diff --git a/.gitmodules b/.gitmodules index d54ac076a..518fc5e9d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,18 @@ [submodule "project/jni/application/NewRAW"] path = project/jni/application/NewRAW - url = https://github.com/usineur/android-newraw.git + url = git@github.com:usineur/android-newraw.git [submodule "project/jni/boost/src"] path = project/jni/boost/src - url = git://github.com/pelya/Boost-for-Android.git + url = git@github.com:pelya/Boost-for-Android.git [submodule "project/jni/application/commandergenius/commandergenius"] path = project/jni/application/commandergenius/commandergenius - url = git://github.com/gerstrong/Commander-Genius.git + url = git@github.com:gerstrong/Commander-Genius.git [submodule "project/jni/application/gemrb-sdl-1.3/gemrb"] path = project/jni/application/gemrb-sdl-1.3/gemrb url = git://gemrb.git.sourceforge.net/gitroot/gemrb/gemrb [submodule "project/jni/application/frogatto"] path = project/jni/application/frogatto - url = https://github.com/frogatto/frogatto.git + url = git@github.com:frogatto/frogatto.git [submodule "project/jni/application/ufoai/ufoai"] path = project/jni/application/ufoai/ufoai url = git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai @@ -21,13 +21,13 @@ url = git://gemrb.git.sourceforge.net/gitroot/gemrb/gemrb [submodule "project/jni/application/openarena/engine"] path = project/jni/application/openarena/engine - url = https://github.com/pelya/openarena-engine.git + url = git@github.com:pelya/openarena-engine.git [submodule "project/jni/application/scummvm/scummvm"] path = project/jni/application/scummvm/scummvm - url = https://github.com/scummvm/scummvm.git + url = git@github.com:scummvm/scummvm.git [submodule "project/jni/application/openarena/vm"] path = project/jni/application/openarena/vm - url = https://github.com/pelya/openarena-vm + url = git@github.com:pelya/openarena-vm [submodule "project/jni/application/teeworlds/src"] path = project/jni/application/teeworlds/src - url = https://github.com/pelya/teeworlds.git + url = git@github.com:pelya/teeworlds.git diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 6ecd3f454..863684820 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -1,6 +1,6 @@ #!/bin/sh -CHANGE_APP_SETTINGS_VERSION=17 +CHANGE_APP_SETTINGS_VERSION=19 AUTO= CHANGED= @@ -13,9 +13,9 @@ fi . ./AndroidAppSettings.cfg -#if [ "$CHANGE_APP_SETTINGS_VERSION" != "$AppSettingVersion" ]; then -# AUTO= -#fi +if [ "$CHANGE_APP_SETTINGS_VERSION" != "$AppSettingVersion" ]; then + CHANGED=1 +fi var="" @@ -56,7 +56,7 @@ fi if [ -z "$ScreenOrientation" -o -z "$AUTO" ]; then echo -echo -n "Specify screen orientation: (v)ertical or (h)orizontal ($ScreenOrientation): " +echo -n "Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ($ScreenOrientation): " read var if [ -n "$var" ] ; then ScreenOrientation="$var" @@ -319,8 +319,7 @@ fi if [ -z "$AppUsesJoystick" -o -z "$AUTO" ]; then echo -echo "Application uses joystick (y) or (n), the on-screen DPAD will be used" -echo -n " as joystick 0 axes 0-1, you will also need to set AppNeedsArrowKeys=y ($AppUsesJoystick): " +echo -n "Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 ($AppUsesJoystick): " read var if [ -n "$var" ] ; then AppUsesJoystick="$var" @@ -328,6 +327,20 @@ if [ -n "$var" ] ; then fi fi +if [ "$AppUsesJoystick" = "y" ]; then +if [ -z "$AppUsesSecondJoystick" -o -z "$AUTO" ]; then +echo +echo -n "Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) ($AppUsesSecondJoystick): " +read var +if [ -n "$var" ] ; then + AppUsesSecondJoystick="$var" + CHANGED=1 +fi +fi +else +AppUsesSecondJoystick=n +fi + if [ -z "$AppUsesAccelerometer" -o -z "$AUTO" ]; then echo echo -n "Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 ($AppUsesAccelerometer): " @@ -375,7 +388,8 @@ if [ -z "$NonBlockingSwapBuffers" -o -z "$AUTO" ]; then echo echo "Application implements Android-specific routines to put to background, and will not draw anything to screen" echo "between SDL_ACTIVEEVENT lost / gained notifications - you should check for them" -echo -n "rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) ($NonBlockingSwapBuffers): " +echo "rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background" +echo -n "This option is reported to be buggy, sometimes failing to restore video state (y) or (n) ($NonBlockingSwapBuffers): " read var if [ -n "$var" ] ; then NonBlockingSwapBuffers="$var" @@ -385,8 +399,7 @@ fi if [ -z "$InhibitSuspend" -o -z "$AUTO" ]; then echo -echo "Prevent device from going to sleep while application is running (y) or (n) - this setting is" -echo -n "applied automatically if you're using accelerometer, but may be useful for video players etc ($InhibitSuspend): " +echo -n "Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer ($InhibitSuspend): " read var if [ -n "$var" ] ; then InhibitSuspend="$var" @@ -412,7 +425,7 @@ fi if [ -z "$AppTouchscreenKeyboardKeysAmount" -o -z "$AUTO" ]; then echo -echo -n "Number of virtual keyboard keys (currently 7 is maximum) ($AppTouchscreenKeyboardKeysAmount): " +echo -n "Number of virtual keyboard keys (currently 6 is maximum) ($AppTouchscreenKeyboardKeysAmount): " read var if [ -n "$var" ] ; then AppTouchscreenKeyboardKeysAmount="$var" @@ -472,10 +485,15 @@ if [ -n "$var" ] ; then fi fi +MenuOptionsAvailable= +for FF in Menu MenuMisc MenuMouse MenuKeyboard ; do + MenuOptionsAvailable1=`grep 'extends Menu' project/java/Settings$FF.java | sed "s/.* class \(.*\) extends .*/Settings$FF.\1/" | tr '\n' ' '` + MenuOptionsAvailable="$MenuOptionsAvailable $MenuOptionsAvailable1" +done if [ -z "$AUTO" ]; then echo echo "Menu items to hide from startup menu, available menu items:" -echo `grep 'extends Menu' project/java/Settings.java | sed 's/.* class \(.*\) extends .*/\1/'` +echo "$MenuOptionsAvailable" echo "($HiddenMenuOptions)" echo -n ": " read var @@ -485,13 +503,13 @@ if [ -n "$var" ] ; then fi fi -FirstStartMenuOptionsDefault='new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode ? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration()' +FirstStartMenuOptionsDefault='new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()' if [ -z "$AUTO" ]; then echo -echo "Menu items to show at startup - this is Java code snippet, leave empty for default" -echo $FirstStartMenuOptionsDefault +echo "Menu items to show at startup - this is Java code snippet, leave empty for default:" +echo "$FirstStartMenuOptionsDefault" echo "Available menu items:" -echo `grep 'extends Menu' project/java/Settings.java | sed 's/.* class \(.*\) extends .*/new Settings.\1(), /'` +echo "$MenuOptionsAvailable" echo "Current value: " "$FirstStartMenuOptions" echo -n ": " read var @@ -630,7 +648,7 @@ fi if [ -z "$AUTO" ]; then echo echo "Here you may type readme text, which will be shown during startup. Format is:" -echo "Text in English, use \\n to separate lines" +echo "Text in English, use \\\\n to separate lines (that's four backslashes, nice isn't it?)" echo "de:Text in Deutsch" echo "ru:Text in Russian, and so on" echo @@ -707,67 +725,220 @@ echo if [ -n "$CHANGED" ]; then cat /dev/null > AndroidAppSettings.cfg echo "# The application settings for Android libSDL port" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg echo AppSettingVersion=$CHANGE_APP_SETTINGS_VERSION >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2)" >> AndroidAppSettings.cfg echo LibSdlVersion=$LibSdlVersion >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Specify application name (e.x. My Application)" >> AndroidAppSettings.cfg echo AppName=\"$AppName\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Specify reversed site name of application (e.x. com.mysite.myapp)" >> AndroidAppSettings.cfg echo AppFullName=$AppFullName >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape" >> AndroidAppSettings.cfg echo ScreenOrientation=$ScreenOrientation >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer" >> AndroidAppSettings.cfg echo InhibitSuspend=$InhibitSuspend >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'" >> AndroidAppSettings.cfg +echo "# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu" >> AndroidAppSettings.cfg +echo "# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped" >> AndroidAppSettings.cfg +echo "# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -" >> AndroidAppSettings.cfg +echo "# these files are put inside .apk package by build system" >> AndroidAppSettings.cfg +echo "# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS" >> AndroidAppSettings.cfg echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only" >> AndroidAppSettings.cfg +echo "# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)" >> AndroidAppSettings.cfg echo VideoDepthBpp=$VideoDepthBpp >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)" >> AndroidAppSettings.cfg echo NeedDepthBuffer=$NeedDepthBuffer >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)" >> AndroidAppSettings.cfg echo NeedStencilBuffer=$NeedStencilBuffer >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device" >> AndroidAppSettings.cfg +echo "# you need this option only if you're developing 3-d app (y) or (n)" >> AndroidAppSettings.cfg echo NeedGles2=$NeedGles2 >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL," >> AndroidAppSettings.cfg +echo "# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)" >> AndroidAppSettings.cfg echo SwVideoMode=$SwVideoMode >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application video output will be resized to fit into native device screen (y)/(n)" >> AndroidAppSettings.cfg echo SdlVideoResize=$SdlVideoResize >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)" >> AndroidAppSettings.cfg echo SdlVideoResizeKeepAspect=$SdlVideoResizeKeepAspect >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -" >> AndroidAppSettings.cfg +echo "# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)" >> AndroidAppSettings.cfg echo CompatibilityHacks=$CompatibilityHacks >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)" >> AndroidAppSettings.cfg echo CompatibilityHacksStaticInit=$CompatibilityHacksStaticInit >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)" >> AndroidAppSettings.cfg echo CompatibilityHacksTextInputEmulatesHwKeyboard=$CompatibilityHacksTextInputEmulatesHwKeyboard >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)" >> AndroidAppSettings.cfg echo CompatibilityHacksPreventAudioChopping=$CompatibilityHacksPreventAudioChopping >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)" >> AndroidAppSettings.cfg echo CompatibilityHacksAppIgnoresAudioBufferSize=$CompatibilityHacksAppIgnoresAudioBufferSize >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Hack for VCMI: preload additional shared libraries before aplication start" >> AndroidAppSettings.cfg echo CompatibilityHacksAdditionalPreloadedSharedLibraries=\"$CompatibilityHacksAdditionalPreloadedSharedLibraries\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -" >> AndroidAppSettings.cfg +echo "# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)" >> AndroidAppSettings.cfg echo CompatibilityHacksSlowCompatibleEventQueue=$CompatibilityHacksSlowCompatibleEventQueue >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL" >> AndroidAppSettings.cfg echo CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=$CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user" >> AndroidAppSettings.cfg echo AppUsesMouse=$AppUsesMouse >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)" >> AndroidAppSettings.cfg echo AppNeedsTwoButtonMouse=$AppNeedsTwoButtonMouse >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)" >> AndroidAppSettings.cfg echo ShowMouseCursor=$ShowMouseCursor >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)" >> AndroidAppSettings.cfg echo ForceRelativeMouseMode=$ForceRelativeMouseMode >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n)" >> AndroidAppSettings.cfg echo AppNeedsArrowKeys=$AppNeedsArrowKeys >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application needs text input (y) or (n), enables button for text input on screen" >> AndroidAppSettings.cfg echo AppNeedsTextInput=$AppNeedsTextInput >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1" >> AndroidAppSettings.cfg echo AppUsesJoystick=$AppUsesJoystick >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)" >> AndroidAppSettings.cfg +echo AppUsesSecondJoystick=$AppUsesSecondJoystick >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7" >> AndroidAppSettings.cfg echo AppUsesAccelerometer=$AppUsesAccelerometer >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4" >> AndroidAppSettings.cfg echo AppUsesGyroscope=$AppUsesGyroscope >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0" >> AndroidAppSettings.cfg echo AppUsesMultitouch=$AppUsesMultitouch >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application records audio (it will use any available source, such a s microphone)" >> AndroidAppSettings.cfg +echo "# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);" >> AndroidAppSettings.cfg +echo "# This option will add additional permission to Android manifest (y)/(n)" >> AndroidAppSettings.cfg echo AppRecordsAudio=$AppRecordsAudio >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application implements Android-specific routines to put to background, and will not draw anything to screen" >> AndroidAppSettings.cfg +echo "# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them" >> AndroidAppSettings.cfg +echo "# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)" >> AndroidAppSettings.cfg +echo "# This option is reported to be buggy, sometimes failing to restore video state" >> AndroidAppSettings.cfg echo NonBlockingSwapBuffers=$NonBlockingSwapBuffers >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Redefine common hardware keys to SDL keysyms" >> AndroidAppSettings.cfg +echo "# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent" >> AndroidAppSettings.cfg +echo "# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices" >> AndroidAppSettings.cfg +echo "# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)" >> AndroidAppSettings.cfg +echo "# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA" >> AndroidAppSettings.cfg echo RedefinedKeys=\"$RedefinedKeys\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Number of virtual keyboard keys (currently 6 is maximum)" >> AndroidAppSettings.cfg echo AppTouchscreenKeyboardKeysAmount=$AppTouchscreenKeyboardKeysAmount >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Number of virtual keyboard keys that support autofire (currently 2 is maximum)" >> AndroidAppSettings.cfg echo AppTouchscreenKeyboardKeysAmountAutoFire=$AppTouchscreenKeyboardKeysAmountAutoFire >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)" >> AndroidAppSettings.cfg echo RedefinedKeysScreenKb=\"$RedefinedKeysScreenKb\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu" >> AndroidAppSettings.cfg echo RedefinedKeysScreenKbNames=\"$RedefinedKeysScreenKbNames\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# How long to show startup menu button, in msec, 0 to disable startup menu" >> AndroidAppSettings.cfg echo StartupMenuButtonTimeout=$StartupMenuButtonTimeout >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Menu items to hide from startup menu, available menu items:" >> AndroidAppSettings.cfg +echo "# $MenuOptionsAvailable" >> AndroidAppSettings.cfg echo HiddenMenuOptions=\'$HiddenMenuOptions\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Menu items to show at startup - this is Java code snippet, leave empty for default" >> AndroidAppSettings.cfg +echo "# $FirstStartMenuOptionsDefault" >> AndroidAppSettings.cfg +echo "# Available menu items:" >> AndroidAppSettings.cfg +echo "# $MenuOptionsAvailable" >> AndroidAppSettings.cfg echo FirstStartMenuOptions=\'$FirstStartMenuOptions\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices," >> AndroidAppSettings.cfg +echo "# but .apk size is 2x bigger (y) / (n) / (x86) / (all)" >> AndroidAppSettings.cfg echo MultiABI=$MultiABI >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower" >> AndroidAppSettings.cfg echo AppMinimumRAM=$AppMinimumRAM >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application version code (integer)" >> AndroidAppSettings.cfg echo AppVersionCode=$AppVersionCode >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application user-visible version name (string)" >> AndroidAppSettings.cfg echo AppVersionName=\"$AppVersionName\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Reset SDL config when updating application to the new version (y) / (n)" >> AndroidAppSettings.cfg echo ResetSdlConfigForThisVersion=$ResetSdlConfigForThisVersion >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Delete application data files when upgrading (specify file/dir paths separated by spaces)" >> AndroidAppSettings.cfg echo DeleteFilesOnUpgrade=\"$DeleteFilesOnUpgrade\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Optional shared libraries to compile - removing some of them will save space" >> AndroidAppSettings.cfg +echo "# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed" >> AndroidAppSettings.cfg +grep 'Available' project/jni/SettingsTemplate.mk >> AndroidAppSettings.cfg echo CompiledLibraries=\"$CompiledLibraries\" >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)" >> AndroidAppSettings.cfg echo CustomBuildScript=$CustomBuildScript >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Aditional CFLAGS for application" >> AndroidAppSettings.cfg echo AppCflags=\'$AppCflags\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Additional LDFLAGS for application" >> AndroidAppSettings.cfg echo AppLdflags=\'$AppLdflags\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable" >> AndroidAppSettings.cfg echo AppOverlapsSystemHeaders=$AppOverlapsSystemHeaders >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Build only following subdirs (empty will build all dirs, ignored with custom script)" >> AndroidAppSettings.cfg echo AppSubdirsBuild=\'$AppSubdirsBuild\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Exclude these files from build" >> AndroidAppSettings.cfg echo AppBuildExclude=\'$AppBuildExclude\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Application command line parameters, including app name as 0-th param" >> AndroidAppSettings.cfg echo AppCmdline=\'$AppCmdline\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Here you may type readme text, which will be shown during startup. Format is:" >> AndroidAppSettings.cfg +echo "# Text in English, use \\\\\\\\\\\\\\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?)" >> AndroidAppSettings.cfg echo ReadmeText=\'$ReadmeText\' >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens" >> AndroidAppSettings.cfg +echo "# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge" >> AndroidAppSettings.cfg echo MinimumScreenSize=$MinimumScreenSize >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Your AdMob Publisher ID, (n) if you don't want advertisements" >> AndroidAppSettings.cfg echo AdmobPublisherId=$AdmobPublisherId >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Your AdMob test device ID, to receive a test ad" >> AndroidAppSettings.cfg echo AdmobTestDeviceId=$AdmobTestDeviceId >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER)" >> AndroidAppSettings.cfg echo AdmobBannerSize=$AdmobBannerSize >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg fi AppShortName=`echo $AppName | sed 's/ //g'` @@ -782,7 +953,7 @@ if [ "$LibSdlVersion" = "1.3" ] ; then UsingSdl13=true fi -if [ "$ScreenOrientation" = "h" ] ; then +if [ "$ScreenOrientation" = "h" -o "$ScreenOrientation" = "l" ] ; then ScreenOrientation1=landscape HorizontalOrientation=true fi @@ -915,6 +1086,12 @@ else AppUsesJoystick=false fi +if [ "$AppUsesSecondJoystick" = "y" ] ; then + AppUsesSecondJoystick=true +else + AppUsesSecondJoystick=false +fi + if [ "$AppUsesAccelerometer" = "y" ] ; then AppUsesAccelerometer=true else @@ -985,12 +1162,17 @@ fi HiddenMenuOptions1="" for F in $HiddenMenuOptions; do - HiddenMenuOptions1="$HiddenMenuOptions1 new Settings.$F()," + HiddenMenuOptions1="$HiddenMenuOptions1 new $F()," done -if [ -z "$FirstStartMenuOptions" ]; then - FirstStartMenuOptions="$FirstStartMenuOptionsDefault" -fi +FirstStartMenuOptions1="" +for F in $FirstStartMenuOptions; do + FirstStartMenuOptions1="$FirstStartMenuOptions1 new $F()," +done + +#if [ -z "$FirstStartMenuOptions" ]; then +# FirstStartMenuOptions="$FirstStartMenuOptionsDefault" +#fi ReadmeText="`echo $ReadmeText | sed 's/\"/\\\\\\\\\"/g' | sed 's/[&%]//g'`" @@ -1075,6 +1257,7 @@ $SEDI "s/public static boolean ShowMouseCursor = .*;/public static boolean ShowM $SEDI "s/public static boolean AppNeedsArrowKeys = .*;/public static boolean AppNeedsArrowKeys = $AppNeedsArrowKeys;/" project/src/Globals.java $SEDI "s/public static boolean AppNeedsTextInput = .*;/public static boolean AppNeedsTextInput = $AppNeedsTextInput;/" project/src/Globals.java $SEDI "s/public static boolean AppUsesJoystick = .*;/public static boolean AppUsesJoystick = $AppUsesJoystick;/" project/src/Globals.java +$SEDI "s/public static boolean AppUsesSecondJoystick = .*;/public static boolean AppUsesSecondJoystick = $AppUsesSecondJoystick;/" project/src/Globals.java $SEDI "s/public static boolean AppUsesAccelerometer = .*;/public static boolean AppUsesAccelerometer = $AppUsesAccelerometer;/" project/src/Globals.java $SEDI "s/public static boolean AppUsesGyroscope = .*;/public static boolean AppUsesGyroscope = $AppUsesGyroscope;/" project/src/Globals.java $SEDI "s/public static boolean AppUsesMultitouch = .*;/public static boolean AppUsesMultitouch = $AppUsesMultitouch;/" project/src/Globals.java @@ -1086,8 +1269,8 @@ $SEDI "s/public static int AppTouchscreenKeyboardKeysAmountAutoFire = .*;/public $SEDI "s@public static String\\[\\] AppTouchscreenKeyboardKeysNames = .*;@public static String[] AppTouchscreenKeyboardKeysNames = \"$RedefinedKeysScreenKbNames\".split(\" \");@" project/src/Globals.java $SEDI "s/public static int StartupMenuButtonTimeout = .*;/public static int StartupMenuButtonTimeout = $StartupMenuButtonTimeout;/" project/src/Globals.java $SEDI "s/public static int AppMinimumRAM = .*;/public static int AppMinimumRAM = $AppMinimumRAM;/" project/src/Globals.java -$SEDI "s/public static Settings.Menu HiddenMenuOptions .*;/public static Settings.Menu HiddenMenuOptions [] = { $HiddenMenuOptions1 };/" project/src/Globals.java -$SEDI "s@public static Settings.Menu FirstStartMenuOptions .*;@public static Settings.Menu FirstStartMenuOptions [] = { $FirstStartMenuOptions };@" project/src/Globals.java +$SEDI "s/public static SettingsMenu.Menu HiddenMenuOptions .*;/public static SettingsMenu.Menu HiddenMenuOptions [] = { $HiddenMenuOptions1 };/" project/src/Globals.java +[ -n "$FirstStartMenuOptions1" ] && $SEDI "s@public static SettingsMenu.Menu FirstStartMenuOptions .*;@public static SettingsMenu.Menu FirstStartMenuOptions [] = { $FirstStartMenuOptions1 };@" project/src/Globals.java $SEDI "s%public static String ReadmeText = .*%public static String ReadmeText = \"$ReadmeText\";%" project/src/Globals.java $SEDI "s%public static String CommandLine = .*%public static String CommandLine = \"$AppCmdline\";%" project/src/Globals.java $SEDI "s/public static String AdmobPublisherId = .*/public static String AdmobPublisherId = \"$AdmobPublisherId\";/" project/src/Globals.java @@ -1095,6 +1278,7 @@ $SEDI "s/public static String AdmobTestDeviceId = .*/public static String AdmobT $SEDI "s/public static String AdmobBannerSize = .*/public static String AdmobBannerSize = \"$AdmobBannerSize\";/" project/src/Globals.java $SEDI "s/public static String AppLibraries.*/public static String AppLibraries[] = { $LibrariesToLoad };/" project/src/Globals.java + echo Patching project/jni/Settings.mk echo '# DO NOT EDIT THIS FILE - it is automatically generated, edit file SettingsTemplate.mk' > project/jni/Settings.mk cat project/jni/SettingsTemplate.mk | \ diff --git a/project/java/Accelerometer.java b/project/java/Accelerometer.java index 0e054aecf..978020850 100644 --- a/project/java/Accelerometer.java +++ b/project/java/Accelerometer.java @@ -33,7 +33,7 @@ import android.hardware.SensorManager; import android.hardware.SensorEventListener; import android.hardware.Sensor; import android.hardware.SensorEvent; - +import android.util.Log; import android.widget.TextView; @@ -53,7 +53,7 @@ class AccelerometerReader implements SensorEventListener { if( _manager != null ) { - System.out.println("libSDL: stopping accelerometer/gyroscope"); + Log.i("SDL", "libSDL: stopping accelerometer/gyroscope"); _manager.unregisterListener(this); _manager.unregisterListener(gyro); } @@ -64,12 +64,12 @@ class AccelerometerReader implements SensorEventListener if( (Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) && _manager != null && _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null ) { - System.out.println("libSDL: starting accelerometer"); + Log.i("SDL", "libSDL: starting accelerometer"); _manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME); } if( Globals.AppUsesGyroscope && _manager != null && _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null ) { - System.out.println("libSDL: starting gyroscope"); + Log.i("SDL", "libSDL: starting gyroscope"); _manager.registerListener(gyro, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME); } } diff --git a/project/java/Audio.java b/project/java/Audio.java index e14b215b8..94ae6f427 100644 --- a/project/java/Audio.java +++ b/project/java/Audio.java @@ -173,7 +173,7 @@ class AudioThread } if( !mRecordThread.isStopped() ) { - System.out.println("SDL: error: application already opened audio recording device"); + Log.i("SDL", "SDL: error: application already opened audio recording device"); return null; } @@ -186,7 +186,7 @@ class AudioThread int minBufDevice = AudioRecord.getMinBufferSize(rate, channelConfig, encodingConfig); int minBufferSize = Math.max(bufsize * 8, minBufDevice + (bufsize - (minBufDevice % bufsize))); - System.out.println("SDL: app opened recording device, rate " + rate + " channels " + channels + " sample size " + (encoding+1) + " bufsize " + bufsize + " internal bufsize " + minBufferSize); + Log.i("SDL", "SDL: app opened recording device, rate " + rate + " channels " + channels + " sample size " + (encoding+1) + " bufsize " + bufsize + " internal bufsize " + minBufferSize); if( mRecorder == null || mRecorder.getSampleRate() != rate || mRecorder.getChannelCount() != channels || mRecorder.getAudioFormat() != encodingConfig || @@ -199,13 +199,13 @@ class AudioThread mRecorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, encodingConfig, minBufferSize); mRecorderBufferSize = minBufferSize; } catch (IllegalArgumentException e) { - System.out.println("SDL: error: failed to open recording device!"); + Log.i("SDL", "SDL: error: failed to open recording device!"); return null; } } else { - System.out.println("SDL: reusing old recording device"); + Log.i("SDL", "SDL: reusing old recording device"); } mRecordThread.startRecording(); return mRecordThread.mRecordBuffer; @@ -215,11 +215,11 @@ class AudioThread { if( mRecordThread == null || mRecordThread.isStopped() ) { - System.out.println("SDL: error: application already closed audio recording device"); + Log.i("SDL", "SDL: error: application already closed audio recording device"); return; } mRecordThread.stopRecording(); - System.out.println("SDL: app closed recording device"); + Log.i("SDL", "SDL: app closed recording device"); } private class RecordingThread extends Thread @@ -261,9 +261,9 @@ class AudioThread } else { - //System.out.println("SDL: nativeAudioRecordCallback with len " + mRecordBuffer.length); + //Log.i("SDL", "SDL: nativeAudioRecordCallback with len " + mRecordBuffer.length); nativeAudioRecordCallback(); - //System.out.println("SDL: nativeAudioRecordCallback returned"); + //Log.i("SDL", "SDL: nativeAudioRecordCallback returned"); } } diff --git a/project/java/DataDownloader.java b/project/java/DataDownloader.java index e5ddf398f..99b786b3a 100644 --- a/project/java/DataDownloader.java +++ b/project/java/DataDownloader.java @@ -228,7 +228,7 @@ class DataDownloader extends Thread String [] downloadUrls = DataDownloadUrl.split("[|]"); if( downloadUrls.length < 2 ) { - System.out.println("Error: download string invalid: '" + DataDownloadUrl + "', your AndroidAppSettigns.cfg is broken"); + Log.i("SDL", "Error: download string invalid: '" + DataDownloadUrl + "', your AndroidAppSettigns.cfg is broken"); Status.setText( res.getString(R.string.error_dl_from, DataDownloadUrl) ); return false; } @@ -249,14 +249,14 @@ class DataDownloader extends Thread if( readed > 0 ) compare = new String( b, 0, readed, "UTF-8" ); boolean matched = false; - //System.out.println("Read URL: '" + compare + "'"); + //Log.i("SDL", "Read URL: '" + compare + "'"); for( int i = 1; i < downloadUrls.length; i++ ) { - //System.out.println("Comparing: '" + downloadUrls[i] + "'"); + //Log.i("SDL", "Comparing: '" + downloadUrls[i] + "'"); if( compare.compareTo(downloadUrls[i]) == 0 ) matched = true; } - //System.out.println("Matched: " + String.valueOf(matched)); + //Log.i("SDL", "Matched: " + String.valueOf(matched)); if( ! matched ) throw new IOException(); Status.setText( res.getString(R.string.download_unneeded) ); @@ -269,7 +269,7 @@ class DataDownloader extends Thread checkFile = null; // Create output directory (not necessary for phone storage) - System.out.println("Downloading data to: '" + outFilesDir + "'"); + Log.i("SDL", "Downloading data to: '" + outFilesDir + "'"); try { File outDir = new File( outFilesDir ); if( !(outDir.exists() && outDir.isDirectory()) ) @@ -295,7 +295,7 @@ class DataDownloader extends Thread int downloadUrlIndex = 1; while( downloadUrlIndex < downloadUrls.length ) { - System.out.println("Processing download " + downloadUrls[downloadUrlIndex]); + Log.i("SDL", "Processing download " + downloadUrls[downloadUrlIndex]); url = new String(downloadUrls[downloadUrlIndex]); DoNotUnzip = false; if(url.indexOf(":") == 0) @@ -320,35 +320,37 @@ class DataDownloader extends Thread stream1 = Parent.getAssets().open(url + "00"); stream1.close(); } catch( Exception ee ) { - System.out.println("Failed to open file in assets: " + url); + Log.i("SDL", "Failed to open file in assets: " + url); downloadUrlIndex++; continue; } } FileInAssets = true; - System.out.println("Fetching file from assets: " + url); + Log.i("SDL", "Fetching file from assets: " + url); break; } else { - System.out.println("Connecting to: " + url); + Log.i("SDL", "Connecting to: " + url); request = new HttpGet(url); request.addHeader("Accept", "*/*"); - if( partialDownloadLen > 0 ) + if( partialDownloadLen > 0 ) { request.addHeader("Range", "bytes=" + partialDownloadLen + "-"); + Log.i("SDL", "Trying to resume download at pos " + partialDownloadLen); + } try { DefaultHttpClient client = HttpWithDisabledSslCertCheck(); client.getParams().setBooleanParameter("http.protocol.handle-redirects", true); response = client.execute(request); } catch (IOException e) { - System.out.println("Failed to connect to " + url); + Log.i("SDL", "Failed to connect to " + url); downloadUrlIndex++; }; if( response != null ) { if( response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 206 ) { - System.out.println("Failed to connect to " + url + " with error " + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase()); + Log.i("SDL", "Failed to connect to " + url + " with error " + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase()); responseError = response; response = null; downloadUrlIndex++; @@ -376,7 +378,7 @@ class DataDownloader extends Thread multipart = s; else multipart = new SequenceInputStream(multipart, s); - System.out.println("Multipart archive found: " + url1); + Log.i("SDL", "Multipart archive found: " + url1); } catch( IOException e ) { break; } @@ -393,7 +395,7 @@ class DataDownloader extends Thread stream.close(); stream = new CountingInputStream(Parent.getAssets().open(url), 8192); } catch( IOException e ) { - System.out.println("Unpacking from assets '" + url + "' - error: " + e.toString()); + Log.i("SDL", "Unpacking from assets '" + url + "' - error: " + e.toString()); Status.setText( res.getString(R.string.error_dl_from, url) ); return false; } @@ -403,7 +405,7 @@ class DataDownloader extends Thread { if( response == null ) { - System.out.println("Error connecting to " + url); + Log.i("SDL", "Error connecting to " + url); Status.setText( res.getString(R.string.failed_connecting_to, url) + (responseError == null ? "" : ": " + responseError.getStatusLine().getStatusCode() + " " + responseError.getStatusLine().getReasonPhrase()) ); return false; } @@ -420,7 +422,7 @@ class DataDownloader extends Thread if(DoNotUnzip) { - System.out.println("Saving file '" + path + "'"); + Log.i("SDL", "Saving file '" + path + "'"); OutputStream out = null; try { try { @@ -435,14 +437,16 @@ class DataDownloader extends Thread Header[] range = response.getHeaders("Content-Range"); if( range.length > 0 && range[0].getValue().indexOf("bytes") == 0 ) { - //System.out.println("Resuming download of file '" + path + "': Content-Range: " + range[0].getValue()); + //Log.i("SDL", "Resuming download of file '" + path + "': Content-Range: " + range[0].getValue()); String[] skippedBytes = range[0].getValue().split("/")[0].split("-")[0].split(" "); if( skippedBytes.length >= 2 && Long.parseLong(skippedBytes[1]) == partialDownloadLen ) { out = new FileOutputStream( path, true ); - System.out.println("Resuming download of file '" + path + "' at pos " + partialDownloadLen); + Log.i("SDL", "Resuming download of file '" + path + "' at pos " + partialDownloadLen); } } + else + Log.i("SDL", "Server does not support partial downloads. " + (range.length == 0 ? "" : range[0].getValue())); } catch (Exception e) { } } if( out == null ) @@ -451,14 +455,14 @@ class DataDownloader extends Thread partialDownloadLen = 0; } } catch( FileNotFoundException e ) { - System.out.println("Saving file '" + path + "' - error creating output file: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString()); } catch( SecurityException e ) { - System.out.println("Saving file '" + path + "' - error creating output file: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString()); }; if( out == null ) { Status.setText( res.getString(R.string.error_write, path) ); - System.out.println("Saving file '" + path + "' - error creating output file"); + Log.i("SDL", "Saving file '" + path + "' - error creating output file"); return false; } @@ -480,14 +484,14 @@ class DataDownloader extends Thread out = null; } catch( java.io.IOException e ) { Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() ); - System.out.println("Saving file '" + path + "' - error writing: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - error writing: " + e.toString()); return false; } - System.out.println("Saving file '" + path + "' done"); + Log.i("SDL", "Saving file '" + path + "' done"); } else { - System.out.println("Reading from zip file '" + url + "'"); + Log.i("SDL", "Reading from zip file '" + url + "'"); ZipInputStream zip = new ZipInputStream(stream); while(true) @@ -496,20 +500,20 @@ class DataDownloader extends Thread try { entry = zip.getNextEntry(); if( entry != null ) - System.out.println("Reading from zip file '" + url + "' entry '" + entry.getName() + "'"); + Log.i("SDL", "Reading from zip file '" + url + "' entry '" + entry.getName() + "'"); } catch( java.io.IOException e ) { Status.setText( res.getString(R.string.error_dl_from, url) ); - System.out.println("Error reading from zip file '" + url + "': " + e.toString()); + Log.i("SDL", "Error reading from zip file '" + url + "': " + e.toString()); return false; } if( entry == null ) { - System.out.println("Reading from zip file '" + url + "' finished"); + Log.i("SDL", "Reading from zip file '" + url + "' finished"); break; } if( entry.isDirectory() ) { - System.out.println("Creating dir '" + getOutFilePath(entry.getName()) + "'"); + Log.i("SDL", "Creating dir '" + getOutFilePath(entry.getName()) + "'"); try { File outDir = new File( getOutFilePath(entry.getName()) ); if( !(outDir.exists() && outDir.isDirectory()) ) @@ -522,7 +526,7 @@ class DataDownloader extends Thread path = getOutFilePath(entry.getName()); float percent = 0.0f; - System.out.println("Saving file '" + path + "'"); + Log.i("SDL", "Saving file '" + path + "'"); try { File outDir = new File( path.substring(0, path.lastIndexOf("/") )); @@ -540,7 +544,7 @@ class DataDownloader extends Thread ff.delete(); throw new Exception(); } - System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it"); + Log.i("SDL", "File '" + path + "' exists and passed CRC check - not overwriting it"); if( totalLen > 0 ) percent = stream.getBytesRead() * 100.0f / totalLen; Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) ); @@ -550,14 +554,14 @@ class DataDownloader extends Thread try { out = new FileOutputStream( path ); } catch( FileNotFoundException e ) { - System.out.println("Saving file '" + path + "' - cannot create file: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString()); } catch( SecurityException e ) { - System.out.println("Saving file '" + path + "' - cannot create file: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString()); }; if( out == null ) { Status.setText( res.getString(R.string.error_write, path) ); - System.out.println("Saving file '" + path + "' - cannot create file"); + Log.i("SDL", "Saving file '" + path + "' - cannot create file"); return false; } @@ -583,7 +587,7 @@ class DataDownloader extends Thread out = null; } catch( java.io.IOException e ) { Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() ); - System.out.println("Saving file '" + path + "' - error writing or downloading: " + e.toString()); + Log.i("SDL", "Saving file '" + path + "' - error writing or downloading: " + e.toString()); return false; } @@ -600,7 +604,7 @@ class DataDownloader extends Thread { File ff = new File(path); ff.delete(); - System.out.println("Saving file '" + path + "' - CRC check failed, ZIP: " + + Log.i("SDL", "Saving file '" + path + "' - CRC check failed, ZIP: " + String.format("%x", entry.getCrc()) + " actual file: " + String.format("%x", check.getChecksum().getValue()) + " file size in ZIP: " + entry.getSize() + " actual size " + count ); throw new Exception(); @@ -609,7 +613,7 @@ class DataDownloader extends Thread Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() ); return false; } - System.out.println("Saving file '" + path + "' done"); + Log.i("SDL", "Saving file '" + path + "' done"); } }; @@ -682,7 +686,7 @@ class DataDownloader extends Thread } - public class BackKeyListener implements Settings.KeyEventsListener + public class BackKeyListener implements MainActivity.KeyEventsListener { MainActivity p; public BackKeyListener(MainActivity _p) diff --git a/project/java/GLSurfaceView_SDL.java b/project/java/GLSurfaceView_SDL.java index a0c6c4cba..998bf1c5c 100644 --- a/project/java/GLSurfaceView_SDL.java +++ b/project/java/GLSurfaceView_SDL.java @@ -37,6 +37,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; +import android.app.KeyguardManager; /** * An implementation of SurfaceView that uses the dedicated surface for @@ -698,15 +699,18 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call EGL10.EGL_NATIVE_RENDERABLE, 0); int caveat = findConfigAttrib(egl, display, config, EGL10.EGL_CONFIG_CAVEAT, EGL10.EGL_NONE); - int distance = Math.abs(r - mRedSize) - + Math.abs(g - mGreenSize) - + Math.abs(b - mBlueSize) + Math.abs(a - mAlphaSize); + int distance = Math.abs(r - mRedSize) + Math.abs(g - mGreenSize) + Math.abs(b - mBlueSize); + int dist1 = distance; + if( mAlphaSize - a > 0 ) + distance += mAlphaSize - a; + else if( mAlphaSize - a < 0 ) + distance += 1; // Small penalty if we don't need alpha channel but it is present int dist2 = distance; if( (d > 0) != (mDepthSize > 0) ) distance += (mDepthSize > 0) ? 5 : 1; // Small penalty if we don't need zbuffer but it is present int dist3 = distance; if( (s > 0) != (mStencilSize > 0) ) - distance += (mStencilSize > 0) ? 5 : 1; + distance += (mStencilSize > 0) ? 5 : 1; // Small penalty if we don't need stencil buffer but it is present int dist4 = distance; if( (rendertype & desiredtype) == 0 ) distance += 5; @@ -732,7 +736,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call caveat == EGL10.EGL_NON_CONFORMANT_CONFIG ? "non-conformant" : String.valueOf(caveat))); cfgcur += " nr " + nativeRender; - cfgcur += " pos " + distance + " (" + dist2 + "," + dist3 + "," + dist4 + "," + dist5 + ")"; + cfgcur += " pos " + distance + " (" + dist1 + "," + dist2 + "," + dist3 + "," + dist4 + "," + dist5 + ")"; Log.v("SDL", "GL config " + idx + ": " + cfgcur); if (distance < closestDistance) { closestDistance = distance; @@ -1100,6 +1104,10 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call } private boolean needToWait() { + if (((KeyguardManager)getContext().getSystemService(Context.KEYGUARD_SERVICE)).inKeyguardRestrictedInputMode()) { + return true; // We're in lockscreen - sleep until user unlocks the device + } + if (mDone) { return false; } diff --git a/project/java/Globals.java b/project/java/Globals.java index 373621782..ec38ae368 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -53,6 +53,7 @@ class Globals public static boolean AppNeedsArrowKeys = true; public static boolean AppNeedsTextInput = true; public static boolean AppUsesJoystick = false; + public static boolean AppUsesSecondJoystick = false; public static boolean AppUsesAccelerometer = false; public static boolean AppUsesGyroscope = false; public static boolean AppUsesMultitouch = false; @@ -64,8 +65,8 @@ class Globals public static String[] AppTouchscreenKeyboardKeysNames = "Fire Shoot Switch_weapon Jump Run Hide/Seek".split(" "); public static int StartupMenuButtonTimeout = 3000; public static int AppMinimumRAM = 0; - public static Settings.Menu HiddenMenuOptions [] = {}; - public static Settings.Menu FirstStartMenuOptions [] = { (AppUsesMouse && ! ForceRelativeMouseMode ? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() }; + public static SettingsMenu.Menu HiddenMenuOptions [] = {}; // If you see error here - update HiddenMenuOptions in your AndroidAppSettings.cfg: change OptionalDownloadConfig to SettingsMenuMisc.OptionalDownloadConfig etc. + public static SettingsMenu.Menu FirstStartMenuOptions [] = { new SettingsMenuMisc.ShowReadme(), (AppUsesMouse && ! ForceRelativeMouseMode ? new SettingsMenuMouse.DisplaySizeConfig() : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(), new SettingsMenuMisc.GyroscopeCalibration() }; public static String AdmobPublisherId = ""; public static String AdmobTestDeviceId = ""; public static String AdmobBannerSize = ""; @@ -77,6 +78,7 @@ class Globals public static boolean UseAccelerometerAsArrowKeys = false; public static boolean UseTouchscreenKeyboard = true; public static int TouchscreenKeyboardSize = 1; + public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4; public static int TouchscreenKeyboardDrawSize = 1; public static int TouchscreenKeyboardTheme = 2; public static int TouchscreenKeyboardTransparency = 2; @@ -104,8 +106,10 @@ class Globals public static int ClickScreenTouchspotSize = 0; public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST]; public static int RemapScreenKbKeycode[] = new int[6]; - public static boolean ScreenKbControlsShown[] = new boolean[8]; /* Also joystick and text input button added */ - public static int ScreenKbControlsLayout[][] = new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } }; // Values for 800x480 resolution + public static int ScreenKbControlsLayout[][] = AppUsesSecondJoystick ? // Values for 800x480 resolution + new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } : + new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } }; + public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */ public static int RemapMultitouchGestureKeycode[] = new int[4]; public static boolean MultitouchGesturesUsed[] = new boolean[4]; public static int MultitouchGestureSensitivity = 1; diff --git a/project/java/Keycodes.java b/project/java/Keycodes.java index e632781ce..15aa6b6e9 100644 --- a/project/java/Keycodes.java +++ b/project/java/Keycodes.java @@ -525,6 +525,16 @@ class SDL_Keys static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h + static String getName(int v) + { + for( int f = 0; f < values.length; f++ ) + { + if( values[f] == v ) + return names[f]; + } + return names[0]; + } + static { ArrayList Names = new ArrayList (); diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index 8c4cdc476..425a9454e 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -74,6 +74,7 @@ import java.util.concurrent.Semaphore; import android.content.pm.ActivityInfo; import android.view.Display; import android.text.InputType; +import android.util.Log; public class MainActivity extends Activity { @@ -93,7 +94,7 @@ public class MainActivity extends Activity getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - System.out.println("libSDL: Creating startup screen"); + Log.i("SDL", "libSDL: Creating startup screen"); _layout = new LinearLayout(this); _layout.setOrientation(LinearLayout.VERTICAL); _layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); @@ -114,9 +115,9 @@ public class MainActivity extends Activity public void onClick(View v) { setUpStatusLabel(); - System.out.println("libSDL: User clicked change phone config button"); + Log.i("SDL", "libSDL: User clicked change phone config button"); loadedLibraries.acquireUninterruptibly(); - Settings.showConfig(p, false); + SettingsMenu.showConfig(p, false); } }; _btn.setOnClickListener(new onClickListener(this)); @@ -164,10 +165,10 @@ public class MainActivity extends Activity if(p.mAudioThread == null) { - System.out.println("libSDL: Loading libraries"); + Log.i("SDL", "libSDL: Loading libraries"); p.LoadLibraries(); p.mAudioThread = new AudioThread(p); - System.out.println("libSDL: Loading settings"); + Log.i("SDL", "libSDL: Loading settings"); final Semaphore loaded = new Semaphore(0); class Callback2 implements Runnable { @@ -191,14 +192,14 @@ public class MainActivity extends Activity { if( Globals.StartupMenuButtonTimeout > 0 ) { - System.out.println("libSDL: " + String.valueOf(Globals.StartupMenuButtonTimeout) + "-msec timeout in startup screen"); + Log.i("SDL", "libSDL: " + String.valueOf(Globals.StartupMenuButtonTimeout) + "-msec timeout in startup screen"); try { Thread.sleep(Globals.StartupMenuButtonTimeout); } catch( InterruptedException e ) {}; } if( Settings.settingsChanged ) return; - System.out.println("libSDL: Timeout reached in startup screen, process with downloader"); + Log.i("SDL", "libSDL: Timeout reached in startup screen, process with downloader"); p.startDownloader(); } } @@ -225,14 +226,14 @@ public class MainActivity extends Activity public void startDownloader() { - System.out.println("libSDL: Starting data downloader"); + Log.i("SDL", "libSDL: Starting data downloader"); class Callback implements Runnable { public MainActivity Parent; public void run() { setUpStatusLabel(); - System.out.println("libSDL: Starting downloader"); + Log.i("SDL", "libSDL: Starting downloader"); if( Parent.downloader == null ) Parent.downloader = new DataDownloader(Parent, Parent._tv); } @@ -251,7 +252,7 @@ public class MainActivity extends Activity //int tries = 30; while( isCurrentOrientationHorizontal() != Globals.HorizontalOrientation ) { - System.out.println("libSDL: Waiting for screen orientation to change - the device is probably in the lockscreen mode"); + Log.i("SDL", "libSDL: Waiting for screen orientation to change - the device is probably in the lockscreen mode"); try { Thread.sleep(500); } catch( Exception e ) {} @@ -259,13 +260,13 @@ public class MainActivity extends Activity tries--; if( tries <= 0 ) { - System.out.println("libSDL: Giving up waiting for screen orientation change"); + Log.i("SDL", "libSDL: Giving up waiting for screen orientation change"); break; } */ if( _isPaused ) { - System.out.println("libSDL: Application paused, cancelling SDL initialization until it will be brought to foreground"); + Log.i("SDL", "libSDL: Application paused, cancelling SDL initialization until it will be brought to foreground"); return; } } @@ -284,12 +285,9 @@ public class MainActivity extends Activity { if(sdlInited) return; - System.out.println("libSDL: Initializing video and SDL application"); + Log.i("SDL", "libSDL: Initializing video and SDL application"); sdlInited = true; - if(Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) - getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, - WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); _videoLayout.removeView(_layout); if( _ad.getView() != null ) _videoLayout.removeView(_ad.getView()); @@ -363,7 +361,7 @@ public class MainActivity extends Activity @Override public void onWindowFocusChanged (boolean hasFocus) { super.onWindowFocusChanged(hasFocus); - System.out.println("libSDL: onWindowFocusChanged: " + hasFocus + " - sending onPause/onResume"); + Log.i("SDL", "libSDL: onWindowFocusChanged: " + hasFocus + " - sending onPause/onResume"); if (hasFocus == false) onPause(); else @@ -396,6 +394,9 @@ public class MainActivity extends Activity if( mGLView != null ) mGLView.exitApp(); super.onDestroy(); + try{ + Thread.sleep(2000); // The event is sent asynchronously, allow app to save it's state, and call exit() itself. + } catch (InterruptedException e) {} System.exit(0); } @@ -454,7 +455,7 @@ public class MainActivity extends Activity return true; } } - //System.out.println("Key " + keyCode + " flags " + event.getFlags() + " action " + event.getAction()); + //Log.i("SDL", "Key " + keyCode + " flags " + event.getFlags() + " action " + event.getAction()); return false; } }; @@ -514,7 +515,7 @@ public class MainActivity extends Activity public void setScreenKeyboardHintMessage(String s) { _screenKeyboardHintMessage = s; - //System.out.println("setScreenKeyboardHintMessage: " + (_screenKeyboardHintMessage != null ? _screenKeyboardHintMessage : getString(R.string.text_edit_click_here))); + //Log.i("SDL", "setScreenKeyboardHintMessage: " + (_screenKeyboardHintMessage != null ? _screenKeyboardHintMessage : getString(R.string.text_edit_click_here))); runOnUiThread(new Runnable() { public void run() @@ -667,7 +668,7 @@ public class MainActivity extends Activity @Override public boolean dispatchTouchEvent(final MotionEvent ev) { - //System.out.println("dispatchTouchEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() ); + //Log.i("SDL", "dispatchTouchEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() ); if(_screenKeyboard != null) _screenKeyboard.dispatchTouchEvent(ev); else @@ -694,7 +695,7 @@ public class MainActivity extends Activity @Override public boolean dispatchGenericMotionEvent (MotionEvent ev) { - //System.out.println("dispatchGenericMotionEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() ); + //Log.i("SDL", "dispatchGenericMotionEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() ); // This code fails to run for Android 1.6, so there will be no generic motion event for Andorid screen keyboard /* if(_screenKeyboard != null) @@ -760,11 +761,11 @@ public class MainActivity extends Activity { if(Globals.NeedGles2) System.loadLibrary("GLESv2"); - System.out.println("libSDL: loaded GLESv2 lib"); + Log.i("SDL", "libSDL: loaded GLESv2 lib"); } catch ( UnsatisfiedLinkError e ) { - System.out.println("libSDL: Cannot load GLESv2 lib"); + Log.i("SDL", "libSDL: Cannot load GLESv2 lib"); } // ----- VCMI hack ----- @@ -772,7 +773,7 @@ public class MainActivity extends Activity for(String binaryZip: binaryZipNames) { try { - System.out.println("libSDL: Trying to extract binaries from assets " + binaryZip); + Log.i("SDL", "libSDL: Trying to extract binaries from assets " + binaryZip); InputStream in = null; try @@ -813,11 +814,11 @@ public class MainActivity extends Activity entry = zip.getNextEntry(); /* if( entry != null ) - System.out.println("Extracting lib " + entry.getName()); + Log.i("SDL", "Extracting lib " + entry.getName()); */ if( entry == null ) { - System.out.println("Extracting binaries finished"); + Log.i("SDL", "Extracting binaries finished"); break; } if( entry.isDirectory() ) @@ -846,11 +847,11 @@ public class MainActivity extends Activity ff.delete(); throw new Exception(); } - System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it"); + Log.i("SDL", "File '" + path + "' exists and passed CRC check - not overwriting it"); continue; } catch( Exception eeeeee ) { } - System.out.println("Saving to file '" + path + "'"); + Log.i("SDL", "Saving to file '" + path + "'"); out = new FileOutputStream( path ); int len = zip.read(buf); @@ -868,7 +869,7 @@ public class MainActivity extends Activity } catch ( Exception eee ) { - //System.out.println("libSDL: Error: " + eee.toString()); + //Log.i("SDL", "libSDL: Error: " + eee.toString()); } } // ----- VCMI hack ----- @@ -882,22 +883,22 @@ public class MainActivity extends Activity { String libname = System.mapLibraryName(l); File libpath = new File(getFilesDir().getAbsolutePath() + "/../lib/" + libname); - System.out.println("libSDL: loading lib " + libpath.getAbsolutePath()); + Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath()); System.load(libpath.getPath()); } catch( UnsatisfiedLinkError e ) { - System.out.println("libSDL: error loading lib " + l + ": " + e.toString()); + Log.i("SDL", "libSDL: error loading lib " + l + ": " + e.toString()); try { String libname = System.mapLibraryName(l); File libpath = new File(getFilesDir().getAbsolutePath() + "/" + libname); - System.out.println("libSDL: loading lib " + libpath.getAbsolutePath()); + Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath()); System.load(libpath.getPath()); } catch( UnsatisfiedLinkError ee ) { - System.out.println("libSDL: error loading lib " + l + ": " + ee.toString()); + Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString()); System.loadLibrary(l); } } @@ -906,7 +907,7 @@ public class MainActivity extends Activity catch ( UnsatisfiedLinkError e ) { try { - System.out.println("libSDL: Extracting APP2SD-ed libs"); + Log.i("SDL", "libSDL: Extracting APP2SD-ed libs"); InputStream in = null; try @@ -939,11 +940,11 @@ public class MainActivity extends Activity entry = zip.getNextEntry(); /* if( entry != null ) - System.out.println("Extracting lib " + entry.getName()); + Log.i("SDL", "Extracting lib " + entry.getName()); */ if( entry == null ) { - System.out.println("Extracting libs finished"); + Log.i("SDL", "Extracting libs finished"); break; } if( entry.isDirectory() ) @@ -962,7 +963,7 @@ public class MainActivity extends Activity outDir.mkdirs(); } catch( SecurityException eeeee ) { }; - System.out.println("Saving to file '" + path + "'"); + Log.i("SDL", "Saving to file '" + path + "'"); out = new FileOutputStream( path ); int len = zip.read(buf); @@ -981,14 +982,14 @@ public class MainActivity extends Activity { String libname = System.mapLibraryName(l); File libpath = new File(libDir, libname); - System.out.println("libSDL: loading lib " + libpath.getPath()); + Log.i("SDL", "libSDL: loading lib " + libpath.getPath()); System.load(libpath.getPath()); libpath.delete(); } } catch ( Exception ee ) { - System.out.println("libSDL: Error: " + ee.toString()); + Log.i("SDL", "libSDL: Error: " + ee.toString()); } } @@ -1007,21 +1008,21 @@ public class MainActivity extends Activity } catch ( UnsatisfiedLinkError e ) { - System.out.println("libSDL: error loading lib: " + e.toString()); + Log.i("SDL", "libSDL: error loading lib: " + e.toString()); try { for(String l : libs) { String libname = System.mapLibraryName(l); File libpath = new File(context.getFilesDir(), libname); - System.out.println("libSDL: loading lib " + libpath.getPath()); + Log.i("SDL", "libSDL: loading lib " + libpath.getPath()); System.load(libpath.getPath()); libpath.delete(); } } catch ( UnsatisfiedLinkError ee ) { - System.out.println("libSDL: error loading lib: " + ee.toString()); + Log.i("SDL", "libSDL: error loading lib: " + ee.toString()); } } } @@ -1032,7 +1033,7 @@ public class MainActivity extends Activity PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); return packageInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { - System.out.println("libSDL: Cannot get the version of our own package: " + e); + Log.i("SDL", "libSDL: Cannot get the version of our own package: " + e); } return 0; } @@ -1061,8 +1062,19 @@ public class MainActivity extends Activity private EditText _screenKeyboard = null; private String _screenKeyboardHintMessage = null; private boolean sdlInited = false; - public Settings.TouchEventsListener touchListener = null; - public Settings.KeyEventsListener keyListener = null; + + public interface TouchEventsListener + { + public void onTouchEvent(final MotionEvent ev); + } + + public interface KeyEventsListener + { + public void onKeyEvent(final int keyCode); + } + + public TouchEventsListener touchListener = null; + public KeyEventsListener keyListener = null; boolean _isPaused = false; private InputMethodManager _inputManager = null; diff --git a/project/java/Settings.java b/project/java/Settings.java index 8e8d0e951..fad46d0b5 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -66,6 +66,7 @@ import android.app.AlarmManager; import android.util.DisplayMetrics; import android.net.Uri; import java.util.concurrent.Semaphore; +import java.util.Arrays; import android.graphics.Color; import android.hardware.SensorEventListener; import android.hardware.SensorEvent; @@ -183,7 +184,7 @@ class Settings { return; } - System.out.println("libSDL: Settings.Load(): enter"); + Log.i("SDL", "libSDL: Settings.Load(): enter"); nativeInitKeymap(); for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ ) { @@ -203,10 +204,12 @@ class Settings idx = ii; Globals.RemapScreenKbKeycode[i] = idx; } - Globals.ScreenKbControlsShown[0] = Globals.AppNeedsArrowKeys; + Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick); Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput; for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ ) Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount ); + if( Globals.AppUsesSecondJoystick ) + Globals.ScreenKbControlsShown[8] = true; for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ ) { int sdlKey = nativeGetKeymapKeyMultitouchGesture(i); @@ -233,9 +236,13 @@ class Settings Globals.ScreenKbControlsLayout[i][2] *= (float)displayX / 800.0f; Globals.ScreenKbControlsLayout[i][1] *= (float)displayY / 480.0f; Globals.ScreenKbControlsLayout[i][3] *= (float)displayY / 480.0f; + // Make them square + int wh = Math.min( Globals.ScreenKbControlsLayout[i][2] - Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][3] - Globals.ScreenKbControlsLayout[i][1] ); + Globals.ScreenKbControlsLayout[i][2] = Globals.ScreenKbControlsLayout[i][0] + wh; + Globals.ScreenKbControlsLayout[i][3] = Globals.ScreenKbControlsLayout[i][1] + wh; } - System.out.println("android.os.Build.MODEL: " + android.os.Build.MODEL); + Log.i("SDL", "android.os.Build.MODEL: " + android.os.Build.MODEL); if( (android.os.Build.MODEL.equals("GT-N7000") || android.os.Build.MODEL.equals("SGH-I717")) && android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.GINGERBREAD_MR1 ) { @@ -342,16 +349,16 @@ class Settings settingsLoaded = true; - System.out.println("libSDL: Settings.Load(): loaded settings successfully"); + Log.i("SDL", "libSDL: Settings.Load(): loaded settings successfully"); settingsFile.close(); - System.out.println("libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion()); + Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion()); if( cfgVersion != p.getApplicationVersion() ) { - DeleteFilesOnUpgrade(); + DeleteFilesOnUpgrade(p); if( Globals.ResetSdlConfigForThisVersion ) { - System.out.println("libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file"); + Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file"); // Delete settings file, and restart the application DeleteSdlConfigOnUpgradeAndRestart(p); } @@ -363,10 +370,10 @@ class Settings } catch( FileNotFoundException e ) { } catch( SecurityException e ) { } catch ( IOException e ) { - DeleteFilesOnUpgrade(); + DeleteFilesOnUpgrade(p); if( Globals.ResetSdlConfigForThisVersion ) { - System.out.println("libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file"); + Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file"); DeleteSdlConfigOnUpgradeAndRestart(p); } }; @@ -375,7 +382,7 @@ class Settings { if( !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) ) { - System.out.println("libSDL: SD card or external storage is not mounted (state " + Environment.getExternalStorageState() + "), switching to the internal storage."); + Log.i("SDL", "libSDL: SD card or external storage is not mounted (state " + Environment.getExternalStorageState() + "), switching to the internal storage."); Globals.DownloadToSdcard = false; } Globals.DataDir = Globals.DownloadToSdcard ? @@ -392,2190 +399,20 @@ class Settings } } - System.out.println("libSDL: Settings.Load(): loading settings failed, running config dialog"); + Log.i("SDL", "libSDL: Settings.Load(): loading settings failed, running config dialog"); p.setUpStatusLabel(); if( checkRamSize(p) ) - showConfig(p, true); + SettingsMenu.showConfig(p, true); } - // =============================================================================================== - - public static abstract class Menu - { - // Should be overridden by children - abstract void run(final MainActivity p); - abstract String title(final MainActivity p); - boolean enabled() - { - return true; - } - // Should not be overridden - boolean enabledOrHidden() - { - for( Menu m: Globals.HiddenMenuOptions ) - { - if( m.getClass().getName().equals( this.getClass().getName() ) ) - return false; - } - return enabled(); - } - void showMenuOptionsList(final MainActivity p, final Menu[] list) - { - menuStack.add(this); - ArrayList items = new ArrayList (); - for( Menu m: list ) - { - if(m.enabledOrHidden()) - items.add(m.title(p)); - } - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(title(p)); - builder.setItems(items.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - int selected = 0; - - for( Menu m: list ) - { - if(m.enabledOrHidden()) - { - if( selected == item ) - { - m.run(p); - return; - } - selected ++; - } - } - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBackOuterMenu(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static ArrayList menuStack = new ArrayList (); - - public static void showConfig(final MainActivity p, final boolean firstStart) - { - settingsChanged = true; - if( Globals.OptionalDataDownload == null ) - { - String downloads[] = Globals.DataDownloadUrl; - Globals.OptionalDataDownload = new boolean[downloads.length]; - boolean oldFormat = true; - for( int i = 0; i < downloads.length; i++ ) - { - if( downloads[i].indexOf("!") == 0 ) - { - Globals.OptionalDataDownload[i] = true; - oldFormat = false; - } - } - if( oldFormat ) - Globals.OptionalDataDownload[0] = true; - } - - if(!firstStart) - new MainMenu().run(p); - else - { - if( Globals.StartupMenuButtonTimeout > 0 ) // If we did not disable startup menu altogether - { - for( Menu m: Globals.FirstStartMenuOptions ) - { - boolean hidden = false; - for( Menu m1: Globals.HiddenMenuOptions ) - { - if( m1.getClass().getName().equals( m.getClass().getName() ) ) - hidden = true; - } - if( ! hidden ) - menuStack.add(m); - } - } - goBack(p); - } - } - - static void goBack(final MainActivity p) - { - if(menuStack.isEmpty()) - { - Save(p); - p.startDownloader(); - } - else - { - Menu c = menuStack.remove(menuStack.size() - 1); - c.run(p); - } - } - - static void goBackOuterMenu(final MainActivity p) - { - if(!menuStack.isEmpty()) - menuStack.remove(menuStack.size() - 1); - goBack(p); - } - - static class OkButton extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.ok); - } - void run (final MainActivity p) - { - goBackOuterMenu(p); - } - } - - static class DummyMenu extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.ok); - } - void run (final MainActivity p) - { - goBack(p); - } - } - - static class MainMenu extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.device_config); - } - void run (final MainActivity p) - { - Menu options[] = - { - new DownloadConfig(), - new OptionalDownloadConfig(false), - new KeyboardConfigMainMenu(), - new MouseConfigMainMenu(), - new GyroscopeCalibration(), - new AudioConfig(), - new RemapHwKeysConfig(), - new ScreenGesturesConfig(), - new VideoSettingsConfig(), - new ResetToDefaultsConfig(), - new OkButton(), - }; - showMenuOptionsList(p, options); - } - } - - static class MouseConfigMainMenu extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.mouse_emulation); - } - boolean enabled() - { - return Globals.AppUsesMouse; - } - void run (final MainActivity p) - { - Menu options[] = - { - new DisplaySizeConfig(false), - new LeftClickConfig(), - new RightClickConfig(), - new AdditionalMouseConfig(), - new JoystickMouseConfig(), - new TouchPressureMeasurementTool(), - new CalibrateTouchscreenMenu(), - new OkButton(), - }; - showMenuOptionsList(p, options); - } - } - - static class KeyboardConfigMainMenu extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.controls_screenkb); - } - boolean enabled() - { - return Globals.UseTouchscreenKeyboard; - } - void run (final MainActivity p) - { - Menu options[] = - { - new ScreenKeyboardThemeConfig(), - new ScreenKeyboardSizeConfig(), - new ScreenKeyboardDrawSizeConfig(), - new ScreenKeyboardTransparencyConfig(), - new RemapScreenKbConfig(), - new CustomizeScreenKbLayout(), - new OkButton(), - }; - showMenuOptionsList(p, options); - } - } - - static class DownloadConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.storage_question); - } - void run (final MainActivity p) - { - long freeSdcard = 0; - long freePhone = 0; - try - { - StatFs sdcard = new StatFs(Environment.getExternalStorageDirectory().getPath()); - StatFs phone = new StatFs(Environment.getDataDirectory().getPath()); - freeSdcard = (long)sdcard.getAvailableBlocks() * sdcard.getBlockSize() / 1024 / 1024; - freePhone = (long)phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024; - } - catch(Exception e) {} - - final CharSequence[] items = { p.getResources().getString(R.string.storage_phone, freePhone), - p.getResources().getString(R.string.storage_sd, freeSdcard), - p.getResources().getString(R.string.storage_custom) }; - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.storage_question)); - builder.setSingleChoiceItems(items, Globals.DownloadToSdcard ? 1 : 0, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - - if( item == 2 ) - showCustomDownloadDirConfig(p); - else - { - Globals.DownloadToSdcard = (item != 0); - Globals.DataDir = Globals.DownloadToSdcard ? - SdcardAppPath.getPath(p) : - p.getFilesDir().getAbsolutePath(); - goBack(p); - } - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - static void showCustomDownloadDirConfig(final MainActivity p) - { - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.storage_custom)); - - final EditText edit = new EditText(p); - edit.setFocusableInTouchMode(true); - edit.setFocusable(true); - edit.setText(Globals.DataDir); - builder.setView(edit); - - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.DataDir = edit.getText().toString(); - dialog.dismiss(); - showCommandLineConfig(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - static void showCommandLineConfig(final MainActivity p) - { - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.storage_commandline)); - - final EditText edit = new EditText(p); - edit.setFocusableInTouchMode(true); - edit.setFocusable(true); - edit.setText(Globals.CommandLine); - builder.setView(edit); - - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.CommandLine = edit.getText().toString(); - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class OptionalDownloadConfig extends Menu - { - boolean firstStart = false; - OptionalDownloadConfig() - { - firstStart = false; - } - OptionalDownloadConfig(boolean firstStart) - { - this.firstStart = firstStart; - } - String title(final MainActivity p) - { - return p.getResources().getString(R.string.downloads); - } - void run (final MainActivity p) - { - String [] downloadFiles = Globals.DataDownloadUrl; - final boolean [] mandatory = new boolean[downloadFiles.length]; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.downloads)); - - CharSequence[] items = new CharSequence[downloadFiles.length]; - for(int i = 0; i < downloadFiles.length; i++ ) - { - items[i] = new String(downloadFiles[i].split("[|]")[0]); - if( items[i].toString().indexOf("!") == 0 ) - items[i] = items[i].toString().substring(1); - if( items[i].toString().indexOf("!") == 0 ) - { - items[i] = items[i].toString().substring(1); - mandatory[i] = true; - } - } - - if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != items.length ) - { - Globals.OptionalDataDownload = new boolean[downloadFiles.length]; - boolean oldFormat = true; - for( int i = 0; i < downloadFiles.length; i++ ) - { - if( downloadFiles[i].indexOf("!") == 0 ) - { - Globals.OptionalDataDownload[i] = true; - oldFormat = false; - } - } - if( oldFormat ) - { - Globals.OptionalDataDownload[0] = true; - mandatory[0] = true; - } - } - - builder.setMultiChoiceItems(items, Globals.OptionalDataDownload, new DialogInterface.OnMultiChoiceClickListener() - { - public void onClick(DialogInterface dialog, int item, boolean isChecked) - { - Globals.OptionalDataDownload[item] = isChecked; - if( mandatory[item] && !isChecked ) - { - Globals.OptionalDataDownload[item] = true; - ((AlertDialog)dialog).getListView().setItemChecked(item, true); - } - } - }); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - goBack(p); - } - }); - if( firstStart ) - { - builder.setNegativeButton(p.getResources().getString(R.string.show_more_options), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - menuStack.clear(); - new MainMenu().run(p); - } - }); - } - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ScreenKeyboardSizeConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.controls_screenkb_size); - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large), - p.getResources().getString(R.string.controls_screenkb_medium), - p.getResources().getString(R.string.controls_screenkb_small), - p.getResources().getString(R.string.controls_screenkb_tiny) }; - - for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) - for( int ii = 0; ii < 4; ii++ ) - Globals.ScreenKbControlsLayout[i][ii] = 0; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.controls_screenkb_size)); - builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardSize, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.TouchscreenKeyboardSize = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ScreenKeyboardDrawSizeConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.controls_screenkb_drawsize); - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large), - p.getResources().getString(R.string.controls_screenkb_medium), - p.getResources().getString(R.string.controls_screenkb_small), - p.getResources().getString(R.string.controls_screenkb_tiny) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.controls_screenkb_drawsize)); - builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardDrawSize, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.TouchscreenKeyboardDrawSize = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ScreenKeyboardThemeConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.controls_screenkb_theme); - } - void run (final MainActivity p) - { - final CharSequence[] items = { - p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"), - p.getResources().getString(R.string.controls_screenkb_by, "Simple Theme", "Beholder"), - p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea") - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.controls_screenkb_theme)); - builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTheme, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.TouchscreenKeyboardTheme = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ScreenKeyboardTransparencyConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.controls_screenkb_transparency); - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_trans_0), - p.getResources().getString(R.string.controls_screenkb_trans_1), - p.getResources().getString(R.string.controls_screenkb_trans_2), - p.getResources().getString(R.string.controls_screenkb_trans_3), - p.getResources().getString(R.string.controls_screenkb_trans_4) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.controls_screenkb_transparency)); - builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTransparency, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.TouchscreenKeyboardTransparency = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class AudioConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.audiobuf_question); - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_verysmall), - p.getResources().getString(R.string.audiobuf_small), - p.getResources().getString(R.string.audiobuf_medium), - p.getResources().getString(R.string.audiobuf_large) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.audiobuf_question); - builder.setSingleChoiceItems(items, Globals.AudioBufferConfig, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.AudioBufferConfig = item; - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class DisplaySizeConfig extends Menu - { - boolean firstStart = false; - DisplaySizeConfig() - { - this.firstStart = false; - } - DisplaySizeConfig(boolean firstStart) - { - this.firstStart = firstStart; - } - String title(final MainActivity p) - { - return p.getResources().getString(R.string.display_size_mouse); - } - void run (final MainActivity p) - { - CharSequence[] items = { - p.getResources().getString(R.string.display_size_tiny_touchpad), - p.getResources().getString(R.string.display_size_tiny), - p.getResources().getString(R.string.display_size_small), - p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_large), - }; - int _size_tiny_touchpad = 0; - int _size_tiny = 1; - int _size_small = 2; - int _size_small_touchpad = 3; - int _size_large = 4; - int _more_options = 5; - - if( ! Globals.SwVideoMode ) - { - CharSequence[] items2 = { - p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_large), - }; - items = items2; - _size_small_touchpad = 0; - _size_large = 1; - _size_tiny_touchpad = _size_tiny = _size_small = 1000; - - } - if( firstStart ) - { - CharSequence[] items2 = { - p.getResources().getString(R.string.display_size_tiny_touchpad), - p.getResources().getString(R.string.display_size_tiny), - p.getResources().getString(R.string.display_size_small), - p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_large), - p.getResources().getString(R.string.show_more_options), - }; - items = items2; - if( ! Globals.SwVideoMode ) - { - CharSequence[] items3 = { - p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_large), - p.getResources().getString(R.string.show_more_options), - }; - items = items3; - _more_options = 3; - } - } - // Java is so damn worse than C++11 - final int size_tiny_touchpad = _size_tiny_touchpad; - final int size_tiny = _size_tiny; - final int size_small = _size_small; - final int size_small_touchpad = _size_small_touchpad; - final int size_large = _size_large; - final int more_options = _more_options; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.display_size); - class ClickListener implements DialogInterface.OnClickListener - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - if( item == size_large ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_NORMAL; - Globals.RelativeMouseMovement = false; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; - } - if( item == size_small ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; - Globals.RelativeMouseMovement = false; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER; - } - if( item == size_small_touchpad ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; - Globals.RelativeMouseMovement = true; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; - } - if( item == size_tiny ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; - Globals.RelativeMouseMovement = false; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_SCREEN_TRANSFORM; - } - if( item == size_tiny_touchpad ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; - Globals.RelativeMouseMovement = true; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_FULLSCREEN_MAGNIFIER; - } - if( item == more_options ) - { - menuStack.clear(); - new MainMenu().run(p); - return; - } - goBack(p); - } - } - builder.setItems(items, new ClickListener()); - /* - else - builder.setSingleChoiceItems(items, - Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ? - ( Globals.RelativeMouseMovement ? Globals.SwVideoMode ? 2 : 1 : 0 ) : - ( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 : - Globals.ShowScreenUnderFinger + 1, - new ClickListener()); - */ - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class LeftClickConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.leftclick_question); - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.leftclick_normal), - p.getResources().getString(R.string.leftclick_near_cursor), - p.getResources().getString(R.string.leftclick_multitouch), - p.getResources().getString(R.string.leftclick_pressure), - p.getResources().getString(R.string.rightclick_key), - p.getResources().getString(R.string.leftclick_timeout), - p.getResources().getString(R.string.leftclick_tap), - p.getResources().getString(R.string.leftclick_tap_or_timeout) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.leftclick_question); - builder.setSingleChoiceItems(items, Globals.LeftClickMethod, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - Globals.LeftClickMethod = item; - if( item == Mouse.LEFT_CLICK_WITH_KEY ) - p.keyListener = new KeyRemapToolMouseClick(p, true); - else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT ) - showLeftClickTimeoutConfig(p); - else - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - static void showLeftClickTimeoutConfig(final MainActivity p) { - final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0), - p.getResources().getString(R.string.leftclick_timeout_time_1), - p.getResources().getString(R.string.leftclick_timeout_time_2), - p.getResources().getString(R.string.leftclick_timeout_time_3), - p.getResources().getString(R.string.leftclick_timeout_time_4) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.leftclick_timeout_time); - builder.setSingleChoiceItems(items, Globals.LeftClickTimeout, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.LeftClickTimeout = item; - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class RightClickConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.rightclick_question); - } - boolean enabled() - { - return Globals.AppNeedsTwoButtonMouse; - } - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.rightclick_none), - p.getResources().getString(R.string.rightclick_multitouch), - p.getResources().getString(R.string.rightclick_pressure), - p.getResources().getString(R.string.rightclick_key), - p.getResources().getString(R.string.leftclick_timeout) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.rightclick_question); - builder.setSingleChoiceItems(items, Globals.RightClickMethod, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RightClickMethod = item; - dialog.dismiss(); - if( item == Mouse.RIGHT_CLICK_WITH_KEY ) - p.keyListener = new KeyRemapToolMouseClick(p, false); - else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT ) - showRightClickTimeoutConfig(p); - else - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showRightClickTimeoutConfig(final MainActivity p) { - final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0), - p.getResources().getString(R.string.leftclick_timeout_time_1), - p.getResources().getString(R.string.leftclick_timeout_time_2), - p.getResources().getString(R.string.leftclick_timeout_time_3), - p.getResources().getString(R.string.leftclick_timeout_time_4) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.leftclick_timeout_time); - builder.setSingleChoiceItems(items, Globals.RightClickTimeout, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RightClickTimeout = item; - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - public static class KeyRemapToolMouseClick implements KeyEventsListener - { - MainActivity p; - boolean leftClick; - public KeyRemapToolMouseClick(MainActivity _p, boolean leftClick) - { - p = _p; - p.setText(p.getResources().getString(R.string.remap_hwkeys_press)); - this.leftClick = leftClick; - } - - public void onKeyEvent(final int keyCode) - { - p.keyListener = null; - int keyIndex = keyCode; - if( keyIndex < 0 ) - keyIndex = 0; - if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST ) - keyIndex = 0; - - if( leftClick ) - Globals.LeftClickKey = keyIndex; - else - Globals.RightClickKey = keyIndex; - - goBack(p); - } - } - - static class AdditionalMouseConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.pointandclick_question); - } - void run (final MainActivity p) - { - CharSequence[] items = { - p.getResources().getString(R.string.pointandclick_joystickmouse), - p.getResources().getString(R.string.click_with_dpadcenter), - p.getResources().getString(R.string.pointandclick_relative) - }; - - boolean defaults[] = { - Globals.MoveMouseWithJoystick, - Globals.ClickMouseWithDpad, - Globals.RelativeMouseMovement - }; - - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.pointandclick_question)); - builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() - { - public void onClick(DialogInterface dialog, int item, boolean isChecked) - { - if( item == 0 ) - Globals.MoveMouseWithJoystick = isChecked; - if( item == 1 ) - Globals.ClickMouseWithDpad = isChecked; - if( item == 2 ) - Globals.RelativeMouseMovement = isChecked; - } - }); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - if( Globals.RelativeMouseMovement ) - showRelativeMouseMovementConfig(p); - else - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showRelativeMouseMovementConfig(final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.accel_veryslow), - p.getResources().getString(R.string.accel_slow), - p.getResources().getString(R.string.accel_medium), - p.getResources().getString(R.string.accel_fast), - p.getResources().getString(R.string.accel_veryfast) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.pointandclick_relative_speed); - builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementSpeed, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RelativeMouseMovementSpeed = item; - - dialog.dismiss(); - showRelativeMouseMovementConfig1(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showRelativeMouseMovementConfig1(final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.none), - p.getResources().getString(R.string.accel_slow), - p.getResources().getString(R.string.accel_medium), - p.getResources().getString(R.string.accel_fast) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.pointandclick_relative_accel); - builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementAccel, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RelativeMouseMovementAccel = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class JoystickMouseConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.pointandclick_joystickmousespeed); - } - boolean enabled() - { - return Globals.MoveMouseWithJoystick; - }; - void run (final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.accel_slow), - p.getResources().getString(R.string.accel_medium), - p.getResources().getString(R.string.accel_fast) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.pointandclick_joystickmousespeed); - builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickSpeed, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.MoveMouseWithJoystickSpeed = item; - - dialog.dismiss(); - showJoystickMouseAccelConfig(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showJoystickMouseAccelConfig(final MainActivity p) - { - final CharSequence[] items = { p.getResources().getString(R.string.none), - p.getResources().getString(R.string.accel_slow), - p.getResources().getString(R.string.accel_medium), - p.getResources().getString(R.string.accel_fast) }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.pointandclick_joystickmouseaccel); - builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickAccel, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.MoveMouseWithJoystickAccel = item; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - public interface TouchEventsListener - { - public void onTouchEvent(final MotionEvent ev); - } - - public interface KeyEventsListener - { - public void onKeyEvent(final int keyCode); - } - - static class TouchPressureMeasurementTool extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.measurepressure); - } - boolean enabled() - { - return Globals.RightClickMethod == Mouse.RIGHT_CLICK_WITH_PRESSURE || - Globals.LeftClickMethod == Mouse.LEFT_CLICK_WITH_PRESSURE; - }; - void run (final MainActivity p) - { - p.setText(p.getResources().getString(R.string.measurepressure_touchplease)); - p.touchListener = new TouchMeasurementTool(p); - } - - public static class TouchMeasurementTool implements TouchEventsListener - { - MainActivity p; - ArrayList force = new ArrayList(); - ArrayList radius = new ArrayList(); - static final int maxEventAmount = 100; - - public TouchMeasurementTool(MainActivity _p) - { - p = _p; - } - - public void onTouchEvent(final MotionEvent ev) - { - force.add(new Integer((int)(ev.getPressure() * 1000.0))); - radius.add(new Integer((int)(ev.getSize() * 1000.0))); - p.setText(p.getResources().getString(R.string.measurepressure_response, force.get(force.size()-1), radius.get(radius.size()-1))); - try { - Thread.sleep(10L); - } catch (InterruptedException e) { } - - if( force.size() >= maxEventAmount ) - { - p.touchListener = null; - Globals.ClickScreenPressure = getAverageForce(); - Globals.ClickScreenTouchspotSize = getAverageRadius(); - System.out.println("SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize); - goBack(p); - } - } - - int getAverageForce() - { - int avg = 0; - for(Integer f: force) - { - avg += f; - } - return avg / force.size(); - } - int getAverageRadius() - { - int avg = 0; - for(Integer r: radius) - { - avg += r; - } - return avg / radius.size(); - } - } - } - - static class RemapHwKeysConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.remap_hwkeys); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - p.setText(p.getResources().getString(R.string.remap_hwkeys_press)); - p.keyListener = new KeyRemapTool(p); - } - - public static class KeyRemapTool implements KeyEventsListener - { - MainActivity p; - public KeyRemapTool(MainActivity _p) - { - p = _p; - } - - public void onKeyEvent(final int keyCode) - { - p.keyListener = null; - int keyIndex = keyCode; - if( keyIndex < 0 ) - keyIndex = 0; - if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST ) - keyIndex = 0; - - final int KeyIndexFinal = keyIndex; - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.remap_hwkeys_select); - builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[keyIndex]], new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RemapHwKeycode[KeyIndexFinal] = SDL_Keys.namesSortedIdx[item]; - - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - } - - static class RemapScreenKbConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.remap_screenkb); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - CharSequence[] items = { - p.getResources().getString(R.string.remap_screenkb_joystick), - p.getResources().getString(R.string.remap_screenkb_button_text), - p.getResources().getString(R.string.remap_screenkb_button) + " 1", - p.getResources().getString(R.string.remap_screenkb_button) + " 2", - p.getResources().getString(R.string.remap_screenkb_button) + " 3", - p.getResources().getString(R.string.remap_screenkb_button) + " 4", - p.getResources().getString(R.string.remap_screenkb_button) + " 5", - p.getResources().getString(R.string.remap_screenkb_button) + " 6", - }; - - boolean defaults[] = { - Globals.ScreenKbControlsShown[0], - Globals.ScreenKbControlsShown[1], - Globals.ScreenKbControlsShown[2], - Globals.ScreenKbControlsShown[3], - Globals.ScreenKbControlsShown[4], - Globals.ScreenKbControlsShown[5], - Globals.ScreenKbControlsShown[6], - Globals.ScreenKbControlsShown[7], - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.remap_screenkb)); - builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() - { - public void onClick(DialogInterface dialog, int item, boolean isChecked) - { - if( ! Globals.UseTouchscreenKeyboard ) - item += 8; - Globals.ScreenKbControlsShown[item] = isChecked; - } - }); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - showRemapScreenKbConfig2(p, 0); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showRemapScreenKbConfig2(final MainActivity p, final int currentButton) - { - CharSequence[] items = { - p.getResources().getString(R.string.remap_screenkb_button) + " 1", - p.getResources().getString(R.string.remap_screenkb_button) + " 2", - p.getResources().getString(R.string.remap_screenkb_button) + " 3", - p.getResources().getString(R.string.remap_screenkb_button) + " 4", - p.getResources().getString(R.string.remap_screenkb_button) + " 5", - p.getResources().getString(R.string.remap_screenkb_button) + " 6", - }; - - if( currentButton >= Globals.RemapScreenKbKeycode.length ) - { - goBack(p); - return; - } - if( ! Globals.ScreenKbControlsShown[currentButton + 2] ) - { - showRemapScreenKbConfig2(p, currentButton + 1); - return; - } - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(items[currentButton]); - builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; - - dialog.dismiss(); - showRemapScreenKbConfig2(p, currentButton + 1); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ScreenGesturesConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.remap_screenkb_button_gestures); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - CharSequence[] items = { - p.getResources().getString(R.string.remap_screenkb_button_zoomin), - p.getResources().getString(R.string.remap_screenkb_button_zoomout), - p.getResources().getString(R.string.remap_screenkb_button_rotateleft), - p.getResources().getString(R.string.remap_screenkb_button_rotateright), - }; - - boolean defaults[] = { - Globals.MultitouchGesturesUsed[0], - Globals.MultitouchGesturesUsed[1], - Globals.MultitouchGesturesUsed[2], - Globals.MultitouchGesturesUsed[3], - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.remap_screenkb_button_gestures)); - builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() - { - public void onClick(DialogInterface dialog, int item, boolean isChecked) - { - Globals.MultitouchGesturesUsed[item] = isChecked; - } - }); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - showScreenGesturesConfig2(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showScreenGesturesConfig2(final MainActivity p) - { - final CharSequence[] items = { - p.getResources().getString(R.string.accel_slow), - p.getResources().getString(R.string.accel_medium), - p.getResources().getString(R.string.accel_fast), - p.getResources().getString(R.string.accel_veryfast) - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(R.string.remap_screenkb_button_gestures_sensitivity); - builder.setSingleChoiceItems(items, Globals.MultitouchGestureSensitivity, new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.MultitouchGestureSensitivity = item; - - dialog.dismiss(); - showScreenGesturesConfig3(p, 0); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - static void showScreenGesturesConfig3(final MainActivity p, final int currentButton) - { - CharSequence[] items = { - p.getResources().getString(R.string.remap_screenkb_button_zoomin), - p.getResources().getString(R.string.remap_screenkb_button_zoomout), - p.getResources().getString(R.string.remap_screenkb_button_rotateleft), - p.getResources().getString(R.string.remap_screenkb_button_rotateright), - }; - - if( currentButton >= Globals.RemapMultitouchGestureKeycode.length ) - { - goBack(p); - return; - } - if( ! Globals.MultitouchGesturesUsed[currentButton] ) - { - showScreenGesturesConfig3(p, currentButton + 1); - return; - } - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(items[currentButton]); - builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; - - dialog.dismiss(); - showScreenGesturesConfig3(p, currentButton + 1); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class CalibrateTouchscreenMenu extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.calibrate_touchscreen); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - p.setText(p.getResources().getString(R.string.calibrate_touchscreen_touch)); - Globals.TouchscreenCalibration[0] = 0; - Globals.TouchscreenCalibration[1] = 0; - Globals.TouchscreenCalibration[2] = 0; - Globals.TouchscreenCalibration[3] = 0; - ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p); - p.touchListener = tool; - p.keyListener = tool; - } - - static class ScreenEdgesCalibrationTool implements TouchEventsListener, KeyEventsListener - { - MainActivity p; - ImageView img; - Bitmap bmp; - - public ScreenEdgesCalibrationTool(MainActivity _p) - { - p = _p; - img = new ImageView(p); - img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); - img.setScaleType(ImageView.ScaleType.MATRIX); - bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate ); - img.setImageBitmap(bmp); - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); - RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], - Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - img.setImageMatrix(m); - p.getVideoLayout().addView(img); - } - - public void onTouchEvent(final MotionEvent ev) - { - if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] && - Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] && - Globals.TouchscreenCalibration[2] == Globals.TouchscreenCalibration[3] ) - { - Globals.TouchscreenCalibration[0] = (int)ev.getX(); - Globals.TouchscreenCalibration[1] = (int)ev.getY(); - Globals.TouchscreenCalibration[2] = (int)ev.getX(); - Globals.TouchscreenCalibration[3] = (int)ev.getY(); - } - if( ev.getX() < Globals.TouchscreenCalibration[0] ) - Globals.TouchscreenCalibration[0] = (int)ev.getX(); - if( ev.getY() < Globals.TouchscreenCalibration[1] ) - Globals.TouchscreenCalibration[1] = (int)ev.getY(); - if( ev.getX() > Globals.TouchscreenCalibration[2] ) - Globals.TouchscreenCalibration[2] = (int)ev.getX(); - if( ev.getY() > Globals.TouchscreenCalibration[3] ) - Globals.TouchscreenCalibration[3] = (int)ev.getY(); - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); - RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], - Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - img.setImageMatrix(m); - } - - public void onKeyEvent(final int keyCode) - { - p.touchListener = null; - p.keyListener = null; - p.getVideoLayout().removeView(img); - goBack(p); - } - } - } - - static class CustomizeScreenKbLayout extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.screenkb_custom_layout); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help)); - CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p); - p.touchListener = tool; - p.keyListener = tool; - } - - static class CustomizeScreenKbLayoutTool implements TouchEventsListener, KeyEventsListener - { - MainActivity p; - FrameLayout layout = null; - ImageView imgs[] = new ImageView[Globals.ScreenKbControlsLayout.length]; - Bitmap bmps[] = new Bitmap[Globals.ScreenKbControlsLayout.length]; - ImageView boundary = null; - Bitmap boundaryBmp = null; - int currentButton = 0; - int buttons[] = { - R.drawable.dpad, - R.drawable.keyboard, - R.drawable.b1, - R.drawable.b2, - R.drawable.b3, - R.drawable.b4, - R.drawable.b5, - R.drawable.b6 - }; - int oldX = 0, oldY = 0; - boolean resizing = false; - - public CustomizeScreenKbLayoutTool(MainActivity _p) - { - p = _p; - layout = new FrameLayout(p); - p.getVideoLayout().addView(layout); - boundary = new ImageView(p); - boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); - boundary.setScaleType(ImageView.ScaleType.MATRIX); - boundaryBmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.rectangle ); - boundary.setImageBitmap(boundaryBmp); - layout.addView(boundary); - currentButton = -1; - if( Globals.TouchscreenKeyboardTheme == 2 ) - { - buttons = new int[] { - R.drawable.sun_dpad, - R.drawable.sun_keyboard, - R.drawable.sun_b1, - R.drawable.sun_b2, - R.drawable.sun_b3, - R.drawable.sun_b4, - R.drawable.sun_b5, - R.drawable.sun_b6 - }; - } - - int displayX = 800; - int displayY = 480; - try { - DisplayMetrics dm = new DisplayMetrics(); - p.getWindowManager().getDefaultDisplay().getMetrics(dm); - displayX = dm.widthPixels; - displayY = dm.heightPixels; - } catch (Exception eeeee) {} - - for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) - { - if( ! Globals.ScreenKbControlsShown[i] ) - continue; - if( currentButton == -1 ) - currentButton = i; - - // Check if the button is off screen edge or shrunk to zero - if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayX/15 ) - Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX/15; - if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/15 ) - Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/15; - if( Globals.ScreenKbControlsLayout[i][0] < 0 ) - { - Globals.ScreenKbControlsLayout[i][2] = -Globals.ScreenKbControlsLayout[i][0]; - Globals.ScreenKbControlsLayout[i][0] = 0; - } - if( Globals.ScreenKbControlsLayout[i][2] > displayX ) - { - Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX; - Globals.ScreenKbControlsLayout[i][2] = displayX; - } - if( Globals.ScreenKbControlsLayout[i][1] < 0 ) - { - Globals.ScreenKbControlsLayout[i][3] = -Globals.ScreenKbControlsLayout[i][0]; - Globals.ScreenKbControlsLayout[i][1] = 0; - } - if( Globals.ScreenKbControlsLayout[i][3] > displayY ) - { - Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][2] - displayY; - Globals.ScreenKbControlsLayout[i][3] = displayY; - } - - imgs[i] = new ImageView(p); - imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); - imgs[i].setScaleType(ImageView.ScaleType.MATRIX); - bmps[i] = BitmapFactory.decodeResource( p.getResources(), buttons[i] ); - imgs[i].setImageBitmap(bmps[i]); - imgs[i].setAlpha(128); - layout.addView(imgs[i]); - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); - RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], - Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - imgs[i].setImageMatrix(m); - } - boundary.bringToFront(); - if( currentButton == -1 ) - onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything - else - setupButton(currentButton); - } - - void setupButton(int i) - { - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); - RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], - Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - imgs[i].setImageMatrix(m); - m = new Matrix(); - src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - boundary.setImageMatrix(m); - String buttonText = (i == 0 ? "Joystick" : ( i == 1 ? "Text input" : "" )); - if ( i >= 2 && i - 2 < Globals.AppTouchscreenKeyboardKeysNames.length ) - buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 2]; - p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText.replace("_", " ")); - } - - public void onTouchEvent(final MotionEvent ev) - { - if( ev.getAction() == MotionEvent.ACTION_DOWN ) - { - oldX = (int)ev.getX(); - oldY = (int)ev.getY(); - resizing = true; - for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) - { - if( ! Globals.ScreenKbControlsShown[i] ) - continue; - if( Globals.ScreenKbControlsLayout[i][0] <= oldX && - Globals.ScreenKbControlsLayout[i][2] >= oldX && - Globals.ScreenKbControlsLayout[i][1] <= oldY && - Globals.ScreenKbControlsLayout[i][3] >= oldY ) - { - currentButton = i; - setupButton(currentButton); - resizing = false; - break; - } - } - } - if( ev.getAction() == MotionEvent.ACTION_MOVE ) - { - int dx = (int)ev.getX() - oldX; - int dy = (int)ev.getY() - oldY; - if( resizing ) - { - // Resize slowly, with 1/3 of movement speed - dx /= 6; - dy /= 6; - Globals.ScreenKbControlsLayout[currentButton][0] -= dx; - Globals.ScreenKbControlsLayout[currentButton][2] += dx; - Globals.ScreenKbControlsLayout[currentButton][1] += dy; - Globals.ScreenKbControlsLayout[currentButton][3] -= dy; - dx *= 6; - dy *= 6; - } - else - { - Globals.ScreenKbControlsLayout[currentButton][0] += dx; - Globals.ScreenKbControlsLayout[currentButton][2] += dx; - Globals.ScreenKbControlsLayout[currentButton][1] += dy; - Globals.ScreenKbControlsLayout[currentButton][3] += dy; - } - oldX += dx; - oldY += dy; - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight()); - RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1], - Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - imgs[currentButton].setImageMatrix(m); - m = new Matrix(); - src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - boundary.setImageMatrix(m); - } - } - - public void onKeyEvent(final int keyCode) - { - if( keyCode == KeyEvent.KEYCODE_BACK ) - { - p.getVideoLayout().removeView(layout); - layout = null; - p.touchListener = null; - p.keyListener = null; - goBack(p); - } - } - } - } - - static class VideoSettingsConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.video); - } - //boolean enabled() { return true; }; - void run (final MainActivity p) - { - CharSequence[] items = { - p.getResources().getString(R.string.pointandclick_keepaspectratio), - p.getResources().getString(R.string.video_smooth) - }; - boolean defaults[] = { - Globals.KeepAspectRatio, - Globals.VideoLinearFilter - }; - - if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo) - { - CharSequence[] items2 = { - p.getResources().getString(R.string.pointandclick_keepaspectratio), - p.getResources().getString(R.string.video_smooth), - p.getResources().getString(R.string.video_separatethread), - }; - boolean defaults2[] = { - Globals.KeepAspectRatio, - Globals.VideoLinearFilter, - Globals.MultiThreadedVideo - }; - items = items2; - defaults = defaults2; - } - - if(Globals.Using_SDL_1_3) - { - CharSequence[] items2 = { - p.getResources().getString(R.string.pointandclick_keepaspectratio), - }; - boolean defaults2[] = { - Globals.KeepAspectRatio, - }; - items = items2; - defaults = defaults2; - } - - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.video)); - builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() - { - public void onClick(DialogInterface dialog, int item, boolean isChecked) - { - if( item == 0 ) - Globals.KeepAspectRatio = isChecked; - if( item == 1 ) - Globals.VideoLinearFilter = isChecked; - if( item == 2 ) - Globals.MultiThreadedVideo = isChecked; - } - }); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class ShowReadme extends Menu - { - String title(final MainActivity p) - { - return "Readme"; - } - boolean enabled() - { - return true; - } - void run (final MainActivity p) - { - String readmes[] = Globals.ReadmeText.split("\\^"); - String lang = new String(Locale.getDefault().getLanguage()) + ":"; - String readme = readmes[0]; - for( String r: readmes ) - { - if( r.startsWith(lang) ) - readme = r.substring(lang.length()); - } - readme = readme.trim(); - if( readme.length() <= 2 ) - { - goBack(p); - return; - } - TextView text = new TextView(p); - text.setMaxLines(1000); - text.setText(readme); - text.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); - AlertDialog.Builder builder = new AlertDialog.Builder(p); - ScrollView scroll = new ScrollView(p); - scroll.addView(text); - Button ok = new Button(p); - final AlertDialog alertDismiss[] = new AlertDialog[1]; - ok.setOnClickListener(new View.OnClickListener() - { - public void onClick(View v) - { - alertDismiss[0].cancel(); - } - }); - ok.setText(R.string.ok); - LinearLayout layout = new LinearLayout(p); - layout.setOrientation(LinearLayout.VERTICAL); - layout.addView(scroll); - layout.addView(ok); - builder.setView(layout); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alertDismiss[0] = alert; - alert.setOwnerActivity(p); - alert.show(); - } - } - - static class GyroscopeCalibration extends Menu implements SensorEventListener - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.calibrate_gyroscope); - } - boolean enabled() - { - return Globals.AppUsesGyroscope; - } - void run (final MainActivity p) - { - if( !Globals.AppUsesGyroscope || !AccelerometerReader.gyro.available(p) ) - { - Toast toast = Toast.makeText(p, p.getResources().getString(R.string.calibrate_gyroscope_not_supported), Toast.LENGTH_LONG); - toast.show(); - goBack(p); - return; - } - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.calibrate_gyroscope)); - builder.setMessage(p.getResources().getString(R.string.calibrate_gyroscope_text)); - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - startCalibration(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - - ImageView img; - Bitmap bmp; - int numEvents; - MainActivity p; - - void startCalibration(final MainActivity _p) - { - p = _p; - img = new ImageView(p); - img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); - img.setScaleType(ImageView.ScaleType.MATRIX); - bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate ); - img.setImageBitmap(bmp); - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); - RectF dst = new RectF( p.getVideoLayout().getWidth()/2 - 50, p.getVideoLayout().getHeight()/2 - 50, - p.getVideoLayout().getWidth()/2 + 50, p.getVideoLayout().getHeight()/2 + 50); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - img.setImageMatrix(m); - p.getVideoLayout().addView(img); - numEvents = 0; - AccelerometerReader.gyro.x1 = 100; - AccelerometerReader.gyro.x2 = -100; - AccelerometerReader.gyro.xc = 0; - AccelerometerReader.gyro.y1 = 100; - AccelerometerReader.gyro.y2 = -100; - AccelerometerReader.gyro.yc = 0; - AccelerometerReader.gyro.z1 = 100; - AccelerometerReader.gyro.z2 = -100; - AccelerometerReader.gyro.zc = 0; - AccelerometerReader.gyro.registerListener(p, this); - (new Thread(new Runnable() - { - public void run() - { - for(int count = 1; count < 10; count++) - { - p.setText("" + count + "0% ..."); - try { - Thread.sleep(500); - } catch( Exception e ) {} - } - finishCalibration(p); - } - } - )).start(); - } - - public void onSensorChanged(SensorEvent event) - { - gyroscopeEvent(event.values[0], event.values[1], event.values[2]); - } - public void onAccuracyChanged(Sensor s, int a) - { - } - void gyroscopeEvent(float x, float y, float z) - { - numEvents++; - AccelerometerReader.gyro.xc += x; - AccelerometerReader.gyro.yc += y; - AccelerometerReader.gyro.zc += z; - AccelerometerReader.gyro.x1 = Math.min(AccelerometerReader.gyro.x1, x * 1.1f); // Small safety bound coefficient - AccelerometerReader.gyro.x2 = Math.max(AccelerometerReader.gyro.x2, x * 1.1f); - AccelerometerReader.gyro.y1 = Math.min(AccelerometerReader.gyro.y1, y * 1.1f); - AccelerometerReader.gyro.y2 = Math.max(AccelerometerReader.gyro.y2, y * 1.1f); - AccelerometerReader.gyro.z1 = Math.min(AccelerometerReader.gyro.z1, z * 1.1f); - AccelerometerReader.gyro.z2 = Math.max(AccelerometerReader.gyro.z2, z * 1.1f); - final Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); - RectF dst = new RectF( x * 5000 + p.getVideoLayout().getWidth()/2 - 50, y * 5000 + p.getVideoLayout().getHeight()/2 - 50, - x * 5000 + p.getVideoLayout().getWidth()/2 + 50, y * 5000 + p.getVideoLayout().getHeight()/2 + 50); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - p.runOnUiThread(new Runnable() - { - public void run() - { - img.setImageMatrix(m); - } - }); - } - void finishCalibration(final MainActivity p) - { - AccelerometerReader.gyro.unregisterListener(p, this); - try { - Thread.sleep(200); // Just in case we have pending events - } catch( Exception e ) {} - if( numEvents > 5 ) - { - AccelerometerReader.gyro.xc /= (float)numEvents; - AccelerometerReader.gyro.yc /= (float)numEvents; - AccelerometerReader.gyro.zc /= (float)numEvents; - } - p.runOnUiThread(new Runnable() - { - public void run() - { - p.getVideoLayout().removeView(img); - goBack(p); - } - }); - } - } - - static class ResetToDefaultsConfig extends Menu - { - String title(final MainActivity p) - { - return p.getResources().getString(R.string.reset_config); - } - boolean enabled() - { - return true; - } - void run (final MainActivity p) - { - AlertDialog.Builder builder = new AlertDialog.Builder(p); - builder.setTitle(p.getResources().getString(R.string.reset_config_ask)); - builder.setMessage(p.getResources().getString(R.string.reset_config_ask)); - - builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - DeleteSdlConfigOnUpgradeAndRestart(p); // Never returns - dialog.dismiss(); - goBack(p); - } - }); - builder.setNegativeButton(p.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() - { - public void onClick(DialogInterface dialog, int item) - { - dialog.dismiss(); - goBack(p); - } - }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() - { - public void onCancel(DialogInterface dialog) - { - goBack(p); - } - }); - AlertDialog alert = builder.create(); - alert.setOwnerActivity(p); - alert.show(); - } - } - - // =============================================================================================== public static boolean deleteRecursively(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); - for (int i=0; i 0 ) lang = lang + "_" + Locale.getDefault().getCountry(); - System.out.println( "libSDL: setting envvar LANGUAGE to '" + lang + "'"); + Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'"); nativeSetEnv( "LANG", lang ); nativeSetEnv( "LANGUAGE", lang ); // TODO: get current user name and set envvar USER, the API is not availalbe on Android 1.6 so I don't bother with this @@ -2831,7 +684,7 @@ class Settings { String[] fields = line.split("[ \t]+"); Long size = Long.parseLong(fields[1]); - System.out.println("Device RAM size: " + size / 1024 + " Mb, required minimum RAM: " + Globals.AppMinimumRAM + " Mb" ); + Log.i("SDL", "Device RAM size: " + size / 1024 + " Mb, required minimum RAM: " + Globals.AppMinimumRAM + " Mb" ); if( size / 1024 < Globals.AppMinimumRAM ) { settingsChanged = true; @@ -2850,7 +703,7 @@ class Settings { public void onClick(DialogInterface dialog, int item) { - showConfig(p, true); + SettingsMenu.showConfig(p, true); return; } }); @@ -2870,7 +723,7 @@ class Settings } } } catch ( Exception e ) { - System.out.println("Error: cannot parse /proc/meminfo: " + e.toString()); + Log.i("SDL", "Error: cannot parse /proc/meminfo: " + e.toString()); } return true; } @@ -2885,7 +738,7 @@ class Settings int leftClickTimeout, int rightClickTimeout, int relativeMovement, int relativeMovementSpeed, int relativeMovementAccel, int showMouseCursor); - private static native void nativeSetJoystickUsed(); + private static native void nativeSetJoystickUsed(int firstJoystickUsed, int secondJoystickUsed); private static native void nativeSetAccelerometerUsed(); private static native void nativeSetMultitouchUsed(); private static native void nativeSetTouchscreenKeyboardUsed(); diff --git a/project/java/SettingsMenu.java b/project/java/SettingsMenu.java new file mode 100644 index 000000000..544eb0977 --- /dev/null +++ b/project/java/SettingsMenu.java @@ -0,0 +1,257 @@ +/* +Simple DirectMedia Layer +Java source code (C) 2009-2012 Sergii Pylypenko + +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. +*/ + +package net.sourceforge.clonekeenplus; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; +import android.util.Log; +import java.io.*; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Environment; +import android.os.StatFs; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.zip.GZIPInputStream; +import java.util.Collections; +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import java.lang.String; +import android.graphics.Matrix; +import android.graphics.RectF; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.FrameLayout; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.widget.TextView; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.Button; +import android.view.View; +import android.widget.LinearLayout; +import android.text.Editable; +import android.text.SpannedString; +import android.content.Intent; +import android.app.PendingIntent; +import android.app.AlarmManager; +import android.util.DisplayMetrics; +import android.net.Uri; +import java.util.concurrent.Semaphore; +import java.util.Arrays; +import android.graphics.Color; +import android.hardware.SensorEventListener; +import android.hardware.SensorEvent; +import android.hardware.Sensor; +import android.widget.Toast; + + +class SettingsMenu +{ + public static abstract class Menu + { + // Should be overridden by children + abstract void run(final MainActivity p); + abstract String title(final MainActivity p); + boolean enabled() + { + return true; + } + // Should not be overridden + boolean enabledOrHidden() + { + for( Menu m: Globals.HiddenMenuOptions ) + { + if( m.getClass().getName().equals( this.getClass().getName() ) ) + return false; + } + return enabled(); + } + void showMenuOptionsList(final MainActivity p, final Menu[] list) + { + menuStack.add(this); + ArrayList items = new ArrayList (); + for( Menu m: list ) + { + if(m.enabledOrHidden()) + items.add(m.title(p)); + } + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(title(p)); + builder.setItems(items.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + int selected = 0; + + for( Menu m: list ) + { + if(m.enabledOrHidden()) + { + if( selected == item ) + { + m.run(p); + return; + } + selected ++; + } + } + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBackOuterMenu(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static ArrayList menuStack = new ArrayList (); + + public static void showConfig(final MainActivity p, final boolean firstStart) + { + Settings.settingsChanged = true; + if( Globals.OptionalDataDownload == null ) + { + String downloads[] = Globals.DataDownloadUrl; + Globals.OptionalDataDownload = new boolean[downloads.length]; + boolean oldFormat = true; + for( int i = 0; i < downloads.length; i++ ) + { + if( downloads[i].indexOf("!") == 0 ) + { + Globals.OptionalDataDownload[i] = true; + oldFormat = false; + } + } + if( oldFormat ) + Globals.OptionalDataDownload[0] = true; + } + + if(!firstStart) + new MainMenu().run(p); + else + { + if( Globals.StartupMenuButtonTimeout > 0 ) // If we did not disable startup menu altogether + { + for( Menu m: Globals.FirstStartMenuOptions ) + { + boolean hidden = false; + for( Menu m1: Globals.HiddenMenuOptions ) + { + if( m1.getClass().getName().equals( m.getClass().getName() ) ) + hidden = true; + } + if( ! hidden ) + menuStack.add(0, m); + } + } + goBack(p); + } + } + + static void goBack(final MainActivity p) + { + if(menuStack.isEmpty()) + { + Settings.Save(p); + p.startDownloader(); + } + else + { + Menu c = menuStack.remove(menuStack.size() - 1); + c.run(p); + } + } + + static void goBackOuterMenu(final MainActivity p) + { + if(!menuStack.isEmpty()) + menuStack.remove(menuStack.size() - 1); + goBack(p); + } + + static class OkButton extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.ok); + } + void run (final MainActivity p) + { + goBackOuterMenu(p); + } + } + + static class DummyMenu extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.ok); + } + void run (final MainActivity p) + { + goBack(p); + } + } + + static class MainMenu extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.device_config); + } + void run (final MainActivity p) + { + Menu options[] = + { + new SettingsMenuMisc.DownloadConfig(), + new SettingsMenuMisc.OptionalDownloadConfig(false), + new SettingsMenuKeyboard.KeyboardConfigMainMenu(), + new SettingsMenuMouse.MouseConfigMainMenu(), + new SettingsMenuMisc.GyroscopeCalibration(), + new SettingsMenuMisc.AudioConfig(), + new SettingsMenuKeyboard.RemapHwKeysConfig(), + new SettingsMenuKeyboard.ScreenGesturesConfig(), + new SettingsMenuMisc.VideoSettingsConfig(), + new SettingsMenuMisc.ResetToDefaultsConfig(), + new OkButton(), + }; + showMenuOptionsList(p, options); + } + } +} diff --git a/project/java/SettingsMenuKeyboard.java b/project/java/SettingsMenuKeyboard.java new file mode 100644 index 000000000..cb616da10 --- /dev/null +++ b/project/java/SettingsMenuKeyboard.java @@ -0,0 +1,842 @@ +/* +Simple DirectMedia Layer +Java source code (C) 2009-2012 Sergii Pylypenko + +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. +*/ + +package net.sourceforge.clonekeenplus; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; +import android.util.Log; +import java.io.*; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Environment; +import android.os.StatFs; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.zip.GZIPInputStream; +import java.util.Collections; +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import java.lang.String; +import android.graphics.Matrix; +import android.graphics.RectF; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.FrameLayout; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.widget.TextView; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.Button; +import android.view.View; +import android.widget.LinearLayout; +import android.text.Editable; +import android.text.SpannedString; +import android.content.Intent; +import android.app.PendingIntent; +import android.app.AlarmManager; +import android.util.DisplayMetrics; +import android.net.Uri; +import java.util.concurrent.Semaphore; +import java.util.Arrays; +import android.graphics.Color; +import android.hardware.SensorEventListener; +import android.hardware.SensorEvent; +import android.hardware.Sensor; +import android.widget.Toast; + + +class SettingsMenuKeyboard extends SettingsMenu +{ + static class KeyboardConfigMainMenu extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.controls_screenkb); + } + boolean enabled() + { + return Globals.UseTouchscreenKeyboard; + } + void run (final MainActivity p) + { + Menu options[] = + { + new ScreenKeyboardThemeConfig(), + new ScreenKeyboardSizeConfig(), + new ScreenKeyboardDrawSizeConfig(), + new ScreenKeyboardTransparencyConfig(), + new RemapScreenKbConfig(), + new CustomizeScreenKbLayout(), + new OkButton(), + }; + showMenuOptionsList(p, options); + } + } + + static class ScreenKeyboardSizeConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.controls_screenkb_size); + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large), + p.getResources().getString(R.string.controls_screenkb_medium), + p.getResources().getString(R.string.controls_screenkb_small), + p.getResources().getString(R.string.controls_screenkb_tiny), + p.getResources().getString(R.string.controls_screenkb_custom) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.controls_screenkb_size)); + builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardSize, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.TouchscreenKeyboardSize = item; + dialog.dismiss(); + if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM ) + new CustomizeScreenKbLayout().run(p); + else + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class ScreenKeyboardDrawSizeConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.controls_screenkb_drawsize); + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large), + p.getResources().getString(R.string.controls_screenkb_medium), + p.getResources().getString(R.string.controls_screenkb_small), + p.getResources().getString(R.string.controls_screenkb_tiny) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.controls_screenkb_drawsize)); + builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardDrawSize, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.TouchscreenKeyboardDrawSize = item; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class ScreenKeyboardThemeConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.controls_screenkb_theme); + } + void run (final MainActivity p) + { + final CharSequence[] items = { + p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"), + p.getResources().getString(R.string.controls_screenkb_by, "Simple Theme", "Beholder"), + p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea") + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.controls_screenkb_theme)); + builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTheme, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.TouchscreenKeyboardTheme = item; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class ScreenKeyboardTransparencyConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.controls_screenkb_transparency); + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_trans_0), + p.getResources().getString(R.string.controls_screenkb_trans_1), + p.getResources().getString(R.string.controls_screenkb_trans_2), + p.getResources().getString(R.string.controls_screenkb_trans_3), + p.getResources().getString(R.string.controls_screenkb_trans_4) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.controls_screenkb_transparency)); + builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTransparency, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.TouchscreenKeyboardTransparency = item; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class RemapHwKeysConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.remap_hwkeys); + } + void run (final MainActivity p) + { + p.setText(p.getResources().getString(R.string.remap_hwkeys_press)); + p.keyListener = new KeyRemapTool(p); + } + + public static class KeyRemapTool implements MainActivity.KeyEventsListener + { + MainActivity p; + public KeyRemapTool(MainActivity _p) + { + p = _p; + } + + public void onKeyEvent(final int keyCode) + { + p.keyListener = null; + int keyIndex = keyCode; + if( keyIndex < 0 ) + keyIndex = 0; + if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST ) + keyIndex = 0; + + final int KeyIndexFinal = keyIndex; + CharSequence[] items = { + SDL_Keys.names[Globals.RemapScreenKbKeycode[0]], + SDL_Keys.names[Globals.RemapScreenKbKeycode[1]], + SDL_Keys.names[Globals.RemapScreenKbKeycode[2]], + SDL_Keys.names[Globals.RemapScreenKbKeycode[3]], + SDL_Keys.names[Globals.RemapScreenKbKeycode[4]], + SDL_Keys.names[Globals.RemapScreenKbKeycode[5]], + p.getResources().getString(R.string.remap_hwkeys_select_more_keys), + }; + + for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ ) + items[i] = Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " "); + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.remap_hwkeys_select_simple); + builder.setItems(items, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + if( item >= 6 ) + ShowAllKeys(KeyIndexFinal); + else + { + Globals.RemapHwKeycode[KeyIndexFinal] = Globals.RemapScreenKbKeycode[item]; + goBack(p); + } + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + public void ShowAllKeys(final int KeyIndex) + { + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.remap_hwkeys_select); + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[KeyIndex]], new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RemapHwKeycode[KeyIndex] = SDL_Keys.namesSortedIdx[item]; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + } + + static class RemapScreenKbConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.remap_screenkb); + } + //boolean enabled() { return true; }; + void run (final MainActivity p) + { + CharSequence[] items = { + p.getResources().getString(R.string.remap_screenkb_joystick), + p.getResources().getString(R.string.remap_screenkb_button_text), + p.getResources().getString(R.string.remap_screenkb_button) + " 1", + p.getResources().getString(R.string.remap_screenkb_button) + " 2", + p.getResources().getString(R.string.remap_screenkb_button) + " 3", + p.getResources().getString(R.string.remap_screenkb_button) + " 4", + p.getResources().getString(R.string.remap_screenkb_button) + " 5", + p.getResources().getString(R.string.remap_screenkb_button) + " 6", + }; + + boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length); + if( Globals.AppUsesSecondJoystick ) + { + items = Arrays.copyOf(items, items.length + 1); + items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2"; + defaults = Arrays.copyOf(defaults, defaults.length + 1); + defaults[defaults.length - 1] = true; + } + + for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ ) + items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " "); + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.remap_screenkb)); + builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() + { + public void onClick(DialogInterface dialog, int item, boolean isChecked) + { + Globals.ScreenKbControlsShown[item] = isChecked; + } + }); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + showRemapScreenKbConfig2(p, 0); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showRemapScreenKbConfig2(final MainActivity p, final int currentButton) + { + CharSequence[] items = { + p.getResources().getString(R.string.remap_screenkb_button) + " 1", + p.getResources().getString(R.string.remap_screenkb_button) + " 2", + p.getResources().getString(R.string.remap_screenkb_button) + " 3", + p.getResources().getString(R.string.remap_screenkb_button) + " 4", + p.getResources().getString(R.string.remap_screenkb_button) + " 5", + p.getResources().getString(R.string.remap_screenkb_button) + " 6", + }; + + for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ ) + items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " "); + + if( currentButton >= Globals.RemapScreenKbKeycode.length ) + { + goBack(p); + return; + } + if( ! Globals.ScreenKbControlsShown[currentButton + 2] ) + { + showRemapScreenKbConfig2(p, currentButton + 1); + return; + } + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(items[currentButton]); + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; + + dialog.dismiss(); + showRemapScreenKbConfig2(p, currentButton + 1); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class ScreenGesturesConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.remap_screenkb_button_gestures); + } + //boolean enabled() { return true; }; + void run (final MainActivity p) + { + CharSequence[] items = { + p.getResources().getString(R.string.remap_screenkb_button_zoomin), + p.getResources().getString(R.string.remap_screenkb_button_zoomout), + p.getResources().getString(R.string.remap_screenkb_button_rotateleft), + p.getResources().getString(R.string.remap_screenkb_button_rotateright), + }; + + boolean defaults[] = { + Globals.MultitouchGesturesUsed[0], + Globals.MultitouchGesturesUsed[1], + Globals.MultitouchGesturesUsed[2], + Globals.MultitouchGesturesUsed[3], + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.remap_screenkb_button_gestures)); + builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() + { + public void onClick(DialogInterface dialog, int item, boolean isChecked) + { + Globals.MultitouchGesturesUsed[item] = isChecked; + } + }); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + showScreenGesturesConfig2(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showScreenGesturesConfig2(final MainActivity p) + { + final CharSequence[] items = { + p.getResources().getString(R.string.accel_slow), + p.getResources().getString(R.string.accel_medium), + p.getResources().getString(R.string.accel_fast), + p.getResources().getString(R.string.accel_veryfast) + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.remap_screenkb_button_gestures_sensitivity); + builder.setSingleChoiceItems(items, Globals.MultitouchGestureSensitivity, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.MultitouchGestureSensitivity = item; + + dialog.dismiss(); + showScreenGesturesConfig3(p, 0); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showScreenGesturesConfig3(final MainActivity p, final int currentButton) + { + CharSequence[] items = { + p.getResources().getString(R.string.remap_screenkb_button_zoomin), + p.getResources().getString(R.string.remap_screenkb_button_zoomout), + p.getResources().getString(R.string.remap_screenkb_button_rotateleft), + p.getResources().getString(R.string.remap_screenkb_button_rotateright), + }; + + if( currentButton >= Globals.RemapMultitouchGestureKeycode.length ) + { + goBack(p); + return; + } + if( ! Globals.MultitouchGesturesUsed[currentButton] ) + { + showScreenGesturesConfig3(p, currentButton + 1); + return; + } + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(items[currentButton]); + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; + + dialog.dismiss(); + showScreenGesturesConfig3(p, currentButton + 1); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class CustomizeScreenKbLayout extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.screenkb_custom_layout); + } + //boolean enabled() { return true; }; + void run (final MainActivity p) + { + p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help)); + CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p); + p.touchListener = tool; + p.keyListener = tool; + Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM; + } + + static class CustomizeScreenKbLayoutTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener + { + MainActivity p; + FrameLayout layout = null; + ImageView imgs[] = new ImageView[Globals.ScreenKbControlsLayout.length]; + Bitmap bmps[] = new Bitmap[Globals.ScreenKbControlsLayout.length]; + ImageView boundary = null; + Bitmap boundaryBmp = null; + int currentButton = 0; + int buttons[] = { + R.drawable.dpad, + R.drawable.keyboard, + R.drawable.b1, + R.drawable.b2, + R.drawable.b3, + R.drawable.b4, + R.drawable.b5, + R.drawable.b6, + R.drawable.dpad + }; + int oldX = 0, oldY = 0; + boolean resizing = false; + + public CustomizeScreenKbLayoutTool(MainActivity _p) + { + p = _p; + layout = new FrameLayout(p); + p.getVideoLayout().addView(layout); + boundary = new ImageView(p); + boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + boundary.setScaleType(ImageView.ScaleType.MATRIX); + boundaryBmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.rectangle ); + boundary.setImageBitmap(boundaryBmp); + layout.addView(boundary); + currentButton = -1; + if( Globals.TouchscreenKeyboardTheme == 2 ) + { + buttons = new int[] { + R.drawable.sun_dpad, + R.drawable.sun_keyboard, + R.drawable.sun_b1, + R.drawable.sun_b2, + R.drawable.sun_b3, + R.drawable.sun_b4, + R.drawable.sun_b5, + R.drawable.sun_b6, + R.drawable.sun_dpad + }; + } + + int displayX = 800; + int displayY = 480; + try { + DisplayMetrics dm = new DisplayMetrics(); + p.getWindowManager().getDefaultDisplay().getMetrics(dm); + displayX = dm.widthPixels; + displayY = dm.heightPixels; + } catch (Exception eeeee) {} + + for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) + { + if( ! Globals.ScreenKbControlsShown[i] ) + continue; + if( currentButton == -1 ) + currentButton = i; + //Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] ); + // Check if the button is off screen edge or shrunk to zero + if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayY/12 ) + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY/12; + if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/12 ) + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/12; + if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] - displayY*2/3 ) + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY*2/3; + if( Globals.ScreenKbControlsLayout[i][1] < Globals.ScreenKbControlsLayout[i][3] - displayY*2/3 ) + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY*2/3; + if( Globals.ScreenKbControlsLayout[i][0] < 0 ) + { + Globals.ScreenKbControlsLayout[i][2] += -Globals.ScreenKbControlsLayout[i][0]; + Globals.ScreenKbControlsLayout[i][0] = 0; + } + if( Globals.ScreenKbControlsLayout[i][2] > displayX ) + { + Globals.ScreenKbControlsLayout[i][0] -= Globals.ScreenKbControlsLayout[i][2] - displayX; + Globals.ScreenKbControlsLayout[i][2] = displayX; + } + if( Globals.ScreenKbControlsLayout[i][1] < 0 ) + { + Globals.ScreenKbControlsLayout[i][3] += -Globals.ScreenKbControlsLayout[i][1]; + Globals.ScreenKbControlsLayout[i][1] = 0; + } + if( Globals.ScreenKbControlsLayout[i][3] > displayY ) + { + Globals.ScreenKbControlsLayout[i][1] -= Globals.ScreenKbControlsLayout[i][3] - displayY; + Globals.ScreenKbControlsLayout[i][3] = displayY; + } + //Log.i("SDL", "After bounds check coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] ); + + imgs[i] = new ImageView(p); + imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + imgs[i].setScaleType(ImageView.ScaleType.MATRIX); + bmps[i] = BitmapFactory.decodeResource( p.getResources(), buttons[i] ); + imgs[i].setImageBitmap(bmps[i]); + imgs[i].setAlpha(128); + layout.addView(imgs[i]); + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); + RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], + Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + imgs[i].setImageMatrix(m); + } + boundary.bringToFront(); + if( currentButton == -1 ) + onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything + else + setupButton(currentButton); + } + + void setupButton(int i) + { + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); + RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], + Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + imgs[i].setImageMatrix(m); + m = new Matrix(); + src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + boundary.setImageMatrix(m); + String buttonText = ""; + if( i >= 2 && i <= 7 ) + buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 2); + if( i >= 2 && i - 2 < Globals.AppTouchscreenKeyboardKeysNames.length ) + buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 2].replace("_", " "); + if( i == 0 ) + buttonText = "Joystick"; + if( i == 1 ) + buttonText = "Text input"; + if( i == 8 ) + buttonText = "Joystick 2"; + p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText); + } + + public void onTouchEvent(final MotionEvent ev) + { + if( ev.getAction() == MotionEvent.ACTION_DOWN ) + { + oldX = (int)ev.getX(); + oldY = (int)ev.getY(); + resizing = true; + for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) + { + if( ! Globals.ScreenKbControlsShown[i] ) + continue; + if( Globals.ScreenKbControlsLayout[i][0] <= oldX && + Globals.ScreenKbControlsLayout[i][2] >= oldX && + Globals.ScreenKbControlsLayout[i][1] <= oldY && + Globals.ScreenKbControlsLayout[i][3] >= oldY ) + { + currentButton = i; + setupButton(currentButton); + resizing = false; + break; + } + } + } + if( ev.getAction() == MotionEvent.ACTION_MOVE ) + { + int dx = (int)ev.getX() - oldX; + int dy = (int)ev.getY() - oldY; + if( resizing ) + { + // Resize slowly, with 1/3 of movement speed + dx /= 6; + dy /= 6; + if( Globals.ScreenKbControlsLayout[currentButton][0] <= Globals.ScreenKbControlsLayout[currentButton][2] + dx*2 ) + { + Globals.ScreenKbControlsLayout[currentButton][0] -= dx; + Globals.ScreenKbControlsLayout[currentButton][2] += dx; + } + if( Globals.ScreenKbControlsLayout[currentButton][1] <= Globals.ScreenKbControlsLayout[currentButton][3] + dy*2 ) + { + Globals.ScreenKbControlsLayout[currentButton][1] += dy; + Globals.ScreenKbControlsLayout[currentButton][3] -= dy; + } + dx *= 6; + dy *= 6; + } + else + { + Globals.ScreenKbControlsLayout[currentButton][0] += dx; + Globals.ScreenKbControlsLayout[currentButton][2] += dx; + Globals.ScreenKbControlsLayout[currentButton][1] += dy; + Globals.ScreenKbControlsLayout[currentButton][3] += dy; + } + oldX += dx; + oldY += dy; + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight()); + RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1], + Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + imgs[currentButton].setImageMatrix(m); + m = new Matrix(); + src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + boundary.setImageMatrix(m); + } + } + + public void onKeyEvent(final int keyCode) + { + if( keyCode == KeyEvent.KEYCODE_BACK ) + { + p.getVideoLayout().removeView(layout); + layout = null; + p.touchListener = null; + p.keyListener = null; + goBack(p); + } + } + } + } +} + diff --git a/project/java/SettingsMenuMisc.java b/project/java/SettingsMenuMisc.java new file mode 100644 index 000000000..1cfae7263 --- /dev/null +++ b/project/java/SettingsMenuMisc.java @@ -0,0 +1,701 @@ +/* +Simple DirectMedia Layer +Java source code (C) 2009-2012 Sergii Pylypenko + +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. +*/ + +package net.sourceforge.clonekeenplus; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; +import android.util.Log; +import java.io.*; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Environment; +import android.os.StatFs; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.zip.GZIPInputStream; +import java.util.Collections; +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import java.lang.String; +import android.graphics.Matrix; +import android.graphics.RectF; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.FrameLayout; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.widget.TextView; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.Button; +import android.view.View; +import android.widget.LinearLayout; +import android.text.Editable; +import android.text.SpannedString; +import android.content.Intent; +import android.app.PendingIntent; +import android.app.AlarmManager; +import android.util.DisplayMetrics; +import android.net.Uri; +import java.util.concurrent.Semaphore; +import java.util.Arrays; +import android.graphics.Color; +import android.hardware.SensorEventListener; +import android.hardware.SensorEvent; +import android.hardware.Sensor; +import android.widget.Toast; + + +class SettingsMenuMisc extends SettingsMenu +{ + static class DownloadConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.storage_question); + } + void run (final MainActivity p) + { + long freeSdcard = 0; + long freePhone = 0; + try + { + StatFs sdcard = new StatFs(Environment.getExternalStorageDirectory().getPath()); + StatFs phone = new StatFs(Environment.getDataDirectory().getPath()); + freeSdcard = (long)sdcard.getAvailableBlocks() * sdcard.getBlockSize() / 1024 / 1024; + freePhone = (long)phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024; + } + catch(Exception e) {} + + final CharSequence[] items = { p.getResources().getString(R.string.storage_phone, freePhone), + p.getResources().getString(R.string.storage_sd, freeSdcard), + p.getResources().getString(R.string.storage_custom) }; + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.storage_question)); + builder.setSingleChoiceItems(items, Globals.DownloadToSdcard ? 1 : 0, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + + if( item == 2 ) + showCustomDownloadDirConfig(p); + else + { + Globals.DownloadToSdcard = (item != 0); + Globals.DataDir = Globals.DownloadToSdcard ? + Settings.SdcardAppPath.getPath(p) : + p.getFilesDir().getAbsolutePath(); + goBack(p); + } + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + static void showCustomDownloadDirConfig(final MainActivity p) + { + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.storage_custom)); + + final EditText edit = new EditText(p); + edit.setFocusableInTouchMode(true); + edit.setFocusable(true); + edit.setText(Globals.DataDir); + builder.setView(edit); + + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.DataDir = edit.getText().toString(); + dialog.dismiss(); + showCommandLineConfig(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + static void showCommandLineConfig(final MainActivity p) + { + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.storage_commandline)); + + final EditText edit = new EditText(p); + edit.setFocusableInTouchMode(true); + edit.setFocusable(true); + edit.setText(Globals.CommandLine); + builder.setView(edit); + + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.CommandLine = edit.getText().toString(); + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class OptionalDownloadConfig extends Menu + { + boolean firstStart = false; + OptionalDownloadConfig() + { + firstStart = true; + } + OptionalDownloadConfig(boolean firstStart) + { + this.firstStart = firstStart; + } + String title(final MainActivity p) + { + return p.getResources().getString(R.string.downloads); + } + void run (final MainActivity p) + { + String [] downloadFiles = Globals.DataDownloadUrl; + final boolean [] mandatory = new boolean[downloadFiles.length]; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.downloads)); + + CharSequence[] items = new CharSequence[downloadFiles.length]; + for(int i = 0; i < downloadFiles.length; i++ ) + { + items[i] = new String(downloadFiles[i].split("[|]")[0]); + if( items[i].toString().indexOf("!") == 0 ) + items[i] = items[i].toString().substring(1); + if( items[i].toString().indexOf("!") == 0 ) + { + items[i] = items[i].toString().substring(1); + mandatory[i] = true; + } + } + + if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != items.length ) + { + Globals.OptionalDataDownload = new boolean[downloadFiles.length]; + boolean oldFormat = true; + for( int i = 0; i < downloadFiles.length; i++ ) + { + if( downloadFiles[i].indexOf("!") == 0 ) + { + Globals.OptionalDataDownload[i] = true; + oldFormat = false; + } + } + if( oldFormat ) + { + Globals.OptionalDataDownload[0] = true; + mandatory[0] = true; + } + } + + builder.setMultiChoiceItems(items, Globals.OptionalDataDownload, new DialogInterface.OnMultiChoiceClickListener() + { + public void onClick(DialogInterface dialog, int item, boolean isChecked) + { + Globals.OptionalDataDownload[item] = isChecked; + if( mandatory[item] && !isChecked ) + { + Globals.OptionalDataDownload[item] = true; + ((AlertDialog)dialog).getListView().setItemChecked(item, true); + } + } + }); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + goBack(p); + } + }); + if( firstStart ) + { + builder.setNegativeButton(p.getResources().getString(R.string.show_more_options), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + menuStack.clear(); + new MainMenu().run(p); + } + }); + } + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class AudioConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.audiobuf_question); + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_verysmall), + p.getResources().getString(R.string.audiobuf_small), + p.getResources().getString(R.string.audiobuf_medium), + p.getResources().getString(R.string.audiobuf_large) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.audiobuf_question); + builder.setSingleChoiceItems(items, Globals.AudioBufferConfig, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.AudioBufferConfig = item; + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class VideoSettingsConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.video); + } + //boolean enabled() { return true; }; + void run (final MainActivity p) + { + CharSequence[] items = { + p.getResources().getString(R.string.pointandclick_keepaspectratio), + p.getResources().getString(R.string.video_smooth) + }; + boolean defaults[] = { + Globals.KeepAspectRatio, + Globals.VideoLinearFilter + }; + + if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo) + { + CharSequence[] items2 = { + p.getResources().getString(R.string.pointandclick_keepaspectratio), + p.getResources().getString(R.string.video_smooth), + p.getResources().getString(R.string.video_separatethread), + }; + boolean defaults2[] = { + Globals.KeepAspectRatio, + Globals.VideoLinearFilter, + Globals.MultiThreadedVideo + }; + items = items2; + defaults = defaults2; + } + + if(Globals.Using_SDL_1_3) + { + CharSequence[] items2 = { + p.getResources().getString(R.string.pointandclick_keepaspectratio), + }; + boolean defaults2[] = { + Globals.KeepAspectRatio, + }; + items = items2; + defaults = defaults2; + } + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.video)); + builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() + { + public void onClick(DialogInterface dialog, int item, boolean isChecked) + { + if( item == 0 ) + Globals.KeepAspectRatio = isChecked; + if( item == 1 ) + Globals.VideoLinearFilter = isChecked; + if( item == 2 ) + Globals.MultiThreadedVideo = isChecked; + } + }); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class ShowReadme extends Menu + { + String title(final MainActivity p) + { + return "Readme"; + } + boolean enabled() + { + return true; + } + void run (final MainActivity p) + { + String readmes[] = Globals.ReadmeText.split("\\^"); + String lang = new String(Locale.getDefault().getLanguage()) + ":"; + String readme = readmes[0]; + String buttonName = "", buttonUrl = ""; + for( String r: readmes ) + { + if( r.startsWith(lang) ) + readme = r.substring(lang.length()); + if( r.startsWith("button:") ) + { + buttonName = r.substring("button:".length()); + if( buttonName.indexOf(":") != -1 ) + { + buttonUrl = buttonName.substring(buttonName.indexOf(":") + 1); + buttonName = buttonName.substring(0, buttonName.indexOf(":")); + } + } + } + readme = readme.trim(); + if( readme.length() <= 2 ) + { + goBack(p); + return; + } + TextView text = new TextView(p); + text.setMaxLines(1000); + text.setText(readme); + text.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); + AlertDialog.Builder builder = new AlertDialog.Builder(p); + ScrollView scroll = new ScrollView(p); + scroll.addView(text); + Button ok = new Button(p); + final AlertDialog alertDismiss[] = new AlertDialog[1]; + ok.setOnClickListener(new View.OnClickListener() + { + public void onClick(View v) + { + alertDismiss[0].cancel(); + } + }); + ok.setText(R.string.ok); + LinearLayout layout = new LinearLayout(p); + layout.setOrientation(LinearLayout.VERTICAL); + layout.addView(scroll); + layout.addView(ok); + if( buttonName.length() > 0 ) + { + Button cancel = new Button(p); + cancel.setText(buttonName); + final String url = buttonUrl; + cancel.setOnClickListener(new View.OnClickListener() + { + public void onClick(View v) + { + if( url.length() > 0 ) + { + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + p.startActivity(i); + } + alertDismiss[0].cancel(); + System.exit(0); + } + }); + layout.addView(cancel); + } + builder.setView(layout); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alertDismiss[0] = alert; + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class GyroscopeCalibration extends Menu implements SensorEventListener + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.calibrate_gyroscope); + } + boolean enabled() + { + return Globals.AppUsesGyroscope; + } + void run (final MainActivity p) + { + if( !Globals.AppUsesGyroscope || !AccelerometerReader.gyro.available(p) ) + { + if( Globals.AppUsesGyroscope ) + { + Toast toast = Toast.makeText(p, p.getResources().getString(R.string.calibrate_gyroscope_not_supported), Toast.LENGTH_LONG); + toast.show(); + } + goBack(p); + return; + } + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.calibrate_gyroscope)); + builder.setMessage(p.getResources().getString(R.string.calibrate_gyroscope_text)); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + startCalibration(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + ImageView img; + Bitmap bmp; + int numEvents; + MainActivity p; + + void startCalibration(final MainActivity _p) + { + p = _p; + img = new ImageView(p); + img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + img.setScaleType(ImageView.ScaleType.MATRIX); + bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate ); + img.setImageBitmap(bmp); + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); + RectF dst = new RectF( p.getVideoLayout().getWidth()/2 - 50, p.getVideoLayout().getHeight()/2 - 50, + p.getVideoLayout().getWidth()/2 + 50, p.getVideoLayout().getHeight()/2 + 50); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + img.setImageMatrix(m); + p.getVideoLayout().addView(img); + numEvents = 0; + AccelerometerReader.gyro.x1 = 100; + AccelerometerReader.gyro.x2 = -100; + AccelerometerReader.gyro.xc = 0; + AccelerometerReader.gyro.y1 = 100; + AccelerometerReader.gyro.y2 = -100; + AccelerometerReader.gyro.yc = 0; + AccelerometerReader.gyro.z1 = 100; + AccelerometerReader.gyro.z2 = -100; + AccelerometerReader.gyro.zc = 0; + AccelerometerReader.gyro.registerListener(p, this); + (new Thread(new Runnable() + { + public void run() + { + for(int count = 1; count < 10; count++) + { + p.setText("" + count + "0% ..."); + try { + Thread.sleep(500); + } catch( Exception e ) {} + } + finishCalibration(p); + } + } + )).start(); + } + + public void onSensorChanged(SensorEvent event) + { + gyroscopeEvent(event.values[0], event.values[1], event.values[2]); + } + public void onAccuracyChanged(Sensor s, int a) + { + } + void gyroscopeEvent(float x, float y, float z) + { + numEvents++; + AccelerometerReader.gyro.xc += x; + AccelerometerReader.gyro.yc += y; + AccelerometerReader.gyro.zc += z; + AccelerometerReader.gyro.x1 = Math.min(AccelerometerReader.gyro.x1, x * 1.1f); // Small safety bound coefficient + AccelerometerReader.gyro.x2 = Math.max(AccelerometerReader.gyro.x2, x * 1.1f); + AccelerometerReader.gyro.y1 = Math.min(AccelerometerReader.gyro.y1, y * 1.1f); + AccelerometerReader.gyro.y2 = Math.max(AccelerometerReader.gyro.y2, y * 1.1f); + AccelerometerReader.gyro.z1 = Math.min(AccelerometerReader.gyro.z1, z * 1.1f); + AccelerometerReader.gyro.z2 = Math.max(AccelerometerReader.gyro.z2, z * 1.1f); + final Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); + RectF dst = new RectF( x * 5000 + p.getVideoLayout().getWidth()/2 - 50, y * 5000 + p.getVideoLayout().getHeight()/2 - 50, + x * 5000 + p.getVideoLayout().getWidth()/2 + 50, y * 5000 + p.getVideoLayout().getHeight()/2 + 50); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + p.runOnUiThread(new Runnable() + { + public void run() + { + img.setImageMatrix(m); + } + }); + } + void finishCalibration(final MainActivity p) + { + AccelerometerReader.gyro.unregisterListener(p, this); + try { + Thread.sleep(200); // Just in case we have pending events + } catch( Exception e ) {} + if( numEvents > 5 ) + { + AccelerometerReader.gyro.xc /= (float)numEvents; + AccelerometerReader.gyro.yc /= (float)numEvents; + AccelerometerReader.gyro.zc /= (float)numEvents; + } + p.runOnUiThread(new Runnable() + { + public void run() + { + p.getVideoLayout().removeView(img); + goBack(p); + } + }); + } + } + + static class ResetToDefaultsConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.reset_config); + } + boolean enabled() + { + return true; + } + void run (final MainActivity p) + { + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.reset_config_ask)); + builder.setMessage(p.getResources().getString(R.string.reset_config_ask)); + + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Settings.DeleteSdlConfigOnUpgradeAndRestart(p); // Never returns + dialog.dismiss(); + goBack(p); + } + }); + builder.setNegativeButton(p.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } +} + diff --git a/project/java/SettingsMenuMouse.java b/project/java/SettingsMenuMouse.java new file mode 100644 index 000000000..c4495874d --- /dev/null +++ b/project/java/SettingsMenuMouse.java @@ -0,0 +1,771 @@ +/* +Simple DirectMedia Layer +Java source code (C) 2009-2012 Sergii Pylypenko + +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. +*/ + +package net.sourceforge.clonekeenplus; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; +import android.util.Log; +import java.io.*; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Environment; +import android.os.StatFs; +import java.util.Locale; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.zip.GZIPInputStream; +import java.util.Collections; +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import java.lang.String; +import android.graphics.Matrix; +import android.graphics.RectF; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.FrameLayout; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.widget.TextView; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.Button; +import android.view.View; +import android.widget.LinearLayout; +import android.text.Editable; +import android.text.SpannedString; +import android.content.Intent; +import android.app.PendingIntent; +import android.app.AlarmManager; +import android.util.DisplayMetrics; +import android.net.Uri; +import java.util.concurrent.Semaphore; +import java.util.Arrays; +import android.graphics.Color; +import android.hardware.SensorEventListener; +import android.hardware.SensorEvent; +import android.hardware.Sensor; +import android.widget.Toast; + + +class SettingsMenuMouse extends SettingsMenu +{ + static class MouseConfigMainMenu extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.mouse_emulation); + } + boolean enabled() + { + return Globals.AppUsesMouse; + } + void run (final MainActivity p) + { + Menu options[] = + { + new DisplaySizeConfig(false), + new LeftClickConfig(), + new RightClickConfig(), + new AdditionalMouseConfig(), + new JoystickMouseConfig(), + new TouchPressureMeasurementTool(), + new CalibrateTouchscreenMenu(), + new OkButton(), + }; + showMenuOptionsList(p, options); + } + } + + static class DisplaySizeConfig extends Menu + { + boolean firstStart = false; + DisplaySizeConfig() + { + this.firstStart = true; + } + DisplaySizeConfig(boolean firstStart) + { + this.firstStart = firstStart; + } + String title(final MainActivity p) + { + return p.getResources().getString(R.string.display_size_mouse); + } + void run (final MainActivity p) + { + CharSequence[] items = { + p.getResources().getString(R.string.display_size_tiny_touchpad), + p.getResources().getString(R.string.display_size_tiny), + p.getResources().getString(R.string.display_size_small), + p.getResources().getString(R.string.display_size_small_touchpad), + p.getResources().getString(R.string.display_size_large), + }; + int _size_tiny_touchpad = 0; + int _size_tiny = 1; + int _size_small = 2; + int _size_small_touchpad = 3; + int _size_large = 4; + int _more_options = 5; + + if( ! Globals.SwVideoMode ) + { + CharSequence[] items2 = { + p.getResources().getString(R.string.display_size_small_touchpad), + p.getResources().getString(R.string.display_size_large), + }; + items = items2; + _size_small_touchpad = 0; + _size_large = 1; + _size_tiny_touchpad = _size_tiny = _size_small = 1000; + + } + if( firstStart ) + { + CharSequence[] items2 = { + p.getResources().getString(R.string.display_size_tiny_touchpad), + p.getResources().getString(R.string.display_size_tiny), + p.getResources().getString(R.string.display_size_small), + p.getResources().getString(R.string.display_size_small_touchpad), + p.getResources().getString(R.string.display_size_large), + p.getResources().getString(R.string.show_more_options), + }; + items = items2; + if( ! Globals.SwVideoMode ) + { + CharSequence[] items3 = { + p.getResources().getString(R.string.display_size_small_touchpad), + p.getResources().getString(R.string.display_size_large), + p.getResources().getString(R.string.show_more_options), + }; + items = items3; + _more_options = 3; + } + } + // Java is so damn worse than C++11 + final int size_tiny_touchpad = _size_tiny_touchpad; + final int size_tiny = _size_tiny; + final int size_small = _size_small; + final int size_small_touchpad = _size_small_touchpad; + final int size_large = _size_large; + final int more_options = _more_options; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.display_size); + class ClickListener implements DialogInterface.OnClickListener + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + if( item == size_large ) + { + Globals.LeftClickMethod = Mouse.LEFT_CLICK_NORMAL; + Globals.RelativeMouseMovement = false; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; + } + if( item == size_small ) + { + Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; + Globals.RelativeMouseMovement = false; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER; + } + if( item == size_small_touchpad ) + { + Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; + Globals.RelativeMouseMovement = true; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; + } + if( item == size_tiny ) + { + Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; + Globals.RelativeMouseMovement = false; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_SCREEN_TRANSFORM; + } + if( item == size_tiny_touchpad ) + { + Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; + Globals.RelativeMouseMovement = true; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_FULLSCREEN_MAGNIFIER; + } + if( item == more_options ) + { + menuStack.clear(); + new MainMenu().run(p); + return; + } + goBack(p); + } + } + builder.setItems(items, new ClickListener()); + /* + else + builder.setSingleChoiceItems(items, + Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ? + ( Globals.RelativeMouseMovement ? Globals.SwVideoMode ? 2 : 1 : 0 ) : + ( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 : + Globals.ShowScreenUnderFinger + 1, + new ClickListener()); + */ + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class LeftClickConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.leftclick_question); + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.leftclick_normal), + p.getResources().getString(R.string.leftclick_near_cursor), + p.getResources().getString(R.string.leftclick_multitouch), + p.getResources().getString(R.string.leftclick_pressure), + p.getResources().getString(R.string.rightclick_key), + p.getResources().getString(R.string.leftclick_timeout), + p.getResources().getString(R.string.leftclick_tap), + p.getResources().getString(R.string.leftclick_tap_or_timeout) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.leftclick_question); + builder.setSingleChoiceItems(items, Globals.LeftClickMethod, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + Globals.LeftClickMethod = item; + if( item == Mouse.LEFT_CLICK_WITH_KEY ) + p.keyListener = new KeyRemapToolMouseClick(p, true); + else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT ) + showLeftClickTimeoutConfig(p); + else + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + static void showLeftClickTimeoutConfig(final MainActivity p) { + final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0), + p.getResources().getString(R.string.leftclick_timeout_time_1), + p.getResources().getString(R.string.leftclick_timeout_time_2), + p.getResources().getString(R.string.leftclick_timeout_time_3), + p.getResources().getString(R.string.leftclick_timeout_time_4) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.leftclick_timeout_time); + builder.setSingleChoiceItems(items, Globals.LeftClickTimeout, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.LeftClickTimeout = item; + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class RightClickConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.rightclick_question); + } + boolean enabled() + { + return Globals.AppNeedsTwoButtonMouse; + } + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.rightclick_none), + p.getResources().getString(R.string.rightclick_multitouch), + p.getResources().getString(R.string.rightclick_pressure), + p.getResources().getString(R.string.rightclick_key), + p.getResources().getString(R.string.leftclick_timeout) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.rightclick_question); + builder.setSingleChoiceItems(items, Globals.RightClickMethod, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RightClickMethod = item; + dialog.dismiss(); + if( item == Mouse.RIGHT_CLICK_WITH_KEY ) + p.keyListener = new KeyRemapToolMouseClick(p, false); + else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT ) + showRightClickTimeoutConfig(p); + else + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showRightClickTimeoutConfig(final MainActivity p) { + final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0), + p.getResources().getString(R.string.leftclick_timeout_time_1), + p.getResources().getString(R.string.leftclick_timeout_time_2), + p.getResources().getString(R.string.leftclick_timeout_time_3), + p.getResources().getString(R.string.leftclick_timeout_time_4) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.leftclick_timeout_time); + builder.setSingleChoiceItems(items, Globals.RightClickTimeout, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RightClickTimeout = item; + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + public static class KeyRemapToolMouseClick implements MainActivity.KeyEventsListener + { + MainActivity p; + boolean leftClick; + public KeyRemapToolMouseClick(MainActivity _p, boolean leftClick) + { + p = _p; + p.setText(p.getResources().getString(R.string.remap_hwkeys_press)); + this.leftClick = leftClick; + } + + public void onKeyEvent(final int keyCode) + { + p.keyListener = null; + int keyIndex = keyCode; + if( keyIndex < 0 ) + keyIndex = 0; + if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST ) + keyIndex = 0; + + if( leftClick ) + Globals.LeftClickKey = keyIndex; + else + Globals.RightClickKey = keyIndex; + + goBack(p); + } + } + + static class AdditionalMouseConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.pointandclick_question); + } + void run (final MainActivity p) + { + CharSequence[] items = { + p.getResources().getString(R.string.pointandclick_joystickmouse), + p.getResources().getString(R.string.click_with_dpadcenter), + p.getResources().getString(R.string.pointandclick_relative) + }; + + boolean defaults[] = { + Globals.MoveMouseWithJoystick, + Globals.ClickMouseWithDpad, + Globals.RelativeMouseMovement + }; + + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(p.getResources().getString(R.string.pointandclick_question)); + builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener() + { + public void onClick(DialogInterface dialog, int item, boolean isChecked) + { + if( item == 0 ) + Globals.MoveMouseWithJoystick = isChecked; + if( item == 1 ) + Globals.ClickMouseWithDpad = isChecked; + if( item == 2 ) + Globals.RelativeMouseMovement = isChecked; + } + }); + builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + dialog.dismiss(); + if( Globals.RelativeMouseMovement ) + showRelativeMouseMovementConfig(p); + else + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showRelativeMouseMovementConfig(final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.accel_veryslow), + p.getResources().getString(R.string.accel_slow), + p.getResources().getString(R.string.accel_medium), + p.getResources().getString(R.string.accel_fast), + p.getResources().getString(R.string.accel_veryfast) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.pointandclick_relative_speed); + builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementSpeed, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RelativeMouseMovementSpeed = item; + + dialog.dismiss(); + showRelativeMouseMovementConfig1(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showRelativeMouseMovementConfig1(final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.none), + p.getResources().getString(R.string.accel_slow), + p.getResources().getString(R.string.accel_medium), + p.getResources().getString(R.string.accel_fast) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.pointandclick_relative_accel); + builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementAccel, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.RelativeMouseMovementAccel = item; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class JoystickMouseConfig extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.pointandclick_joystickmousespeed); + } + boolean enabled() + { + return Globals.MoveMouseWithJoystick; + }; + void run (final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.accel_slow), + p.getResources().getString(R.string.accel_medium), + p.getResources().getString(R.string.accel_fast) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.pointandclick_joystickmousespeed); + builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickSpeed, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.MoveMouseWithJoystickSpeed = item; + + dialog.dismiss(); + showJoystickMouseAccelConfig(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + + static void showJoystickMouseAccelConfig(final MainActivity p) + { + final CharSequence[] items = { p.getResources().getString(R.string.none), + p.getResources().getString(R.string.accel_slow), + p.getResources().getString(R.string.accel_medium), + p.getResources().getString(R.string.accel_fast) }; + + AlertDialog.Builder builder = new AlertDialog.Builder(p); + builder.setTitle(R.string.pointandclick_joystickmouseaccel); + builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickAccel, new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int item) + { + Globals.MoveMouseWithJoystickAccel = item; + + dialog.dismiss(); + goBack(p); + } + }); + builder.setOnCancelListener(new DialogInterface.OnCancelListener() + { + public void onCancel(DialogInterface dialog) + { + goBack(p); + } + }); + AlertDialog alert = builder.create(); + alert.setOwnerActivity(p); + alert.show(); + } + } + + static class TouchPressureMeasurementTool extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.measurepressure); + } + boolean enabled() + { + return Globals.RightClickMethod == Mouse.RIGHT_CLICK_WITH_PRESSURE || + Globals.LeftClickMethod == Mouse.LEFT_CLICK_WITH_PRESSURE; + }; + void run (final MainActivity p) + { + p.setText(p.getResources().getString(R.string.measurepressure_touchplease)); + p.touchListener = new TouchMeasurementTool(p); + } + + public static class TouchMeasurementTool implements MainActivity.TouchEventsListener + { + MainActivity p; + ArrayList force = new ArrayList(); + ArrayList radius = new ArrayList(); + static final int maxEventAmount = 100; + + public TouchMeasurementTool(MainActivity _p) + { + p = _p; + } + + public void onTouchEvent(final MotionEvent ev) + { + force.add(new Integer((int)(ev.getPressure() * 1000.0))); + radius.add(new Integer((int)(ev.getSize() * 1000.0))); + p.setText(p.getResources().getString(R.string.measurepressure_response, force.get(force.size()-1), radius.get(radius.size()-1))); + try { + Thread.sleep(10L); + } catch (InterruptedException e) { } + + if( force.size() >= maxEventAmount ) + { + p.touchListener = null; + Globals.ClickScreenPressure = getAverageForce(); + Globals.ClickScreenTouchspotSize = getAverageRadius(); + Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize); + goBack(p); + } + } + + int getAverageForce() + { + int avg = 0; + for(Integer f: force) + { + avg += f; + } + return avg / force.size(); + } + int getAverageRadius() + { + int avg = 0; + for(Integer r: radius) + { + avg += r; + } + return avg / radius.size(); + } + } + } + + static class CalibrateTouchscreenMenu extends Menu + { + String title(final MainActivity p) + { + return p.getResources().getString(R.string.calibrate_touchscreen); + } + //boolean enabled() { return true; }; + void run (final MainActivity p) + { + p.setText(p.getResources().getString(R.string.calibrate_touchscreen_touch)); + Globals.TouchscreenCalibration[0] = 0; + Globals.TouchscreenCalibration[1] = 0; + Globals.TouchscreenCalibration[2] = 0; + Globals.TouchscreenCalibration[3] = 0; + ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p); + p.touchListener = tool; + p.keyListener = tool; + } + + static class ScreenEdgesCalibrationTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener + { + MainActivity p; + ImageView img; + Bitmap bmp; + + public ScreenEdgesCalibrationTool(MainActivity _p) + { + p = _p; + img = new ImageView(p); + img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + img.setScaleType(ImageView.ScaleType.MATRIX); + bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate ); + img.setImageBitmap(bmp); + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); + RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], + Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + img.setImageMatrix(m); + p.getVideoLayout().addView(img); + } + + public void onTouchEvent(final MotionEvent ev) + { + if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] && + Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] && + Globals.TouchscreenCalibration[2] == Globals.TouchscreenCalibration[3] ) + { + Globals.TouchscreenCalibration[0] = (int)ev.getX(); + Globals.TouchscreenCalibration[1] = (int)ev.getY(); + Globals.TouchscreenCalibration[2] = (int)ev.getX(); + Globals.TouchscreenCalibration[3] = (int)ev.getY(); + } + if( ev.getX() < Globals.TouchscreenCalibration[0] ) + Globals.TouchscreenCalibration[0] = (int)ev.getX(); + if( ev.getY() < Globals.TouchscreenCalibration[1] ) + Globals.TouchscreenCalibration[1] = (int)ev.getY(); + if( ev.getX() > Globals.TouchscreenCalibration[2] ) + Globals.TouchscreenCalibration[2] = (int)ev.getX(); + if( ev.getY() > Globals.TouchscreenCalibration[3] ) + Globals.TouchscreenCalibration[3] = (int)ev.getY(); + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight()); + RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], + Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + img.setImageMatrix(m); + } + + public void onKeyEvent(final int keyCode) + { + p.touchListener = null; + p.keyListener = null; + p.getVideoLayout().removeView(img); + goBack(p); + } + } + } +} + diff --git a/project/java/Video.java b/project/java/Video.java index 3425f4c2c..01abb2004 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -47,6 +47,7 @@ import android.graphics.drawable.BitmapDrawable; import android.content.res.Resources; import android.content.res.AssetManager; import android.widget.Toast; +import android.util.Log; import android.widget.TextView; import java.lang.Thread; @@ -108,7 +109,7 @@ abstract class DifferentTouchInput multiTouchAvailable2 = true; } try { - System.out.println("Device model: " + android.os.Build.MODEL); + Log.i("SDL", "Device model: " + android.os.Build.MODEL); if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH ) { return IcsTouchInput.Holder.sInstance; @@ -191,7 +192,7 @@ abstract class DifferentTouchInput { int action = -1; - //System.out.println("Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY()); + //Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY()); if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP || (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_CANCEL ) { @@ -231,7 +232,7 @@ abstract class DifferentTouchInput { s += " p" + event.getPointerId(i) + "=" + (int)event.getX(i) + ":" + (int)event.getY(i); } - System.out.println(s); + Log.i("SDL", s); */ int pointerReleased = -1; if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP ) @@ -332,7 +333,7 @@ abstract class DifferentTouchInput private int buttonState = 0; public void process(final MotionEvent event) { - //System.out.println("Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource()); + //Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource()); int buttonStateNew = event.getButtonState(); if( buttonStateNew != buttonState ) { @@ -379,7 +380,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer } public void onSurfaceCreated(GL10 gl, EGLConfig config) { - System.out.println("libSDL: DemoRenderer.onSurfaceCreated(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart ); + Log.i("SDL", "libSDL: DemoRenderer.onSurfaceCreated(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart ); mGlSurfaceCreated = true; mGl = gl; if( ! mPaused && ! mFirstTimeStart ) @@ -388,7 +389,14 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer } public void onSurfaceChanged(GL10 gl, int w, int h) { - System.out.println("libSDL: DemoRenderer.onSurfaceChanged(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart ); + Log.i("SDL", "libSDL: DemoRenderer.onSurfaceChanged(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart + " w " + w + " h " + h); + if( w < h && Globals.HorizontalOrientation ) + { + // Sometimes when Android awakes from lockscreen, portrait orientation is kept + int x = w; + w = h; + h = x; + } mWidth = w; mHeight = h; mGl = gl; @@ -396,7 +404,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer } public void onSurfaceDestroyed() { - System.out.println("libSDL: DemoRenderer.onSurfaceDestroyed(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart ); + Log.i("SDL", "libSDL: DemoRenderer.onSurfaceDestroyed(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart ); mGlSurfaceCreated = false; mGlContextLost = true; nativeGlContextLost(); @@ -568,6 +576,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer } public void DrawLogo(GL10 gl) { + /* // TODO: this not quite works, as it seems BitmapDrawable bmp = null; try @@ -618,6 +627,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer gl.glDeleteTextures(1, mTextureNameWorkspace, 0); gl.glFlush(); + */ } @@ -723,7 +733,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL { return; mRenderer.mPaused = false; super.onResume(); - System.out.println("libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated " + mRenderer.mGlSurfaceCreated + " mRenderer.mPaused " + mRenderer.mPaused); + Log.i("SDL", "libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated " + mRenderer.mGlSurfaceCreated + " mRenderer.mPaused " + mRenderer.mPaused); if( mRenderer.mGlSurfaceCreated && ! mRenderer.mPaused || Globals.NonBlockingSwapBuffers ) mRenderer.nativeGlContextRecreated(); if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization? @@ -733,7 +743,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL { // This seems like redundant code - it handled in MainActivity.java @Override public boolean onKeyDown(int keyCode, final KeyEvent event) { - //System.out.println("Got key down event, id " + keyCode + " meta " + event.getMetaState() + " event " + event.toString()); + //Log.i("SDL", "Got key down event, id " + keyCode + " meta " + event.getMetaState() + " event " + event.toString()); if( nativeKey( keyCode, 1 ) == 0 ) return super.onKeyDown(keyCode, event); return true; @@ -741,7 +751,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL { @Override public boolean onKeyUp(int keyCode, final KeyEvent event) { - //System.out.println("Got key up event, id " + keyCode + " meta " + event.getMetaState()); + //Log.i("SDL", "Got key up event, id " + keyCode + " meta " + event.getMetaState()); if( nativeKey( keyCode, 0 ) == 0 ) return super.onKeyUp(keyCode, event); return true; diff --git a/project/java/translations/values-fr/strings.xml b/project/java/translations/values-fr/strings.xml index 33f606fc2..abc5c397c 100644 --- a/project/java/translations/values-fr/strings.xml +++ b/project/java/translations/values-fr/strings.xml @@ -172,4 +172,5 @@ Yes No Press BACK when done. Resize buttons by sliding on empty space. +Custom diff --git a/project/java/translations/values-ru/strings.xml b/project/java/translations/values-ru/strings.xml index b81408e8b..4c615c60c 100644 --- a/project/java/translations/values-ru/strings.xml +++ b/project/java/translations/values-ru/strings.xml @@ -26,10 +26,10 @@ Дополнительные Ñлементы ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð­ÐºÑ€Ð°Ð½Ð½Ð°Ñ ÐºÐ»Ð°Ð²Ð¸Ð°Ñ‚ÑƒÑ€Ð° ÐкÑелерометр -Ð­ÐºÑ€Ð°Ð½Ð½Ð°Ñ ÐºÐ»Ð°Ð²Ð¸Ð°Ñ‚ÑƒÑ€Ð° размером +Размер Ñкранной клавиатуры Большой Средний -Малые +Маленький Крошечный Тема клавиатуры %1$s от %2$s @@ -87,10 +87,10 @@ Экранный джойÑтик Экранные кнопки Ð­ÐºÑ€Ð°Ð½Ð½Ð°Ñ ÐºÐ½Ð¾Ð¿ÐºÐ° ввода текÑта -Увеличить Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ жеÑÑ‚ -Уменьшить Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ жеÑÑ‚ -Повернуть налево Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ жеÑÑ‚ -Повернуть вправо Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ жеÑÑ‚ +Увеличить Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ +Уменьшить Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ +Повернуть налево Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ +Повернуть вправо Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ ЖеÑÑ‚ Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ по Ñкрану Очень быÑтро ЧувÑтвительноÑть жеÑта Ð´Ð²ÑƒÐ¼Ñ Ð¿Ð°Ð»ÑŒÑ†Ð°Ð¼Ð¸ по Ñкрану @@ -145,4 +145,5 @@ Загрузка может быть продолжена позднее. Да Ðет +ПользовательÑкие наÑтройки diff --git a/project/java/translations/values-uk/strings.xml b/project/java/translations/values-uk/strings.xml index d9573df4a..746d6aac2 100644 --- a/project/java/translations/values-uk/strings.xml +++ b/project/java/translations/values-uk/strings.xml @@ -87,10 +87,10 @@ Ðаекранний джойÑтік Ðаекранні кнопки Ðаекранна кнопка вводу текÑту -Збільшити двома пальцÑми жеÑÑ‚ -Зменшити двома пальцÑми жеÑÑ‚ -Повернути наліво двома пальцÑми жеÑÑ‚ -Повернути праворуч двома пальцÑми жеÑÑ‚ +Збільшити двома пальцÑми +Зменшити двома пальцÑми +Повернути наліво двома пальцÑми +Повернути праворуч двома пальцÑми ЖеÑÑ‚ двома пальцÑми по екрану Дуже швидко ЧутливіÑть жеÑту двома пальцÑми по екрану @@ -144,4 +144,5 @@ Ð—Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ð¼Ð¾Ð¶Ðµ бути відновлено пізніше. Так ÐÑ– +ÐÐ°Ð»Ð°ÑˆÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ ÐºÐ¾Ñ€Ð¸Ñтувача diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml index f232b23d4..e6ffc801c 100644 --- a/project/java/translations/values/strings.xml +++ b/project/java/translations/values/strings.xml @@ -45,6 +45,7 @@ Medium Small Tiny + Custom On-screen keyboard theme %1$s by %2$s On-screen keyboard transparency @@ -123,11 +124,13 @@ Remap physical keys Press any key except HOME and POWER, you may use volume keys Select SDL keycode + Select action + Show all keycodes Remap on-screen controls - On-screen joystick - On-screen button - On-screen text input button + Joystick + Button + Text input button Two-finger screen gestures Two-finger screen gestures sensitivity Zoom in two-finger gesture diff --git a/project/jni/SettingsTemplate.mk b/project/jni/SettingsTemplate.mk index bcb8d2a4a..07fe12147 100644 --- a/project/jni/SettingsTemplate.mk +++ b/project/jni/SettingsTemplate.mk @@ -1,5 +1,5 @@ -# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 APP_MODULES := application sdl-1.2 sdl_main stlport jpeg png ogg flac vorbis freetype tremor ogg # To filter out static libs from all libs in makefile diff --git a/project/jni/application/ballfield/AndroidAppSettings.cfg b/project/jni/application/ballfield/AndroidAppSettings.cfg index 08466b91f..c92e5c2ae 100644 --- a/project/jni/application/ballfield/AndroidAppSettings.cfg +++ b/project/jni/application/ballfield/AndroidAppSettings.cfg @@ -1,62 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="Ballfield" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=net.olofson.ballfield + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer InhibitSuspend=n -AppDataDownloadUrl="Game data is 1 Mb|ballfield3.zip" + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!Game data is 1 Mb|ballfield3.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=16 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y -SdlVideoResizeKeepAspect=n + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) +SdlVideoResizeKeepAspect=y + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=y + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) AppNeedsArrowKeys=y + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=y + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 AppUsesAccelerometer=y + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 AppUsesGyroscope=y + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=y + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" -AppTouchscreenKeyboardKeysAmount=1 + +# Number of virtual keyboard keys (currently 6 is maximum) +AppTouchscreenKeyboardKeysAmount=6 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig HiddenMenuOptions='OptionalDownloadConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 + +# Application version code (integer) AppVersionCode=101 + +# Application user-visible version name (string) AppVersionName="1.01" + +# Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 CompiledLibraries="sdl_image" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=n + +# Aditional CFLAGS for application AppCflags='-O2 -finline-functions' + +# Additional LDFLAGS for application AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) AppSubdirsBuild='' + +# Exclude these files from build AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on ReadmeText='^Readme text' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge MinimumScreenSize=s + +# Your AdMob Publisher ID, (n) if you don't want advertisements AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize= + diff --git a/project/jni/application/ballfield/ballfield.cpp b/project/jni/application/ballfield/ballfield.cpp index 46bb8b42a..7259519c9 100644 --- a/project/jni/application/ballfield/ballfield.cpp +++ b/project/jni/application/ballfield/ballfield.cpp @@ -25,7 +25,7 @@ Definitions... ----------------------------------------------------------*/ -#define SCREEN_W 800 +#define SCREEN_W 640 #define SCREEN_H 480 @@ -562,6 +562,8 @@ int main(int argc, char* argv[]) SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r); __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w); } + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1); + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1); while(1) { diff --git a/project/jni/application/commandergenius/AndroidAppSettings.cfg b/project/jni/application/commandergenius/AndroidAppSettings.cfg index dd4091a95..b2003dbce 100644 --- a/project/jni/application/commandergenius/AndroidAppSettings.cfg +++ b/project/jni/application/commandergenius/AndroidAppSettings.cfg @@ -1,62 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="Commander Genius" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=net.sourceforge.clonekeenplus + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer InhibitSuspend=n + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS AppDataDownloadUrl="!Keen1|keen1.zip^!Keen4|keen4.zip^!Keen7|keen7.zip^High-quality GFX and music - 50 Mb|http://sourceforge.net/projects/clonekeenplus/files/High%20Quality%20Packs/Version%202.x/hqpv20.zip/download" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=24 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=n + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=n + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) AppNeedsArrowKeys=y + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=n + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=n + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 AppUsesAccelerometer=y + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="LCTRL LALT NO_REMAP NO_REMAP RETURN ESCAPE" + +# Number of virtual keyboard keys (currently 6 is maximum) AppTouchscreenKeyboardKeysAmount=4 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=1 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) RedefinedKeysScreenKb="LCTRL LALT SPACE RETURN" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu RedefinedKeysScreenKbNames="LCTRL LALT SPACE RETURN" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig HiddenMenuOptions='' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) MultiABI=n + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=64 + +# Application version code (integer) AppVersionCode=144000 + +# Application user-visible version name (string) AppVersionName="1.4.4 Release" + +# Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 CompiledLibraries="tremor ogg sdl_image" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=n + +# Aditional CFLAGS for application AppCflags='-frtti -fexceptions -finline-functions -O2 -DTREMOR=1 -DANDROID=1 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11' + +# Additional LDFLAGS for application AppLdflags='-ltremor' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) AppSubdirsBuild='commandergenius/src/*' + +# Exclude these files from build AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on ReadmeText='^You may press "Home" now - the data will be downloaded in background' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge MinimumScreenSize=m + +# Your AdMob Publisher ID, (n) if you don't want advertisements AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize= + diff --git a/project/jni/application/fheroes2/AndroidAppSettings.cfg b/project/jni/application/fheroes2/AndroidAppSettings.cfg index 18d259296..89b99484d 100644 --- a/project/jni/application/fheroes2/AndroidAppSettings.cfg +++ b/project/jni/application/fheroes2/AndroidAppSettings.cfg @@ -16,6 +16,11 @@ SdlVideoResizeKeepAspect=n CompatibilityHacks=n CompatibilityHacksStaticInit=n CompatibilityHacksTextInputEmulatesHwKeyboard=n +CompatibilityHacksPreventAudioChopping=n +CompatibilityHacksAppIgnoresAudioBufferSize=n +CompatibilityHacksAdditionalPreloadedSharedLibraries="" +CompatibilityHacksSlowCompatibleEventQueue=y +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= AppUsesMouse=y AppNeedsTwoButtonMouse=y ShowMouseCursor=n @@ -24,25 +29,31 @@ AppNeedsArrowKeys=n AppNeedsTextInput=n AppUsesJoystick=n AppUsesAccelerometer=n +AppUsesGyroscope=n AppUsesMultitouch=n +AppRecordsAudio=y NonBlockingSwapBuffers=n RedefinedKeys="LCTRL T NO_REMAP NO_REMAP H" AppTouchscreenKeyboardKeysAmount=0 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="LCTRL M SPACE C E C H T S L" +RedefinedKeysScreenKbNames="LCTRL M SPACE C E C H T S L" StartupMenuButtonTimeout=3000 HiddenMenuOptions='' FirstStartMenuOptions='' MultiABI=n -AppVersionCode=288220 -AppVersionName="2882.20" +AppMinimumRAM=32 +AppVersionCode=304100 +AppVersionName="3041.00" ResetSdlConfigForThisVersion=n DeleteFilesOnUpgrade="libsdl-DownloadFinished-5.flag libsdl-DownloadFinished-6.flag libsdl-DownloadFinished-7.flag libsdl-DownloadFinished-8.flag libsdl-DownloadFinished-9.flag libsdl-DownloadFinished-10.flag libsdl-DownloadFinished-11.flag libsdl-DownloadFinished-12.flag libsdl-DownloadFinished-13.flag libsdl-DownloadFinished-14.flag" CompiledLibraries="sdl_net sdl_mixer sdl_image sdl_ttf png intl" CustomBuildScript=n AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF -DWITH_AI=simple -DWITH_DEBUG -DWITH_EDITOR -frtti' AppLdflags='' +AppOverlapsSystemHeaders= AppSubdirsBuild='fheroes2/src/engine fheroes2/src/xmlccwrap fheroes2/src/fheroes2/agg fheroes2/src/fheroes2/ai fheroes2/src/fheroes2/ai/simple fheroes2/src/fheroes2/army fheroes2/src/fheroes2/battle fheroes2/src/fheroes2/castle fheroes2/src/fheroes2/dialog fheroes2/src/fheroes2/editor fheroes2/src/fheroes2/game fheroes2/src/fheroes2/gui fheroes2/src/fheroes2/heroes fheroes2/src/fheroes2/image fheroes2/src/fheroes2/kingdom fheroes2/src/fheroes2/maps fheroes2/src/fheroes2/monster fheroes2/src/fheroes2/objects fheroes2/src/fheroes2/pocketpc fheroes2/src/fheroes2/resource fheroes2/src/fheroes2/spell fheroes2/src/fheroes2/system fheroes2/src/fheroes2/test' +AppBuildExclude='' AppCmdline='fheroes2' ReadmeText='^You may press "Home" now - the data will be downloaded in background' MinimumScreenSize=s diff --git a/project/jni/application/openarena/AndroidAppSettings.cfg b/project/jni/application/openarena/AndroidAppSettings.cfg index b862d4d64..26cdeda37 100644 --- a/project/jni/application/openarena/AndroidAppSettings.cfg +++ b/project/jni/application/openarena/AndroidAppSettings.cfg @@ -1,62 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="OpenArena" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=ws.openarena.sdl + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer InhibitSuspend=n + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS AppDataDownloadUrl="!Game data|:baseoa/pak0.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak0.pk3/download^!Game data|:baseoa/pak1-maps.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak1-maps.pk3/download^!Game data|:baseoa/pak2-players-mature.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak2-players-mature.pk3/download^!Game data|:baseoa/pak2-players.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak2-players.pk3/download^!Game data|:baseoa/pak4-textures.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak4-textures.pk3/download^!Game data|:baseoa/pak5-TA.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak5-TA.pk3/download^!Game data|:baseoa/pak6-misc.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak6-misc.pk3/download^!Game data|:baseoa/pak6-patch085.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak6-patch085.pk3/download^!Game data|:baseoa/pak6-patch088.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/pak6-patch088.pk3/download^!Game data|:baseoa/skn-arachna-forlorna.pk3:http://sourceforge.net/projects/libsdl-android/files/OpenArena/0.8.8/skn-arachna-forlorna.pk3/download^!Game logic|:baseoa/pak7-android.pk3:pak7-android.pk3" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=24 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=y + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=n + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=n + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) AppNeedsArrowKeys=y + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=n + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 AppUsesAccelerometer=y + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 AppUsesGyroscope=y + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=y + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) AppRecordsAudio=y + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="SPACE SPACE NO_REMAP NO_REMAP RETURN ESCAPE LCTRL" + +# Number of virtual keyboard keys (currently 6 is maximum) AppTouchscreenKeyboardKeysAmount=6 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) RedefinedKeysScreenKb="SLASH BACKSPACE TAB END LCTRL SPACE UNKNOWN UNKNOWN UNKNOWN UNKNOWN" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu RedefinedKeysScreenKbNames="Change_weapon Sniper_view Show_scores Center_view Fire Jump" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default +# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() +# Available menu items: +# new SettingsMenu.OkButton(), new SettingsMenu.DummyMenu(), new SettingsMenu.MainMenu(), new SettingsMenuMisc.DownloadConfig(), new SettingsMenuMisc.OptionalDownloadConfig(), new SettingsMenuMisc.AudioConfig(), new SettingsMenuMisc.VideoSettingsConfig(), new SettingsMenuMisc.ShowReadme(), new SettingsMenuMisc.GyroscopeCalibration(), new SettingsMenuMisc.ResetToDefaultsConfig(), new SettingsMenuMouse.MouseConfigMainMenu(), new SettingsMenuMouse.DisplaySizeConfig(), new SettingsMenuMouse.LeftClickConfig(), new SettingsMenuMouse.RightClickConfig(), new SettingsMenuMouse.AdditionalMouseConfig(), new SettingsMenuMouse.JoystickMouseConfig(), new SettingsMenuMouse.TouchPressureMeasurementTool(), new SettingsMenuMouse.CalibrateTouchscreenMenu(), new SettingsMenuKeyboard.KeyboardConfigMainMenu(), new SettingsMenuKeyboard.ScreenKeyboardSizeConfig(), new SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig(), new SettingsMenuKeyboard.ScreenKeyboardThemeConfig(), new SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig(), new SettingsMenuKeyboard.RemapHwKeysConfig(), new SettingsMenuKeyboard.RemapScreenKbConfig(), new SettingsMenuKeyboard.ScreenGesturesConfig(), new SettingsMenuKeyboard.CustomizeScreenKbLayout(), FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=300 -AppVersionCode=08822 -AppVersionName="0.8.8.22" + +# Application version code (integer) +AppVersionCode=08823 + +# Application user-visible version name (string) +AppVersionName="0.8.8.23" + +# Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) DeleteFilesOnUpgrade="libsdl-DownloadFinished-10.flag" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 CompiledLibraries="sdl_mixer sdl_image freetype curl vorbis ogg openal" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=y + +# Aditional CFLAGS for application AppCflags='-O2 -finline-functions' + +# Additional LDFLAGS for application AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) AppSubdirsBuild='' + +# Exclude these files from build AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) ReadmeText='^Readme text' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge MinimumScreenSize=n + +# Your AdMob Publisher ID, (n) if you don't want advertisements AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad AdmobTestDeviceId=66133194946FB6C1CD0ED2EFCCB82539 + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize=BANNER + diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 1c3f8aa9c..a90f54fd4 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 1c3f8aa9c102c1a1c70e18b2bcb0a955decc2033 +Subproject commit a90f54fd4886f7288dc2090632bf69d18de86703 diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index c88124ddc..79d6cc69d 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit c88124ddcb2f6b7857ac72497d30a30459d3545e +Subproject commit 79d6cc69dbcd406e1172d27c37869568908e3987 diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg index a43bf9f31..6209e1073 100644 --- a/project/jni/application/openttd/AndroidAppSettings.cfg +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -1,62 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="OpenTTD" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=org.openttd.sdl + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer InhibitSuspend=n -AppDataDownloadUrl="!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.3.0.zip/download^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!Config file|:.openttd/openttd.cfg:openttd-1.3.0.25.cfg" + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.3.1.zip/download^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Config file|:.openttd/openttd.cfg:openttd-1.3.0.25.cfg" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=16 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=y + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) AppNeedsArrowKeys=n + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=n + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=n + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="LALT RETURN NO_REMAP NO_REMAP SPACE DELETE" + +# Number of virtual keyboard keys (currently 6 is maximum) AppTouchscreenKeyboardKeysAmount=0 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu RedefinedKeysScreenKbNames="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig HiddenMenuOptions='OptionalDownloadConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) MultiABI=n + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 -AppVersionCode=13025 -AppVersionName="1.3.0.25" + +# Application version code (integer) +AppVersionCode=13125 + +# Application user-visible version name (string) +AppVersionName="1.3.1.25" + +# Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 CompiledLibraries="jpeg png freetype timidity lzma lzo2" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=y + +# Aditional CFLAGS for application AppCflags='' + +# Additional LDFLAGS for application AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) AppSubdirsBuild='' + +# Exclude these files from build AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param AppCmdline='openttd' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) ReadmeText='^You may press "Home" now - the data will be downloaded in background' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge MinimumScreenSize=s + +# Your AdMob Publisher ID, (n) if you don't want advertisements AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize= + diff --git a/project/jni/application/openttd/AndroidBuild.sh b/project/jni/application/openttd/AndroidBuild.sh index b77e2b136..4c2ffa8e4 100755 --- a/project/jni/application/openttd/AndroidBuild.sh +++ b/project/jni/application/openttd/AndroidBuild.sh @@ -2,7 +2,7 @@ LOCAL_PATH=`dirname $0` LOCAL_PATH=`cd $LOCAL_PATH && pwd` -VER=1.3.0 +VER=1.3.1 if [ \! -d openttd-$VER ] ; then diff --git a/project/jni/application/openttd/openttd-trunk-android.patch b/project/jni/application/openttd/openttd-trunk-android.patch index 0d0acdf2f..f8b30e50e 100644 --- a/project/jni/application/openttd/openttd-trunk-android.patch +++ b/project/jni/application/openttd/openttd-trunk-android.patch @@ -1,5 +1,5 @@ ---- src/debug.cpp 2013-03-31 23:56:27.000000000 +0300 -+++ src/debug.cpp 2013-04-04 21:22:32.082336178 +0300 +--- src/debug.cpp 2013-05-31 23:57:15.000000000 +0300 ++++ src/debug.cpp 2013-06-02 17:34:54.700814123 +0300 @@ -16,6 +16,9 @@ #include "string_func.h" #include "fileio_func.h" @@ -20,8 +20,8 @@ #if defined(ENABLE_NETWORK) if (_debug_socket != INVALID_SOCKET) { char buf2[1024 + 32]; ---- src/fontcache.cpp 2013-03-31 23:56:27.000000000 +0300 -+++ src/fontcache.cpp 2013-04-04 21:22:32.082336178 +0300 +--- src/fontcache.cpp 2013-05-31 23:57:15.000000000 +0300 ++++ src/fontcache.cpp 2013-06-02 17:34:54.700814123 +0300 @@ -808,7 +808,15 @@ return ret; } @@ -39,8 +39,8 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) {return FT_Err_Cannot_Open_Resource;} bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; } #endif /* WITH_FONTCONFIG */ ---- src/music/libtimidity.cpp 2013-03-31 23:56:08.000000000 +0300 -+++ src/music/libtimidity.cpp 2013-04-04 21:22:32.082336178 +0300 +--- src/music/libtimidity.cpp 2013-05-31 23:56:52.000000000 +0300 ++++ src/music/libtimidity.cpp 2013-06-02 17:34:54.700814123 +0300 @@ -13,6 +13,7 @@ #include "../openttd.h" #include "../sound_type.h" @@ -82,8 +82,8 @@ /** Factory for the libtimidity driver. */ static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity; ---- src/network/core/os_abstraction.h 2013-03-31 23:56:21.000000000 +0300 -+++ src/network/core/os_abstraction.h 2013-04-04 21:22:32.086336178 +0300 +--- src/network/core/os_abstraction.h 2013-05-31 23:57:06.000000000 +0300 ++++ src/network/core/os_abstraction.h 2013-06-02 17:34:54.700814123 +0300 @@ -161,7 +161,7 @@ # include /* According to glibc/NEWS, appeared in glibc-2.3. */ @@ -93,8 +93,8 @@ /* If for any reason ifaddrs.h does not exist on your system, comment out * the following two lines and an alternative way will be used to fetch * the list of IPs from the system. */ ---- src/os/unix/crashlog_unix.cpp 2013-03-31 23:56:09.000000000 +0300 -+++ src/os/unix/crashlog_unix.cpp 2013-04-04 21:22:32.086336178 +0300 +--- src/os/unix/crashlog_unix.cpp 2013-05-31 23:56:54.000000000 +0300 ++++ src/os/unix/crashlog_unix.cpp 2013-06-02 17:34:54.700814123 +0300 @@ -141,7 +141,11 @@ }; @@ -107,8 +107,8 @@ /** * Entry point for the crash handler. ---- src/os/unix/unix.cpp 2013-03-31 23:56:09.000000000 +0300 -+++ src/os/unix/unix.cpp 2013-04-04 21:22:32.086336178 +0300 +--- src/os/unix/unix.cpp 2013-05-31 23:56:54.000000000 +0300 ++++ src/os/unix/unix.cpp 2013-06-02 17:34:54.704814123 +0300 @@ -25,7 +25,7 @@ #ifdef __APPLE__ @@ -130,8 +130,8 @@ int CDECL main(int argc, char *argv[]) { int ret; ---- src/osk_gui.cpp 2013-03-31 23:56:27.000000000 +0300 -+++ src/osk_gui.cpp 2013-04-04 21:24:19.418335198 +0300 +--- src/osk_gui.cpp 2013-05-31 23:57:15.000000000 +0300 ++++ src/osk_gui.cpp 2013-06-02 17:41:23.344810333 +0300 @@ -21,6 +21,9 @@ #include "table/sprites.h" @@ -142,13 +142,15 @@ char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES]; -@@ -411,6 +414,14 @@ +@@ -411,6 +414,16 @@ GetKeyboardLayout(); new OskWindow(&_osk_desc, parent, button); +#ifdef __ANDROID__ -+ SDL_ANDROID_GetScreenKeyboardTextInput(parent->text.buf, parent->text.max_bytes); /* Invoke Android built-in screen keyboard */ ++ char text[256]; ++ SDL_ANDROID_GetScreenKeyboardTextInput(text, sizeof(text) - 1); /* Invoke Android built-in screen keyboard */ + OskWindow *osk = dynamic_cast(FindWindowById(WC_OSK, 0)); ++ osk->qs->text.Assign(text); + free(osk->orig_str_buf); + osk->orig_str_buf = strdup(osk->qs->text.buf); + @@ -157,8 +159,8 @@ } /** ---- src/script/api/script_date.cpp 2013-03-31 23:56:17.000000000 +0300 -+++ src/script/api/script_date.cpp 2013-04-04 21:22:32.090336178 +0300 +--- src/script/api/script_date.cpp 2013-05-31 23:57:01.000000000 +0300 ++++ src/script/api/script_date.cpp 2013-06-02 17:34:54.704814123 +0300 @@ -9,8 +9,8 @@ /** @file script_date.cpp Implementation of ScriptDate. */ @@ -169,8 +171,8 @@ #include "script_date.hpp" #include "../../date_func.h" ---- src/sound/sdl_s.cpp 2013-03-31 23:56:07.000000000 +0300 -+++ src/sound/sdl_s.cpp 2013-04-04 21:22:32.090336178 +0300 +--- src/sound/sdl_s.cpp 2013-05-31 23:56:51.000000000 +0300 ++++ src/sound/sdl_s.cpp 2013-06-02 17:34:54.704814123 +0300 @@ -21,6 +21,10 @@ /** Factory for the SDL sound driver. */ static FSoundDriver_SDL iFSoundDriver_SDL; @@ -192,8 +194,8 @@ } const char *SoundDriver_SDL::Start(const char * const *parm) ---- src/video/sdl_v.cpp 2013-03-31 23:55:59.000000000 +0300 -+++ src/video/sdl_v.cpp 2013-04-04 21:26:10.534334178 +0300 +--- src/video/sdl_v.cpp 2013-05-31 23:56:34.000000000 +0300 ++++ src/video/sdl_v.cpp 2013-06-02 17:34:54.704814123 +0300 @@ -25,6 +25,9 @@ #include "../fileio_func.h" #include "sdl_v.h" diff --git a/project/jni/application/sc2/AUTHORS b/project/jni/application/sc2/AUTHORS deleted file mode 100644 index e34b166dd..000000000 --- a/project/jni/application/sc2/AUTHORS +++ /dev/null @@ -1,204 +0,0 @@ -We worship these two higher beings for making the original, legendary game: - Fred Ford - Paul Reiche III - - -The Ur-Quan Masters port: -------------------------- - -Core team (in alphabetical order): - Serge van den Boom - Mika Kolehmainen - Michael Chapman Martin - Chris Nelson - Alex Volkov - -Additional programming (in alphabetical order): - Geoffrey Hausheer - Nicolas Simonds - -Music remixers (in alphabetical order): - Jouni Airaksinen - Tore Aune Fjellstad - Espen Gätzschmann - Aaron J. Grier - Dan Nicholson - George Nowik - Riku Nuottajärvi - Erol Otus - -Other contributions (in alphabetical order): - Jouni Airaksinen (Startup Menu) - Karl Bartel - Travis Chase (BeOS port) - Felix Lazarev (3DO internals) - Parker MacMillan - Sanjay Madhav (code patches) - Robert McNamara (MacOS X stuff) - Mike Melanson (ADPCM basis from FFmpeg used for DUK audio) - Mudrony Laszlo (PC/DOS content unpacking) - Erol Otus (Splash screen) - Brian Rogers - Horatiu Romosan (v0.1 Win32 installer) - Zarla Sheenaza (0.6 Win32 installer graphics) - Joffrey Smith (setup graphics) - Peter van Valderen - Alex Volkov (additional slides) - Alexander Waseleski (code patches) - Yukki (v0.1 Win32 installer graphics) - - -Original game: --------------- - -Programming & technology: - Fred Ford - -Game design and fiction: - Paul Reiche III - -3DO programming: - Ken Ford - Fred Ford - Brad Van Tighem - -Producer (3DO version): - Mark Wallace - -3DO production: - Paul Reiche III - Richard Antaki - -Starring the voices of: - Richard Antaki ....... Thraddash - Alex Bennett ......... Starbase Commander - Rich Betz ............ Ariloulaleelay - ............ Druuge - Roy Blumenfeld ....... Zoq-Fot-Pik - David Bryce .......... Kohr-Ah - .......... Ilwrath - .......... Shofixti - .......... Spathi - Lauren Forcella ...... Supox - Greg Johnson ......... Orz - ......... Pkunk - ......... Utwig - Bruce Leyland ........ Yehat - Erol Otus ............ Chmmr - Paul Reiche III ...... Mycon - ...... Talking Pet - Brad Van Tighem ...... Slylandro Speaker - Madeleine Wild ....... Zoq-Fot-Pik - ....... Syreen - ....... VUX - Larry Zee ............ Umgah - ............ Melnorme - ............ Ur-Quan - 840-AV ............... Slylandro Probe - Paul II, Paul III .... Victory Sequence - Arianna & Devin Reiche - -Voice effects: - Jeff Forehan - Burke Treischmann - Mark Miller - -Voice editing: - Richard Antaki - Paul Reiche III - Burke Treischmann - Steve Henefin - Jeremy Bredow - Erik Griss - Brad Van Tighem - -Art and animation: - George Barr - Paul Reiche III - Erol Otus - Greg Johnson - Kyle Balda - Jeff Rianda - Taunya Shiffer - Leonard Robel - Greg Hammond - Armand Cabrera - Silicon Knights - -Additional writing: - Greg Johnson - Mat Genser - Robert Leyland - Iain McCaig - Tomi Quintana - Erol Otus - Leonard Robel - John Estes - -Music: - Burke Treischmann - Dan Nicholson - Riku Nuottajärvi - Eric Berge - Erol Otus - Marc Brown - Aaron Grier - Kevin Palivec - Tommy Dunbar - -3D cinemagraphics: - Gene Bodio - Phil Le Marbre - TrueMotion(R) "S" Video Compression by The Duck Corporation - -Product marketing manager (3DO version): - Jim Curry - -3DO testers: - Susan Michele - Jeremy Bredow - Wes Gittens - Ty Johnson - Tate Schieferle - Carolina Esmurdoc - Rob Johnson - Kevin Kwan - Joe Ganis - Chang Fadel - Erik Griss - Eugene Law - Mark Ybarra - Steve Groll - Tim Jordan - Matt Young - -PC/DOS testers: - Pam Levins - Tomi Quintana - Joel Dinolt - Robert Daly - Greg Hammond - B.J. Shea - Robert Leyland - Sean Vikoren - Mike Ebert - Tony Hsieh - ROL - Ed Gwynn - Akila Redmer - Russell Bornschlegel - Steve Graziano - Mark Voorsanger - -Special thanks to: - Greg Johnson - John Ratcliffe - -Paul's Foundation: - Laurie - Devin - and Arianna - -Got us 86'ed out of a restaurant in Las Vegas: - Madeline Canepa (we love her anyway) - diff --git a/project/jni/application/sc2/AndroidAppSettings.cfg b/project/jni/application/sc2/AndroidAppSettings.cfg deleted file mode 100644 index f4068a369..000000000 --- a/project/jni/application/sc2/AndroidAppSettings.cfg +++ /dev/null @@ -1,57 +0,0 @@ -# The application settings for Android libSDL port -AppSettingVersion=17 -LibSdlVersion=1.2 -AppName="Ur-Quan Masters" -AppFullName=com.sourceforge.sc2 -ScreenOrientation=h -InhibitSuspend=n -AppDataDownloadUrl="!!Game data (15 Mb)|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/sc2-data-5.zip/download^3DO remixed music (19 Mb) - enable it in Setup->Sound Options->3DO Remixes|:addons/3domusic/3domusic.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3domusic.zip/download^UQM music remix pack (150 Mb) - enable it in Setup->Sound Options->UQM Remixes|:addons/remix/remix.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/remix.zip/download^3DO voice (115 Mb) - go to Setup->Sound Options and increase Voice volume from zero|:addons/3dovoice/3dovoice.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovoice.zip/download^Russian translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/russian.zip/download^Deutsch translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/deutsch.zip/download^Spanish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/spanish.zip/download^Slovak translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/slovak.zip/download^Finnish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/finnish.zip/download^3DO video support - after installing this pack copy all files from|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^your 3DO Star Control II game CD from 'duckart' dir to the SD card to dir|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'app-data/com.sourceforge.sc2/addons/3dovideo', to extract files from 3DO disk use|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^'3DO Commander' or 'uncd-rom' apps from http://madroms.free.fr/3do/|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download^Then from the game change 'Setup->PC/3DO compat->Cutscenes' to Movies, and restart game|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/3dovideo.zip/download" -VideoDepthBpp=16 -NeedDepthBuffer=n -NeedStencilBuffer=n -NeedGles2=n -SwVideoMode=y -SdlVideoResize=y -SdlVideoResizeKeepAspect=n -CompatibilityHacks=n -CompatibilityHacksStaticInit=n -CompatibilityHacksTextInputEmulatesHwKeyboard=n -CompatibilityHacksPreventAudioChopping=n -CompatibilityHacksAppIgnoresAudioBufferSize=n -CompatibilityHacksAdditionalPreloadedSharedLibraries="" -AppUsesMouse=n -AppNeedsTwoButtonMouse=n -ShowMouseCursor=n -ForceRelativeMouseMode=n -AppNeedsArrowKeys=y -AppNeedsTextInput=y -AppUsesJoystick=y -AppUsesAccelerometer=n -AppUsesMultitouch=n -NonBlockingSwapBuffers=n -RedefinedKeys="RETURN RSHIFT NO_REMAP NO_REMAP RCTRL F10" -AppTouchscreenKeyboardKeysAmount=2 -AppTouchscreenKeyboardKeysAmountAutoFire=0 -RedefinedKeysScreenKb="RCTRL RSHIFT KP_PLUS KP_MINUS" -StartupMenuButtonTimeout=3000 -HiddenMenuOptions='' -FirstStartMenuOptions='' -MultiABI=n -AppMinimumRAM=0 -AppVersionCode=07023 -AppVersionName="0.7.0.23" -ResetSdlConfigForThisVersion=y -DeleteFilesOnUpgrade="%" -CompiledLibraries="sdl_image tremor ogg" -CustomBuildScript=n -AppCflags='-O3 -DGFXMODULE_SDL -DOVCODEC_TREMOR -DNETPLAY=NETPLAY_FULL -DHAVE_JOYSTICK -DHAVE_ZIP=1 -DTHREADLIB_SDL -DUSE_INTERNAL_MIKMOD' -AppLdflags='' -AppOverlapsSystemHeaders=y -AppSubdirsBuild='src src/libs/* src/uqm/*' -AppBuildExclude='src/libs/uio/hashtable.c src/libs/uio/memdebug.c' -AppCmdline='uqm --addon lang' -ReadmeText='^You may press "Home" now - the data will be downloaded in background' -MinimumScreenSize=s -AdmobPublisherId=n -AdmobTestDeviceId= -AdmobBannerSize= diff --git a/project/jni/application/sc2/BUGS b/project/jni/application/sc2/BUGS deleted file mode 100644 index f7bac6a7b..000000000 --- a/project/jni/application/sc2/BUGS +++ /dev/null @@ -1,5 +0,0 @@ -All known bugs and missing features are listed in our online bug database, -which can be found at - http://bugs.uqm.stack.nl/ -New bugs that you may find can be reported at the same location. - diff --git a/project/jni/application/sc2/COPYING b/project/jni/application/sc2/COPYING deleted file mode 100644 index bda2c0218..000000000 --- a/project/jni/application/sc2/COPYING +++ /dev/null @@ -1,944 +0,0 @@ - - The Ur-Quan Masters - Copyright (C) 1992, 2002 Toys for Bob, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be entertaining, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. A copy of the - General Public License is included at the end of this document. - - The content -- voiceovers, dialogue, graphics, sounds, and music -- - are copyright (C) 1992, 1993, 2002 Toys for Bob, Inc. or their - respective creators. The content may be used freely under the - terms of the Creative Commons Attribution-NonCommercial-ShareAlike - 2.5 license (included below, and also available at - http://creativecommons.org/licenses/by-nc-sa/2.5/). The content - may also be copied freely as part of a distribution of The Ur-Quan - Masters. - - The documentation -- excluding documentation that is part of the - code or otherwise clearly governed by the preceding licenses -- - may be used freely under the terms of the Creative Commons - Attribution 2.0 license (included below, and also available at - http://creativecommons.org/licenses/by/2.0/). - ----------------------------------------------------------------------------- - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - ----------------------------------------------------------------------------- - -CREATIVE COMMONS LICENSE -Attribution-NonCommercial-ShareAlike 2.5 - -CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL -SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT -RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" -BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION -PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE -COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY -COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS -AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE -TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE -RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND -CONDITIONS. - -1. Definitions - - a. "Collective Work" means a work, such as a periodical issue, - anthology or encyclopedia, in which the Work in its entirety in - unmodified form, along with a number of other contributions, - constituting separate and independent works in themselves, are - assembled into a collective whole. A work that constitutes a - Collective Work will not be considered a Derivative Work (as - defined below) for the purposes of this License. - - b. "Derivative Work" means a work based upon the Work or upon the - Work and other pre-existing works, such as a translation, - musical arrangement, dramatization, fictionalization, motion - picture version, sound recording, art reproduction, abridgment, - condensation, or any other form in which the Work may be recast, - transformed, or adapted, except that a work that constitutes a - Collective Work will not be considered a Derivative Work for the - purpose of this License. For the avoidance of doubt, where the - Work is a musical composition or sound recording, the - synchronization of the Work in timed-relation with a moving - image ("synching") will be considered a Derivative Work for the - purpose of this License. - - c. "Licensor" means the individual or entity that offers the Work - under the terms of this License. - - d. "Original Author" means the individual or entity who created the - Work. - - e. "Work" means the copyrightable work of authorship offered under - the terms of this License. - - f. "You" means an individual or entity exercising rights under this - License who has not previously violated the terms of this - License with respect to the Work, or who has received express - permission from the Licensor to exercise rights under this - License despite a previous violation. - - g. "License Elements" means the following high-level license - attributes as selected by Licensor and indicated in the title of - this License: Attribution, Noncommercial, ShareAlike. - -2. Fair Use Rights. Nothing in this license is intended to reduce, - limit, or restrict any rights arising from fair use, first sale or - other limitations on the exclusive rights of the copyright owner - under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, - Licensor hereby grants You a worldwide, royalty-free, - non-exclusive, perpetual (for the duration of the applicable - copyright) license to exercise the rights in the Work as stated - below: - - a. to reproduce the Work, to incorporate the Work into one or more - Collective Works, and to reproduce the Work as incorporated in - the Collective Works; - - b. to create and reproduce Derivative Works; - - c. to distribute copies or phonorecords of, display publicly, - perform publicly, and perform publicly by means of a digital - audio transmission the Work including as incorporated in - Collective Works; - - d. to distribute copies or phonorecords of, display publicly, - perform publicly, and perform publicly by means of a digital - audio transmission Derivative Works; - - The above rights may be exercised in all media and formats whether - now known or hereafter devised. The above rights include the right - to make such modifications as are technically necessary to exercise - the rights in other media and formats. All rights not expressly - granted by Licensor are hereby reserved, including but not limited - to the rights set forth in Sections 4(e) and 4(f). - -4. Restrictions. - - The license granted in Section 3 above is expressly made subject to and - limited by the following restrictions: - - a. You may distribute, publicly display, publicly perform, or - publicly digitally perform the Work only under the terms of this - License, and You must include a copy of, or the Uniform Resource - Identifier for, this License with every copy or phonorecord of - the Work You distribute, publicly display, publicly perform, or - publicly digitally perform. You may not offer or impose any - terms on the Work that alter or restrict the terms of this - License or the recipients' exercise of the rights granted - hereunder. You may not sublicense the Work. You must keep intact - all notices that refer to this License and to the disclaimer of - warranties. You may not distribute, publicly display, publicly - perform, or publicly digitally perform the Work with any - technological measures that control access or use of the Work in - a manner inconsistent with the terms of this License - Agreement. The above applies to the Work as incorporated in a - Collective Work, but this does not require the Collective Work - apart from the Work itself to be made subject to the terms of - this License. If You create a Collective Work, upon notice from - any Licensor You must, to the extent practicable, remove from - the Collective Work any credit as required by clause 4(d), as - requested. If You create a Derivative Work, upon notice from any - Licensor You must, to the extent practicable, remove from the - Derivative Work any credit as required by clause 4(d), as - requested. - - b. You may distribute, publicly display, publicly perform, or - publicly digitally perform a Derivative Work only under the - terms of this License, a later version of this License with the - same License Elements as this License, or a Creative Commons - iCommons license that contains the same License Elements as this - License (e.g. Attribution-NonCommercial-ShareAlike 2.5 - Japan). You must include a copy of, or the Uniform Resource - Identifier for, this License or other license specified in the - previous sentence with every copy or phonorecord of each - Derivative Work You distribute, publicly display, publicly - perform, or publicly digitally perform. You may not offer or - impose any terms on the Derivative Works that alter or restrict - the terms of this License or the recipients' exercise of the - rights granted hereunder, and You must keep intact all notices - that refer to this License and to the disclaimer of - warranties. You may not distribute, publicly display, publicly - perform, or publicly digitally perform the Derivative Work with - any technological measures that control access or use of the - Work in a manner inconsistent with the terms of this License - Agreement. The above applies to the Derivative Work as - incorporated in a Collective Work, but this does not require the - Collective Work apart from the Derivative Work itself to be made - subject to the terms of this License. - - c. You may not exercise any of the rights granted to You in Section - 3 above in any manner that is primarily intended for or directed - toward commercial advantage or private monetary - compensation. The exchange of the Work for other copyrighted - works by means of digital file-sharing or otherwise shall not be - considered to be intended for or directed toward commercial - advantage or private monetary compensation, provided there is no - payment of any monetary compensation in connection with the - exchange of copyrighted works. - - d. If you distribute, publicly display, publicly perform, or - publicly digitally perform the Work or any Derivative Works or - Collective Works, You must keep intact all copyright notices for - the Work and provide, reasonable to the medium or means You are - utilizing: (i) the name of the Original Author (or pseudonym, if - applicable) if supplied, and/or (ii) if the Original Author - and/or Licensor designate another party or parties (e.g. a - sponsor institute, publishing entity, journal) for attribution - in Licensor's copyright notice, terms of service or by other - reasonable means, the name of such party or parties; the title - of the Work if supplied; to the extent reasonably practicable, - the Uniform Resource Identifier, if any, that Licensor specifies - to be associated with the Work, unless such URI does not refer - to the copyright notice or licensing information for the Work; - and in the case of a Derivative Work, a credit identifying the - use of the Work in the Derivative Work (e.g., "French - translation of the Work by Original Author," or "Screenplay - based on original Work by Original Author"). Such credit may be - implemented in any reasonable manner; provided, however, that in - the case of a Derivative Work or Collective Work, at a minimum - such credit will appear where any other comparable authorship - credit appears and in a manner at least as prominent as such - other comparable authorship credit. - - e. For the avoidance of doubt, where the Work is a musical composition: - - i. Performance Royalties Under Blanket Licenses. Licensor - reserves the exclusive right to collect, whether - individually or via a performance rights society - (e.g. ASCAP, BMI, SESAC), royalties for the public - performance or public digital performance (e.g. webcast) - of the Work if that performance is primarily intended for - or directed toward commercial advantage or private - monetary compensation. - - ii. Mechanical Rights and Statutory Royalties. Licensor - reserves the exclusive right to collect, whether - individually or via a music rights agency or designated - agent (e.g. Harry Fox Agency), royalties for any - phonorecord You create from the Work ("cover version") - and distribute, subject to the compulsory license created - by 17 USC Section 115 of the US Copyright Act (or the - equivalent in other jurisdictions), if Your distribution - of such cover version is primarily intended for or - directed toward commercial advantage or private monetary - compensation. - - f. Webcasting Rights and Statutory Royalties. For the avoidance of - doubt, where the Work is a sound recording, Licensor reserves - the exclusive right to collect, whether individually or via a - performance-rights society (e.g. SoundExchange), royalties for - the public digital performance (e.g. webcast) of the Work, - subject to the compulsory license created by 17 USC Section 114 - of the US Copyright Act (or the equivalent in other - jurisdictions), if Your public digital performance is primarily - intended for or directed toward commercial advantage or private - monetary compensation. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, -LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR -WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, -STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF -TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, -NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, -OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT -DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED -WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. - -EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL -LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, -INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT -OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - a. This License and the rights granted hereunder will terminate - automatically upon any breach by You of the terms of this - License. Individuals or entities who have received Derivative - Works or Collective Works from You under this License, however, - will not have their licenses terminated provided such - individuals or entities remain in full compliance with those - licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any - termination of this License. - - b. Subject to the above terms and conditions, the license granted - here is perpetual (for the duration of the applicable copyright - in the Work). Notwithstanding the above, Licensor reserves the - right to release the Work under different license terms or to - stop distributing the Work at any time; provided, however that - any such election will not serve to withdraw this License (or - any other license that has been, or is required to be, granted - under the terms of this License), and this License will continue - in full force and effect unless terminated as stated above. - -8. Miscellaneous - - a. Each time You distribute or publicly digitally perform the Work - or a Collective Work, the Licensor offers to the recipient a - license to the Work on the same terms and conditions as the - license granted to You under this License. - - b. Each time You distribute or publicly digitally perform a - Derivative Work, Licensor offers to the recipient a license to - the original Work on the same terms and conditions as the - license granted to You under this License. - - c. If any provision of this License is invalid or unenforceable - under applicable law, it shall not affect the validity or - enforceability of the remainder of the terms of this License, - and without further action by the parties to this agreement, - such provision shall be reformed to the minimum extent necessary - to make such provision valid and enforceable. - - d. No term or provision of this License shall be deemed waived and - no breach consented to unless such waiver or consent shall be in - writing and signed by the party to be charged with such waiver - or consent. - - e. This License constitutes the entire agreement between the - parties with respect to the Work licensed here. There are no - understandings, agreements or representations with respect to - the Work not specified here. Licensor shall not be bound by any - additional provisions that may appear in any communication from - You. This License may not be modified without the mutual written - agreement of the Licensor and You. - -Creative Commons is not a party to this License, and makes no warranty -whatsoever in connection with the Work. Creative Commons will not be -liable to You or any party on any legal theory for any damages -whatsoever, including without limitation any general, special, -incidental or consequential damages arising in connection to this -license. Notwithstanding the foregoing two (2) sentences, if Creative -Commons has expressly identified itself as the Licensor hereunder, it -shall have all rights and obligations of Licensor. - -Except for the limited purpose of indicating to the public that the -Work is licensed under the CCPL, neither party will use the trademark -"Creative Commons" or any related trademark or logo of Creative -Commons without the prior written consent of Creative Commons. Any -permitted use will be in compliance with Creative Commons' -then-current trademark usage guidelines, as may be published on its -website or otherwise made available upon request from time to time. - -Creative Commons may be contacted at http://creativecommons.org/. - ----------------------------------------------------------------------- - -CREATIVE COMMONS LICENSE ATTRIBUTION-2.0 - -CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE -LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN -ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS -INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES -REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR -DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS -CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS -PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE -WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS -PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND -AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS -YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF -SUCH TERMS AND CONDITIONS. - -1. Definitions - - a. "Collective Work" means a work, such as a periodical issue, - anthology or encyclopedia, in which the Work in its entirety in - unmodified form, along with a number of other contributions, - constituting separate and independent works in themselves, are - assembled into a collective whole. A work that constitutes a - Collective Work will not be considered a Derivative Work (as - defined below) for the purposes of this License. - - b. "Derivative Work" means a work based upon the Work or upon the - Work and other pre-existing works, such as a translation, - musical arrangement, dramatization, fictionalization, motion - picture version, sound recording, art reproduction, abridgment, - condensation, or any other form in which the Work may be recast, - transformed, or adapted, except that a work that constitutes a - Collective Work will not be considered a Derivative Work for the - purpose of this License. For the avoidance of doubt, where the - Work is a musical composition or sound recording, the - synchronization of the Work in timed-relation with a moving - image ("synching") will be considered a Derivative Work for the - purpose of this License. - - c. "Licensor" means the individual or entity that offers the Work - under the terms of this License. - - d. "Original Author" means the individual or entity who created the - Work. - - e. "Work" means the copyrightable work of authorship offered under - the terms of this License. - - f. "You" means an individual or entity exercising rights under this - License who has not previously violated the terms of this - License with respect to the Work, or who has received express - permission from the Licensor to exercise rights under this - License despite a previous violation. - -2. Fair Use Rights. Nothing in this license is intended to reduce, - limit, or restrict any rights arising from fair use, first sale or - other limitations on the exclusive rights of the copyright owner - under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, - Licensor hereby grants You a worldwide, royalty-free, - non-exclusive, perpetual (for the duration of the applicable - copyright) license to exercise the rights in the Work as stated - below: - - a. to reproduce the Work, to incorporate the Work into one or more - Collective Works, and to reproduce the Work as incorporated in - the Collective Works; - - b. to create and reproduce Derivative Works; - - c. to distribute copies or phonorecords of, display publicly, - perform publicly, and perform publicly by means of a digital - audio transmission the Work including as incorporated in - Collective Works; - - d. to distribute copies or phonorecords of, display publicly, - perform publicly, and perform publicly by means of a digital - audio transmission Derivative Works. - - e. For the avoidance of doubt, where the work is a musical - composition: - - i. Performance Royalties Under Blanket Licenses. Licensor - waives the exclusive right to collect, whether - individually or via a performance rights society - (e.g. ASCAP, BMI, SESAC), royalties for the public - performance or public digital performance (e.g. webcast) - of the Work. - - ii. Mechanical Rights and Statutory Royalties. Licensor - waives the exclusive right to collect, whether - individually or via a music rights agency or designated - agent (e.g. Harry Fox Agency), royalties for any - phonorecord You create from the Work ("cover version") - and distribute, subject to the compulsory license created - by 17 USC Section 115 of the US Copyright Act (or the - equivalent in other jurisdictions). - - f. Webcasting Rights and Statutory Royalties. For the avoidance of - doubt, where the Work is a sound recording, Licensor waives the - exclusive right to collect, whether individually or via a - performance-rights society (e.g. SoundExchange), royalties for - the public digital performance (e.g. webcast) of the Work, - subject to the compulsory license created by 17 USC Section 114 - of the US Copyright Act (or the equivalent in other - jurisdictions). - - The above rights may be exercised in all media and formats whether - now known or hereafter devised. The above rights include the right - to make such modifications as are technically necessary to exercise - the rights in other media and formats. All rights not expressly - granted by Licensor are hereby reserved. - -4. Restrictions. The license granted in Section 3 above is expressly - made subject to and limited by the following restrictions: - - a. You may distribute, publicly display, publicly perform, or - publicly digitally perform the Work only under the terms of this - License, and You must include a copy of, or the Uniform Resource - Identifier for, this License with every copy or phonorecord of - the Work You distribute, publicly display, publicly perform, or - publicly digitally perform. You may not offer or impose any - terms on the Work that alter or restrict the terms of this - License or the recipients' exercise of the rights granted - hereunder. You may not sublicense the Work. You must keep intact - all notices that refer to this License and to the disclaimer of - warranties. You may not distribute, publicly display, publicly - perform, or publicly digitally perform the Work with any - technological measures that control access or use of the Work in - a manner inconsistent with the terms of this License - Agreement. The above applies to the Work as incorporated in a - Collective Work, but this does not require the Collective Work - apart from the Work itself to be made subject to the terms of - this License. If You create a Collective Work, upon notice from - any Licensor You must, to the extent practicable, remove from - the Collective Work any reference to such Licensor or the - Original Author, as requested. If You create a Derivative Work, - upon notice from any Licensor You must, to the extent - practicable, remove from the Derivative Work any reference to - such Licensor or the Original Author, as requested. - - b. If you distribute, publicly display, publicly perform, or - publicly digitally perform the Work or any Derivative Works or - Collective Works, You must keep intact all copyright notices for - the Work and give the Original Author credit reasonable to the - medium or means You are utilizing by conveying the name (or - pseudonym if applicable) of the Original Author if supplied; the - title of the Work if supplied; to the extent reasonably - practicable, the Uniform Resource Identifier, if any, that - Licensor specifies to be associated with the Work, unless such - URI does not refer to the copyright notice or licensing - information for the Work; and in the case of a Derivative Work, - a credit identifying the use of the Work in the Derivative Work - (e.g., "French translation of the Work by Original Author," or - "Screenplay based on original Work by Original Author"). Such - credit may be implemented in any reasonable manner; provided, - however, that in the case of a Derivative Work or Collective - Work, at a minimum such credit will appear where any other - comparable authorship credit appears and in a manner at least as - prominent as such other comparable authorship credit. - -5. Representations, Warranties and Disclaimer. UNLESS OTHERWISE -MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK -AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND -CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, -INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, -FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF -LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF -ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW -THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY -TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY - APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY - LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE - OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE - WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - DAMAGES. - -7. Termination - - a. This License and the rights granted hereunder will terminate - automatically upon any breach by You of the terms of this - License. Individuals or entities who have received Derivative - Works or Collective Works from You under this License, however, - will not have their licenses terminated provided such - individuals or entities remain in full compliance with those - licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any - termination of this License. - - b. Subject to the above terms and conditions, the license granted - here is perpetual (for the duration of the applicable copyright - in the Work). Notwithstanding the above, Licensor reserves the - right to release the Work under different license terms or to - stop distributing the Work at any time; provided, however that - any such election will not serve to withdraw this License (or - any other license that has been, or is required to be, granted - under the terms of this License), and this License will continue - in full force and effect unless terminated as stated above. - -8. Miscellaneous - - a. Each time You distribute or publicly digitally perform the Work - or a Collective Work, the Licensor offers to the recipient a - license to the Work on the same terms and conditions as the - license granted to You under this License. - - b. Each time You distribute or publicly digitally perform a - Derivative Work, Licensor offers to the recipient a license to - the original Work on the same terms and conditions as the - license granted to You under this License. - - c. If any provision of this License is invalid or unenforceable - under applicable law, it shall not affect the validity or - enforceability of the remainder of the terms of this License, - and without further action by the parties to this agreement, - such provision shall be reformed to the minimum extent necessary - to make such provision valid and enforceable. - - d. No term or provision of this License shall be deemed waived and - no breach consented to unless such waiver or consent shall be in - writing and signed by the party to be charged with such waiver - or consent. - - e. This License constitutes the entire agreement between the - parties with respect to the Work licensed here. There are no - understandings, agreements or representations with respect to - the Work not specified here. Licensor shall not be bound by any - additional provisions that may appear in any communication from - You. This License may not be modified without the mutual written - agreement of the Licensor and You. - -Creative Commons is not a party to this License, and makes no warranty -whatsoever in connection with the Work. Creative Commons will not be -liable to You or any party on any legal theory for any damages -whatsoever, including without limitation any general, special, -incidental or consequential damages arising in connection to this -license. Notwithstanding the foregoing two (2) sentences, if Creative -Commons has expressly identified itself as the Licensor hereunder, it -shall have all rights and obligations of Licensor. - -Except for the limited purpose of indicating to the public that the -Work is licensed under the CCPL, neither party will use the trademark -"Creative Commons" or any related trademark or logo of Creative -Commons without the prior written consent of Creative Commons. Any -permitted use will be in compliance with Creative Commons' -then-current trademark usage guidelines, as may be published on its -website or otherwise made available upon request from time to time. - -Creative Commons may be contacted at http://creativecommons.org/. diff --git a/project/jni/application/sc2/ChangeLog b/project/jni/application/sc2/ChangeLog deleted file mode 100644 index 94c1d5467..000000000 --- a/project/jni/application/sc2/ChangeLog +++ /dev/null @@ -1,1082 +0,0 @@ -Changes towards version 0.7: -- Fixed ship picking order after a simultaneous destruction, e.g. - Shofixti picks last after Glory device (bugs #1087, #1088) - Alex -- Game no longer locks up after quickly escaping melee (bug #1003) - Alex -- Reset input delay upon leaving Supermelee (bug #1022) - Alex -- Properly account for simultaneous destruction of last ships - in each fleet in Supermelee (bug #437) - Alex -- Do not match singular stars when given a prefix in star search - (bug #1071) - Alex -- Preserve character case when editing with joystick (bug #1080) - Alex -- Fixed misaligned cargo count (bug #1092) - Coredev -- Fixed the network SuperMelee team configuration protocol - SvdB -- Fixed fuel reserve bounds checks - SvdB -- Fixed a crash when filling fuel tanks over 10 (bug #1082) - Alex -- Got rid of many warnings - SvdB -- Clean up and some refactoring of the SuperMelee code - SvdB -- Fixed concurrent screen fades regression (bug #1079) - Alex -- Removed some legacy source code files related to resources - SvdB -- Put SuperMelee source files in separate subdirectory - SvdB -- Added additive and alpha drawing modes to graphics lib - Alex -- Fixed black pixel gaps between the planet and shield when entering the - orbit of a shielded planet (bug #32) - Alex -- Split off SDL-specific colormap bits into SDL domain - Alex -- Fixed planet blinking when exiting scan (bug #799) - Alex -- Restore menu sounds after editing a control set name (bug #1066) - Alex -- Use an own 'UniChar' rather than 'wchar_t', which may not be large - enough, depending on the platform - SvdB -- Added 'COLOR' resource type - SvdB -- All graphics operations use 24-bits colors at the game level too now, - instead of 16 bits colors. - SvdB -- Cross-platform safemode (ignores uqm.cfg, bug #946) - Michael -- Correct Chmmr response when asking about Sa-Matra (bug #1073) - Alex -- Refactored universe generation - SvdB -- Comm animation processing rewrite, bugs fixed - Alex -- Added graphics context debugging function - SvdB -- Thread down-throttling and game sleep when inactive (currently disabled), - (bug #1070), from Flandry -- Internal changes: GOOD_GUY/BAD_GUY ship flags retired - Alex -- Fixed Melee menu timeout when both sides are Cyborgs (bug #1067) - Alex -- Fixed AI ship not moving on warp in (bug #648) - Alex -- Revert gfx settings entirely when a mode switch fails (bug #1056) - Alex -- Fixed the Syreen lights-out scene timing (bug #1011) - Alex -- Added a native error box for MacOSX (like we have for Windows) - Alex -- Fix for weird colors problem on MacOSX w/ SDL 1.2.14; also improves - overall compatibility on all platforms - Alex -- Unix build system cleanups, fix detection of SDL, libmikmod, pthread - SvdB -- Make DoPopupWindow() work over faded out screens. - SvdB -- Trackplayer rewrite; fixed many bugs - Alex -- Source tree reorg: libs/ moved out of sc2code/, msvc++/ moved to - build/msvc6/, src/sc2code/ renamed to src/uqm/ - Coredev -- Druuge no longer turn hostile after attempting a salvage (bug #1013) - Alex -- Process subtitles correctly with no timestamp file (bug #1060) - Alex -- Lander will no longer hang when killed on planets with a lot of - natural disasters (bug #584) - Alex -- Canceling load from the main menu returns to main menu (bug #679) - Alex -- Fixed inputting numbers with the numpad, except directx (bug #934) - Alex -- Better location description in savegame summaries (bug #844) - Alex -- Fixed crash when saving a game into the last slot while having - too many devices on board - Alex -- Allow any sound data format to be graphed by comm oscilloscope; also - auto-adjust the scope for different gain levels (bug #1064) - Alex -- Game settings Quit menu now delegates to F10 quit (bug #462) - Alex -- Do not pause the game in places where not relevant (bug #984) - Alex -- Fixed crashes and potential weirdness when loading savegames from - a Homeworld encounter screen (bug #997) - Alex -- Cleanup of GLOBAL(ShipStamp.frame) abuse; fixes bug #1054 - Alex -- Game attempts to exit cleanly under normal circustances (bug #52) - Alex -- Fixed Mmrnmhrm's X-Form transformation without energy use (bug #1004) - Alex -- Added missing sleeps in DoInput() functions (bug #893) - Alex -- Starmap unit conversion corrections; fixes bug #970 - Alex -- Rounding-error correction in log(x|y)ToUniverse (bug #1046), from Nic -- Change hardcoded Starbase and Sa-Matra values to pretty enum values - (bug #1047), from Nic -- Load override.cfg from user's dir to add or override menu controls - Alex -- Allow addons to override any content by placing zips into their - 'shadow-content' dir - Alex -- Content reorg: font chars now use hexadecimal numbering - Alex -- Content reorg: some race comm and ships renamed, ship files renamed, - many ani files renamed, new naming scheme for ani frames and voice - Alex -- .cfg files are now kept as subtrees of the resource map - Michael -- Flight control data no longer unnecessarily copied to config directory - Michael -- Index loading/saving now can operate on subtrees - Michael -- Videos vs. slide now controlled by a '3dovideo' addon - Michael -- New video resource type for 3DO videos - Michael -- Allow reaching 999.9:999.9 in HyperSpace (bug #628), from Nic -- Use system getopt_long() when available - SvdB -- Added --addondir commandline option - Mika -- Case insensitive matching when looking for .zip/.uqm/.rmp files - SvdB -- Added read-ahead buffering when reading zip index files. - SvdB -- Added support for packed ani and font files - Mika -- DrawTracedText abstraction (bug #1029), from Nic -- Experimental support for Symbian S60 3rd edition - Mika & SvdB -- Pthread support - Mika -- Content Dirs completely reorganized; 3DO and PC segregation - Coredev -- Voiceovers controlled by a synthetic '3dovoice' addon - Michael -- CONVERSATION explicitly names text/voice/timestamps - Michael -- Replaced stricmp() by the POSIX compatible strcasecmp() - SvdB -- Split STRTAB further into STRTAB and CONVERSATION - Michael -- INT32, BOOLEAN, and STRING resource types - Michael -- UNKNOWNRES is now safe to load, and "loads" as its resvalue - Michael -- CODE is now SHIP, and uses an integer descriptor instead of a one-byte - .cod file - Michael -- ResourceLoadFun is now descriptor-based, not stream-based - Michael -- Removed RES_TYPE enum, folded into ResourceDesc - Michael -- Split STRTAB into STRTAB (strings) and BINTAB (color/xlat tables) - Michael -- Removed internal references to defunct resource types - Michael -- Revamped resource system to only use .rmp files - Michael -- Isolated all constructed resources into cons_res.c - Michael -- Fixed a crash when conversing with music disabled - Michael -- Moved all resources into starcon.ls2 - Michael -- Fixed compile errors when compiling without joystick support - Michael -- Added endian-aware integer read functions to uio - SvdB -- Introduce the concept of an "InputContext" - SvdB -- Don't use alloca() in uio. - SvdB -- Replace PlayerOne/PlayerTwo by PlayerControls[0]/PlayerControls[1] - SvdB -- Moved comm resources into starcon.ls2 - Michael -- Repackaged static comm/ship data to it all uniquely named - Michael -- On MacOS X, search for the content in the application bundle, from Nic -- Planetside resource names are now consistent and generatable - Michael -- Androsynth ruins freeing condition now uses cycles (Bug #1028) - Michael -- .rmp files now carry the types of the targets - Michael -- Joystick threshold defaults to 10,000, not 0 (Bug #1046) - Michael -- Remove MEM_HANDLEs from everywhere outside of memlib - Michael -- Split out RESOURCEs from the loaded data in RACE_DESC and LOCDATA - structures - Michael -- Prevent overflow for planet weight when scanning a planet (bug #1025) - - from Benjamin Alan Weaver -- Don't set _POSIX_THREAD_SAFE_FUNCTIONS - SvdB -- Support for Windows CE. - SvdB with Pavel Chernikov -- Added support to the unix build system for explicitely specifying the name - of the define to set to show when a symbol is found. - Also a fix for when 'strcasecmp' is #define'd by the system. - SvdB -- Rewrote mapres.c to use uio's hashtables instead of its own - association lists - Michael -- Added a Remix option to the setup menu - Michael -- Addon zips can live in content/addons directly - Michael -- 3DO music separated into an addon pack - Michael -- Major change in resource index scheme - Michael - - .lst replaced (mapping to IDs instead of to files) - - .rmp files give the mapping from IDs to files. - - Addons provide additional files instead of overriding UIO - - Addons must provide .rmp files to do the necessary overrides. -- Removed unnecessary _ALIGNED_ON macro usage - SvdB -- The current directory is now among the locations searched for the content - when no explicit location has been specified. (bug fix) - from Nic -- Non-3DO Shipspin anims now use Presentations - Michael -- Added presentation commands TEXT, TE (text effect), MOVIE - Alex -- Increased the size of display queue (elements were sometimes missing - in e.g. Nemesis vs. Nemesis battles with many marines out) - Alex -- ShowPresentation() no longer clears the screen by force; presentations - now do this by request - Michael -- Added match_matchPatternOnce() - SvdB -- Fixed a problem with blue ships after Avatar's tractor beam, - along with some other fill-stamp situations; bug #929 - Alex -- Added TFB_Canvas_Lock(), TFB_Canvas_Unlock() and TFB_Canvas_GetStride() - - SvdB -- Scaling images with respect to their hotspots: stabilizes compound - Melee objects; re-added bilinear Melee scaler; zooming planet uses - bilinear; fixes bug #685 - Alex -- Added --keepaspectratio to keep correct aspect ratio when using - custom resolutions in OpenGL mode - Mika -- Add /var/tmp as possible location for temporary files. Don't try - /tmp and /var/tmp at all on MS Windows (Cygwin excepted) - SvdB -- Added fullscreen/windowed toggle key F11 (bug #578) - Mika -- Allow building without ogg vorbis support (bug #852) - SvdB -- Reworked SuperMelee fleet loading (fixes bug #823) - SvdB -- Fixed enemy ships getting recrewed between ecnounters in HyperSpace - (bug #996) - Alex -- Removed mouse_err.c since DoPopupWindow() is used now - SvdB -- (debugging) Fixed instant-move towards the current location - SvdB -- Fixed wrong Sa-Matra guards icons after Kohr-Ah win (bug #1001) - Alex -- Internal ship structures and queues refactoring and cleanup - Alex -- Fix quitting out of IP before the IP is fully set (bug #987) - Michael -- Fixed speech looping with long tracks at high sampling rates; - scope supports higher rates for speech now; bug 999 - Alex -- Basic support for .ani-based shipspin animations - Michael -- Fixed some Melnorme history info timestamps - Alex -- Fixed Ur-Quan story timestamps, from Vlad-Ceru Opran -- Removed the 256-frame limit on .ani files - Michael -- Renamed PlaySpeech/StopSpeech to work around name collisions - on OSX - Alex -- Ending the battle with a simultaneous death no longer triggers an - assertion - SvdB -- Concurrent supermelee ship selection - SvdB -- New generic, unthreaded flashing code - SvdB -- Cleanup of 3DO ship spin support; spin speech works now - Alex -- No longer creating and mounting a temporary directory. It is no longer - used, but it might be again at some point, for loadable modules. - SvdB -- Added RNG functions that work on a supplied state - SvdB -- Fixed a crash on startup if uqm.cfg did not exist, flagged and fixed - by jdorje - Michael -- Support for 3do "ship spin" videos (Bug #733, patch by Jan Lönnberg) - -Michael -- Major refactoring of input configuration to use the resource system - instead of custom files (bugs #961 and #949) - Michael -- Added ability to remove entries from ALists - Michael -- Cleaned up FRAME, CONTEXT, and FONT abstraction layers - Michael -- Added Input Frames to pause code to stop infinite loops - Michael -- Added more netplay debug code - SvdB -- Added uio_fprintf() and uio_vfprintf() - SvdB -- Any input will register for at least one frame (Bug #864) - Michael -- Many VControl cleanups - Michael -- Fix compilation without Netplay support - SvdB -- Added limited AIFF sound file decoder for playing 3DO originals; - SDX2 decoder by SvdB - Alex -- Typo fix in Starbase speech (bug #959) - Michael -- (MacOS) Don't package up .svn dirs with 'build.sh uqm install' (bug #958), - from Nic. -- No more extra newlines to log_add() calls for libs/network/ code - SvdB -- DUCK videos now play correctly after a video mode change; bug #734 - Alex -- Cancel key will now quit out of the Manifest Menu (Bug #838) - Michael -- Added -w and -x commandline options, to counter -f and -o; used these - to implement "Safe Mode" links in the Win32 installer (Bug #946) - - Michael -- OpenGL texture loading uses surface pitch instead of screen width. - This should head off future bugs similar to Bug #740 (this issue was - reported as Bug #956) - Michael - -0.6.2 (maintenance release): -- A bit more debug info for failed connects. - SvdB -- Exit with failure if basic content cannot be found, ensuring proper - error reporting under Windows - Michael -- Popup windows for "Really Exit?" and Game Pause are immune to fades - and crossfades (Bug #455) - Michael -- No longer depend on SDLK_LAST statically; key input should now be safe - if compiled with a different version of SDL than the one running the - program (Bug #936, possibly also #834 and #883) - Michael -- Unix build scripts now work under LC_CTYPE=tr_TR - SvdB -- Flush write buffer when doing a uio_fclose() after doing only - uio_fwrite() operations. - SvdB -- Major rewrite of the SwapBuffers commands -- screen compositing logic - has all been abstracted out into sdl_common.c instead of being - nearly-duplicated in opengl.c and pure.c - Michael - -0.6.1 (maintenance release): -- The Unicode Private Use Area is no longer considered printable. This - is a stopgap to handle unusual behavior with text entry under OS X. - From Nic; see bug #942 for more details - Michael -- Do not rely on GL_UNPACK_SKIP_* arguments, which some OpenGL drivers - mishandle (Bug #914) - Michael -- Do not overwrite GLOBAL_SIS (CrewEnlisted) when leaving Hyperspace - (Bug #938) - Michael -- Fixed a text entry width problem that was deleting control template - names (Bug #947) - Michael -- uio cleanups, documentation - SvdB -- uio path parsing fixes/improvements - SvdB - - Windows UNC path support (#907) - - Windows drive-relative paths ("D:path" without a path seperator) - - treat multiple consecutive path seperators as one (like POSIX) -- config dir no longer needs trailing path seperator (bug #738)- SvdB -- Simplification of uio Stream functions. No more internal seeks. - SvdB - -0.6.0: -- Fixed a bug where an input delay was used for non-network games - SvdB -- Fixed a bug where the victory ditty would end prematurely when UQM - is compiled without Netplay support - SvdB -- Take $CFLAGS and $LDFLAGS into account for dependency detection - (they were already used for the building itself) - SvdB -- Validate UQM version of either side of a Netplay game - SvdB -- Better abort and disconnect handling for Netplay - SvdB -- Menu sounds in Setup track rest of game (#922), from Nic - Michael -- Shifted the Mouse Error to a Popup Window, moved the message to - starcon.txt for translators - Michael -- Generic DoPopupWindow() command for status messages - Michael -- Update the 'current selection' icon after deleting or inserting ships - in a fleet in SuperMelee - SvdB -- Correct some background pixels in melebkgd.{25,26}.png - SvdB -- Unix build scripts improvements. - SvdB -- Build fixes for MacOS X (with thanks to Nic) - SvdB -- Ships in battle can resume normal speed in all circumstances after - the enemy Avatar's tractor beam disengages (bug #860; this is a - netplay desynchronizing change) - Alex -- Conversation summary breaks lines based on actual chars/words - that fit (bug #916) - Alex -- Netplay configuration dialog - Michael -- Better error message for 'Kernel failed to load' (#917) - Michael -- Pushbutton for connecting to netplay, in anticipation of a full - configuration dialog later - Michael -- Cleanup of comm.c - SvdB -- Netplay - SvdB -- Added step-by-step instructions for compilation on MSVC++ - SvdB -- All output done in binary mode, due to uio/Win32 conflicts (#912) - Michael -- Online key configuration menu actually functional now - Michael -- Tweak to Lander UI - Special Weapon is now explicitly Lander Escape, - just as Warp Escape is - Michael -- Default key configuration changed slightly; online display of current - key bindings - Michael -- Input templates can now be renamed, both online and off - Michael -- Fixed an integer-size error that was causing crashes on AMD64, from - Solomon Peachy (#895) - Michael -- Added some generic lib code to be used by future code. - SvdB -- Joystick support is now optional; from SvdB, Alex -- Restructed and normalized savegame and game-state reading/writing code; - savegames are now compatible between same-endian 32- and 64-bit systems; - savegames from prior 64-bit builds cannot be used - Alex -- (Unix build scripts) Failed mkdep doesn't result in empty .d files - anymore. Now using the gcc 3 "-MF" and "-MT" options. - SvdB -- removed internal libmikmod, adding a dependancy on an external one - SvdB -- Added a quit button for the Super Melee main menu - Michael -- Fixed sporadic uqm.cfg loading errors in release builds - Alex -- Quit (F10) now works correctly during intro (bug #862) - Alex -- Playing failure sounds when entering text consistently (bug #884) - Alex -- 64-bit fixes in construct_response () - Michael -- Removed rotating 3d planet frame caching (cuts mem usage by 5M) - Alex -- One pixel fix in melee menu pictures. - SvdB -- Debugging function to add energy during battle. - SvdB -- Changed slaveshield throb rate to match the 3DO - SvdB -- Fixed recently introduced bug with crew count on exit to HyperSpace. - (bug #875) - SvdB -- Fixed static vars not reinited in alien comm code (caused various - side-effects; bug #870) - Alex -- Fixed a spinlock in Melee's final score screen (Bug 879) - Michael -- Phase 2 of online keyconfig - Setup Menu can configure assignment of - templates to players - Michael -- Control scheme shifted to Menus + Control Templates in preparation for - the online keyconfig - Michael -- Fixes to logic in the Utwig conversations (Bugs 327, 647), from Nic - and Michael -- Removed unused and invalid lander font chars - Alex -- Setup menu reads strings out of lbm/setupmenu.txt - Michael -- More fixes towards working 64-bits binaries. - SvdB -- Flashing outfit modules to build with PC menus too; bug #871 - Alex -- Corrected caption Orbit: to Tilt: in planet scan; bug #847 - Alex -- Added missing failure sounds in Outfit, Shipyard, Cargo and Roster; - played when over/under capacity, not enough RUs, etc; bug #842 -Alex -- Crew retrieved from space after the end of an encounter will no - longer set the crew larger than the ship's maximum. - SvdB -- Flagship crew numbers are no longer continuously synchronised during - melee, but only at the beginning and end of the battle. - SvdB -- Various small cleanups. - SvdB -- Debugging function to add crew during battle. - SvdB -- More documentation - SvdB. -- RMPLIFIED PRECURSOR BOMB is now AMPLIFIED, from Vorn (bug #812) - -Michael - -0.5: -- Innocent original c&p bug fixed, from bpoint. -- Handle relative dirs in -C correctly, from Jan Lönnberg (part of bug #738). -- Internationalization fixes: moved many hardcoded English strings - into string resource file starcon.txt (bug #778), from Andrew Zabolotny -- Melee Scale and Slides/Movies now take effect immediately - Michael -- The intro now plays only when a new game is started - Alex -- fixed uio_rename() and some other cases where a new file is created - under specific circumstances. - SvdB -- Fix bug in GetStringContents which used the number of chars where it - should have used the memory size. - SvdB -- Control scheme upgrades checked (VControl Version upgrade) - Michael -- Better instant-move (for debugging) - SvdB -- Fixed version checking in unix build scripts. SDL 1.2.10 is - now recognised as newer than 1.2.9. - SvdB -- Some small improvements to the portability of the build system, - from Jim Paris -- Fixed two-week bomb installation at the Starbase bypassing the - defeat condition (bug #757), from Nic, Alex -- Added star search in Starmap (define Menu-Search and Menu-Next keys - in your keys.cfg) from kworces, Alex, SvdB -- Fixed Orz greeting at Taalo homeworld inconsistency (bug #819) - Alex -- Fixed Venus' atmo density to 90 times that of Earth (bug #821) - Alex -- Internationalization fixes: better or, in some cases, fixed support of - non-Latin UTF-8 strings (more to come; bug #778), from Andrew Zabolotny -- Remaped special chars used in the game (degree, infinity and earth - signs; middle dot) to their UCS equivalent codes (bug #818) - Alex -- Color depth is now determined entirely automatically - Michael -- Text input is now available in languages other than English - (UCS/Unicode; SDL does not support Unicode input on Windows yet; - you must have proper font chars installed -- see translations) - Alex -- Re-added joystick text input (with Up/Down/PageUp/PageDown keys); - joystick alphabet in content/lbm/joyalpha.txt (bug #495) - Alex -- Text input refactoring: enabled key repeat, added support for - Home, End and BackSpace keys; (bugs #671, #815) - Alex -- Selecting the scan methods for shielded and gas giant planets - is now allowed when using PC menus (bug #800) - Alex -- Added a unified credit roll combined with outtakes (bug #46) - Alex -- Setup menu selection doesn't reset when you quit a submenu now - Michael -- Split config.alwaysgl and config.usegl so that "Use Pure Mode If Possible" - persists across runs even when using a GL mode - Michael -- Fixed Yehat Rebel left hand doubling up problem (bug #807) - Alex -- Fixed the problem with Melnorme stripping Chmmr bomb/crystal - modules from the ship in a fuel deal (bug #803) - Alex -- Corrected baseline of 'j' in Micro font (bug #797) - Alex -- Fixed small VUX animation glitch (out of order frames; bug #808) - Alex -- CANCEL now behaves as expected in setup menu - Michael -- Only SELECT and CANCEL trigger the fade-to-black at the end of a - Super Melee, solving the issue in bug #547 - Michael -- Admiral ZEX is no longer referred to as "Commander" or "Zex" (bug - #811) - Michael -- Keypress status is not reset when entering battle mode (solves - bug #596) - Michael -- Added the rest of devel/ and users/ documentation into MSVC .dsp - files (bug #589) - Michael -- Fixed PNG transparency info (tRNS chunk) in all images according - to info specified by .ani - Alex -- Comm animation fixes (bugs 557, 705, 806); from chmmravatar, Alex -- Imported DOS versions of alien comm graphics which have richer - palettes and look better in most cases (bug #314) - Alex -- Added slider controls for volume to setup menu - Michael -- Added --shield and --scaler hq to setup menu - Michael -- Fixed lockup when skipping past VUX beast analysis data in Starbase - (bug #790; should take care of all spliced comm edge cases) - Alex -- Added 3DO-style throbbing slave shield (--shield; bug #32); - special thanks to Nic for inspiration and some code - Alex -- Rotating 3D planet changes: nicer looking slave shield; planet now - finally looks like a rotating sphere (and not cylinder); added some - lighting variance to give it a 3D feel (not a smooth ball) - Alex -- Refactored colormaps storage, management and transforms; paletted - images rendering should be much faster now - Alex -- Corrected intro slide 5 (crosshair removed); bug #794, from AusME -- Split off alien comm colormaps from global scclrtab into - corresponding race dirs (avoids potential mod collisions) - Alex -- Refactored font engine: fonts are loaded and treated as - alpha-channel-only images (allowing for antialiased fonts now); - solid color and gradient/alternate effects processing is unified - Alex -- Fixed problems with pausing the game during ending sequences - (game-clock bug; undrawing incorrectly due to cliprect) - Alex -- Removed hotspot abuse from lander report drawing to fix bad - positioning desync brought on by new hotspot handling - Alex -- Trilinear melee scaler overhaul (melee smooth mode should look - nicer now; melee can now fully use alpha gfx) - Alex -- Miscellaneous Sa-Matra gfx fixes (Generator collision masks and - explosion frame 0 were off; Shield position was off in med and sml; - Main sml gfx was 2 pixels too narrow) - Alex -- Replaced the binary resource indexes by textual ones - (also resolves bug #687) - SvdB -- Some subtitle timing fixes (bug #s 771, 780) - Alex -- Entering Planetary Orbit wait screen is back (from DOS) - Alex -- Gfx engine changes: now always 32bpp internally (facilitates - alpha channel usage); accelerated platform-specific scaler code; - only using alpha channel where needed. Processor pack is necessary - for compilation on VC6. - Alex -- New 2x scaler 'hq' (by Maxim Stepin; www.hiend3d.com/hq2x.html) - Alex -- Removed MikMod i/o hacks (using MREADER i/o now; bug #787) - Alex -- Fixed fast escape weirdness (bug #619) - from Jan Lönnberg -- New topographical 4x planet surface scaler (bug #786) - Alex -- Added support for Tremor for Ogg Vorbis decoding (avoids floating point - math) - SvdB -- Fixed T-Pet compulsion graphics (partially); bug #772 - Alex -- Doing game-state file I/O in memory instead of temp files; - should avoid problems as in bug #752 - Alex -- Separate config_win.h file for build.sh builds on Windows - SvdB -- Fixed a typo ("we" -> "he") in Thraddash dialog (bug #783) - Alex -- Corrected grammar in Umgah 'Caster lander report (bug #781); - from James Ho -- Options selected in the Setup Menu now persist across runs -Michael -- Added a simple implementation of key-value pair "resource" files - for organizing simple data such as configuration options -Michael -- Added a 'fullscreen' setup menu option - Alex -- Fixed a bug that prevented Slylandro Probes from ever showing up - in interplanetary exploration (found by SvdB, bug #768) -- Lowered the Comm ambient animation rate from 120 to 40fps, thus - limiting the CPU usage - Alex -- Fixed Recursive Mutexes to still work even if the ThreadID is 0 - (bug 779) - Michael -- Permit independent selection of graphics driver and resolution in - setup menu - Michael -- Changed comm subtitle caching to use own context instead of - screen grabs; should resolve Blue Comm Screen universally - Alex -- Added missing break statement in DrawBatch:RECT_PRIM - Alex -- Setup menu split into four submenus - Michael -- Fixed fallback in getHomeDir() for when $HOME is not defined on *nix - - SvdB -- %APPDATA% fallback no longer to "../userdata", but to "./userdata", - as we don't chdir() to the content dir anymore. - SvdB -- Commander Hayes flickering lights animation now properly reenabled - when applicable (bug #777) - Alex -- Refactored setupmenu code to use generic widgets - Michael -- Support UTF-8 chars in mineral names (bug #770) - SvdB -- Modified scalers to use surface pitch instead of width - reported to - fix bug #740 - Michael -- Cleaner build output. Set '$MAKE_VERBOSE' to 1 for old output. - SvdB -- Improved dependency tracking for unix build system. - SvdB - "./build.sh uqm depend" is only needed for checking for new source files. -- handle "." and ".." in paths - SvdB - -0.4: -- Nicer title image during intro, from Nic -- Installation routine for MacOS X, from Nic. -- Lots and lots of dialog fixes, from Nic. -- Some speech is dependant on whether spoken voices are on, from Nic. -- OpenAL header cleanup. Updating OpenAL may be necessary. - Windows users should put the OpenAL headers in an AL/ directory - now too (should be the default). - SvdB -- Improvements to the unix build system for cross-compilation - SvdB -- Do not define ssize_t for MinGW. - SvdB -- Fallback readdir_r() - SvdB -- Attempting to click the screen pops up an error message, from - Nic, heavily modified (dodge on #533) -Michael -- Fixed potential crash with a truecolor oscilloscope image (thanks - jdorje) and made it generally more flexible (bug #729) -Alex -- Added missing Tanaka battle portrait images (new artwork; oldcap) and - minor fixes to other shofixti images (bug #183), from Nic -- Mycon captain portrait finally fixed (bug #183), from Nic -- Saving the game while on autopilot inside an interplanetary system - will no longer reset the autopilot (bug #725) -Alex -- Main menu and Super Melee menu can now play music tracks; drop in - 'lbm/mainmenu.ogg' and 'melee/melemenu.ogg', respectively -Alex -- Can now switch mod->ogg in intro/outro player (thanks Nic), and - mod<->ogg everywhere in general -Alex -- Fixed crash after T.Pet conversation upon reentering D.Crateris - once Ur-Quan have been confused (bug #531) -Alex -- Fixed last subtitle flashing after fast-forwarding to the end, - pressing F10 and selecting NO (bug #498) -Alex -- Fixed first contact with Arilou at homeworld; Talking Pet confusion - (bug #638), from Paxtez -- Fixed warp-escape in Cyborg mode removed by previous game input - patches (bug #563) -Alex -- Fixed spurious story-line changes (usually the manner of the encountered - race) caused by loading a game from an Encounter screen (bug #519) -Alex -- Option change: --meleescale to --meleezoom (bug #694) -Alex -- The alpha icon is now default (for XP/2003); bug #474 -Alex -- Fixed incomplete memset()s in comm alien animation code (comm should - be saner now), from jdorje -- Guard access to the Clock so that accessing it is a no-op when the game - isn't actually in progress (bug #678), from Nic -- Accept files with .uqm extension for packages (bug #558) - Added regex fallback files. - SvdB -- Music volume normalized throughout the game (bug #718) -Alex -- VControl parse errors suppressed unless critical - attempting to set - the threshold of a nonexistent joystick no longer makes the game refuse - to run (Bug #660, again) - Michael -- Properly handling Thraddash-Ilwrath mission overlap (bug #530) -Alex -- Separate 'ask for fuel' player responses for Mercury and Luna missions - (bug #716), from Nic -- Stereo SFX model changed slightly (fixes #472) -Alex -- Pkunk Spindle news items are now disabled until you befriend them - (bug #315), from Paxtez -- Melee captain names re-extracted and fixed (bug #188) -Alex -- It is now possible to complete the game without ever allying with the - Starbase at Earth; known as 'Beating the Game Differently' mode; - (bug #592) -Alex -- The direction flagship is facing is now preserved through an - encounter in Hyperspace -Alex -- Added support for PC-style 3-step melee zooming; -b=pc|step option; - (bug #694) -Alex -- Melee team building pick-ship box is now generated with actual ship - icons (bug #692) -Alex -- Setup Menu no longer crashes or misbehaves on custom resolutions (bug - #693) - Michael -- Quit confirmation window (on F10) undraws correctly during intro slides - (bug #673) -Alex -- Attempting to set to a mode that Doesn't Work in Setup no longer ends - the program (bug #695) - Michael -- Fixed segfault when shutting down because video could not be initialized - (bug #683) - Michael -- Fixed crash when restarting Sa-Matra battle after abort (bug #700) -Alex -- Some cleanups, enabling successful build with GCC 4 (bug #710), - mostly from Ville Skyttà -SvdB -- Sa-Matra portrait now fills the portrait space (bug #514), from Nic -- Updated melee images with original DOS content; should resolve most - captain portrait issues (bug #183) -Alex -- Bug #702 fixes (dead code + compiler warnings) -Alex -- Flagship will not fly sideways on auto-pilot in Hyperspace (bug #642) -Alex -- Fixed menu sounds in full-game battle ship selection box (bug #566) -Alex -- Added '--version' - SvdB -- Fixed a bad memory access which could occur when the code relies - on CharCount for determining the end of a string (bug #701). - SvdB -- Battle planet images now have corrected transparency info, so there - is no more black square overlaping ships (bug #128); and coincidently - 3DO credits now have a starfield background (bug #470) -Alex -- Unicode support for fonts and strings - SvdB -- Fixed image clipping with --meleescale=nearest (bug #126) -Alex -- Setup menu now uses a background contributed by Joffrey Smith -- If keys.cfg refers to a nonexistent joystick, the game will stil run - (bug #660) -McMartin -- Fixed support for languages other than English; loading font chars - with codes above 136 is now possible (bug #690), from Matthias Hager -- Enable the other insults against the Mycon (bug #559), from Nic. -- Colormap format (.ct files) changed to allow for richer graphics. - First step towards importing some of the original DOS gfx. - See bug #314 for more info. -Alex -- Better dependency checking in unix build scripts - SvdB -- Many options menu changes: left-justified categories, and the ability - to change driver/resolution/bpp/scaler in real time, and updates are - less frequent so as to spare the DCQ -McMartin -- PC ending animation now draws the flagship with modules according to - the actual player's load; also the script structure changed - allowing for an FPS improvement -Alex -- Version number in the main menu does not blink anymore when the - menu selection is changed (bug #672), from Nic -- Massive amount of file restructuring and cleanups. Need many more. - SvdB -- Added Intro and Ending slide shows (bug #46); use "-i pc" -Alex -- Cross-fades in OpenGL mode with complex scalers fixed (bug #674) -Alex -- Added doc/devel/dialogs - SvdB -- Don't allow the reply "Symbionts, how interesting!" in the Supox - conversation until they mentioned they were Symbionts. (bug #528), - from Nic -- Not initialising the various systems when -h/-? is supplied (bug #656), - from Nic -- F10 works when playing the intro (bug #665), from fOSSiL -- Game clock counter overflow fix (bug #668) - [collective effort] -- Cocoa hooks for MacOS X, from Nic -- Corrected number for combat energy when outfitting starship. - SvdB -- Added dumping planet info to uqmdebug.c - SvdB -- Check language.txt for locale, from Zap -- Make it possible to specify the config dir on the command line. - (bug #645) - SvdB -- Speech .txt and .ts corrections, from Nic. - SvdB -- Made the unix build scripts more portable. Removed some small - bugs. - SvdB -- No longer chdir() to the content dir (bug #564) - Environment variables and ~ are interpreted in the supplied content - path now. - Don't look for content in the default directories if an explicitely - supplied path failed. It would only confuse users. - SvdB -- The unix build script is now able to detect SDL on Darwin (bug #358) - SvdB -- Resource units given more obviously when ordering a probe to - self-destruct (bug #586), from Nic. -- Shipyard "Combat Energy" changed to reflect the recharge rate (bug #522). - Also, some cleanups. Thanks and apologies to Nic. - SvdB -- Added lots of debugging functions, SvdB -- Cleaned up use of the DEBUG define, SvdB -- Talking Pet .txt file corrected to match the .ogg files, - and talkpet.ts corrections, from Nic -- Abstracted window-drawing code from confirm.c -Michael -- Fixed blue comms screen problem (bug #363), from Joel Holveck & Nic -- Automatically adding an icon for Darwin builds, from Nic -- Fixed Roster-F10-Quit bug (#591), - Michael -- Restructured starcon2.c, with better checks for argument parsing, - and consistent error messages. - SvdB -- Restructuring of the unix build scripts. - Also, interrupted dependency builds are now detected. - SvdB -- Unix build: Make it possible to use another directory than the current - one for putting the build data in (such as build.vars, config.state, - the obj/ dir, and the final binary). - SvdB -- Fixed various odd behaviors when loading from HyperSpace (bug #587), - from Nic and Michael -- Added new 'triscan' scaler; derived from scale2x[.sf.net] -Alex -- Space marines die in a self-destructing Scout (Bug #445), from Nic -- Added the -l option to produce logfiles (bug #560), from Nic -- Zoq-Fot-Pik speech properly vertically centered (bug #579), from Nic -- Input code refactoring, phase 2: All player input is brokered by - DoInput -Michael -- Updated .cvsignore commands, from Nic -- Fixed a keyrepeatbug from when the player cancels out of the - Starmap in IP -Michael -- IP_taskfunc now uses PulsedInputState instead of handling its - own debounce delays -Michael -- Input code refactoring, phase 1: Replaced messy structs with an - array indexed by an enum. -Michael -- Thread code refactoring: only the main thread will actually spawn - threads, and thread IDs are properly recycled with SDL_WaitThead () - once they're done. (With luck, this will fix bug #561) -Michael -- Sound code refactoring: core api is now virtualized, - MixSDL is divided to generic mixer and driver entities - Mika -- Optimized MixSDL mixing and resampling routines - (hopefully fixes bug #435) - Mika -- MOD music should now play properly on big endian machines if using - high quality mode (workaround for bug #166) - Mika -- Better-looking slave shield (bug #32), from Nic -- Bay door animations don't stall before aborting (bug #500), from - chmmravatar -- Reports SDL version on startup (bug #520) - Mika,Nic -- Fuel usage on planet landing is now reported correctly on all situations - (bug #556), from Nic -- Fine-grained control of menu sounds, "MenuSounds" global now - guaranteed to always be non-null -Michael -- Added support for stdio file access through temporary files to uio. - added uio_copyFile to uio - SvdB -- Added uio_getFileLocation() and uio_getMountFileSystemType() to uio. - Also some small improvements. - SvdB -- Fixed fuel usage estimate to selected destination on the starmap. - (original bug, not reported) - SvdB -- Sound decoders refactoring: decoders are now virtualized, - the high-level decoding code is unified and any format is - theoretically streamable -Alex -- Patches to enforce the invariant that the GraphicsLock is held when - SetFlashRect is called (bug #504) -Michael -- Major refactoring of threadlib; see doc/devel/threads -Michael -- Downgraded the GraphicsLock to an ordinary Mutex -Michael -- Added movie player; only movies defined are intro and ending; - only .duk decoder present (.duk audio decoder mostly derived - from decoder by SvdB) -Alex -- Extra fallback for the unlikely situation that $HOME isn't set on a - unix system. (#493) - SvdB -- Accept spaces in --contentdir argument (#492) - SvdB -- Separated and abstracted sound buffer-tagging and trackplayer - clip/subtitle chaining -Alex -- Abstracted the recursive mutexes in MixSDL and DCQ code -Michael -- Introduced a new synchronization construct (CrossThreadMutex) and - migrated the GraphicsSem and clock_sem over to it (#359) -Michael -- Replaced thread-local Semaphores with Mutexes (#359) -Michael -- Load/save icons don't flash anymore when in savegame menu - (part of bug #291), from Paxtez -- Savegame slot now defaults to the last one used during one execution - of uqm (bug #477), from chmmravatar -- Fixed one-pixel glitch in shipyard when scrapping (bug #461), - from Paxtez -- Adjusted subtitle timings when there are no oggs (part of bug #362), - from chmmravatar -- Fixed crash in conversation summary and ffw/frew problem when - selling data to Melnorme (bug #476), from chmmravatar -- Flush input after selecting "Navigate" (bug #475) - Michael -- Fixed ships in solar system getting displaced after having - visited a planet (bug #365) -Alex -- Fixed collisions/encounters with "invisible" fleeing ships - (bug #319) -Alex -- Quit confirmation fixes: lander reports, conversation summaries, - outtakes, end credits; font effect properly set/saved/restored; - (bugs #454, #465, #466); from chmmravatar -- Obsolete "register" keywords removed -Michael - -0.3: -- Dirty hack to avoid a warning about the "ignored.key" hack - SvdB -- Typo 'natually' fixed in Arilou speech - SvdB -- uio: Fixed a bug which could cause spurious warnings when using .zip files - generated from DOS/Windows - SvdB -- uio: Fixed a potentially memory-corrupting bug when in a .zip file a subdir - is described before a dir higher in the directory structure. -- uio: Fixed an incomplete message that would only show when handling a - specific error - SvdB -- Added doc/checklist file - SvdB -- RUs properly cleared in savegame display, from Paxtez, chmmravatar -- Support for up to 50 savegames, from Paxtez -- Action names are properly null-terminated, stops a crash for some - bad keys.cfg types -Michael -- added '--addon ' - SvdB -- keys.cfg from incompatible control scheme version is now renamed - automatically to keys.old -Mika -- Added warranty message in the console on startup, SvdB -- Left and Right directions disabled in fuel screen (bug #452), from - Paxtez -- Syreen don't rejoice until victory truly is theirs (bug #451), from - Nic -- Guardian in Blazer mode being drained by DOGI will no longer - result in a non-blazer Guardian with Blazer effects. Original sc2 bug. - (bug #283); from Paxtez -- 'CREW' and 'BATT' instead of icons in combat screen when using - PC-style menus (bug #308); from Paxtez -- New shipyard SCRAP system with scrapping confirmation - (bug #413); from Paxtez -- Syreen ships become available when Talana says they are - (bug #264); from Nic, Alex -- The infinity symbol is correctly printed for gas giant atmosphere - in coarse scan screen (bug #239) -Alex -- Prevent Syreen crew above 12 getting thrown out the airlock in - Roster screen (bug #184); from chmmravatar, Alex -- Lander report messages now use the entire panel (bug #36), from chmmravatar -- Fix colour cycling in the roster screen (bug #279), from Nic -- Fixed last seen battle-group teleporting to Sol after invoking - Talking Pet in Sol (bug #109) -Alex -- Fixed a dialog glitch on Slylandro homeworld (#442) -Michael -- Freeze planetary simulation at beginning of landing sequence to stop - event bursts (bug #80) -Michael -- Extra 2 ship slots in supermelee, as in the PC SC2, and all the PC - default teams, from chmmravatar (bug #248) - NOTE: this breaks old team saves! -- Made functions for GET_GAME_STATE and SET_GAME_STATE - SvdB -- Fixed bug with entering closing portals (bug #108) - SvdB+chmmravatar -- Mouse cursor is now hidden in fullscreen mode (bug #173) -Mika -- Version checks inside the input code to flag incompatible changes --Michael -- Install location for content on unix systems is now ${prefix}/share/uqm - instead of ${prefix}/lib/uqm - SvdB -- New main menu graphics from MarkVera, Paxtez, Nic (bug #393) -- Removed a place where you could ask for repairs when you shouldn't - (bug #432), from Nic -- Can use F10 to quit during splash screen as well as main menu -Michael -- Fixed starship location when being teleported from Procyon to - the Earth Starbase after the Precursor bomb is installed. - SvdB -- Crew death on planet is now counted properly in all cases (bug #70) -Mika -- Fixed lockup in 'save failed' alert box (bug #397), from ghakko -- Fixed glitch in Pkunk animation (bug #354), from Paxtez -- Fixed Kohr-Ah final defeat message repeating (bug #426) -Mika -- Fix for picking up talking pet after Umgah genocide - from Paxtez -- MinGW compilation fixes - SvdB+Mika -- Bilinear scaler is now faster, has 24bpp mode and uses regions -Alex -- Accept CRLF line endings in .txt and .ts files - SvdB -- Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika -- MixSDL now handles resampling correctly (less cracklings); - added cubic interpolation for high quality mode -Mika -- Removed the redundant "GameExiting" variable -Michael -- Added quit options to ingame menu (bug #409), from Paxtez -- Fix position of blinking save/load in melee (bug #406), from Paxtez -- New packaging/io system. - SvdB -- Exit confirmation dialog is prettier and safer, from Paxtez -- Exiting from the main menu with F10 now exits the game -Michael -- Changed lander speed to 35 FPS, which matches reported 3DO speed - (Bug #22) -Michael -- Added a Menu-Delete key for the Super-Melee menu (#123) -Michael -- Added support for positional (stereo) sound effects, currently - works only with OpenAL -Mika -- Fixed screen transitions from homeworld conversations (bug #348) -Michael -- Fixed Fwiffo join_us_refusals initialization (bug #405) -Mika -- Fix Druuge transactions to not elevate crew costs baselessly (bug #235), - from ghakko -- Fixed glitches and NULL Stamp draw attempt in menu code (bug #26) -Mika -- Absence of voice files is now automatically detected (bug #309) -Mika -- Fixed Commander Hayes mouth movement before radioactives are given - (bug #343) -Mika -- Fix glitches in slylandro probe animation (bugs #398, #399), from Paxtez -- Confirmation dialog box for exiting the game is now menu-based -- Commander Hayes explains his predicament before you get the option to - rescue, closes #366, from Nic -- Gestalt mode accelerates continuously as long as some key is held; - should resolve to PC-style input wrt bug #381 - Michael -- Fixed some more false key cancels, addressing 378 again - Michael -- Added "gestalt mode" for acceleration cancels; fixes #381 - Michael -- Fixed some "false key cancels" in the input system, addressing bugs - #378 and #379 -Michael -- Completely reworked the input system -- Added PC version outtakes, from chmmravatar -- Fix crash in PlayStream when whole file is prebuffered and its not - speech (bug #259) -Mika -- Fix endian problem in colormap transform code (bug #137) -Mika -- Fix minor glitch in planet coarse scan (bug #238), from chmmravatar -- Wav loader is now endian safe (bug #165) -Mika -- Dialogue patch for Melnorme, fixing bug #335 -- Two dialogue spots where visit count could run away patched; fixes bug - #333, from Stas Sergeev -- EventHandler checks CurStarDescPtr before dereferencing it (bug #347) -- Oscilloscope/mini-map now has borders (bug #307 part 4) -Mika -- Flashing rects are no longer constrained to even-numbered pixels on the - y axis; fixes bug #255, from Nic -- Fixed minor glitches in main window borders (bug #307 parts 1,2,3) -Mika -- There's now space before and after : in coordinates (bug #307 part 6), - from Paxtez -- Star coordinates no longer shimmy (bug #331), from chmmravatar -- The DRAWABLE_DESC datatype now uses separately allocated arrays for - animation frames instead of doing pointer arithmetic between it and - FRAME_DESCs --McMartin -- Date on the green bar now has floating period between day and - the year like in PC version (bug #307 part 5) -Mika -- AWARE_OF_SAMATRA flag is now written as well as read (closes #113), - from Nic -- Subtitle drawing is now cached (closes #313) -Mika -- Fix glitch and lockup in dialogs when rewinding (bugs #311 and #272), - from chmmravatar -- Fastforwarding when in last subtitle now works as expected (bug #318), - from chmmravatar -- Fixed MixSDL buffer underrun handling (bug #211) -Mika -- Fix issue with caps lock and num lock preventing planet scan - and lander message skipping (bug #299), from chmmravatar -- Subtitles are now hidden after alien has finished talking (bug #312), - from chmmravatar -- Fix for mycon portrait (bug #183), from Nic -- Music levels no longer drop in conversations when using -T 0 - (partial fix for bug #309), from chmmravatar -- Added PC-style conversation summaries (bug #310), from chmmravatar -- Pressing pause key now stops dialog correctly (bug #167), from chmmravatar -- Fix some glitches in load/save screen (bug #163), from chmmravatar -- Utwig shield now pulsates properly (bug #269), from Nic -- Fix for memory leak in TFB_DrawCanvas_ExtractPalette (bug #277), - from Richard Braakman -- Patched Umgah dialogue, fixing bug #8 -- Crossfade code now explicitly caches the screen to transition from, and - thus no longer glitches. The code needed a slight rewrite, but this - does fix bug #33 -McMartin -- Melee scaling is now trilinear by default, but it's still possible to - choose nearest neighbour with --meleescale; fixes #34 -Mika -- Minimum scaling extent is now 1,1; fixes mostly small-objects-disappearing - problem in melee, from chmmravatar -- Fixed a long standing memory leak relating to planet surface -PhracturedBlue -- Scaled images no longer allocate/free memory all the time -McMartin -- Planet spin on lander launch/return is now enabled -PhracturedBlue -- Fix skipping after planet scan, landing (closes bug 31) -PhracturedBlue -- Decelerate when entering orbit to give a smoother effect -PhracturedBlue -- fix subtitle text overlap issues (bug 232) -- 'Esc' now leaves planet surface (bug233) -PhracturedBlue -- Fix race on exiting starbase (bug 230) -PracturedBlue -- Cleanup shipyard door animation (bug 215) -PhracturedBlue -- Misc .ani fixes; Fixes asteroid destruction crash (bugs 150, 155, 158) - and somewhat fixes Mycon potrait (bug #183) -fOSSiL -- Moved image scaling to DCQ thread; fixes scale-out-of-sync problem - in melee -Mika -- Fix lockup in cyborg melee (fixes 204 and 218) from chmmravatar -- Added -g option to control gamma correction, from chmmravatar -- Restored the CondBank to actually use condition variables properly - (resolves a race condition under OpenBSD) -- Removed aspects of the legacy graphics code that are never used or that - are redundant. More 'C-like' use of the PRIMITIVE datatype. -- Fix various graphics glitches during dialog. Especially Spathi Eye,and ZFP - Closes #23, #156 - PhracturedBlue -- Fix Syreen, KohrAh and Slylandro ship effects to not be screen - size dependant (corolary to bug 93) - PhracturedBlue -- Line clipping is now handled correctly; fixes #28 (one pixel corruptions) - and #198 (beam weapons changing direction) -Mika -- Vux warps in close (fixes bug 93) -from Nic -- Fixed lockup on lander-report (Bug #144 annd 187?) - PhracturedBlue -- Version # is now printed in the main menu, from Nic -- Added PC Shipyard + Hangar power lines animation; - (closes #176) -fOSSiL - -0.2: -- Shipyard/Outfit screens now use larger PC graphics; - Outfit blueprint is properly aligned; from Nic -- Key config is now saved in user dir too. - melee.cfg too again. - SvdB -- Added copyFile() - SvdB -- Pure mode partial screen updates are now more efficient; - fixed 'crossfades not finished' problem -Mika -- Graduated colours for crew in shipyard, from Nic -- Alien dialog fixes: Talking Pet, Utwig, Mycon, Syreen -fOSSiL -- Updated all game, menu, melee and weapon sounds to original 3DO - ones (extracted using various tools); some sounds were simply - wrong: menu - "device success", weapons - arilou, slylandro, thraddash; - others had bad sampling rates; (fixes #19) -fOSSiL -- Fixed Melnrome repeating "Please do not mention this subject again" - text (bug #145) -fOSSiL -- Fixed load/save screen leaving characters when having more - than 1000 units of some type of resources (bug #75) -fOSSiL -- Lowered Drawable memory footprint, made Frame safer - Martin -- Support for running without voice .ogg files present -PBlue -- Slider should now work correctly everywhere -PhracturedBlue -- Added 'nosound' driver and --sound=openal|mixsdl|none - option; -a option has been removed -fOSSiL -- Fix ZFP stuttering and some other random sound issues -PBlue -- Correctly deal with multiply-mapped keys. This may fix some keys - not being detected correctly on the Mac as well - PBlue -- OpenGL mode now fully supports partial screen updates -Mika -- Fixed melee ship selection-box bugs -fOSSiL -- Added a 4th button to starcon.key 'Esc' now emergency-escapes -PBlue -- Biadapt and biadv scalers now work in OpenGL mode too -Mika -- Fixed lockup when fastforwarding through orz comm -PBlue -- A new windows installer is now in builds/win32_install -PBlue -- Added '-a' switch to go between OpenAL and MixSDL at runtime -PBlue -- Melnorme will pronounce numbers now -fOSSiL -- Added icons to win32 builds (MSVC and mingw) -fOSSiL -- Removed the GraphicStrength code, since all that is handled with - an arithmetic blit routine outside of the drawing thread -- Added an improved version of biadapt scaling filter, - working name "biadv" (use --scale=biadv) -fOSSiL -- Removed SDL_mixer sound module -- TFB_FlushGraphics keeps track of smallest bounding box that requires - updating, allowing for faster scaling -- Added a TFB_Canvas data buffer to let TFB_Image be more accessible -- Added new graphics primitives -- Added 'smooth' scolling for ff, frev (similar to the 3DO) - PhracturedBlue -- New streaming code for openal/mixsdl. supports ff/frev in subtitles -PBlue -- New sound module "mixsdl" (experimental) -fOSSiL -- Fixed overlapping subtitle text while switch tracks -PhracturedBlue -- New flash-thread cacheing scheme - PhracturedBlue -- Voice-over / subtitle synch is done - PhracturedBlue -- Optimized DCQ to be much smaller and faster -- Added stat data in outfit screen (use --font=pc) - from Nic -- Added fixed introx.mod, from fOSSiL -- Fixed Orz .mod file, from fOSSiL -- Added vertical alignment for subtitles (text runs off screen fix)-from Nic -- Updated infinity text/symbol for RUs - from fOSSiL, Nic -- Split away DCQ-specific code into its own header file -- Added correct lander font - from fOSSiL -- Added support for multiple menu hierarchies, and a few PC hiers. -PBlue -- Fixed a potential semaphore race when suspending clock -PhracturedBlue -- Function name conflict fixes for Mac OSX -by peterb -- Minor fixes for pc-fonts (Outfit screen, gradient color swap) -by Nic -- DCQ is now accessed uniformly by routines in gfx_common.c -- Fixed OpenGL colors on MacOS X -Mika -- Added a sane cmd-line naming scheme: --opt=(pc|3do) see --help for more -PBlue -- Added new font effect (PC-lander messages), and set colors for text -PBlue -- Use correct font for 'CAPTAIN', 'FUEL', and 'CREW' is status screen -PBlue -- Added gradiated font support (for ship name), and PC-font option -PBlue -- Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue -- Updated mingw support with better directions, and easier build -PBlue -- PCMenus now suports 'settings', and menu font is correct -PhracturedBlue -- Added '-b' option to get PC Menus -PhracturedBlue -- Check for a deadlock in savedgames and try to continue -PhracturedBlue -- Added an option ('-a') to display 'PC-style' coarse-scan -PhracturedBlue -- Fixed deadlock races in new FlushGraphics method -PhracturedBlue -- FlushGraphics now waits and notifies on a per-thread level - McMartin -- No longer using SHGetFolderPath on Windows - SvdB -- Key repeat is now enabled when typing text, from slayne -- Capital letter bug in new input code fixed, from slayne -- Oscilloscope now reacts to music when speech is disabled (OpenAL) -Mika -- Rewritten input code (better and adds joystick/pad support), from slayne -- Biadapt scaling for pure mode, from fOSSiL -- Saving user data in "%APPDATA%/Application Data" on windows - SvdB -- Melnorme comm fix, from TD. -- Planet scan font character fixes (micro.fon), from fOSSiL -- Temporary files are deleted on exit. - SvdB -- Font png's no longer need to have alpha channel, black background with - white pixels is enough -Mika -- Added PC version intro/ending font, from VileRancour -- Added files for intro and ending sequence, from fOSSiL; extracted using - Mudrony's scripts plus his own work. -- Added some corrected mods, from fOSSiL; extracted using Mudrony's scripts. -- Replaced add_sub_frame with arith_frame_blit -PhracturedBlue -- Crosshair in orbit leaving light trace to image in OpenGL mode fixed -Mika -- Planet scan should now take ~2secs on all computers -PhracturedBlue -- Updated earth image to look nicer (no vertical lines) -PhracturedBlue -- Clock semaphore is now created with a value of 0 -PhracturedBlue -- Rewrote Semaphore debugging code to be more useful - PhracturedBlue -- Better fix for clearing load/save screen - fOSSiL -- Implemented bilinear scaling in pure SDL mode - Mika -- Planet surface is now smoothed, from PhracturedBlue -- Implemented scanlines in pure SDL mode - Mika -- Star sizes and colors are now correct in solar system, from fOSSiL -- Captain portraits in melee are now updated properly after battle and - bottom portrait always stays in correct place, from fOSSiL -- Removed 2xSaI and SuperSAI scaling due to GPL incompatiblities. - They should be reimplemented later. -- Bucks print from wrong team in melee ship selection box fixed, from fOSSiL -- Autopilot works in Quasispace when without fuel, from fOSSiL. -- Negative shift warnings removed, from Fizban -- Displaying correct lander images, from fOSSiL. -- 3D planet now uses phong lighting, from PhracturedBlue -- Put save data and temporary files in a seperate dir - SvdB -- Fix OpenGL colors on big-endian CPUs, from Bryce McKinlay -- MikMod now loops modules correctly (OpenAL), from Nic -- player.fon/42.png corrected, from Parker -- GraphicsSem usage reverted back in RotatePlanet, from PhracturedBlue -- Pause/exit game dialog problem with planets fixed, from PhracturedBlue -- Fixed lockup if sbuf_size was zero (OpenAL) -- Planet surface changing color when using device fixed, from PhracturedBlue -- Some race conditions eliminated, from PhracturedBlue -- Earth / other slave shielded planet color issue fixed, from PhracturedBlue -- Orbit/starmap related lockup fixed, from PhracturedBlue -- 3D planet showing on starmap when in orbit fixed, from PhracturedBlue -- Scan (single, interrupting) fixed, from PhracturedBlue -- Defining DCQ_OF_DOOM lowers the DrawCommandQueue size to 512, to aid in - simulating severe overload stresses on the machine -- Removed TFB_FlushGraphics' dependency on GraphicsSem, which the new - condition variable code both breaks and makes unnecessary -- Scan tint is now cleared right after the scan, from PhracturedBlue -- Recoded the DCQ to not sit on the heap, added debugging info -- Fixed Outfit Starship and Shipyard graphics, from TDuck -- 3D planet is now zoomed randomly from any corner, from PhracturedBlue -- Flagship thrusters and modules one-pixel place fix, from TDuck -- Earth topo map is now tinted as should, from PhracturedBlue -- Fixed planet stuff when leaving surface with lander, from PhracturedBlue -- RotatePlanet now holds GraphicsSem a shorter time, from PhracturedBlue -- Added proper mutex usage to 3do_getbody.c, from PhracturedBlue -- Scan uses now additive blit instead of transparency, from PhracturedBlue -- Loading game saved while in orbit fixed (bg correct), from PhracturedBlue -- Changed SDL_Delay to SleepThread in TFB_FlushGraphics -- Rendering thread now broadcasts to a condition variable, stopping most - of the problems we were having where a fast thread spams the DCQ with - too many requests to handle in a timely manner -- Fixed an unsafe memory freeing from sfx.c -- Thread library now includes condition variables -- Shofixti dialogue fixed to subtitles, by BlckKnght -- Crash during loading from orbit fixed, from PhracturedBlue -- Starmap issue when orbiting earth fixed, from PhracturedBlue -- Oscilloscope is now implemented (OpenAL) -- Moved initialisation of _MemorySem to memInit - SvdB -- Planet scan is now cleared correctly, from l0ci -- Flagship modules are now drawn correctly instead of one pix left, from l0ci -- Planet code fixes, from PhracturedBlue -- Build fixes for FreeBSD, from Max Horn. -- Fixed typo in Thraddash text, from Dan Plimak. -- Make HMalloc abort when no memory available, from Abaddon. -- Replace malloc() calls by HMalloc, from Abaddon. -- #include in main program, for OSX, from Max Horn. -- Use sources for getopt() for all systems that don't support it, not only - for Windows, from Max Horn. -- Planet code cleanups, from PhracturedBlue -- Changed some types to SDLKey in input.c to prevent overflows, from tamlin -- Slider now moves in communications (OpenAL) -- Fixed a DCQ bug where it wasn't freeing batches of graphics commands -- > vs. >= bugfix on plangen.c, from PhracturedBlue -- More appropriate names to ROSTER + 1 and ROSTER + 2, from slayne -- Lines and colouring of planet surface when scanning, from PhracturedBlue -- Melnorme bridge turns purple at the right spot in his conversation -- Repaired a DrawCommandQueue invariant, from tamlin -- Color transforms in communication merged into core animation thread -- 3D planet is now antialiased, from PhracturedBlue -- Hyperspace saving crash introduced by prev. patches fixed, from slayne -- Precursor ship crew count is now placed correctly in melee, from wjp -- Dialog choices doesn't go off rectangle in right anymore, from wjp -- When saving in planet scan screen, screen is now redrawn, from slayne -- Commas causing pixels to appear in planetary reports fixed, from slayne -- Team names switching when selecting next ship to fight fixed, from slayne -- More memory leak fixes in 3do_getbody.c, from PhracturedBlue -- Fixed memory leak in _ReleaseCelData, from PhracturedBlue. -- Fixed mutex deadlock in 3do_blt.c, from tamlin -- 'additional credits' amount for Melnorme correct now, by Windplume. -- Spheres of influence now move correctly in starmap, from l0ci@hotmail.com -- Linux OpenAL fixes (music plays now as stereo) -- Fuel giveaway bug fixed, from steve@blckknght.org and Windplume. -- Starmap fuel range calculator and actual consumption matches now -- Collision detection is now pixel-perfect (fixes Sa-Matra, BUTT missile, etc) -- Fixed lander position sign bug which was introduced by previous fixes -- Initial display of planet surface on landing is at correct position -- Planet scan is now properly erased when cancelling/landing -- 3D planet view when entering orbit is now implemented -- TFB_DrawCommandQueue->FullSize was uninitialised. -- Typo 'cultrue' for Thraddash fixed. -- Autopilot indicator no longer blinking on starmap and combat -- Entering a star system lockup/messed graphics fixed -- Position of planet info icons/texts is now correct and centered -- Yehat had no subtitles. -- Incorrect position of 'empty slot' and 'team name' in supermelee fixed - -0.1: -- Initial release - diff --git a/project/jni/application/sc2/Contributing b/project/jni/application/sc2/Contributing deleted file mode 100644 index 9eca28971..000000000 --- a/project/jni/application/sc2/Contributing +++ /dev/null @@ -1,135 +0,0 @@ -These are some guidelines for people who want to contribute to the code. -Don't be surprised if your contributions get tossed in the bit-bucket if you -do not follow them. We don't want to be unfriendly, but our time is limited. -These guidelines are there so that you won't waste both our and your time. - -Before making changes: -- Read this entire document -- See if the the Bugzilla bug database at - http://bugs.uqm.stack.nl/ contains any comments on what you're planning - to do. -- Make sure you're using the most recent Subversion version -- Discuss in advance what you're planning to do, with the core team. - The best place to do this is on #sc2 on irc.freenode.net. - This prevents you from wasting your time when - - someone else is already working on your issue - - we've got a very clear idea of how we want it to be - - the code you're planning to change will be completely rewritten - in the near future. -- Don't bother on adding "great ideas" you have for the game; - Our current goal is a straight port. The code is GPL, so feel free - to start your own modified version, but don't bother sending them - in for the official version. - -Making changes: -- Follow the coding style of the existing source. You don't have to like it, - we don't even always do, but we've accepted this as our standard. The main - reason is that this is very close to the original style. - Trying to start a discussion about the standard is pointless and is - definately NOT appreciated. - - Use 1 tab per indentation level - - Use no more than 76 chars on a line, when using a tabsize of 4. - - Use 2 extra indentation levels for the continuation of a broken line, - like this: - if (blablablabla || foobar || - zut || linefiller || - morezut) - printf ("Yeah!\n"); - - Don't use tabs for anything but indenting. If you would, and someone - has a different tab size, or something in the line changes, other stuff - on the line may or may not move, depending on where on the line it is. - If you for instance want to align a list of declarations, use spaces, - like this: - { - long l, - m; - int i; - } - (Though in this particular case, I personally would repeat the 'long', - or place l and m on the same line) - - Put { on a seperate line, both for the start of a function and - for the start of a block. - - one space around binary operators, and after commas. - - one space between the function name and following '(', both in - declaration and call (unusual as it is). - - one space after 'if', 'while', 'do', 'for' and 'switch'. - - even for short selections or repetitions, don't have the statement - to execute on the same line as the guard. So: - if (a) - a--; - - Use unix-style line-endings, that is '\n' only. If the editor you're - using doesn't support this, please pass your code through a conversion - program before submitting. -- Don't hurry into changing code. All code is there for a reason. Be sure - you understand that reason before changing it. Don't just go recode a part - because you think that would be easier than trying to understand the - original. If you don't have the skills or patience to do so, this is not - the place for you. -- Only use portable functions. The code is intended to work on Windows, - Linux, FreeBSD, BeOS and MacOS X. - Try to avoid unnecessary system-dependant code, but use #ifdefs if you - really have to. -- No shortcuts. Don't assume anything about user input (like the length), - and check the return values of functions that may fail. -- Your code shouldn't cause any compile-time or runtime-warnings. We know - the current source is far from warning-free, but those should be removed - eventually and we don't want to make it worse. -- Don't add comment lines saying things like "This line added by ". - These comments only foul the code and don't add anything for people - reading it. You'll still be credited in the Changelog, and for large - contributions (or many small ones) in the authors list. We have - Subversion for when we need to find out when what changes were made. - -Making the patches: -- One issue per patch. - We need to keep track of what's being changed, and multiple changes - in one patch will make that more difficult. - Also, we might want to accept one patch, and reject the other. -- Use unified diffs. - That way, there's a bigger chance the patch can be automatically applied - successfully against modified files. -- Make the patches against the current Subversion tree. - -Test the patches: -- If possible, test your changes both on Windows and a *nix platform, or - send them to someone to test them for you. - -Getting the patches committed: -- Either attach the patches to the appropriate bug report in the Bugzilla - bug database or send them to one of the committers, in plain-text format. - This can be done by email, DCC from within the #sc2 channel, or by - mentioning an URL where we can get the patch. - The committers are listed below (in alphabetical order), with their - particular field of expertise with the source. Though all of us - should have enough experience to deal with most issues not explicitely - mentioned. - Serge van den Boom (svdb at stack.nl), Meep-Eep at #sc2 - - Resource system - - 3DO historical code - - *nix build system - - Netplay - - General issues (particularly on *nix) - Mika Kolehmainen (mk at kapsi.fi), Gwl at #sc2 - - Graphics - - Sound - - General issues - Michael Martin (mcmartin at stanford.edu), McMartin at #sc2 - - Threading - - Alien communications code - - Graphics - - Input system - - In-game configuration - - General issues - Alex Volkov (codepro at usa.net), fOSSiL at #sc2 - - Graphics - - Sound (particularly MixSDL) - - General issues -- Only submit code that can be used under the GPL. By submitting code you - hold the copyright to, you agree that it can be used under the term of - the GPL. If you use code by someone else, make sure that it can be used - under the GPL and let us know, so that adequate credit can be given. - - -Initial version of this file by Serge van den Boom, 2002-12-05. - - diff --git a/project/jni/application/sc2/README b/project/jni/application/sc2/README deleted file mode 100644 index 74e0178d2..000000000 --- a/project/jni/application/sc2/README +++ /dev/null @@ -1,21 +0,0 @@ -You're looking at the readme for 'The Ur-Quan Masters', a volunteer -project that intends to bring the classic game 'Star Control II' to -modern systems. - -The program code that comprises 'The Ur-Quan Masters' was derived from code -written by Toys for Bob, Inc. for the 3DO version of 'Star Control II', with -their permission and encouragement. - -If you've got this file from the source tree, you can find everything -you need to get started in INSTALL (INSTALL.mingw for MinGW) and -doc/users/unixinstall. - -The home page of the project is located at http://sc2.sourceforge.net/ -You can find links to downloads, our bug database, and our forum there. - -Have fun! - - -Star Control II is a registered trademark of Accolade, Inc. -All other trademarks and tradenames belong to their respective owners. - diff --git a/project/jni/application/sc2/WhatsNew b/project/jni/application/sc2/WhatsNew deleted file mode 100644 index a91ff23c9..000000000 --- a/project/jni/application/sc2/WhatsNew +++ /dev/null @@ -1,370 +0,0 @@ -This file tries to organize and describe the changes between releases. -Changes are broadly classified into the following categories: - -- New Features: These are either elements of the original games that - were first implemented in this release, or actually new capabilities - that are visible to the user. - -- Bugfixes: The removal of visible Bad Things from the code. - -- Internal Changes: The removal of invisible Bad Things from the code, - or changes in the way the program itself is structured. These are - unlikely to be of interest to you unless you plan on coding - extensions. - - Version 0.6 - ------------- - -NEW FEATURES - -- Netplay! You can now engage in Super Melee over the Internet. -- Key configuration is now entirely in-game. -- UQM now compiles and runs on 64-bit systems. - -BUGFIXES - -- The Quit button (F10) now works properly when used during the - introduction sequence. -- Various small fixes to text and conversation logic. - -INTERNAL CHANGES - -- The setup menu now reads all its text from the content, easing - translation. -- The MOD player for PC-style music can now be linked against an - external version of libmikmod. -- Various code cleanups and memory optimizations. - - Version 0.5 - ------------- - -NEW FEATURES - -- The Starmap is searchable! Type / then the beginning of the - constellation name, and you can tab through all possible - completions. -- New 'hq' scaler, based on Maxim Stepin's "HQ2X" scaler. See - www.hiend3d.com/hq2x.html for more details. -- Scalers can use MMX/SSE/3DNow! instructions for significant speed - improvements. The "Processor pack" is necessary for compilation of - same on VC6. -- Imported DOS versions of many graphics; these have richer palettes - and so generally look better -- There's a proper credit roll at the end of the game now. -- Superior Planet handling: topographical maps scaled far more - precisely; optional 3DO-style throbbing slave shield; planets are - finally rotating spheres instead of spotlit cylinders or rectangles. - The old PC-style "Entering Planetary Orbit..." screen is back. -- Setup Menu far more complete and easy to use, and selections made in - the Setup Menu will actually persist when you restart the program -- Added support for the Tremor Ogg Vorbis decoder (avoids floating point - math) -- Home, End and BackSpace keys work as you'd expect in text input. -- Most of the game works with Unicode properly now, and so, with proper - font characters installed, will work with non-Latin alphabets. (On - Windows, Unicode input requires a very recent version of SDL.) -- Text may be input with the joystick again, as on the 3DO. The - available characters are stored in content/lbm/joyalpha.txt. -- The intro now plays only when a new game is started. -- Color depth is now determined entirely automatically. - -BUGFIXES - -- Only SELECT and CANCEL trigger the fade-to-black at the end of a - Super Melee, solving the issue of invisible "Really Quit?" menus for - Super Melee. The "quit during fades" problem in general is still - extant. -- Many dialog, and comm animation, and general graphical fixes -- Keypress status is not reset when entering battle mode, so (for - instance) Melnorme ships can continue to charge a shot across - battles. -- The Melnorme would occasionally strip off Plot Points as part of a - fuel deal. No longer. -- Bugs in the original code prevented certain ships from properly - spawning in "uncontrolled" space. The "wilds" are now a bit wilder, - as apparently originally intended. -- Venus's atmospheric density was incorrectly corrected in the 3DO - version. It's been correctly corrected now. -- Scheduled plot events work properly, even when the game suddenly - skips ahead in time. -- Fixed version checking in unix build scripts. SDL 1.2.10 is now - recognised as newer than 1.2.9. -- Spliced communications can be safely skipped past now. -- Fixed fast escape weirdness (bug #619) -- Threading system no longer assumes that there is no thread 0; this - permits compilation on AmigaOS. -- Relative paths and fallback paths work properly now. -- Scalers now use surface pitch instead of image width - this is - reported to solve many strange display problems in non-OpenGL mode - on Macs -- Ending sequences may now be safely paused. - -INTERNAL CHANGES - -- Added the rest of devel/ and users/ documentation into MSVC .dsp - files. -- Control scheme upgraded. Old versions of keys.cfg will no longer - work. -- PNG transparency info (tRNS chunk) is now set properly, based on - info in the .ani files. -- Paletted images should render much faster now, and collisions - between mods are less likely. -- New font engine: fonts are loaded and treated as alpha-channel-only - images, with font effects handled as backing images. -- Melee works properly with alpha-channel graphics new, even when - mipmapped. -- Lander report drawing handled more sensibly now -- Binary resource indexes have been replaced with textual ones. -- All spritework is done internally in 32BPP. -- Removed MikMod i/o hacks. -- The temp files for representing star and group data are now kept in - memory instead. -- Separate config_win.h file for build.sh builds on Windows -- Lowered some animation rates to reasonable levels, lowering CPU - usage. -- Changed comm subtitle caching scheme. Should kill the "blue comm - screen" problem forever. -- Refactored setup menu code to use generic widgets. -- Cleaner build output. Set '$MAKE_VERBOSE' to 1 for old output. -- Improved dependency tracking for unix build system. "./build.sh uqm - depend" is now only needed for checking for new source files. - - Version 0.4 - ------------- - -NEW FEATURES - -- Savegame slot defaults to the last one used during this play -- PC intro and ending sequence are now present -- 3DO intro and ending movies are supported for those who have these - movies from the 3DO CD of Star Control II -- Improved slave shield graphics -- Added a new -l option to produce logfiles -- Added a new 'triscan' scaler derived from scale2x -- Made the fact that self-destructing ships grant resources more obvious -- Added a "config dir" option for holding saves and melee information -- Cocoa hooks -- Setup menu now permits configuration of some options. They do not - yet persist past program quit, though. -- Added a "--version" option -- Melee images are now based on the (richer) DOS content -- 3-step melee zooming as per the PC version is now implemented -- It is now possible to complete the game without ever allying with the - Starbase (if one is insane; this is known on the forum as "Beating The - Game Differently" - but bugs and plot elements preventing this have been - fixed or evaded under this circumstance). - -BUGFIXES - -- Fixes to the Quit Confirmation dialog -- Collisions/encounters with "invisible" fleeing ships gone -- Other ships insystem remain in proper locations after planet landing -- Fixed some keyboard "focus" problems where flight controls were - being cleared at inappropriate times, or interfering with menus -- Graphics fixes -- Subtitle timings work in the absence of oggs -- Conversation summaries with Melnorme no longer crash -- --contentdir argument may now have spaces -- $HOME isn't required for Unix systems anymore -- Fuel estimates fixed (original bug) -- Fuel usage on planet landing now correcly reported on all versions -- MOD music will play on big-endian machines under high-quality now -- Space marines die in a self-destructing Scout -- ZFP speech is properly vertically aligned now -- Various odd behaviors when loading in HyperSpace now fixed -- Quitting from the Roster screen no longer crashes -- Many dialog fixes -- The "Blue Comm Screen" problem no longer occurs -- Combat Energy computation in Outfit Flagship screen corrected -- A game crash that manifested when pausing after 85 minutes has been - corrected -- Main menu version number drawn more consistently -- Transparency bugfixes - 3DO ending credits, planets in battle -- Content packs may also be named ".uqm" - these are really still - zip files, but you can't expand them by accident. -- One may now configure a joystick without crashing the game if the - joystick is not present -- Music volume normalized throughout the game - -INTERNAL CHANGES - -- Thread system completely reworked to provide more detailed thread - information, and to prevent resource leaks -- Sound code is now virtualized and separate from game logic -- Fine-grained control of menu sounds -- Input system fully unified - all parts of the game use the same - basic structure now -- Build scripts made more robust -- Window-drawing code was lifted out of confirm.c and made more general -- Lots of debugging functions -- Unicode support for game dialogs and fonts -- Lots of code cleanups -- Documentation of more internals - - - Version 0.3 - ------------- - -NEW FEATURES - -- PC-style shipyard graphics, complete with animated power lines -- Selling ships in the shipyards has slightly different controls - that make it harder to sell ships accidentally -- Main menu displays version number -- Added a '-g' option to control gamma correction -- Planet spin has been improved -- Trilinear (mipmap-based) scaling in melee -- PC-style conversation summaries have been implemented -- Ship location display in status bar matches original more closely -- Game flags (such as AWARE_OF_SAMATRA) that were ignored by half the - game (even in the original) now are more universally available -- Oscilloscope and Mini-Map have borders now -- Commander Hayes won't let you rescue him until he's explained his - predicament -- Confirmation dialogs are now menu-based -- Positional sound effects are available for OpenAL -- Delete key works on Super-Melee team editing -- Exit key from the Main Menu will quit the game -- Quit option available in GAME menu -- New Main Menu graphics: Setup (not yet implemented) and Quit are - options at the Main Menu now -- Cubic resampling in high quality audio mode -- PC-style alien outtakes when game is completed -- 2 more ship slots in melee, as the PC Star Control 2 had. -- All the standard melee teams from the Star Control 2 PC version. -- Support for 50 savegames, instead of just 10 -- 'CREW'/'BATT' instead of icons in melee when using PC menus - -BUGFIXES - -- Text entry doesn't freeze up lander reports anymore -- VUX warps in at proper range -- Distance-based ship effects (Syreen, Slylandro, Kohr-Ah) were screen - size dependent -- Line clipping fixed -- Various communication animation glitches solved -- Various melee crashes solved -- Various race conditions eliminated -- Scaling of graphics is handled by the rendering thread now, solving - issues where the background and object scales would drift out of - sync -- Subtitle text is clipped more carefully -- Objects can no longer be scaled to total invisibility -- Various dialogue fixes -- Crossfade glitches eliminated -- Pause and Exit keys function properly everywhere -- Visit Count overflow with Yehat and Chmmr patched -- Wav loader and color transforms are now endian safe -- Menu glitches when leaving the "GAME" menu are gone -- Druuge transactions no longer baselessly increase crew cost -- Lander speed has been retimed to match 3DO -- Audio resampling works now correctly (less cracklings) -- MixSDL buffer underrun handling fixed -- Some memory leaks have been eliminated -- Fixes and speed improvements on bilinear, biadapt, biadv scalers -- Various minor graphics glitch fixes -- Crew death on planet is now counted properly in all cases -- Mouse cursor is now hidden in fullscreen mode -- Guardian in Blazer mode being drained by DOGI will no longer - result in a non-blazer Guardian with Blazer effects. - -INTERNAL CHANGES - -- Legacy graphics code stripped down tremendously, a lot of "poor - man's object orientation" has fallen away too. Many uses of - function pointers with only one possible value replaced with simple - direct calls. -- Crossfades require you to explicitly cache the screen before drawing - the transition target -- User Input code has been completely rewritten -- File I/O code has been completely rewritten -- Subtitle drawing is now cached as its own sprite; communication - screens are much less graphics intensive now -- DRAWABLE_DESC uses separately allocated arrays for its frames - - - Version 0.2 - ------------- - -NEW FEATURES - -- Planet info "coarse scan" information available and properly rendered, - either in 3DO way (symbols) or PC (text) -- 3D spinning planet in orbit window is present, with antialiasing and - phong lighting and an animated approach -- Pixel-perfect collision detection; Spathi/Mycon are thus playable, and - the game is now beatable -- Build system enhanced and generalized to handle OpenBSD and FreeBSD cleanly. -- Oscilloscope display works in communication now -- Color-shading in planet scans -- Earth with its slave shield now functions properly -- Outfit Starship and Shipyard graphics re-extracted -- Save data and temp files are put in a separate directory now -- Star sizes and colors are properly differentiated. -- Planet surface is smoothed, blurred, and randomized slightly when it's - magnified -- SIS Status window fully implemented (including gradiated fonts from PC - version) -- Dialogue "slider" shows how far along the speech is; rewind/forward works -- 'ESC' alone lets you emergency-warp-escape -- Optional PC version menus -- Preliminary support for MacOS X (needs more work) - -BUGFIXES - -- Melee screens cleaned up, SuperMelee menus work. -- Subtitles now render for all alien races -- Major editing of subtitles to match more closely the speeches -- Speech and subtitles are now synchronized properly -- Autopilot indicator doesn't take over the top of the screen anymore. -- Entering star systems on autopilot doesn't crash the system. -- Planet scan is properly erased when cancelling/landing -- Initial display of planet surface on landing is at correct position -- Spheres of influence now move correctly on the starmap -- Melnorme correctly compute the required additional credits -- Team names switching when selecting the next ship to fight in melee fixed -- Commas left dots behind on planetary reports; this is fixed -- Screen resets properly after loading/saving -- Dialog choices wrap properly -- Precursor ship crew count now placed correctly in melee -- 'Cued' color transforms in conversations occur at the right time now -- SIS correctly predicts its own fuel usage now -- Melnorme no longer give away fuel -- Flagship modules are properly aligned -- The PC soundtrack now loops correctly -- Lander upgrades were drawn incorrectly -- Autopilot now works in QuasiSpace without fuel -- Captain portraits in melee are updated properly now -- If you have over 1000 units of a resource, those numbers are properly - cleared - -INTERNAL CHANGES - -- SDL_mixer has been abandoned in favor of either OpenAL or the new - "MixSDL" library built on the basic SDL_audio routines -- Color transforms in communications are merged into the core animation - thread now, improving speed and stability -- Much more flexible handling of commandline options -- All allocated memory is allocated through 'safe' routines that abort if - the allocation fails. -- Thread library now includes condition variables -- Threads can tell the rendering thread to sleep until everything they've - requested is done -- The rendering thread has been recoded to use no heap space and to have a - far smaller memory footprint. -- Added a special #define, DCQ_OF_DOOM, which simulates severe overload - stresses. -- SAI and related scalers removed due to GPL incompatibilities; similar - algorithms reimplemented under GPL. -- Files for the intro and ending sequence have been successfully extracted -- Rendering thread routines are somewhat more modular than before -- Created a new set of graphics primitives that's much easier to use -- Only parts of the screen that actually changed are updated -- Input code rewritten entirely -- Various functions have their names changed to avoid conflicts with - core library routines on OS X - - - Version 0.1 - ------------- -Initial release. diff --git a/project/jni/application/sc2/android.diff b/project/jni/application/sc2/android.diff deleted file mode 100644 index 487b065a8..000000000 --- a/project/jni/application/sc2/android.diff +++ /dev/null @@ -1,1519 +0,0 @@ -Index: libs/md5/md5.c -=================================================================== ---- libs/md5/md5.c (revision 3779) -+++ libs/md5/md5.c (working copy) -@@ -21,7 +21,7 @@ - - /* Written by Ulrich Drepper , 1995. */ - --#include -+#include "config.h" - - #include "md5.h" - -Index: libs/resource/filecntl.c -=================================================================== ---- libs/resource/filecntl.c (revision 3779) -+++ libs/resource/filecntl.c (working copy) -@@ -26,6 +26,7 @@ - #include "port.h" - #include "resintrn.h" - #include "libs/uio.h" -+#include "libs/log.h" - - uio_Stream * - res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) -@@ -34,7 +35,10 @@ - struct stat sb; - - if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) -+ { -+ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); - return ((uio_Stream *) ~0); -+ } - - fp = uio_fopen (dir, filename, mode); - -Index: libs/sound/decoders/oggaud.c -=================================================================== ---- libs/sound/decoders/oggaud.c (revision 3779) -+++ libs/sound/decoders/oggaud.c (working copy) -@@ -270,7 +270,7 @@ - // this is the closest to a frame there is in ogg vorbis stream - // doesn't seem to be a func to retrive it - #ifdef OVCODEC_TREMOR -- return ova->vf.os->pageno; -+ return ova->vf.os.pageno; - #else - return ova->vf.os.pageno; - #endif /* OVCODEC_TREMOR */ -Index: libs/network/netmanager/netmanager_win.c -=================================================================== ---- libs/network/netmanager/netmanager_win.c (revision 3779) -+++ libs/network/netmanager/netmanager_win.c (working copy) -@@ -16,6 +16,8 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#ifdef WIN32 -+ - #define PORT_WANT_ERRNO - #include "port.h" - #include "../netport.h" -@@ -461,4 +463,4 @@ - return 0; - } - -- -+#endif -Index: libs/network/network_win.c -=================================================================== ---- libs/network/network_win.c (revision 3779) -+++ libs/network/network_win.c (working copy) -@@ -16,6 +16,8 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#ifdef WIN32 -+ - #include "netport.h" - - #include "network.h" -@@ -72,4 +74,4 @@ - } - } - -- -+#endif -Index: libs/network/socket/socket_win.c -=================================================================== ---- libs/network/socket/socket_win.c (revision 3779) -+++ libs/network/socket/socket_win.c (working copy) -@@ -18,6 +18,8 @@ - - // Socket functions for Winsock sockets. - -+#ifdef WIN32 -+ - #define PORT_WANT_ERRNO - #include "port.h" - #include "../netport.h" -@@ -311,4 +313,4 @@ - return 0; - } - -- -+#endif -Index: libs/graphics/sdl/pure.c -=================================================================== ---- libs/graphics/sdl/pure.c (revision 3779) -+++ libs/graphics/sdl/pure.c (working copy) -@@ -20,6 +20,10 @@ - #include "scalers.h" - #include "libs/log.h" - -+#ifdef ANDROID -+#include -+#endif -+ - static SDL_Surface *fade_color_surface = NULL; - static SDL_Surface *fade_temp = NULL; - static SDL_Surface *scaled_display = NULL; -@@ -104,6 +108,7 @@ - { - int i, videomode_flags; - SDL_PixelFormat conv_fmt; -+ int BPP = 32; - - GraphicsDriver = driver; - -@@ -128,6 +133,20 @@ - "under pure SDL, using 640x480", width, height); - } - -+#ifdef ANDROID -+ videomode_flags = SDL_SWSURFACE; -+ ScreenWidthActual = 320; -+ ScreenHeightActual = 240; -+ graphics_backend = &pure_unscaled_backend; -+ BPP = 16; -+ /* Make the on-screen buttons slightly overlap, so we can hit them with one finger */ -+ SDL_Rect b0; -+ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b0); -+ b0.x -= b0.w * 0.2; -+ b0.w += b0.w * 0.2; -+ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b0); -+#endif -+ - videomode_flags |= SDL_ANYFORMAT; - if (flags & TFB_GFXFLAGS_FULLSCREEN) - videomode_flags |= SDL_FULLSCREEN; -@@ -135,7 +154,7 @@ - /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set - SDL_ANYFORMAT */ - SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, -- 32, videomode_flags); -+ BPP, videomode_flags); - - if (SDL_Video == NULL) - { -Index: libs/cdp/cdpapi.c -=================================================================== ---- libs/cdp/cdpapi.c (revision 3779) -+++ libs/cdp/cdpapi.c (working copy) -@@ -20,6 +20,8 @@ - * the API is used by both the engine and modules - */ - -+#ifndef ANDROID -+ - #include "cdp.h" - #include "port.h" - #include "cdpint.h" -@@ -862,3 +864,5 @@ - } - return ret; - } -+ -+#endif -Index: libs/cdp/cdp.c -=================================================================== ---- libs/cdp/cdp.c (revision 3779) -+++ libs/cdp/cdp.c (working copy) -@@ -19,6 +19,8 @@ - * CDP library definitions - */ - -+#ifndef ANDROID -+ - #include - #include - #include "cdp.h" -@@ -435,3 +437,5 @@ - cdp_FreeModule (cdp); - } - } -+ -+#endif -Index: libs/cdp/windl.c -=================================================================== ---- libs/cdp/windl.c (revision 3779) -+++ libs/cdp/windl.c (working copy) -@@ -19,6 +19,8 @@ - * CDP dlopen() & Co. WIN32 implementation - */ - -+#ifdef WIN32 -+ - #include "windl.h" - #include "port.h" - #define WIN32_LEAN_AND_MEAN -@@ -74,3 +76,5 @@ - else - return NULL; - } -+ -+#endif -Index: libs/input/sdl/input.c -=================================================================== ---- libs/input/sdl/input.c (revision 3779) -+++ libs/input/sdl/input.c (working copy) -@@ -186,6 +186,13 @@ - directory. */ - LoadResourceIndex (contentDir, "uqm.key", "keys."); - } -+ -+#ifdef ANDROID // TODO: hacky -+ res_PutString("keys.1.up.2", "joystick 0 axis 1 negative"); -+ res_PutString("keys.1.down.2", "joystick 0 axis 1 positive"); -+ res_PutString("keys.1.left.2", "joystick 0 axis 0 negative"); -+ res_PutString("keys.1.right.2", "joystick 0 axis 0 positive"); -+#endif - - register_flight_controls (); - -Index: libs/input/sdl/vcontrol.c -=================================================================== ---- libs/input/sdl/vcontrol.c (revision 3779) -+++ libs/input/sdl/vcontrol.c (working copy) -@@ -46,6 +46,7 @@ - typedef struct vcontrol_joystick_axis { - keybinding *neg, *pos; - int polarity; -+ int value; - } axis_type; - - typedef struct vcontrol_joystick_hat { -@@ -66,7 +67,7 @@ - - #endif /* HAVE_JOYSTICK */ - --static unsigned int joycount; -+static unsigned int joycount = 0; - static unsigned int num_sdl_keys = 0; - static keybinding **bindings = NULL; - -@@ -818,6 +819,7 @@ - int t; - if (!joysticks[port].stick) - return; -+ joysticks[port].axes[axis].value = value; - t = joysticks[port].threshold; - if (value > t) - { -@@ -894,6 +896,25 @@ - #endif /* HAVE_JOYSTICK */ - } - -+int -+VControl_GetJoyAxis(int port, int axis) -+{ -+#ifdef HAVE_JOYSTICK -+ if( joycount <= port ) -+ return 0; -+ if (!joysticks[port].stick || joysticks[port].numaxes <= axis ) -+ return 0; -+ return joysticks[port].axes[axis].value; -+#else -+ return 0; -+#endif /* HAVE_JOYSTICK */ -+}; -+ -+int VControl_GetJoysticksAmount() -+{ -+ return joycount; -+}; -+ - void - VControl_ResetInput (void) - { -Index: libs/input/sdl/vcontrol.h -=================================================================== ---- libs/input/sdl/vcontrol.h (revision 3779) -+++ libs/input/sdl/vcontrol.h (working copy) -@@ -76,6 +76,9 @@ - void VControl_ProcessJoyAxis (int port, int axis, int value); - void VControl_ProcessJoyHat (int port, int which, Uint8 value); - -+int VControl_GetJoyAxis(int port, int axis); -+int VControl_GetJoysticksAmount(); -+ - /* Force the input into the blank state. For preventing "sticky" keys. */ - void VControl_ResetInput (void); - -Index: libs/log/msgbox_stub.c -=================================================================== ---- libs/log/msgbox_stub.c (revision 3779) -+++ libs/log/msgbox_stub.c (working copy) -@@ -16,6 +16,9 @@ - - #include "msgbox.h" - #include "loginternal.h" -+#ifdef ANDROID -+#include -+#endif - - void - log_displayBox (const /*UTF-8*/char *title, int isError, -@@ -26,6 +29,9 @@ - // So just inform the user of our predicament - fprintf (streamOut, "Do not know how to display %s box\n", - isError ? "an error" : "a"); -+#ifdef ANDROID -+ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); -+#endif - - // Suppress the compiler warnings in any case. - (void)title; -Index: libs/log/uqmlog.c -=================================================================== ---- libs/log/uqmlog.c (revision 3779) -+++ libs/log/uqmlog.c (working copy) -@@ -23,6 +23,9 @@ - #include - #include - #include -+#ifdef ANDROID -+#include -+#endif - #include "libs/threadlib.h" - - #ifndef MAX_LOG_ENTRY_SIZE -@@ -191,6 +194,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -@@ -227,6 +233,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -Index: libs/log/msgbox_win.c -=================================================================== ---- libs/log/msgbox_win.c (revision 3779) -+++ libs/log/msgbox_win.c (working copy) -@@ -14,6 +14,7 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#ifndef ANDROID - #include "msgbox.h" - #define WIN32_LEAN_AND_MEAN - #include -@@ -64,4 +65,4 @@ - free (swTitle); - free (swMsg); - } -- -+#endif -Index: libs/uio/match.c -=================================================================== ---- libs/uio/match.c (revision 3779) -+++ libs/uio/match.c (working copy) -@@ -506,7 +506,7 @@ - return match_ENOTINIT; - } - if (context->errorString) { -- uio_free(context->errorString); -+ uio_free(context->errorString); //TODO: why does it crash here on Android? - context->errorString = NULL; - } - retval = regexec(&context->native, string, 0, NULL, 0); -Index: libs/uio/match.h -=================================================================== ---- libs/uio/match.h (revision 3779) -+++ libs/uio/match.h (working copy) -@@ -79,7 +79,7 @@ - - #include - #ifdef HAVE_REGEX --# include -+#include - #endif - - #include "uioport.h" -Index: libs/uio/io.c -=================================================================== ---- libs/uio/io.c (revision 3779) -+++ libs/uio/io.c (working copy) -@@ -35,6 +35,7 @@ - #include "mem.h" - #include "uioutils.h" - #include "uioport.h" -+#include "../log.h" - #ifdef uio_MEM_DEBUG - # include "memdebug.h" - #endif -@@ -193,6 +194,7 @@ - errno = EINVAL; - return NULL; - } -+ log_add (log_Info, "uio_open %s", sourcePath); - handle = uio_open(sourceDir, sourcePath, - ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? - O_RDONLY : O_RDWR) -@@ -201,12 +203,14 @@ - #endif - , 0); - if (handle == NULL) { -+ log_add (log_Info, "uio_open failed for %s", sourcePath); - // errno is set - return NULL; - } - } - - handler = uio_getFileSystemHandler(fsType); -+ log_add (log_Info, "uio_getFileSystemHandler %p", handler); - if (handler == NULL) { - if (handle) - uio_close(handle); -@@ -800,6 +804,7 @@ - &readMountInfo, &readPDirHandle, NULL, - &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { - // errno is set -+ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); - return NULL; - } - -@@ -826,6 +831,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = EEXIST; -+ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); - return NULL; - } - if ((flags & O_TRUNC) == O_TRUNC) { -@@ -842,6 +848,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = savedErrno; -+ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); - return NULL; - } - } -@@ -863,6 +870,7 @@ - handle = (pDirHandle->pRoot->handler->open)(pDirHandle, name, flags, mode); - // Also adds a new entry to the physical dir if appropriate. - if (handle == NULL) { -+ log_add (log_Info, "uio_open: open file failed '%s'", name); - int savedErrno = errno; - uio_free(name); - uio_PDirHandle_unref(pDirHandle); -Index: libs/uio/zip/zip.c -=================================================================== ---- libs/uio/zip/zip.c (revision 3779) -+++ libs/uio/zip/zip.c (working copy) -@@ -1366,6 +1366,10 @@ - gPFileData->gid = (uid_t) makeUInt16(buf[12], buf[13]); - break; - } -+ case 0x7875: // 'Unix string UID/GID' -+ // Just skip it -+ break; -+ - default: - #ifdef DEBUG - fprintf(stderr, "Debug: Extra field 0x%04x unsupported, " -Index: config_unix.h -=================================================================== ---- config_unix.h (revision 0) -+++ config_unix.h (working copy) -@@ -0,0 +1,63 @@ -+/* This file contains some compile-time configuration options for *nix -+ * systems. -+ * config_unix.h is generated from config_unix.h.in by build.sh -+ * When building on MS Windows using build.sh (MinGW, Cygwin), -+ * config_win.h is generated from src/config_win.h.in. -+ * When using MSVC on MS Windows, you'll have to edit src/config_vc6.h -+ * manually if you want anything else than the defaults. -+ */ -+ -+#ifndef _CONFIG_UNIX_H -+#define _CONFIG_UNIX_H -+ -+/* Directory where the UQM game data is located */ -+#define CONTENTDIR "" -+ -+/* Directory where game data will be stored */ -+#define USERDIR "config/" -+ -+/* Directory where config files will be stored */ -+#define CONFIGDIR USERDIR -+ -+/* Directory where supermelee teams will be stored */ -+#define MELEEDIR "teams/" -+ -+/* Directory where save games will be stored */ -+#define SAVEDIR "save/" -+ -+/* Defined if words are stored with the most significant byte first */ -+#undef WORDS_BIGENDIAN -+ -+/* Defined if your system has readdir_r of its own */ -+#define HAVE_READDIR_R -+ -+/* Defined if your system has setenv of its own */ -+#define HAVE_SETENV -+ -+/* Defined if your system has strupr of its own */ -+#undef HAVE_STRUPR -+ -+/* Defined if your system has strcasecmp of its own */ -+#define HAVE_STRCASECMP_UQM -+ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. -+ -+/* Defined if your system has stricmp of its own */ -+#undef HAVE_STRICMP -+ -+/* Defined if your system has getopt_long */ -+#define HAVE_GETOPT_LONG -+ -+/* Defined if your system has iswgraph of its own*/ -+#define HAVE_ISWGRAPH -+ -+/* Defined if your system has wchar_t of its own */ -+#define HAVE_WCHAR_T -+ -+/* Defined if your system has wint_t of its own */ -+#define HAVE_WINT_T -+ -+/* Defined if your system has _Bool of its own */ -+#define HAVE__BOOL -+ -+#endif /* _CONFIG_UNIX_H */ -+ -Index: uqm/confirm.c -=================================================================== ---- uqm/confirm.c (revision 3779) -+++ uqm/confirm.c (working copy) -@@ -36,22 +36,29 @@ - #define CONFIRM_WIN_HEIGHT 22 - - static void --DrawConfirmationWindow (BOOLEAN answer) -+DrawConfirmationWindow (int answer) - { - Color oldfg = SetContextForeGroundColor (MENU_TEXT_COLOR); - FONT oldfont = SetContextFont (StarConFont); - FRAME oldFontEffect = SetContextFontEffect (NULL); - RECT r; - TEXT t; -+ int textOffset; - - BatchGraphics (); - r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1; - r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1; - r.extent.width = CONFIRM_WIN_WIDTH; - r.extent.height = CONFIRM_WIN_HEIGHT; -+ textOffset = r.extent.width >> 1; -+ if (GLOBAL (CurrentActivity) & IN_BATTLE) -+ { -+ r.corner.x -= CONFIRM_WIN_WIDTH; -+ r.extent.width += CONFIRM_WIN_WIDTH * 2; -+ textOffset = r.extent.width / 3; -+ } - DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR, - SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR); -- - t.baseline.x = r.corner.x + (r.extent.width >> 1); - t.baseline.y = r.corner.y + 8; - t.pStr = GAME_STRING (QUITMENU_STRING_BASE); // "Really Quit?" -@@ -59,14 +66,21 @@ - t.CharCount = (COUNT)~0; - font_DrawText (&t); - t.baseline.y += 10; -- t.baseline.x = r.corner.x + (r.extent.width >> 2); -+ t.baseline.x = r.corner.x + (textOffset >> 1); - t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 1); // "Yes" -- SetContextForeGroundColor (answer ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); -+ SetContextForeGroundColor (answer == 1 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); - font_DrawText (&t); -- t.baseline.x += (r.extent.width >> 1); -+ t.baseline.x += textOffset; - t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" -- SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); -+ SetContextForeGroundColor (answer == 0 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); - font_DrawText (&t); -+ if (GLOBAL (CurrentActivity) & IN_BATTLE) -+ { -+ t.baseline.x += textOffset; -+ t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt -+ SetContextForeGroundColor (answer == 2 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); -+ font_DrawText (&t); -+ } - - UnbatchGraphics (); - -@@ -75,6 +89,8 @@ - SetContextForeGroundColor (oldfg); - } - -+BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; -+ - BOOLEAN - DoConfirmExit (void) - { -@@ -91,7 +107,11 @@ - RECT ctxRect; - CONTEXT oldContext; - RECT oldRect; -- BOOLEAN response = FALSE, done; -+ int response = 0; -+ BOOLEAN done; -+ int responseMax = 1; -+ if (GLOBAL (CurrentActivity) & IN_BATTLE) -+ responseMax = 2; - - oldContext = SetContext (ScreenContext); - GetContextClipRect (&oldRect); -@@ -119,7 +139,7 @@ - if (GLOBAL (CurrentActivity) & CHECK_ABORT) - { // something else triggered an exit - done = TRUE; -- response = TRUE; -+ response = 1; - } - else if (PulsedInputState.menu[KEY_MENU_SELECT]) - { -@@ -129,11 +149,16 @@ - else if (PulsedInputState.menu[KEY_MENU_CANCEL]) - { - done = TRUE; -- response = FALSE; -+ response = 0; - } - else if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT]) - { -- response = !response; -+ -+ response += PulsedInputState.menu[KEY_MENU_LEFT] ? 1 : -1; -+ if(response < 0) -+ response = responseMax; -+ if( response > responseMax ) -+ response = 0; - DrawConfirmationWindow (response); - PlayMenuSound (MENU_SOUND_MOVE); - } -@@ -144,15 +169,19 @@ - DrawStamp (&s); - DestroyDrawable (ReleaseDrawable (s.frame)); - ClearSystemRect (); -- if (response || (GLOBAL (CurrentActivity) & CHECK_ABORT)) -+ if (response == 1 || (GLOBAL (CurrentActivity) & CHECK_ABORT)) - { - result = TRUE; - GLOBAL (CurrentActivity) |= CHECK_ABORT; -- } -+ } - else - { - result = FALSE; - } -+ if( response == 2 ) -+ { -+ EmergencyEscapeWarpUnitActivatedFromMenu = TRUE; -+ } - ExitRequested = FALSE; - GamePaused = FALSE; - FlushInput (); -Index: uqm/battle.c -=================================================================== ---- uqm/battle.c (revision 3779) -+++ uqm/battle.c (working copy) -@@ -16,6 +16,10 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#ifdef ANDROID -+#include -+#endif -+ - #include "battle.h" - - #include "battlecontrols.h" -@@ -44,6 +48,8 @@ - #include "libs/graphics/gfx_common.h" - #include "libs/log.h" - #include "libs/mathlib.h" -+#include "globdata.h" -+#include "libs/input/sdl/vcontrol.h" - - - BYTE battle_counter[NUM_SIDES]; -@@ -138,7 +144,8 @@ - frameInputHuman (HumanInputContext *context, STARSHIP *StarShipPtr) - { - (void) StarShipPtr; -- return CurrentInputToBattleInput (context->playerNr); -+ -+ return CurrentInputToBattleInput (context->playerNr, StarShipPtr ? StarShipPtr->ShipFacing : -1); - } - - static void -@@ -208,8 +215,11 @@ - StarShipPtr->ship_input_state |= SPECIAL; - - if (CanRunAway && cur_player == 0 && -- (InputState & BATTLE_ESCAPE)) -+ ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu)) -+ { -+ EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; - DoRunAway (StarShipPtr); -+ } - } - } - -Index: uqm/intel.c -=================================================================== ---- uqm/intel.c (revision 3779) -+++ uqm/intel.c (working copy) -@@ -45,10 +45,10 @@ - // Allow a player to warp-escape in cyborg mode - if (StarShipPtr->playerNr == RPG_PLAYER_NUM) - InputState |= CurrentInputToBattleInput ( -- context->playerNr) & BATTLE_ESCAPE; -+ context->playerNr, -1) & BATTLE_ESCAPE; - } - else -- InputState = CurrentInputToBattleInput (context->playerNr); -+ InputState = CurrentInputToBattleInput (context->playerNr, -1); - } - else if (!(PlayerControl[context->playerNr] & PSYTRON_CONTROL)) - InputState = 0; -Index: uqm/controls.h -=================================================================== ---- uqm/controls.h (revision 3779) -+++ uqm/controls.h (working copy) -@@ -90,13 +90,14 @@ - #define BATTLE_ESCAPE ((BATTLE_INPUT_STATE)(1 << 5)) - #define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6)) - --BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player); -+BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player, int direction /* = -1 for no directional input */); - BATTLE_INPUT_STATE PulsedInputToBattleInput (COUNT player); - - extern CONTROLLER_INPUT_STATE CurrentInputState; - extern CONTROLLER_INPUT_STATE PulsedInputState; - extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; - extern CONTROL_TEMPLATE PlayerControls[]; -+extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu; - - void UpdateInputState (void); - extern void FlushInput (void); -@@ -116,6 +117,9 @@ - BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput); - BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput); - -+/* TODO: only joystick #0 and player #0 supported currently */ -+extern BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction); -+ - void DoPopupWindow(const char *msg); - - typedef void (InputFrameCallback) (void); -Index: uqm/planets/solarsys.c -=================================================================== ---- uqm/planets/solarsys.c (revision 3779) -+++ uqm/planets/solarsys.c (working copy) -@@ -837,18 +837,19 @@ - static void - ProcessShipControls (void) - { -- COUNT index; -+ COUNT index = GetFrameIndex (GLOBAL (ShipStamp.frame));; - SIZE delta_x, delta_y; -+ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index); - -- if (CurrentInputState.key[PlayerControls[0]][KEY_UP]) -+ if (InputState & BATTLE_THRUST) - delta_y = -1; - else - delta_y = 0; - - delta_x = 0; -- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) -+ if (InputState & BATTLE_LEFT) - delta_x -= 1; -- if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) -+ if (InputState & BATTLE_RIGHT) - delta_x += 1; - - if (delta_x || delta_y < 0) -@@ -861,7 +862,6 @@ - else - delta_y = 0; - -- index = GetFrameIndex (GLOBAL (ShipStamp.frame)); - if (pSolarSysState->turn_counter) - --pSolarSysState->turn_counter; - else if (delta_x) -Index: uqm/planets/lander.c -=================================================================== ---- uqm/planets/lander.c (revision 3779) -+++ uqm/planets/lander.c (working copy) -@@ -1591,15 +1591,15 @@ - if (crew_left) - { - SIZE index = GetFrameIndex (LanderFrame[0]); -+ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index); - if (turn_wait) - --turn_wait; -- else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] || -- CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) -+ else if ((InputState & BATTLE_LEFT) || (InputState & BATTLE_RIGHT)) - { - COUNT landerSpeedNumer; - COUNT angle; - -- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) -+ if (InputState & BATTLE_LEFT) - --index; - else - ++index; -@@ -1623,7 +1623,7 @@ - turn_wait = SHUTTLE_TURN_WAIT; - } - -- if (!CurrentInputState.key[PlayerControls[0]][KEY_UP]) -+ if (!(InputState & BATTLE_THRUST)) - { - dx = 0; - dy = 0; -Index: uqm/setupmenu.c -=================================================================== ---- uqm/setupmenu.c (revision 3779) -+++ uqm/setupmenu.c (working copy) -@@ -75,7 +75,7 @@ - #endif - - #define MENU_COUNT 8 --#define CHOICE_COUNT 24 -+#define CHOICE_COUNT 25 - #define SLIDER_COUNT 4 - #define BUTTON_COUNT 10 - #define LABEL_COUNT 4 -@@ -98,7 +98,7 @@ - static int choice_widths[CHOICE_COUNT] = { - 3, 2, 3, 3, 2, 2, 2, 2, 2, 2, - 2, 2, 3, 2, 2, 3, 3, 2, 3, 3, -- 3, 2, 2, 2 }; -+ 3, 2, 2, 2, 2 }; - - static HANDLER button_handlers[BUTTON_COUNT] = { - quit_main_menu, quit_sub_menu, do_graphics, do_engine, -@@ -157,6 +157,7 @@ - (WIDGET *)(&choices[12]), - (WIDGET *)(&choices[15]), - (WIDGET *)(&choices[16]), -+ (WIDGET *)(&choices[24]), - (WIDGET *)(&buttons[1]), - NULL }; - -@@ -416,6 +417,7 @@ - choices[21].selected = opts.musicremix; - choices[22].selected = opts.speech; - choices[23].selected = opts.keepaspect; -+ choices[24].selected = opts.directionaljoystick; - - sliders[0].value = opts.musicvol; - sliders[1].value = opts.sfxvol; -@@ -450,6 +452,7 @@ - opts.musicremix = choices[21].selected; - opts.speech = choices[22].selected; - opts.keepaspect = choices[23].selected; -+ opts.directionaljoystick = choices[24].selected; - - opts.musicvol = sliders[0].value; - opts.sfxvol = sliders[1].value; -@@ -1277,6 +1280,7 @@ - opts->musicremix = optRemixMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED; - opts->speech = optSpeech ? OPTVAL_ENABLED : OPTVAL_DISABLED; - opts->keepaspect = optKeepAspectRatio ? OPTVAL_ENABLED : OPTVAL_DISABLED; -+ opts->directionaljoystick = optDirectionalJoystick ? OPTVAL_ENABLED : OPTVAL_DISABLED; - switch (snddriver) { - case audio_DRIVER_OPENAL: - opts->adriver = OPTVAL_OPENAL; -@@ -1518,6 +1522,7 @@ - optWhichIntro = (opts->intro == OPTVAL_3DO) ? OPT_3DO : OPT_PC; - optStereoSFX = (opts->stereo == OPTVAL_ENABLED); - optKeepAspectRatio = (opts->keepaspect == OPTVAL_ENABLED); -+ optDirectionalJoystick = (opts->directionaljoystick == OPTVAL_ENABLED) ? TRUE : FALSE; - PlayerControls[0] = opts->player1; - PlayerControls[1] = opts->player2; - -@@ -1532,6 +1537,7 @@ - res_PutBoolean ("config.speech", opts->speech == OPTVAL_ENABLED); - res_PutBoolean ("config.3domovies", opts->intro == OPTVAL_3DO); - res_PutBoolean ("config.showfps", opts->fps == OPTVAL_ENABLED); -+ res_PutBoolean ("config.directionaljoystick", opts->directionaljoystick == OPTVAL_ENABLED); - res_PutBoolean ("config.smoothmelee", opts->meleezoom == OPTVAL_3DO); - res_PutBoolean ("config.positionalsfx", opts->stereo == OPTVAL_ENABLED); - res_PutBoolean ("config.pulseshield", opts->shield == OPTVAL_3DO); -Index: uqm/setupmenu.h -=================================================================== ---- uqm/setupmenu.h (revision 3779) -+++ uqm/setupmenu.h (working copy) -@@ -81,6 +81,7 @@ - OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo; - OPT_ENABLABLE music3do, musicremix, speech; - OPT_ENABLABLE keepaspect; -+ OPT_ENABLABLE directionaljoystick; - OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; - CONTROL_TEMPLATE player1, player2; - int speechvol, musicvol, sfxvol; -Index: uqm/gameinp.c -=================================================================== ---- uqm/gameinp.c (revision 3779) -+++ uqm/gameinp.c (working copy) -@@ -16,6 +16,7 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#include - #include "controls.h" - #include "battlecontrols.h" - #include "init.h" -@@ -33,11 +34,14 @@ - #include "libs/timelib.h" - #include "libs/threadlib.h" - -- -+#ifdef ANDROID -+#define ACCELERATION_INCREMENT (ONE_SECOND) -+#define MENU_REPEAT_DELAY (ONE_SECOND) -+#else - #define ACCELERATION_INCREMENT (ONE_SECOND / 12) - #define MENU_REPEAT_DELAY (ONE_SECOND / 2) -+#endif - -- - typedef struct - { - BOOLEAN (*InputFunc) (void *pInputState); -@@ -416,16 +420,10 @@ - } - - static BATTLE_INPUT_STATE --ControlInputToBattleInput (const int *keyState) -+ControlInputToBattleInput (const int *keyState, int direction) - { - BATTLE_INPUT_STATE InputState = 0; - -- if (keyState[KEY_UP]) -- InputState |= BATTLE_THRUST; -- if (keyState[KEY_LEFT]) -- InputState |= BATTLE_LEFT; -- if (keyState[KEY_RIGHT]) -- InputState |= BATTLE_RIGHT; - if (keyState[KEY_WEAPON]) - InputState |= BATTLE_WEAPON; - if (keyState[KEY_SPECIAL]) -@@ -435,21 +433,35 @@ - if (keyState[KEY_DOWN]) - InputState |= BATTLE_DOWN; - -+ if(direction < 0) -+ { -+ if (keyState[KEY_UP]) -+ InputState |= BATTLE_THRUST; -+ if (keyState[KEY_LEFT]) -+ InputState |= BATTLE_LEFT; -+ if (keyState[KEY_RIGHT]) -+ InputState |= BATTLE_RIGHT; -+ } -+ else -+ { -+ InputState |= GetDirectionalJoystickInput(direction); -+ } -+ - return InputState; - } - - BATTLE_INPUT_STATE --CurrentInputToBattleInput (COUNT player) -+CurrentInputToBattleInput (COUNT player, int direction) - { - return ControlInputToBattleInput( -- CurrentInputState.key[PlayerControls[player]]); -+ CurrentInputState.key[PlayerControls[player]], direction); - } - - BATTLE_INPUT_STATE - PulsedInputToBattleInput (COUNT player) - { - return ControlInputToBattleInput( -- PulsedInputState.key[PlayerControls[player]]); -+ PulsedInputState.key[PlayerControls[player]], -1); - } - - BOOLEAN -@@ -494,3 +506,76 @@ - return result; - } - -+// Fast arctan2, returns angle in radians as integer, with fractional part in lower 16 bits -+// Stolen from http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization , precision is said to be 0.07 rads -+ -+#ifndef M_PI -+#define M_PI 3.14159265358979323846 -+#endif -+enum { atan2i_coeff_1 = ((int)(M_PI*65536.0/4)), atan2i_coeff_2 = (3*atan2i_coeff_1), atan2i_PI = (int)(M_PI * 65536.0), SHIP_DIRECTIONS = 16 }; -+ -+static inline int atan2i(int y, int x) -+{ -+ int angle; -+ int abs_y = abs(y); -+ if( abs_y == 0 ) -+ abs_y = 1; -+ if (x>=0) -+ { -+ angle = atan2i_coeff_1 - atan2i_coeff_1 * (x - abs_y) / (x + abs_y); -+ } -+ else -+ { -+ angle = atan2i_coeff_2 - atan2i_coeff_1 * (x + abs_y) / (abs_y - x); -+ } -+ if (y < 0) -+ return(-angle); // negate if in quad III or IV -+ else -+ return(angle); -+} -+ -+ -+BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction) -+{ -+ BATTLE_INPUT_STATE InputState = 0; -+ if(VControl_GetJoysticksAmount() <= 0 || !optDirectionalJoystick) -+ { -+ if(CurrentInputState.key[PlayerControls[0]][KEY_UP]) -+ InputState |= BATTLE_THRUST; -+ if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) -+ InputState |= BATTLE_LEFT; -+ if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) -+ InputState |= BATTLE_RIGHT; -+ } -+ else -+ { -+ /* TODO: only joystick #0 supported currently */ -+ int axisX = VControl_GetJoyAxis(0, 0), axisY = VControl_GetJoyAxis(0, 1); -+ if( axisX != 0 || axisY != 0 ) -+ { -+ int angle = atan2i(axisY, axisX), diff; -+ // Convert it to 16 directions used by Melee -+ angle += atan2i_PI / SHIP_DIRECTIONS; -+ if( angle < 0 ) -+ angle += atan2i_PI * 2; -+ if( angle > atan2i_PI * 2 ) -+ angle -= atan2i_PI * 2; -+ angle = angle * SHIP_DIRECTIONS / atan2i_PI / 2; -+ -+ diff = angle - direction - SHIP_DIRECTIONS / 4; -+ while( diff >= SHIP_DIRECTIONS ) -+ diff -= SHIP_DIRECTIONS; -+ while( diff < 0 ) -+ diff += SHIP_DIRECTIONS; -+ -+ if( diff < SHIP_DIRECTIONS / 2 ) -+ InputState |= BATTLE_LEFT; -+ if( diff > SHIP_DIRECTIONS / 2 ) -+ InputState |= BATTLE_RIGHT; -+ -+ if( ((axisX*axisX)>>1) + ((axisY*axisY)>>1) > (16384*16384)>>1 ) // Force of joystick tilt, equation is clumsy because (axisX*axisX + axisY*axisY) may overflow int32 -+ InputState |= BATTLE_THRUST; -+ } -+ } -+ return InputState; -+} -Index: uqm/comm/urquan/urquanc.c -=================================================================== ---- uqm/comm/urquan/urquanc.c (revision 3779) -+++ uqm/comm/urquan/urquanc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../urquan/strings.h" - - static LOCDATA urquan_desc = - { -Index: uqm/comm/supox/supoxc.c -=================================================================== ---- uqm/comm/supox/supoxc.c (revision 3779) -+++ uqm/comm/supox/supoxc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../supox/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/vux/vuxc.c -=================================================================== ---- uqm/comm/vux/vuxc.c (revision 3779) -+++ uqm/comm/vux/vuxc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../vux/strings.h" - - static LOCDATA vux_desc = - { -Index: uqm/comm/shofixt/shofixt.c -=================================================================== ---- uqm/comm/shofixt/shofixt.c (revision 3779) -+++ uqm/comm/shofixt/shofixt.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../shofixt/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/pkunk/pkunkc.c -=================================================================== ---- uqm/comm/pkunk/pkunkc.c (revision 3779) -+++ uqm/comm/pkunk/pkunkc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../pkunk/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/spathi/spathic.c -=================================================================== ---- uqm/comm/spathi/spathic.c (revision 3779) -+++ uqm/comm/spathi/spathic.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../spathi/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/rebel/rebel.c -=================================================================== ---- uqm/comm/rebel/rebel.c (revision 3779) -+++ uqm/comm/rebel/rebel.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../yehat/resinst.h" --#include "strings.h" -+#include "../rebel/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/druuge/druugec.c -=================================================================== ---- uqm/comm/druuge/druugec.c (revision 3779) -+++ uqm/comm/druuge/druugec.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../druuge/strings.h" - - #include "uqm/build.h" - #include "uqm/setup.h" -Index: uqm/comm/spahome/spahome.c -=================================================================== ---- uqm/comm/spahome/spahome.c (revision 3779) -+++ uqm/comm/spahome/spahome.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../spathi/resinst.h" --#include "strings.h" -+#include "../spahome/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/starbas/starbas.c -=================================================================== ---- uqm/comm/starbas/starbas.c (revision 3779) -+++ uqm/comm/starbas/starbas.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../comandr/resinst.h" --#include "strings.h" -+#include "../starbas/strings.h" - - #include "uqm/build.h" - #include "uqm/setup.h" -Index: uqm/comm/utwig/utwigc.c -=================================================================== ---- uqm/comm/utwig/utwigc.c (revision 3779) -+++ uqm/comm/utwig/utwigc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../utwig/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/umgah/umgahc.c -=================================================================== ---- uqm/comm/umgah/umgahc.c (revision 3779) -+++ uqm/comm/umgah/umgahc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../umgah/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/talkpet/talkpet.c -=================================================================== ---- uqm/comm/talkpet/talkpet.c (revision 3779) -+++ uqm/comm/talkpet/talkpet.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../talkpet/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/syreen/syreenc.c -=================================================================== ---- uqm/comm/syreen/syreenc.c (revision 3779) -+++ uqm/comm/syreen/syreenc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../syreen/strings.h" - - #include "uqm/build.h" - #include "uqm/setup.h" -Index: uqm/comm/melnorm/melnorm.c -=================================================================== ---- uqm/comm/melnorm/melnorm.c (revision 3779) -+++ uqm/comm/melnorm/melnorm.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../melnorm/strings.h" - - #include "uqm/gameev.h" - #include "uqm/shipcont.h" -Index: uqm/comm/yehat/yehatc.c -=================================================================== ---- uqm/comm/yehat/yehatc.c (revision 3779) -+++ uqm/comm/yehat/yehatc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../yehat/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/orz/orzc.c -=================================================================== ---- uqm/comm/orz/orzc.c (revision 3779) -+++ uqm/comm/orz/orzc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../orz/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/slyhome/slyhome.c -=================================================================== ---- uqm/comm/slyhome/slyhome.c (revision 3779) -+++ uqm/comm/slyhome/slyhome.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../slyhome/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/zoqfot/zoqfotc.c -=================================================================== ---- uqm/comm/zoqfot/zoqfotc.c (revision 3779) -+++ uqm/comm/zoqfot/zoqfotc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../zoqfot/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/blackur/blackurc.c -=================================================================== ---- uqm/comm/blackur/blackurc.c (revision 3779) -+++ uqm/comm/blackur/blackurc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../blackur/strings.h" - - static LOCDATA blackurq_desc = - { -Index: uqm/comm/comandr/comandr.c -=================================================================== ---- uqm/comm/comandr/comandr.c (revision 3779) -+++ uqm/comm/comandr/comandr.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../comandr/strings.h" - - #include "uqm/setup.h" - #include "uqm/sis.h" -Index: uqm/comm/mycon/myconc.c -=================================================================== ---- uqm/comm/mycon/myconc.c (revision 3779) -+++ uqm/comm/mycon/myconc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../mycon/strings.h" - - #include "uqm/gameev.h" - #include "libs/mathlib.h" -Index: uqm/comm/arilou/arilouc.c -=================================================================== ---- uqm/comm/arilou/arilouc.c (revision 3779) -+++ uqm/comm/arilou/arilouc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../arilou/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/slyland/slyland.c -=================================================================== ---- uqm/comm/slyland/slyland.c (revision 3779) -+++ uqm/comm/slyland/slyland.c (working copy) -@@ -16,10 +16,10 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#include "../slyland/strings.h" -+#include - #include "../commall.h" --#include - #include "resinst.h" --#include "strings.h" - - #include "options.h" - #include "uqm/battle.h" -Index: uqm/comm/thradd/thraddc.c -=================================================================== ---- uqm/comm/thradd/thraddc.c (revision 3779) -+++ uqm/comm/thradd/thraddc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../thradd/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/chmmr/chmmrc.c -=================================================================== ---- uqm/comm/chmmr/chmmrc.c (revision 3779) -+++ uqm/comm/chmmr/chmmrc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../chmmr/strings.h" - - #include "uqm/build.h" - #include "uqm/hyper.h" -Index: uqm/comm/ilwrath/ilwrathc.c -=================================================================== ---- uqm/comm/ilwrath/ilwrathc.c (revision 3779) -+++ uqm/comm/ilwrath/ilwrathc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../ilwrath/strings.h" - - #include "uqm/gameev.h" - -Index: options.c -=================================================================== ---- options.c (revision 3779) -+++ options.c (working copy) -@@ -50,6 +50,7 @@ - int optWhichShield; - int optSmoothScroll; - int optMeleeScale; -+int optDirectionalJoystick; - const char **optAddons; - - BOOLEAN opt3doMusic; -@@ -467,6 +468,7 @@ - - for (i = 0; i < dirList->numNames; i++) - { -+ log_add (log_Info, "Mounting ZIP '%s'", dirList->names[i]); - if (uio_mountDir (repository, mountPoint, uio_FSTYPE_ZIP, - dirHandle, dirList->names[i], "/", autoMount, - relativeFlags | uio_MOUNT_RDONLY, -Index: options.h -=================================================================== ---- options.h (revision 3779) -+++ options.h (working copy) -@@ -41,6 +41,7 @@ - extern int optWhichShield; - extern int optSmoothScroll; - extern int optMeleeScale; -+extern int optDirectionalJoystick; - - extern BOOLEAN opt3doMusic; - extern BOOLEAN optRemixMusic; -Index: uqm.c -=================================================================== ---- uqm.c (revision 3779) -+++ uqm.c (working copy) -@@ -129,6 +129,7 @@ - DECL_CONFIG_OPTION(float, sfxVolumeScale); - DECL_CONFIG_OPTION(float, speechVolumeScale); - DECL_CONFIG_OPTION(bool, safeMode); -+ DECL_CONFIG_OPTION(bool, directionalJoystick); - - #define INIT_CONFIG_OPTION(name, val) \ - { val, false } -@@ -263,6 +264,7 @@ - INIT_CONFIG_OPTION( sfxVolumeScale, 1.0f ), - INIT_CONFIG_OPTION( speechVolumeScale, 1.0f ), - INIT_CONFIG_OPTION( safeMode, false ), -+ INIT_CONFIG_OPTION( directionalJoystick, true ), - }; - struct options_struct defaults = options; - int optionsResult; -@@ -390,6 +392,7 @@ - sfxVolumeScale = options.sfxVolumeScale.value; - speechVolumeScale = options.speechVolumeScale.value; - optAddons = options.addons; -+ optDirectionalJoystick = options.directionalJoystick.value; - - prepareContentDir (options.contentDir, options.addonDir, argv[0]); - prepareMeleeDir (); -@@ -637,6 +640,7 @@ - getBoolConfigValue (&options->fullscreen, "config.fullscreen"); - getBoolConfigValue (&options->scanlines, "config.scanlines"); - getBoolConfigValue (&options->showFps, "config.showfps"); -+ getBoolConfigValue (&options->directionalJoystick, "config.directionaljoystick"); - getBoolConfigValue (&options->keepAspectRatio, "config.keepaspectratio"); - getGammaConfigValue (&options->gamma, "config.gamma"); - diff --git a/project/jni/application/supertux/AndroidAppSettings.cfg b/project/jni/application/supertux/AndroidAppSettings.cfg index 69dc23212..a08f311c3 100644 --- a/project/jni/application/supertux/AndroidAppSettings.cfg +++ b/project/jni/application/supertux/AndroidAppSettings.cfg @@ -1,47 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=19 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="SuperTux" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=org.lethargik.supertux2 + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer InhibitSuspend=n -AppDataDownloadUrl="!Data files|http://sourceforge.net/projects/libsdl-android/files/SuperTux/data-1.zip" + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!Data files|http://sourceforge.net/projects/libsdl-android/files/SuperTux/data-2.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=24 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n -AppUsesMouse=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) +CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) +CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user +AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) AppNeedsArrowKeys=y + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=n -AppHandlesJoystickSensitivity=n + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=n + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 +AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="LALT RETURN NO_REMAP NO_REMAP SPACE" + +# Number of virtual keyboard keys (currently 6 is maximum) AppTouchscreenKeyboardKeysAmount=2 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) RedefinedKeysScreenKb="SPACE LCTRL" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="Jump Action" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 -HiddenMenuOptions='OptionalDownloadConfig' + +# Menu items to hide from startup menu, available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout +HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default +# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() +# Available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout FirstStartMenuOptions='' -MultiABI=n -AppVersionCode=03304 -AppVersionName="0.3.3.04" -ResetSdlConfigForThisVersion=n -DeleteFilesOnUpgrade="%" -CompiledLibraries=" sdl_image physfs boost_system curl openal jpeg png tremor ogg" + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower +AppMinimumRAM=0 + +# Application version code (integer) +AppVersionCode=03305 + +# Application user-visible version name (string) +AppVersionName="0.3.3.05" + +# Reset SDL config when updating application to the new version (y) / (n) +ResetSdlConfigForThisVersion=y + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) +DeleteFilesOnUpgrade="data" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 +CompiledLibraries="sdl_image physfs boost_system curl openal jpeg png vorbis ogg" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=n -AppCflags='-include GLES/gl.h -Ijni/openal/include/AL -DHAVE_SDL=1' -AppLdflags='' + +# Aditional CFLAGS for application +AppCflags='-include GLES/gl.h -Ijni/openal/include/AL -DHAVE_SDL=1 -frtti -fexceptions' + +# Additional LDFLAGS for application +AppLdflags='-frtti -fexceptions' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) AppSubdirsBuild='. supertux/src/* supertux/external/tinygettext/tinygettext supertux/external/tinygettext supertux/external/findlocale supertux/external/obstack supertux/external/squirrel/include supertux/external/squirrel/squirrel supertux/external/squirrel/sqstdlib' + +# Exclude these files from build +AppBuildExclude='supertux/external/findlocale/example.c' + +# Application command line parameters, including app name as 0-th param AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) ReadmeText='^You may press "Home" now - the data will be downloaded in background' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge +MinimumScreenSize=m + +# Your AdMob Publisher ID, (n) if you don't want advertisements +AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad +AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) +AdmobBannerSize= + diff --git a/project/jni/application/supertux/AndroidPreBuild.sh b/project/jni/application/supertux/AndroidPreBuild.sh new file mode 100755 index 000000000..02925c655 --- /dev/null +++ b/project/jni/application/supertux/AndroidPreBuild.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -e supertux/patched.successfully ]; then + exit 0 +else + # Google Code fails to send shallow repository, so we're checking out everything + git clone https://code.google.com/p/supertux && patch -p1 -d supertux < android.diff && touch supertux/patched.successfully || exit 1 +fi diff --git a/project/jni/application/supertux/android.diff b/project/jni/application/supertux/android.diff index 1f36d4c7b..8fcb828fe 100644 --- a/project/jni/application/supertux/android.diff +++ b/project/jni/application/supertux/android.diff @@ -1,33 +1,5 @@ -diff --git a/src/audio/ogg_sound_file.cpp b/src/audio/ogg_sound_file.cpp -index fd7c7fc..ebf978b 100644 ---- a/src/audio/ogg_sound_file.cpp -+++ b/src/audio/ogg_sound_file.cpp -@@ -83,8 +83,8 @@ OggSoundFile::read(void* _buffer, size_t buffer_size) - } - - long bytesRead -- = ov_read(&vorbis_file, buffer, bytes_to_read, bigendian, -- 2, 1, §ion); -+ = ov_read(&vorbis_file, buffer, bytes_to_read, -+ §ion); - if(bytesRead == 0) { - break; - } -diff --git a/src/audio/ogg_sound_file.hpp b/src/audio/ogg_sound_file.hpp -index 0a9b8b1..8344177 100644 ---- a/src/audio/ogg_sound_file.hpp -+++ b/src/audio/ogg_sound_file.hpp -@@ -18,7 +18,7 @@ - #define HEADER_SUPERTUX_AUDIO_OGG_SOUND_FILE_HPP - - #include --#include -+#include - - #include "audio/sound_file.hpp" - diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp -index de414fa..92ba634 100644 +index 6c9e9c0..dbb8a9e 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -70,7 +70,7 @@ JoystickKeyboardController::JoystickKeyboardController() : @@ -58,7 +30,7 @@ index 235198c..6126b25 100644 try_vsync(true), show_fps(false), diff --git a/src/supertux/main.cpp b/src/supertux/main.cpp -index 3dccd6e..f4b179d 100644 +index d89420f..2c80b2b 100644 --- a/src/supertux/main.cpp +++ b/src/supertux/main.cpp @@ -20,7 +20,7 @@ @@ -213,7 +185,7 @@ index 6ce6f73..e12edf7 100644 return (Console::output); else diff --git a/src/video/gl/gl_lightmap.cpp b/src/video/gl/gl_lightmap.cpp -index 2ac49ef..dd5953b 100644 +index f8a6735..9638b64 100644 --- a/src/video/gl/gl_lightmap.cpp +++ b/src/video/gl/gl_lightmap.cpp @@ -60,7 +60,7 @@ GLLightmap::GLLightmap() : @@ -226,12 +198,12 @@ index 2ac49ef..dd5953b 100644 GLLightmap::~GLLightmap() diff --git a/src/video/gl/gl_renderer.cpp b/src/video/gl/gl_renderer.cpp -index 361f30a..f26db81 100644 +index 0e66433..abf65b8 100644 --- a/src/video/gl/gl_renderer.cpp +++ b/src/video/gl/gl_renderer.cpp -@@ -118,8 +118,8 @@ GLRenderer::draw_surface(const DrawingRequest& request) - - glBindTexture(GL_TEXTURE_2D, gltexture->get_handle()); +@@ -123,8 +123,8 @@ GLRenderer::draw_surface(const DrawingRequest& request) + glBindTexture(GL_TEXTURE_2D, th); + } intern_draw(request.pos.x, request.pos.y, - request.pos.x + surface->get_width(), - request.pos.y + surface->get_height(), @@ -240,9 +212,9 @@ index 361f30a..f26db81 100644 surface_data->get_uv_left(), surface_data->get_uv_top(), surface_data->get_uv_right(), -@@ -150,8 +150,8 @@ GLRenderer::draw_surface_part(const DrawingRequest& request) - - glBindTexture(GL_TEXTURE_2D, gltexture->get_handle()); +@@ -159,8 +159,8 @@ GLRenderer::draw_surface_part(const DrawingRequest& request) + glBindTexture(GL_TEXTURE_2D, th); + } intern_draw(request.pos.x, request.pos.y, - request.pos.x + surfacepartrequest->size.x, - request.pos.y + surfacepartrequest->size.y, @@ -252,7 +224,7 @@ index 361f30a..f26db81 100644 uv_top, uv_right, diff --git a/src/video/gl/gl_renderer.hpp b/src/video/gl/gl_renderer.hpp -index 9e20859..8b7e04e 100644 +index d5d9995..4fdacf8 100644 --- a/src/video/gl/gl_renderer.hpp +++ b/src/video/gl/gl_renderer.hpp @@ -63,8 +63,8 @@ inline void intern_draw(float left, float top, float right, float bottom, @@ -490,10 +462,10 @@ index e814547..710a488 100644 private: Texture(const Texture&); diff --git a/src/video/texture_manager.cpp b/src/video/texture_manager.cpp -index 7343a45..86af07e 100644 +index 0c77a5a..378853b 100644 --- a/src/video/texture_manager.cpp +++ b/src/video/texture_manager.cpp -@@ -219,6 +219,7 @@ TextureManager::create_dummy_texture() +@@ -228,6 +228,7 @@ TextureManager::create_dummy_texture() void TextureManager::save_textures() { @@ -501,7 +473,7 @@ index 7343a45..86af07e 100644 #ifdef GL_PACK_ROW_LENGTH /* all this stuff is not support by OpenGL ES */ glPixelStorei(GL_PACK_ROW_LENGTH, 0); -@@ -236,11 +237,13 @@ TextureManager::save_textures() +@@ -245,11 +246,13 @@ TextureManager::save_textures() i != image_textures.end(); ++i) { save_texture(dynamic_cast(i->second.lock().get())); } @@ -515,7 +487,7 @@ index 7343a45..86af07e 100644 SavedTexture saved_texture; saved_texture.texture = texture; glBindTexture(GL_TEXTURE_2D, texture->get_handle()); -@@ -275,11 +278,13 @@ TextureManager::save_texture(GLTexture* texture) +@@ -284,11 +287,13 @@ TextureManager::save_texture(GLTexture* texture) texture->set_handle(0); assert_gl("retrieving texture for save"); @@ -529,7 +501,7 @@ index 7343a45..86af07e 100644 #ifdef GL_UNPACK_ROW_LENGTH /* OpenGL ES doesn't support these */ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); -@@ -320,6 +325,12 @@ TextureManager::reload_textures() +@@ -329,6 +334,12 @@ TextureManager::reload_textures() } saved_textures.clear(); diff --git a/project/jni/application/supertux/supertux b/project/jni/application/supertux/supertux deleted file mode 120000 index d0ae93725..000000000 --- a/project/jni/application/supertux/supertux +++ /dev/null @@ -1 +0,0 @@ -../../../../../supertux \ No newline at end of file diff --git a/project/jni/application/teeworlds-0.5.2/AndroidAppSettings.cfg b/project/jni/application/teeworlds-0.5.2/AndroidAppSettings.cfg deleted file mode 100644 index 21e6e5df3..000000000 --- a/project/jni/application/teeworlds-0.5.2/AndroidAppSettings.cfg +++ /dev/null @@ -1,47 +0,0 @@ -# The application settings for Android libSDL port -AppSettingVersion=17 -LibSdlVersion=1.2 -AppName="TeeWorlds" -AppFullName=com.teeworlds -ScreenOrientation=h -InhibitSuspend=n -AppDataDownloadUrl="Game data|teeworlds.zip" -VideoDepthBpp=16 -NeedDepthBuffer=n -NeedStencilBuffer=n -NeedGles2=n -SwVideoMode=n -SdlVideoResize=n -SdlVideoResizeKeepAspect=n -CompatibilityHacks=n -CompatibilityHacksStaticInit=n -CompatibilityHacksTextInputEmulatesHwKeyboard=n -AppUsesMouse=y -AppNeedsTwoButtonMouse=y -ShowMouseCursor=n -ForceRelativeMouseMode=y -AppNeedsArrowKeys=y -AppNeedsTextInput=y -AppUsesJoystick=y -AppHandlesJoystickSensitivity=n -AppUsesMultitouch=n -NonBlockingSwapBuffers=n -RedefinedKeys="SPACE RETURN LEFT RIGHT LSHIFT ESCAPE RSHIFT LSHIFT" -AppTouchscreenKeyboardKeysAmount=6 -AppTouchscreenKeyboardKeysAmountAutoFire=0 -RedefinedKeysScreenKb="SPACE RETURN LEFT RIGHT RSHIFT LSHIFT" -StartupMenuButtonTimeout=3000 -HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig' -FirstStartMenuOptions='' -MultiABI=y -AppVersionCode=5207 -AppVersionName="0.5.2.07" -ResetSdlConfigForThisVersion=n -DeleteFilesOnUpgrade="%" -CompiledLibraries="sdl_image freetype" -CustomBuildScript=n -AppCflags='-O3' -AppLdflags='' -AppSubdirsBuild='' -AppCmdline='' -ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/application/teeworlds-0.5.2/AndroidData/teeworlds.zip b/project/jni/application/teeworlds-0.5.2/AndroidData/teeworlds.zip deleted file mode 100644 index e5480c23d..000000000 Binary files a/project/jni/application/teeworlds-0.5.2/AndroidData/teeworlds.zip and /dev/null differ diff --git a/project/jni/application/teeworlds-0.5.2/icon.png b/project/jni/application/teeworlds-0.5.2/icon.png deleted file mode 100644 index 78936fa81..000000000 Binary files a/project/jni/application/teeworlds-0.5.2/icon.png and /dev/null differ diff --git a/project/jni/application/teeworlds-0.5.2/license.txt b/project/jni/application/teeworlds-0.5.2/license.txt deleted file mode 100644 index e1d5c2cac..000000000 --- a/project/jni/application/teeworlds-0.5.2/license.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (C) 2007-2010 Magnus Auvinen - -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. - ------------------------------------------------------------------------- - -IMPORTANT NOTE! The source under src/engine/external are stripped -libraries with their own licenses. Mostly BSD or zlib/libpng license but -check the individual libraries. - ------------------------------------------------------------------------- - -With that being said, contact us if there is anything you want to do -that the license does not premit. diff --git a/project/jni/application/teeworlds-0.5.2/readme.txt b/project/jni/application/teeworlds-0.5.2/readme.txt deleted file mode 100644 index a56a3981d..000000000 --- a/project/jni/application/teeworlds-0.5.2/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2010 Magnus Auvinen - - -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. - - -Please visit http://www.teeworlds.com for up-to-date information about -the game, including new versions, custom maps and much more. diff --git a/project/jni/application/teeworlds-0.5.2/src/base/detect.h b/project/jni/application/teeworlds-0.5.2/src/base/detect.h deleted file mode 100644 index 2369c8fe0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/base/detect.h +++ /dev/null @@ -1,134 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef BASELIB_FILE_CONFIG_H -#define BASELIB_FILE_CONFIG_H - -/* - this file detected the family, platform and architecture - to compile for. -*/ - -/* platforms */ - -/* windows Family */ -#if defined(WIN64) || defined(_WIN64) - /* Hmm, is this IA64 or x86-64? */ - #define CONF_FAMILY_WINDOWS 1 - #define CONF_FAMILY_STRING "windows" - #define CONF_PLATFORM_WIN64 1 - #define CONF_PLATFORM_STRING "win64" -#elif defined(WIN32) || defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) - #define CONF_FAMILY_WINDOWS 1 - #define CONF_FAMILY_STRING "windows" - #define CONF_PLATFORM_WIN32 1 - #define CONF_PLATFORM_STRING "win32" -#endif - -/* unix family */ -#if defined(__FreeBSD__) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFORM_FREEBSD 1 - #define CONF_PLATFORM_STRING "freebsd" -#endif - -#if defined(__OpenBSD__) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFORM_OPENBSD 1 - #define CONF_PLATFORM_STRING "openbsd" -#endif - -#if defined(__LINUX__) || defined(__linux__) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFORM_LINUX 1 - #define CONF_PLATFORM_STRING "linux" -#endif - -#if defined(MACOSX) || defined(__APPLE__) || defined(__DARWIN__) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFORM_MACOSX 1 - #define CONF_PLATFORM_STRING "macosx" -#endif - -#if defined(__sun) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFROM_SOLARIS 1 - #define CONF_PLATFORM_STRING "solaris" -#endif - -/* beos family */ -#if defined(__BeOS) || defined(__BEOS__) - #define CONF_FAMILY_BEOS 1 - #define CONF_FAMILY_STRING "beos" - #define CONF_PLATFORM_BEOS 1 - #define CONF_PLATFORM_STRING "beos" -#endif - -#if defined(ANDROID) - #define CONF_FAMILY_UNIX 1 - #define CONF_FAMILY_STRING "unix" - #define CONF_PLATFORM_LINUX 1 - #define CONF_PLATFORM_STRING "android" -#endif - - -/* architectures */ -#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(CONF_PLATFORM_WIN32) - #define CONF_ARCH_IA32 1 - #define CONF_ARCH_STRING "ia32" - #define CONF_ARCH_ENDIAN_LITTLE 1 -#endif - -#if defined(__ia64__) - #define CONF_ARCH_IA64 1 - #define CONF_ARCH_STRING "ia64" - #define CONF_ARCH_ENDIAN_LITTLE 1 -#endif - -#if defined(__amd64__) || defined(__x86_64__) - #define CONF_ARCH_AMD64 1 - #define CONF_ARCH_STRING "amd64" - #define CONF_ARCH_ENDIAN_LITTLE 1 -#endif - -#if defined(__powerpc__) || defined(__ppc__) - #define CONF_ARCH_PPC 1 - #define CONF_ARCH_STRING "ppc" - #define CONF_ARCH_ENDIAN_BIG 1 -#endif - -#if defined(__sparc__) - #define CONF_ARCH_SPARC 1 - #define CONF_ARCH_STRING "sparc" - #define CONF_ARCH_ENDIAN_BIG 1 -#endif - -#if defined(__ARMEB__) - #define CONF_ARCH_ARM 1 - #define CONF_ARCH_STRING "arm" - #define CONF_ARCH_ENDIAN_BIG 1 -#endif - -#if defined(__ARMEL__) - #define CONF_ARCH_ARM 1 - #define CONF_ARCH_STRING "arm" - #define CONF_ARCH_ENDIAN_LITTLE 1 -#endif - - -#ifndef CONF_FAMILY_STRING -#define CONF_FAMILY_STRING "unknown" -#endif - -#ifndef CONF_PLATFORM_STRING -#define CONF_PLATFORM_STRING "unknown" -#endif - -#ifndef CONF_ARCH_STRING -#define CONF_ARCH_STRING "unknown" -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/base/math.hpp b/project/jni/application/teeworlds-0.5.2/src/base/math.hpp deleted file mode 100644 index 302935d76..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/base/math.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef BASE_MATH_H -#define BASE_MATH_H - -#include - -template -inline T clamp(T val, T min, T max) -{ - if(val < min) - return min; - if(val > max) - return max; - return val; -} - -inline float sign(float f) -{ - return f<0.0f?-1.0f:1.0f; -} - -inline int round(float f) -{ - if(f > 0) - return (int)(f+0.5f); - return (int)(f-0.5f); -} - -template -inline T mix(const T a, const T b, TB amount) -{ - return a + (b-a)*amount; -} - -inline float frandom() { return rand()/(float)(RAND_MAX); } - -// float to fixed -inline int f2fx(float v) { return (int)(v*(float)(1<<10)); } -inline float fx2f(int v) { return v*(1.0f/(1<<10)); } - -class fxp -{ - int value; -public: - void set(int v) { value = v; } - int get() const { return value; } - fxp &operator = (int v) { value = v<<10; return *this; } - fxp &operator = (float v) { value = (int)(v*(float)(1<<10)); return *this; } - operator float() const { return value/(float)(1<<10); } -}; - -class tune_param -{ - int value; -public: - void set(int v) { value = v; } - int get() const { return value; } - tune_param &operator = (int v) { value = (int)(v*100.0f); return *this; } - tune_param &operator = (float v) { value = (int)(v*100.0f); return *this; } - operator float() const { return value/100.0f; } -}; - -const float pi = 3.1415926535897932384626433f; - -template inline T min(T a, T b) { return a inline T max(T a, T b) { return a>b?a:b; } - -#endif // BASE_MATH_H diff --git a/project/jni/application/teeworlds-0.5.2/src/base/system.cpp b/project/jni/application/teeworlds-0.5.2/src/base/system.cpp deleted file mode 100644 index 1a20fedc7..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/base/system.cpp +++ /dev/null @@ -1,1200 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include -#include -#include - -/*#include "detect.h"*/ -#include "system.h" -/*#include "e_console.h"*/ - -#if defined(CONF_FAMILY_UNIX) - #include - #include - - /* unix net includes */ - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #include - - #if defined(CONF_PLATFORM_MACOSX) - #include - #endif -#ifdef ANDROID - #include -#endif - -#elif defined(CONF_FAMILY_WINDOWS) - #define WIN32_LEAN_AND_MEAN - #define _WIN32_WINNT 0x0501 /* required for mingw to get getaddrinfo to work */ - #include - #include - #include - #include - #include - #include - #include - - #define EWOULDBLOCK WSAEWOULDBLOCK -#else - #error NOT IMPLEMENTED -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -IOHANDLE io_stdin() { return (IOHANDLE)stdin; } -IOHANDLE io_stdout() { return (IOHANDLE)stdout; } -IOHANDLE io_stderr() { return (IOHANDLE)stderr; } - -static DBG_LOGGER loggers[16]; -static int num_loggers = 0; - -static NETSTATS network_stats = {0}; -static MEMSTATS memory_stats = {0}; - -void dbg_logger(DBG_LOGGER logger) -{ - loggers[num_loggers++] = logger; -} - -void dbg_assert_imp(const char *filename, int line, int test, const char *msg) -{ - if(!test) - { - dbg_msg("assert", "%s(%d): %s", filename, line, msg); - dbg_break(); - } -} - -void dbg_break() -{ - *((unsigned*)0) = 0x0; -} - -void dbg_msg(const char *sys, const char *fmt, ...) -{ - va_list args; - char str[1024*4]; - char *msg; - int i, len; - - str_format(str, sizeof(str), "[%08x][%s]: ", (int)time(0), sys); - len = strlen(str); - msg = (char *)str + len; - - va_start(args, fmt); -#if defined(CONF_FAMILY_WINDOWS) - _vsnprintf(msg, sizeof(str)-len, fmt, args); -#else - vsnprintf(msg, sizeof(str)-len, fmt, args); -#endif - va_end(args); - - for(i = 0; i < num_loggers; i++) - loggers[i](str); -} - -static void logger_stdout(const char *line) -{ - printf("%s\n", line); - fflush(stdout); -#ifdef ANDROID - __android_log_print(ANDROID_LOG_INFO, "Teeworlds", "%s", line); -#endif - -} - -static void logger_debugger(const char *line) -{ -#if defined(CONF_FAMILY_WINDOWS) - OutputDebugString(line); - OutputDebugString("\n"); -#endif -} - - -IOHANDLE logfile = 0; -static void logger_file(const char *line) -{ - io_write(logfile, line, strlen(line)); - io_write(logfile, "\n", 1); - io_flush(logfile); -} - -void dbg_logger_stdout() { dbg_logger(logger_stdout); } -void dbg_logger_debugger() { dbg_logger(logger_debugger); } -void dbg_logger_file(const char *filename) -{ - logfile = io_open(filename, IOFLAG_WRITE); - if(logfile) - dbg_logger(logger_file); - else - dbg_msg("dbg/logger", "failed to open '%s' for logging", filename); - -} - -/* */ - -int memory_alloced = 0; - -typedef struct MEMHEADER -{ - const char *filename; - int line; - int size; - struct MEMHEADER *prev; - struct MEMHEADER *next; -} MEMHEADER; - -typedef struct MEMTAIL -{ - int guard; -} MEMTAIL; - -static struct MEMHEADER *first = 0; -static const int MEM_GUARD_VAL = 0xbaadc0de; - -void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned alignment) -{ - /* TODO: fix alignment */ - /* TODO: add debugging */ - MEMHEADER *header = (struct MEMHEADER *)malloc(size+sizeof(MEMHEADER)+sizeof(MEMTAIL)); - MEMTAIL *tail = (struct MEMTAIL *)(((char*)(header+1))+size); - header->size = size; - header->filename = filename; - header->line = line; - - memory_stats.allocated += header->size; - memory_stats.total_allocations++; - memory_stats.active_allocations++; - - tail->guard = MEM_GUARD_VAL; - - header->prev = (MEMHEADER *)0; - header->next = first; - if(first) - first->prev = header; - first = header; - - /*dbg_msg("mem", "++ %p", header+1); */ - return header+1; -} - -void mem_free(void *p) -{ - if(p) - { - MEMHEADER *header = (MEMHEADER *)p - 1; - MEMTAIL *tail = (MEMTAIL *)(((char*)(header+1))+header->size); - - if(tail->guard != MEM_GUARD_VAL) - dbg_msg("mem", "!! %p", p); - /* dbg_msg("mem", "-- %p", p); */ - memory_stats.allocated -= header->size; - memory_stats.active_allocations--; - - if(header->prev) - header->prev->next = header->next; - else - first = header->next; - if(header->next) - header->next->prev = header->prev; - - free(header); - } -} - -void mem_debug_dump() -{ - char buf[1024]; - MEMHEADER *header = first; - IOHANDLE f = io_open("memory.txt", IOFLAG_WRITE); - - while(header) - { - str_format(buf, sizeof(buf), "%s(%d): %d\n", header->filename, header->line, header->size); - io_write(f, buf, strlen(buf)); - header = header->next; - } - - io_close(f); -} - - -void mem_copy(void *dest, const void *source, unsigned size) -{ - memcpy(dest, source, size); -} - -void mem_move(void *dest, const void *source, unsigned size) -{ - memmove(dest, source, size); -} - -void mem_zero(void *block,unsigned size) -{ - memset(block, 0, size); -} - -int mem_check_imp() -{ - MEMHEADER *header = first; - while(header) - { - MEMTAIL *tail = (MEMTAIL *)(((char*)(header+1))+header->size); - if(tail->guard != MEM_GUARD_VAL) - { - dbg_msg("mem", "Memory check failed at %s(%d): %d", header->filename, header->line, header->size); - return 0; - } - header = header->next; - } - - return 1; -} - -IOHANDLE io_open(const char *filename, int flags) -{ - if(flags == IOFLAG_READ) - return (IOHANDLE)fopen(filename, "rb"); - if(flags == IOFLAG_WRITE) - return (IOHANDLE)fopen(filename, "wb"); - return 0x0; -} - -unsigned io_read(IOHANDLE io, void *buffer, unsigned size) -{ - return fread(buffer, 1, size, (FILE*)io); -} - -unsigned io_skip(IOHANDLE io, unsigned size) -{ - fseek((FILE*)io, size, SEEK_CUR); - return size; -} - -int io_seek(IOHANDLE io, int offset, int origin) -{ - int real_origin; - - switch(origin) - { - case IOSEEK_START: - real_origin = SEEK_SET; - break; - case IOSEEK_CUR: - real_origin = SEEK_CUR; - break; - case IOSEEK_END: - real_origin = SEEK_END; - } - - return fseek((FILE*)io, offset, origin); -} - -long int io_tell(IOHANDLE io) -{ - return ftell((FILE*)io); -} - -long int io_length(IOHANDLE io) -{ - long int length; - io_seek(io, 0, IOSEEK_END); - length = io_tell(io); - io_seek(io, 0, IOSEEK_START); - return length; -} - -unsigned io_write(IOHANDLE io, const void *buffer, unsigned size) -{ - return fwrite(buffer, 1, size, (FILE*)io); -} - -int io_close(IOHANDLE io) -{ - fclose((FILE*)io); - return 1; -} - -int io_flush(IOHANDLE io) -{ - fflush((FILE*)io); - return 0; -} - -void *thread_create(void (*threadfunc)(void *), void *u) -{ -#if defined(CONF_FAMILY_UNIX) - pthread_t id; - pthread_create(&id, NULL, (void *(*)(void*))threadfunc, u); - return (void*)id; -#elif defined(CONF_FAMILY_WINDOWS) - return CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc, u, 0, NULL); -#else - #error not implemented -#endif -} - -void thread_wait(void *thread) -{ -#if defined(CONF_FAMILY_UNIX) - pthread_join((pthread_t)thread, NULL); -#elif defined(CONF_FAMILY_WINDOWS) - WaitForSingleObject((HANDLE)thread, INFINITE); -#else - #error not implemented -#endif -} - -void thread_destroy(void *thread) -{ -#if defined(CONF_FAMILY_UNIX) - void *r = 0; - pthread_join((pthread_t)thread, &r); -#else - /*#error not implemented*/ -#endif -} - -void thread_yield() -{ -#if defined(CONF_FAMILY_UNIX) - sched_yield(); -#elif defined(CONF_FAMILY_WINDOWS) - Sleep(0); -#else - #error not implemented -#endif -} - -void thread_sleep(int milliseconds) -{ -#if defined(CONF_FAMILY_UNIX) - usleep(milliseconds*1000); -#elif defined(CONF_FAMILY_WINDOWS) - Sleep(milliseconds); -#else - #error not implemented -#endif -} - - - - -#if defined(CONF_FAMILY_UNIX) -typedef pthread_mutex_t LOCKINTERNAL; -#elif defined(CONF_FAMILY_WINDOWS) -typedef CRITICAL_SECTION LOCKINTERNAL; -#else - #error not implemented on this platform -#endif - -LOCK lock_create() -{ - LOCKINTERNAL *lock = (LOCKINTERNAL*)mem_alloc(sizeof(LOCKINTERNAL), 4); - -#if defined(CONF_FAMILY_UNIX) - pthread_mutex_init(lock, 0x0); -#elif defined(CONF_FAMILY_WINDOWS) - InitializeCriticalSection((LPCRITICAL_SECTION)lock); -#else - #error not implemented on this platform -#endif - return (LOCK)lock; -} - -void lock_destroy(LOCK lock) -{ -#if defined(CONF_FAMILY_UNIX) - pthread_mutex_destroy((LOCKINTERNAL *)lock); -#elif defined(CONF_FAMILY_WINDOWS) - DeleteCriticalSection((LPCRITICAL_SECTION)lock); -#else - #error not implemented on this platform -#endif - mem_free(lock); -} - -int lock_try(LOCK lock) -{ -#if defined(CONF_FAMILY_UNIX) - return pthread_mutex_trylock((LOCKINTERNAL *)lock); -#elif defined(CONF_FAMILY_WINDOWS) - return TryEnterCriticalSection((LPCRITICAL_SECTION)lock); -#else - #error not implemented on this platform -#endif -} - -void lock_wait(LOCK lock) -{ -#if defined(CONF_FAMILY_UNIX) - pthread_mutex_lock((LOCKINTERNAL *)lock); -#elif defined(CONF_FAMILY_WINDOWS) - EnterCriticalSection((LPCRITICAL_SECTION)lock); -#else - #error not implemented on this platform -#endif -} - -void lock_release(LOCK lock) -{ -#if defined(CONF_FAMILY_UNIX) - pthread_mutex_unlock((LOCKINTERNAL *)lock); -#elif defined(CONF_FAMILY_WINDOWS) - LeaveCriticalSection((LPCRITICAL_SECTION)lock); -#else - #error not implemented on this platform -#endif -} - -/* ----- time ----- */ -int64 time_get() -{ -#if defined(CONF_FAMILY_UNIX) - struct timeval val; - gettimeofday(&val, NULL); - return (int64)val.tv_sec*(int64)1000000+(int64)val.tv_usec; -#elif defined(CONF_FAMILY_WINDOWS) - static int64 last = 0; - int64 t; - QueryPerformanceCounter((PLARGE_INTEGER)&t); - if(tsin_family = AF_INET; - p->sin_port = htons(src->port); - p->sin_addr.s_addr = htonl(src->ip[0]<<24|src->ip[1]<<16|src->ip[2]<<8|src->ip[3]); -} - -static void sockaddr_to_netaddr(const struct sockaddr *src, NETADDR *dst) -{ - /* TODO: IPv6 support */ - unsigned int ip = htonl(((struct sockaddr_in*)src)->sin_addr.s_addr); - mem_zero(dst, sizeof(NETADDR)); - dst->type = NETTYPE_IPV4; - dst->port = htons(((struct sockaddr_in*)src)->sin_port); - dst->ip[0] = (unsigned char)((ip>>24)&0xFF); - dst->ip[1] = (unsigned char)((ip>>16)&0xFF); - dst->ip[2] = (unsigned char)((ip>>8)&0xFF); - dst->ip[3] = (unsigned char)(ip&0xFF); -} - -int net_addr_comp(const NETADDR *a, const NETADDR *b) -{ - return mem_comp(a, b, sizeof(NETADDR)); -} - -void net_addr_str(const NETADDR *addr, char *string, int max_length) -{ - if(addr->type == NETTYPE_IPV4) - str_format(string, max_length, "%d.%d.%d.%d:%d", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3], addr->port); - else if(addr->type == NETTYPE_IPV6) - { - str_format(string, max_length, "[%x:%x:%x:%x:%x:%x:%x:%x]:%d", - (addr->ip[0]<<8)|addr->ip[1], (addr->ip[2]<<8)|addr->ip[3], (addr->ip[4]<<8)|addr->ip[5], (addr->ip[6]<<8)|addr->ip[7], - (addr->ip[8]<<8)|addr->ip[9], (addr->ip[10]<<8)|addr->ip[11], (addr->ip[12]<<8)|addr->ip[13], (addr->ip[14]<<8)|addr->ip[15], - addr->port); - } - else - str_format(string, max_length, "unknown type %d", addr->type); -} - -int net_host_lookup(const char *hostname, NETADDR *addr, int types) -{ - /* TODO: IPv6 support */ - struct addrinfo hints; - struct addrinfo *result; - int e; - - mem_zero(&hints, sizeof(hints)); - hints.ai_family = AF_INET; - - e = getaddrinfo(hostname, NULL, &hints, &result); - if(e != 0 || !result) - return -1; - - sockaddr_to_netaddr(result->ai_addr, addr); - freeaddrinfo(result); - addr->port = 0; - return 0; -} - -static int parse_int(int *out, const char **str) -{ - int i = 0; - *out = 0; - if(**str < '0' || **str > '9') - return -1; - - i = **str - '0'; - (*str)++; - - while(1) - { - if(**str < '0' || **str > '9') - { - *out = i; - return 0; - } - - i = (i*10) + (**str - '0'); - (*str)++; - } - - return 0; -} - -static int parse_char(char c, const char **str) -{ - if(**str != c) return -1; - (*str)++; - return 0; -} - -static int parse_uint8(unsigned char *out, const char **str) -{ - int i; - if(parse_int(&i, str) != 0) return -1; - if(i < 0 || i > 0xff) return -1; - *out = i; - return 0; -} - -static int parse_uint16(unsigned short *out, const char **str) -{ - int i; - if(parse_int(&i, str) != 0) return -1; - if(i < 0 || i > 0xffff) return -1; - *out = i; - return 0; -} - -int net_addr_from_str(NETADDR *addr, const char *string) -{ - const char *str = string; - mem_zero(addr, sizeof(NETADDR)); - - if(str[0] == '[') - { - /* TODO: ipv6 */ - } - else - { - /* ipv4 */ - if(parse_uint8(&addr->ip[0], &str)) return -1; - if(parse_char('.', &str)) return -1; - if(parse_uint8(&addr->ip[1], &str)) return -1; - if(parse_char('.', &str)) return -1; - if(parse_uint8(&addr->ip[2], &str)) return -1; - if(parse_char('.', &str)) return -1; - if(parse_uint8(&addr->ip[3], &str)) return -1; - if(*str == ':') - { - str++; - if(parse_uint16(&addr->port, &str)) return -1; - } - - addr->type = NETTYPE_IPV4; - } - - return 0; -} - - -NETSOCKET net_udp_create(NETADDR bindaddr) -{ - /* TODO: IPv6 support */ - struct sockaddr addr; - unsigned int mode = 1; - int broadcast = 1; - - /* create socket */ - int sock = socket(AF_INET, SOCK_DGRAM, 0); - if(sock < 0) - return NETSOCKET_INVALID; - - /* bind, we should check for error */ - netaddr_to_sockaddr(&bindaddr, &addr); - if(bind(sock, &addr, sizeof(addr)) != 0) - { - net_udp_close(sock); - return NETSOCKET_INVALID; - } - - /* set non-blocking */ -#if defined(CONF_FAMILY_WINDOWS) - ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); -#else - ioctl(sock, FIONBIO, (unsigned long *)&mode); -#endif - - /* set boardcast */ - setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); - - /* return */ - return sock; -} - -int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size) -{ - struct sockaddr sa; - int d; - mem_zero(&sa, sizeof(sa)); - netaddr_to_sockaddr(addr, &sa); - d = sendto((int)sock, (const char*)data, size, 0, &sa, sizeof(sa)); - /*if(d < 0) - { - char addrstr[256]; - net_addr_str(addr, addrstr, sizeof(addrstr)); - - dbg_msg("net", "sendto error %d %x", d, d); - dbg_msg("net", "\tsock = %d %x", sock, sock); - dbg_msg("net", "\tsize = %d %x", size, size); - dbg_msg("net", "\taddr = %s", addrstr); - - }*/ - network_stats.sent_bytes += size; - network_stats.sent_packets++; - return d; -} - -int net_udp_recv(NETSOCKET sock, NETADDR *addr, void *data, int maxsize) -{ - struct sockaddr from; - int bytes; - socklen_t fromlen = sizeof(struct sockaddr); - bytes = recvfrom(sock, (char*)data, maxsize, 0, &from, &fromlen); - if(bytes > 0) - { - sockaddr_to_netaddr(&from, addr); - network_stats.recv_bytes += bytes; - network_stats.recv_packets++; - return bytes; - } - else if(bytes == 0) - return 0; - return -1; /* error */ -} - -int net_udp_close(NETSOCKET sock) -{ -#if defined(CONF_FAMILY_WINDOWS) - closesocket(sock); -#else - close((int)sock); -#endif - return 0; -} - -NETSOCKET net_tcp_create(const NETADDR *a) -{ - /* TODO: IPv6 support */ - struct sockaddr addr; - - /* create socket */ - int sock = socket(AF_INET, SOCK_STREAM, 0); - if(sock < 0) - return NETSOCKET_INVALID; - - /* bind, we should check for error */ - netaddr_to_sockaddr(a, &addr); - bind(sock, &addr, sizeof(addr)); - - /* return */ - return sock; -} - -int net_tcp_set_non_blocking(NETSOCKET sock) -{ - unsigned int mode = 1; -#if defined(CONF_FAMILY_WINDOWS) - return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); -#else - return ioctl(sock, FIONBIO, (unsigned long *)&mode); -#endif -} - -int net_tcp_set_blocking(NETSOCKET sock) -{ - unsigned int mode = 0; -#if defined(CONF_FAMILY_WINDOWS) - return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); -#else - return ioctl(sock, FIONBIO, (unsigned long *)&mode); -#endif -} - -int net_tcp_listen(NETSOCKET sock, int backlog) -{ - return listen(sock, backlog); -} - -int net_tcp_accept(NETSOCKET sock, NETSOCKET *new_sock, NETADDR *a) -{ - int s; - socklen_t sockaddr_len; - struct sockaddr addr; - - sockaddr_len = sizeof(addr); - - s = accept(sock, &addr, &sockaddr_len); - - if (s != -1) - { - sockaddr_to_netaddr(&addr, a); - *new_sock = s; - } - return s; -} - -int net_tcp_connect(NETSOCKET sock, const NETADDR *a) -{ - struct sockaddr addr; - - netaddr_to_sockaddr(a, &addr); - return connect(sock, &addr, sizeof(addr)); -} - -int net_tcp_connect_non_blocking(NETSOCKET sock, const NETADDR *a) -{ - struct sockaddr addr; - int res; - - netaddr_to_sockaddr(a, &addr); - net_tcp_set_non_blocking(sock); - res = connect(sock, &addr, sizeof(addr)); - net_tcp_set_blocking(sock); - - return res; -} - -int net_tcp_send(NETSOCKET sock, const void *data, int size) -{ - int d; - d = send((int)sock, (const char*)data, size, 0); - return d; -} - -int net_tcp_recv(NETSOCKET sock, void *data, int maxsize) -{ - int bytes; - bytes = recv((int)sock, (char*)data, maxsize, 0); - return bytes; -} - -int net_tcp_close(NETSOCKET sock) -{ -#if defined(CONF_FAMILY_WINDOWS) - closesocket(sock); -#else - close((int)sock); -#endif - return 0; -} - -int net_errno() -{ - return errno; -} - -int net_would_block() -{ - return net_errno() == EWOULDBLOCK; -} - -int net_init() -{ -#if defined(CONF_FAMILY_WINDOWS) - WSADATA wsaData; - int err = WSAStartup(MAKEWORD(1, 1), &wsaData); - dbg_assert(err == 0, "network initialization failed."); - return err==0?0:1; -#endif - - return 0; -} - -int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, void *user) -{ -#if defined(CONF_FAMILY_WINDOWS) - WIN32_FIND_DATA finddata; - HANDLE handle; - char buffer[1024*2]; - str_format(buffer, sizeof(buffer), "%s/*", dir); - - handle = FindFirstFileA(buffer, &finddata); - - if (handle == INVALID_HANDLE_VALUE) - return 0; - - /* add all the entries */ - do - { - if(finddata.cFileName[0] != '.') - cb(finddata.cFileName, 0, user); - } while (FindNextFileA(handle, &finddata)); - - FindClose(handle); - return 0; -#else - struct dirent *entry; - DIR *d = opendir(dir); - - if(!d) - return 0; - - while((entry = readdir(d)) != NULL) - cb(entry->d_name, 0, user); - - /* close the directory and return */ - closedir(d); - return 0; -#endif -} - -int fs_storage_path(const char *appname, char *path, int max) -{ -#if defined(CONF_FAMILY_WINDOWS) - HRESULT r; - char *home = getenv("APPDATA"); - if(!home) - return -1; - _snprintf(path, max, "%s/%s", home, appname); - return 0; -#else - char *home = getenv("HOME"); -#if !defined(CONF_PLATFORM_MACOSX) - int i; -#endif - if(!home) - return -1; - -#if defined(CONF_PLATFORM_MACOSX) - snprintf(path, max, "%s/Library/Application Support/%s", home, appname); -#else - snprintf(path, max, "%s/.%s", home, appname); - for(i = strlen(home)+2; path[i]; i++) - path[i] = tolower(path[i]); -#endif - - return 0; -#endif -} - -int fs_makedir(const char *path) -{ -#if defined(CONF_FAMILY_WINDOWS) - if(_mkdir(path) == 0) - return 0; - if(errno == EEXIST) - return 0; - return -1; -#else - if(mkdir(path, 0755) == 0) - return 0; - if(errno == EEXIST) - return 0; - return -1; -#endif -} - -int fs_is_dir(const char *path) -{ -#if defined(CONF_FAMILY_WINDOWS) - /* TODO: do this smarter */ - WIN32_FIND_DATA finddata; - HANDLE handle; - char buffer[1024*2]; - str_format(buffer, sizeof(buffer), "%s/*", path); - - if ((handle = FindFirstFileA(buffer, &finddata)) == INVALID_HANDLE_VALUE) - return 0; - - FindClose(handle); - return 1; -#else - struct stat sb; - if (stat(path, &sb) == -1) - return 0; - - if (S_ISDIR(sb.st_mode)) - return 1; - else - return 0; -#endif -} - -int fs_chdir(const char *path) -{ - if (fs_is_dir(path)) - { - chdir(path); - return 0; - } - else - return 1; -} - -void swap_endian(void *data, unsigned elem_size, unsigned num) -{ - char *src = (char*) data; - char *dst = src + (elem_size - 1); - - while(num) - { - unsigned n = elem_size>>1; - char tmp; - while(n) - { - tmp = *src; - *src = *dst; - *dst = tmp; - - src++; - dst--; - n--; - } - - src = src + (elem_size>>1); - dst = src + (elem_size - 1); - num--; - } -} - -int net_socket_read_wait(NETSOCKET sock, int time) -{ - struct timeval tv; - fd_set readfds; - - tv.tv_sec = 0; - tv.tv_usec = 1000*time; - - FD_ZERO(&readfds); - FD_SET(sock, &readfds); - - /* don't care about writefds and exceptfds */ - select(sock+1, &readfds, NULL, NULL, &tv); - if(FD_ISSET(sock, &readfds)) - return 1; - return 0; -} - -unsigned time_timestamp() -{ - return time(0); -} - -void str_append(char *dst, const char *src, int dst_size) -{ - int s = strlen(dst); - int i = 0; - while(s < dst_size) - { - dst[s] = src[i]; - if(!src[i]) /* check for null termination */ - break; - s++; - i++; - } - - dst[dst_size-1] = 0; /* assure null termination */ -} - -void str_copy(char *dst, const char *src, int dst_size) -{ - strncpy(dst, src, dst_size); - dst[dst_size-1] = 0; /* assure null termination */ -} - -int str_length(const char *str) -{ - return (int)strlen(str); -} - -void str_format(char *buffer, int buffer_size, const char *format, ...) -{ -#if defined(CONF_FAMILY_WINDOWS) - va_list ap; - va_start(ap, format); - _vsnprintf(buffer, buffer_size, format, ap); - va_end(ap); -#else - va_list ap; - va_start(ap, format); - vsnprintf(buffer, buffer_size, format, ap); - va_end(ap); -#endif - - buffer[buffer_size-1] = 0; /* assure null termination */ -} - - - -/* makes sure that the string only contains the characters between 32 and 127 */ -void str_sanitize_strong(char *str_in) -{ - unsigned char *str = (unsigned char *)str_in; - while(*str) - { - *str &= 0x7f; - if(*str < 32) - *str = 32; - str++; - } -} - -/* makes sure that the string only contains the characters between 32 and 255 + \r\n\t */ -void str_sanitize(char *str_in) -{ - unsigned char *str = (unsigned char *)str_in; - while(*str) - { - if(*str < 32 && !(*str == '\r') && !(*str == '\n') && !(*str == '\t')) - *str = ' '; - str++; - } -} - -/* case */ -int str_comp_nocase(const char *a, const char *b) -{ -#if defined(CONF_FAMILY_WINDOWS) - return _stricmp(a,b); -#else - return strcasecmp(a,b); -#endif -} - -const char *str_find_nocase(const char *haystack, const char *needle) -{ - while(*haystack) /* native implementation */ - { - const char *a = haystack; - const char *b = needle; - while(*a && *b && tolower(*a) == tolower(*b)) - { - a++; - b++; - } - if(!(*b)) - return haystack; - haystack++; - } - - return 0; -} - -void str_hex(char *dst, int dst_size, const void *data, int data_size) -{ - static const char hex[] = "0123456789ABCDEF"; - int b; - - for(b = 0; b < data_size && b < dst_size/4-4; b++) - { - dst[b*3] = hex[((const unsigned char *)data)[b]>>4]; - dst[b*3+1] = hex[((const unsigned char *)data)[b]&0xf]; - dst[b*3+2] = ' '; - dst[b*3+3] = 0; - } -} - -int mem_comp(const void *a, const void *b, int size) -{ - return memcmp(a,b,size); -} - -const MEMSTATS *mem_stats() -{ - return &memory_stats; -} - -void net_stats(NETSTATS *stats_inout) -{ - *stats_inout = network_stats; -} - -void gui_messagebox(const char *title, const char *message) -{ -#if defined(CONF_PLATFORM_MACOSX) - DialogRef theItem; - DialogItemIndex itemIndex; - - /* FIXME: really needed? can we rely on glfw? */ - /* HACK - get events without a bundle */ - ProcessSerialNumber psn; - GetCurrentProcess(&psn); - TransformProcessType(&psn,kProcessTransformToForegroundApplication); - SetFrontProcess(&psn); - /* END HACK */ - - CreateStandardAlert(kAlertStopAlert, - CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII), - CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII), - NULL, - &theItem); - - RunStandardAlert(theItem, NULL, &itemIndex); -#elif defined(CONF_FAMILY_UNIX) - static char cmd[1024]; - /* use xmessage which is available on nearly every X11 system */ - snprintf(cmd, sizeof(cmd), "xmessage -center -title '%s' '%s'", - title, - message); - - system(cmd); -#elif defined(CONF_FAMILY_WINDOWS) - MessageBox(NULL, - message, - title, - MB_ICONEXCLAMATION | MB_OK); -#else - /* this is not critical */ - #warning not implemented -#endif -} - -int str_isspace(char c) { return c == ' ' || c == '\n' || c == '\t'; } - - -#if defined(__cplusplus) -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/base/system.h b/project/jni/application/teeworlds-0.5.2/src/base/system.h deleted file mode 100644 index 3aa01cab6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/base/system.h +++ /dev/null @@ -1,954 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -/* - Title: OS Abstraction -*/ - -#ifndef BASE_SYSTEM_H -#define BASE_SYSTEM_H - -#include "detect.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Group: Debug */ -/* - Function: dbg_assert - Breaks into the debugger based on a test. - - Parameters: - test - Result of the test. - msg - Message that should be printed if the test fails. - - Remarks: - Does nothing in release version of the library. - - See Also: - -*/ -void dbg_assert(int test, const char *msg); -#define dbg_assert(test,msg) dbg_assert_imp(__FILE__, __LINE__, test, msg) -void dbg_assert_imp(const char *filename, int line, int test, const char *msg); - -/* - Function: dbg_break - Breaks into the debugger. - - Remarks: - Does nothing in release version of the library. - - See Also: - -*/ -void dbg_break(); - -/* - Function: dbg_msg - - Prints a debug message. - - Parameters: - sys - A string that describes what system the message belongs to - fmt - A printf styled format string. - - Remarks: - Does nothing in relase version of the library. - - See Also: - -*/ -void dbg_msg(const char *sys, const char *fmt, ...); - -/* Group: Memory */ - -/* - Function: mem_alloc - Allocates memory. - - Parameters: - size - Size of the needed block. - alignment - Alignment for the block. - - Returns: - Returns a pointer to the newly allocated block. Returns a - null pointer if the memory couldn't be allocated. - - Remarks: - - Passing 0 to size will allocated the smallest amount possible - and return a unique pointer. - - See Also: - -*/ -void *mem_alloc_debug(const char *filename, int line, unsigned size, unsigned alignment); -#define mem_alloc(s,a) mem_alloc_debug(__FILE__, __LINE__, (s), (a)) - -/* - Function: mem_free - Frees a block allocated through . - - Remarks: - - In the debug version of the library the function will assert if - a non-valid block is passed, like a null pointer or a block that - isn't allocated. - - See Also: - -*/ -void mem_free(void *block); - -/* - Function: mem_copy - Copies a a memory block. - - Parameters: - dest - Destination. - source - Source to copy. - size - Size of the block to copy. - - Remarks: - - This functions DOES NOT handles cases where source and - destination is overlapping. - - See Also: - -*/ -void mem_copy(void *dest, const void *source, unsigned size); - -/* - Function: mem_move - Copies a a memory block - - Parameters: - dest - Destination - source - Source to copy - size - Size of the block to copy - - Remarks: - - This functions handles cases where source and destination - is overlapping - - See Also: - -*/ -void mem_move(void *dest, const void *source, unsigned size); - -/* - Function: mem_zero - Sets a complete memory block to 0 - - Parameters: - block - Pointer to the block to zero out - size - Size of the block -*/ -void mem_zero(void *block, unsigned size); - -/* - Function: mem_comp - Compares two blocks of memory - - Parameters: - a - First block of data - b - Second block of data - size - Size of the data to compare - - Returns: - <0 - Block a is lesser then block b - 0 - Block a is equal to block b - >0 - Block a is greater then block b -*/ -int mem_comp(const void *a, const void *b, int size); - -/* - Function: mem_check - Validates the heap - Will trigger a assert if memory has failed. -*/ -int mem_check_imp(); -#define mem_check() dbg_assert_imp(__FILE__, __LINE__, mem_check_imp(), "Memory check failed") - -/* Group: File IO */ -enum { - IOFLAG_READ = 1, - IOFLAG_WRITE = 2, - IOFLAG_RANDOM = 4, - - IOSEEK_START = 0, - IOSEEK_CUR = 1, - IOSEEK_END = 2 -}; - -typedef struct IOINTERNAL *IOHANDLE; - -/* - Function: io_open - Opens a file. - - Parameters: - filename - File to open. - flags - A set of flags. IOFLAG_READ, IOFLAG_WRITE, IOFLAG_RANDOM. - - Returns: - Returns a handle to the file on success and 0 on failure. - -*/ -IOHANDLE io_open(const char *filename, int flags); - -/* - Function: io_read - Reads data into a buffer from a file. - - Parameters: - io - Handle to the file to read data from. - buffer - Pointer to the buffer that will recive the data. - size - Number of bytes to read from the file. - - Returns: - Number of bytes read. - -*/ -unsigned io_read(IOHANDLE io, void *buffer, unsigned size); - -/* - Function: io_skip - Skips data in a file. - - Parameters: - io - Handle to the file. - size - Number of bytes to skip. - - Returns: - Number of bytes skipped. -*/ -unsigned io_skip(IOHANDLE io, unsigned size); - -/* - Function: io_write - Writes data from a buffer to file. - - Parameters: - io - Handle to the file. - buffer - Pointer to the data that should be written. - size - Number of bytes to write. - - Returns: - Number of bytes written. -*/ -unsigned io_write(IOHANDLE io, const void *buffer, unsigned size); - -/* - Function: io_seek - Seeks to a specified offset in the file. - - Parameters: - io - Handle to the file. - offset - Offset from pos to stop. - origin - Position to start searching from. - - Returns: - Returns 0 on success. -*/ -int io_seek(IOHANDLE io, int offset, int origin); - -/* - Function: io_tell - Gets the current position in the file. - - Parameters: - io - Handle to the file. - - Returns: - Returns the current position. -1L if an error occured. -*/ -long int io_tell(IOHANDLE io); - -/* - Function: io_length - Gets the total length of the file. Resetting cursor to the beginning - - Parameters: - io - Handle to the file. - - Returns: - Returns the total size. -1L if an error occured. -*/ -long int io_length(IOHANDLE io); - -/* - Function: io_close - Closes a file. - - Parameters: - io - Handle to the file. - - Returns: - Returns 0 on success. -*/ -int io_close(IOHANDLE io); - -/* - Function: io_flush - Empties all buffers and writes all pending data. - - Parameters: - io - Handle to the file. - - Returns: - Returns 0 on success. -*/ -int io_flush(IOHANDLE io); - - -/* - Function: io_stdin - Returns an to the standard input. -*/ -IOHANDLE io_stdin(); - -/* - Function: io_stdout - Returns an to the standard output. -*/ -IOHANDLE io_stdout(); - -/* - Function: io_stderr - Returns an to the standard error. -*/ -IOHANDLE io_stderr(); - - -/* Group: Threads */ - -/* - Function: thread_sleep - Suspends the current thread for a given period. - - Parameters: - milliseconds - Number of milliseconds to sleep. -*/ -void thread_sleep(int milliseconds); - -/* - Function: thread_create - Creates a new thread. - - Parameters: - threadfunc - Entry point for the new thread. - user - Pointer to pass to the thread. - -*/ -void *thread_create(void (*threadfunc)(void *), void *user); - -/* - Function: thread_wait - Waits for a thread to be done or destroyed. - - Parameters: - thread - Thread to wait for. -*/ -void thread_wait(void *thread); - -/* - Function: thread_destoy - Destroys a thread. - - Parameters: - thread - Thread to destroy. -*/ -void thread_destroy(void *thread); - -/* - Function: thread_yeild - Yeild the current threads execution slice. -*/ -void thread_yield(); - - -/* Group: Locks */ -typedef void* LOCK; - -LOCK lock_create(); -void lock_destroy(LOCK lock); - -int lock_try(LOCK lock); -void lock_wait(LOCK lock); -void lock_release(LOCK lock); - -/* Group: Timer */ -#ifdef __GNUC__ -/* if compiled with -pedantic-errors it will complain about long - not being a C90 thing. -*/ -__extension__ typedef long long int64; -#else -typedef long long int64; -#endif -/* - Function: time_get - Fetches a sample from a high resolution timer. - - Returns: - Current value of the timer. - - Remarks: - To know how fast the timer is ticking, see . -*/ -int64 time_get(); - -/* - Function: time_freq - Returns the frequency of the high resolution timer. - - Returns: - Returns the frequency of the high resolution timer. -*/ -int64 time_freq(); - -/* - Function: time_timestamp - Retrives the current time as a UNIX timestamp - - Returns: - The time as a UNIX timestamp -*/ -unsigned time_timestamp(); - -/* Group: Network General */ -typedef int NETSOCKET; -enum -{ - NETSOCKET_INVALID = -1, - - NETTYPE_INVALID = 0, - NETTYPE_IPV4 = 1, - NETTYPE_IPV6 = 2, - NETTYPE_ALL = ~0 -}; - -typedef struct -{ - unsigned int type; - unsigned char ip[16]; - unsigned short port; -} NETADDR; - -/* - Function: net_init - Initiates network functionallity. - - Returns: - Returns 0 on success, - - Remarks: - You must call this function before using any other network - functions. -*/ -int net_init(); - -/* - Function: net_host_lookup - Does a hostname lookup by name and fills out the passed - NETADDR struct with the recieved details. - - Returns: - 0 on success. -*/ -int net_host_lookup(const char *hostname, NETADDR *addr, int types); - -/* - Function: net_addr_comp - Compares two network addresses. - - Parameters: - a - Address to compare - b - Address to compare to. - - Returns: - <0 - Address a is lesser then address b - 0 - Address a is equal to address b - >0 - Address a is greater then address b -*/ -int net_addr_comp(const NETADDR *a, const NETADDR *b); - -/* - Function: net_addr_str - Turns a network address into a representive string. - - Parameters: - addr - Address to turn into a string. - string - Buffer to fill with the string. - max_length - Maximum size of the string. - - Remarks: - - The string will always be zero terminated - -*/ -void net_addr_str(const NETADDR *addr, char *string, int max_length); - -/* - Function: net_addr_from_str - Turns string into a network address. - - Returns: - 0 on success - - Parameters: - addr - Address to fill in. - string - String to parse. -*/ -int net_addr_from_str(NETADDR *addr, const char *string); - -/* Group: Network UDP */ - -/* - Function: net_udp_create - Creates a UDP socket and binds it to a port. - - Parameters: - bindaddr - Address to bind the socket to. - - Returns: - On success it returns an handle to the socket. On failure it - returns NETSOCKET_INVALID. -*/ -NETSOCKET net_udp_create(NETADDR bindaddr); - -/* - Function: net_udp_send - Sends a packet over an UDP socket. - - Parameters: - sock - Socket to use. - addr - Where to send the packet. - data - Pointer to the packet data to send. - size - Size of the packet. - - Returns: - On success it returns the number of bytes sent. Returns -1 - on error. -*/ -int net_udp_send(NETSOCKET sock, const NETADDR *addr, const void *data, int size); - -/* - Function: net_udp_recv - Recives a packet over an UDP socket. - - Parameters: - sock - Socket to use. - addr - Pointer to an NETADDR that will recive the address. - data - Pointer to a buffer that will recive the data. - maxsize - Maximum size to recive. - - Returns: - On success it returns the number of bytes recived. Returns -1 - on error. -*/ -int net_udp_recv(NETSOCKET sock, NETADDR *addr, void *data, int maxsize); - -/* - Function: net_udp_close - Closes an UDP socket. - - Parameters: - sock - Socket to close. - - Returns: - Returns 0 on success. -1 on error. -*/ -int net_udp_close(NETSOCKET sock); - - -/* Group: Network TCP */ - -/* - Function: net_tcp_create - Creates a TCP socket. - - Parameters: - bindaddr - Address to bind the socket to. - - Returns: - On success it returns an handle to the socket. On failure it returns NETSOCKET_INVALID. -*/ -NETSOCKET net_tcp_create(const NETADDR *a); - -/* - Function: net_tcp_listen - Makes the socket start listening for new connections. - - Parameters: - sock - Socket to start listen to. - backlog - Size of the queue of incomming connections to keep. - - Returns: - Returns 0 on success. -*/ -int net_tcp_listen(NETSOCKET sock, int backlog); - -/* - Function: net_tcp_accept - Polls a listning socket for a new connection. - - Parameters: - sock - Listning socket to poll. - new_sock - Pointer to a socket to fill in with the new socket. - addr - Pointer to an address that will be filled in the remote address (optional, can be NULL). - - Returns: - Returns a non-negative integer on success. Negative integer on failure. -*/ -int net_tcp_accept(NETSOCKET sock, NETSOCKET *new_sock, NETADDR *addr); - -/* - Function: net_tcp_connect - Connects one socket to another. - - Parameters: - sock - Socket to connect. - addr - Address to connect to. - - Returns: - Returns 0 on success. - -*/ -int net_tcp_connect(NETSOCKET sock, const NETADDR *addr); - -/* - Function: net_tcp_send - Sends data to a TCP stream. - - Parameters: - sock - Socket to send data to. - data - Pointer to the data to send. - size - Size of the data to send. - - Returns: - Number of bytes sent. Negative value on failure. -*/ -int net_tcp_send(NETSOCKET sock, const void *data, int size); - -/* - Function: net_tcp_recv - Recvives data from a TCP stream. - - Parameters: - sock - Socket to recvive data from. - data - Pointer to a buffer to write the data to - max_size - Maximum of data to write to the buffer. - - Returns: - Number of bytes recvived. Negative value on failure. When in - non-blocking mode, it returns 0 when there is no more data to - be fetched. -*/ -int net_tcp_recv(NETSOCKET sock, void *data, int maxsize); - -/* - Function: net_tcp_close - Closes a TCP socket. - - Parameters: - sock - Socket to close. - - Returns: - Returns 0 on success. Negative value on failure. -*/ -int net_tcp_close(NETSOCKET sock); - -/* Group: Strings */ - -/* - Function: str_append - Appends a string to another. - - Parameters: - dst - Pointer to a buffer that contains a string. - src - String to append. - dst_size - Size of the buffer of the dst string. - - Remarks: - - The strings are treated as zero-termineted strings. - - Garantees that dst string will contain zero-termination. -*/ -void str_append(char *dst, const char *src, int dst_size); - -/* - Function: str_copy - Copies a string to another. - - Parameters: - dst - Pointer to a buffer that shall recive the string. - src - String to be copied. - dst_size - Size of the buffer dst. - - Remarks: - - The strings are treated as zero-termineted strings. - - Garantees that dst string will contain zero-termination. -*/ -void str_copy(char *dst, const char *src, int dst_size); - -/* - Function: str_length - Returns the length of a zero terminated string. - - Parameters: - str - Pointer to the string. - - Returns: - Length of string in bytes excluding the zero termination. -*/ -int str_length(const char *str); - -/* - Function: str_format - Performs printf formating into a buffer. - - Parameters: - buffer - Pointer to the buffer to recive the formated string. - buffer_size - Size of the buffer. - format - printf formating string. - ... - Parameters for the formating. - - Remarks: - - See the C manual for syntax for the printf formating string. - - The strings are treated as zero-termineted strings. - - Garantees that dst string will contain zero-termination. -*/ -void str_format(char *buffer, int buffer_size, const char *format, ...); - -/* - Function: str_sanitize_strong - Replaces all characters below 32 and above 127 with whitespace. - - Parameters: - str - String to sanitize. - - Remarks: - - The strings are treated as zero-termineted strings. -*/ -void str_sanitize_strong(char *str); - -/* - Function: str_sanitize - Replaces all characters below 32 and above 127 with whitespace with - exception to \r, \n and \r. - - Parameters: - str - String to sanitize. - - Remarks: - - The strings are treated as zero-termineted strings. -*/ -void str_sanitize(char *str); - -/* - Function: str_comp_nocase - Compares to strings case insensitive. - - Parameters: - a - String to compare. - b - String to compare. - - Returns: - <0 - String a is lesser then string b - 0 - String a is equal to string b - >0 - String a is greater then string b - - Remarks: - - Only garanted to work with a-z/A-Z. - - The strings are treated as zero-termineted strings. -*/ -int str_comp_nocase(const char *a, const char *b); - -/* - Function: str_find_nocase - Finds a string inside another string case insensitive. - - Parameters: - haystack - String to search in - needle - String to search for - - Returns: - A pointer into haystack where the needle was found. - Returns NULL of needle could not be found. - - Remarks: - - Only garanted to work with a-z/A-Z. - - The strings are treated as zero-termineted strings. -*/ -const char *str_find_nocase(const char *haystack, const char *needle); - - -/* - Function: str_hex - Takes a datablock and generates a hexstring of it. - - Parameters: - dst - Buffer to fill with hex data - dst_size - size of the buffer - data - Data to turn into hex - data - Size of the data - - Remarks: - - The desination buffer will be zero-terminated -*/ -void str_hex(char *dst, int dst_size, const void *data, int data_size); - -/* Group: Filesystem */ - -/* - Function: fs_listdir - Lists the files in a directory - - Parameters: - dir - Directory to list - cb - Callback function to call for each entry - user - Pointer to give to the callback - - Returns: - Always returns 0. -*/ -typedef void (*FS_LISTDIR_CALLBACK)(const char *name, int is_dir, void *user); -int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, void *user); - -/* - Function: fs_makedir - Creates a directory - - Parameters: - path - Directory to create - - Returns: - Returns 0 on success. Negative value on failure. - - Remarks: - Does not create several directories if needed. "a/b/c" will result - in a failure if b or a does not exist. -*/ -int fs_makedir(const char *path); - -/* - Function: fs_storage_path - Fetches per user configuration directory. - - Returns: - Returns 0 on success. Negative value on failure. - - Remarks: - - Returns ~/.appname on UNIX based systems - - Returns ~/Library/Applications Support/appname on Mac OS X - - Returns %APPDATA%/Appname on Windows based systems -*/ -int fs_storage_path(const char *appname, char *path, int max); - -/* - Function: fs_is_dir - Checks if directory exists - - Returns: - Returns 1 on success, 0 on failure. -*/ -int fs_is_dir(const char *path); - -/* - Function: fs_chdir - Changes current working directory - - Returns: - Returns 0 on success, 1 on failure. -*/ -int fs_chdir(const char *path); - -/* - Group: Undocumented -*/ - - -/* - Function: net_tcp_connect_non_blocking - - DOCTODO: serp -*/ -int net_tcp_connect_non_blocking(NETSOCKET sock, const NETADDR *a); - -/* - Function: net_tcp_set_non_blocking - - DOCTODO: serp -*/ -int net_tcp_set_non_blocking(NETSOCKET sock); - -/* - Function: net_tcp_set_non_blocking - - DOCTODO: serp -*/ -int net_tcp_set_blocking(NETSOCKET sock); - -/* - Function: net_errno - - DOCTODO: serp -*/ -int net_errno(); - -/* - Function: net_would_block - - DOCTODO: serp -*/ -int net_would_block(); - -int net_socket_read_wait(NETSOCKET sock, int time); - -void mem_debug_dump(); - -void swap_endian(void *data, unsigned elem_size, unsigned num); - -typedef void (*DBG_LOGGER)(const char *line); -void dbg_logger(DBG_LOGGER logger); -void dbg_logger_stdout(); -void dbg_logger_debugger(); -void dbg_logger_file(const char *filename); - -typedef struct -{ - int allocated; - int active_allocations; - int total_allocations; -} MEMSTATS; - -const MEMSTATS *mem_stats(); - -typedef struct -{ - int sent_packets; - int sent_bytes; - int recv_packets; - int recv_bytes; -} NETSTATS; - - -void net_stats(NETSTATS *stats); - -int str_isspace(char c); - - -/* - Function: gui_messagebox - Display plain OS-dependent message box - - Parameters: - title - title of the message box - message - text to display -*/ -void gui_messagebox(const char *title, const char *message); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/base/vmath.hpp b/project/jni/application/teeworlds-0.5.2/src/base/vmath.hpp deleted file mode 100644 index 49dd26d1d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/base/vmath.hpp +++ /dev/null @@ -1,196 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef BASE_VMATH_H -#define BASE_VMATH_H - -// ------------------------------------ - -template -class vector2_base -{ -public: - union { T x,u; }; - union { T y,v; }; - - vector2_base() {} - vector2_base(float nx, float ny) - { - x = nx; - y = ny; - } - - vector2_base operator -() const { return vector2_base(-x, -y); } - vector2_base operator -(const vector2_base &v) const { return vector2_base(x-v.x, y-v.y); } - vector2_base operator +(const vector2_base &v) const { return vector2_base(x+v.x, y+v.y); } - vector2_base operator *(const T v) const { return vector2_base(x*v, y*v); } - - const vector2_base &operator =(const vector2_base &v) { x = v.x; y = v.y; return *this; } - - const vector2_base &operator +=(const vector2_base &v) { x += v.x; y += v.y; return *this; } - const vector2_base &operator -=(const vector2_base &v) { x -= v.x; y -= v.y; return *this; } - const vector2_base &operator *=(const T v) { x *= v; y *= v; return *this; } - - bool operator ==(const vector2_base &v) const { return x == v.x && y == v.y; } //TODO: do this with an eps instead - - operator const T* () { return &x; } -}; - - -template -inline T length(const vector2_base &a) -{ - return sqrtf(a.x*a.x + a.y*a.y); -} - -template -inline T distance(const vector2_base a, const vector2_base &b) -{ - return length(a-b); -} - -template -inline T dot(const vector2_base a, const vector2_base &b) -{ - return a.x*b.x + a.y*b.y; -} - -template -inline vector2_base normalize(const vector2_base &v) -{ - T l = (T)(1.0f/sqrtf(v.x*v.x + v.y*v.y)); - return vector2_base(v.x*l, v.y*l); -} - -typedef vector2_base vec2; -typedef vector2_base bvec2; -typedef vector2_base ivec2; - -template -inline vector2_base closest_point_on_line(vector2_base line_point0, vector2_base line_point1, vector2_base target_point) -{ - vector2_base c = target_point - line_point0; - vector2_base v = (line_point1 - line_point0); - v = normalize(v); - T d = length(line_point0-line_point1); - T t = dot(v, c)/d; - return mix(line_point0, line_point1, clamp(t, (T)0, (T)1)); - /* - if (t < 0) t = 0; - if (t > 1.0f) return 1.0f; - return t;*/ -} - -// ------------------------------------ -template -class vector3_base -{ -public: - union { T x,r,h; }; - union { T y,g,s; }; - union { T z,b,v,l; }; - - vector3_base() {} - vector3_base(float nx, float ny, float nz) - { - x = nx; - y = ny; - z = nz; - } - - const vector3_base &operator =(const vector3_base &v) { x = v.x; y = v.y; z = v.z; return *this; } - - vector3_base operator -(const vector3_base &v) const { return vector3_base(x-v.x, y-v.y, z-v.z); } - vector3_base operator -() const { return vector3_base(-x, -y, -z); } - vector3_base operator +(const vector3_base &v) const { return vector3_base(x+v.x, y+v.y, z+v.z); } - vector3_base operator *(const T v) const { return vector3_base(x*v, y*v, z*v); } - vector3_base operator *(const vector3_base &v) const { return vector3_base(x*v.x, y*v.y, z*v.z); } - vector3_base operator /(const T v) const { return vector3_base(x/v, y/v, z/v); } - - const vector3_base &operator +=(const vector3_base &v) { x += v.x; y += v.y; z += v.z; return *this; } - const vector3_base &operator -=(const vector3_base &v) { x -= v.x; y -= v.y; z -= v.z; return *this; } - const vector3_base &operator *=(const T v) { x *= v; y *= v; z *= v; return *this; } - - bool operator ==(const vector3_base &v) const { return x == v.x && y == v.y && z == v.z; } //TODO: do this with an eps instead - - operator const T* () { return &x; } -}; - -template -inline T length(const vector3_base &a) -{ - return sqrtf(a.x*a.x + a.y*a.y + a.z*a.z); -} - -template -inline T distance(const vector3_base &a, const vector3_base &b) -{ - return length(a-b); -} - -template -inline T dot(const vector3_base &a, const vector3_base &b) -{ - return a.x*b.x + a.y*b.y + a.z*b.z; -} - -template -inline vector3_base normalize(const vector3_base &v) -{ - T l = (T)(1.0f/sqrtf(v.x*v.x + v.y*v.y + v.z*v.z)); - return vector3_base(v.x*l, v.y*l, v.z*l); -} - -template -inline vector3_base cross(const vector3_base &a, const vector3_base &b) -{ - return vector3_base( - a.y*b.z - a.z*b.y, - a.z*b.x - a.x*b.z, - a.x*b.y - a.y*b.x); -} - -typedef vector3_base vec3; -typedef vector3_base bvec3; -typedef vector3_base ivec3; - -// ------------------------------------ - -template -class vector4_base -{ -public: - union { T x,r; }; - union { T y,g; }; - union { T z,b; }; - union { T w,a; }; - - vector4_base() {} - vector4_base(float nx, float ny, float nz, float nw) - { - x = nx; - y = ny; - z = nz; - w = nw; - } - - vector4_base operator +(const vector4_base &v) const { return vector4_base(x+v.x, y+v.y, z+v.z, w+v.w); } - vector4_base operator -(const vector4_base &v) const { return vector4_base(x-v.x, y-v.y, z-v.z, w-v.w); } - vector4_base operator -() const { return vector4_base(-x, -y, -z, -w); } - vector4_base operator *(const vector4_base &v) const { return vector4_base(x*v.x, y*v.y, z*v.z, w*v.w); } - vector4_base operator *(const T v) const { return vector4_base(x*v, y*v, z*v, w*v); } - - const vector4_base &operator =(const vector4_base &v) { x = v.x; y = v.y; z = v.z; w = v.w; return *this; } - - const vector4_base &operator +=(const vector4_base &v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; } - const vector4_base &operator -=(const vector4_base &v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return *this; } - const vector4_base &operator *=(const T v) { x *= v; y *= v; z *= v; w *= v; return *this; } - - bool operator ==(const vector4_base &v) const { return x == v.x && y == v.y && z == v.z && w == v.w; } //TODO: do this with an eps instead - - operator const T* () { return &x; } -}; - -typedef vector4_base vec4; -typedef vector4_base bvec4; -typedef vector4_base ivec4; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_client.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_client.cpp deleted file mode 100644 index 6dfb87c1f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_client.cpp +++ /dev/null @@ -1,2046 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -const int prediction_margin = 1000/50/2; /* magic network prediction value */ - -/* - Server Time - Client Mirror Time - Client Predicted Time - - Snapshot Latency - Downstream latency - - Prediction Latency - Upstream latency -*/ - -/* network client, must be accessible from other parts like the server browser */ -NETCLIENT *net; - -/* TODO: ugly, fix me */ -extern void client_serverbrowse_set(NETADDR *addr, int request, int token, SERVER_INFO *info); -extern void client_serverbrowse_save(); - -static unsigned snapshot_parts; -static int64 local_start_time; - -static int debug_font; -static float frametime = 0.0001f; -static float frametime_low = 1.0f; -static float frametime_high = 0.0f; -static int frames = 0; -static NETADDR server_address; -static int window_must_refocus = 0; -static int snapcrcerrors = 0; - -static int ack_game_tick = -1; -static int current_recv_tick = 0; -static int rcon_authed = 0; - -/* version-checking */ -static char versionstr[10] = "0"; - -/* pinging */ -static int64 ping_start_time = 0; - -/* */ -static char current_map[256] = {0}; -static int current_map_crc = 0; - -/* */ -static char cmd_connect[256] = {0}; - -/* map download */ -static char mapdownload_filename[256] = {0}; -static char mapdownload_name[256] = {0}; -static IOHANDLE mapdownload_file = 0; -static int mapdownload_chunk = 0; -static int mapdownload_crc = 0; -static int mapdownload_amount = -1; -static int mapdownload_totalsize = -1; - -/* */ -static SERVER_INFO current_server_info = {0}; -static int64 current_server_info_requesttime = -1; /* >= 0 should request, == -1 got info */ - -/* current time */ -static int current_tick = 0; -static float intratick = 0; -static float ticktime = 0; -static int prev_tick = 0; - -/* */ -/*static int predictiontime_pingspikecounter = 0; -static int gametime_pingspikecounter = 0;*/ - -/* predicted time */ -static int current_predtick = 0; -static float predintratick = 0; -static int last_input_timeleft = 0; - -static struct /* TODO: handle input better */ -{ - int data[MAX_INPUT_SIZE]; /* the input data */ - int tick; /* the tick that the input is for */ - int64 predicted_time; /* prediction latency when we sent this input */ - int64 time; -} inputs[200]; -static int current_input = 0; - -enum -{ - GRAPH_MAX=128 -}; - -typedef struct -{ - float min, max; - float values[GRAPH_MAX]; - float colors[GRAPH_MAX][3]; - int index; -} GRAPH; - -static void graph_init(GRAPH *g, float min, float max) -{ - g->min = min; - g->max = max; - g->index = 0; -} - -static void graph_scale_max(GRAPH *g) -{ - int i = 0; - g->max = 0; - for(i = 0; i < GRAPH_MAX; i++) - { - if(g->values[i] > g->max) - g->max = g->values[i]; - } -} - -static void graph_scale_min(GRAPH *g) -{ - int i = 0; - g->min = g->max; - for(i = 0; i < GRAPH_MAX; i++) - { - if(g->values[i] < g->min) - g->min = g->values[i]; - } -} - -static void graph_add(GRAPH *graph, float v, float r, float g, float b) -{ - graph->index = (graph->index+1)&(GRAPH_MAX-1); - graph->values[graph->index] = v; - graph->colors[graph->index][0] = r; - graph->colors[graph->index][1] = g; - graph->colors[graph->index][2] = b; -} - -static void graph_render(GRAPH *g, float x, float y, float w, float h, const char *description) -{ - char buf[32]; - int i; - - gfx_blend_normal(); - - - gfx_texture_set(-1); - - gfx_quads_begin(); - gfx_setcolor(0, 0, 0, 0.75f); - gfx_quads_drawTL(x, y, w, h); - gfx_quads_end(); - - gfx_lines_begin(); - gfx_setcolor(0.95f, 0.95f, 0.95f, 1.00f); - gfx_lines_draw(x, y+h/2, x+w, y+h/2); - gfx_setcolor(0.5f, 0.5f, 0.5f, 0.75f); - gfx_lines_draw(x, y+(h*3)/4, x+w, y+(h*3)/4); - gfx_lines_draw(x, y+h/4, x+w, y+h/4); - for(i = 1; i < GRAPH_MAX; i++) - { - float a0 = (i-1)/(float)GRAPH_MAX; - float a1 = i/(float)GRAPH_MAX; - int i0 = (g->index+i-1)&(GRAPH_MAX-1); - int i1 = (g->index+i)&(GRAPH_MAX-1); - - float v0 = (g->values[i0]-g->min) / (g->max-g->min); - float v1 = (g->values[i1]-g->min) / (g->max-g->min); - - gfx_setcolorvertex(0, g->colors[i0][0], g->colors[i0][1], g->colors[i0][2], 0.75f); - gfx_setcolorvertex(1, g->colors[i1][0], g->colors[i1][1], g->colors[i1][2], 0.75f); - gfx_lines_draw(x+a0*w, y+h-v0*h, x+a1*w, y+h-v1*h); - - } - gfx_lines_end(); - - - gfx_texture_set(debug_font); - gfx_quads_text(x+2, y+h-16, 16, 1,1,1,1, description); - - str_format(buf, sizeof(buf), "%.2f", g->max); - gfx_quads_text(x+w-8*strlen(buf)-8, y+2, 16, 1,1,1,1, buf); - - str_format(buf, sizeof(buf), "%.2f", g->min); - gfx_quads_text(x+w-8*strlen(buf)-8, y+h-16, 16, 1,1,1,1, buf); - -} - -typedef struct -{ - int64 snap; - int64 current; - int64 target; - - int64 rlast; - int64 tlast; - GRAPH graph; - - int spikecounter; - - float adjustspeed[2]; /* 0 = down, 1 = up */ -} SMOOTHTIME; - -static void st_init(SMOOTHTIME *st, int64 target) -{ - st->snap = time_get(); - st->current = target; - st->target = target; - st->adjustspeed[0] = 0.3f; - st->adjustspeed[1] = 0.3f; - graph_init(&st->graph, 0.0f, 0.5f); -} - -static int64 st_get(SMOOTHTIME *st, int64 now) -{ - float adjust_speed, a; - int64 c = st->current + (now - st->snap); - int64 t = st->target + (now - st->snap); - int64 r; - - /* it's faster to adjust upward instead of downward */ - /* we might need to adjust these abit */ - - adjust_speed = st->adjustspeed[0]; - if(t > c) - adjust_speed = st->adjustspeed[1]; - - a = ((now-st->snap)/(float)time_freq()) * adjust_speed; - if(a > 1.0f) - a = 1.0f; - - r = c + (int64)((t-c)*a); - - graph_add(&st->graph, a+0.5f,1,1,1); - - return r; -} - -static void st_update_int(SMOOTHTIME *st, int64 target) -{ - int64 now = time_get(); - st->current = st_get(st, now); - st->snap = now; - st->target = target; -} - -static void st_update(SMOOTHTIME *st, GRAPH *graph, int64 target, int time_left, int adjust_direction) -{ - int update_timer = 1; - - if(time_left < 0) - { - int is_spike = 0; - if(time_left < -50) - { - is_spike = 1; - - st->spikecounter += 5; - if(st->spikecounter > 50) - st->spikecounter = 50; - } - - if(is_spike && st->spikecounter < 15) - { - /* ignore this ping spike */ - update_timer = 0; - graph_add(graph, time_left, 1,1,0); - } - else - { - graph_add(graph, time_left, 1,0,0); - if(st->adjustspeed[adjust_direction] < 30.0f) - st->adjustspeed[adjust_direction] *= 2.0f; - } - } - else - { - if(st->spikecounter) - st->spikecounter--; - - graph_add(graph, time_left, 0,1,0); - - st->adjustspeed[adjust_direction] *= 0.95f; - if(st->adjustspeed[adjust_direction] < 2.0f) - st->adjustspeed[adjust_direction] = 2.0f; - } - - last_input_timeleft = time_left; - - if(update_timer) - st_update_int(st, target); -} - -static SMOOTHTIME game_time; -static SMOOTHTIME predicted_time; - -/* graphs */ -static GRAPH inputtime_margin_graph; -static GRAPH gametime_margin_graph; -static GRAPH fps_graph; - -/* -- snapshot handling --- */ -enum -{ - NUM_SNAPSHOT_TYPES=2 -}; - -/* the game snapshots are modifiable by the game */ -SNAPSTORAGE snapshot_storage; -static SNAPSTORAGE_HOLDER *snapshots[NUM_SNAPSHOT_TYPES]; - -static int recived_snapshots = 0; -static char snapshot_incomming_data[MAX_SNAPSHOT_SIZE]; - -static SNAPSTORAGE_HOLDER demorec_snapshotholders[NUM_SNAPSHOT_TYPES]; -static char *demorec_snapshotdata[NUM_SNAPSHOT_TYPES][2][MAX_SNAPSHOT_SIZE]; - -/* --- */ - -void *snap_get_item(int snapid, int index, SNAP_ITEM *item) -{ - SNAPSHOT_ITEM *i; - dbg_assert(snapid >= 0 && snapid < NUM_SNAPSHOT_TYPES, "invalid snapid"); - i = snapshot_get_item(snapshots[snapid]->alt_snap, index); - item->datasize = snapshot_get_item_datasize(snapshots[snapid]->alt_snap, index); - item->type = snapitem_type(i); - item->id = snapitem_id(i); - return (void *)snapitem_data(i); -} - -void snap_invalidate_item(int snapid, int index) -{ - SNAPSHOT_ITEM *i; - dbg_assert(snapid >= 0 && snapid < NUM_SNAPSHOT_TYPES, "invalid snapid"); - i = snapshot_get_item(snapshots[snapid]->alt_snap, index); - if(i) - { - if((char *)i < (char *)snapshots[snapid]->alt_snap || (char *)i > (char *)snapshots[snapid]->alt_snap + snapshots[snapid]->snap_size) - dbg_msg("ASDFASDFASdf", "ASDFASDFASDF"); - if((char *)i >= (char *)snapshots[snapid]->snap && (char *)i < (char *)snapshots[snapid]->snap + snapshots[snapid]->snap_size) - dbg_msg("ASDFASDFASdf", "ASDFASDFASDF"); - i->type_and_id = -1; - } -} - -void *snap_find_item(int snapid, int type, int id) -{ - /* TODO: linear search. should be fixed. */ - int i; - - if(!snapshots[snapid]) - return 0x0; - - for(i = 0; i < snapshots[snapid]->snap->num_items; i++) - { - SNAPSHOT_ITEM *itm = snapshot_get_item(snapshots[snapid]->alt_snap, i); - if(snapitem_type(itm) == type && snapitem_id(itm) == id) - return (void *)snapitem_data(itm); - } - return 0x0; -} - -int snap_num_items(int snapid) -{ - dbg_assert(snapid >= 0 && snapid < NUM_SNAPSHOT_TYPES, "invalid snapid"); - if(!snapshots[snapid]) - return 0; - return snapshots[snapid]->snap->num_items; -} - -/* ------ time functions ------ */ -float client_intratick() { return intratick; } -float client_predintratick() { return predintratick; } -float client_ticktime() { return ticktime; } -int client_tick() { return current_tick; } -int client_prevtick() { return prev_tick; } -int client_predtick() { return current_predtick; } -int client_tickspeed() { return SERVER_TICK_SPEED; } -float client_frametime() { return frametime; } -float client_localtime() { return (time_get()-local_start_time)/(float)(time_freq()); } - -/* ----- send functions ----- */ -int client_send_msg() -{ - const MSG_INFO *info = msg_get_info(); - NETCHUNK packet; - - if(!info) - return -1; - - mem_zero(&packet, sizeof(NETCHUNK)); - - packet.client_id = 0; - packet.data = info->data; - packet.data_size = info->size; - - if(info->flags&MSGFLAG_VITAL) - packet.flags |= NETSENDFLAG_VITAL; - if(info->flags&MSGFLAG_FLUSH) - packet.flags |= NETSENDFLAG_FLUSH; - - if(info->flags&MSGFLAG_RECORD) - { - if(demorec_isrecording()) - demorec_record_message(packet.data, packet.data_size); - } - - if(!(info->flags&MSGFLAG_NOSEND)) - netclient_send(net, &packet); - return 0; -} - -static void client_send_info() -{ - msg_pack_start_system(NETMSG_INFO, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_string(modc_net_version(), 128); - msg_pack_string(config.player_name, 128); - msg_pack_string(config.clan_name, 128); - msg_pack_string(config.password, 128); - msg_pack_end(); - client_send_msg(); -} - - -static void client_send_entergame() -{ - msg_pack_start_system(NETMSG_ENTERGAME, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_end(); - client_send_msg(); -} - -static void client_send_ready() -{ - msg_pack_start_system(NETMSG_READY, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_end(); - client_send_msg(); -} - -int client_rcon_authed() -{ - return rcon_authed; -} - -void client_rcon_auth(const char *name, const char *password) -{ - msg_pack_start_system(NETMSG_RCON_AUTH, MSGFLAG_VITAL); - msg_pack_string(name, 32); - msg_pack_string(password, 32); - msg_pack_end(); - client_send_msg(); -} - -void client_rcon(const char *cmd) -{ - msg_pack_start_system(NETMSG_RCON_CMD, MSGFLAG_VITAL); - msg_pack_string(cmd, 256); - msg_pack_end(); - client_send_msg(); -} - -int client_connection_problems() -{ - return netclient_gotproblems(net); -} - -void client_direct_input(int *input, int size) -{ - int i; - msg_pack_start_system(NETMSG_INPUT, 0); - msg_pack_int(ack_game_tick); - msg_pack_int(current_predtick); - msg_pack_int(size); - - for(i = 0; i < size/4; i++) - msg_pack_int(input[i]); - - msg_pack_end(); - client_send_msg(); -} - - -static void client_send_input() -{ - int64 now = time_get(); - int i, size; - - if(current_predtick <= 0) - return; - - /* fetch input */ - size = modc_snap_input(inputs[current_input].data); - - if(!size) - return; - - /* pack input */ - msg_pack_start_system(NETMSG_INPUT, MSGFLAG_FLUSH); - msg_pack_int(ack_game_tick); - msg_pack_int(current_predtick); - msg_pack_int(size); - - inputs[current_input].tick = current_predtick; - inputs[current_input].predicted_time = st_get(&predicted_time, now); - inputs[current_input].time = now; - - /* pack it */ - for(i = 0; i < size/4; i++) - msg_pack_int(inputs[current_input].data[i]); - - current_input++; - current_input%=200; - - msg_pack_end(); - client_send_msg(); -} - -const char *client_latestversion() -{ - return versionstr; -} - -/* TODO: OPT: do this alot smarter! */ -int *client_get_input(int tick) -{ - int i; - int best = -1; - for(i = 0; i < 200; i++) - { - if(inputs[i].tick <= tick && (best == -1 || inputs[best].tick < inputs[i].tick)) - best = i; - } - - if(best != -1) - return (int *)inputs[best].data; - return 0; -} - -/* ------ state handling ----- */ -static int state = CLIENTSTATE_OFFLINE; -int client_state() { return state; } -static void client_set_state(int s) -{ - int old = state; - if(config.debug) - dbg_msg("client", "state change. last=%d current=%d", state, s); - state = s; - if(old != s) - modc_statechange(state, old); -} - -/* called when the map is loaded and we should init for a new round */ -static void client_on_enter_game() -{ - /* reset input */ - int i; - for(i = 0; i < 200; i++) - inputs[i].tick = -1; - current_input = 0; - - /* reset snapshots */ - snapshots[SNAP_CURRENT] = 0; - snapshots[SNAP_PREV] = 0; - snapstorage_purge_all(&snapshot_storage); - recived_snapshots = 0; - snapshot_parts = 0; - current_predtick = 0; - current_recv_tick = 0; -} - -void client_entergame() -{ - /* now we will wait for two snapshots */ - /* to finish the connection */ - client_send_entergame(); - client_on_enter_game(); - /*netclient_flush(net);*/ -} - -void client_connect(const char *server_address_str) -{ - char buf[512]; - const char *port_str = 0; - int k; - int port = 8303; - - client_disconnect(); - - dbg_msg("client", "connecting to '%s'", server_address_str); - - //client_serverinfo_request(); - str_copy(buf, server_address_str, sizeof(buf)); - - for(k = 0; buf[k]; k++) - { - if(buf[k] == ':') - { - port_str = &(buf[k+1]); - buf[k] = 0; - break; - } - } - - if(port_str) - port = atoi(port_str); - - /* TODO: IPv6 support */ - if(net_host_lookup(buf, &server_address, NETTYPE_IPV4) != 0) - dbg_msg("client", "could not find the address of %s, connecting to localhost", buf); - - rcon_authed = 0; - server_address.port = port; - netclient_connect(net, &server_address); - client_set_state(CLIENTSTATE_CONNECTING); - - graph_init(&inputtime_margin_graph, -150.0f, 150.0f); - graph_init(&gametime_margin_graph, -150.0f, 150.0f); -} - -void client_disconnect_with_reason(const char *reason) -{ - /* stop demo playback */ - demorec_playback_stop(); - - /* */ - rcon_authed = 0; - netclient_disconnect(net, reason); - client_set_state(CLIENTSTATE_OFFLINE); - map_unload(); - - /* disable all downloads */ - mapdownload_chunk = 0; - if(mapdownload_file) - io_close(mapdownload_file); - mapdownload_file = 0; - mapdownload_crc = 0; - mapdownload_totalsize = -1; - mapdownload_amount = 0; - - /* clear the current server info */ - mem_zero(¤t_server_info, sizeof(current_server_info)); - mem_zero(&server_address, sizeof(server_address)); - - /* clear snapshots */ - snapshots[SNAP_CURRENT] = 0; - snapshots[SNAP_PREV] = 0; - recived_snapshots = 0; -} - -void client_disconnect() -{ - client_disconnect_with_reason(0); -} - - -void client_serverinfo(SERVER_INFO *serverinfo) -{ - mem_copy(serverinfo, ¤t_server_info, sizeof(current_server_info)); -} - -void client_serverinfo_request() -{ - mem_zero(¤t_server_info, sizeof(current_server_info)); - current_server_info_requesttime = 0; -} - -static int client_load_data() -{ - debug_font = gfx_load_texture("debug_font.png", IMG_AUTO, TEXLOAD_NORESAMPLE); - return 1; -} - -extern int snapshot_data_rate[0xffff]; -extern int snapshot_data_updates[0xffff]; - -extern "C" const char *modc_getitemname(int type); - -static void client_debug_render() -{ - static NETSTATS prev, current; - static int64 last_snap = 0; - static float frametime_avg = 0; - int64 now = time_get(); - char buffer[512]; - - if(!config.debug) - return; - - gfx_blend_normal(); - gfx_texture_set(debug_font); - gfx_mapscreen(0,0,gfx_screenwidth(),gfx_screenheight()); - - if(time_get()-last_snap > time_freq()) - { - last_snap = time_get(); - prev = current; - net_stats(¤t); - } - - /* - eth = 14 - ip = 20 - udp = 8 - total = 42 - */ - frametime_avg = frametime_avg*0.9f + frametime*0.1f; - str_format(buffer, sizeof(buffer), "ticks: %8d %8d mem %dk %d gfxmem: %dk fps: %3d", - current_tick, current_predtick, - mem_stats()->allocated/1024, - mem_stats()->total_allocations, - gfx_memory_usage()/1024, - (int)(1.0f/frametime_avg)); - gfx_quads_text(2, 2, 16, 1,1,1,1, buffer); - - - { - int send_packets = (current.sent_packets-prev.sent_packets); - int send_bytes = (current.sent_bytes-prev.sent_bytes); - int send_total = send_bytes + send_packets*42; - int recv_packets = (current.recv_packets-prev.recv_packets); - int recv_bytes = (current.recv_bytes-prev.recv_bytes); - int recv_total = recv_bytes + recv_packets*42; - - if(!send_packets) send_packets++; - if(!recv_packets) recv_packets++; - str_format(buffer, sizeof(buffer), "send: %3d %5d+%4d=%5d (%3d kbps) avg: %5d\nrecv: %3d %5d+%4d=%5d (%3d kbps) avg: %5d", - send_packets, send_bytes, send_packets*42, send_total, (send_total*8)/1024, send_bytes/send_packets, - recv_packets, recv_bytes, recv_packets*42, recv_total, (recv_total*8)/1024, recv_bytes/recv_packets); - gfx_quads_text(2, 14, 16, 1,1,1,1, buffer); - } - - /* render rates */ - { - int y = 0; - int i; - for(i = 0; i < 256; i++) - { - if(snapshot_data_rate[i]) - { - str_format(buffer, sizeof(buffer), "%4d %20s: %8d %8d %8d", i, modc_getitemname(i), snapshot_data_rate[i]/8, snapshot_data_updates[i], - (snapshot_data_rate[i]/snapshot_data_updates[i])/8); - gfx_quads_text(2, 100+y*12, 16, 1,1,1,1, buffer); - y++; - } - } - } - - str_format(buffer, sizeof(buffer), "pred: %d ms %3.2f", - (int)((st_get(&predicted_time, now)-st_get(&game_time, now))*1000/(float)time_freq()), - predicted_time.adjustspeed[1]); - gfx_quads_text(2, 70, 16, 1,1,1,1, buffer); - - /* render graphs */ - if(config.dbg_graphs) - { - //gfx_mapscreen(0,0,400.0f,300.0f); - float w = gfx_screenwidth()/4.0f; - float h = gfx_screenheight()/6.0f; - float sp = gfx_screenwidth()/100.0f; - float x = gfx_screenwidth()-w-sp; - - graph_scale_max(&fps_graph); - graph_scale_min(&fps_graph); - graph_render(&fps_graph, x, sp*5, w, h, "FPS"); - graph_render(&inputtime_margin_graph, x, sp*5+h+sp, w, h, "Prediction Margin"); - graph_render(&gametime_margin_graph, x, sp*5+h+sp+h+sp, w, h, "Gametime Margin"); - } -} - -void client_quit() -{ - client_set_state(CLIENTSTATE_QUITING); -} - -const char *client_error_string() -{ - return netclient_error_string(net); -} - -static void client_render() -{ - if(config.gfx_clear) - gfx_clear(1,1,0); - - modc_render(); - client_debug_render(); -} - -static const char *client_load_map(const char *name, const char *filename, int wanted_crc) -{ - static char errormsg[128]; - DATAFILE *df; - int crc; - - client_set_state(CLIENTSTATE_LOADING); - - df = datafile_load(filename); - if(!df) - { - str_format(errormsg, sizeof(errormsg), "map '%s' not found", filename); - return errormsg; - } - - /* get the crc of the map */ - crc = datafile_crc(filename); - if(crc != wanted_crc) - { - datafile_unload(df); - str_format(errormsg, sizeof(errormsg), "map differs from the server. %08x != %08x", crc, wanted_crc); - return errormsg; - } - - // stop demo recording if we loaded a new map - demorec_record_stop(); - - dbg_msg("client", "loaded map '%s'", filename); - recived_snapshots = 0; - map_set(df); - - str_copy(current_map, name, sizeof(current_map)); - current_map_crc = crc; - - return NULL; -} - -static const char *client_load_map_search(const char *mapname, int wanted_crc) -{ - const char *error = 0; - char buf[512]; - dbg_msg("client", "loading map, map=%s wanted crc=%08x", mapname, wanted_crc); - client_set_state(CLIENTSTATE_LOADING); - - /* try the normal maps folder */ - str_format(buf, sizeof(buf), "maps/%s.map", mapname); - error = client_load_map(mapname, buf, wanted_crc); - if(!error) - return error; - - /* try the downloaded maps */ - str_format(buf, sizeof(buf), "downloadedmaps/%s_%08x.map", mapname, wanted_crc); - error = client_load_map(mapname, buf, wanted_crc); - return error; -} - -static int player_score_comp(const void *a, const void *b) -{ - SERVER_INFO_PLAYER *p0 = (SERVER_INFO_PLAYER *)a; - SERVER_INFO_PLAYER *p1 = (SERVER_INFO_PLAYER *)b; - if(p0->score == p1->score) - return 0; - if(p0->score < p1->score) - return 1; - return -1; -} - -static void client_process_packet(NETCHUNK *packet) -{ - if(packet->client_id == -1) - { - /* connectionlesss */ - if(packet->data_size == (int)(sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)) && - memcmp(packet->data, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION)) == 0) - { - unsigned char *versiondata = (unsigned char*) packet->data + sizeof(VERSIONSRV_VERSION); - int version_match = !memcmp(versiondata, VERSION_DATA, sizeof(VERSION_DATA)); - - dbg_msg("client/version", "version does %s (%d.%d.%d)", - version_match ? "match" : "NOT match", - versiondata[1], versiondata[2], versiondata[3]); - - /* assume version is out of date when version-data doesn't match */ - if (!version_match) - { - sprintf(versionstr, "%d.%d.%d", versiondata[1], versiondata[2], versiondata[3]); - } - } - - if(packet->data_size >= (int)sizeof(SERVERBROWSE_LIST) && - memcmp(packet->data, SERVERBROWSE_LIST, sizeof(SERVERBROWSE_LIST)) == 0) - { - int size = packet->data_size-sizeof(SERVERBROWSE_LIST); - int num = size/sizeof(MASTERSRV_ADDR); - MASTERSRV_ADDR *addrs = (MASTERSRV_ADDR *)((char*)packet->data+sizeof(SERVERBROWSE_LIST)); - int i; - - for(i = 0; i < num; i++) - { - NETADDR addr; - - /* convert address */ - mem_zero(&addr, sizeof(addr)); - addr.type = NETTYPE_IPV4; - addr.ip[0] = addrs[i].ip[0]; - addr.ip[1] = addrs[i].ip[1]; - addr.ip[2] = addrs[i].ip[2]; - addr.ip[3] = addrs[i].ip[3]; - addr.port = (addrs[i].port[1]<<8) | addrs[i].port[0]; - - client_serverbrowse_set(&addr, BROWSESET_MASTER_ADD, -1, NULL); - } - } - - { - int packet_type = 0; - if(packet->data_size >= (int)sizeof(SERVERBROWSE_INFO) && memcmp(packet->data, SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO)) == 0) - packet_type = 2; - - if(packet->data_size >= (int)sizeof(SERVERBROWSE_OLD_INFO) && memcmp(packet->data, SERVERBROWSE_OLD_INFO, sizeof(SERVERBROWSE_OLD_INFO)) == 0) - packet_type = 1; - - if(packet_type) - { - /* we got ze info */ - UNPACKER up; - SERVER_INFO info = {0}; - int i; - int token = -1; - - unpacker_reset(&up, (unsigned char*)packet->data+sizeof(SERVERBROWSE_INFO), packet->data_size-sizeof(SERVERBROWSE_INFO)); - if(packet_type >= 2) - token = atol(unpacker_get_string(&up)); - str_copy(info.version, unpacker_get_string(&up), sizeof(info.version)); - str_copy(info.name, unpacker_get_string(&up), sizeof(info.name)); - str_copy(info.map, unpacker_get_string(&up), sizeof(info.map)); - str_copy(info.gametype, unpacker_get_string(&up), sizeof(info.gametype)); - info.flags = atol(unpacker_get_string(&up)); - info.progression = atol(unpacker_get_string(&up)); - info.num_players = atol(unpacker_get_string(&up)); - info.max_players = atol(unpacker_get_string(&up)); - str_format(info.address, sizeof(info.address), "%d.%d.%d.%d:%d", - packet->address.ip[0], packet->address.ip[1], packet->address.ip[2], - packet->address.ip[3], packet->address.port); - - for(i = 0; i < info.num_players; i++) - { - str_copy(info.players[i].name, unpacker_get_string(&up), sizeof(info.players[i].name)); - info.players[i].score = atol(unpacker_get_string(&up)); - } - - if(!up.error) - { - /* sort players */ - qsort(info.players, info.num_players, sizeof(*info.players), player_score_comp); - - if(net_addr_comp(&server_address, &packet->address) == 0) - { - mem_copy(¤t_server_info, &info, sizeof(current_server_info)); - current_server_info.netaddr = server_address; - current_server_info_requesttime = -1; - } - else - { - if(packet_type == 2) - client_serverbrowse_set(&packet->address, BROWSESET_TOKEN, token, &info); - else - client_serverbrowse_set(&packet->address, BROWSESET_OLD_INTERNET, -1, &info); - } - } - } - } - } - else - { - int sys; - int msg = msg_unpack_start(packet->data, packet->data_size, &sys); - - if(sys) - { - /* system message */ - if(msg == NETMSG_MAP_CHANGE) - { - const char *map = msg_unpack_string(); - int map_crc = msg_unpack_int(); - const char *error = 0; - int i; - - if(msg_unpack_error()) - return; - - for(i = 0; map[i]; i++) /* protect the player from nasty map names */ - { - if(map[i] == '/' || map[i] == '\\') - error = "strange character in map name"; - } - - if(error) - client_disconnect_with_reason(error); - else - { - error = client_load_map_search(map, map_crc); - - if(!error) - { - dbg_msg("client/network", "loading done"); - client_send_ready(); - modc_connected(); - } - else - { - str_format(mapdownload_filename, sizeof(mapdownload_filename), "downloadedmaps/%s_%08x.map", map, map_crc); - - dbg_msg("client/network", "starting to download map to '%s'", mapdownload_filename); - - mapdownload_chunk = 0; - str_copy(mapdownload_name, map, sizeof(mapdownload_name)); - mapdownload_file = engine_openfile(mapdownload_filename, IOFLAG_WRITE); - mapdownload_crc = map_crc; - mapdownload_totalsize = -1; - mapdownload_amount = 0; - - msg_pack_start_system(NETMSG_REQUEST_MAP_DATA, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_int(mapdownload_chunk); - msg_pack_end(); - client_send_msg(); - - if(config.debug) - dbg_msg("client/network", "requested chunk %d", mapdownload_chunk); - } - } - } - else if(msg == NETMSG_MAP_DATA) - { - int last = msg_unpack_int(); - int total_size = msg_unpack_int(); - int size = msg_unpack_int(); - const unsigned char *data = msg_unpack_raw(size); - - /* check fior errors */ - if(msg_unpack_error() || size <= 0 || total_size <= 0 || !mapdownload_file) - return; - - io_write(mapdownload_file, data, size); - - mapdownload_totalsize = total_size; - mapdownload_amount += size; - - if(last) - { - const char *error; - dbg_msg("client/network", "download complete, loading map"); - - io_close(mapdownload_file); - mapdownload_file = 0; - mapdownload_amount = 0; - mapdownload_totalsize = -1; - - /* load map */ - error = client_load_map(mapdownload_name, mapdownload_filename, mapdownload_crc); - if(!error) - { - dbg_msg("client/network", "loading done"); - client_send_ready(); - modc_connected(); - } - else - client_disconnect_with_reason(error); - } - else - { - /* request new chunk */ - mapdownload_chunk++; - msg_pack_start_system(NETMSG_REQUEST_MAP_DATA, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_int(mapdownload_chunk); - msg_pack_end(); - client_send_msg(); - - if(config.debug) - dbg_msg("client/network", "requested chunk %d", mapdownload_chunk); - } - } - else if(msg == NETMSG_PING) - { - msg_pack_start_system(NETMSG_PING_REPLY, 0); - msg_pack_end(); - client_send_msg(); - } - else if(msg == NETMSG_RCON_AUTH_STATUS) - { - int result = msg_unpack_int(); - if(msg_unpack_error() == 0) - rcon_authed = result; - } - else if(msg == NETMSG_RCON_LINE) - { - const char *line = msg_unpack_string(); - if(msg_unpack_error() == 0) - { - /*dbg_msg("remote", "%s", line);*/ - modc_rcon_line(line); - } - } - else if(msg == NETMSG_PING_REPLY) - dbg_msg("client/network", "latency %.2f", (time_get() - ping_start_time)*1000 / (float)time_freq()); - else if(msg == NETMSG_INPUTTIMING) - { - int input_predtick = msg_unpack_int(); - int time_left = msg_unpack_int(); - - /* adjust our prediction time */ - int k; - int64 target = 0; - for(k = 0; k < 200; k++) - { - if(inputs[k].tick == input_predtick) - { - target = inputs[k].predicted_time + (time_get() - inputs[k].time); - target = target - (int64)(((time_left-prediction_margin)/1000.0f)*time_freq()); - //st_update(&predicted_time, ); - break; - } - } - - if(target) - st_update(&predicted_time, &inputtime_margin_graph, target, time_left, 1); - } - else if(msg == NETMSG_SNAP || msg == NETMSG_SNAPSINGLE || msg == NETMSG_SNAPEMPTY) - { - /*dbg_msg("client/network", "got snapshot"); */ - int num_parts = 1; - int part = 0; - int game_tick = msg_unpack_int(); - int delta_tick = game_tick-msg_unpack_int(); - int part_size = 0; - int crc = 0; - int complete_size = 0; - const char *data = 0; - - /* we are not allowed to process snapshot yet */ - if(client_state() < CLIENTSTATE_LOADING) - return; - - if(msg == NETMSG_SNAP) - { - num_parts = msg_unpack_int(); - part = msg_unpack_int(); - } - - if(msg != NETMSG_SNAPEMPTY) - { - crc = msg_unpack_int(); - part_size = msg_unpack_int(); - } - - data = (const char *)msg_unpack_raw(part_size); - - if(msg_unpack_error()) - return; - - if(game_tick >= current_recv_tick) - { - if(game_tick != current_recv_tick) - { - snapshot_parts = 0; - current_recv_tick = game_tick; - } - - /* TODO: clean this up abit */ - mem_copy((char*)snapshot_incomming_data + part*MAX_SNAPSHOT_PACKSIZE, data, part_size); - snapshot_parts |= 1<= 0) - { - int deltashot_size = snapstorage_get(&snapshot_storage, delta_tick, 0, &deltashot, 0); - - if(deltashot_size < 0) - { - /* couldn't find the delta snapshots that the server used */ - /* to compress this snapshot. force the server to resync */ - if(config.debug) - dbg_msg("client", "error, couldn't find the delta snapshot"); - - /* ack snapshot */ - /* TODO: combine this with the input message */ - ack_game_tick = -1; - return; - } - } - - /* decompress snapshot */ - deltadata = snapshot_empty_delta(); - deltasize = sizeof(int)*3; - - if(complete_size) - { - int intsize = intpack_decompress(snapshot_incomming_data, complete_size, tmpbuffer2); - - if(intsize < 0) /* failure during decompression, bail */ - return; - - deltadata = tmpbuffer2; - deltasize = intsize; - } - - /* unpack delta */ - purgetick = delta_tick; - snapsize = snapshot_unpack_delta(deltashot, (SNAPSHOT*)tmpbuffer3, deltadata, deltasize); - if(snapsize < 0) - { - dbg_msg("client", "delta unpack failed!"); - return; - } - - if(msg != NETMSG_SNAPEMPTY && snapshot_crc((SNAPSHOT*)tmpbuffer3) != crc) - { - if(config.debug) - { - dbg_msg("client", "snapshot crc error #%d - tick=%d wantedcrc=%d gotcrc=%d compressed_size=%d delta_tick=%d", - snapcrcerrors, game_tick, crc, snapshot_crc((SNAPSHOT*)tmpbuffer3), complete_size, delta_tick); - } - - snapcrcerrors++; - if(snapcrcerrors > 10) - { - /* to many errors, send reset */ - ack_game_tick = -1; - client_send_input(); - snapcrcerrors = 0; - } - return; - } - else - { - if(snapcrcerrors) - snapcrcerrors--; - } - - /* purge old snapshots */ - purgetick = delta_tick; - if(snapshots[SNAP_PREV] && snapshots[SNAP_PREV]->tick < purgetick) - purgetick = snapshots[SNAP_PREV]->tick; - if(snapshots[SNAP_CURRENT] && snapshots[SNAP_CURRENT]->tick < purgetick) - purgetick = snapshots[SNAP_PREV]->tick; - snapstorage_purge_until(&snapshot_storage, purgetick); - - /* add new */ - snapstorage_add(&snapshot_storage, game_tick, time_get(), snapsize, (SNAPSHOT*)tmpbuffer3, 1); - - /* add snapshot to demo */ - if(demorec_isrecording()) - { - - /* write tick marker */ - /* - DEMOREC_TICKMARKER marker; - marker.tick = game_tick; - swap_endian(&marker, sizeof(int), sizeof(marker)/sizeof(int)); - demorec_record_write("TICK", sizeof(marker), &marker); - demorec_record_write("SNAP", snapsize, tmpbuffer3); - */ - - /* write snapshot */ - demorec_record_snapshot(game_tick, tmpbuffer3, snapsize); - } - - /* apply snapshot, cycle pointers */ - recived_snapshots++; - - current_recv_tick = game_tick; - - /* we got two snapshots until we see us self as connected */ - if(recived_snapshots == 2) - { - /* start at 200ms and work from there */ - st_init(&predicted_time, game_tick*time_freq()/50); - predicted_time.adjustspeed[1] = 1000.0f; - st_init(&game_time, (game_tick-1)*time_freq()/50); - snapshots[SNAP_PREV] = snapshot_storage.first; - snapshots[SNAP_CURRENT] = snapshot_storage.last; - local_start_time = time_get(); - client_set_state(CLIENTSTATE_ONLINE); - } - - /* adjust game time */ - { - int64 now = st_get(&game_time, time_get()); - int64 tickstart = game_tick*time_freq()/50; - int64 time_left = (tickstart-now)*1000 / time_freq(); - /*st_update(&game_time, (game_tick-1)*time_freq()/50);*/ - st_update(&game_time, &gametime_margin_graph, (game_tick-1)*time_freq()/50, time_left, 0); - } - - /* ack snapshot */ - ack_game_tick = game_tick; - } - } - } - } - else - { - /* game message */ - if(demorec_isrecording()) - demorec_record_message(packet->data, packet->data_size); - /* demorec_record_write("MESG", packet->data_size, ); */ - - modc_message(msg); - } - } -} - -int client_mapdownload_amount() { return mapdownload_amount; } -int client_mapdownload_totalsize() { return mapdownload_totalsize; } - -static void client_pump_network() -{ - NETCHUNK packet; - - netclient_update(net); - - if(client_state() != CLIENTSTATE_DEMOPLAYBACK) - { - /* check for errors */ - if(client_state() != CLIENTSTATE_OFFLINE && netclient_state(net) == NETSTATE_OFFLINE) - { - client_set_state(CLIENTSTATE_OFFLINE); - client_disconnect(); - dbg_msg("client", "offline error='%s'", netclient_error_string(net)); - } - - /* */ - if(client_state() == CLIENTSTATE_CONNECTING && netclient_state(net) == NETSTATE_ONLINE) - { - /* we switched to online */ - dbg_msg("client", "connected, sending info"); - client_set_state(CLIENTSTATE_LOADING); - client_send_info(); - } - } - - /* process packets */ - while(netclient_recv(net, &packet)) - client_process_packet(&packet); -} - -static void client_democallback_snapshot(void *data, int size) -{ - /* update ticks, they could have changed */ - const DEMOREC_PLAYBACKINFO *info = demorec_playback_info(); - SNAPSTORAGE_HOLDER *temp; - current_tick = info->current_tick; - prev_tick = info->previous_tick; - - /* handle snapshots */ - temp = snapshots[SNAP_PREV]; - snapshots[SNAP_PREV] = snapshots[SNAP_CURRENT]; - snapshots[SNAP_CURRENT] = temp; - - mem_copy(snapshots[SNAP_CURRENT]->snap, data, size); - mem_copy(snapshots[SNAP_CURRENT]->alt_snap, data, size); - - modc_newsnapshot(); - /*modc_predict();*/ -} - -static void client_democallback_message(void *data, int size) -{ - int sys = 0; - int msg = msg_unpack_start(data, size, &sys); - if(!sys) - modc_message(msg); -} - - -const DEMOPLAYBACK_INFO *client_demoplayer_getinfo() -{ - static DEMOPLAYBACK_INFO ret; - const DEMOREC_PLAYBACKINFO *info = demorec_playback_info(); - ret.first_tick = info->first_tick; - ret.last_tick = info->last_tick; - ret.current_tick = info->current_tick; - ret.paused = info->paused; - ret.speed = info->speed; - return &ret; -} - -void client_demoplayer_setpos(float percent) -{ - demorec_playback_set(percent); -} - -void client_demoplayer_setspeed(float speed) -{ - demorec_playback_setspeed(speed); -} - -void client_demoplayer_setpause(int paused) -{ - if(paused) - demorec_playback_pause(); - else - demorec_playback_unpause(); -} - -static void client_update() -{ - if(client_state() == CLIENTSTATE_DEMOPLAYBACK) - { - demorec_playback_update(); - if(demorec_isplaying()) - { - /* update timers */ - const DEMOREC_PLAYBACKINFO *info = demorec_playback_info(); - current_tick = info->current_tick; - prev_tick = info->previous_tick; - intratick = info->intratick; - ticktime = info->ticktime; - } - else - { - /* disconnect on error */ - client_disconnect(); - } - } - else if(client_state() != CLIENTSTATE_OFFLINE && recived_snapshots >= 3) - { - /* switch snapshot */ - int repredict = 0; - int64 freq = time_freq(); - int64 now = st_get(&game_time, time_get()); - int64 pred_now = st_get(&predicted_time, time_get()); - - while(1) - { - SNAPSTORAGE_HOLDER *cur = snapshots[SNAP_CURRENT]; - int64 tickstart = (cur->tick)*time_freq()/50; - - if(tickstart < now) - { - SNAPSTORAGE_HOLDER *next = snapshots[SNAP_CURRENT]->next; - if(next) - { - snapshots[SNAP_PREV] = snapshots[SNAP_CURRENT]; - snapshots[SNAP_CURRENT] = next; - - /* set ticks */ - current_tick = snapshots[SNAP_CURRENT]->tick; - prev_tick = snapshots[SNAP_PREV]->tick; - - if(snapshots[SNAP_CURRENT] && snapshots[SNAP_PREV]) - { - modc_newsnapshot(); - repredict = 1; - } - } - else - break; - } - else - break; - } - - if(snapshots[SNAP_CURRENT] && snapshots[SNAP_PREV]) - { - int64 curtick_start = (snapshots[SNAP_CURRENT]->tick)*time_freq()/50; - int64 prevtick_start = (snapshots[SNAP_PREV]->tick)*time_freq()/50; - /*tg_add(&predicted_time_graph, pred_now, 0); */ - int prev_pred_tick = (int)(pred_now*50/time_freq()); - int new_pred_tick = prev_pred_tick+1; - static float last_predintra = 0; - - intratick = (now - prevtick_start) / (float)(curtick_start-prevtick_start); - ticktime = (now - prevtick_start) / (float)freq; /*(float)SERVER_TICK_SPEED);*/ - - curtick_start = new_pred_tick*time_freq()/50; - prevtick_start = prev_pred_tick*time_freq()/50; - predintratick = (pred_now - prevtick_start) / (float)(curtick_start-prevtick_start); - - if(new_pred_tick < snapshots[SNAP_PREV]->tick-SERVER_TICK_SPEED || new_pred_tick > snapshots[SNAP_PREV]->tick+SERVER_TICK_SPEED) - { - dbg_msg("client", "prediction time reset!"); - st_init(&predicted_time, snapshots[SNAP_CURRENT]->tick*time_freq()/50); - } - - if(new_pred_tick > current_predtick) - { - last_predintra = predintratick; - current_predtick = new_pred_tick; - repredict = 1; - - /* send input */ - client_send_input(); - } - - last_predintra = predintratick; - } - - /* only do sane predictions */ - if(repredict) - { - if(current_predtick > current_tick && current_predtick < current_tick+50) - modc_predict(); - } - - /* fetch server info if we don't have it */ - if(client_state() >= CLIENTSTATE_LOADING && - current_server_info_requesttime >= 0 && - time_get() > current_server_info_requesttime) - { - client_serverbrowse_request(&server_address); - current_server_info_requesttime = time_get()+time_freq()*2; - } - } - - /* STRESS TEST: join the server again */ - if(config.dbg_stress) - { - static int64 action_taken = 0; - int64 now = time_get(); - if(client_state() == CLIENTSTATE_OFFLINE) - { - if(now > action_taken+time_freq()*2) - { - dbg_msg("stress", "reconnecting!"); - client_connect(config.dbg_stress_server); - action_taken = now; - } - } - else - { - /*if(now > action_taken+time_freq()*(10+config.dbg_stress)) - { - dbg_msg("stress", "disconnecting!"); - client_disconnect(); - action_taken = now; - }*/ - } - } - - /* pump the network */ - client_pump_network(); - - /* update the maser server registry */ - mastersrv_update(); - - /* update the server browser */ - client_serverbrowse_update(); -} - - -static void client_versionupdate() -{ - static int state = 0; - static HOSTLOOKUP version_serveraddr; - - if(state == 0) - { - engine_hostlookup(&version_serveraddr, config.cl_version_server); - state++; - } - else if(state == 1) - { - if(jobs_status(&version_serveraddr.job) == JOBSTATUS_DONE) - { - NETCHUNK packet; - - mem_zero(&packet, sizeof(NETCHUNK)); - - version_serveraddr.addr.port = VERSIONSRV_PORT; - - packet.client_id = -1; - packet.address = version_serveraddr.addr; - packet.data = VERSIONSRV_GETVERSION; - packet.data_size = sizeof(VERSIONSRV_GETVERSION); - packet.flags = NETSENDFLAG_CONNLESS; - - netclient_send(net, &packet); - state++; - } - } -} - -extern "C" int editor_update_and_render(); -extern "C" void editor_init(); - -static void client_run() -{ - NETADDR bindaddr; - int64 reporttime = time_get(); - int64 reportinterval = time_freq()*1; - - static PERFORMACE_INFO rootscope = {"root", 0}; - perf_start(&rootscope); - - local_start_time = time_get(); - snapshot_parts = 0; - - /* init graphics and sound */ - if(gfx_init() != 0) - return; - - /* start refreshing addresses while we load */ - mastersrv_refresh_addresses(); - - /* init the editor */ - editor_init(); - - /* sound is allowed to fail */ - snd_init(); - - /* load data */ - if(!client_load_data()) - return; - - /* init the mod */ - modc_init(); - dbg_msg("client", "version %s", modc_net_version()); - - /* open socket */ - mem_zero(&bindaddr, sizeof(bindaddr)); - net = netclient_open(bindaddr, 0); - - /* connect to the server if wanted */ - /* - if(config.cl_connect[0] != 0) - client_connect(config.cl_connect); - config.cl_connect[0] = 0; - */ - - /* */ - graph_init(&fps_graph, 0.0f, 200.0f); - - /* never start with the editor */ - config.cl_editor = 0; - - inp_mouse_mode_relative(); - - while (1) - { - static PERFORMACE_INFO rootscope = {"root", 0}; - int64 frame_start_time = time_get(); - frames++; - - perf_start(&rootscope); - - /* */ - client_versionupdate(); - - /* handle pending connects */ - if(cmd_connect[0]) - { - client_connect(cmd_connect); - cmd_connect[0] = 0; - } - - /* update input */ - { - static PERFORMACE_INFO scope = {"inp_update", 0}; - perf_start(&scope); - inp_update(); - perf_end(); - } - - /* update sound */ - { - static PERFORMACE_INFO scope = {"snd_update", 0}; - perf_start(&scope); - snd_update(); - perf_end(); - } - - /* release focus */ - if(!gfx_window_active()) - { - if(window_must_refocus == 0) - inp_mouse_mode_absolute(); - window_must_refocus = 1; - } - else if (config.dbg_focus && inp_key_pressed(KEY_ESCAPE)) - { - inp_mouse_mode_absolute(); - window_must_refocus = 1; - } - - /* refocus */ - if(window_must_refocus && gfx_window_active()) - { - if(window_must_refocus < 3) - { - inp_mouse_mode_absolute(); - window_must_refocus++; - } - - if(inp_key_pressed(KEY_MOUSE_1)) - { - inp_mouse_mode_relative(); - window_must_refocus = 0; - } - } - - /* panic quit button */ - if(inp_key_pressed(KEY_LCTRL) && inp_key_pressed(KEY_LSHIFT) && inp_key_pressed('q')) - break; - - if(inp_key_pressed(KEY_LCTRL) && inp_key_pressed(KEY_LSHIFT) && inp_key_down('d')) - config.debug ^= 1; - - if(inp_key_pressed(KEY_LCTRL) && inp_key_pressed(KEY_LSHIFT) && inp_key_down('g')) - config.dbg_graphs ^= 1; - - if(inp_key_pressed(KEY_LCTRL) && inp_key_pressed(KEY_LSHIFT) && inp_key_down('e')) - { - config.cl_editor = config.cl_editor^1; - inp_mouse_mode_relative(); - } - - /* - if(!gfx_window_open()) - break; - */ - - /* render */ - if(config.cl_editor) - { - client_update(); - editor_update_and_render(); - gfx_swap(); - } - else - { - { - static PERFORMACE_INFO scope = {"client_update", 0}; - perf_start(&scope); - client_update(); - perf_end(); - } - - if(config.dbg_stress) - { - if((frames%10) == 0) - { - client_render(); - gfx_swap(); - } - } - else - { - { - static PERFORMACE_INFO scope = {"client_render", 0}; - perf_start(&scope); - client_render(); - perf_end(); - } - - { - static PERFORMACE_INFO scope = {"gfx_swap", 0}; - perf_start(&scope); - gfx_swap(); - perf_end(); - } - } - } - - perf_end(); - - - /* check conditions */ - if(client_state() == CLIENTSTATE_QUITING) - break; - - /* be nice */ - if(config.dbg_stress) - thread_sleep(5); - else if(config.cl_cpu_throttle || !gfx_window_active()) - thread_sleep(1); - - if(config.dbg_hitch) - { - thread_sleep(config.dbg_hitch); - config.dbg_hitch = 0; - } - - if(reporttime < time_get()) - { - if(0 && config.debug) - { - dbg_msg("client/report", "fps=%.02f (%.02f %.02f) netstate=%d", - frames/(float)(reportinterval/time_freq()), - 1.0f/frametime_high, - 1.0f/frametime_low, - netclient_state(net)); - } - frametime_low = 1; - frametime_high = 0; - frames = 0; - reporttime += reportinterval; - perf_next(); - - if(config.dbg_pref) - perf_dump(&rootscope); - } - - /* update frametime */ - frametime = (time_get()-frame_start_time)/(float)time_freq(); - if(frametime < frametime_low) - frametime_low = frametime; - if(frametime > frametime_high) - frametime_high = frametime; - - graph_add(&fps_graph, 1.0f/frametime, 1,1,1); - } - - modc_shutdown(); - client_disconnect(); - - gfx_shutdown(); - snd_shutdown(); -} - -static void con_connect(void *result, void *user_data) -{ - str_copy(cmd_connect, console_arg_string(result, 0), sizeof(cmd_connect)); -} - -static void con_disconnect(void *result, void *user_data) -{ - client_disconnect(); -} - -static void con_quit(void *result, void *user_data) -{ - client_quit(); -} - -static void con_ping(void *result, void *user_data) -{ - msg_pack_start_system(NETMSG_PING, 0); - msg_pack_end(); - client_send_msg(); - ping_start_time = time_get(); -} - -static void con_screenshot(void *result, void *user_data) -{ - gfx_screenshot(); -} - -static void con_rcon(void *result, void *user_data) -{ - client_rcon(console_arg_string(result, 0)); -} - -static void con_rcon_auth(void *result, void *user_data) -{ - client_rcon_auth("", console_arg_string(result, 0)); -} - -static void con_addfavorite(void *result, void *user_data) -{ - NETADDR addr; - if(net_addr_from_str(&addr, console_arg_string(result, 0)) == 0) - client_serverbrowse_addfavorite(addr); -} - -void client_demoplayer_play(const char *filename) -{ - int crc; - client_disconnect(); - netclient_error_string_reset(net); - - /* try to start playback */ - demorec_playback_registercallbacks(client_democallback_snapshot, client_democallback_message); - - if(demorec_playback_load(filename)) - return; - - /* load map */ - crc = (demorec_playback_info()->header.crc[0]<<24)| - (demorec_playback_info()->header.crc[1]<<16)| - (demorec_playback_info()->header.crc[2]<<8)| - (demorec_playback_info()->header.crc[3]); - client_load_map_search(demorec_playback_info()->header.map, crc); - modc_connected(); - - /* setup buffers */ - mem_zero(demorec_snapshotdata, sizeof(demorec_snapshotdata)); - - snapshots[SNAP_CURRENT] = &demorec_snapshotholders[SNAP_CURRENT]; - snapshots[SNAP_PREV] = &demorec_snapshotholders[SNAP_PREV]; - - snapshots[SNAP_CURRENT]->snap = (SNAPSHOT *)demorec_snapshotdata[SNAP_CURRENT][0]; - snapshots[SNAP_CURRENT]->alt_snap = (SNAPSHOT *)demorec_snapshotdata[SNAP_CURRENT][1]; - snapshots[SNAP_CURRENT]->snap_size = 0; - snapshots[SNAP_CURRENT]->tick = -1; - - snapshots[SNAP_PREV]->snap = (SNAPSHOT *)demorec_snapshotdata[SNAP_PREV][0]; - snapshots[SNAP_PREV]->alt_snap = (SNAPSHOT *)demorec_snapshotdata[SNAP_PREV][1]; - snapshots[SNAP_PREV]->snap_size = 0; - snapshots[SNAP_PREV]->tick = -1; - - /* enter demo playback state */ - client_set_state(CLIENTSTATE_DEMOPLAYBACK); - - demorec_playback_play(); - modc_entergame(); -} - -static void con_play(void *result, void *user_data) -{ - client_demoplayer_play(console_arg_string(result, 0)); -} - -static void con_record(void *result, void *user_data) -{ - if(state != CLIENTSTATE_ONLINE) - dbg_msg("demorec/record", "client is not online"); - else - { - char filename[512]; - str_format(filename, sizeof(filename), "demos/%s.demo", console_arg_string(result, 0)); - demorec_record_start(filename, modc_net_version(), current_map, current_map_crc, "client"); - } -} - -static void con_stoprecord(void *result, void *user_data) -{ - demorec_record_stop(); -} - -static void con_serverdummy(void *result, void *user_data) -{ - dbg_msg("client", "this command is not available on the client"); -} - -static void client_register_commands() -{ - MACRO_REGISTER_COMMAND("quit", "", CFGFLAG_CLIENT, con_quit, 0x0, "Quit Teeworlds"); - MACRO_REGISTER_COMMAND("exit", "", CFGFLAG_CLIENT, con_quit, 0x0, "Quit Teeworlds"); - MACRO_REGISTER_COMMAND("connect", "s", CFGFLAG_CLIENT, con_connect, 0x0, "Connect to the specified host/ip"); - MACRO_REGISTER_COMMAND("disconnect", "", CFGFLAG_CLIENT, con_disconnect, 0x0, "Disconnect from the server"); - MACRO_REGISTER_COMMAND("ping", "", CFGFLAG_CLIENT, con_ping, 0x0, "Ping the current server"); - MACRO_REGISTER_COMMAND("screenshot", "", CFGFLAG_CLIENT, con_screenshot, 0x0, "Take a screenshot"); - MACRO_REGISTER_COMMAND("rcon", "r", CFGFLAG_CLIENT, con_rcon, 0x0, "Send specified command to rcon"); - MACRO_REGISTER_COMMAND("rcon_auth", "s", CFGFLAG_CLIENT, con_rcon_auth, 0x0, "Authenticate to rcon"); - - MACRO_REGISTER_COMMAND("play", "r", CFGFLAG_CLIENT, con_play, 0x0, "Play the file specified"); - MACRO_REGISTER_COMMAND("record", "s", CFGFLAG_CLIENT, con_record, 0, "Record to the file"); - MACRO_REGISTER_COMMAND("stoprecord", "", CFGFLAG_CLIENT, con_stoprecord, 0, "Stop recording"); - - MACRO_REGISTER_COMMAND("add_favorite", "s", CFGFLAG_CLIENT, con_addfavorite, 0x0, "Add a server as a favorite"); - - /* register server dummy commands for tab completion */ - MACRO_REGISTER_COMMAND("kick", "i", CFGFLAG_SERVER, con_serverdummy, 0, "Kick player with specified id"); - MACRO_REGISTER_COMMAND("ban", "s?i", CFGFLAG_SERVER, con_serverdummy, 0, "Ban player with ip/id for x minutes"); - MACRO_REGISTER_COMMAND("unban", "s", CFGFLAG_SERVER, con_serverdummy, 0, "Unban ip"); - MACRO_REGISTER_COMMAND("bans", "", CFGFLAG_SERVER, con_serverdummy, 0, "Show banlist"); - MACRO_REGISTER_COMMAND("status", "", CFGFLAG_SERVER, con_serverdummy, 0, "List players"); - MACRO_REGISTER_COMMAND("shutdown", "", CFGFLAG_SERVER, con_serverdummy, 0, "Shut down"); - /*MACRO_REGISTER_COMMAND("record", "", CFGFLAG_SERVER, con_serverdummy, 0); - MACRO_REGISTER_COMMAND("stoprecord", "", CFGFLAG_SERVER, con_serverdummy, 0);*/ -} - -void client_save_line(const char *line) -{ - engine_config_write_line(line); -} - -const char *client_user_directory() -{ - static char path[1024] = {0}; - fs_storage_path("Teeworlds", path, sizeof(path)); - return path; -} - -#if defined(CONF_PLATFORM_MACOSX) || defined(ANDROID) -extern "C" int SDL_main(int argc, char **argv) -#else -extern "C" int main(int argc, char **argv) -#endif -{ - /* init the engine */ - dbg_msg("client", "starting..."); - engine_init("Teeworlds"); - - /* register all console commands */ - client_register_commands(); - modc_console_init(); - - /* parse the command line arguments */ - engine_parse_arguments(argc, argv); - - /* execute config file */ - console_execute_file("settings.cfg"); - - /* run the client*/ - client_run(); - - /* write down the config and quit */ - if(engine_config_write_start() == 0) - { - config_save(); - client_serverbrowse_save(); - modc_save_config(); - engine_config_write_stop(); - } - - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.cpp deleted file mode 100644 index f8760d41c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include -#include -#include -#include "ec_font.h" - -typedef struct -{ - short x, y; - short width, height; - short x_offset, y_offset; - short x_advance; -} FONT_CHARACTER; - -typedef struct -{ - short size; - short width, height; - - short line_height; - short base; - - FONT_CHARACTER characters[256]; - - short kerning[256*256]; -} FONT_DATA; - -int font_load(FONT *font, const char *filename) -{ - FONT_DATA font_data; - IOHANDLE file; - - file = engine_openfile(filename, IOFLAG_READ); - - if(file) - { - int i; - - io_read(file, &font_data, sizeof(FONT_DATA)); - io_close(file); - -#if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(&font_data, 2, sizeof(FONT_DATA)/2); -#endif - - { - float scale_factor_x = 1.0f/font_data.size; - float scale_factor_y = 1.0f/font_data.size; - float scale_factor_tex_x = 1.0f/font_data.width; - float scale_factor_tex_y = 1.0f/font_data.height; - - for (i = 0; i < 256; i++) - { - float tex_x0 = font_data.characters[i].x*scale_factor_tex_x; - float tex_y0 = font_data.characters[i].y*scale_factor_tex_y; - float tex_x1 = (font_data.characters[i].x+font_data.characters[i].width)*scale_factor_tex_x; - float tex_y1 = (font_data.characters[i].y+font_data.characters[i].height)*scale_factor_tex_y; - - float width = font_data.characters[i].width*scale_factor_x; - float height = font_data.characters[i].height*scale_factor_y; - float x_offset = font_data.characters[i].x_offset*scale_factor_x; - float y_offset = font_data.characters[i].y_offset*scale_factor_y; - float x_advance = (font_data.characters[i].x_advance)*scale_factor_x; - - font->characters[i].tex_x0 = tex_x0; - font->characters[i].tex_y0 = tex_y0; - font->characters[i].tex_x1 = tex_x1; - font->characters[i].tex_y1 = tex_y1; - font->characters[i].width = width; - font->characters[i].height = height; - font->characters[i].x_offset = x_offset; - font->characters[i].y_offset = y_offset; - font->characters[i].x_advance = x_advance; - - } - - for (i = 0; i < 256*256; i++) - { - font->kerning[i] = (char)font_data.kerning[i]; - } - } - - return 0; - } - else - return -1; -} - -/*int gfx_load_texture(const char *filename, int store_format, int flags); -#define IMG_ALPHA 2*/ - -int font_set_load(FONT_SET *font_set, const char *font_filename, const char *text_texture_filename, const char *outline_texture_filename, int fonts, ...) -{ - int i; - va_list va; - - font_set->font_count = fonts; - - va_start(va, fonts); - for (i = 0; i < fonts; i++) - { - int size; - char composed_font_filename[256]; - char composed_text_texture_filename[256]; - char composed_outline_texture_filename[256]; - FONT *font = &font_set->fonts[i]; - - size = va_arg(va, int); - str_format(composed_font_filename, sizeof(composed_font_filename), font_filename, size); - str_format(composed_text_texture_filename, sizeof(composed_text_texture_filename), text_texture_filename, size); - str_format(composed_outline_texture_filename, sizeof(composed_outline_texture_filename), outline_texture_filename, size); - - if (font_load(font, composed_font_filename)) - { - dbg_msg("font/loading", "failed loading font %s.", composed_font_filename); - va_end(va); - return -1; - } - - font->size = size; - font->text_texture = gfx_load_texture(composed_text_texture_filename, IMG_ALPHA, TEXLOAD_NORESAMPLE); - font->outline_texture = gfx_load_texture(composed_outline_texture_filename, IMG_ALPHA, TEXLOAD_NORESAMPLE); - } - - va_end(va); - return 0; -} - -float font_text_width(FONT *font, const char *text, float size, int length) -{ - float width = 0.0f; - - const unsigned char *c = (unsigned char *)text; - int chars_left; - if (length == -1) - chars_left = strlen(text); - else - chars_left = length; - - while (chars_left--) - { - float tex_x0, tex_y0, tex_x1, tex_y1; - float char_width, char_height; - float x_offset, y_offset, x_advance; - float advance; - - font_character_info(font, *c, &tex_x0, &tex_y0, &tex_x1, &tex_y1, &char_width, &char_height, &x_offset, &y_offset, &x_advance); - - advance = x_advance + font_kerning(font, *c, *(c+1)); - - width += advance; - - c++; - } - - return width*size; -} - -void font_character_info(FONT *font, unsigned char c, float *tex_x0, float *tex_y0, float *tex_x1, float *tex_y1, float *width, float *height, float *x_offset, float *y_offset, float *x_advance) -{ - CHARACTER *character = &font->characters[c]; - - *tex_x0 = character->tex_x0; - *tex_y0 = character->tex_y0; - *tex_x1 = character->tex_x1; - *tex_y1 = character->tex_y1; - *width = character->width; - *height = character->height; - *x_offset = character->x_offset; - *y_offset = character->y_offset; - *x_advance = character->x_advance; -} - -float font_kerning(FONT *font, unsigned char c1, unsigned char c2) -{ - return font->kerning[c1 + c2*256] / (float)font->size; -} - -FONT *font_set_pick(FONT_SET *font_set, float size) -{ - int i; - FONT *picked_font = 0x0; - - for (i = font_set->font_count-1; i >= 0; i--) - { - FONT *font = &font_set->fonts[i]; - - if (font->size >= size) - picked_font = font; - } - - if (!picked_font) - picked_font = &font_set->fonts[font_set->font_count-1]; - - return picked_font; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.h b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.h deleted file mode 100644 index 8221a81a0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_font.h +++ /dev/null @@ -1,49 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef _FONT_H -#define _FONT_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - float tex_x0; - float tex_y0; - float tex_x1; - float tex_y1; - float width; - float height; - float x_offset; - float y_offset; - float x_advance; -} -CHARACTER; - -typedef struct -{ - int text_texture; - int outline_texture; - int size; - CHARACTER characters[256]; - char kerning[256*256]; -} FONT; - -typedef struct -{ - int font_count; - FONT fonts[14]; -} FONT_SET; - -int font_load(FONT *font, const char *filename); -int font_set_load(FONT_SET *font_set, const char *font_filename, const char *text_texture_filename, const char *outline_texture_filename, int fonts, ...); -float font_text_width(FONT *font, const char *text, float size, int width); -void font_character_info(FONT *font, unsigned char c, float *tex_x0, float *tex_y0, float *tex_x1, float *tex_y1, float *width, float *height, float *x_offset, float *y_offset, float *x_advance); -float font_kerning(FONT *font, unsigned char c1, unsigned char c2); -FONT *font_set_pick(FONT_SET *font_set, float size); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx.cpp deleted file mode 100644 index c3cdd1ab0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx.cpp +++ /dev/null @@ -1,1347 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include - -#include "SDL.h" - -#ifdef CONF_FAMILY_WINDOWS - #define WIN32_LEAN_AND_MEAN - #include -#endif - -#ifdef CONF_PLATFORM_MACOSX - #include - #include -#else -#ifdef ANDROID - #define GL_GLEXT_PROTOTYPES - #include - #include -#else - #include - #include -#endif -#endif - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#if defined(ANDROID) -#include -#endif - -#include "ec_font.h" - -/* compressed textures */ -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 - -#define TEXTURE_MAX_ANISOTROPY_EXT 0x84FE - -enum -{ - DRAWING_QUADS=1, - DRAWING_LINES=2 -}; - -/* */ -typedef struct { float x, y, z; } VEC3; -typedef struct { float u, v; } TEXCOORD; -typedef struct { float r, g, b, a; } COLOR; - -typedef struct -{ - VEC3 pos; - TEXCOORD tex; - COLOR color; -} VERTEX; - -const int vertex_buffer_size = 32*1024; -static VERTEX *vertices = 0; -static int num_vertices = 0; - -static int no_gfx = 0; - -static COLOR color[4]; -static TEXCOORD texture[4]; - -static int do_screenshot = 0; -static int render_enable = 1; - -static int screen_width = -1; -static int screen_height = -1; -static float rotation = 0; -static int drawing = 0; - -static float screen_x0 = 0; -static float screen_y0 = 0; -static float screen_x1 = 0; -static float screen_y1 = 0; - -static int invalid_texture = 0; - -typedef struct -{ - GLuint tex; - int memsize; - int flags; - int w, h; - int next; -} TEXTURE; - -enum -{ - MAX_TEXTURES = 1024*4 -}; - -static TEXTURE textures[MAX_TEXTURES]; -static int first_free_texture; -static int memory_usage = 0; -static int active_texture = -1; - -extern SDL_Surface *EC_screen_surface; -SDL_Surface *EC_screen_surface = NULL; - -static const unsigned char null_texture_data[] = { - 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, - 0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, - 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, - 0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, -}; - -static void flush() -{ - if(num_vertices == 0) - return; - - if(no_gfx) - { - num_vertices = 0; - return; - } - - -#ifdef ANDROID - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glVertexPointer(3, GL_FLOAT, // Why do we need Z coord? Let it be just 2 coords - sizeof(VERTEX), - (char*)vertices); - glEnableClientState(GL_VERTEX_ARRAY); - - if(render_enable) - { - if(drawing == DRAWING_QUADS) - { - int i; - glTexCoordPointer(2, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices + sizeof(float)*3); - - glDisableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - for(i = 0; i < num_vertices / 4; i++) - { - -#define SINGLE_COLOR_PER_TEXTURE 1 -#define USE_GL_DRAW_TEX 1 -#define TEXTURE_OUT_OF_SCREEN_CHECK 1 // Some GLES renderers seems to not have this check - -#ifdef TEXTURE_OUT_OF_SCREEN_CHECK - if( - ( vertices[i * 4 + 0].pos.x < screen_x0 && - vertices[i * 4 + 1].pos.x < screen_x0 && - vertices[i * 4 + 2].pos.x < screen_x0 && - vertices[i * 4 + 3].pos.x < screen_x0 ) - || - ( vertices[i * 4 + 0].pos.x > screen_x1 && - vertices[i * 4 + 1].pos.x > screen_x1 && - vertices[i * 4 + 2].pos.x > screen_x1 && - vertices[i * 4 + 3].pos.x > screen_x1 ) - || - ( vertices[i * 4 + 0].pos.y < screen_y0 && - vertices[i * 4 + 1].pos.y < screen_y0 && - vertices[i * 4 + 2].pos.y < screen_y0 && - vertices[i * 4 + 3].pos.y < screen_y0 ) - || - ( vertices[i * 4 + 0].pos.y > screen_y1 && - vertices[i * 4 + 1].pos.y > screen_y1 && - vertices[i * 4 + 2].pos.y > screen_y1 && - vertices[i * 4 + 3].pos.y > screen_y1 ) - ) - continue; -#endif - -#ifndef SINGLE_COLOR_PER_TEXTURE - // GL_COLOR_ARRAY is too damn slow for textures, so we'll set per-texture color - glColorPointer(4, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices + sizeof(float)*5); - glEnableClientState(GL_COLOR_ARRAY); -#else - COLOR texcolor = { - ( vertices[i * 4 + 0].color.r + vertices[i * 4 + 1].color.r + - vertices[i * 4 + 2].color.r + vertices[i * 4 + 3].color.r ) / 4.0f, - ( vertices[i * 4 + 0].color.g + vertices[i * 4 + 1].color.g + - vertices[i * 4 + 2].color.g + vertices[i * 4 + 3].color.g ) / 4.0f, - ( vertices[i * 4 + 0].color.b + vertices[i * 4 + 1].color.b + - vertices[i * 4 + 2].color.b + vertices[i * 4 + 3].color.b ) / 4.0f, - ( vertices[i * 4 + 0].color.a + vertices[i * 4 + 1].color.a + - vertices[i * 4 + 2].color.a + vertices[i * 4 + 3].color.a ) / 4.0f, - }; - // R and B channels are swapped on Android - glColor4f(texcolor.b, texcolor.g, texcolor.r, texcolor.a); - -#endif -#ifdef USE_GL_DRAW_TEX - if( active_texture >= 0 && // Something fishy here eh, let's revert to generic code and hope OpenGL will handle that - (( fabsf(vertices[i * 4].pos.x - vertices[i * 4 + 1].pos.x) < 0.01f && - fabsf(vertices[i * 4].pos.y - vertices[i * 4 + 3].pos.y) < 0.01f ) || - ( fabsf(vertices[i * 4].pos.y - vertices[i * 4 + 1].pos.y) < 0.01f && - fabsf(vertices[i * 4].pos.x - vertices[i * 4 + 3].pos.x) < 0.01f )) ) - { - // No rotation - use faster glDrawTex() implementation - /* - GLint cropRect[4] = { - vertices[i * 4].tex.u, vertices[i * 4].tex.v, - vertices[i * 4 + 2].tex.u - vertices[i * 4].tex.u, - vertices[i * 4 + 2].tex.v - vertices[i * 4].tex.v - }; - glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect); - */ - GLfloat cropRect[4] = { - vertices[i * 4].tex.u * textures[active_texture].w, - vertices[i * 4 + 2].tex.v * textures[active_texture].h, - (vertices[i * 4 + 2].tex.u - vertices[i * 4].tex.u) * textures[active_texture].w, - -(vertices[i * 4 + 2].tex.v - vertices[i * 4].tex.v) * textures[active_texture].h - }; - float aspectX = screen_width / (screen_x1 - screen_x0); - float aspectY = screen_height / (screen_y1 - screen_y0); - - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect); - glDrawTexfOES( (vertices[i * 4].pos.x - screen_x0) * aspectX, - (screen_y1 - vertices[i * 4 + 2].pos.y) * aspectY, // Up and down are swapped for glDrawTex() - 0, - (vertices[i * 4 + 2].pos.x - vertices[i * 4].pos.x) * aspectX, - (vertices[i * 4 + 2].pos.y - vertices[i * 4].pos.y) * aspectY ); - } - else -#endif - { - //Rotation - we have to use generic implementation - glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4); - } - } - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset to defaults - } - else if(drawing == DRAWING_LINES) - { - glColorPointer(4, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices + sizeof(float)*5); - glEnableClientState(GL_COLOR_ARRAY); - glDrawArrays(GL_LINES, 0, num_vertices); - } - } - -#else - // We're on acceptable hardware, not Android, just draw the texture without speed hacks - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glVertexPointer(3, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices); - glTexCoordPointer(2, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices + sizeof(float)*3); - glColorPointer(4, GL_FLOAT, - sizeof(VERTEX), - (char*)vertices + sizeof(float)*5); - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - - if(render_enable) - { - if(drawing == DRAWING_QUADS) - glDrawArrays(GL_QUADS, 0, num_vertices); - else if(drawing == DRAWING_LINES) - glDrawArrays(GL_LINES, 0, num_vertices); - } -#endif - - /* Reset pointer */ - num_vertices = 0; -} - -static void add_vertices(int count) -{ - num_vertices += count; - if((num_vertices + count) >= vertex_buffer_size) - flush(); -} - -extern SDL_Joystick * EC_joystick; -SDL_Joystick * EC_joystick = NULL; - -static int try_init() -{ - const SDL_VideoInfo *info; - int flags = SDL_OPENGL; - -#ifdef ANDROID - config.gfx_screen_width = SDL_ListModes(NULL, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_FULLSCREEN)[0]->w; - config.gfx_screen_height = SDL_ListModes(NULL, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_FULLSCREEN)[0]->h; - - dbg_msg("gfx", "Physical display resolution is %dx%d", config.gfx_screen_width, config.gfx_screen_height); -#endif - - screen_width = config.gfx_screen_width; - screen_height = config.gfx_screen_height; - -#if defined(ANDROID) - // Redefine button layout - if( ! SDL_ANDROID_GetScreenKeyboardRedefinedByUser() ) - { - // Disable DPAD - SDL_Rect pos; - - pos.x = screen_width; - pos.y = screen_height; - pos.h = screen_height * 3 / 5; - pos.w = pos.h; - pos.x -= pos.w; - pos.y -= pos.h; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &pos); - - // Move buttons overlapped in lower-left - pos.x = 0; - pos.y = screen_height; - pos.h = screen_height / 2; - pos.w = pos.h / 2; - pos.y -= pos.h; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &pos); - - pos.x += pos.w; - - // Jump button overlaps move buttons - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &pos); - - pos.w *= 2; - pos.h = pos.w/2; - pos.x = 0; - pos.y -= pos.h/2; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &pos); - - // Rope button below jump button - pos.y = 0; - pos.h = pos.h * 2 / 3; - pos.y = screen_height - pos.h; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &pos); - - // weapprev weapnext buttons - - pos.x = screen_width; - pos.y = 0; - pos.w = screen_width / 8; - pos.h = pos.w; - pos.x -= pos.w; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &pos); - - pos.x -= pos.w; - - SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &pos); - - } -#endif - - info = SDL_GetVideoInfo(); - - /* set flags */ - flags = SDL_OPENGL; - flags |= SDL_GL_DOUBLEBUFFER; - flags |= SDL_HWPALETTE; - if(config.dbg_resizable) - flags |= SDL_RESIZABLE; - - if(info->hw_available) - flags |= SDL_HWSURFACE; - else - flags |= SDL_SWSURFACE; - - if(info->blit_hw) - flags |= SDL_HWACCEL; - - if(config.gfx_fullscreen) - flags |= SDL_FULLSCREEN; - - /* set gl attributes */ - if(config.gfx_fsaa_samples) - { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, config.gfx_fsaa_samples); - } - else - { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); - } - - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, config.gfx_vsync); - - /* set caption */ - SDL_WM_SetCaption("Teeworlds", "Teeworlds"); - - /* create window */ - EC_screen_surface = SDL_SetVideoMode(screen_width, screen_height, 0, flags); - if(EC_screen_surface == NULL) - { - dbg_msg("gfx", "unable to set video mode: %s", SDL_GetError()); - return -1; - } -#ifdef ANDROID - dbg_msg("gfx", "Number of joysticks: %d", SDL_NumJoysticks()); - if(SDL_NumJoysticks() > 0) - { - dbg_msg("gfx", "Joystick 0: %s", SDL_JoystickName(0)); - EC_joystick = SDL_JoystickOpen(0); - if( EC_joystick ) - dbg_msg("gfx", "Opened joystick 0, numaxes %d numbuttons %d", SDL_JoystickNumAxes(EC_joystick), SDL_JoystickNumButtons(EC_joystick)); - else - dbg_msg("gfx", "Error opening joystick 0"); - SDL_JoystickEventState(SDL_ENABLE); - } -#endif - - return 0; -} - -static int gfx_init_window() -{ - if(try_init() == 0) - return 0; - - /* try disabling fsaa */ - while(config.gfx_fsaa_samples) - { - config.gfx_fsaa_samples--; - - if(config.gfx_fsaa_samples) - dbg_msg("gfx", "lowering FSAA to %d and trying again", config.gfx_fsaa_samples); - else - dbg_msg("gfx", "disabling FSAA and trying again"); - - if(try_init() == 0) - return 0; - } - - /* try lowering the resolution */ - if(config.gfx_screen_width != 640 || config.gfx_screen_height != 480) - { - dbg_msg("gfx", "setting resolution to 640x480 and trying again"); - config.gfx_screen_width = 640; - config.gfx_screen_height = 480; - - if(try_init() == 0) - return 0; - } - - dbg_msg("gfx", "out of ideas. failed to init graphics"); - - return -1; -} - -int gfx_init() -{ - int i; - - if(config.dbg_stress) - no_gfx = 1; - - { - int systems = 0; - - if(!no_gfx) - systems |= SDL_INIT_VIDEO; - - if(config.snd_enable) - systems |= SDL_INIT_AUDIO; - - if(config.cl_eventthread) - systems |= SDL_INIT_EVENTTHREAD; - -#ifdef ANDROID - systems |= SDL_INIT_JOYSTICK; -#endif - - if(SDL_Init(systems) < 0) - { - dbg_msg("gfx", "unable to init SDL: %s", SDL_GetError()); - return -1; - } - } - - atexit(SDL_Quit); - - if(!no_gfx) - { - #ifdef CONF_FAMILY_WINDOWS - if(!getenv("SDL_VIDEO_WINDOW_POS") && !getenv("SDL_VIDEO_CENTERED")) - putenv("SDL_VIDEO_WINDOW_POS=8,27"); - #endif - - if(gfx_init_window() != 0) - return -1; - } - - /* Init vertices */ - if (vertices) - mem_free(vertices); - vertices = (VERTEX*)mem_alloc(sizeof(VERTEX) * vertex_buffer_size, 1); - num_vertices = 0; - - - /* - dbg_msg("gfx", "OpenGL version %d.%d.%d", context.version_major(), - context.version_minor(), - context.version_rev());*/ - - - /* Set all z to -5.0f */ - for (i = 0; i < vertex_buffer_size; i++) - vertices[i].pos.z = -5.0f; - - /* init textures */ - first_free_texture = 0; - for(i = 0; i < MAX_TEXTURES; i++) - textures[i].next = i+1; - textures[MAX_TEXTURES-1].next = -1; - - if(!no_gfx) - { - SDL_ShowCursor(0); - gfx_mapscreen(0,0,config.gfx_screen_width, config.gfx_screen_height); - - /* set some default settings */ - glEnable(GL_BLEND); - glDisable(GL_CULL_FACE); - glDisable(GL_DEPTH_TEST); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glAlphaFunc(GL_GREATER, 0); - glEnable(GL_ALPHA_TEST); - glDepthMask(0); - -#ifdef ANDROID - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -#else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -#endif - } - - /* init input */ - inp_init(); - - /* create null texture, will get id=0 */ - invalid_texture = gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data,IMG_RGBA,TEXLOAD_NORESAMPLE); - - /* perform some tests */ - /* pixeltest_dotesting(); */ - - /*if(config.dbg_stress) - gfx_minimize();*/ - - return 0; -} - -float gfx_screenaspect() -{ - return gfx_screenwidth()/(float)gfx_screenheight(); -} - -int gfx_window_active() -{ - return SDL_GetAppState()&SDL_APPINPUTFOCUS; -} - -int gfx_window_open() -{ - return SDL_GetAppState()&SDL_APPACTIVE; -} - -VIDEO_MODE fakemodes[] = { - {320,240,8,8,8}, {400,300,8,8,8}, {640,480,8,8,8}, - {720,400,8,8,8}, {768,576,8,8,8}, {800,600,8,8,8}, - {1024,600,8,8,8}, {1024,768,8,8,8}, {1152,864,8,8,8}, - {1280,768,8,8,8}, {1280,800,8,8,8}, {1280,960,8,8,8}, - {1280,1024,8,8,8}, {1368,768,8,8,8}, {1400,1050,8,8,8}, - {1440,900,8,8,8}, {1440,1050,8,8,8}, {1600,1000,8,8,8}, - {1600,1200,8,8,8}, {1680,1050,8,8,8}, {1792,1344,8,8,8}, - {1800,1440,8,8,8}, {1856,1392,8,8,8}, {1920,1080,8,8,8}, - {1920,1200,8,8,8}, {1920,1440,8,8,8}, {1920,2400,8,8,8}, - {2048,1536,8,8,8}, - - {320,240,5,6,5}, {400,300,5,6,5}, {640,480,5,6,5}, - {720,400,5,6,5}, {768,576,5,6,5}, {800,600,5,6,5}, - {1024,600,5,6,5}, {1024,768,5,6,5}, {1152,864,5,6,5}, - {1280,768,5,6,5}, {1280,800,5,6,5}, {1280,960,5,6,5}, - {1280,1024,5,6,5}, {1368,768,5,6,5}, {1400,1050,5,6,5}, - {1440,900,5,6,5}, {1440,1050,5,6,5}, {1600,1000,5,6,5}, - {1600,1200,5,6,5}, {1680,1050,5,6,5}, {1792,1344,5,6,5}, - {1800,1440,5,6,5}, {1856,1392,5,6,5}, {1920,1080,5,6,5}, - {1920,1200,5,6,5}, {1920,1440,5,6,5}, {1920,2400,5,6,5}, - {2048,1536,5,6,5} -}; - -int gfx_get_video_modes(VIDEO_MODE *list, int maxcount) -{ - int num_modes = sizeof(fakemodes)/sizeof(VIDEO_MODE); - SDL_Rect **modes; - - if(config.gfx_display_all_modes) - { - int count = sizeof(fakemodes)/sizeof(VIDEO_MODE); - mem_copy(list, fakemodes, sizeof(fakemodes)); - if(maxcount < count) - count = maxcount; - return count; - } - - /* TODO: fix this code on osx or windows */ - - modes = SDL_ListModes(NULL, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_FULLSCREEN); - if(modes == NULL) - { - /* no modes */ - num_modes = 0; - } - else if(modes == (SDL_Rect**)-1) - { - /* all modes */ - } - else - { - int i; - num_modes = 0; - for(i = 0; modes[i]; ++i) - { - if(num_modes == maxcount) - break; - list[num_modes].width = modes[i]->w; - list[num_modes].height = modes[i]->h; - list[num_modes].red = 8; - list[num_modes].green = 8; - list[num_modes].blue = 8; -#ifdef ANDROID - list[num_modes].red = 5; - list[num_modes].green = 6; - list[num_modes].blue = 5; -#endif - num_modes++; - } - } - - return num_modes; -} - -int gfx_unload_texture(int index) -{ - if(index == invalid_texture) - return 0; - - if(index < 0) - return 0; - - glDeleteTextures(1, &textures[index].tex); - textures[index].next = first_free_texture; - memory_usage -= textures[index].memsize; - first_free_texture = index; - return 0; -} - -void gfx_blend_none() -{ - if(no_gfx) return; - glDisable(GL_BLEND); -} - -void gfx_blend_normal() -{ - if(no_gfx) return; - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -} - -void gfx_blend_additive() -{ - if(no_gfx) return; - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); -} - -int gfx_memory_usage() { return memory_usage; } - -static unsigned char sample(int w, int h, const unsigned char *data, int u, int v, int offset) -{ - return (data[(v*w+u)*4+offset]+ - data[(v*w+u+1)*4+offset]+ - data[((v+1)*w+u)*4+offset]+ - data[((v+1)*w+u+1)*4+offset])/4; -} - -static int -power_of_2(int input) -{ - int value = 1; - - while (value < input) { - value <<= 1; - } - return value; -} - -int gfx_load_texture_raw(int w, int h, int format, const void *data, int store_format, int flags) -{ - int mipmap = 1; - unsigned char *texdata = (unsigned char *)data; - unsigned char *tmpdata = 0; - int oglformat = 0; - int store_oglformat = 0; - int tex = 0; - int glesType = 0; - - /* don't waste memory on texture if we are stress testing */ - if(config.dbg_stress || no_gfx) - return invalid_texture; - - /* grab texture */ - tex = first_free_texture; - first_free_texture = textures[tex].next; - textures[tex].next = -1; - - /* resample if needed */ - if(!(flags&TEXLOAD_NORESAMPLE) && config.gfx_texture_quality==0) - { - if(w > 16 && h > 16 && format == IMG_RGBA) - { - unsigned char *tmpdata; - int c = 0; - int x, y; - - tmpdata = (unsigned char *)mem_alloc(w*h*4, 1); - - w/=2; - h/=2; - - for(y = 0; y < h; y++) - for(x = 0; x < w; x++, c++) - { - tmpdata[c*4] = sample(w*2, h*2, texdata, x*2,y*2, 0); - tmpdata[c*4+1] = sample(w*2, h*2, texdata, x*2,y*2, 1); - tmpdata[c*4+2] = sample(w*2, h*2, texdata, x*2,y*2, 2); - tmpdata[c*4+3] = sample(w*2, h*2, texdata, x*2,y*2, 3); - } - texdata = tmpdata; - } - } - - oglformat = GL_RGBA; - glesType = GL_UNSIGNED_SHORT_5_5_5_1; - if(format == IMG_RGB) - { - oglformat = GL_RGB; - glesType = GL_UNSIGNED_SHORT_5_6_5; - } - else if(format == IMG_ALPHA) - { - oglformat = GL_ALPHA; -#ifdef ANDROID - oglformat = GL_RGBA; // No pure alpha textures on Android -#endif - glesType = GL_UNSIGNED_SHORT_4_4_4_4; - } - -#ifndef ANDROID - /* upload texture */ - if(config.gfx_texture_compression) - { - store_oglformat = GL_COMPRESSED_RGBA_ARB; - if(store_format == IMG_RGB) - store_oglformat = GL_COMPRESSED_RGB_ARB; - else if(store_format == IMG_ALPHA) - store_oglformat = GL_COMPRESSED_ALPHA_ARB; - } - else -#endif - { - store_oglformat = GL_RGBA; - if(store_format == IMG_RGB) - store_oglformat = GL_RGB; - else if(store_format == IMG_ALPHA) - store_oglformat = GL_ALPHA; - } - - glGenTextures(1, &textures[tex].tex); - glBindTexture(GL_TEXTURE_2D, textures[tex].tex); -#ifdef ANDROID - -/* -#define CONVERT_RGBA8888_RGBA4444( pixel ) \ - ( ( pixel >> 4 ) & 0xF ) | \ - ( ( pixel >> 8 ) & 0xF0 ) | \ - ( ( pixel >> 12 ) & 0xF00 ) | \ - ( ( pixel >> 16 ) & 0xF000 ) -*/ - -// R and B channels are swapped on Android - -#define SWAP_RB_8888( pixel ) \ - ((pixel & 0xFF) << 16 | \ - (pixel & 0xFF00) | \ - (pixel & 0xFF0000) >> 16 | \ - (pixel & 0xFF000000)) - -#define CONVERT_ARGB8888_RGBA4444( pixel ) \ - ( ( pixel >> 28 ) & 0xF ) | \ - ( ( pixel ) & 0xF0 ) | \ - ( ( pixel >> 4 ) & 0xF00 ) | \ - ( ( pixel >> 8 ) & 0xF000 ) - -#define CONVERT_ARGB8888_RGBA5551( pixel ) \ - ( ( pixel >> 31 ) & 0x1 ) | \ - ( ( pixel >> 2 ) & 0x3E ) | \ - ( ( pixel >> 5 ) & 0x7C0 ) | \ - ( ( pixel >> 8 ) & 0xF800 ) - - -#define CONVERT_RGB888_RGB565( pixel ) \ - ( ( pixel >> 3 ) & 0x1F ) | \ - ( ( pixel >> 5 ) & 0x7E0 ) | \ - ( ( pixel >> 8 ) & 0xF800 ) - - tmpdata = (unsigned char *)mem_alloc(w*h*2, 1); - { - Uint16 x, y; - if(format == IMG_RGB) - { - for(y = 0; y < h; y++) - for(x = 0; x < w; x++) - { - ((Uint16 *)tmpdata)[ y*(Uint32)w+x ] = CONVERT_RGB888_RGB565( SWAP_RB_8888(((* ((Uint32 *)(texdata+(y*w+x)*3))) & 0xFFFFFF) ) ); - } - } - else - if(format == IMG_RGBA) - { - for(y = 0; y < h; y++) - for(x = 0; x < w; x++) - { - ((Uint16 *)tmpdata)[ y*(Uint32)w+x ] = CONVERT_ARGB8888_RGBA5551( SWAP_RB_8888((((Uint32 *)texdata)[ y*w+x ]) ) ); - } - } - else - { - for(y = 0; y < h; y++) - for(x = 0; x < w; x++) - { - ((Uint16 *)tmpdata)[ y*(Uint32)w+x ] = CONVERT_ARGB8888_RGBA4444( SWAP_RB_8888((((Uint32 *)texdata)[ y*w+x ]) ) ); - } - } - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexImage2D( GL_TEXTURE_2D, 0, oglformat, power_of_2(w), power_of_2(h), 0, oglformat, glesType, NULL ); - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, w, h, oglformat, glesType, tmpdata); -#else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - gluBuild2DMipmaps(GL_TEXTURE_2D, store_oglformat, w, h, oglformat, GL_UNSIGNED_BYTE, texdata); -#endif - textures[tex].w = w; - textures[tex].h = h; - active_texture = tex; - - /* calculate memory usage */ - { - int pixel_size = 4; - if(store_format == IMG_RGB) - pixel_size = 3; - else if(store_format == IMG_ALPHA) - pixel_size = 1; - - textures[tex].memsize = w*h*pixel_size; - if(mipmap) - { - while(w > 2 && h > 2) - { - w>>=1; - h>>=1; - textures[tex].memsize += w*h*pixel_size; - } - } -#ifdef ANDROID - textures[tex].memsize = power_of_2(w)*power_of_2(h)*2; -#endif - } - - memory_usage += textures[tex].memsize; - mem_free(tmpdata); - return tex; -} - -/* simple uncompressed RGBA loaders */ -int gfx_load_texture(const char *filename, int store_format, int flags) -{ - int l = strlen(filename); - int id; - IMAGE_INFO img; - - if(l < 3) - return -1; - if(gfx_load_png(&img, filename)) - { - if (store_format == IMG_AUTO) - store_format = img.format; - - id = gfx_load_texture_raw(img.width, img.height, img.format, img.data, store_format, flags); - mem_free(img.data); - return id; - } - - return invalid_texture; -} - -int gfx_load_png(IMAGE_INFO *img, const char *filename) -{ - char completefilename[512]; - unsigned char *buffer; - png_t png; - - /* open file for reading */ - png_init(0,0); - - engine_getpath(completefilename, sizeof(completefilename), filename, IOFLAG_READ); - - if(png_open_file(&png, completefilename) != PNG_NO_ERROR) - { - dbg_msg("game/png", "failed to open file. filename='%s'", completefilename); - return 0; - } - - if(png.depth != 8 || (png.color_type != PNG_TRUECOLOR && png.color_type != PNG_TRUECOLOR_ALPHA)) - { - dbg_msg("game/png", "invalid format. filename='%s'", completefilename); - png_close_file(&png); - return 0; - } - - buffer = (unsigned char *)mem_alloc(png.width * png.height * png.bpp, 1); - png_get_data(&png, buffer); - png_close_file(&png); - - img->width = png.width; - img->height = png.height; - if(png.color_type == PNG_TRUECOLOR) - img->format = IMG_RGB; - else if(png.color_type == PNG_TRUECOLOR_ALPHA) - img->format = IMG_RGBA; - img->data = buffer; - return 1; -} - -void gfx_shutdown() -{ - if (vertices) - mem_free(vertices); - - /* TODO: SDL, is this correct? */ - SDL_Quit(); -} - -void gfx_screenshot() -{ - do_screenshot = 1; -} - -void gfx_swap() -{ - if(do_screenshot) - { - /* find filename */ - char filename[128]; - static int index = 1; - - for(; index < 1000; index++) - { - IOHANDLE io; - str_format(filename, sizeof(filename), "screenshots/screenshot%04d.png", index); - io = engine_openfile(filename, IOFLAG_READ); - if(io) - io_close(io); - else - break; - } - - gfx_screenshot_direct(filename); - - do_screenshot = 0; - } - - { - static PERFORMACE_INFO pscope = {"glfwSwapBuffers", 0}; - perf_start(&pscope); - SDL_GL_SwapBuffers(); - perf_end(); - } - - #ifndef ANDROID - if(render_enable && config.gfx_finish) - glFinish(); - #endif -} - -void gfx_screenshot_direct(const char *filename) -{ - /* fetch image data */ - int y; - int w = screen_width; - int h = screen_height; - unsigned char *pixel_data = (unsigned char *)mem_alloc(w*(h+1)*4, 1); - unsigned char *temp_row = pixel_data+w*h*4; - glReadPixels(0,0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixel_data); - - /* flip the pixel because opengl works from bottom left corner */ - for(y = 0; y < h/2; y++) - { - mem_copy(temp_row, pixel_data+y*w*4, w*4); - mem_copy(pixel_data+y*w*4, pixel_data+(h-y-1)*w*4, w*4); - mem_copy(pixel_data+(h-y-1)*w*4, temp_row,w*4); - } - - /* find filename */ - { - char wholepath[1024]; - png_t png; - - engine_savepath(filename, wholepath, sizeof(wholepath)); - - /* save png */ - dbg_msg("client", "saved screenshot to '%s'", wholepath); - png_open_file_write(&png, wholepath); - png_set_data(&png, w, h, 8, PNG_TRUECOLOR_ALPHA, (unsigned char *)pixel_data); - png_close_file(&png); - } - - /* clean up */ - mem_free(pixel_data); -} - -int gfx_screenwidth() -{ - return screen_width; -} - -int gfx_screenheight() -{ - return screen_height; -} - -void gfx_texture_set(int slot) -{ - dbg_assert(drawing == 0, "called gfx_texture_set within begin"); - if(no_gfx) return; - if(slot == -1) - { - glDisable(GL_TEXTURE_2D); - } - else - { - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, textures[slot].tex); - } - active_texture = slot; -} - -void gfx_clear(float r, float g, float b) -{ - if(no_gfx) return; - #ifndef ANDROID - glClearColor(r,g,b,0.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - #endif -} - -void gfx_mapscreen(float tl_x, float tl_y, float br_x, float br_y) -{ - screen_x0 = tl_x; - screen_y0 = tl_y; - screen_x1 = br_x; - screen_y1 = br_y; - if(no_gfx) return; - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#ifdef ANDROID -#define glOrtho glOrthof -#endif - glOrtho(tl_x, br_x, br_y, tl_y, 1.0f, 10.f); -} - -void gfx_getscreen(float *tl_x, float *tl_y, float *br_x, float *br_y) -{ - *tl_x = screen_x0; - *tl_y = screen_y0; - *br_x = screen_x1; - *br_y = screen_y1; -} - -void gfx_quads_begin() -{ - dbg_assert(drawing == 0, "called quads_begin twice"); - drawing = DRAWING_QUADS; - - gfx_quads_setsubset(0,0,1,1); - gfx_quads_setrotation(0); - gfx_setcolor(1,1,1,1); -} - -void gfx_quads_end() -{ - dbg_assert(drawing == DRAWING_QUADS, "called quads_end without begin"); - flush(); - drawing = 0; -} - - -void gfx_quads_setrotation(float angle) -{ - dbg_assert(drawing == DRAWING_QUADS, "called gfx_quads_setrotation without begin"); - rotation = angle; -} - -void gfx_setcolorvertex(int i, float r, float g, float b, float a) -{ - dbg_assert(drawing != 0, "called gfx_quads_setcolorvertex without begin"); - color[i].r = r; - color[i].g = g; - color[i].b = b; - color[i].a = a; -} - -void gfx_setcolor(float r, float g, float b, float a) -{ - dbg_assert(drawing != 0, "called gfx_quads_setcolor without begin"); - gfx_setcolorvertex(0, r, g, b, a); - gfx_setcolorvertex(1, r, g, b, a); - gfx_setcolorvertex(2, r, g, b, a); - gfx_setcolorvertex(3, r, g, b, a); -} - -void gfx_quads_setsubset(float tl_u, float tl_v, float br_u, float br_v) -{ - dbg_assert(drawing == DRAWING_QUADS, "called gfx_quads_setsubset without begin"); - - texture[0].u = tl_u; texture[1].u = br_u; - texture[0].v = tl_v; texture[1].v = tl_v; - - texture[3].u = tl_u; texture[2].u = br_u; - texture[3].v = br_v; texture[2].v = br_v; -} - -void gfx_quads_setsubset_free( - float x0, float y0, float x1, float y1, - float x2, float y2, float x3, float y3) -{ - texture[0].u = x0; texture[0].v = y0; - texture[1].u = x1; texture[1].v = y1; - texture[2].u = x2; texture[2].v = y2; - texture[3].u = x3; texture[3].v = y3; -} - - -static void rotate(VEC3 *center, VEC3 *point) -{ - float x = point->x - center->x; - float y = point->y - center->y; - point->x = x * cosf(rotation) - y * sinf(rotation) + center->x; - point->y = x * sinf(rotation) + y * cosf(rotation) + center->y; -} - -void gfx_quads_draw(float x, float y, float w, float h) -{ - gfx_quads_drawTL(x-w/2, y-h/2,w,h); -} - -void gfx_quads_drawTL(float x, float y, float width, float height) -{ - VEC3 center; - - dbg_assert(drawing == DRAWING_QUADS, "called quads_draw without begin"); - - center.x = x + width/2; - center.y = y + height/2; - center.z = 0; - - vertices[num_vertices].pos.x = x; - vertices[num_vertices].pos.y = y; - vertices[num_vertices].tex = texture[0]; - vertices[num_vertices].color = color[0]; - rotate(¢er, &vertices[num_vertices].pos); - - vertices[num_vertices + 1].pos.x = x+width; - vertices[num_vertices + 1].pos.y = y; - vertices[num_vertices + 1].tex = texture[1]; - vertices[num_vertices + 1].color = color[1]; - rotate(¢er, &vertices[num_vertices + 1].pos); - - vertices[num_vertices + 2].pos.x = x + width; - vertices[num_vertices + 2].pos.y = y+height; - vertices[num_vertices + 2].tex = texture[2]; - vertices[num_vertices + 2].color = color[2]; - rotate(¢er, &vertices[num_vertices + 2].pos); - - vertices[num_vertices + 3].pos.x = x; - vertices[num_vertices + 3].pos.y = y+height; - vertices[num_vertices + 3].tex = texture[3]; - vertices[num_vertices + 3].color = color[3]; - rotate(¢er, &vertices[num_vertices + 3].pos); - - add_vertices(4); -} - -void gfx_quads_draw_freeform( - float x0, float y0, float x1, float y1, - float x2, float y2, float x3, float y3) -{ - dbg_assert(drawing == DRAWING_QUADS, "called quads_draw_freeform without begin"); - - vertices[num_vertices].pos.x = x0; - vertices[num_vertices].pos.y = y0; - vertices[num_vertices].tex = texture[0]; - vertices[num_vertices].color = color[0]; - - vertices[num_vertices + 1].pos.x = x1; - vertices[num_vertices + 1].pos.y = y1; - vertices[num_vertices + 1].tex = texture[1]; - vertices[num_vertices + 1].color = color[1]; - - vertices[num_vertices + 2].pos.x = x3; - vertices[num_vertices + 2].pos.y = y3; - vertices[num_vertices + 2].tex = texture[3]; - vertices[num_vertices + 2].color = color[3]; - - vertices[num_vertices + 3].pos.x = x2; - vertices[num_vertices + 3].pos.y = y2; - vertices[num_vertices + 3].tex = texture[2]; - vertices[num_vertices + 3].color = color[2]; - - add_vertices(4); -} - -void gfx_quads_text(float x, float y, float size, float r, float g, float b, float a, const char *text) -{ - float startx = x; - - gfx_quads_begin(); - gfx_setcolor(r,g,b,a); - - while(*text) - { - char c = *text; - text++; - - if(c == '\n') - { - x = startx; - y += size; - } - else - { - gfx_quads_setsubset( - (c%16)/16.0f, - (c/16)/16.0f, - (c%16)/16.0f+1.0f/16.0f, - (c/16)/16.0f+1.0f/16.0f); - - gfx_quads_drawTL(x,y,size,size); - x += size/2; - } - } - - gfx_quads_end(); -} - -void gfx_lines_begin() -{ - dbg_assert(drawing == 0, "called begin twice"); - drawing = DRAWING_LINES; - gfx_setcolor(1,1,1,1); -} - -void gfx_lines_end() -{ - dbg_assert(drawing == DRAWING_LINES, "called end without begin"); - flush(); - drawing = 0; -} - -void gfx_lines_draw(float x0, float y0, float x1, float y1) -{ - dbg_assert(drawing == DRAWING_LINES, "called draw without begin"); - - vertices[num_vertices].pos.x = x0; - vertices[num_vertices].pos.y = y0; - vertices[num_vertices].tex = texture[0]; - vertices[num_vertices].color = color[0]; - - vertices[num_vertices + 1].pos.x = x1; - vertices[num_vertices + 1].pos.y = y1; - vertices[num_vertices + 1].tex = texture[1]; - vertices[num_vertices + 1].color = color[1]; - - add_vertices(2); -} - -void gfx_clip_enable(int x, int y, int w, int h) -{ - if(no_gfx) return; - glScissor(x, gfx_screenheight()-(y+h), w, h); - glEnable(GL_SCISSOR_TEST); -} - -void gfx_clip_disable() -{ - if(no_gfx) return; - glDisable(GL_SCISSOR_TEST); -} - -void gfx_minimize() -{ - SDL_WM_IconifyWindow(); -} - -void gfx_maximize() -{ - /* TODO: SDL */ -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx_text.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx_text.cpp deleted file mode 100644 index 5b55febdf..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_gfx_text.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include -#include -#include - -static int word_length(const char *text) -{ - int s = 1; - while(1) - { - if(*text == 0) - return s-1; - if(*text == '\n' || *text == '\t' || *text == ' ') - return s; - text++; - s++; - } -} - -static float text_r=1; -static float text_g=1; -static float text_b=1; -static float text_a=1; - -static FONT_SET *default_font_set = 0; -void gfx_text_set_default_font(void *font) -{ - default_font_set = (FONT_SET *)font; -} - - -void gfx_text_set_cursor(TEXT_CURSOR *cursor, float x, float y, float font_size, int flags) -{ - mem_zero(cursor, sizeof(*cursor)); - cursor->font_size = font_size; - cursor->start_x = x; - cursor->start_y = y; - cursor->x = x; - cursor->y = y; - cursor->line_count = 1; - cursor->line_width = -1; - cursor->flags = flags; - cursor->charcount = 0; -} - -void gfx_text_ex(TEXT_CURSOR *cursor, const char *text, int length) -{ - FONT_SET *font_set = (FONT_SET *)cursor->font_set; - float screen_x0, screen_y0, screen_x1, screen_y1; - float fake_to_screen_x, fake_to_screen_y; - int actual_x, actual_y; - - FONT *font; - int actual_size; - int i; - int got_new_line = 0; - float draw_x, draw_y; - float cursor_x, cursor_y; - const char *end; - - float size = cursor->font_size; - - /* to correct coords, convert to screen coords, round, and convert back */ - gfx_getscreen(&screen_x0, &screen_y0, &screen_x1, &screen_y1); - - fake_to_screen_x = (gfx_screenwidth()/(screen_x1-screen_x0)); - fake_to_screen_y = (gfx_screenheight()/(screen_y1-screen_y0)); - actual_x = cursor->x * fake_to_screen_x; - actual_y = cursor->y * fake_to_screen_y; - - cursor_x = actual_x / fake_to_screen_x; - cursor_y = actual_y / fake_to_screen_y; - - /* same with size */ - actual_size = size * fake_to_screen_y; - size = actual_size / fake_to_screen_y; - - if(!font_set) - font_set = default_font_set; - - font = font_set_pick(font_set, actual_size); - - if (length < 0) - length = strlen(text); - - end = text + length; - - /* if we don't want to render, we can just skip the first outline pass */ - i = 1; - if(cursor->flags&TEXTFLAG_RENDER) - i = 0; - - for(;i < 2; i++) - { - const unsigned char *current = (unsigned char *)text; - int to_render = length; - draw_x = cursor_x; - draw_y = cursor_y; - - if(cursor->flags&TEXTFLAG_RENDER) - { - if (i == 0) - gfx_texture_set(font->outline_texture); - else - gfx_texture_set(font->text_texture); - - gfx_quads_begin(); - if (i == 0) - gfx_setcolor(0.0f, 0.0f, 0.0f, 0.3f*text_a); - else - gfx_setcolor(text_r, text_g, text_b, text_a); - } - - while(to_render > 0) - { - int new_line = 0; - int this_batch = to_render; - if(cursor->line_width > 0 && !(cursor->flags&TEXTFLAG_STOP_AT_END)) - { - int wlen = word_length((char *)current); - TEXT_CURSOR compare = *cursor; - compare.x = draw_x; - compare.y = draw_y; - compare.flags &= ~TEXTFLAG_RENDER; - compare.line_width = -1; - gfx_text_ex(&compare, text, wlen); - - if(compare.x-draw_x > cursor->line_width) - { - /* word can't be fitted in one line, cut it */ - TEXT_CURSOR cutter = *cursor; - cutter.charcount = 0; - cutter.x = draw_x; - cutter.y = draw_y; - cutter.flags &= ~TEXTFLAG_RENDER; - cutter.flags |= TEXTFLAG_STOP_AT_END; - - gfx_text_ex(&cutter, (const char *)current, wlen); - wlen = cutter.charcount; - new_line = 1; - - if(wlen <= 3) /* if we can't place 3 chars of the word on this line, take the next */ - wlen = 0; - } - else if(compare.x-cursor->start_x > cursor->line_width) - { - new_line = 1; - wlen = 0; - } - - this_batch = wlen; - } - - if((const char *)current+this_batch > end) - this_batch = (const char *)end-(const char *)current; - - to_render -= this_batch; - - while(this_batch-- > 0) - { - float tex_x0, tex_y0, tex_x1, tex_y1; - float width, height; - float x_offset, y_offset, x_advance; - float advance; - - if(*current == '\n') - { - draw_x = cursor->start_x; - draw_y += size; - draw_x = (int)(draw_x * fake_to_screen_x) / fake_to_screen_x; /* realign */ - draw_y = (int)(draw_y * fake_to_screen_y) / fake_to_screen_y; - current++; - continue; - } - - font_character_info(font, *current, &tex_x0, &tex_y0, &tex_x1, &tex_y1, &width, &height, &x_offset, &y_offset, &x_advance); - - if(cursor->flags&TEXTFLAG_RENDER) - { - gfx_quads_setsubset(tex_x0, tex_y0, tex_x1, tex_y1); - gfx_quads_drawTL(draw_x+x_offset*size, draw_y+y_offset*size, width*size, height*size); - } - - advance = x_advance + font_kerning(font, *current, *(current+1)); - - if(cursor->flags&TEXTFLAG_STOP_AT_END && draw_x+advance*size-cursor->start_x > cursor->line_width) - { - /* we hit the end of the line, no more to render or count */ - to_render = 0; - break; - } - - draw_x += advance*size; - cursor->charcount++; - current++; - } - - if(new_line) - { - draw_x = cursor->start_x; - draw_y += size; - got_new_line = 1; - draw_x = (int)(draw_x * fake_to_screen_x) / fake_to_screen_x; /* realign */ - draw_y = (int)(draw_y * fake_to_screen_y) / fake_to_screen_y; - } - } - - if(cursor->flags&TEXTFLAG_RENDER) - gfx_quads_end(); - } - - cursor->x = draw_x; - - if(got_new_line) - cursor->y = draw_y; -} - -void gfx_text(void *font_set_v, float x, float y, float size, const char *text, int max_width) -{ - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, x, y, size, TEXTFLAG_RENDER); - cursor.line_width = max_width; - gfx_text_ex(&cursor, text, -1); -} - -float gfx_text_width(void *font_set_v, float size, const char *text, int length) -{ - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, 0, 0, size, 0); - gfx_text_ex(&cursor, text, length); - return cursor.x; -} - -void gfx_text_color(float r, float g, float b, float a) -{ - text_r = r; - text_g = g; - text_b = b; - text_a = a; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_inp.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_inp.cpp deleted file mode 100644 index b2f5644c0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_inp.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "SDL.h" - -#include -#include -#include - -#include - -static struct -{ - unsigned char presses; - unsigned char releases; -} input_count[2][1024] = {{{0}}, {{0}}}; - -static unsigned char input_state[2][1024] = {{0}, {0}}; - -static int input_current = 0; -static int input_grabbed = 0; - -static unsigned int last_release = 0; -static unsigned int release_delta = -1; - -extern SDL_Joystick * EC_joystick; -extern SDL_Surface *EC_screen_surface; - -static void add_event(char c, int key, int flags); - -void inp_mouse_relative(int *x, int *y) -{ - int nx = 0, ny = 0; - float sens = config.inp_mousesens/100.0f; - - if(config.inp_grab) - SDL_GetRelativeMouseState(&nx, &ny); - else - { - if(input_grabbed) - { - SDL_GetMouseState(&nx,&ny); - SDL_WarpMouse(gfx_screenwidth()/2,gfx_screenheight()/2); - nx -= gfx_screenwidth()/2; ny -= gfx_screenheight()/2; - } - } - - *x = nx*sens; - *y = ny*sens; -} - -void inp_mouse_absolute(int *x, int *y) -{ - SDL_GetMouseState(x, y); -} - -void inp_warp_mouse(int x, int y) -{ - SDL_WarpMouse(x,y); -} - -int inp_process_joystick() -{ - if( !EC_joystick || !EC_screen_surface ) - return 0; - int jx = SDL_JoystickGetAxis(EC_joystick, 0); - int jy = SDL_JoystickGetAxis(EC_joystick, 1); - if( abs(jx) > 10 && abs(jy) > 10 ) - { - jx = (jx + 32768) * EC_screen_surface->w / 65536; - jy = (jy + 32768) * EC_screen_surface->h / 65536; - SDL_WarpMouse(jx,jy); - SDL_PumpEvents(); - return 1; - } - return 0; -} - -enum -{ - INPUT_BUFFER_SIZE=32 -}; - -static INPUT_EVENT input_events[INPUT_BUFFER_SIZE]; -static int num_events = 0; - -static void add_event(char c, int key, int flags) -{ - if(num_events != INPUT_BUFFER_SIZE) - { - input_events[num_events].ch = c; - input_events[num_events].key = key; - input_events[num_events].flags = flags; - num_events++; - } -} - -int inp_num_events() -{ - return num_events; -} - -void inp_clear_events() -{ - num_events = 0; -} - -INPUT_EVENT inp_get_event(int index) -{ - if(index < 0 || index >= num_events) - { - INPUT_EVENT e = {0,0}; - return e; - } - - return input_events[index]; -} - -void inp_init() -{ - SDL_EnableUNICODE(1); - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -void inp_mouse_mode_absolute() -{ - SDL_ShowCursor(1); - input_grabbed = 0; - if(config.inp_grab) - SDL_WM_GrabInput(SDL_GRAB_OFF); -} - -void inp_mouse_mode_relative() -{ - SDL_ShowCursor(0); - input_grabbed = 1; - if(config.inp_grab) - SDL_WM_GrabInput(SDL_GRAB_ON); -} - -int inp_mouse_doubleclick() -{ - return release_delta < (time_freq() >> 2); -} - -void inp_clear_key_states() -{ - mem_zero(input_state, sizeof(input_state)); - mem_zero(input_count, sizeof(input_count)); -} - -int inp_key_presses(int key) -{ - return input_count[input_current][key].presses; -} - -int inp_key_releases(int key) -{ - return input_count[input_current][key].releases; -} - -int inp_key_state(int key) -{ - return input_state[input_current][key]; -} - -int inp_key_pressed(int key) { return input_state[input_current][key]; } -int inp_key_was_pressed(int key) { return input_state[input_current^1][key]; } -int inp_key_down(int key) { return inp_key_pressed(key)&&!inp_key_was_pressed(key); } -int inp_button_pressed(int button) { return input_state[input_current][button]; } - -static int oldjoy = 0; - -void inp_update() -{ - int i; - - if(input_grabbed && !gfx_window_active()) - inp_mouse_mode_absolute(); - - /*if(!input_grabbed && gfx_window_active()) - inp_mouse_mode_relative();*/ - - /* clear and begin count on the other one */ - input_current^=1; - mem_zero(&input_count[input_current], sizeof(input_count[input_current])); - mem_zero(&input_state[input_current], sizeof(input_state[input_current])); - - { - Uint8 *state = SDL_GetKeyState(&i); - if(i >= KEY_LAST) - i = KEY_LAST-1; - mem_copy(input_state[input_current], state, i); - } - - /* these states must always be updated manually because they are not in the GetKeyState from SDL */ - i = SDL_GetMouseState(NULL, NULL); - int joy = inp_process_joystick(); - if(i&SDL_BUTTON(1)) input_state[input_current][KEY_MOUSE_1] = 1; /* 1 is left */ - if(i&SDL_BUTTON(3)) input_state[input_current][KEY_MOUSE_2] = 1; /* 3 is right */ - if(i&SDL_BUTTON(2)) input_state[input_current][KEY_MOUSE_3] = 1; /* 2 is middle */ - if(i&SDL_BUTTON(4)) input_state[input_current][KEY_MOUSE_4] = 1; - if(i&SDL_BUTTON(5)) input_state[input_current][KEY_MOUSE_5] = 1; - if(i&SDL_BUTTON(6)) input_state[input_current][KEY_MOUSE_6] = 1; - if(i&SDL_BUTTON(7)) input_state[input_current][KEY_MOUSE_7] = 1; - if(i&SDL_BUTTON(8)) input_state[input_current][KEY_MOUSE_8] = 1; - - { - SDL_Event event; - - while(SDL_PollEvent(&event)) - { - int key = -1; - int action = INPFLAG_PRESS; - switch (event.type) - { - /* handle keys */ - case SDL_KEYDOWN: - if(event.key.keysym.unicode < 255) - add_event(event.key.keysym.unicode, 0, 0); - key = event.key.keysym.sym; - break; - case SDL_KEYUP: - action = INPFLAG_RELEASE; - key = event.key.keysym.sym; - break; - - /* handle mouse buttons */ - case SDL_MOUSEBUTTONUP: - action = INPFLAG_RELEASE; - - if(event.button.button == 1) - { - release_delta = time_get() - last_release; - last_release = time_get(); - } - - /* fall through */ - case SDL_MOUSEBUTTONDOWN: - if(event.button.button == SDL_BUTTON_LEFT) key = KEY_MOUSE_1; - if(event.button.button == SDL_BUTTON_RIGHT) key = KEY_MOUSE_2; - if(event.button.button == SDL_BUTTON_MIDDLE) key = KEY_MOUSE_3; - if(event.button.button == SDL_BUTTON_WHEELUP) key = KEY_MOUSE_WHEEL_UP; - if(event.button.button == SDL_BUTTON_WHEELDOWN) key = KEY_MOUSE_WHEEL_DOWN; - if(event.button.button == 6) key = KEY_MOUSE_6; - if(event.button.button == 7) key = KEY_MOUSE_7; - if(event.button.button == 8) key = KEY_MOUSE_8; - break; - - /* other messages */ - case SDL_QUIT: -#ifdef ANDROID - case SDL_VIDEORESIZE: -#endif - /* TODO: cleaner exit */ - exit(0); - break; - } - - /* */ - if(key != -1) - { - input_count[input_current][key].presses++; - if(action == INPFLAG_PRESS) - input_state[input_current][key] = 1; - add_event(0, key, action); - } - - } - - if(joy && !input_state[input_current][KEY_MOUSE_1]) - { - input_count[input_current][KEY_MOUSE_1].presses++; - add_event(0, KEY_MOUSE_1, INPFLAG_PRESS); - } - if(!joy && oldjoy && !(i&SDL_BUTTON(1))) - { - input_count[input_current][KEY_MOUSE_1].presses++; - add_event(0, KEY_MOUSE_1, INPFLAG_RELEASE); - } - oldjoy = joy; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_snd.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_snd.cpp deleted file mode 100644 index 7b2546e3f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_snd.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include - -#include "SDL.h" - - -extern "C" { -#include -} - -#include -#include -#include -#ifdef ANDROID -#include -#include -#endif - -enum -{ - NUM_SAMPLES = 512, - NUM_VOICES = 64, - NUM_CHANNELS = 16, -}; - -typedef struct -{ - short *data; - int num_frames; - int rate; - int channels; - int loop_start; - int loop_end; -} SAMPLE; - -typedef struct -{ - int vol; - int pan; -} CHANNEL; - -typedef struct -{ - SAMPLE *snd; - CHANNEL *channel; - int tick; - int vol; /* 0 - 255 */ - int flags; - int x, y; -} VOICE; - -static SAMPLE samples[NUM_SAMPLES] = { {0} }; -static VOICE voices[NUM_VOICES] = { {0} }; -static CHANNEL channels[NUM_CHANNELS] = { {255, 0} }; - -static LOCK sound_lock = 0; -static int sound_enabled = 0; - -static int center_x = 0; -static int center_y = 0; - -static int mixing_rate = 48000; -static volatile int sound_volume = 100; - -static int next_voice = 0; -static int * mix_buffer = NULL; - -void snd_set_channel(int cid, float vol, float pan) -{ - channels[cid].vol = (int)(vol*255.0f); - channels[cid].pan = (int)(pan*255.0f); /* TODO: this is only on and off right now */ -} - -static int play(int cid, int sid, int flags, float x, float y) -{ - int vid = -1; - int i; - - lock_wait(sound_lock); - - /* search for voice */ - for(i = 0; i < NUM_VOICES; i++) - { - int id = (next_voice + i) % NUM_VOICES; - if(!voices[id].snd) - { - vid = id; - next_voice = id+1; - break; - } - } - - /* voice found, use it */ - if(vid != -1) - { - voices[vid].snd = &samples[sid]; - voices[vid].channel = &channels[cid]; - voices[vid].tick = 0; - voices[vid].vol = 255; - voices[vid].flags = flags; - voices[vid].x = (int)x; - voices[vid].y = (int)y; - } - - lock_release(sound_lock); - return vid; -} - -int snd_play_at(int cid, int sid, int flags, float x, float y) -{ - return play(cid, sid, flags|SNDFLAG_POS, x, y); -} - -int snd_play(int cid, int sid, int flags) -{ - return play(cid, sid, flags, 0, 0); -} - -void snd_stop(int vid) -{ - /* TODO: a nice fade out */ - lock_wait(sound_lock); - voices[vid].snd = 0; - lock_release(sound_lock); -} - -/* TODO: there should be a faster way todo this */ -static short int2short(int i) -{ - if(i > 0x7fff) - return 0x7fff; - else if(i < -0x7fff) - return -0x7fff; - return i; -} - -static int iabs(int i) -{ - if(i<0) - return -i; - return i; -} - -static void mix(short *final_out, unsigned frames) -{ - int i, s; - int master_vol; - - /* aquire lock while we are mixing */ - lock_wait(sound_lock); - -#ifdef ANDROID - bzero(mix_buffer, frames * 2 * sizeof(int)); -#else - memset(mix_buffer, 0, sizeof(mix_buffer)); -#endif - - master_vol = sound_volume; - - for(i = 0; i < NUM_VOICES; i++) - { - if(voices[i].snd) - { - /* mix voice */ - VOICE *v = &voices[i]; - int *out = mix_buffer; - - int step = v->snd->channels; /* setup input sources */ - short *in_l = &v->snd->data[v->tick*step]; - short *in_r = &v->snd->data[v->tick*step+1]; - - int end = v->snd->num_frames-v->tick; - - int rvol = v->channel->vol; - int lvol = v->channel->vol; - - /* make sure that we don't go outside the sound data */ - if(frames < end) - end = frames; - - /* check if we have a mono sound */ - if(v->snd->channels == 1) - in_r = in_l; - - /* volume calculation */ - if(v->flags&SNDFLAG_POS && v->channel->pan) - { - /* TODO: we should respect the channel panning value */ - const int range = 1500; /* magic value, remove */ - int dx = v->x - center_x; - int dy = v->y - center_y; - int dist = sqrt(dx*dx+dy*dy); /* double here. nasty */ - int p = iabs(dx); - if(dist < range) - { - /* panning */ - if(dx > 0) - lvol = ((range-p)*lvol)/range; - else - rvol = ((range-p)*rvol)/range; - - /* falloff */ - lvol = (lvol*(range-dist))/range; - rvol = (rvol*(range-dist))/range; - } - else - { - lvol = 0; - rvol = 0; - } - } - - /* process all frames */ - for(s = 0; s < end; s++) - { - *out++ += (*in_l)*lvol; - *out++ += (*in_r)*rvol; - in_l += step; - in_r += step; - v->tick++; - } - - /* free voice if not used any more */ - if(v->tick == v->snd->num_frames) - v->snd = 0; - - } - } - - - /* release the lock */ - lock_release(sound_lock); - - { - /* clamp accumulated values */ - /* TODO: this seams slow */ - for(i = 0; i < frames; i++) - { - int j = i<<1; - int vl = ((mix_buffer[j]*master_vol)/101)>>8; - int vr = ((mix_buffer[j+1]*master_vol)/101)>>8; - - final_out[j] = int2short(vl); - final_out[j+1] = int2short(vr); - } - } - -#if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(final_out, sizeof(short), frames * 2); -#endif -} - -static void sdlcallback(void *unused, Uint8 *stream, int len) -{ - mix((short *)stream, len/2/2); -} - -int snd_init() -{ - SDL_AudioSpec format, format2; - - sound_lock = lock_create(); - - if(!config.snd_enable) - return 0; - - mixing_rate = config.snd_rate; - - /* Set 16-bit stereo audio at 22Khz */ - format.freq = config.snd_rate; - format.format = AUDIO_S16; - format.channels = 2; - format.samples = config.snd_buffer_size; - format.callback = sdlcallback; - format.userdata = NULL; - - /* Open the audio device and start playing sound! */ - if(SDL_OpenAudio(&format, &format2) < 0) - { - dbg_msg("client/sound", "unable to open audio: %s", SDL_GetError()); - return -1; - } - else - dbg_msg("client/sound", "sound init successful"); - - mix_buffer = (int *)malloc(format2.samples * 2 * sizeof(int)); - - SDL_PauseAudio(0); - - sound_enabled = 1; - snd_update(); /* update the volume */ - return 0; -} - -int snd_update() -{ - /* update volume */ - int wanted_volume = config.snd_volume; - - if(!gfx_window_active() && config.snd_nonactive_mute) - wanted_volume = 0; - - if(wanted_volume != sound_volume) - { - lock_wait(sound_lock); - sound_volume = wanted_volume; - lock_release(sound_lock); - } - - return 0; -} - -int snd_shutdown() -{ - SDL_CloseAudio(); - lock_destroy(sound_lock); - if( mix_buffer ) - free(mix_buffer); - mix_buffer = NULL; - return 0; -} - -int snd_alloc_id() -{ - /* TODO: linear search, get rid of it */ - unsigned sid; - for(sid = 0; sid < NUM_SAMPLES; sid++) - { - if(samples[sid].data == 0x0) - return sid; - } - - return -1; -} - -static void rate_convert(int sid) -{ - SAMPLE *snd = &samples[sid]; - int num_frames = 0; - short *new_data = 0; - int i; - - /* make sure that we need to convert this sound */ - if(!snd->data || snd->rate == mixing_rate) - return; - - /* allocate new data */ - num_frames = (int)((snd->num_frames/(float)snd->rate)*mixing_rate); - new_data = (Sint16 *)mem_alloc(num_frames*snd->channels*sizeof(short), 1); - - for(i = 0; i < num_frames; i++) - { - /* resample TODO: this should be done better, like linear atleast */ - float a = i/(float)num_frames; - int f = (int)(a*snd->num_frames); - if(f >= snd->num_frames) - f = snd->num_frames-1; - - /* set new data */ - if(snd->channels == 1) - new_data[i] = snd->data[f]; - else if(snd->channels == 2) - { - new_data[i*2] = snd->data[f*2]; - new_data[i*2+1] = snd->data[f*2+1]; - } - } - - /* free old data and apply new */ - mem_free(snd->data); - snd->data = new_data; - snd->num_frames = num_frames; -} - - -static IOHANDLE file = NULL; - -static int read_data(void *buffer, int size) -{ - return io_read(file, buffer, size); -} - -int snd_load_wv(const char *filename) -{ - SAMPLE *snd; - int sid = -1; - char error[100]; - WavpackContext *context; - - /* don't waste memory on sound when we are stress testing */ - if(config.dbg_stress) - return -1; - - /* no need to load sound when we are running with no sound */ - if(!sound_enabled) - return 1; - - file = engine_openfile(filename, IOFLAG_READ); /* TODO: use system.h stuff for this */ - if(!file) - { - dbg_msg("sound/wv", "failed to open %s", filename); - return -1; - } - - sid = snd_alloc_id(); - if(sid < 0) - return -1; - snd = &samples[sid]; - - context = WavpackOpenFileInput(read_data, error); - if (context) - { - int samples = WavpackGetNumSamples(context); - int bitspersample = WavpackGetBitsPerSample(context); - unsigned int samplerate = WavpackGetSampleRate(context); - int channels = WavpackGetNumChannels(context); - int *data; - int *src; - short *dst; - int i; - - snd->channels = channels; - snd->rate = samplerate; - - if(snd->channels > 2) - { - dbg_msg("sound/wv", "file is not mono or stereo. filename='%s'", filename); - return -1; - } - - /* - if(snd->rate != 44100) - { - dbg_msg("sound/wv", "file is %d Hz, not 44100 Hz. filename='%s'", snd->rate, filename); - return -1; - }*/ - - if(bitspersample != 16) - { - dbg_msg("sound/wv", "bps is %d, not 16, filname='%s'", bitspersample, filename); - return -1; - } - - data = (int *)mem_alloc(4*samples*channels, 1); - WavpackUnpackSamples(context, data, samples); /* TODO: check return value */ - src = data; - - snd->data = (short *)mem_alloc(2*samples*channels, 1); - dst = snd->data; - - for (i = 0; i < samples*channels; i++) - *dst++ = (short)*src++; - - mem_free(data); - - snd->num_frames = samples; - snd->loop_start = -1; - snd->loop_end = -1; - } - else - { - dbg_msg("sound/wv", "failed to open %s: %s", filename, error); - } - - io_close(file); - file = NULL; - - if(config.debug) - dbg_msg("sound/wv", "loaded %s", filename); - - rate_convert(sid); - return sid; -} - -void snd_set_listener_pos(float x, float y) -{ - center_x = (int)x; - center_y = (int)y; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_srvbrowse.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_srvbrowse.cpp deleted file mode 100644 index 1744c0071..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/client/ec_srvbrowse.cpp +++ /dev/null @@ -1,737 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -extern NETCLIENT *net; - - -/* ------ server browse ---- */ -/* TODO: move all this to a separate file */ - -typedef struct SERVERENTRY_t SERVERENTRY; -struct SERVERENTRY_t -{ - NETADDR addr; - int64 request_time; - int got_info; - SERVER_INFO info; - - SERVERENTRY *next_ip; /* ip hashed list */ - - SERVERENTRY *prev_req; /* request list */ - SERVERENTRY *next_req; -}; - -static HEAP *serverlist_heap = 0; -static SERVERENTRY **serverlist = 0; -static int *sorted_serverlist = 0; - -enum -{ - MAX_FAVORITES=256 -}; - -static NETADDR favorite_servers[MAX_FAVORITES]; -static int num_favorite_servers = 0; - -static SERVERENTRY *serverlist_ip[256] = {0}; /* ip hash list */ - -static SERVERENTRY *first_req_server = 0; /* request list */ -static SERVERENTRY *last_req_server = 0; -static int num_requests = 0; - -static int need_refresh = 0; - -static int num_sorted_servers = 0; -static int num_sorted_servers_capacity = 0; -static int num_servers = 0; -static int num_server_capacity = 0; - -static int sorthash = 0; -static char filterstring[64] = {0}; -static char filtergametypestring[128] = {0}; - -/* the token is to keep server refresh separated from each other */ -static int current_token = 1; - -static int serverlist_type = 0; -static int64 broadcast_time = 0; - -int client_serverbrowse_lan() { return serverlist_type == BROWSETYPE_LAN; } -int client_serverbrowse_num() { return num_servers; } - -SERVER_INFO *client_serverbrowse_get(int index) -{ - if(index < 0 || index >= num_servers) - return 0; - return &serverlist[index]->info; -} - -int client_serverbrowse_sorted_num() { return num_sorted_servers; } - -SERVER_INFO *client_serverbrowse_sorted_get(int index) -{ - if(index < 0 || index >= num_sorted_servers) - return 0; - return &serverlist[sorted_serverlist[index]]->info; -} - - -int client_serverbrowse_num_requests() -{ - return num_requests; -} - -static int client_serverbrowse_sort_compare_name(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - return strcmp(a->info.name, b->info.name); -} - -static int client_serverbrowse_sort_compare_map(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - return strcmp(a->info.map, b->info.map); -} - -static int client_serverbrowse_sort_compare_ping(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - if(a->info.latency > b->info.latency) return 1; - if(a->info.latency < b->info.latency) return -1; - return 0; -} - -static int client_serverbrowse_sort_compare_gametype(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - return strcmp(a->info.gametype, b->info.gametype); -} - -static int client_serverbrowse_sort_compare_progression(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - if(a->info.progression > b->info.progression) return 1; - if(a->info.progression < b->info.progression) return -1; - return 0; -} - -static int client_serverbrowse_sort_compare_numplayers(const void *ai, const void *bi) -{ - SERVERENTRY *a = serverlist[*(const int*)ai]; - SERVERENTRY *b = serverlist[*(const int*)bi]; - if(a->info.num_players > b->info.num_players) return 1; - if(a->info.num_players < b->info.num_players) return -1; - return 0; -} - -static void client_serverbrowse_filter() -{ - int i = 0, p = 0; - num_sorted_servers = 0; - - /* allocate the sorted list */ - if(num_sorted_servers_capacity < num_servers) - { - if(sorted_serverlist) - mem_free(sorted_serverlist); - num_sorted_servers_capacity = num_servers; - sorted_serverlist = (int *)mem_alloc(num_sorted_servers_capacity*sizeof(int), 1); - } - - /* filter the servers */ - for(i = 0; i < num_servers; i++) - { - int filtered = 0; - - if(config.b_filter_empty && serverlist[i]->info.num_players == 0) - filtered = 1; - else if(config.b_filter_full && serverlist[i]->info.num_players == serverlist[i]->info.max_players) - filtered = 1; - else if(config.b_filter_pw && serverlist[i]->info.flags&SRVFLAG_PASSWORD) - filtered = 1; - else if(config.b_filter_pure && (strcmp(serverlist[i]->info.gametype, "DM") != 0 && strcmp(serverlist[i]->info.gametype, "TDM") != 0 && strcmp(serverlist[i]->info.gametype, "CTF") != 0)) - filtered = 1; - else if(config.b_filter_pure_map && - !(strcmp(serverlist[i]->info.map, "dm1") == 0 || - strcmp(serverlist[i]->info.map, "dm2") == 0 || - strcmp(serverlist[i]->info.map, "dm6") == 0 || - strcmp(serverlist[i]->info.map, "dm7") == 0 || - strcmp(serverlist[i]->info.map, "dm8") == 0 || - strcmp(serverlist[i]->info.map, "dm9") == 0 || - strcmp(serverlist[i]->info.map, "ctf1") == 0 || - strcmp(serverlist[i]->info.map, "ctf2") == 0 || - strcmp(serverlist[i]->info.map, "ctf3") == 0 || - strcmp(serverlist[i]->info.map, "ctf4") == 0 || - strcmp(serverlist[i]->info.map, "ctf5") == 0) - ) - { - filtered = 1; - } - else if(config.b_filter_ping < serverlist[i]->info.latency) - filtered = 1; - else if(config.b_filter_compatversion && strncmp(serverlist[i]->info.version, modc_net_version(), 3) != 0) - filtered = 1; - else - { - if(config.b_filter_string[0] != 0) - { - int matchfound = 0; - - serverlist[i]->info.quicksearch_hit = 0; - - /* match against server name */ - if(str_find_nocase(serverlist[i]->info.name, config.b_filter_string)) - { - matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_SERVERNAME; - } - - /* match against players */ - for(p = 0; p < serverlist[i]->info.num_players; p++) - { - if(str_find_nocase(serverlist[i]->info.players[p].name, config.b_filter_string)) - { - matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_PLAYERNAME; - break; - } - } - - /* match against map */ - if(str_find_nocase(serverlist[i]->info.map, config.b_filter_string)) - { - matchfound = 1; - serverlist[i]->info.quicksearch_hit |= BROWSEQUICK_MAPNAME; - } - - if(!matchfound) - filtered = 1; - } - - if(!filtered && config.b_filter_gametype[0] != 0) - { - /* match against game type */ - if(!str_find_nocase(serverlist[i]->info.gametype, config.b_filter_gametype)) - filtered = 1; - } - } - - if(filtered == 0) - sorted_serverlist[num_sorted_servers++] = i; - } -} - -static int client_serverbrowse_sorthash() -{ - int i = config.b_sort&0xf; - i |= config.b_filter_empty<<4; - i |= config.b_filter_full<<5; - i |= config.b_filter_pw<<6; - i |= config.b_sort_order<<7; - i |= config.b_filter_compatversion<<8; - i |= config.b_filter_pure<<9; - i |= config.b_filter_pure_map<<10; - i |= config.b_filter_ping<<16; - return i; -} - -static void client_serverbrowse_sort() -{ - int i; - - /* create filtered list */ - client_serverbrowse_filter(); - - /* sort */ - if(config.b_sort == BROWSESORT_NAME) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_name); - else if(config.b_sort == BROWSESORT_PING) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_ping); - else if(config.b_sort == BROWSESORT_MAP) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_map); - else if(config.b_sort == BROWSESORT_NUMPLAYERS) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_numplayers); - else if(config.b_sort == BROWSESORT_GAMETYPE) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_gametype); - else if(config.b_sort == BROWSESORT_PROGRESSION) - qsort(sorted_serverlist, num_sorted_servers, sizeof(int), client_serverbrowse_sort_compare_progression); - - /* invert the list if requested */ - if(config.b_sort_order) - { - for(i = 0; i < num_sorted_servers/2; i++) - { - int temp = sorted_serverlist[i]; - sorted_serverlist[i] = sorted_serverlist[num_sorted_servers-i-1]; - sorted_serverlist[num_sorted_servers-i-1] = temp; - } - } - - /* set indexes */ - for(i = 0; i < num_sorted_servers; i++) - serverlist[sorted_serverlist[i]]->info.sorted_index = i; - - str_copy(filtergametypestring, config.b_filter_gametype, sizeof(filtergametypestring)); - str_copy(filterstring, config.b_filter_string, sizeof(filterstring)); - sorthash = client_serverbrowse_sorthash(); -} - -static void client_serverbrowse_remove_request(SERVERENTRY *entry) -{ - if(entry->prev_req || entry->next_req || first_req_server == entry) - { - if(entry->prev_req) - entry->prev_req->next_req = entry->next_req; - else - first_req_server = entry->next_req; - - if(entry->next_req) - entry->next_req->prev_req = entry->prev_req; - else - last_req_server = entry->prev_req; - - entry->prev_req = 0; - entry->next_req = 0; - num_requests--; - } -} - -static SERVERENTRY *client_serverbrowse_find(NETADDR *addr) -{ - SERVERENTRY *entry = serverlist_ip[addr->ip[0]]; - - for(; entry; entry = entry->next_ip) - { - if(net_addr_comp(&entry->addr, addr) == 0) - return entry; - } - return (SERVERENTRY*)0; -} - -void client_serverbrowse_queuerequest(SERVERENTRY *entry) -{ - /* add it to the list of servers that we should request info from */ - entry->prev_req = last_req_server; - if(last_req_server) - last_req_server->next_req = entry; - else - first_req_server = entry; - last_req_server = entry; - - num_requests++; -} - -void client_serverbrowse_setinfo(SERVERENTRY *entry, SERVER_INFO *info) -{ - int fav = entry->info.favorite; - entry->info = *info; - entry->info.favorite = fav; - entry->info.netaddr = entry->addr; - - // all these are just for nice compability - if(entry->info.gametype[0] == '0' && entry->info.gametype[1] == 0) - str_copy(entry->info.gametype, "DM", sizeof(entry->info.gametype)); - else if(entry->info.gametype[0] == '1' && entry->info.gametype[1] == 0) - str_copy(entry->info.gametype, "TDM", sizeof(entry->info.gametype)); - else if(entry->info.gametype[0] == '2' && entry->info.gametype[1] == 0) - str_copy(entry->info.gametype, "CTF", sizeof(entry->info.gametype)); - - /*if(!request) - { - entry->info.latency = (time_get()-entry->request_time)*1000/time_freq(); - client_serverbrowse_remove_request(entry); - }*/ - - entry->got_info = 1; - client_serverbrowse_sort(); -} - -SERVERENTRY *client_serverbrowse_add(NETADDR *addr) -{ - int hash = addr->ip[0]; - SERVERENTRY *entry = 0; - int i; - - /* create new entry */ - entry = (SERVERENTRY *)memheap_allocate(serverlist_heap, sizeof(SERVERENTRY)); - mem_zero(entry, sizeof(SERVERENTRY)); - - /* set the info */ - entry->addr = *addr; - entry->info.netaddr = *addr; - - entry->info.latency = 999; - str_format(entry->info.address, sizeof(entry->info.address), "%d.%d.%d.%d:%d", - addr->ip[0], addr->ip[1], addr->ip[2], - addr->ip[3], addr->port); - str_format(entry->info.name, sizeof(entry->info.name), "\255%d.%d.%d.%d:%d", /* the \255 is to make sure that it's sorted last */ - addr->ip[0], addr->ip[1], addr->ip[2], - addr->ip[3], addr->port); - - /*if(serverlist_type == BROWSETYPE_LAN) - entry->info.latency = (time_get()-broadcast_time)*1000/time_freq();*/ - - /* check if it's a favorite */ - for(i = 0; i < num_favorite_servers; i++) - { - if(net_addr_comp(addr, &favorite_servers[i]) == 0) - entry->info.favorite = 1; - } - - /* add to the hash list */ - entry->next_ip = serverlist_ip[hash]; - serverlist_ip[hash] = entry; - - if(num_servers == num_server_capacity) - { - SERVERENTRY **newlist; - num_server_capacity += 100; - newlist = (SERVERENTRY**)mem_alloc(num_server_capacity*sizeof(SERVERENTRY*), 1); - mem_copy(newlist, serverlist, num_servers*sizeof(SERVERENTRY*)); - mem_free(serverlist); - serverlist = newlist; - } - - /* add to list */ - serverlist[num_servers] = entry; - entry->info.server_index = num_servers; - num_servers++; - - return entry; -} - -void client_serverbrowse_set(NETADDR *addr, int type, int token, SERVER_INFO *info) -{ - SERVERENTRY *entry = 0; - if(type == BROWSESET_MASTER_ADD) - { - if(serverlist_type != BROWSETYPE_INTERNET) - return; - - if(!client_serverbrowse_find(addr)) - { - entry = client_serverbrowse_add(addr); - client_serverbrowse_queuerequest(entry); - } - } - else if(type == BROWSESET_FAV_ADD) - { - if(serverlist_type != BROWSETYPE_FAVORITES) - return; - - if(!client_serverbrowse_find(addr)) - { - entry = client_serverbrowse_add(addr); - client_serverbrowse_queuerequest(entry); - } - } - else if(type == BROWSESET_TOKEN) - { - if(token != current_token) - return; - - entry = client_serverbrowse_find(addr); - if(!entry) - entry = client_serverbrowse_add(addr); - if(entry) - { - client_serverbrowse_setinfo(entry, info); - if(serverlist_type == BROWSETYPE_LAN) - entry->info.latency = (time_get()-broadcast_time)*1000/time_freq(); - else - entry->info.latency = (time_get()-entry->request_time)*1000/time_freq(); - client_serverbrowse_remove_request(entry); - } - } - else if(type == BROWSESET_OLD_INTERNET) - { - entry = client_serverbrowse_find(addr); - if(entry) - { - client_serverbrowse_setinfo(entry, info); - - if(serverlist_type == BROWSETYPE_LAN) - entry->info.latency = (time_get()-broadcast_time)*1000/time_freq(); - else - entry->info.latency = (time_get()-entry->request_time)*1000/time_freq(); - client_serverbrowse_remove_request(entry); - } - } - else if(type == BROWSESET_OLD_LAN) - { - entry = client_serverbrowse_find(addr); - if(entry) - if(!entry) - entry = client_serverbrowse_add(addr); - if(entry) - client_serverbrowse_setinfo(entry, info); - } - - client_serverbrowse_sort(); -} - -void client_serverbrowse_refresh(int type) -{ - /* clear out everything */ - if(serverlist_heap) - memheap_destroy(serverlist_heap); - serverlist_heap = memheap_create(); - num_servers = 0; - num_sorted_servers = 0; - mem_zero(serverlist_ip, sizeof(serverlist_ip)); - first_req_server = 0; - last_req_server = 0; - num_requests = 0; - - /* next token */ - current_token = (current_token+1)&0xff; - - /* */ - serverlist_type = type; - - if(type == BROWSETYPE_LAN) - { - unsigned char buffer[sizeof(SERVERBROWSE_GETINFO)+1]; - NETCHUNK packet; - int i; - - mem_copy(buffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO)); - buffer[sizeof(SERVERBROWSE_GETINFO)] = current_token; - - packet.client_id = -1; - mem_zero(&packet, sizeof(packet)); - packet.address.ip[0] = 255; - packet.address.ip[1] = 255; - packet.address.ip[2] = 255; - packet.address.ip[3] = 255; - packet.flags = NETSENDFLAG_CONNLESS; - packet.data_size = sizeof(buffer); - packet.data = buffer; - broadcast_time = time_get(); - - for(i = 8303; i <= 8310; i++) - { - packet.address.port = i; - netclient_send(net, &packet); - } - - if(config.debug) - dbg_msg("client", "broadcasting for servers"); - } - else if(type == BROWSETYPE_INTERNET) - need_refresh = 1; - else if(type == BROWSETYPE_FAVORITES) - { - int i; - for(i = 0; i < num_favorite_servers; i++) - client_serverbrowse_set(&favorite_servers[i], BROWSESET_FAV_ADD, -1, 0); - } -} - -static void client_serverbrowse_request_impl(NETADDR *addr, SERVERENTRY *entry) -{ - /*unsigned char buffer[sizeof(SERVERBROWSE_GETINFO)+1];*/ - NETCHUNK p; - - if(config.debug) - { - dbg_msg("client", "requesting server info from %d.%d.%d.%d:%d", - addr->ip[0], addr->ip[1], addr->ip[2], - addr->ip[3], addr->port); - } - - /*mem_copy(buffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO)); - buffer[sizeof(SERVERBROWSE_GETINFO)] = current_token;*/ - - p.client_id = -1; - p.address = *addr; - p.flags = NETSENDFLAG_CONNLESS; - /*p.data_size = sizeof(buffer); - p.data = buffer; - netclient_send(net, &p);*/ - - /* send old requtest style aswell */ - p.data_size = sizeof(SERVERBROWSE_OLD_GETINFO); - p.data = SERVERBROWSE_OLD_GETINFO; - netclient_send(net, &p); - - if(entry) - entry->request_time = time_get(); -} - -void client_serverbrowse_request(NETADDR *addr) -{ - client_serverbrowse_request_impl(addr, 0); -} - - -void client_serverbrowse_update() -{ - int64 timeout = time_freq(); - int64 now = time_get(); - int count; - SERVERENTRY *entry, *next; - - /* do server list requests */ - if(need_refresh && !mastersrv_refreshing()) - { - NETADDR addr; - NETCHUNK p; - int i; - - need_refresh = 0; - - mem_zero(&p, sizeof(p)); - p.client_id = -1; - p.flags = NETSENDFLAG_CONNLESS; - p.data_size = sizeof(SERVERBROWSE_GETLIST); - p.data = SERVERBROWSE_GETLIST; - - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - addr = mastersrv_get(i); - if(!addr.ip[0] && !addr.ip[1] && !addr.ip[2] && !addr.ip[3]) - continue; - - p.address = addr; - netclient_send(net, &p); - } - - if(config.debug) - dbg_msg("client", "requesting server list"); - } - - /* do timeouts */ - entry = first_req_server; - while(1) - { - if(!entry) /* no more entries */ - break; - - next = entry->next_req; - - if(entry->request_time && entry->request_time+timeout < now) - { - /* timeout */ - client_serverbrowse_remove_request(entry); - num_requests--; - } - - entry = next; - } - - /* do timeouts */ - entry = first_req_server; - count = 0; - while(1) - { - if(!entry) /* no more entries */ - break; - - /* no more then 10 concurrent requests */ - if(count == config.b_max_requests) - break; - - if(entry->request_time == 0) - client_serverbrowse_request_impl(&entry->addr, entry); - - count++; - entry = entry->next_req; - } - - /* check if we need to resort */ - /* TODO: remove the strcmp */ - if(sorthash != client_serverbrowse_sorthash() || strcmp(filterstring, config.b_filter_string) != 0 || strcmp(filtergametypestring, config.b_filter_gametype) != 0) - client_serverbrowse_sort(); -} - - -int client_serverbrowse_isfavorite(NETADDR addr) -{ - /* search for the address */ - int i; - for(i = 0; i < num_favorite_servers; i++) - { - if(net_addr_comp(&addr, &favorite_servers[i]) == 0) - return 1; - } - return 0; -} - -void client_serverbrowse_addfavorite(NETADDR addr) -{ - int i; - SERVERENTRY *entry; - - if(num_favorite_servers == MAX_FAVORITES) - return; - - /* make sure that we don't already have the server in our list */ - for(i = 0; i < num_favorite_servers; i++) - { - if(net_addr_comp(&addr, &favorite_servers[i]) == 0) - return; - } - - /* add the server to the list */ - favorite_servers[num_favorite_servers++] = addr; - entry = client_serverbrowse_find(&addr); - if(entry) - entry->info.favorite = 1; - dbg_msg("", "added fav, %p", entry); -} - -void client_serverbrowse_removefavorite(NETADDR addr) -{ - int i; - SERVERENTRY *entry; - - for(i = 0; i < num_favorite_servers; i++) - { - if(net_addr_comp(&addr, &favorite_servers[i]) == 0) - { - mem_move(&favorite_servers[i], &favorite_servers[i+1], num_favorite_servers-(i+1)); - num_favorite_servers--; - - entry = client_serverbrowse_find(&addr); - if(entry) - entry->info.favorite = 0; - - return; - } - } -} - -void client_serverbrowse_save() -{ - int i; - char addrstr[128]; - char buffer[256]; - for(i = 0; i < num_favorite_servers; i++) - { - net_addr_str(&favorite_servers[i], addrstr, sizeof(addrstr)); - str_format(buffer, sizeof(buffer), "add_favorite %s", addrstr); - engine_config_write_line(buffer); - } -} - - -int client_serverbrowse_refreshingmasters() -{ - return mastersrv_refreshing(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/docs/client_time.txt b/project/jni/application/teeworlds-0.5.2/src/engine/docs/client_time.txt deleted file mode 100644 index bc76f91cd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/docs/client_time.txt +++ /dev/null @@ -1,11 +0,0 @@ -Title: Time on the client - -tick, intratick -predtick, predintratick - - prevtick tick predtick - 4 8 14 - |---------------------|---------------------| - 0 <- intratick -> 1 - 0 <- ticktime(in s)-> X - 0 <- predintratick?-> 1 diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/docs/prediction.txt b/project/jni/application/teeworlds-0.5.2/src/engine/docs/prediction.txt deleted file mode 100644 index d5771d1aa..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/docs/prediction.txt +++ /dev/null @@ -1,19 +0,0 @@ -Title: Prediction - -The engine calls when reprediction is required. This happens usally when new data has arrived from the server. should to prediction from the current snapshot and current snapshot tick ( + 1) upto and including the tick returned by . - -Predicted input sent to the server can be retrived by calling with the corresponding tick that you want the input for. Here is a simple example of how it might look. - -> void modc_predict() -> { -> int tick; -> prediction_reset(); -> -> for(tick = client_tick()+1; tick <= client_predtick(); tick++) -> { -> MY_INPUT *input = (MY_INPUT *)client_get_input(); -> if(input) -> prediction_apply_input(input); -> prediction_tick(); -> } -> } diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/docs/server_op.txt b/project/jni/application/teeworlds-0.5.2/src/engine/docs/server_op.txt deleted file mode 100644 index 59181e624..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/docs/server_op.txt +++ /dev/null @@ -1,39 +0,0 @@ -Title: Server Operation - -Section: Init - -Section: Running - -Here is an graph over how the server operates on each refresh. - -(start code) -load map -init mod - -while running - if map change then - load new map - shutdown mod - reset clients to init state - init mod - end if - - if new tick then - call - for each client do - create snapshot - send snapshot - end for - end - - process new network messages -end while - -unload map -(end) - - - -Section: Reinit - -Section: Shutdown diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/docs/snapshots.txt b/project/jni/application/teeworlds-0.5.2/src/engine/docs/snapshots.txt deleted file mode 100644 index 647b049ae..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/docs/snapshots.txt +++ /dev/null @@ -1,58 +0,0 @@ -Title: Snapshots - -Section: Overview - -Topic: Definitions - -- *Snapshot*. A is a serialized game state from which a client can render the game from. They are sent from the server at a regular interval and is created specificly for each client in order to reduce bandwidth. -- *Delta Snapshot*. A set of data that can be applied to a snapshot in order to create a new snapshot with the updated game state. - -Topic: Structure - -A snapshot contains a series of items. Each item have a type, id and data. - -- *Type*. Type of item. Could be projectile or character for example. -- *Id*. A unique id so the client can identify the item between two snapshots. -- *Data*. A series of 32-bit integers that contains the per item type specific data. - -Section: Server Side - -Topic: Creating - -Items can be added when is called using the function to insert an item to the snapshot. The server can not inspect the snapshot that is in progress of being created. - -Section: Client Side - -Topic: Inspection - is called when a new snapshot has arrived for processing. , and can be used to inspect the current and previous snapshot. This can be done anywhere while the client is running and not just in the function. The client can also call if an item contains improper information that could harm the operation of the client. This should however be done in to assure that no bad data propagates into the rest of the client. - -Topic: Rendering -DOCTODO - -Section: In depth - -Topic: Compression - -After a snapshot have been created, compression is applyed to reduce the bandwidth. There are several steps taken inorder to reduce the size of the size of the snapshot. - -- *Delta*. The server looks in a clients backlog of snapshots to find a previous acked snapshot. It then compares the two snapshots and creates a delta snapshot containing the changes from the previous acked snapshot to the new one. -- *Variable Integers*. The delta snapshot which is only consisting of 32-bit integers is then encoded into variable integers similar to UTF-8. Each byte has a bit that tells the decoder that it needs one more byte to decode the 32-bit integer. The first byte also contains a bit for telling the sign of the integer. - -> ESDDDDDD EDDDDDDD EDDDDDDD EDDDDDDD - -> E = extend -> S = sign -> D = data bit - -- *Huffman*. The last step is to compress the buffer with a huffman encoder. It uses a static tree that is weighted towards 0 because it's where most of the data will be because of the delta compression. - -Topic: Interval - -The interval for how often a client recives a snapshot changes during the course of the connection. There are three different snapshot rates. - -- *Init*. 5 snapshots per second. Used when a client is connecting and used until the client has acknowlaged a snapshot. This mechanism is used because the first snapshot because no delta compression can be done. - -- *Full*. Snapshot for every tick or every even tick depending on server configuration. This is used during normal gameplay and everything is running smooth. - -- *Recovery*. 1 snapshot each second. A client enters recovery rate when it havn't acknowlaged a snapshot over 1 second. This is to let the client to beable to recover if it has a slow connection. - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_client_interface.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_client_interface.h deleted file mode 100644 index 2cc9e5c79..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_client_interface.h +++ /dev/null @@ -1,25 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_CLIENT_INTERFACE_H -#define ENGINE_CLIENT_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "e_if_other.h" -#include "e_if_client.h" -#include "e_if_snd.h" -#include "e_if_gfx.h" -#include "e_if_inp.h" -#include "e_if_msg.h" -#include "e_if_modc.h" - -#include "e_console.h" -#include "e_config.h" -#include "client/ec_font.h" - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_common_interface.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_common_interface.h deleted file mode 100644 index 498bb6b48..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_common_interface.h +++ /dev/null @@ -1,16 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_COMMON_INTERFACE_H -#define ENGINE_COMMON_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "e_if_other.h" -#include "e_if_msg.h" - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.cpp deleted file mode 100644 index 0df91eb00..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_compression.h" - - -/* Format: ESDDDDDD EDDDDDDD EDD... Extended, Data, Sign */ -unsigned char *vint_pack(unsigned char *dst, int i) -{ - *dst = (i>>25)&0x40; /* set sign bit if i<0 */ - i = i^(i>>31); /* if(i<0) i = ~i */ - - *dst |= i&0x3F; /* pack 6bit into dst */ - i >>= 6; /* discard 6 bits */ - if(i) - { - *dst |= 0x80; /* set extend bit */ - while(1) - { - dst++; - *dst = i&(0x7F); /* pack 7bit */ - i >>= 7; /* discard 7 bits */ - *dst |= (i!=0)<<7; /* set extend bit (may branch) */ - if(!i) - break; - } - } - - dst++; - return dst; -} - -const unsigned char *vint_unpack(const unsigned char *src, int *i) -{ - int sign = (*src>>6)&1; - *i = *src&0x3F; - - do - { - if(!(*src&0x80)) break; - src++; - *i |= (*src&(0x7F))<<(6); - - if(!(*src&0x80)) break; - src++; - *i |= (*src&(0x7F))<<(6+7); - - if(!(*src&0x80)) break; - src++; - *i |= (*src&(0x7F))<<(6+7+7); - - if(!(*src&0x80)) break; - src++; - *i |= (*src&(0x7F))<<(6+7+7+7); - } while(0); - - src++; - *i ^= -sign; /* if(sign) *i = ~(*i) */ - return src; -} - - -long intpack_decompress(const void *src_, int size, void *dst_) -{ - const unsigned char *src = (unsigned char *)src_; - const unsigned char *end = src + size; - int *dst = (int *)dst_; - while(src < end) - { - src = vint_unpack(src, dst); - dst++; - } - return (long)((unsigned char *)dst-(unsigned char *)dst_); -} - -long intpack_compress(const void *src_, int size, void *dst_) -{ - int *src = (int *)src_; - unsigned char *dst = (unsigned char *)dst_; - size /= 4; - while(size) - { - dst = vint_pack(dst, *src); - size--; - src++; - } - return (long)(dst-(unsigned char *)dst_); -} - - -/* */ -long zerobit_compress(const void *src_, int size, void *dst_) -{ - unsigned char *src = (unsigned char *)src_; - unsigned char *dst = (unsigned char *)dst_; - - while(size) - { - unsigned char bit = 0x80; - unsigned char mask = 0; - int dst_move = 1; - int chunk = size < 8 ? size : 8; - int b; - size -= chunk; - - for(b = 0; b < chunk; b++, bit>>=1) - { - if(*src) - { - dst[dst_move] = *src; - mask |= bit; - dst_move++; - } - - src++; - } - - *dst = mask; - dst += dst_move; - } - - return (long)(dst-(unsigned char *)dst_); -} - -long zerobit_decompress(const void *src_, int size, void *dst_) -{ - unsigned char *src = (unsigned char *)src_; - unsigned char *dst = (unsigned char *)dst_; - unsigned char *end = src + size; - - while(src < end) - { - unsigned char bit = 0x80; - unsigned char mask = *src++; - int b; - - for(b = 0; b < 8; b++, bit>>=1) - { - if(mask&bit) - *dst++ = *src++; - else - *dst++ = 0; - } - - if(src > end) - return -1; - } - - return (long)(dst-(unsigned char *)dst_); -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.h deleted file mode 100644 index d5c212fbe..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_compression.h +++ /dev/null @@ -1,19 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* variable int packing */ -unsigned char *vint_pack(unsigned char *dst, int i); -const unsigned char *vint_unpack(const unsigned char *src, int *inout); -long intpack_compress(const void *src, int size, void *dst); -long intpack_decompress(const void *src, int size, void *dst); - -/* zerobit packing */ -long zerobit_compress(const void *src, int size, void *dst); -long zerobit_decompress(const void *src, int size, void *dst); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_config.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_config.cpp deleted file mode 100644 index 67a4c81a8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_config.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include -#include -#include - -#include -#include "e_if_other.h" -#include "e_config.h" -#include "e_linereader.h" -#include "e_engine.h" - -CONFIGURATION config; - -void config_reset() -{ - #define MACRO_CONFIG_INT(name,def,min,max,flags,desc) config.name = def; - #define MACRO_CONFIG_STR(name,len,def,flags,desc) str_copy(config.name, def, len); - - #include "e_config_variables.h" - - #undef MACRO_CONFIG_INT - #undef MACRO_CONFIG_STR -} - -void config_save() -{ - char linebuf[1024*2]; - - #define MACRO_CONFIG_INT(name,def,min,max,flags,desc) if((flags)&CFGFLAG_SAVE){ str_format(linebuf, sizeof(linebuf), "%s %i", #name, config.name); engine_config_write_line(linebuf); } - #define MACRO_CONFIG_STR(name,len,def,flags,desc) if((flags)&CFGFLAG_SAVE){ str_format(linebuf, sizeof(linebuf), "%s %s", #name, config.name); engine_config_write_line(linebuf); } - - #include "e_config_variables.h" - - #undef MACRO_CONFIG_INT - #undef MACRO_CONFIG_STR -} - -#define MACRO_CONFIG_INT(name,def,min,max,flags,desc) int config_get_ ## name (CONFIGURATION *c) { return c->name; } -#define MACRO_CONFIG_STR(name,len,def,flags,desc) const char *config_get_ ## name (CONFIGURATION *c) { return c->name; } -#include "e_config_variables.h" -#undef MACRO_CONFIG_INT -#undef MACRO_CONFIG_STR - -#define MACRO_CONFIG_INT(name,def,min,max,flags,desc) void config_set_ ## name (CONFIGURATION *c, int val) { if(min != max) { if (val < min) val = min; if (max != 0 && val > max) val = max; } c->name = val; } -#define MACRO_CONFIG_STR(name,len,def,flags,desc) void config_set_ ## name (CONFIGURATION *c, const char *str) { str_copy(c->name, str, len-1); c->name[sizeof(c->name)-1] = 0; } -#include "e_config_variables.h" -#undef MACRO_CONFIG_INT -#undef MACRO_CONFIG_STR diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_config.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_config.h deleted file mode 100644 index 965e08f05..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef _CONFIG_H -#define _CONFIG_H - -#ifdef __cplusplus -extern "C"{ -#endif - -typedef struct -{ - #define MACRO_CONFIG_INT(name,def,min,max,save,desc) int name; - #define MACRO_CONFIG_STR(name,len,def,save,desc) char name[len]; /* Flawfinder: ignore */ - #include "e_config_variables.h" - #undef MACRO_CONFIG_INT - #undef MACRO_CONFIG_STR -} CONFIGURATION; - -extern CONFIGURATION config; - -void config_init(); -void config_reset(); -void config_save(); - -enum -{ - CFGFLAG_SAVE=1, - CFGFLAG_CLIENT=2, - CFGFLAG_SERVER=4 -}; - -typedef int (*CONFIG_INT_GETTER)(CONFIGURATION *c); -typedef const char *(*CONFIG_STR_GETTER)(CONFIGURATION *c); -typedef void (*CONFIG_INT_SETTER)(CONFIGURATION *c, int val); -typedef void (*CONFIG_STR_SETTER)(CONFIGURATION *c, const char *str); - -#define MACRO_CONFIG_INT(name,def,min,max,flags,desc) int config_get_ ## name (CONFIGURATION *c); -#define MACRO_CONFIG_STR(name,len,def,flags,desc) const char *config_get_ ## name (CONFIGURATION *c); -#include "e_config_variables.h" -#undef MACRO_CONFIG_INT -#undef MACRO_CONFIG_STR - -#define MACRO_CONFIG_INT(name,def,min,max,flags,desc) void config_set_ ## name (CONFIGURATION *c, int val); -#define MACRO_CONFIG_STR(name,len,def,flags,desc) void config_set_ ## name (CONFIGURATION *c, const char *str); -#include "e_config_variables.h" -#undef MACRO_CONFIG_INT -#undef MACRO_CONFIG_STR - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_config_variables.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_config_variables.h deleted file mode 100644 index 21b71b2fc..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_config_variables.h +++ /dev/null @@ -1,87 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -/* TODO: remove this */ -#include "../game/variables.hpp" - - -MACRO_CONFIG_STR(player_name, 32, "nameless tee", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Name of the player") -MACRO_CONFIG_STR(clan_name, 32, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "(not used)") -MACRO_CONFIG_STR(password, 32, "", CFGFLAG_CLIENT, "Password to the server") -MACRO_CONFIG_STR(logfile, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filename to log all output to") - -MACRO_CONFIG_INT(cl_cpu_throttle, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "") - -MACRO_CONFIG_INT(cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events") - -MACRO_CONFIG_INT(inp_grab, 0, 0, 1, CFGFLAG_CLIENT, "Use forceful input grabbing method") - -MACRO_CONFIG_STR(b_filter_string, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string") - -MACRO_CONFIG_INT(b_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out full server in browser") -MACRO_CONFIG_INT(b_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser") -MACRO_CONFIG_INT(b_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser") -MACRO_CONFIG_INT(b_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser") -MACRO_CONFIG_STR(b_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter") -MACRO_CONFIG_INT(b_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard servers in browser") -MACRO_CONFIG_INT(b_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser") -MACRO_CONFIG_INT(b_filter_compatversion, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-compatible servers in browser") - -MACRO_CONFIG_INT(b_sort, 1, 0, 256, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") // Sort by ping -MACRO_CONFIG_INT(b_sort_order, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(b_max_requests, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Number of requests to use when refreshing server browser") - -MACRO_CONFIG_INT(snd_buffer_size, 512, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound buffer size") -#ifdef ANDROID -MACRO_CONFIG_INT(snd_rate, 22050, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound mixing rate") -#else -MACRO_CONFIG_INT(snd_rate, 48000, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound mixing rate") -#endif -MACRO_CONFIG_INT(snd_enable, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound enable") -MACRO_CONFIG_INT(snd_volume, 100, 0, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound volume") -MACRO_CONFIG_INT(snd_device, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "(deprecated) Sound device to use") - -MACRO_CONFIG_INT(snd_nonactive_mute, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") - -MACRO_CONFIG_INT(gfx_screen_width, 800, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution width") -MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height") -MACRO_CONFIG_INT(gfx_fullscreen, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen") -MACRO_CONFIG_INT(gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)") -MACRO_CONFIG_INT(gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors bits for framebuffer (fullscreen only)") -MACRO_CONFIG_INT(gfx_clear, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering") -MACRO_CONFIG_INT(gfx_vsync, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync") -MACRO_CONFIG_INT(gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(gfx_texture_compression, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use texture compression") -#ifdef ANDROID -MACRO_CONFIG_INT(gfx_high_detail, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail") -MACRO_CONFIG_INT(gfx_texture_quality, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples") -#else -MACRO_CONFIG_INT(gfx_high_detail, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail") -MACRO_CONFIG_INT(gfx_texture_quality, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples") -#endif -MACRO_CONFIG_INT(gfx_refresh_rate, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate") -MACRO_CONFIG_INT(gfx_finish, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") - -MACRO_CONFIG_INT(inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity") - -MACRO_CONFIG_STR(sv_name, 128, "unnamed server", CFGFLAG_SERVER, "Server name") -MACRO_CONFIG_STR(sv_bindaddr, 128, "", CFGFLAG_SERVER, "Address to bind the server to") -MACRO_CONFIG_INT(sv_port, 8303, 0, 0, CFGFLAG_SERVER, "Port to use for the server") -MACRO_CONFIG_INT(sv_external_port, 0, 0, 0, CFGFLAG_SERVER, "External port to report to the master servers") -MACRO_CONFIG_STR(sv_map, 128, "dm1", CFGFLAG_SERVER, "Map to use on the server") -MACRO_CONFIG_INT(sv_max_clients, 8, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients that are allowed on a server") -MACRO_CONFIG_INT(sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only") -MACRO_CONFIG_INT(sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing") -MACRO_CONFIG_STR(sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password") -MACRO_CONFIG_INT(sv_map_reload, 0, 0, 1, CFGFLAG_SERVER, "Reload the current map") - -MACRO_CONFIG_INT(debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode") -MACRO_CONFIG_INT(dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems") -MACRO_CONFIG_INT(dbg_stress_network, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress network") -MACRO_CONFIG_INT(dbg_pref, 0, 0, 1, CFGFLAG_SERVER, "Performance outputs") -MACRO_CONFIG_INT(dbg_graphs, 0, 0, 1, CFGFLAG_CLIENT, "Performance graphs") -MACRO_CONFIG_INT(dbg_hitch, 0, 0, 0, CFGFLAG_SERVER, "Hitch warnings") -MACRO_CONFIG_STR(dbg_stress_server, 32, "localhost", CFGFLAG_CLIENT, "Server to stress") -MACRO_CONFIG_INT(dbg_resizable, 0, 0, 0, CFGFLAG_CLIENT, "Enables window resizing") diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_console.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_console.cpp deleted file mode 100644 index 700619a2f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_console.cpp +++ /dev/null @@ -1,443 +0,0 @@ -#include -#include "e_if_other.h" -#include "e_console.h" -#include "e_config.h" -#include "e_engine.h" -#include "e_linereader.h" -#include -#include -#include - - -#define CONSOLE_MAX_STR_LENGTH 1024 -/* the maximum number of tokens occurs in a string of length CONSOLE_MAX_STR_LENGTH with tokens size 1 separated by single spaces */ -#define MAX_PARTS (CONSOLE_MAX_STR_LENGTH+1)/2 - -typedef struct -{ - char string_storage[CONSOLE_MAX_STR_LENGTH+1]; - char *args_start; - - const char *command; - const char *args[MAX_PARTS]; - unsigned int num_args; -} PARSE_RESULT; - -static char *str_skipblanks(char *str) -{ - while(*str && (*str == ' ' || *str == '\t' || *str == '\n')) - str++; - return str; -} - -static char *str_skiptoblank(char *str) -{ - while(*str && (*str != ' ' && *str != '\t' && *str != '\n')) - str++; - return str; -} - -/* static int digit(char c) { return '0' <= c && c <= '9'; } */ - -static int console_parse_start(PARSE_RESULT *result, const char *string, int length) -{ - char *str; - int len = sizeof(result->string_storage); - if(length < len) - len = length; - - str_copy(result->string_storage, string, length); - str = result->string_storage; - - /* get command */ - str = str_skipblanks(str); - result->command = str; - str = str_skiptoblank(str); - - if(*str) - { - str[0] = 0; - str++; - } - - result->args_start = str; - result->num_args = 0; - return 0; -} - -static int console_parse_args(PARSE_RESULT *result, const char *format) -{ - char command; - char *str; - int optional = 0; - int error = 0; - - str = result->args_start; - - while(1) - { - /* fetch command */ - command = *format; - format++; - - if(!command) - break; - - if(command == '?') - optional = 1; - else - { - str = str_skipblanks(str); - - if(!(*str)) /* error, non optional command needs value */ - { - if(!optional) - error = 1; - break; - } - - /* add token */ - if(*str == '"') - { - char *dst; - str++; - result->args[result->num_args++] = str; - - dst = str; /* we might have to process escape data */ - while(1) - { - if(str[0] == '"') - break; - else if(str[0] == '\\') - { - if(str[1] == '\\') - str++; /* skip due to escape */ - else if(str[1] == '"') - str++; /* skip due to escape */ - } - else if(str[0] == 0) - return 1; /* return error */ - - *dst = *str; - dst++; - str++; - } - - /* write null termination */ - *dst = 0; - } - else - { - result->args[result->num_args++] = str; - - if(command == 'r') /* rest of the string */ - break; - else if(command == 'i') /* validate int */ - str = str_skiptoblank(str); - else if(command == 'f') /* validate float */ - str = str_skiptoblank(str); - else if(command == 's') /* validate string */ - str = str_skiptoblank(str); - - if(str[0] != 0) /* check for end of string */ - { - str[0] = 0; - str++; - } - } - } - } - - return error; -} - -const char *console_arg_string(void *res, int index) -{ - PARSE_RESULT *result = (PARSE_RESULT *)res; - if (index < 0 || index >= result->num_args) - return ""; - return result->args[index]; -} - -int console_arg_int(void *res, int index) -{ - PARSE_RESULT *result = (PARSE_RESULT *)res; - if (index < 0 || index >= result->num_args) - return 0; - return atoi(result->args[index]); -} - -float console_arg_float(void *res, int index) -{ - PARSE_RESULT *result = (PARSE_RESULT *)res; - if (index < 0 || index >= result->num_args) - return 0.0f; - return atof(result->args[index]); -} - -int console_arg_num(void *result) -{ - return ((PARSE_RESULT *)result)->num_args; -} - -static COMMAND *first_command = 0x0; - -COMMAND *console_find_command(const char *name) -{ - COMMAND *cmd; - for (cmd = first_command; cmd; cmd = cmd->next) - { - if (strcmp(cmd->name, name) == 0) - return cmd; - } - - return 0x0; -} - -void console_register(COMMAND *cmd) -{ - cmd->next = first_command; - first_command = cmd; -} - -static void (*print_callback)(const char *, void *) = 0x0; -static void *print_callback_userdata; - -void console_register_print_callback(void (*callback)(const char *, void *), void *user_data) -{ - print_callback = callback; - print_callback_userdata = user_data; -} - -void console_print(const char *str) -{ - if (print_callback) - print_callback(str, print_callback_userdata); -} - -void console_execute_line_stroked(int stroke, const char *str) -{ - PARSE_RESULT result; - COMMAND *command; - - char strokestr[2] = {'0', 0}; - if(stroke) - strokestr[0] = '1'; - - while(str) - { - const char *end = str; - const char *next_part = 0; - int in_string = 0; - - while(*end) - { - if(*end == '"') - in_string ^= 1; - else if(*end == '\\') /* escape sequences */ - { - if(end[1] == '"') - end++; - } - else if(!in_string) - { - if(*end == ';') /* command separator */ - { - next_part = end+1; - break; - } - else if(*end == '#') /* comment, no need to do anything more */ - break; - } - - end++; - } - - if(console_parse_start(&result, str, (end-str) + 1) != 0) - return; - - command = console_find_command(result.command); - - if(command) - { - int is_stroke_command = 0; - if(result.command[0] == '+') - { - /* insert the stroke direction token */ - result.args[result.num_args] = strokestr; - result.num_args++; - is_stroke_command = 1; - } - - if(stroke || is_stroke_command) - { - if(console_parse_args(&result, command->params)) - { - char buf[256]; - str_format(buf, sizeof(buf), "Invalid arguments... Usage: %s %s", command->name, command->params); - console_print(buf); - } - else - command->callback(&result, command->user_data); - } - } - else - { - char buf[256]; - str_format(buf, sizeof(buf), "No such command: %s.", result.command); - console_print(buf); - } - - str = next_part; - } -} - -void console_possible_commands(const char *str, int flagmask, void (*callback)(const char *cmd, void *user), void *user) -{ - COMMAND *cmd; - for (cmd = first_command; cmd; cmd = cmd->next) - { - if(cmd->flags&flagmask) - { - if(str_find_nocase(cmd->name, str)) - callback(cmd->name, user); - } - } -} - - -COMMAND *console_get_command(const char *str) -{ - COMMAND *cmd; - for (cmd = first_command; cmd; cmd = cmd->next) - { - if(str_comp_nocase(cmd->name, str) == 0) - return cmd; - } - - return 0x0; -} - -void console_execute_line(const char *str) -{ - console_execute_line_stroked(1, str); -} - -static void console_execute_file_real(const char *filename) -{ - IOHANDLE file; - file = engine_openfile(filename, IOFLAG_READ); - - if(file) - { - char *line; - LINEREADER lr; - - dbg_msg("console", "executing '%s'", filename); - linereader_init(&lr, file); - - while((line = linereader_get(&lr))) - console_execute_line(line); - - io_close(file); - } - else - dbg_msg("console", "failed to open '%s'", filename); -} - -struct EXECFILE -{ - const char *filename; - struct EXECFILE *next; -}; - -void console_execute_file(const char *filename) -{ - static struct EXECFILE *first = 0; - struct EXECFILE thisfile; - struct EXECFILE *cur; - struct EXECFILE *prev; - - /* make sure that this isn't being executed already */ - for(cur = first; cur; cur = cur->next) - if(strcmp(filename, cur->filename) == 0) - return; - - /* push this one to the stack */ - prev = first; - thisfile.filename = filename; - thisfile.next = first; - first = &thisfile; - - /* execute file */ - console_execute_file_real(filename); - - /* pop this one from the stack */ - first = prev; -} - -static void con_echo(void *result, void *user_data) -{ - console_print(console_arg_string(result, 0)); -} - -static void con_exec(void *result, void *user_data) -{ - console_execute_file(console_arg_string(result, 0)); - -} - - -typedef struct -{ - CONFIG_INT_GETTER getter; - CONFIG_INT_SETTER setter; -} INT_VARIABLE_DATA; - -typedef struct -{ - CONFIG_STR_GETTER getter; - CONFIG_STR_SETTER setter; -} STR_VARIABLE_DATA; - -static void int_variable_command(void *result, void *user_data) -{ - INT_VARIABLE_DATA *data = (INT_VARIABLE_DATA *)user_data; - - if(console_arg_num(result)) - data->setter(&config, console_arg_int(result, 0)); - else - { - char buf[1024]; - str_format(buf, sizeof(buf), "Value: %d", data->getter(&config)); - console_print(buf); - } -} - -static void str_variable_command(void *result, void *user_data) -{ - STR_VARIABLE_DATA *data = (STR_VARIABLE_DATA *)user_data; - - if(console_arg_num(result)) - data->setter(&config, console_arg_string(result, 0)); - else - { - char buf[1024]; - str_format(buf, sizeof(buf), "Value: %s", data->getter(&config)); - console_print(buf); - } -} - -void console_init() -{ - MACRO_REGISTER_COMMAND("echo", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, con_echo, 0x0, "Echo the text"); - MACRO_REGISTER_COMMAND("exec", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, con_exec, 0x0, "Execute the specified file"); - - #define MACRO_CONFIG_INT(name,def,min,max,flags,desc) { static INT_VARIABLE_DATA data = { &config_get_ ## name, &config_set_ ## name }; MACRO_REGISTER_COMMAND(#name, "?i", flags, int_variable_command, &data, desc) } - #define MACRO_CONFIG_STR(name,len,def,flags,desc) { static STR_VARIABLE_DATA data = { &config_get_ ## name, &config_set_ ## name }; MACRO_REGISTER_COMMAND(#name, "?r", flags, str_variable_command, &data, desc) } - - #include "e_config_variables.h" - - #undef MACRO_CONFIG_INT - #undef MACRO_CONFIG_STR -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_console.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_console.h deleted file mode 100644 index c2393e399..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_console.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _CONSOLE_H -#define _CONSOLE_H - -#ifdef __cplusplus -extern "C"{ -#endif - -typedef void (*CONSOLE_CALLBACK)(void *result, void *user_data); - -typedef struct COMMAND_t -{ - const char *name; - const char *params; - int flags; - CONSOLE_CALLBACK callback; - void *user_data; - const char *help; - struct COMMAND_t *next; -} COMMAND; - -void console_init(); -void console_register(COMMAND *cmd); -void console_execute_line(const char *str); -void console_execute_line_stroked(int stroke, const char *str); -void console_execute_file(const char *filename); -void console_possible_commands(const char *str, int flagmask, void (*callback)(const char *cmd, void *user), void *user); -COMMAND *console_get_command(const char *cmd); -void console_print(const char *str); -void console_register_print_callback(void (*callback)(const char *, void *user_data), void *user_data); - -/*int console_result_string(void *result, int index, const char **str); -int console_result_int(void *result, int index, int *i); -int console_result_float(void *result, int index, float *f);*/ - -const char *console_arg_string(void *result, int index); -int console_arg_int(void *result, int index); -float console_arg_float(void *result, int index); -int console_arg_num(void *result); - -#define MACRO_REGISTER_COMMAND(name, params, flags, func, ptr, help) { static COMMAND cmd = { name, params, flags, func, ptr, help, 0x0}; console_register(&cmd); } - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.cpp deleted file mode 100644 index 0317f9d00..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_datafile.h" -#include "e_engine.h" -#include - -static const int DEBUG=0; - -typedef struct -{ - int type; - int start; - int num; -} DATAFILE_ITEM_TYPE; - -typedef struct -{ - int type_and_id; - int size; -} DATAFILE_ITEM; - -typedef struct -{ - char id[4]; - int version; - int size; - int swaplen; - int num_item_types; - int num_items; - int num_raw_data; - int item_size; - int data_size; -} DATAFILE_HEADER; - -typedef struct -{ - int num_item_types; - int num_items; - int num_raw_data; - int item_size; - int data_size; - char start[4]; -} DATAFILE_DATA; - -typedef struct -{ - DATAFILE_ITEM_TYPE *item_types; - int *item_offsets; - int *data_offsets; - int *data_sizes; - - char *item_start; - char *data_start; -} DATAFILE_INFO; - -struct DATAFILE_t -{ - IOHANDLE file; - DATAFILE_INFO info; - DATAFILE_HEADER header; - int data_start_offset; - char **data_ptrs; - char *data; -}; - -DATAFILE *datafile_load(const char *filename) -{ - DATAFILE *df; - IOHANDLE file; - DATAFILE_HEADER header; - unsigned readsize; - - unsigned *dst; - unsigned char *src; - unsigned j; - int size = 0; - int allocsize = 0; - - (void)dst; - (void)src; - (void)j; - - - dbg_msg("datafile", "datafile loading. filename='%s'", filename); - - file = engine_openfile(filename, IOFLAG_READ); - if(!file) - return 0; - - /* TODO: change this header */ - io_read(file, &header, sizeof(header)); - if(header.id[0] != 'A' || header.id[1] != 'T' || header.id[2] != 'A' || header.id[3] != 'D') - { - if(header.id[0] != 'D' || header.id[1] != 'A' || header.id[2] != 'T' || header.id[3] != 'A') - { - dbg_msg("datafile", "wrong signature. %x %x %x %x", header.id[0], header.id[1], header.id[2], header.id[3]); - return 0; - } - } - -#if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(&header, sizeof(int), sizeof(header)/sizeof(int)); -#endif - if(header.version != 3 && header.version != 4) - { - dbg_msg("datafile", "wrong version. version=%x", header.version); - return 0; - } - - /* read in the rest except the data */ - size = 0; - size += header.num_item_types*sizeof(DATAFILE_ITEM_TYPE); - size += (header.num_items+header.num_raw_data)*sizeof(int); - if(header.version == 4) - size += header.num_raw_data*sizeof(int); /* v4 has uncompressed data sizes aswell */ - size += header.item_size; - - allocsize = size; - allocsize += sizeof(DATAFILE); /* add space for info structure */ - allocsize += header.num_raw_data*sizeof(void*); /* add space for data pointers */ - - df = (DATAFILE*)mem_alloc(allocsize, 1); - df->header = header; - df->data_start_offset = sizeof(DATAFILE_HEADER) + size; - df->data_ptrs = (char**)(df+1); - df->data = (char *)(df+1)+header.num_raw_data*sizeof(char *); - df->file = file; - - /* clear the data pointers */ - mem_zero(df->data_ptrs, header.num_raw_data*sizeof(void*)); - - /* read types, offsets, sizes and item data */ - readsize = io_read(file, df->data, size); - if(readsize != size) - { - dbg_msg("datafile", "couldn't load the whole thing, wanted=%d got=%d", size, readsize); - return 0; - } - -#if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(df->data, sizeof(int), header.swaplen / sizeof(int)); -#endif - - if(DEBUG) - { - dbg_msg("datafile", "allocsize=%d", allocsize); - dbg_msg("datafile", "readsize=%d", readsize); - dbg_msg("datafile", "swaplen=%d", header.swaplen); - dbg_msg("datafile", "item_size=%d", df->header.item_size); - } - - df->info.item_types = (DATAFILE_ITEM_TYPE *)df->data; - df->info.item_offsets = (int *)&df->info.item_types[df->header.num_item_types]; - df->info.data_offsets = (int *)&df->info.item_offsets[df->header.num_items]; - df->info.data_sizes = (int *)&df->info.data_offsets[df->header.num_raw_data]; - - if(header.version == 4) - df->info.item_start = (char *)&df->info.data_sizes[df->header.num_raw_data]; - else - df->info.item_start = (char *)&df->info.data_offsets[df->header.num_raw_data]; - df->info.data_start = df->info.item_start + df->header.item_size; - - if(DEBUG) - dbg_msg("datafile", "datafile loading done. datafile='%s'", filename); - - if(DEBUG) - { - /* - for(int i = 0; i < df->data.num_raw_data; i++) - { - void *p = datafile_get_data(df, i); - dbg_msg("datafile", "%d %d", (int)((char*)p - (char*)(&df->data)), size); - } - - for(int i = 0; i < datafile_num_items(df); i++) - { - int type, id; - void *data = datafile_get_item(df, i, &type, &id); - dbg_msg("map", "\t%d: type=%x id=%x p=%p offset=%d", i, type, id, data, df->info.item_offsets[i]); - int *idata = (int*)data; - for(int k = 0; k < 3; k++) - dbg_msg("datafile", "\t\t%d=%d (%x)", k, idata[k], idata[k]); - } - - for(int i = 0; i < df->data.num_item_types; i++) - { - dbg_msg("map", "\t%d: type=%x start=%d num=%d", i, - df->info.item_types[i].type, - df->info.item_types[i].start, - df->info.item_types[i].num); - for(int k = 0; k < df->info.item_types[i].num; k++) - { - int type, id; - datafile_get_item(df, df->info.item_types[i].start+k, &type, &id); - if(type != df->info.item_types[i].type) - dbg_msg("map", "\tERROR"); - } - } - */ - } - - return df; -} - -int datafile_num_data(DATAFILE *df) -{ - return df->header.num_raw_data; -} - -/* always returns the size in the file */ -int datafile_get_datasize(DATAFILE *df, int index) -{ - if(index == df->header.num_raw_data-1) - return df->header.data_size-df->info.data_offsets[index]; - return df->info.data_offsets[index+1]-df->info.data_offsets[index]; -} - -static void *datafile_get_data_impl(DATAFILE *df, int index, int swap) -{ - /* load it if needed */ - if(!df->data_ptrs[index]) - { - /* fetch the data size */ - int datasize = datafile_get_datasize(df, index); - int swapsize = datasize; - - if(df->header.version == 4) - { - /* v4 has compressed data */ - void *temp = (char *)mem_alloc(datasize, 1); - unsigned long uncompressed_size = df->info.data_sizes[index]; - unsigned long s; - - dbg_msg("datafile", "loading data index=%d size=%d uncompressed=%d", index, datasize, uncompressed_size); - df->data_ptrs[index] = (char *)mem_alloc(uncompressed_size, 1); - - /* read the compressed data */ - io_seek(df->file, df->data_start_offset+df->info.data_offsets[index], IOSEEK_START); - io_read(df->file, temp, datasize); - - /* decompress the data, TODO: check for errors */ - s = uncompressed_size; - uncompress((Bytef*)df->data_ptrs[index], &s, (Bytef*)temp, datasize); - swapsize = s; - - /* clean up the temporary buffers */ - mem_free(temp); - } - else - { - /* load the data */ - dbg_msg("datafile", "loading data index=%d size=%d", index, datasize); - df->data_ptrs[index] = (char *)mem_alloc(datasize, 1); - io_seek(df->file, df->data_start_offset+df->info.data_offsets[index], IOSEEK_START); - io_read(df->file, df->data_ptrs[index], datasize); - } - -#if defined(CONF_ARCH_ENDIAN_BIG) - if(swap && swapsize) - swap_endian(df->data_ptrs[index], sizeof(int), swapsize/sizeof(int)); -#endif - } - - return df->data_ptrs[index]; -} - -void *datafile_get_data(DATAFILE *df, int index) -{ - return datafile_get_data_impl(df, index, 0); -} - -void *datafile_get_data_swapped(DATAFILE *df, int index) -{ - return datafile_get_data_impl(df, index, 1); -} - -void datafile_unload_data(DATAFILE *df, int index) -{ - if(index < 0) - return; - - /* */ - mem_free(df->data_ptrs[index]); - df->data_ptrs[index] = 0x0; -} - -int datafile_get_itemsize(DATAFILE *df, int index) -{ - if(index == df->header.num_items-1) - return df->header.item_size-df->info.item_offsets[index]; - return df->info.item_offsets[index+1]-df->info.item_offsets[index]; -} - -void *datafile_get_item(DATAFILE *df, int index, int *type, int *id) -{ - DATAFILE_ITEM *i = (DATAFILE_ITEM *)(df->info.item_start+df->info.item_offsets[index]); - if(type) - *type = (i->type_and_id>>16)&0xffff; /* remove sign extention */ - if(id) - *id = i->type_and_id&0xffff; - return (void *)(i+1); -} - -void datafile_get_type(DATAFILE *df, int type, int *start, int *num) -{ - int i; - for(i = 0; i < df->header.num_item_types; i++) - { - if(df->info.item_types[i].type == type) - { - *start = df->info.item_types[i].start; - *num = df->info.item_types[i].num; - return; - } - } - - *start = 0; - *num = 0; -} - -void *datafile_find_item(DATAFILE *df, int type, int id) -{ - int start, num,i ; - int item_id; - void *item; - - datafile_get_type(df, type, &start, &num); - for(i = 0; i < num; i++) - { - item = datafile_get_item(df, start+i,0, &item_id); - if(id == item_id) - return item; - } - return 0; -} - -int datafile_num_items(DATAFILE *df) -{ - return df->header.num_items; -} - -void datafile_unload(DATAFILE *df) -{ - if(df) - { - /* free the data that is loaded */ - int i; - for(i = 0; i < df->header.num_raw_data; i++) - mem_free(df->data_ptrs[i]); - - io_close(df->file); - mem_free(df); - } -} - -/* DATAFILE output */ -typedef struct -{ - int uncompressed_size; - int compressed_size; - void *compressed_data; -} DATA_INFO; - -typedef struct -{ - int type; - int id; - int size; - int next; - int prev; - void *data; -} ITEM_INFO; - -typedef struct -{ - int num; - int first; - int last; -} ITEMTYPE_INFO; - -/* */ -struct DATAFILE_OUT_t -{ - IOHANDLE file; - int num_items; - int num_datas; - int num_item_types; - ITEMTYPE_INFO item_types[0xffff]; - ITEM_INFO items[1024]; - DATA_INFO datas[1024]; -}; - -DATAFILE_OUT *datafile_create(const char *filename) -{ - int i; - DATAFILE_OUT *df = (DATAFILE_OUT*)mem_alloc(sizeof(DATAFILE_OUT), 1); - df->file = engine_openfile(filename, IOFLAG_WRITE); - if(!df->file) - { - mem_free(df); - return 0; - } - - df->num_items = 0; - df->num_datas = 0; - df->num_item_types = 0; - mem_zero(&df->item_types, sizeof(df->item_types)); - - for(i = 0; i < 0xffff; i++) - { - df->item_types[i].first = -1; - df->item_types[i].last = -1; - } - - return df; -} - -int datafile_add_item(DATAFILE_OUT *df, int type, int id, int size, void *data) -{ - df->items[df->num_items].type = type; - df->items[df->num_items].id = id; - df->items[df->num_items].size = size; - - /* - dbg_msg("datafile", "added item type=%d id=%d size=%d", type, id, size); - int i; - for(i = 0; i < size/4; i++) - dbg_msg("datafile", "\t%d: %08x %d", i, ((int*)data)[i], ((int*)data)[i]); - */ - - /* copy data */ - df->items[df->num_items].data = mem_alloc(size, 1); - mem_copy(df->items[df->num_items].data, data, size); - - if(!df->item_types[type].num) /* count item types */ - df->num_item_types++; - - /* link */ - df->items[df->num_items].prev = df->item_types[type].last; - df->items[df->num_items].next = -1; - - if(df->item_types[type].last != -1) - df->items[df->item_types[type].last].next = df->num_items; - df->item_types[type].last = df->num_items; - - if(df->item_types[type].first == -1) - df->item_types[type].first = df->num_items; - - df->item_types[type].num++; - - df->num_items++; - return df->num_items-1; -} - -int datafile_add_data(DATAFILE_OUT *df, int size, void *data) -{ - DATA_INFO *info = &df->datas[df->num_datas]; - unsigned long s = compressBound(size); - void *compdata = mem_alloc(s, 1); /* temporary buffer that we use duing compression */ - - int result = compress((Bytef*)compdata, &s, (Bytef*)data, size); - if(result != Z_OK) - { - dbg_msg("datafile", "compression error %d", result); - dbg_assert(0, "zlib error"); - } - - info->uncompressed_size = size; - info->compressed_size = (int)s; - info->compressed_data = mem_alloc(info->compressed_size, 1); - mem_copy(info->compressed_data, compdata, info->compressed_size); - mem_free(compdata); - - df->num_datas++; - return df->num_datas-1; -} - -int datafile_add_data_swapped(DATAFILE_OUT *df, int size, void *data) -{ -#if defined(CONF_ARCH_ENDIAN_BIG) - void *swapped = mem_alloc(size, 1); /* temporary buffer that we use duing compression */ - int index; - mem_copy(swapped, data, size); - swap_endian(&swapped, sizeof(int), size/sizeof(int)); - index = datafile_add_data(df, size, swapped); - mem_free(swapped); - return index; -#else - return datafile_add_data(df, size, data); -#endif -} - - -int datafile_finish(DATAFILE_OUT *df) -{ - int itemsize = 0; - int i, count, offset; - int typessize, headersize, offsetsize, filesize, swapsize; - int datasize = 0; - DATAFILE_ITEM_TYPE info; - DATAFILE_ITEM itm; - DATAFILE_HEADER header; - - /* we should now write this file! */ - if(DEBUG) - dbg_msg("datafile", "writing"); - - /* calculate sizes */ - for(i = 0; i < df->num_items; i++) - { - if(DEBUG) - dbg_msg("datafile", "item=%d size=%d (%d)", i, df->items[i].size, df->items[i].size+sizeof(DATAFILE_ITEM)); - itemsize += df->items[i].size + sizeof(DATAFILE_ITEM); - } - - - for(i = 0; i < df->num_datas; i++) - datasize += df->datas[i].compressed_size; - - /* calculate the complete size */ - typessize = df->num_item_types*sizeof(DATAFILE_ITEM_TYPE); - headersize = sizeof(DATAFILE_HEADER); - offsetsize = df->num_items*sizeof(int) + df->num_datas*sizeof(int); - filesize = headersize + typessize + offsetsize + itemsize + datasize; - swapsize = filesize - datasize; - - (void)swapsize; - - if(DEBUG) - dbg_msg("datafile", "num_item_types=%d typessize=%d itemsize=%d datasize=%d", df->num_item_types, typessize, itemsize, datasize); - - /* construct header */ - { - header.id[0] = 'D'; - header.id[1] = 'A'; - header.id[2] = 'T'; - header.id[3] = 'A'; - header.version = 4; - header.size = filesize - 16; - header.swaplen = swapsize - 16; - header.num_item_types = df->num_item_types; - header.num_items = df->num_items; - header.num_raw_data = df->num_datas; - header.item_size = itemsize; - header.data_size = datasize; - - /* TODO: apply swapping */ - /* write header */ - if(DEBUG) - dbg_msg("datafile", "headersize=%d", sizeof(header)); - io_write(df->file, &header, sizeof(header)); - } - - /* write types */ - for(i = 0, count = 0; i < 0xffff; i++) - { - if(df->item_types[i].num) - { - /* write info */ - info.type = i; - info.start = count; - info.num = df->item_types[i].num; - if(DEBUG) - dbg_msg("datafile", "writing type=%x start=%d num=%d", info.type, info.start, info.num); - io_write(df->file, &info, sizeof(info)); - count += df->item_types[i].num; - } - } - - /* write item offsets */ - for(i = 0, offset = 0; i < 0xffff; i++) - { - if(df->item_types[i].num) - { - /* write all items in of this type */ - int k = df->item_types[i].first; - while(k != -1) - { - if(DEBUG) - dbg_msg("datafile", "writing item offset num=%d offset=%d", k, offset); - io_write(df->file, &offset, sizeof(offset)); - offset += df->items[k].size + sizeof(DATAFILE_ITEM); - - /* next */ - k = df->items[k].next; - } - } - } - - /* write data offsets */ - for(i = 0, offset = 0; i < df->num_datas; i++) - { - if(DEBUG) - dbg_msg("datafile", "writing data offset num=%d offset=%d", i, offset); - io_write(df->file, &offset, sizeof(offset)); - offset += df->datas[i].compressed_size; - } - - /* write data uncompressed sizes */ - for(i = 0, offset = 0; i < df->num_datas; i++) - { - /* - if(DEBUG) - dbg_msg("datafile", "writing data offset num=%d offset=%d", i, offset); - */ - io_write(df->file, &df->datas[i].uncompressed_size, sizeof(int)); - } - - /* write items */ - for(i = 0; i < 0xffff; i++) - { - if(df->item_types[i].num) - { - /* write all items in of this type */ - int k = df->item_types[i].first; - while(k != -1) - { - itm.type_and_id = (i<<16)|df->items[k].id; - itm.size = df->items[k].size; - if(DEBUG) - dbg_msg("datafile", "writing item type=%x idx=%d id=%d size=%d", i, k, df->items[k].id, df->items[k].size); - - io_write(df->file, &itm, sizeof(itm)); - io_write(df->file, df->items[k].data, df->items[k].size); - - /* next */ - k = df->items[k].next; - } - } - } - - /* write data */ - for(i = 0; i < df->num_datas; i++) - { - if(DEBUG) - dbg_msg("datafile", "writing data id=%d size=%d", i, df->datas[i].compressed_size); - io_write(df->file, df->datas[i].compressed_data, df->datas[i].compressed_size); - } - - /* free data */ - for(i = 0; i < df->num_items; i++) - mem_free(df->items[i].data); - - - io_close(df->file); - mem_free(df); - - if(DEBUG) - dbg_msg("datafile", "done"); - return 0; -} - -#define BUFFER_SIZE 64*1024 - -int datafile_crc(const char *filename) -{ - unsigned char buffer[BUFFER_SIZE]; - IOHANDLE file; - int crc = 0; - unsigned bytes = 0; - - file = engine_openfile(filename, IOFLAG_READ); - if(!file) - return 0; - - while(1) - { - bytes = io_read(file, buffer, BUFFER_SIZE); - if(bytes <= 0) - break; - crc = crc32(crc, buffer, bytes); - } - - io_close(file); - - return crc; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.h deleted file mode 100644 index 4e56ff871..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_datafile.h +++ /dev/null @@ -1,43 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifndef __DATAFILE__H__ -#define __DATAFILE__H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* raw datafile access */ -typedef struct DATAFILE_t DATAFILE; - -/* read access */ -DATAFILE *datafile_load(const char *filename); -DATAFILE *datafile_load_old(const char *filename); -void *datafile_get_data(DATAFILE *df, int index); -void *datafile_get_data_swapped(DATAFILE *df, int index); /* makes sure that the data is 32bit LE ints when saved */ -int datafile_get_datasize(DATAFILE *df, int index); -void datafile_unload_data(DATAFILE *df, int index); -void *datafile_get_item(DATAFILE *df, int index, int *type, int *id); -int datafile_get_itemsize(DATAFILE *df, int index); -void datafile_get_type(DATAFILE *df, int type, int *start, int *num); -void *datafile_find_item(DATAFILE *df, int type, int id); -int datafile_num_items(DATAFILE *df); -int datafile_num_data(DATAFILE *df); -void datafile_unload(DATAFILE *df); - -int datafile_crc(const char *filename); - -/* write access */ -typedef struct DATAFILE_OUT_t DATAFILE_OUT; -DATAFILE_OUT *datafile_create(const char *filename); -int datafile_add_data(DATAFILE_OUT *df, int size, void *data); -int datafile_add_data_swapped(DATAFILE_OUT *df, int size, void *data); -int datafile_add_item(DATAFILE_OUT *df, int type, int id, int size, void *data); -int datafile_finish(DATAFILE_OUT *df); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.cpp deleted file mode 100644 index 8bb586105..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.cpp +++ /dev/null @@ -1,640 +0,0 @@ - -#include -#include "e_demorec.h" -#include "e_memheap.h" -#include "e_snapshot.h" -#include "e_compression.h" -#include "e_network.h" -#include "e_engine.h" -#include "e_if_other.h" -#include "e_demorec.h" - -static IOHANDLE record_file = 0; -static const unsigned char header_marker[8] = {'T', 'W', 'D', 'E', 'M', 'O', 0, 1}; - -/* Record */ -static int record_lasttickmarker = -1; -static int record_lastkeyframe; -static unsigned char record_lastsnapshotdata[MAX_SNAPSHOT_SIZE]; - -int demorec_isrecording() { return record_file != 0; } - -int demorec_record_start(const char *filename, const char *netversion, const char *map, int crc, const char *type) -{ - DEMOREC_HEADER header; - if(record_file) - return -1; - - record_file = engine_openfile(filename, IOFLAG_WRITE); - - if(!record_file) - { - dbg_msg("demorec/record", "Unable to open '%s' for recording", filename); - return -1; - } - - /* write header */ - mem_zero(&header, sizeof(header)); - mem_copy(header.marker, header_marker, sizeof(header.marker)); - str_copy(header.netversion, netversion, sizeof(header.netversion)); - str_copy(header.map, map, sizeof(header.map)); - str_copy(header.type, type, sizeof(header.type)); - header.crc[0] = (crc>>24)&0xff; - header.crc[1] = (crc>>16)&0xff; - header.crc[2] = (crc>>8)&0xff; - header.crc[3] = (crc)&0xff; - io_write(record_file, &header, sizeof(header)); - - record_lastkeyframe = -1; - record_lasttickmarker = -1; - - dbg_msg("demorec/record", "Recording to '%s'", filename); - return 0; -} - -/* - Tickmarker - 7 = Always set - 6 = Keyframe flag - 0-5 = Delta tick - - Normal - 7 = Not set - 5-6 = Type - 0-4 = Size -*/ - -enum -{ - CHUNKTYPEFLAG_TICKMARKER = 0x80, - CHUNKTICKFLAG_KEYFRAME = 0x40, /* only when tickmarker is set*/ - - CHUNKMASK_TICK = 0x3f, - CHUNKMASK_TYPE = 0x60, - CHUNKMASK_SIZE = 0x1f, - - CHUNKTYPE_SNAPSHOT = 1, - CHUNKTYPE_MESSAGE = 2, - CHUNKTYPE_DELTA = 3, - - CHUNKFLAG_BIGSIZE = 0x10 -}; - -static void demorec_record_write_tickmarker(int tick, int keyframe) -{ - if(record_lasttickmarker == -1 || tick-record_lasttickmarker > 63 || keyframe) - { - unsigned char chunk[5]; - chunk[0] = CHUNKTYPEFLAG_TICKMARKER; - chunk[1] = (tick>>24)&0xff; - chunk[2] = (tick>>16)&0xff; - chunk[3] = (tick>>8)&0xff; - chunk[4] = (tick)&0xff; - - if(keyframe) - chunk[0] |= CHUNKTICKFLAG_KEYFRAME; - - io_write(record_file, chunk, sizeof(chunk)); - } - else - { - unsigned char chunk[1]; - chunk[0] = CHUNKTYPEFLAG_TICKMARKER | (tick-record_lasttickmarker); - io_write(record_file, chunk, sizeof(chunk)); - } - - record_lasttickmarker = tick; -} - -static void demorec_record_write(int type, const void *data, int size) -{ - char buffer[64*1024]; - char buffer2[64*1024]; - unsigned char chunk[3]; - - if(!record_file) - return; - - - /* pad the data with 0 so we get an alignment of 4, - else the compression won't work and miss some bytes */ - mem_copy(buffer2, data, size); - while(size&3) - buffer2[size++] = 0; - size = intpack_compress(buffer2, size, buffer); /* buffer2 -> buffer */ - size = netcommon_compress(buffer, size, buffer2, sizeof(buffer2)); /* buffer -> buffer2 */ - - - chunk[0] = ((type&0x3)<<5); - if(size < 30) - { - chunk[0] |= size; - io_write(record_file, chunk, 1); - } - else - { - if(size < 256) - { - chunk[0] |= 30; - chunk[1] = size&0xff; - io_write(record_file, chunk, 2); - } - else - { - chunk[0] |= 31; - chunk[1] = size&0xff; - chunk[2] = size>>8; - io_write(record_file, chunk, 3); - } - } - - io_write(record_file, buffer2, size); -} - -void demorec_record_snapshot(int tick, const void *data, int size) -{ - if(record_lastkeyframe == -1 || (tick-record_lastkeyframe) > SERVER_TICK_SPEED*5) - { - /* write full tickmarker */ - demorec_record_write_tickmarker(tick, 1); - - /* write snapshot */ - demorec_record_write(CHUNKTYPE_SNAPSHOT, data, size); - - record_lastkeyframe = tick; - mem_copy(record_lastsnapshotdata, data, size); - } - else - { - /* create delta, prepend tick */ - char delta_data[MAX_SNAPSHOT_SIZE+sizeof(int)]; - int delta_size; - - /* write tickmarker */ - demorec_record_write_tickmarker(tick, 0); - - delta_size = snapshot_create_delta((SNAPSHOT*)record_lastsnapshotdata, (SNAPSHOT*)data, &delta_data); - if(delta_size) - { - /* record delta */ - demorec_record_write(CHUNKTYPE_DELTA, delta_data, delta_size); - mem_copy(record_lastsnapshotdata, data, size); - } - } -} - -void demorec_record_message(const void *data, int size) -{ - demorec_record_write(CHUNKTYPE_MESSAGE, data, size); -} - -int demorec_record_stop() -{ - if(!record_file) - return -1; - - dbg_msg("demorec/record", "Stopped recording"); - io_close(record_file); - record_file = 0; - return 0; -} - -/* Playback */ -typedef struct KEYFRAME -{ - long filepos; - int tick; -} KEYFRAME; - -typedef struct KEYFRAME_SEARCH -{ - KEYFRAME frame; - struct KEYFRAME_SEARCH *next; -} KEYFRAME_SEARCH; - -static IOHANDLE play_file = 0; -static DEMOREC_PLAYCALLBACK play_callback_snapshot = 0; -static DEMOREC_PLAYCALLBACK play_callback_message = 0; -static KEYFRAME *keyframes = 0; - -static DEMOREC_PLAYBACKINFO playbackinfo; -static unsigned char playback_lastsnapshotdata[MAX_SNAPSHOT_SIZE]; -static int playback_lastsnapshotdata_size = -1; - - -const DEMOREC_PLAYBACKINFO *demorec_playback_info() { return &playbackinfo; } -int demorec_isplaying() { return play_file != 0; } - -int demorec_playback_registercallbacks(DEMOREC_PLAYCALLBACK snapshot_cb, DEMOREC_PLAYCALLBACK message_cb) -{ - play_callback_snapshot = snapshot_cb; - play_callback_message = message_cb; - return 0; -} - -static int read_chunk_header(int *type, int *size, int *tick) -{ - unsigned char chunk = 0; - - *size = 0; - *type = 0; - - if(io_read(play_file, &chunk, sizeof(chunk)) != sizeof(chunk)) - return -1; - - if(chunk&CHUNKTYPEFLAG_TICKMARKER) - { - /* decode tick marker */ - int tickdelta = chunk&(CHUNKMASK_TICK); - *type = chunk&(CHUNKTYPEFLAG_TICKMARKER|CHUNKTICKFLAG_KEYFRAME); - - if(tickdelta == 0) - { - unsigned char tickdata[4]; - if(io_read(play_file, tickdata, sizeof(tickdata)) != sizeof(tickdata)) - return -1; - *tick = (tickdata[0]<<24) | (tickdata[1]<<16) | (tickdata[2]<<8) | tickdata[3]; - } - else - { - *tick += tickdelta; - } - - } - else - { - /* decode normal chunk */ - *type = (chunk&CHUNKMASK_TYPE)>>5; - *size = chunk&CHUNKMASK_SIZE; - - if(*size == 30) - { - unsigned char sizedata[1]; - if(io_read(play_file, sizedata, sizeof(sizedata)) != sizeof(sizedata)) - return -1; - *size = sizedata[0]; - - } - else if(*size == 31) - { - unsigned char sizedata[2]; - if(io_read(play_file, sizedata, sizeof(sizedata)) != sizeof(sizedata)) - return -1; - *size = (sizedata[1]<<8) | sizedata[0]; - } - } - - return 0; -} - -static void scan_file() -{ - long start_pos; - HEAP *heap = 0; - KEYFRAME_SEARCH *first_key = 0; - KEYFRAME_SEARCH *current_key = 0; - /*DEMOREC_CHUNK chunk;*/ - int chunk_size, chunk_type, chunk_tick = 0; - int i; - - heap = memheap_create(); - - start_pos = io_tell(play_file); - playbackinfo.seekable_points = 0; - - while(1) - { - long current_pos = io_tell(play_file); - - if(read_chunk_header(&chunk_type, &chunk_size, &chunk_tick)) - break; - - /* read the chunk */ - if(chunk_type&CHUNKTYPEFLAG_TICKMARKER) - { - if(chunk_type&CHUNKTICKFLAG_KEYFRAME) - { - KEYFRAME_SEARCH *key; - - /* save the position */ - key = (KEYFRAME_SEARCH*)memheap_allocate(heap, sizeof(KEYFRAME_SEARCH)); - key->frame.filepos = current_pos; - key->frame.tick = chunk_tick; - key->next = 0; - if(current_key) - current_key->next = key; - if(!first_key) - first_key = key; - current_key = key; - playbackinfo.seekable_points++; - } - - if(playbackinfo.first_tick == -1) - playbackinfo.first_tick = chunk_tick; - playbackinfo.last_tick = chunk_tick; - } - else if(chunk_size) - io_skip(play_file, chunk_size); - - } - - /* copy all the frames to an array instead for fast access */ - keyframes = (KEYFRAME*)mem_alloc(playbackinfo.seekable_points*sizeof(KEYFRAME), 1); - for(current_key = first_key, i = 0; current_key; current_key = current_key->next, i++) - keyframes[i] = current_key->frame; - - /* destroy the temporary heap and seek back to the start */ - memheap_destroy(heap); - io_seek(play_file, start_pos, IOSEEK_START); -} - -static void do_tick() -{ - static char compresseddata[MAX_SNAPSHOT_SIZE]; - static char decompressed[MAX_SNAPSHOT_SIZE]; - static char data[MAX_SNAPSHOT_SIZE]; - int chunk_size, chunk_type, chunk_tick; - int data_size; - int got_snapshot = 0; - - /* update ticks */ - playbackinfo.previous_tick = playbackinfo.current_tick; - playbackinfo.current_tick = playbackinfo.next_tick; - chunk_tick = playbackinfo.current_tick; - - while(1) - { - if(read_chunk_header(&chunk_type, &chunk_size, &chunk_tick)) - { - /* stop on error or eof */ - dbg_msg("demorec", "end of file"); - demorec_playback_pause(); - break; - } - - /* read the chunk */ - if(chunk_size) - { - if(io_read(play_file, compresseddata, chunk_size) != chunk_size) - { - /* stop on error or eof */ - dbg_msg("demorec", "error reading chunk"); - demorec_playback_stop(); - break; - } - - data_size = netcommon_decompress(compresseddata, chunk_size, decompressed, sizeof(decompressed)); - if(data_size < 0) - { - /* stop on error or eof */ - dbg_msg("demorec", "error during network decompression"); - demorec_playback_stop(); - break; - } - - data_size = intpack_decompress(decompressed, data_size, data); - - if(data_size < 0) - { - dbg_msg("demorec", "error during intpack decompression"); - demorec_playback_stop(); - break; - } - } - - if(chunk_type == CHUNKTYPE_DELTA) - { - /* process delta snapshot */ - static char newsnap[MAX_SNAPSHOT_SIZE]; - - got_snapshot = 1; - - data_size = snapshot_unpack_delta((SNAPSHOT*)playback_lastsnapshotdata, (SNAPSHOT*)newsnap, data, data_size); - - if(data_size >= 0) - { - if(play_callback_snapshot) - play_callback_snapshot(newsnap, data_size); - - playback_lastsnapshotdata_size = data_size; - mem_copy(playback_lastsnapshotdata, newsnap, data_size); - } - else - dbg_msg("demorec", "error duing unpacking of delta, err=%d", data_size); - } - else if(chunk_type == CHUNKTYPE_SNAPSHOT) - { - /* process full snapshot */ - got_snapshot = 1; - - playback_lastsnapshotdata_size = data_size; - mem_copy(playback_lastsnapshotdata, data, data_size); - if(play_callback_snapshot) - play_callback_snapshot(data, data_size); - } - else - { - /* if there were no snapshots in this tick, replay the last one */ - if(!got_snapshot && play_callback_snapshot && playback_lastsnapshotdata_size != -1) - { - got_snapshot = 1; - play_callback_snapshot(playback_lastsnapshotdata, playback_lastsnapshotdata_size); - } - - /* check the remaining types */ - if(chunk_type&CHUNKTYPEFLAG_TICKMARKER) - { - playbackinfo.next_tick = chunk_tick; - break; - } - else if(chunk_type == CHUNKTYPE_MESSAGE) - { - if(play_callback_message) - play_callback_message(data, data_size); - } - } - } -} - -void demorec_playback_pause() -{ - playbackinfo.paused = 1; -} - -void demorec_playback_unpause() -{ - if(playbackinfo.paused) - { - /*playbackinfo.start_tick = playbackinfo.current_tick; - playbackinfo.start_time = time_get();*/ - playbackinfo.paused = 0; - } -} - -int demorec_playback_load(const char *filename) -{ - play_file = engine_openfile(filename, IOFLAG_READ); - if(!play_file) - { - dbg_msg("demorec/playback", "could not open '%s'", filename); - return -1; - } - - /* clear the playback info */ - mem_zero(&playbackinfo, sizeof(playbackinfo)); - playbackinfo.first_tick = -1; - playbackinfo.last_tick = -1; - /*playbackinfo.start_tick = -1;*/ - playbackinfo.next_tick = -1; - playbackinfo.current_tick = -1; - playbackinfo.previous_tick = -1; - playbackinfo.speed = 1; - - playback_lastsnapshotdata_size = -1; - - /* read the header */ - io_read(play_file, &playbackinfo.header, sizeof(playbackinfo.header)); - if(mem_comp(playbackinfo.header.marker, header_marker, sizeof(header_marker)) != 0) - { - dbg_msg("demorec/playback", "'%s' is not a demo file", filename); - io_close(play_file); - play_file = 0; - return -1; - } - - /* scan the file for interessting points */ - scan_file(); - - /* ready for playback */ - return 0; -} - -int demorec_playback_nextframe() -{ - do_tick(); - return demorec_isplaying(); -} - -int demorec_playback_play() -{ - /* fill in previous and next tick */ - while(playbackinfo.previous_tick == -1 && demorec_isplaying()) - do_tick(); - - /* set start info */ - /*playbackinfo.start_tick = playbackinfo.previous_tick; - playbackinfo.start_time = time_get();*/ - playbackinfo.current_time = playbackinfo.previous_tick*time_freq()/SERVER_TICK_SPEED; - playbackinfo.last_update = time_get(); - return 0; -} - -int demorec_playback_set(float percent) -{ - int keyframe; - int wanted_tick; - if(!play_file) - return -1; - - /* -5 because we have to have a current tick and previous tick when we do the playback */ - wanted_tick = playbackinfo.first_tick + (int)((playbackinfo.last_tick-playbackinfo.first_tick)*percent) - 5; - - keyframe = (int)(playbackinfo.seekable_points*percent); - - if(keyframe < 0 || keyframe >= playbackinfo.seekable_points) - return -1; - - /* get correct key frame */ - if(keyframes[keyframe].tick < wanted_tick) - while(keyframe < playbackinfo.seekable_points-1 && keyframes[keyframe].tick < wanted_tick) - keyframe++; - - while(keyframe && keyframes[keyframe].tick > wanted_tick) - keyframe--; - - /* seek to the correct keyframe */ - io_seek(play_file, keyframes[keyframe].filepos, IOSEEK_START); - - /*playbackinfo.start_tick = -1;*/ - playbackinfo.next_tick = -1; - playbackinfo.current_tick = -1; - playbackinfo.previous_tick = -1; - - /* playback everything until we hit our tick */ - while(playbackinfo.previous_tick < wanted_tick) - do_tick(); - - demorec_playback_play(); - - return 0; -} - -void demorec_playback_setspeed(float speed) -{ - playbackinfo.speed = speed; -} - -int demorec_playback_update() -{ - int64 now = time_get(); - int64 deltatime = now-playbackinfo.last_update; - playbackinfo.last_update = now; - - if(!demorec_isplaying()) - return 0; - - if(playbackinfo.paused) - { - - } - else - { - int64 freq = time_freq(); - playbackinfo.current_time += (int64)(deltatime*(double)playbackinfo.speed); - - while(1) - { - int64 curtick_start = (playbackinfo.current_tick)*freq/SERVER_TICK_SPEED; - - /* break if we are ready */ - if(curtick_start > playbackinfo.current_time) - break; - - /* do one more tick */ - do_tick(); - - if(playbackinfo.paused) - return 0; - } - - /* update intratick */ - { - int64 curtick_start = (playbackinfo.current_tick)*freq/SERVER_TICK_SPEED; - int64 prevtick_start = (playbackinfo.previous_tick)*freq/SERVER_TICK_SPEED; - playbackinfo.intratick = (playbackinfo.current_time - prevtick_start) / (float)(curtick_start-prevtick_start); - playbackinfo.ticktime = (playbackinfo.current_time - prevtick_start) / (float)freq; - } - - if(playbackinfo.current_tick == playbackinfo.previous_tick || - playbackinfo.current_tick == playbackinfo.next_tick) - { - dbg_msg("demorec/playback", "tick error prev=%d cur=%d next=%d", - playbackinfo.previous_tick, playbackinfo.current_tick, playbackinfo.next_tick); - } - } - - return 0; -} - -int demorec_playback_stop() -{ - if(!play_file) - return -1; - - dbg_msg("demorec/playback", "Stopped playback"); - io_close(play_file); - play_file = 0; - mem_free(keyframes); - keyframes = 0; - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.h deleted file mode 100644 index 482debb49..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_demorec.h +++ /dev/null @@ -1,77 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef _DEMOREC_H -#define _DEMOREC_H - -#ifdef __cplusplus -extern "C"{ -#endif - -typedef struct DEMOREC_HEADER -{ - char marker[8]; - char netversion[64]; - char map[64]; - unsigned char crc[4]; - char type[8]; -} DEMOREC_HEADER; - -typedef struct DEMOREC_CHUNK -{ - char type[2]; - unsigned short size; -} DEMOREC_CHUNK; - -typedef struct DEMOREC_TICKMARKER -{ - int tick; -} DEMOREC_TICKMARKER; - -typedef struct DEMOREC_PLAYBACKINFO -{ - DEMOREC_HEADER header; - - int paused; - float speed; - - int64 last_update; - int64 current_time; - - int first_tick; - int last_tick; - - int seekable_points; - - int next_tick; - int current_tick; - int previous_tick; - - float intratick; - float ticktime; -} DEMOREC_PLAYBACKINFO; - -int demorec_record_start(const char *filename, const char *netversion, const char *map, int map_crc, const char *type); -int demorec_isrecording(); -void demorec_record_snapshot(int tick, const void *data, int size); -void demorec_record_message(const void *data, int size); -int demorec_record_stop(); - -typedef void (*DEMOREC_PLAYCALLBACK)(void *data, int size); - -int demorec_playback_registercallbacks(DEMOREC_PLAYCALLBACK snapshot_cb, DEMOREC_PLAYCALLBACK message_cb); -int demorec_playback_load(const char *filename); -int demorec_playback_nextframe(); -int demorec_playback_play(); -void demorec_playback_pause(); -void demorec_playback_unpause(); -void demorec_playback_setspeed(float speed); -int demorec_playback_set(float precent); -int demorec_playback_update(); -const DEMOREC_PLAYBACKINFO *demorec_playback_info(); -int demorec_isplaying(); -int demorec_playback_stop(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.cpp deleted file mode 100644 index 06d152c45..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.cpp +++ /dev/null @@ -1,596 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include "e_linereader.h" - -/* compiled-in data-dir path */ -#define DATA_DIR "data" - -static JOBPOOL hostlookuppool; -static int engine_find_datadir(char *argv0); - -static void con_dbg_dumpmem(void *result, void *user_data) -{ - mem_debug_dump(); -} - -static void con_dbg_lognetwork(void *result, void *user_data) -{ - netcommon_openlog("network_sent.dat", "network_recv.dat"); -} - - -static char application_save_path[512] = {0}; -static char datadir[512] = {0}; - -const char *engine_savepath(const char *filename, char *buffer, int max) -{ - str_format(buffer, max, "%s/%s", application_save_path, filename); - return buffer; -} - -void engine_init(const char *appname) -{ - dbg_logger_stdout(); - dbg_logger_debugger(); - - /* */ - dbg_msg("engine", "running on %s-%s-%s", CONF_FAMILY_STRING, CONF_PLATFORM_STRING, CONF_ARCH_STRING); -#ifdef CONF_ARCH_ENDIAN_LITTLE - dbg_msg("engine", "arch is little endian"); -#elif defined(CONF_ARCH_ENDIAN_BIG) - dbg_msg("engine", "arch is big endian"); -#else - dbg_msg("engine", "unknown endian"); -#endif - - /* init the network */ - net_init(); - netcommon_init(); - - /* create storage location */ - { - char path[1024] = {0}; - fs_storage_path(appname, application_save_path, sizeof(application_save_path)); - if(fs_makedir(application_save_path) == 0) - { - str_format(path, sizeof(path), "%s/screenshots", application_save_path); - fs_makedir(path); - - str_format(path, sizeof(path), "%s/maps", application_save_path); - fs_makedir(path); - - str_format(path, sizeof(path), "%s/downloadedmaps", application_save_path); - fs_makedir(path); - - str_format(path, sizeof(path), "%s/demos", application_save_path); - fs_makedir(path); - } - } - - /* init console and add the console logger */ - console_init(); - dbg_logger(console_print); - - jobs_initpool(&hostlookuppool, 1); - - MACRO_REGISTER_COMMAND("dbg_dumpmem", "", CFGFLAG_SERVER|CFGFLAG_CLIENT, con_dbg_dumpmem, 0x0, "Dump the memory"); - MACRO_REGISTER_COMMAND("dbg_lognetwork", "", CFGFLAG_SERVER|CFGFLAG_CLIENT, con_dbg_lognetwork, 0x0, "Log the network"); - - /* reset the config */ - config_reset(); -} - - -void engine_listdir(int types, const char *path, FS_LISTDIR_CALLBACK cb, void *user) -{ - char buffer[1024]; - - /* list current directory */ - if(types&LISTDIRTYPE_CURRENT) - { - fs_listdir(path, cb, user); - } - - /* list users directory */ - if(types&LISTDIRTYPE_SAVE) - { - engine_savepath(path, buffer, sizeof(buffer)); - fs_listdir(buffer, cb, user); - } - - /* list datadir directory */ - if(types&LISTDIRTYPE_DATA) - { - str_format(buffer, sizeof(buffer), "%s/%s", datadir, path); - fs_listdir(buffer, cb, user); - } -} - -void engine_getpath(char *buffer, int buffer_size, const char *filename, int flags) -{ - if(flags&IOFLAG_WRITE) - engine_savepath(filename, buffer, buffer_size); - else - { - IOHANDLE handle = 0; - - /* check current directory */ - handle = io_open(filename, flags); - if(handle) - { - str_copy(buffer, filename, buffer_size); - io_close(handle); - return; - } - - /* check user directory */ - engine_savepath(filename, buffer, buffer_size); - handle = io_open(buffer, flags); - if(handle) - { - io_close(handle); - return; - } - - /* check normal data directory */ - str_format(buffer, buffer_size, "%s/%s", datadir, filename); - handle = io_open(buffer, flags); - if(handle) - { - io_close(handle); - return; - } - } - - buffer[0] = 0; -} - -IOHANDLE engine_openfile(const char *filename, int flags) -{ - char buffer[1024]; - - if(flags&IOFLAG_WRITE) - { - engine_savepath(filename, buffer, sizeof(buffer)); - return io_open(buffer, flags); - } - else - { - IOHANDLE handle = 0; - - /* check current directory */ - handle = io_open(filename, flags); - if(handle) - return handle; - - /* check user directory */ - engine_savepath(filename, buffer, sizeof(buffer)); - handle = io_open(buffer, flags); - if(handle) - return handle; - - /* check normal data directory */ - str_format(buffer, sizeof(buffer), "%s/%s", datadir, filename); - handle = io_open(buffer, flags); - if(handle) - return handle; - } - return 0; -} - -void engine_parse_arguments(int argc, char **argv) -{ - /* load the configuration */ - int i; - - /* check for datadir override */ - for(i = 1; i < argc; i++) - { - if(argv[i][0] == '-' && argv[i][1] == 'd' && argv[i][2] == 0 && argc - i > 1) - { - str_copy(datadir, argv[i+1], sizeof(datadir)); - i++; - } - } - - /* search for data directory */ - engine_find_datadir(argv[0]); - - dbg_msg("engine/datadir", "paths used:"); - dbg_msg("engine/datadir", "\t."); - dbg_msg("engine/datadir", "\t%s", application_save_path); - dbg_msg("engine/datadir", "\t%s", datadir); - dbg_msg("engine/datadir", "saving files to: %s", application_save_path); - - - /* check for scripts to execute */ - for(i = 1; i < argc; i++) - { - if(argv[i][0] == '-' && argv[i][1] == 'f' && argv[i][2] == 0 && argc - i > 1) - { - console_execute_file(argv[i+1]); - i++; - } - } - - /* search arguments for overrides */ - { - int i; - for(i = 1; i < argc; i++) - console_execute_line(argv[i]); - } - - console_execute_file("autoexec.cfg"); - - /* open logfile if needed */ - if(config.logfile[0]) - dbg_logger_file(config.logfile); - - /* set default servers and load from disk*/ - mastersrv_default(); - mastersrv_load(); -} - - -static IOHANDLE config_file = 0; - -int engine_config_write_start() -{ - config_save(); - config_file = engine_openfile("settings.cfg", IOFLAG_WRITE); - if(config_file == 0) - return -1; - return 0; -} - -void engine_config_write_line(const char *line) -{ - if(config_file) - { -#if defined(CONF_FAMILY_WINDOWS) - static const char newline[] = "\r\n"; -#else - static const char newline[] = "\n"; -#endif - io_write(config_file, line, strlen(line)); - io_write(config_file, newline, sizeof(newline)-1); - } -} - -void engine_config_write_stop() -{ - io_close(config_file); - config_file = 0; -} -/* -void engine_writeconfig() -{ -}*/ - -static int perf_tick = 1; -static PERFORMACE_INFO *current = 0; - -void perf_init() -{ -} - -void perf_next() -{ - perf_tick++; - current = 0; -} - -void perf_start(PERFORMACE_INFO *info) -{ - if(info->tick != perf_tick) - { - info->parent = current; - info->first_child = 0; - info->next_child = 0; - - if(info->parent) - { - info->next_child = info->parent->first_child; - info->parent->first_child = info; - } - - info->tick = perf_tick; - info->biggest = 0; - info->total = 0; - } - - current = info; - current->start = time_get(); -} - -void perf_end() -{ - if(!current) - return; - - current->last_delta = time_get()-current->start; - current->total += current->last_delta; - - if(current->last_delta > current->biggest) - current->biggest = current->last_delta; - - current = current->parent; -} - -static void perf_dump_imp(PERFORMACE_INFO *info, int indent) -{ - char buf[512] = {0}; - int64 freq = time_freq(); - int i; - - for(i = 0; i < indent; i++) - buf[i] = ' '; - - str_format(&buf[indent], sizeof(buf)-indent, "%-20s %8.2f %8.2f", info->name, info->total*1000/(float)freq, info->biggest*1000/(float)freq); - dbg_msg("perf", "%s", buf); - - info = info->first_child; - while(info) - { - perf_dump_imp(info, indent+2); - info = info->next_child; - } -} - -void perf_dump(PERFORMACE_INFO *top) -{ - perf_dump_imp(top, 0); -} - -/* master server functions */ -typedef struct -{ - char hostname[128]; - NETADDR addr; - - HOSTLOOKUP lookup; -} MASTER_INFO; - -static MASTER_INFO master_servers[MAX_MASTERSERVERS] = {{{0}}}; -static int needs_update = -1; - -int mastersrv_refresh_addresses() -{ - int i; - - if(needs_update != -1) - return 0; - - dbg_msg("engine/mastersrv", "refreshing master server addresses"); - - /* add lookup jobs */ - for(i = 0; i < MAX_MASTERSERVERS; i++) - engine_hostlookup(&master_servers[i].lookup, master_servers[i].hostname); - - needs_update = 1; - return 0; -} - -void mastersrv_update() -{ - int i; - - /* check if we need to update */ - if(needs_update != 1) - return; - needs_update = 0; - - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - if(jobs_status(&master_servers[i].lookup.job) != JOBSTATUS_DONE) - needs_update = 1; - else - { - master_servers[i].addr = master_servers[i].lookup.addr; - master_servers[i].addr.port = 8300; - } - } - - if(!needs_update) - { - dbg_msg("engine/mastersrv", "saving addresses"); - mastersrv_save(); - } -} - -int mastersrv_refreshing() -{ - return needs_update; -} - -NETADDR mastersrv_get(int index) -{ - return master_servers[index].addr; -} - -const char *mastersrv_name(int index) -{ - return master_servers[index].hostname; -} - -void mastersrv_dump_servers() -{ - int i; - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - dbg_msg("mastersrv", "#%d = %d.%d.%d.%d", i, - master_servers[i].addr.ip[0], master_servers[i].addr.ip[1], - master_servers[i].addr.ip[2], master_servers[i].addr.ip[3]); - } -} - -void mastersrv_default() -{ - int i; - mem_zero(master_servers, sizeof(master_servers)); - for(i = 0; i < MAX_MASTERSERVERS; i++) - sprintf(master_servers[i].hostname, "master%d.teeworlds.com", i+1); -} - -int mastersrv_load() -{ - LINEREADER lr; - IOHANDLE file; - int count = 0; - - /* try to open file */ - file = engine_openfile("masters.cfg", IOFLAG_READ); - if(!file) - return -1; - - linereader_init(&lr, file); - while(1) - { - MASTER_INFO info = {{0}}; - int ip[4]; - const char *line = linereader_get(&lr); - if(!line) - break; - - /* parse line */ - if(sscanf(line, "%s %d.%d.%d.%d", info.hostname, &ip[0], &ip[1], &ip[2], &ip[3]) == 5) - { - info.addr.ip[0] = (unsigned char)ip[0]; - info.addr.ip[1] = (unsigned char)ip[1]; - info.addr.ip[2] = (unsigned char)ip[2]; - info.addr.ip[3] = (unsigned char)ip[3]; - info.addr.port = 8300; - if(count != MAX_MASTERSERVERS) - { - master_servers[count] = info; - count++; - } - else - dbg_msg("engine/mastersrv", "warning: skipped master server '%s' due to limit of %d", line, MAX_MASTERSERVERS); - } - else - dbg_msg("engine/mastersrv", "warning: couldn't parse master server '%s'", line); - } - - io_close(file); - return 0; -} - -int mastersrv_save() -{ - IOHANDLE file; - int i; - - /* try to open file */ - file = engine_openfile("masters.cfg", IOFLAG_WRITE); - if(!file) - return -1; - - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - char buf[1024]; - str_format(buf, sizeof(buf), "%s %d.%d.%d.%d\n", master_servers[i].hostname, - master_servers[i].addr.ip[0], master_servers[i].addr.ip[1], - master_servers[i].addr.ip[2], master_servers[i].addr.ip[3]); - - io_write(file, buf, strlen(buf)); - } - - io_close(file); - return 0; -} - - -int hostlookup_thread(void *user) -{ - HOSTLOOKUP *lookup = (HOSTLOOKUP *)user; - net_host_lookup(lookup->hostname, &lookup->addr, NETTYPE_IPV4); - return 0; -} - -void engine_hostlookup(HOSTLOOKUP *lookup, const char *hostname) -{ - str_copy(lookup->hostname, hostname, sizeof(lookup->hostname)); - jobs_add(&hostlookuppool, &lookup->job, hostlookup_thread, lookup); -} - -static int engine_find_datadir(char *argv0) -{ - /* 1) use provided data-dir override */ - if(datadir[0]) - { - if(fs_is_dir(datadir)) - return 0; - else - { - dbg_msg("engine/datadir", "specified data-dir '%s' does not exist", datadir); - return -1; - } - } - - /* 2) use data-dir in PWD if present */ - if(fs_is_dir("data")) - { - strcpy(datadir, "data"); - return 0; - } - - /* 3) use compiled-in data-dir if present */ - if (fs_is_dir(DATA_DIR)) - { - strcpy(datadir, DATA_DIR); - return 0; - } - - /* 4) check for usable path in argv[0] */ - { - unsigned int pos = strrchr(argv0, '/') - argv0; - - if (pos < sizeof(datadir)) - { - char basedir[sizeof(datadir)]; - strncpy(basedir, argv0, pos); - basedir[pos] = '\0'; - str_format(datadir, sizeof(datadir), "%s/data", basedir); - - if (fs_is_dir(datadir)) - return 0; - } - } - -#if defined(CONF_FAMILY_UNIX) - /* 5) check for all default locations */ - { - const char *sdirs[] = { - "/usr/share/teeworlds", - "/usr/local/share/teeworlds" - "/opt/teeworlds" - }; - const int sdirs_count = sizeof(sdirs) / sizeof(sdirs[0]); - - int i; - for (i = 0; i < sdirs_count; i++) - { - if (fs_is_dir(sdirs[i])) - { - strcpy(datadir, sdirs[i]); - return 0; - } - } - } -#endif - - /* no data-dir found */ - dbg_msg("engine/datadir", "warning no data directory found"); - return -1; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.h deleted file mode 100644 index 5091e2444..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_engine.h +++ /dev/null @@ -1,60 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include "e_jobs.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -const char *engine_savepath(const char *filename, char *buffer, int max); -void engine_init(const char *appname); -void engine_parse_arguments(int argc, char **argv); - -int engine_config_write_start(); -void engine_config_write_line(const char *line); -void engine_config_write_stop(); - - -enum -{ - LISTDIRTYPE_SAVE=1, - LISTDIRTYPE_CURRENT=2, - LISTDIRTYPE_DATA=4, - LISTDIRTYPE_ALL = ~0 -}; - -void engine_listdir(int types, const char *path, FS_LISTDIR_CALLBACK cb, void *user); -IOHANDLE engine_openfile(const char *filename, int flags); -void engine_getpath(char *buffer, int buffer_size, const char *filename, int flags); - -int engine_stress(float probability); - -typedef struct HOSTLOOKUP -{ - JOB job; - char hostname[128]; - NETADDR addr; -} HOSTLOOKUP; - -void engine_hostlookup(HOSTLOOKUP *lookup, const char *hostname); - -enum -{ - MAX_MASTERSERVERS=4 -}; - -void mastersrv_default(); -int mastersrv_load(); -int mastersrv_save(); - -int mastersrv_refresh_addresses(); -void mastersrv_update(); -int mastersrv_refreshing(); -void mastersrv_dump_servers(); -NETADDR mastersrv_get(int index); -const char *mastersrv_name(int index); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.cpp deleted file mode 100644 index 6a72a6c50..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include /* memset */ -#include /* memset */ -#include "e_huffman.h" - -typedef struct HUFFMAN_CONSTRUCT_NODE -{ - unsigned short node_id; - int frequency; -} HUFFMAN_CONSTRUCT_NODE; - -static void huffman_setbits_r(HUFFMAN_STATE *huff, HUFFMAN_NODE *node, int bits, int depth) -{ - if(node->leafs[1] != 0xffff) - huffman_setbits_r(huff, &huff->nodes[node->leafs[1]], bits|(1<leafs[0] != 0xffff) - huffman_setbits_r(huff, &huff->nodes[node->leafs[0]], bits, depth+1); - - if(node->num_bits) - { - node->bits = bits; - node->num_bits = depth; - } -} - -/* TODO: this should be something faster, but it's enough for now */ -void bubblesort(HUFFMAN_CONSTRUCT_NODE **list, int size) -{ - int i, changed = 1; - HUFFMAN_CONSTRUCT_NODE *temp; - - while(changed) - { - changed = 0; - for(i = 0; i < size-1; i++) - { - if(list[i]->frequency < list[i+1]->frequency) - { - temp = list[i]; - list[i] = list[i+1]; - list[i+1] = temp; - changed = 1; - } - } - } -} - -static void huffman_construct_tree(HUFFMAN_STATE *huff, const unsigned *frequencies) -{ - HUFFMAN_CONSTRUCT_NODE nodes_left_storage[HUFFMAN_MAX_SYMBOLS]; - HUFFMAN_CONSTRUCT_NODE *nodes_left[HUFFMAN_MAX_SYMBOLS]; - int num_nodes_left = HUFFMAN_MAX_SYMBOLS; - int i; - - /* add the symbols */ - for(i = 0; i < HUFFMAN_MAX_SYMBOLS; i++) - { - huff->nodes[i].num_bits = -1; - huff->nodes[i].symbol = i; - huff->nodes[i].leafs[0] = -1; - huff->nodes[i].leafs[1] = -1; - - if(i == HUFFMAN_EOF_SYMBOL) - nodes_left_storage[i].frequency = 1; - else - nodes_left_storage[i].frequency = frequencies[i]; - nodes_left_storage[i].node_id = i; - nodes_left[i] = &nodes_left_storage[i]; - - } - huff->num_nodes = HUFFMAN_MAX_SYMBOLS; - - /* construct the table */ - while(num_nodes_left > 1) - { - /* we can't rely on stdlib's qsort for this, it can generate different results on different implementations */ - bubblesort(nodes_left, num_nodes_left); - - huff->nodes[huff->num_nodes].num_bits = 0; - huff->nodes[huff->num_nodes].leafs[0] = nodes_left[num_nodes_left-1]->node_id; - huff->nodes[huff->num_nodes].leafs[1] = nodes_left[num_nodes_left-2]->node_id; - nodes_left[num_nodes_left-2]->node_id = huff->num_nodes; - nodes_left[num_nodes_left-2]->frequency = nodes_left[num_nodes_left-1]->frequency + nodes_left[num_nodes_left-2]->frequency; - - huff->num_nodes++; - num_nodes_left--; - } - - /* set start node */ - huff->start_node = &huff->nodes[huff->num_nodes-1]; - - /* build symbol bits */ - huffman_setbits_r(huff, huff->start_node, 0, 0); -} - -void huffman_init(HUFFMAN_STATE *huff, const unsigned *frequencies) -{ - int i; - - /* make sure to cleanout every thing */ - memset(huff, 0, sizeof(HUFFMAN_STATE)); - - /* construct the tree */ - huffman_construct_tree(huff, frequencies); - - /* build decode LUT */ - for(i = 0; i < HUFFMAN_LUTSIZE; i++) - { - unsigned bits = i; - int k; - HUFFMAN_NODE *node = huff->start_node; - for(k = 0; k < HUFFMAN_LUTBITS; k++) - { - node = &huff->nodes[node->leafs[bits&1]]; - bits >>= 1; - - if(!node) - break; - - if(node->num_bits) - { - huff->decode_lut[i] = node; - break; - } - } - - if(k == HUFFMAN_LUTBITS) - huff->decode_lut[i] = node; - } - -} - -/*****************************************************************/ -int huffman_compress(HUFFMAN_STATE *huff, const void *input, int input_size, void *output, int output_size) -{ - /* this macro loads a symbol for a byte into bits and bitcount */ -#define HUFFMAN_MACRO_LOADSYMBOL(sym) \ - bits |= huff->nodes[sym].bits << bitcount; \ - bitcount += huff->nodes[sym].num_bits; - - /* this macro writes the symbol stored in bits and bitcount to the dst pointer */ -#define HUFFMAN_MACRO_WRITE() \ - while(bitcount >= 8) \ - { \ - *dst++ = (unsigned char)(bits&0xff); \ - if(dst == dst_end) \ - return -1; \ - bits >>= 8; \ - bitcount -= 8; \ - } - - /* setup buffer pointers */ - const unsigned char *src = (const unsigned char *)input; - const unsigned char *src_end = src + input_size; - unsigned char *dst = (unsigned char *)output; - unsigned char *dst_end = dst + output_size; - - /* symbol variables */ - unsigned bits = 0; - unsigned bitcount = 0; - - /* make sure that we have data that we want to compress */ - if(input_size) - { - /* {A} load the first symbol */ - int symbol = *src++; - - while(src != src_end) - { - /* {B} load the symbol */ - HUFFMAN_MACRO_LOADSYMBOL(symbol) - - /* {C} fetch next symbol, this is done here because it will reduce dependency in the code */ - symbol = *src++; - - /* {B} write the symbol loaded at */ - HUFFMAN_MACRO_WRITE() - } - - /* write the last symbol loaded from {C} or {A} in the case of only 1 byte input buffer */ - HUFFMAN_MACRO_LOADSYMBOL(symbol) - HUFFMAN_MACRO_WRITE() - } - - /* write EOF symbol */ - HUFFMAN_MACRO_LOADSYMBOL(HUFFMAN_EOF_SYMBOL) - HUFFMAN_MACRO_WRITE() - - /* write out the last bits */ - *dst++ = bits; - - /* return the size of the output */ - return (int)(dst - (const unsigned char *)output); - - /* remove macros */ -#undef HUFFMAN_MACRO_LOADSYMBOL -#undef HUFFMAN_MACRO_WRITE -} - -/*****************************************************************/ -int huffman_decompress(HUFFMAN_STATE *huff, const void *input, int input_size, void *output, int output_size) -{ - /* setup buffer pointers */ - unsigned char *dst = (unsigned char *)output; - unsigned char *src = (unsigned char *)input; - unsigned char *dst_end = dst + output_size; - unsigned char *src_end = src + input_size; - - unsigned bits = 0; - unsigned bitcount = 0; - - HUFFMAN_NODE *eof = &huff->nodes[HUFFMAN_EOF_SYMBOL]; - HUFFMAN_NODE *node = 0; - - while(1) - { - /* {A} try to load a node now, this will reduce dependency at location {D} */ - node = 0; - if(bitcount >= HUFFMAN_LUTBITS) - node = huff->decode_lut[bits&HUFFMAN_LUTMASK]; - - /* {B} fill with new bits */ - while(bitcount < 24 && src != src_end) - { - bits |= (*src++) << bitcount; - bitcount += 8; - } - - /* {C} load symbol now if we didn't that earlier at location {A} */ - if(!node) - node = huff->decode_lut[bits&HUFFMAN_LUTMASK]; - - /* {D} check if we hit a symbol already */ - if(node->num_bits) - { - /* remove the bits for that symbol */ - bits >>= node->num_bits; - bitcount -= node->num_bits; - } - else - { - /* remove the bits that the lut checked up for us */ - bits >>= HUFFMAN_LUTBITS; - bitcount -= HUFFMAN_LUTBITS; - - /* walk the tree bit by bit */ - while(1) - { - /* traverse tree */ - node = &huff->nodes[node->leafs[bits&1]]; - - /* remove bit */ - bitcount--; - bits >>= 1; - - /* check if we hit a symbol */ - if(node->num_bits) - break; - - /* no more bits, decoding error */ - if(bitcount == 0) - return -1; - } - } - - /* check for eof */ - if(node == eof) - break; - - /* output character */ - if(dst == dst_end) - return -1; - *dst++ = node->symbol; - } - - /* return the size of the decompressed buffer */ - return (int)(dst - (const unsigned char *)output); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.h deleted file mode 100644 index c4e202234..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_huffman.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __HUFFMAN_HEADER__ -#define __HUFFMAN_HEADER__ - -#ifdef __cplusplus -extern "C" { -#endif - -enum -{ - HUFFMAN_EOF_SYMBOL = 256, - - HUFFMAN_MAX_SYMBOLS=HUFFMAN_EOF_SYMBOL+1, - HUFFMAN_MAX_NODES=HUFFMAN_MAX_SYMBOLS*2-1, - - HUFFMAN_LUTBITS = 10, - HUFFMAN_LUTSIZE = (1< -*/ -float client_intratick(); - -/* - Function: client_predtick - Returns the current predicted tick. -*/ -int client_predtick(); - -/* - Function: client_predintratick - Returns the current preticted intra tick. - - Remarks: - This is the same as but for the current predicted tick and - previous predicted tick. - - See Also: - -*/ -float client_predintratick(); - -/* - Function: client_ticktime - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -float client_ticktime(); - -/* - Function: client_tickspeed - Returns how many ticks per second the client is doing. - - Remarks: - This will be the same as the server tick speed. -*/ -int client_tickspeed(); - -/* - Function: client_frametime - Returns how long time the last frame took to process. -*/ -float client_frametime(); - -/* - Function: client_localtime - Returns the clients local time. - - Remarks: - The local time is set to 0 when the client starts and when - it connects to a server. Can be used for client side effects. -*/ -float client_localtime(); - -/********************************************************************************** - Group: Server Browser -**********************************************************************************/ - -/* - Function: client_serverbrowse_refresh - Issues a refresh of the server browser. - - Arguments: - type - What type of servers to browse, internet, lan or favorites. - - Remarks: - This will cause a broadcast on the local network if the lan argument is set. - Otherwise it call ask all the master servers for their servers lists. -*/ -void client_serverbrowse_refresh(int type); - -/* - Function: client_serverbrowse_sorted_get - Returns server info from the sorted list. - - Arguments: - index - Zero based index into the sorted list. - - See Also: - -*/ -SERVER_INFO *client_serverbrowse_sorted_get(int index); - -/* - Function: client_serverbrowse_sorted_num - Returns how many servers there are in the sorted list. - - See Also: - -*/ -int client_serverbrowse_sorted_num(); - -/* - Function: client_serverbrowse_get - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -SERVER_INFO *client_serverbrowse_get(int index); - -/* - Function: client_serverbrowse_num - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_serverbrowse_num(); - -/* - Function: client_serverbrowse_num_requests - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_serverbrowse_num_requests(); - -/* - Function: client_serverbrowse_update - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void client_serverbrowse_update(); - -/* - Function: client_serverbrowse_lan - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_serverbrowse_lan(); - -/* - Function: client_serverbrowse_isfavorite - Asks the server browser is a netaddr is in the favorite list - - Arguments: - addr - Address of the server to ask about. - - Returns: - Returns zero if it's not in the list, non-zero if it is. -*/ -int client_serverbrowse_isfavorite(NETADDR addr); - -/* - Function: client_serverbrowse_addfavorite - Adds a server to the favorite list - - Arguments: - addr - Address of the favorite server. -*/ -void client_serverbrowse_addfavorite(NETADDR addr); - -/* - Function: client_serverbrowse_removefavorite - Removes a server to the favorite list - - Arguments: - addr - Address of the favorite server. -*/ -void client_serverbrowse_removefavorite(NETADDR addr); - -/********************************************************************************** - Group: Actions -**********************************************************************************/ - - -/* - Function: client_connect - Connects to a server at the specified address. - - Arguments: - address - Address of the server to connect to. - - See Also: - -*/ -void client_connect(const char *address); - -/* - Function: client_disconnect - Disconnects from the current server. - - Remarks: - Does nothing if not connected to a server. - - See Also: - -*/ -void client_disconnect(); - -/* - Function: client_quit - Tells to client to shutdown. - - See Also: - -*/ -void client_quit(); - -void client_entergame(); - -/* - Function: client_rcon - Sends a command to the server to execute on it's console. - - Arguments: - cmd - The command to send. - - Remarks: - The client must have the correct rcon password to connect. - - See Also: - -*/ -void client_rcon(const char *cmd); - -/* - Function: client_rcon_auth - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void client_rcon_auth(const char *name, const char *password); - -/* - Function: client_rcon_authed - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_rcon_authed(); - -/********************************************************************************** - Group: Other -**********************************************************************************/ -/* - Function: client_latestversion - Returns 0 if there's no version difference - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *client_latestversion(); - -/* - Function: client_get_input - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int *client_get_input(int tick); - -/* - Function: client_direct_input - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void client_direct_input(int *input, int size); - -/* - Function: client_error_string - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *client_error_string(); - -/* - Function: client_connection_problems - Returns 1 if the client is connection problems. - - Remarks: - Connections problems usually means that the client havn't recvived any data - from the server in a while. -*/ -int client_connection_problems(); - -/* - Function: client_state - Returns the state of the client. - - See Also: - -*/ -int client_state(); - -/* - Function: client_mapdownload_amount - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_mapdownload_amount(); - -/* - Function: client_mapdownload_totalsize - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_mapdownload_totalsize(); - -/* - Function: client_save_line - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void client_save_line(const char *line); - - - - - - -enum -{ - BROWSESET_MASTER_ADD=1, - BROWSESET_FAV_ADD, - BROWSESET_TOKEN, - BROWSESET_OLD_INTERNET, - BROWSESET_OLD_LAN -}; - -void client_serverbrowse_set(NETADDR *addr, int type, int token, SERVER_INFO *info); - -int client_serverbrowse_refreshingmasters(); - - -typedef struct DEMOPLAYBACK_INFO -{ - int first_tick; - int last_tick; - int current_tick; - int paused; - float speed; -} DEMOPLAYBACK_INFO; - -void client_demoplayer_play(const char *filename); -const DEMOPLAYBACK_INFO *client_demoplayer_getinfo(); -void client_demoplayer_setpos(float percent); -void client_demoplayer_setpause(int paused); -void client_demoplayer_setspeed(float speed); -const char *client_user_directory(); -void client_serverinfo(SERVER_INFO *serverinfo); -void client_serverinfo_request(); -void client_serverbrowse_request(NETADDR *addr); -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_gfx.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_gfx.h deleted file mode 100644 index 1b9f920c0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_gfx.h +++ /dev/null @@ -1,673 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_GFX_H -#define ENGINE_IF_GFX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Title: Graphics -*/ - -/* - Section: Structures -*/ - -/* - Structure: IMAGE_INFO -*/ -typedef struct -{ - /* Variable: width - Contains the width of the image */ - int width; - - /* Variable: height - Contains the height of the image */ - int height; - - /* Variable: format - Contains the format of the image. See for more information. */ - int format; - - /* Variable: data - Pointer to the image data. */ - void *data; -} IMAGE_INFO; - -/* - Structure: VIDEO_MODE -*/ -typedef struct -{ - int width, height; - int red, green, blue; -} VIDEO_MODE; - -/* - Section: Functions -*/ - -/* - Group: Quads -*/ - -/* - Function: gfx_quads_begin - Begins a quad drawing session. - - Remarks: - This functions resets the rotation, color and subset. - End the session by using . - You can't change texture or blending mode during a session. - - See Also: - -*/ -void gfx_quads_begin(); - -/* - Function: gfx_quads_end - Ends a quad session. - - See Also: - -*/ -void gfx_quads_end(); - -/* - Function: gfx_quads_setrotation - Sets the rotation to use when drawing a quad. - - Arguments: - angle - Angle in radians. - - Remarks: - The angle is reset when is called. -*/ -void gfx_quads_setrotation(float angle); - -/* - Function: gfx_quads_setsubset - Sets the uv coordinates to use. - - Arguments: - tl_u - Top-left U value. - tl_v - Top-left V value. - br_u - Bottom-right U value. - br_v - Bottom-right V value. - - Remarks: - O,0 is top-left of the texture and 1,1 is bottom-right. - The color is reset when is called. -*/ -void gfx_quads_setsubset(float tl_u, float tl_v, float br_u, float br_v); - -/* - Function: gfx_quads_setsubset_free - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_quads_setsubset_free( - float x0, float y0, - float x1, float y1, - float x2, float y2, - float x3, float y3); - -/* - Function: gfx_quads_drawTL - Draws a quad by specifying the top-left point. - - Arguments: - x - X coordinate of the top-left corner. - y - Y coordinate of the top-left corner. - width - Width of the quad. - height - Height of the quad. - - Remarks: - Rotation still occurs from the center of the quad. - You must call before calling this function. - - See Also: - -*/ -void gfx_quads_drawTL(float x, float y, float width, float height); - -/* - Function: gfx_quads_draw - Draws a quad by specifying the center point. - - Arguments: - x - X coordinate of the center. - y - Y coordinate of the center. - width - Width of the quad. - height - Height of the quad. - - Remarks: - You must call before calling this function. - - See Also: - -*/ -void gfx_quads_draw(float x, float y, float w, float h); - -/* - Function: gfx_quads_draw_freeform - Draws a quad by specifying the corner points. - - Arguments: - x0, y0 - Coordinates of the upper left corner. - x1, y1 - Coordinates of the upper right corner. - x2, y2 - Coordinates of the lower left corner. // TODO: DOUBLE CHECK!!! - x3, y3 - Coordinates of the lower right corner. // TODO: DOUBLE CHECK!!! - - See Also: - -*/ -void gfx_quads_draw_freeform( - float x0, float y0, - float x1, float y1, - float x2, float y2, - float x3, float y3); - -/* - Function: gfx_quads_text - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_quads_text(float x, float y, float size, float r, float g, float b, float a, const char *text); - -/* - Group: Lines -*/ - -/* - Function: gfx_lines_begin - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_lines_begin(); - -/* - Function: gfx_lines_draw - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_lines_draw(float x0, float y0, float x1, float y1); - -/* - Function: gfx_minimize - Minimizes the window. - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_minimize(); - -/* - Function: gfx_minimize - Maximizes the window. - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_maximize(); - -/* - Function: gfx_lines_end - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_lines_end(); - -/* - Group: Text -*/ - - -/* - Function: gfx_text - TODO - - Arguments: - arg1 - desc - - Returns: - returns the number of lines written - See Also: - -*/ -void gfx_text(void *font, float x, float y, float size, const char *text, int max_width); - -/* - Function: gfx_text_width - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -float gfx_text_width(void *font, float size, const char *text, int length); - -/* - Function: gfx_text_color - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_text_color(float r, float g, float b, float a); - -/* - Function: gfx_text_set_default_font - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_text_set_default_font(void *font); - -/* - Group: Other -*/ - -/* - Function: gfx_get_video_modes - Fetches a list of all the available video modes. - - Arguments: - list - An array to recive the modes. Must be able to contain maxcount number of modes. - maxcount - The maximum number of modes to fetch. - - Returns: - The number of video modes that was fetched. -*/ -int gfx_get_video_modes(VIDEO_MODE *list, int maxcount); - -/* image loaders */ - -/* - Function: gfx_load_png - Loads a PNG image from disk. - - Arguments: - img - Pointer to an structure to be filled out with the image information. - filename - Filename of the image to load. - - Returns: - Returns non-zero on success and zero on error. - - Remarks: - The caller are responsible for cleaning up the allocated memory in the IMAGE_INFO structure. - - See Also: - -*/ -int gfx_load_png(IMAGE_INFO *img, const char *filename); - -/* textures */ -/* - Function: gfx_load_texture - Loads a texture from a file. TGA and PNG supported. - - Arguments: - filename - Null terminated string to the file to load. - store_format - What format to store on gfx card as. - flags - controls how the texture is uploaded - - Returns: - An ID to the texture. -1 on failure. - - See Also: - -*/ -int gfx_load_texture(const char *filename, int store_format, int flags); - -/* - Function: gfx_load_texture_raw - Loads a texture from memory. - - Arguments: - w - Width of the texture. - h - Height of the texture. - data - Pointer to the pixel data. - format - Format of the pixel data. - store_format - The format to store the texture on the graphics card. - flags - controls how the texture is uploaded - - Returns: - An ID to the texture. -1 on failure. - - Remarks: - The pixel data should be in RGBA format with 8 bit per component. - So the total size of the data should be w*h*4. - - See Also: - -*/ -int gfx_load_texture_raw(int w, int h, int format, const void *data, int store_format, int flags); - -/* - Function: gfx_texture_set - Sets the active texture. - - Arguments: - id - ID to the texture to set. -*/ -void gfx_texture_set(int id); - -/* - Function: gfx_unload_texture - Unloads a texture. - - Arguments: - id - ID to the texture to unload. - - See Also: - , - - Remarks: - NOT IMPLEMENTED -*/ -int gfx_unload_texture(int id); - -/* - Function: gfx_clear - Clears the screen with the specified color. - - Arguments: - r - Red component. - g - Green component. - b - Red component. - - Remarks: - The value of the components are given in 0.0 - 1.0 ranges. -*/ -void gfx_clear(float r, float g, float b); - -/* - Function: gfx_screenaspect - Returns the aspect ratio between width and height. - - See Also: - , -*/ -float gfx_screenaspect(); - -/* - Function: gfx_screenwidth - Returns the screen width. - - See Also: - -*/ -int gfx_screenwidth(); - -/* - Function: gfx_screenheight - Returns the screen height. - - See Also: - -*/ -int gfx_screenheight(); - -/* - Function: gfx_mapscreen - Specifies the coordinate system for the screen. - - Arguments: - tl_x - Top-left X - tl_y - Top-left Y - br_x - Bottom-right X - br_y - Bottom-right y -*/ -void gfx_mapscreen(float tl_x, float tl_y, float br_x, float br_y); - -/* - Function: gfx_blend_normal - Set the active blending mode to normal (src, 1-src). - - Remarks: - This must be used before calling . - This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). - - See Also: - -*/ -void gfx_blend_normal(); - -/* - Function: gfx_blend_additive - Set the active blending mode to additive (src, one). - - Remarks: - This must be used before calling . - This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE). - - See Also: - -*/ -void gfx_blend_additive(); - -/* - Function: gfx_blend_none - Disables blending - - Remarks: - This must be used before calling . - - See Also: - -*/ -void gfx_blend_none(); - - -/* - Function: gfx_setcolorvertex - Sets the color of a vertex. - - Arguments: - i - Index to the vertex. - r - Red value. - g - Green value. - b - Blue value. - a - Alpha value. - - Remarks: - The color values are from 0.0 to 1.0. - The color is reset when is called. -*/ -void gfx_setcolorvertex(int i, float r, float g, float b, float a); - -/* - Function: gfx_setcolor - Sets the color of all the vertices. - - Arguments: - r - Red value. - g - Green value. - b - Blue value. - a - Alpha value. - - Remarks: - The color values are from 0.0 to 1.0. - The color is reset when is called. -*/ -void gfx_setcolor(float r, float g, float b, float a); - -/* - Function: gfx_getscreen - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_getscreen(float *tl_x, float *tl_y, float *br_x, float *br_y); - -/* - Function: gfx_memory_usage - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int gfx_memory_usage(); - -/* - Function: gfx_screenshot - TODO - - Arguments: - filename - desc - - Returns: - - See Also: - -*/ -void gfx_screenshot(); - -/* - Function: gfx_screenshot_direct - TODO - - Arguments: - filename - desc - - Returns: - - See Also: - -*/ -void gfx_screenshot_direct(const char *filename); - -/* - Function: gfx_clip_enable - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_clip_enable(int x, int y, int w, int h); - -/* - Function: gfx_clip_disable - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void gfx_clip_disable(); - - -enum -{ - TEXTFLAG_RENDER=1, - TEXTFLAG_ALLOW_NEWLINE=2, - TEXTFLAG_STOP_AT_END=4 -}; - -typedef struct -{ - int flags; - int line_count; - int charcount; - - float start_x; - float start_y; - float line_width; - float x, y; - void *font_set; - float font_size; -} TEXT_CURSOR; - -void gfx_text_set_cursor(TEXT_CURSOR *cursor, float x, float y, float font_size, int flags); -void gfx_text_ex(TEXT_CURSOR *cursor, const char *text, int length); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_inp.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_inp.h deleted file mode 100644 index 9277d8302..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_inp.h +++ /dev/null @@ -1,255 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_INP_H -#define ENGINE_IF_INP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Section: Input -*/ - - -/* - Structure: INPUT_EVENT -*/ -enum -{ - INPFLAG_PRESS=1, - INPFLAG_RELEASE=2, - INPFLAG_REPEAT=4 -}; - -typedef struct -{ - int flags; - unsigned char ch; - int key; -} INPUT_EVENT; - -/* - Function: inp_mouse_relative - Fetches the mouse movements. - - Arguments: - x - Pointer to the variable that should get the X movement. - y - Pointer to the variable that should get the Y movement. -*/ -void inp_mouse_relative(int *x, int *y); - -void inp_mouse_absolute(int *x, int *y); - -/* - Function: inp_mouse_scroll - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_mouse_scroll(); - -/* - Function: inp_key_pressed - Checks if a key is pressed. - - Arguments: - key - Index to the key to check - - Returns: - Returns 1 if the button is pressed, otherwise 0. - - Remarks: - Check keys.h for the keys. -*/ -int inp_key_pressed(int key); - - -/* input */ -/* - Function: inp_key_was_pressed - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_was_pressed(int key); - -/* - Function: inp_key_down - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_down(int key); - - -/* - Function: inp_num_events - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_num_events(); - -/* - Function: inp_get_event - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -INPUT_EVENT inp_get_event(int index); - -/* - Function: inp_clear_events - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void inp_clear_events(); - -/* - Function: inp_mouse_doubleclick - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_mouse_doubleclick(); - -/* - Function: inp_key_presses - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_presses(int key); - -/* - Function: inp_key_releases - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_releases(int key); - -/* - Function: inp_key_state - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_state(int key); - -/* - Function: inp_key_name - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *inp_key_name(int k); - -/* - Function: inp_key_code - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int inp_key_code(const char *key_name); - - - -/* - Function: inp_clear_key_states - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void inp_clear_key_states(); - -void inp_update(); -void inp_init(); -void inp_mouse_mode_absolute(); -void inp_mouse_mode_relative(); -void inp_warp_mouse(int x, int y); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_modc.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_modc.h deleted file mode 100644 index d09bebeb3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_modc.h +++ /dev/null @@ -1,153 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_MODC_H -#define ENGINE_IF_MODC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************************************************************************** - Section: Client Hooks -*********************************************************************************/ -/* - Function: modc_console_init - TODO -*/ -void modc_console_init(); - -/* - Function: modc_rcon_line - TODO -*/ -void modc_rcon_line(const char *line); - -/* - Function: modc_save_config - TODO -*/ -void modc_save_config(); - -/* - Function: modc_init - Called when the client starts. - - Remarks: - The game should load resources that are used during the entire - time of the game. No map is loaded. -*/ -void modc_init(); - -/* - Function: modc_newsnapshot - Called when the client progressed to a new snapshot. - - Remarks: - The client can check for items in the snapshot and perform one time - events like playing sounds, spawning client side effects etc. -*/ -void modc_newsnapshot(); - -/* - Function: modc_entergame - Called when the client has successfully connect to a server and - loaded a map. - - Remarks: - The client can check for items in the map and load them. -*/ -void modc_entergame(); - -/* - Function: modc_shutdown - Called when the client closes down. -*/ -void modc_shutdown(); - -/* - Function: modc_render - Called every frame to let the game render it self. -*/ -void modc_render(); - -/* - Function: modc_statechange - Called every time client changes state. -*/ -void modc_statechange(int new_state, int old_state); - -/* undocumented callbacks */ -/* - Function: modc_connected - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void modc_connected(); - -/* - Function: modc_message - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void modc_message(int msg); - -/* - Function: modc_predict - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void modc_predict(); - -/* - Function: modc_snap_input - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int modc_snap_input(int *data); - -/* - Function: modc_net_version - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *modc_net_version(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_mods.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_mods.h deleted file mode 100644 index f63c2a025..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_mods.h +++ /dev/null @@ -1,176 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_MOD_H -#define ENGINE_IF_MOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************************************************************************** - Section: Server Hooks -**********************************************************************************/ -/* - Function: mods_console_init - TODO -*/ -void mods_console_init(); - -/* - Function: mods_init - Called when the server is started. - - Remarks: - It's called after the map is loaded so all map items are available. -*/ -void mods_init(); - -/* - Function: mods_shutdown - Called when the server quits. - - Remarks: - Should be used to clean up all resources used. -*/ -void mods_shutdown(); - -/* - Function: mods_client_enter - Called when a client has joined the game. - - Arguments: - cid - Client ID. Is 0 - MAX_CLIENTS. - - Remarks: - It's called when the client is finished loading and should enter gameplay. -*/ -void mods_client_enter(int cid); - -/* - Function: mods_client_drop - Called when a client drops from the server. - - Arguments: - cid - Client ID. Is 0 - MAX_CLIENTS -*/ -void mods_client_drop(int cid); - -/* - Function: mods_client_direct_input - Called when the server recives new input from a client. - - Arguments: - cid - Client ID. Is 0 - MAX_CLIENTS. - input - Pointer to the input data. - size - Size of the data. (NOT IMPLEMENTED YET) -*/ -void mods_client_direct_input(int cid, void *input); - -/* - Function: mods_client_predicted_input - Called when the server applys the predicted input on the client. - - Arguments: - cid - Client ID. Is 0 - MAX_CLIENTS. - input - Pointer to the input data. - size - Size of the data. (NOT IMPLEMENTED YET) -*/ -void mods_client_predicted_input(int cid, void *input); - - -/* - Function: mods_tick - Called with a regular interval to progress the gameplay. - - Remarks: - The SERVER_TICK_SPEED tells the number of ticks per second. -*/ -void mods_tick(); - -/* - Function: mods_presnap - Called before the server starts to construct snapshots for the clients. -*/ -void mods_presnap(); - -/* - Function: mods_snap - Called to create the snapshot for a client. - - Arguments: - cid - Client ID. Is 0 - MAX_CLIENTS. - - Remarks: - The game should make a series of calls to to construct - the snapshot for the client. -*/ -void mods_snap(int cid); - -/* - Function: mods_postsnap - Called after the server is done sending the snapshots. -*/ -void mods_postsnap(); - - -/* - Function: mods_connected - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void mods_connected(int client_id); - - -/* - Function: mods_net_version - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *mods_net_version(); - -/* - Function: mods_version - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *mods_version(); - -/* - Function: mods_message - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void mods_message(int msg, int client_id); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_msg.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_msg.h deleted file mode 100644 index f83ec4219..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_msg.h +++ /dev/null @@ -1,158 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_MSG_H -#define ENGINE_IF_MSG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Section: Messaging -*/ - -void msg_pack_start_system(int msg, int flags); - -/* - Function: msg_pack_start - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void msg_pack_start(int msg, int flags); - -/* - Function: msg_pack_int - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void msg_pack_int(int i); - -/* - Function: msg_pack_string - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void msg_pack_string(const char *p, int limit); - -/* - Function: msg_pack_raw - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void msg_pack_raw(const void *data, int size); - -/* - Function: msg_pack_end - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void msg_pack_end(); - -typedef struct -{ - int msg; - int flags; - const unsigned char *data; - int size; -} MSG_INFO; - -const MSG_INFO *msg_get_info(); - -/* message unpacking */ -int msg_unpack_start(const void *data, int data_size, int *is_system); - -/* - Function: msg_unpack_int - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int msg_unpack_int(); - -/* - Function: msg_unpack_string - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *msg_unpack_string(); - -/* - Function: msg_unpack_raw - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const unsigned char *msg_unpack_raw(int size); - -/* - Function: msg_unpack_error - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int msg_unpack_error(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_other.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_other.h deleted file mode 100644 index 6d91ecc32..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_other.h +++ /dev/null @@ -1,392 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_OTHER_H -#define ENGINE_IF_OTHER_H - -/* - Title: Engine Interface -*/ - -#include -#include "e_keys.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum -{ - SERVER_TICK_SPEED=50, - MAX_CLIENTS=16, - - SNAP_CURRENT=0, - SNAP_PREV=1, - - MASK_NONE=0, - MASK_SET, - MASK_ZERO, - - SNDFLAG_LOOP=1, - SNDFLAG_POS=2, - SNDFLAG_ALL=3, - - MAX_NAME_LENGTH=32 -}; - -enum -{ - SRVFLAG_PASSWORD = 0x1, -}; - -/* - Structure: SNAP_ITEM -*/ -typedef struct -{ - int type; - int id; - int datasize; -} SNAP_ITEM; - -/* - Structure: CLIENT_INFO -*/ -typedef struct -{ - const char *name; - int latency; -} CLIENT_INFO; - -typedef struct PERFORMACE_INFO_t -{ - const char *name; - struct PERFORMACE_INFO_t *parent; - struct PERFORMACE_INFO_t *first_child; - struct PERFORMACE_INFO_t *next_child; - int tick; - int64 start; - int64 total; - int64 biggest; - int64 last_delta; -} PERFORMACE_INFO; - -void perf_init(); -void perf_next(); -void perf_start(PERFORMACE_INFO *info); -void perf_end(); -void perf_dump(PERFORMACE_INFO *top); - -int gfx_init(); -void gfx_shutdown(); -void gfx_swap(); -int gfx_window_active(); -int gfx_window_open(); - -void gfx_set_vsync(int val); - -int snd_init(); -int snd_shutdown(); -int snd_update(); - -int map_load(const char *mapname); -void map_unload(); - -void map_set(void *m); - -/* -#include "e_if_client.h" -#include "e_if_server.h" -#include "e_if_snd.h" -#include "e_if_gfx.h" -#include "e_if_inp.h" -#include "e_if_msg.h" -#include "e_if_mod.h"*/ - -/* - Section: Map -*/ - -/* - Function: map_is_loaded - Checks if a map is loaded. - - Returns: - Returns 1 if the button is pressed, otherwise 0. -*/ -int map_is_loaded(); - -/* - Function: map_num_items - Checks the number of items in the loaded map. - - Returns: - Returns the number of items. 0 if no map is loaded. -*/ -int map_num_items(); - -/* - Function: map_find_item - Searches the map for an item. - - Arguments: - type - Item type. - id - Item ID. - - Returns: - Returns a pointer to the item if it exists, otherwise it returns NULL. -*/ -void *map_find_item(int type, int id); - -/* - Function: map_get_item - Gets an item from the loaded map from index. - - Arguments: - index - Item index. - type - Pointer that recives the item type (can be NULL). - id - Pointer that recives the item id (can be NULL). - - Returns: - Returns a pointer to the item if it exists, otherwise it returns NULL. -*/ -void *map_get_item(int index, int *type, int *id); - -/* - Function: map_get_type - Gets the index range of an item type. - - Arguments: - type - Item type to search for. - start - Pointer that recives the starting index. - num - Pointer that recives the number of items. - - Returns: - If the item type is not in the map, start and num will be set to 0. -*/ -void map_get_type(int type, int *start, int *num); - -/* - Function: map_get_data - Fetches a pointer to a raw data chunk in the map. - - Arguments: - index - Index to the data to fetch. - - Returns: - A pointer to the raw data, otherwise 0. -*/ -void *map_get_data(int index); - -/* - Function: map_get_data_swapped - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void *map_get_data_swapped(int index); - -/* - Section: Network (Server) -*/ -/* - Function: snap_new_item - Creates a new item that should be sent. - - Arguments: - type - Type of the item. - id - ID of the item. - size - Size of the item. - - Returns: - A pointer to the item data, otherwise 0. - - Remarks: - The item data should only consist pf 4 byte integers as - they are subject to byte swapping. This means that the size - argument should be dividable by 4. -*/ -void *snap_new_item(int type, int id, int size); - -/* - Section:Section: Network (Client) -*/ -/* - Function: snap_num_items - Check the number of items in a snapshot. - - Arguments: - snapid - Snapshot ID to the data to fetch. - * SNAP_PREV for previous snapshot. - * SNAP_CUR for current snapshot. - - Returns: - The number of items in the snapshot. -*/ -int snap_num_items(int snapid); - -/* - Function: snap_get_item - Gets an item from a snapshot. - - Arguments: - snapid - Snapshot ID to the data to fetch. - * SNAP_PREV for previous snapshot. - * SNAP_CUR for current snapshot. - index - Index of the item. - item - Pointer that recives the item info. - - Returns: - Returns a pointer to the item if it exists, otherwise NULL. -*/ -void *snap_get_item(int snapid, int index, SNAP_ITEM *item); - -/* - Function: snap_find_item - Searches a snapshot for an item. - - Arguments: - snapid - Snapshot ID to the data to fetch. - * SNAP_PREV for previous snapshot. - * SNAP_CUR for current snapshot. - type - Type of the item. - id - ID of the item. - - Returns: - Returns a pointer to the item if it exists, otherwise NULL. -*/ -void *snap_find_item(int snapid, int type, int id); - -/* - Function: snap_invalidate_item - Marks an item as invalid byt setting type and id to 0xffffffff. - - Arguments: - snapid - Snapshot ID to the data to fetch. - * SNAP_PREV for previous snapshot. - * SNAP_CUR for current snapshot. - index - Index of the item. -*/ -void snap_invalidate_item(int snapid, int index); - -/* - Function: snap_input - Sets the input data to send to the server. - - Arguments: - data - Pointer to the data. - size - Size of the data. - - Remarks: - The data should only consist of 4 bytes integer as they are - subject to byte swapping. -*/ -void snap_input(void *data, int size); - -/* - Function: snap_set_staticsize - Tells the engine how big a specific item always will be. This - helps the engine to compress snapshots better. - - Arguments: - type - Item type - size - Size of the data. - - Remarks: - Size must be in a multiple of 4. -*/ -void snap_set_staticsize(int type, int size); - -/* message packing */ -enum -{ - MSGFLAG_VITAL=1, - MSGFLAG_FLUSH=2, - MSGFLAG_NORECORD=4, - MSGFLAG_RECORD=8, - MSGFLAG_NOSEND=16 -}; - -/* message sending */ -/* - Function: server_send_msg - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int server_send_msg(int client_id); /* client_id == -1 == broadcast */ - -/* - Function: client_send_msg - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int client_send_msg(); -/* undocumented graphics stuff */ - -/* server snap id */ -/* - Function: snap_new_id - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int snap_new_id(); - -/* - Function: snap_free_id - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void snap_free_id(int id); - -/* other */ -/* - Function: map_unload_data - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void map_unload_data(int index); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_server.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_server.h deleted file mode 100644 index 6940d4f37..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_server.h +++ /dev/null @@ -1,149 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_SERVER_H -#define ENGINE_IF_SERVER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Section: Server Interface -*/ - -/* server */ -/* - Function: server_getclientinfo - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int server_getclientinfo(int client_id, CLIENT_INFO *info); - -/* - Function: server_clientname - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -const char *server_clientname(int client_id); - -/* grabs the latest input for the client. not withholding anything */ - -/* - Function: server_latestinput - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int *server_latestinput(int client_id, int *size); - -/* - Function: server_setclientname - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void server_setclientname(int client_id, const char *name); - -/* - Function: server_setclientscore - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void server_setclientscore(int client_id, int score); - -/* - Function: server_setbrowseinfo - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void server_setbrowseinfo(const char *game_type, int progression); - -/* - Function: server_kick - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -void server_kick(int client_id, const char *reason); - -/* - Function: server_tick - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int server_tick(); - -/* - Function: server_tickspeed - TODO - - Arguments: - arg1 - desc - - Returns: - - See Also: - -*/ -int server_tickspeed(); - -int server_ban_add(NETADDR addr, int seconds); -int server_ban_remove(NETADDR addr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_snd.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_if_snd.h deleted file mode 100644 index e21490500..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_if_snd.h +++ /dev/null @@ -1,99 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_IF_SND_H -#define ENGINE_IF_SND_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Section: Sound -*/ - -/* - Function: snd_set_channel - Sets the parameters for a sound channel. - - Arguments: - cid - Channel ID - vol - Volume for the channel. 0.0 to 1.0. - pan - Panning for the channel. -1.0 is all left. 0.0 is equal distribution. 1.0 is all right. -*/ -void snd_set_channel(int cid, float vol, float pan); - -/* - Function: snd_load_wv - Loads a wavpack compressed sound. - - Arguments: - filename - Filename of the file to load - - Returns: - The id of the loaded sound. -1 on failure. -*/ -int snd_load_wv(const char *filename); - -/* - Function: snd_play_at - Plays a sound at a specified postition. - - Arguments: - cid - Channel id of the channel to use. - sid - Sound id of the sound to play. - flags - TODO - x - TODO - y - TODO - - Returns: - An id to the voice. -1 on failure. - - See Also: - -*/ -int snd_play_at(int cid, int sid, int flags, float x, float y); - -/* - Function: snd_play - Plays a sound. - - Arguments: - Arguments: - cid - Channel id of the channel to use. - sid - Sound id of the sound to play. - flags - TODO - - Returns: - An id to the voice. -1 on failure. - - See Also: - -*/ -int snd_play(int cid, int sid, int flags); - -/* - Function: snd_stop - Stops a currenly playing sound. - - Arguments: - id - The ID of the voice to stop. - - See Also: - -*/ -void snd_stop(int id); - -/* - Function: snd_set_listener_pos - Sets the listener posititon. - - Arguments: - x - TODO - y - TODO -*/ -void snd_set_listener_pos(float x, float y); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.cpp deleted file mode 100644 index e87b395a0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_jobs.h" - -void worker_thread(void *user) -{ - JOBPOOL *pool = (JOBPOOL *)user; - - while(1) - { - JOB *job = 0; - - /* fetch job from queue */ - lock_wait(pool->lock); - if(pool->first_job) - { - job = pool->first_job; - pool->first_job = pool->first_job->next; - if(pool->first_job) - pool->first_job->prev = 0; - else - pool->last_job = 0; - } - lock_release(pool->lock); - - /* do the job if we have one */ - if(job) - { - job->status = JOBSTATUS_RUNNING; - job->result = job->func(job->func_data); - job->status = JOBSTATUS_DONE; - } - else - thread_sleep(10); - } - -} - -int jobs_initpool(JOBPOOL *pool, int num_threads) -{ - int i; - - /* empty the pool */ - mem_zero(pool, sizeof(JOBPOOL)); - pool->lock = lock_create(); - - /* start threads */ - for(i = 0; i < num_threads; i++) - thread_create(worker_thread, pool); - return 0; -} - -int jobs_add(JOBPOOL *pool, JOB *job, JOBFUNC func, void *data) -{ - mem_zero(job, sizeof(JOB)); - job->func = func; - job->func_data = data; - - lock_wait(pool->lock); - - /* add job to queue */ - job->prev = pool->last_job; - if(pool->last_job) - pool->last_job->next = job; - pool->last_job = job; - if(!pool->first_job) - pool->first_job = job; - - lock_release(pool->lock); - return 0; -} - -int jobs_status(JOB *job) -{ - return job->status; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.h deleted file mode 100644 index bcfe2685d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_jobs.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef int (*JOBFUNC)(void *data); - -typedef struct JOB -{ - struct JOBPOOL *pool; - struct JOB *prev; - struct JOB *next; - volatile int status; - volatile int result; - JOBFUNC func; - void *func_data; -} JOB; - -typedef struct JOBPOOL -{ - LOCK lock; - JOB *first_job; - JOB *last_job; -} JOBPOOL; - -enum -{ - JOBSTATUS_PENDING=0, - JOBSTATUS_RUNNING, - JOBSTATUS_DONE - /*JOBSTATUS_ABORTING,*/ - /*JOBSTATUS_ABORTED,*/ -}; - -int jobs_initpool(JOBPOOL *pool, int num_threads); -int jobs_add(JOBPOOL *pool, JOB *job, JOBFUNC func, void *data); -int jobs_status(JOB *job); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_keynames.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_keynames.cpp deleted file mode 100644 index fc91888c5..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_keynames.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/* AUTO GENERATED! DO NOT EDIT MANUALLY! */ - -#include -#include "e_if_inp.h" - -static const char key_strings[512][16] = -{ - - "first", - "&1", - "&2", - "&3", - "&4", - "&5", - "&6", - "&7", - "backspace", - "tab", - "&10", - "&11", - "clear", - "return", - "&14", - "&15", - "&16", - "&17", - "&18", - "pause", - "&20", - "&21", - "&22", - "&23", - "&24", - "&25", - "&26", - "escape", - "&28", - "&29", - "&30", - "&31", - "space", - "exclaim", - "quotedbl", - "hash", - "dollar", - "&37", - "ampersand", - "quote", - "leftparen", - "rightparen", - "asterisk", - "plus", - "comma", - "minus", - "period", - "slash", - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "colon", - "semicolon", - "less", - "equals", - "greater", - "question", - "at", - "&65", - "&66", - "&67", - "&68", - "&69", - "&70", - "&71", - "&72", - "&73", - "&74", - "&75", - "&76", - "&77", - "&78", - "&79", - "&80", - "&81", - "&82", - "&83", - "&84", - "&85", - "&86", - "&87", - "&88", - "&89", - "&90", - "leftbracket", - "backslash", - "rightbracket", - "caret", - "underscore", - "backquote", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "&123", - "&124", - "&125", - "&126", - "delete", - "&128", - "&129", - "&130", - "&131", - "&132", - "&133", - "&134", - "&135", - "&136", - "&137", - "&138", - "&139", - "&140", - "&141", - "&142", - "&143", - "&144", - "&145", - "&146", - "&147", - "&148", - "&149", - "&150", - "&151", - "&152", - "&153", - "&154", - "&155", - "&156", - "&157", - "&158", - "&159", - "world_0", - "world_1", - "world_2", - "world_3", - "world_4", - "world_5", - "world_6", - "world_7", - "world_8", - "world_9", - "world_10", - "world_11", - "world_12", - "world_13", - "world_14", - "world_15", - "world_16", - "world_17", - "world_18", - "world_19", - "world_20", - "world_21", - "world_22", - "world_23", - "world_24", - "world_25", - "world_26", - "world_27", - "world_28", - "world_29", - "world_30", - "world_31", - "world_32", - "world_33", - "world_34", - "world_35", - "world_36", - "world_37", - "world_38", - "world_39", - "world_40", - "world_41", - "world_42", - "world_43", - "world_44", - "world_45", - "world_46", - "world_47", - "world_48", - "world_49", - "world_50", - "world_51", - "world_52", - "world_53", - "world_54", - "world_55", - "world_56", - "world_57", - "world_58", - "world_59", - "world_60", - "world_61", - "world_62", - "world_63", - "world_64", - "world_65", - "world_66", - "world_67", - "world_68", - "world_69", - "world_70", - "world_71", - "world_72", - "world_73", - "world_74", - "world_75", - "world_76", - "world_77", - "world_78", - "world_79", - "world_80", - "world_81", - "world_82", - "world_83", - "world_84", - "world_85", - "world_86", - "world_87", - "world_88", - "world_89", - "world_90", - "world_91", - "world_92", - "world_93", - "world_94", - "world_95", - "kp0", - "kp1", - "kp2", - "kp3", - "kp4", - "kp5", - "kp6", - "kp7", - "kp8", - "kp9", - "kp_period", - "kp_divide", - "kp_multiply", - "kp_minus", - "kp_plus", - "kp_enter", - "kp_equals", - "up", - "down", - "right", - "left", - "insert", - "home", - "end", - "pageup", - "pagedown", - "f1", - "f2", - "f3", - "f4", - "f5", - "f6", - "f7", - "f8", - "f9", - "f10", - "f11", - "f12", - "f13", - "f14", - "f15", - "&297", - "&298", - "&299", - "numlock", - "capslock", - "scrollock", - "rshift", - "lshift", - "rctrl", - "lctrl", - "ralt", - "lalt", - "rmeta", - "lmeta", - "lsuper", - "rsuper", - "mode", - "compose", - "help", - "print", - "sysreq", - "break", - "menu", - "power", - "euro", - "undo", - "mouse1", - "mouse2", - "mouse3", - "mouse4", - "mouse5", - "mouse6", - "mouse7", - "mouse8", - "mousewheelup", - "mousewheeldown", - "&333", - "&334", - "&335", - "&336", - "&337", - "&338", - "&339", - "&340", - "&341", - "&342", - "&343", - "&344", - "&345", - "&346", - "&347", - "&348", - "&349", - "&350", - "&351", - "&352", - "&353", - "&354", - "&355", - "&356", - "&357", - "&358", - "&359", - "&360", - "&361", - "&362", - "&363", - "&364", - "&365", - "&366", - "&367", - "&368", - "&369", - "&370", - "&371", - "&372", - "&373", - "&374", - "&375", - "&376", - "&377", - "&378", - "&379", - "&380", - "&381", - "&382", - "&383", - "&384", - "&385", - "&386", - "&387", - "&388", - "&389", - "&390", - "&391", - "&392", - "&393", - "&394", - "&395", - "&396", - "&397", - "&398", - "&399", - "&400", - "&401", - "&402", - "&403", - "&404", - "&405", - "&406", - "&407", - "&408", - "&409", - "&410", - "&411", - "&412", - "&413", - "&414", - "&415", - "&416", - "&417", - "&418", - "&419", - "&420", - "&421", - "&422", - "&423", - "&424", - "&425", - "&426", - "&427", - "&428", - "&429", - "&430", - "&431", - "&432", - "&433", - "&434", - "&435", - "&436", - "&437", - "&438", - "&439", - "&440", - "&441", - "&442", - "&443", - "&444", - "&445", - "&446", - "&447", - "&448", - "&449", - "&450", - "&451", - "&452", - "&453", - "&454", - "&455", - "&456", - "&457", - "&458", - "&459", - "&460", - "&461", - "&462", - "&463", - "&464", - "&465", - "&466", - "&467", - "&468", - "&469", - "&470", - "&471", - "&472", - "&473", - "&474", - "&475", - "&476", - "&477", - "&478", - "&479", - "&480", - "&481", - "&482", - "&483", - "&484", - "&485", - "&486", - "&487", - "&488", - "&489", - "&490", - "&491", - "&492", - "&493", - "&494", - "&495", - "&496", - "&497", - "&498", - "&499", - "&500", - "&501", - "&502", - "&503", - "&504", - "&505", - "&506", - "&507", - "&508", - "&509", - "&510", - "&511", -}; - -const char *inp_key_name(int k) { if (k >= 0 && k < 512) return key_strings[k]; else return key_strings[0]; } -int inp_key_code(const char *key_name) { int i; if (!strcmp(key_name, "-?-")) return -1; else for (i = 0; i < 512; i++) if (!strcmp(key_strings[i], key_name)) return i; return -1; } - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_keys.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_keys.h deleted file mode 100644 index cb4ca3716..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_keys.h +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef ENGINE_KEYS_H -#define ENGINE_KEYS_H -/* AUTO GENERATED! DO NOT EDIT MANUALLY! */ -enum -{ - KEY_UNKNOWN = 0, - KEY_FIRST = 0, - KEY_BACKSPACE = 8, - KEY_TAB = 9, - KEY_CLEAR = 12, - KEY_RETURN = 13, - KEY_PAUSE = 19, - KEY_ESCAPE = 27, - KEY_SPACE = 32, - KEY_EXCLAIM = 33, - KEY_QUOTEDBL = 34, - KEY_HASH = 35, - KEY_DOLLAR = 36, - KEY_AMPERSAND = 38, - KEY_QUOTE = 39, - KEY_LEFTPAREN = 40, - KEY_RIGHTPAREN = 41, - KEY_ASTERISK = 42, - KEY_PLUS = 43, - KEY_COMMA = 44, - KEY_MINUS = 45, - KEY_PERIOD = 46, - KEY_SLASH = 47, - KEY_0 = 48, - KEY_1 = 49, - KEY_2 = 50, - KEY_3 = 51, - KEY_4 = 52, - KEY_5 = 53, - KEY_6 = 54, - KEY_7 = 55, - KEY_8 = 56, - KEY_9 = 57, - KEY_COLON = 58, - KEY_SEMICOLON = 59, - KEY_LESS = 60, - KEY_EQUALS = 61, - KEY_GREATER = 62, - KEY_QUESTION = 63, - KEY_AT = 64, - KEY_LEFTBRACKET = 91, - KEY_BACKSLASH = 92, - KEY_RIGHTBRACKET = 93, - KEY_CARET = 94, - KEY_UNDERSCORE = 95, - KEY_BACKQUOTE = 96, - KEY_a = 97, - KEY_b = 98, - KEY_c = 99, - KEY_d = 100, - KEY_e = 101, - KEY_f = 102, - KEY_g = 103, - KEY_h = 104, - KEY_i = 105, - KEY_j = 106, - KEY_k = 107, - KEY_l = 108, - KEY_m = 109, - KEY_n = 110, - KEY_o = 111, - KEY_p = 112, - KEY_q = 113, - KEY_r = 114, - KEY_s = 115, - KEY_t = 116, - KEY_u = 117, - KEY_v = 118, - KEY_w = 119, - KEY_x = 120, - KEY_y = 121, - KEY_z = 122, - KEY_DELETE = 127, - KEY_WORLD_0 = 160, - KEY_WORLD_1 = 161, - KEY_WORLD_2 = 162, - KEY_WORLD_3 = 163, - KEY_WORLD_4 = 164, - KEY_WORLD_5 = 165, - KEY_WORLD_6 = 166, - KEY_WORLD_7 = 167, - KEY_WORLD_8 = 168, - KEY_WORLD_9 = 169, - KEY_WORLD_10 = 170, - KEY_WORLD_11 = 171, - KEY_WORLD_12 = 172, - KEY_WORLD_13 = 173, - KEY_WORLD_14 = 174, - KEY_WORLD_15 = 175, - KEY_WORLD_16 = 176, - KEY_WORLD_17 = 177, - KEY_WORLD_18 = 178, - KEY_WORLD_19 = 179, - KEY_WORLD_20 = 180, - KEY_WORLD_21 = 181, - KEY_WORLD_22 = 182, - KEY_WORLD_23 = 183, - KEY_WORLD_24 = 184, - KEY_WORLD_25 = 185, - KEY_WORLD_26 = 186, - KEY_WORLD_27 = 187, - KEY_WORLD_28 = 188, - KEY_WORLD_29 = 189, - KEY_WORLD_30 = 190, - KEY_WORLD_31 = 191, - KEY_WORLD_32 = 192, - KEY_WORLD_33 = 193, - KEY_WORLD_34 = 194, - KEY_WORLD_35 = 195, - KEY_WORLD_36 = 196, - KEY_WORLD_37 = 197, - KEY_WORLD_38 = 198, - KEY_WORLD_39 = 199, - KEY_WORLD_40 = 200, - KEY_WORLD_41 = 201, - KEY_WORLD_42 = 202, - KEY_WORLD_43 = 203, - KEY_WORLD_44 = 204, - KEY_WORLD_45 = 205, - KEY_WORLD_46 = 206, - KEY_WORLD_47 = 207, - KEY_WORLD_48 = 208, - KEY_WORLD_49 = 209, - KEY_WORLD_50 = 210, - KEY_WORLD_51 = 211, - KEY_WORLD_52 = 212, - KEY_WORLD_53 = 213, - KEY_WORLD_54 = 214, - KEY_WORLD_55 = 215, - KEY_WORLD_56 = 216, - KEY_WORLD_57 = 217, - KEY_WORLD_58 = 218, - KEY_WORLD_59 = 219, - KEY_WORLD_60 = 220, - KEY_WORLD_61 = 221, - KEY_WORLD_62 = 222, - KEY_WORLD_63 = 223, - KEY_WORLD_64 = 224, - KEY_WORLD_65 = 225, - KEY_WORLD_66 = 226, - KEY_WORLD_67 = 227, - KEY_WORLD_68 = 228, - KEY_WORLD_69 = 229, - KEY_WORLD_70 = 230, - KEY_WORLD_71 = 231, - KEY_WORLD_72 = 232, - KEY_WORLD_73 = 233, - KEY_WORLD_74 = 234, - KEY_WORLD_75 = 235, - KEY_WORLD_76 = 236, - KEY_WORLD_77 = 237, - KEY_WORLD_78 = 238, - KEY_WORLD_79 = 239, - KEY_WORLD_80 = 240, - KEY_WORLD_81 = 241, - KEY_WORLD_82 = 242, - KEY_WORLD_83 = 243, - KEY_WORLD_84 = 244, - KEY_WORLD_85 = 245, - KEY_WORLD_86 = 246, - KEY_WORLD_87 = 247, - KEY_WORLD_88 = 248, - KEY_WORLD_89 = 249, - KEY_WORLD_90 = 250, - KEY_WORLD_91 = 251, - KEY_WORLD_92 = 252, - KEY_WORLD_93 = 253, - KEY_WORLD_94 = 254, - KEY_WORLD_95 = 255, - KEY_KP0 = 256, - KEY_KP1 = 257, - KEY_KP2 = 258, - KEY_KP3 = 259, - KEY_KP4 = 260, - KEY_KP5 = 261, - KEY_KP6 = 262, - KEY_KP7 = 263, - KEY_KP8 = 264, - KEY_KP9 = 265, - KEY_KP_PERIOD = 266, - KEY_KP_DIVIDE = 267, - KEY_KP_MULTIPLY = 268, - KEY_KP_MINUS = 269, - KEY_KP_PLUS = 270, - KEY_KP_ENTER = 271, - KEY_KP_EQUALS = 272, - KEY_UP = 273, - KEY_DOWN = 274, - KEY_RIGHT = 275, - KEY_LEFT = 276, - KEY_INSERT = 277, - KEY_HOME = 278, - KEY_END = 279, - KEY_PAGEUP = 280, - KEY_PAGEDOWN = 281, - KEY_F1 = 282, - KEY_F2 = 283, - KEY_F3 = 284, - KEY_F4 = 285, - KEY_F5 = 286, - KEY_F6 = 287, - KEY_F7 = 288, - KEY_F8 = 289, - KEY_F9 = 290, - KEY_F10 = 291, - KEY_F11 = 292, - KEY_F12 = 293, - KEY_F13 = 294, - KEY_F14 = 295, - KEY_F15 = 296, - KEY_NUMLOCK = 300, - KEY_CAPSLOCK = 301, - KEY_SCROLLOCK = 302, - KEY_RSHIFT = 303, - KEY_LSHIFT = 304, - KEY_RCTRL = 305, - KEY_LCTRL = 306, - KEY_RALT = 307, - KEY_LALT = 308, - KEY_RMETA = 309, - KEY_LMETA = 310, - KEY_LSUPER = 311, - KEY_RSUPER = 312, - KEY_MODE = 313, - KEY_COMPOSE = 314, - KEY_HELP = 315, - KEY_PRINT = 316, - KEY_SYSREQ = 317, - KEY_BREAK = 318, - KEY_MENU = 319, - KEY_POWER = 320, - KEY_EURO = 321, - KEY_UNDO = 322, - KEY_MOUSE_1 = 323, - KEY_MOUSE_2 = 324, - KEY_MOUSE_3 = 325, - KEY_MOUSE_4 = 326, - KEY_MOUSE_5 = 327, - KEY_MOUSE_6 = 328, - KEY_MOUSE_7 = 329, - KEY_MOUSE_8 = 330, - KEY_MOUSE_WHEEL_UP = 331, - KEY_MOUSE_WHEEL_DOWN = 332, - KEY_LAST, -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.cpp deleted file mode 100644 index 57ba9a856..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "e_linereader.h" - -void linereader_init(LINEREADER *lr, IOHANDLE io) -{ - lr->buffer_max_size = 4*1024; - lr->buffer_size = 0; - lr->buffer_pos = 0; - lr->io = io; -} - -char *linereader_get(LINEREADER *lr) -{ - unsigned line_start = lr->buffer_pos; - - while(1) - { - if(lr->buffer_pos >= lr->buffer_size) - { - /* fetch more */ - - /* move the remaining part to the front */ - unsigned read; - unsigned left = lr->buffer_size - line_start; - - if(line_start > lr->buffer_size) - left = 0; - if(left) - mem_move(lr->buffer, &lr->buffer[line_start], left); - lr->buffer_pos = left; - - /* fill the buffer */ - read = io_read(lr->io, &lr->buffer[lr->buffer_pos], lr->buffer_max_size-lr->buffer_pos); - lr->buffer_size = left + read; - line_start = 0; - - if(!read) - { - if(left) - { - lr->buffer[left] = 0; /* return the last line */ - lr->buffer_pos = left; - lr->buffer_size = left; - return lr->buffer; - } - else - return 0x0; /* we are done! */ - } - } - else - { - if(lr->buffer[lr->buffer_pos] == '\n' || lr->buffer[lr->buffer_pos] == '\r') - { - /* line found */ - lr->buffer[lr->buffer_pos] = 0; - lr->buffer_pos++; - return &lr->buffer[line_start]; - } - else - lr->buffer_pos++; - } - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.h deleted file mode 100644 index 434a5f888..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_linereader.h +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* buffered stream for reading lines, should perhaps be something smaller */ -typedef struct -{ - char buffer[4*1024]; - unsigned buffer_pos; - unsigned buffer_size; - unsigned buffer_max_size; - IOHANDLE io; -} LINEREADER; - -void linereader_init(LINEREADER *lr, IOHANDLE io); -char *linereader_get(LINEREADER *lr); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_map.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_map.cpp deleted file mode 100644 index 445a95a37..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_map.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_datafile.h" -#include "e_if_other.h" - -static DATAFILE *map = 0; - -void *map_get_data(int index) -{ - return datafile_get_data(map, index); -} - -void *map_get_data_swapped(int index) -{ - return datafile_get_data_swapped(map, index); -} - -void map_unload_data(int index) -{ - datafile_unload_data(map, index); -} - -void *map_get_item(int index, int *type, int *id) -{ - return datafile_get_item(map, index, type, id); -} - -void map_get_type(int type, int *start, int *num) -{ - datafile_get_type(map, type, start, num); -} - -void *map_find_item(int type, int id) -{ - return datafile_find_item(map, type, id); -} - -int map_num_items() -{ - return datafile_num_items(map); -} - -void map_unload() -{ - datafile_unload(map); - map = 0x0; -} - -int map_is_loaded() -{ - return map != 0; -} - -int map_load(const char *mapname) -{ - char buf[512]; - str_format(buf, sizeof(buf), "maps/%s.map", mapname); - map = datafile_load(buf); - return map != 0; -} - -void map_set(void *m) -{ - if(map) - map_unload(); - map = (DATAFILE*)m; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.cpp deleted file mode 100644 index 652b9d7d5..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_memheap.h" - -typedef struct CHUNK_t -{ - char *memory; - char *current; - char *end; - struct CHUNK_t *next; -} CHUNK; - -typedef struct HEAP_t -{ - CHUNK *current; -} HEAP; - -/* how large each chunk should be */ -static const int chunksize = 1024*64; - -/* allocates a new chunk to be used */ -static CHUNK *memheap_newchunk() -{ - CHUNK *chunk; - char *mem; - - /* allocate memory */ - mem = (char*)mem_alloc(sizeof(CHUNK)+chunksize, 1); - if(!mem) - return 0x0; - - /* the chunk structure is located in the begining of the chunk */ - /* init it and return the chunk */ - chunk = (CHUNK*)mem; - chunk->memory = (char*)(chunk+1); - chunk->current = chunk->memory; - chunk->end = chunk->memory + chunksize; - chunk->next = (CHUNK *)0x0; - return chunk; -} - -/******************/ -static void *memheap_allocate_from_chunk(CHUNK *chunk, unsigned int size) -{ - char *mem; - - /* check if we need can fit the allocation */ - if(chunk->current + size > chunk->end) - return (void*)0x0; - - /* get memory and move the pointer forward */ - mem = chunk->current; - chunk->current += size; - return mem; -} - -/* creates a heap */ -HEAP *memheap_create() -{ - CHUNK *chunk; - HEAP *heap; - - /* allocate a chunk and allocate the heap structure on that chunk */ - chunk = memheap_newchunk(); - heap = (HEAP *)memheap_allocate_from_chunk(chunk, sizeof(HEAP)); - heap->current = chunk; - return heap; -} - -/* destroys the heap */ -void memheap_destroy(HEAP *heap) -{ - CHUNK *chunk = heap->current; - CHUNK *next; - - while(chunk) - { - next = chunk->next; - mem_free(chunk); - chunk = next; - } -} - -/* */ -void *memheap_allocate(HEAP *heap, unsigned int size) -{ - char *mem; - - /* try to allocate from current chunk */ - mem = (char *)memheap_allocate_from_chunk(heap->current, size); - if(!mem) - { - /* allocate new chunk and add it to the heap */ - CHUNK *chunk = memheap_newchunk(); - chunk->next = heap->current; - heap->current = chunk; - - /* try to allocate again */ - mem = (char *)memheap_allocate_from_chunk(heap->current, size); - } - - return mem; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.h deleted file mode 100644 index bba0c66e8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_memheap.h +++ /dev/null @@ -1,14 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct HEAP_t HEAP; -HEAP *memheap_create(); -void memheap_destroy(HEAP *heap); -void *memheap_allocate(HEAP *heap, unsigned int size); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_msg.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_msg.cpp deleted file mode 100644 index f9efc2bfe..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_msg.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "e_common_interface.h" -#include "e_packer.h" - -/* message packing */ -static PACKER msg_packer; -static MSG_INFO pack_info; -static int packer_failed = 0; - -void msg_pack_int(int i) { packer_add_int(&msg_packer, i); } -void msg_pack_string(const char *p, int limit) { packer_add_string(&msg_packer, p, limit); } -void msg_pack_raw(const void *data, int size) { packer_add_raw(&msg_packer, (const unsigned char *)data, size); } - -void msg_pack_start_system(int msg, int flags) -{ - packer_reset(&msg_packer); - pack_info.msg = (msg<<1)|1; - pack_info.flags = flags; - packer_failed = 0; - - msg_pack_int(pack_info.msg); -} - -void msg_pack_start(int msg, int flags) -{ - packer_reset(&msg_packer); - pack_info.msg = msg<<1; - pack_info.flags = flags; - packer_failed = 0; - - msg_pack_int(pack_info.msg); -} - -void msg_pack_end() -{ - if(msg_packer.error) - { - packer_failed = 1; - pack_info.size = 0; - pack_info.data = (unsigned char *)""; - } - else - { - pack_info.size = packer_size(&msg_packer); - pack_info.data = packer_data(&msg_packer); - } -} - -const MSG_INFO *msg_get_info() -{ - if(packer_failed) - return 0; - return &pack_info; -} - -/* message unpacking */ -static UNPACKER msg_unpacker; -int msg_unpack_start(const void *data, int data_size, int *system) -{ - int msg; - unpacker_reset(&msg_unpacker, (const unsigned char *)data, data_size); - msg = msg_unpack_int(); - *system = msg&1; - return msg>>1; -} - -int msg_unpack_int() { return unpacker_get_int(&msg_unpacker); } -const char *msg_unpack_string() { return unpacker_get_string(&msg_unpacker); } -const unsigned char *msg_unpack_raw(int size) { return unpacker_get_raw(&msg_unpacker, size); } -int msg_unpack_error() { return msg_unpacker.error; } diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_network.cpp deleted file mode 100644 index c7aabc99a..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include - -#include /* strlen */ - -#include "e_config.h" -#include "e_engine.h" -#include "e_network.h" -#include "e_network_internal.h" -#include "e_huffman.h" - -void recvinfo_clear(NETRECVINFO *info) -{ - info->valid = 0; -} - -void recvinfo_start(NETRECVINFO *info, NETADDR *addr, NETCONNECTION *conn, int cid) -{ - info->addr = *addr; - info->conn = conn; - info->client_id = cid; - info->current_chunk = 0; - info->valid = 1; -} - - -int seq_in_backroom(int seq, int ack) -{ - int bottom = (ack-NET_MAX_SEQUENCE/2); - if(bottom < 0) - { - if(seq <= ack) - return 1; - if(seq >= (bottom + NET_MAX_SEQUENCE)) - return 1; - } - else - { - if(seq <= ack && seq >= bottom) - return 1; - } - - return 0; -} - -/* TODO: rename this function */ -int recvinfo_fetch_chunk(NETRECVINFO *info, NETCHUNK *chunk) -{ - NETCHUNKHEADER header; - unsigned char *end = info->data.chunk_data + info->data.data_size; - int i; - - while(1) - { - unsigned char *data = info->data.chunk_data; - - /* check for old data to unpack */ - if(!info->valid || info->current_chunk >= info->data.num_chunks) - { - recvinfo_clear(info); - return 0; - } - - /* TODO: add checking here so we don't read too far */ - for(i = 0; i < info->current_chunk; i++) - { - data = unpack_chunk_header(data, &header); - data += header.size; - } - - /* unpack the header */ - data = unpack_chunk_header(data, &header); - info->current_chunk++; - - if(data+header.size > end) - { - recvinfo_clear(info); - return 0; - } - - /* handle sequence stuff */ - if(info->conn && (header.flags&NET_CHUNKFLAG_VITAL)) - { - if(header.sequence == (info->conn->ack+1)%NET_MAX_SEQUENCE) - { - /* in sequence */ - info->conn->ack = (info->conn->ack+1)%NET_MAX_SEQUENCE; - } - else - { - /* old packet that we already got */ - if(seq_in_backroom(header.sequence, info->conn->ack)) - continue; - - /* out of sequence, request resend */ - if(config.debug) - dbg_msg("conn", "asking for resend %d %d", header.sequence, (info->conn->ack+1)%NET_MAX_SEQUENCE); - conn_want_resend(info->conn); - continue; /* take the next chunk in the packet */ - } - } - - /* fill in the info */ - chunk->client_id = info->client_id; - chunk->address = info->addr; - chunk->flags = 0; - chunk->data_size = header.size; - chunk->data = data; - return 1; - } -} - - -static IOHANDLE datalog_sent = 0; -static IOHANDLE datalog_recv = 0; -static HUFFMAN_STATE huffmanstate; - -#define COMPRESSION 1 - -/* packs the data tight and sends it */ -void send_packet_connless(NETSOCKET socket, NETADDR *addr, const void *data, int data_size) -{ - unsigned char buffer[NET_MAX_PACKETSIZE]; - buffer[0] = 0xff; - buffer[1] = 0xff; - buffer[2] = 0xff; - buffer[3] = 0xff; - buffer[4] = 0xff; - buffer[5] = 0xff; - mem_copy(&buffer[6], data, data_size); - net_udp_send(socket, addr, buffer, 6+data_size); -} - -int netcommon_compress(const void *data, int data_size, void *output, int output_size) -{ - return huffman_compress(&huffmanstate, data, data_size, output, output_size); -} - -int netcommon_decompress(const void *data, int data_size, void *output, int output_size) -{ - return huffman_decompress(&huffmanstate, data, data_size, output, output_size); -} - -void send_packet(NETSOCKET socket, NETADDR *addr, NETPACKETCONSTRUCT *packet) -{ - unsigned char buffer[NET_MAX_PACKETSIZE]; - int compressed_size = -1; - int final_size = -1; - - /* log the data */ - if(datalog_sent) - { - int type = 1; - io_write(datalog_sent, &type, sizeof(type)); - io_write(datalog_sent, &packet->data_size, sizeof(packet->data_size)); - io_write(datalog_sent, &packet->chunk_data, packet->data_size); - io_flush(datalog_sent); - } - - /* compress if its enabled */ - if(COMPRESSION) - compressed_size = huffman_compress(&huffmanstate, packet->chunk_data, packet->data_size, &buffer[3], NET_MAX_PACKETSIZE-4); - - /* check if the compression was enabled, successful and good enough */ - if(compressed_size > 0 && compressed_size < packet->data_size) - { - final_size = compressed_size; - packet->flags |= NET_PACKETFLAG_COMPRESSION; - } - else - { - /* use uncompressed data */ - final_size = packet->data_size; - mem_copy(&buffer[3], packet->chunk_data, packet->data_size); - packet->flags &= ~NET_PACKETFLAG_COMPRESSION; - } - - /* set header and send the packet if all things are good */ - if(final_size >= 0) - { - final_size += NET_PACKETHEADERSIZE; - buffer[0] = ((packet->flags<<4)&0xf0)|((packet->ack>>8)&0xf); - buffer[1] = packet->ack&0xff; - buffer[2] = packet->num_chunks; - net_udp_send(socket, addr, buffer, final_size); - - /* log raw socket data */ - if(datalog_sent) - { - int type = 0; - io_write(datalog_sent, &type, sizeof(type)); - io_write(datalog_sent, &final_size, sizeof(final_size)); - io_write(datalog_sent, buffer, final_size); - io_flush(datalog_sent); - } - } -} - -/* TODO: rename this function */ -int unpack_packet(unsigned char *buffer, int size, NETPACKETCONSTRUCT *packet) -{ - /* check the size */ - if(size < NET_PACKETHEADERSIZE || size > NET_MAX_PACKETSIZE) - { - dbg_msg("", "packet too small, %d", size); - return -1; - } - - /* log the data */ - if(datalog_recv) - { - int type = 0; - io_write(datalog_recv, &type, sizeof(type)); - io_write(datalog_recv, &size, sizeof(size)); - io_write(datalog_recv, buffer, size); - io_flush(datalog_recv); - } - - /* read the packet */ - packet->flags = buffer[0]>>4; - packet->ack = ((buffer[0]&0xf)<<8) | buffer[1]; - packet->num_chunks = buffer[2]; - packet->data_size = size - NET_PACKETHEADERSIZE; - - if(packet->flags&NET_PACKETFLAG_CONNLESS) - { - packet->flags = NET_PACKETFLAG_CONNLESS; - packet->ack = 0; - packet->num_chunks = 0; - packet->data_size = size - 6; - mem_copy(packet->chunk_data, &buffer[6], packet->data_size); - } - else - { - if(packet->flags&NET_PACKETFLAG_COMPRESSION) - packet->data_size = huffman_decompress(&huffmanstate, &buffer[3], packet->data_size, packet->chunk_data, sizeof(packet->chunk_data)); - else - mem_copy(packet->chunk_data, &buffer[3], packet->data_size); - } - - /* check for errors */ - if(packet->data_size < 0) - { - if(config.debug) - dbg_msg("network", "error during packet decoding"); - return -1; - } - - /* log the data */ - if(datalog_recv) - { - int type = 1; - io_write(datalog_recv, &type, sizeof(type)); - io_write(datalog_recv, &packet->data_size, sizeof(packet->data_size)); - io_write(datalog_recv, packet->chunk_data, packet->data_size); - io_flush(datalog_recv); - } - - /* return success */ - return 0; -} - - -/* TODO: change the arguments of this function */ -unsigned char *pack_chunk_header(unsigned char *data, int flags, int size, int sequence) -{ - data[0] = ((flags&3)<<6)|((size>>4)&0x3f); - data[1] = (size&0xf); - if(flags&NET_CHUNKFLAG_VITAL) - { - data[1] |= (sequence>>2)&0xf0; - data[2] = sequence&0xff; - return data + 3; - } - return data + 2; -} - -unsigned char *unpack_chunk_header(unsigned char *data, NETCHUNKHEADER *header) -{ - header->flags = (data[0]>>6)&3; - header->size = ((data[0]&0x3f)<<4) | (data[1]&0xf); - header->sequence = -1; - if(header->flags&NET_CHUNKFLAG_VITAL) - { - header->sequence = ((data[1]&0xf0)<<2) | data[2]; - return data + 3; - } - return data + 2; -} - - -void send_controlmsg(NETSOCKET socket, NETADDR *addr, int ack, int controlmsg, const void *extra, int extra_size) -{ - NETPACKETCONSTRUCT construct; - construct.flags = NET_PACKETFLAG_CONTROL; - construct.ack = ack; - construct.num_chunks = 0; - construct.data_size = 1+extra_size; - construct.chunk_data[0] = controlmsg; - mem_copy(&construct.chunk_data[1], extra, extra_size); - - /* send the control message */ - send_packet(socket, addr, &construct); -} - -void netcommon_openlog(const char *sentlog, const char *recvlog) -{ - if(sentlog) - { - datalog_sent = engine_openfile(sentlog, IOFLAG_WRITE); - if(datalog_sent) - dbg_msg("network", "logging sent packages to '%s'", sentlog); - else - dbg_msg("network", "failed to open for logging '%s'", sentlog); - } - - if(recvlog) - { - datalog_recv = engine_openfile(recvlog, IOFLAG_WRITE); - if(recvlog) - dbg_msg("network", "logging recv packages to '%s'", recvlog); - else - dbg_msg("network", "failed to open for logging '%s'", recvlog); - } -} - -static const unsigned freq_table[256+1] = { - 1<<30,4545,2657,431,1950,919,444,482,2244,617,838,542,715,1814,304,240,754,212,647,186, - 283,131,146,166,543,164,167,136,179,859,363,113,157,154,204,108,137,180,202,176, - 872,404,168,134,151,111,113,109,120,126,129,100,41,20,16,22,18,18,17,19, - 16,37,13,21,362,166,99,78,95,88,81,70,83,284,91,187,77,68,52,68, - 59,66,61,638,71,157,50,46,69,43,11,24,13,19,10,12,12,20,14,9, - 20,20,10,10,15,15,12,12,7,19,15,14,13,18,35,19,17,14,8,5, - 15,17,9,15,14,18,8,10,2173,134,157,68,188,60,170,60,194,62,175,71, - 148,67,167,78,211,67,156,69,1674,90,174,53,147,89,181,51,174,63,163,80, - 167,94,128,122,223,153,218,77,200,110,190,73,174,69,145,66,277,143,141,60, - 136,53,180,57,142,57,158,61,166,112,152,92,26,22,21,28,20,26,30,21, - 32,27,20,17,23,21,30,22,22,21,27,25,17,27,23,18,39,26,15,21, - 12,18,18,27,20,18,15,19,11,17,33,12,18,15,19,18,16,26,17,18, - 9,10,25,22,22,17,20,16,6,16,15,20,14,18,24,335,1517}; - -void netcommon_init() -{ - huffman_init(&huffmanstate, freq_table); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_network.h deleted file mode 100644 index fa556749b..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef ENGINE_NETWORK_H -#define ENGINE_NETWORK_H -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct -{ - /* -1 means that it's a stateless packet */ - /* 0 on the client means the server */ - int client_id; - NETADDR address; /* only used when client_id == -1 */ - int flags; - int data_size; - const void *data; -} NETCHUNK; - - -typedef struct -{ - NETADDR addr; - int expires; -} NETBANINFO; - -/*typedef struct -{ - int send_bytes; - int recv_bytes; - int send_packets; - int recv_packets; - - int resend_packets; - int resend_bytes; -} NETSTATS;*/ - -typedef struct NETSERVER NETSERVER; -typedef struct NETCLIENT NETCLIENT; - -enum -{ - NETFLAG_ALLOWSTATELESS=1, - NETSENDFLAG_VITAL=1, - NETSENDFLAG_CONNLESS=2, - NETSENDFLAG_FLUSH=4, - - NETSTATE_OFFLINE=0, - NETSTATE_CONNECTING, - NETSTATE_ONLINE, - - NETBANTYPE_SOFT=1, - NETBANTYPE_DROP=2 -}; - -typedef int (*NETFUNC_DELCLIENT)(int cid, void *user); -typedef int (*NETFUNC_NEWCLIENT)(int cid, void *user); - -/* both */ -void netcommon_openlog(const char *sentlog, const char *recvlog); -void netcommon_init(); -int netcommon_compress(const void *data, int data_size, void *output, int output_size); -int netcommon_decompress(const void *data, int data_size, void *output, int output_size); - -/* server side */ -NETSERVER *netserver_open(NETADDR bindaddr, int max_clients, int flags); -int netserver_set_callbacks(NETSERVER *s, NETFUNC_NEWCLIENT new_client, NETFUNC_DELCLIENT del_client, void *user); -int netserver_recv(NETSERVER *s, NETCHUNK *chunk); -int netserver_send(NETSERVER *s, NETCHUNK *chunk); -int netserver_close(NETSERVER *s); -int netserver_update(NETSERVER *s); -NETSOCKET netserver_socket(NETSERVER *s); -int netserver_drop(NETSERVER *s, int client_id, const char *reason); -int netserver_client_addr(NETSERVER *s, int client_id, NETADDR *addr); -int netserver_max_clients(NETSERVER *s); - -int netserver_ban_add(NETSERVER *s, NETADDR addr, int seconds); -int netserver_ban_remove(NETSERVER *s, NETADDR addr); -int netserver_ban_num(NETSERVER *s); /* caution, slow */ -int netserver_ban_get(NETSERVER *s, int index, NETBANINFO *info); /* caution, slow */ - -/*void netserver_stats(NETSERVER *s, NETSTATS *stats);*/ - -/* client side */ -NETCLIENT *netclient_open(NETADDR bindaddr, int flags); -int netclient_disconnect(NETCLIENT *c, const char *reason); -int netclient_connect(NETCLIENT *c, NETADDR *addr); -int netclient_recv(NETCLIENT *c, NETCHUNK *chunk); -int netclient_send(NETCLIENT *c, NETCHUNK *chunk); -int netclient_close(NETCLIENT *c); -int netclient_update(NETCLIENT *c); -int netclient_state(NETCLIENT *c); -int netclient_flush(NETCLIENT *c); -int netclient_gotproblems(NETCLIENT *c); -/*void netclient_stats(NETCLIENT *c, NETSTATS *stats);*/ -int netclient_error_string_reset(NETCLIENT *c); -const char *netclient_error_string(NETCLIENT *c); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -class net_server -{ - NETSERVER *ptr; -public: - net_server() : ptr(0) {} - ~net_server() { close(); } - - int open(NETADDR bindaddr, int max, int flags) { ptr = netserver_open(bindaddr, max, flags); return ptr != 0; } - int close() { int r = netserver_close(ptr); ptr = 0; return r; } - - int set_callbacks(NETFUNC_NEWCLIENT new_client, NETFUNC_DELCLIENT del_client, void *user) - { return netserver_set_callbacks(ptr, new_client, del_client, user); } - - int recv(NETCHUNK *chunk) { return netserver_recv(ptr, chunk); } - int send(NETCHUNK *chunk) { return netserver_send(ptr, chunk); } - int update() { return netserver_update(ptr); } - - int drop(int client_id, const char *reason) { return netserver_drop(ptr, client_id, reason); } - - int max_clients() { return netserver_max_clients(ptr); } - /*void stats(NETSTATS *stats) { netserver_stats(ptr, stats); }*/ -}; - - -class net_client -{ - NETCLIENT *ptr; -public: - net_client() : ptr(0) {} - ~net_client() { close(); } - - int open(NETADDR bindaddr, int flags) { ptr = netclient_open(bindaddr, flags); return ptr != 0; } - int close() { int r = netclient_close(ptr); ptr = 0; return r; } - - int connect(NETADDR *addr) { return netclient_connect(ptr, addr); } - int disconnect(const char *reason) { return netclient_disconnect(ptr, reason); } - - int recv(NETCHUNK *chunk) { return netclient_recv(ptr, chunk); } - int send(NETCHUNK *chunk) { return netclient_send(ptr, chunk); } - int update() { return netclient_update(ptr); } - - const char *error_string() { return netclient_error_string(ptr); } - - int state() { return netclient_state(ptr); } - /*void stats(NETSTATS *stats) { netclient_stats(ptr, stats); }*/ -}; -#endif - - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_client.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_network_client.cpp deleted file mode 100644 index 75f7c5384..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_client.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include "e_network.h" -#include "e_network_internal.h" - -struct NETCLIENT -{ - NETADDR server_addr; - NETSOCKET socket; - - NETRECVINFO recv; - NETCONNECTION conn; -}; - -NETCLIENT *netclient_open(NETADDR bindaddr, int flags) -{ - NETCLIENT *client = (NETCLIENT *)mem_alloc(sizeof(NETCLIENT), 1); - mem_zero(client, sizeof(NETCLIENT)); - client->socket = net_udp_create(bindaddr); - conn_init(&client->conn, client->socket); - return client; -} - -int netclient_close(NETCLIENT *c) -{ - /* TODO: implement me */ - return 0; -} - - -int netclient_disconnect(NETCLIENT *c, const char *reason) -{ - dbg_msg("netclient", "disconnected. reason=\"%s\"", reason); - conn_disconnect(&c->conn, reason); - return 0; -} - -int netclient_update(NETCLIENT *c) -{ - conn_update(&c->conn); - if(c->conn.state == NET_CONNSTATE_ERROR) - netclient_disconnect(c, conn_error(&c->conn)); - return 0; -} - -int netclient_connect(NETCLIENT *c, NETADDR *addr) -{ - conn_connect(&c->conn, addr); - return 0; -} - -int netclient_error_string_reset(NETCLIENT *c) -{ - mem_zero(c->conn.error_string, sizeof(c->conn.error_string)); - return 0; -} - -int netclient_recv(NETCLIENT *c, NETCHUNK *chunk) -{ - while(1) - { - NETADDR addr; - int bytes; - - /* check for a chunk */ - if(recvinfo_fetch_chunk(&c->recv, chunk)) - return 1; - - /* TODO: empty the recvinfo */ - bytes = net_udp_recv(c->socket, &addr, c->recv.buffer, NET_MAX_PACKETSIZE); - - /* no more packets for now */ - if(bytes <= 0) - break; - - if(unpack_packet(c->recv.buffer, bytes, &c->recv.data) == 0) - { - if(c->recv.data.flags&NET_PACKETFLAG_CONNLESS) - { - chunk->flags = NETSENDFLAG_CONNLESS; - chunk->client_id = -1; - chunk->address = addr; - chunk->data_size = c->recv.data.data_size; - chunk->data = c->recv.data.chunk_data; - return 1; - } - else - { - if(conn_feed(&c->conn, &c->recv.data, &addr)) - recvinfo_start(&c->recv, &addr, &c->conn, 0); - } - } - } - return 0; -} - -int netclient_send(NETCLIENT *c, NETCHUNK *chunk) -{ - if(chunk->data_size >= NET_MAX_PAYLOAD) - { - dbg_msg("netclient", "chunk payload too big. %d. dropping chunk", chunk->data_size); - return -1; - } - - if(chunk->flags&NETSENDFLAG_CONNLESS) - { - /* send connectionless packet */ - send_packet_connless(c->socket, &chunk->address, chunk->data, chunk->data_size); - } - else - { - int f = 0; - dbg_assert(chunk->client_id == 0, "errornous client id"); - - if(chunk->flags&NETSENDFLAG_VITAL) - f = NET_CHUNKFLAG_VITAL; - - conn_queue_chunk(&c->conn, f, chunk->data_size, chunk->data); - - if(chunk->flags&NETSENDFLAG_FLUSH) - conn_flush(&c->conn); - } - return 0; -} - -int netclient_state(NETCLIENT *c) -{ - if(c->conn.state == NET_CONNSTATE_ONLINE) - return NETSTATE_ONLINE; - if(c->conn.state == NET_CONNSTATE_OFFLINE) - return NETSTATE_OFFLINE; - return NETSTATE_CONNECTING; -} - -int netclient_flush(NETCLIENT *c) -{ - return conn_flush(&c->conn); -} - -int netclient_gotproblems(NETCLIENT *c) -{ - if(time_get() - c->conn.last_recv_time > time_freq()) - return 1; - return 0; -} - -void netclient_stats(NETCLIENT *c, NETSTATS *stats) -{ - *stats = c->conn.stats; -} - -const char *netclient_error_string(NETCLIENT *c) -{ - return conn_error(&c->conn); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_conn.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_network_conn.cpp deleted file mode 100644 index ed68864f6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_conn.cpp +++ /dev/null @@ -1,369 +0,0 @@ -#include -#include -#include "e_config.h" -#include "e_network_internal.h" - -static void conn_reset_stats(NETCONNECTION *conn) -{ - mem_zero(&conn->stats, sizeof(conn->stats)); -} - -static void conn_reset(NETCONNECTION *conn) -{ - conn->seq = 0; - conn->ack = 0; - conn->remote_closed = 0; - - conn->state = NET_CONNSTATE_OFFLINE; - conn->last_send_time = 0; - conn->last_recv_time = 0; - conn->last_update_time = 0; - conn->token = -1; - mem_zero(&conn->peeraddr, sizeof(conn->peeraddr)); - - conn->buffer = ringbuf_init(conn->buffer_memory, sizeof(conn->buffer_memory), 0); - - mem_zero(&conn->construct, sizeof(conn->construct)); -} - - -const char *conn_error(NETCONNECTION *conn) -{ - return conn->error_string; -} - -static void conn_set_error(NETCONNECTION *conn, const char *str) -{ - str_copy(conn->error_string, str, sizeof(conn->error_string)); -} - -void conn_init(NETCONNECTION *conn, NETSOCKET socket) -{ - conn_reset(conn); - conn_reset_stats(conn); - conn->socket = socket; - mem_zero(conn->error_string, sizeof(conn->error_string)); -} - - -static void conn_ack(NETCONNECTION *conn, int ack) -{ - - while(1) - { - NETCHUNKDATA *resend = (NETCHUNKDATA *)ringbuf_first(conn->buffer); - if(!resend) - break; - - if(seq_in_backroom(resend->sequence, ack)) - ringbuf_popfirst(conn->buffer); - else - break; - } -} - -void conn_want_resend(NETCONNECTION *conn) -{ - conn->construct.flags |= NET_PACKETFLAG_RESEND; -} - -int conn_flush(NETCONNECTION *conn) -{ - int num_chunks = conn->construct.num_chunks; - if(!num_chunks && !conn->construct.flags) - return 0; - - /* send of the packets */ - conn->construct.ack = conn->ack; - send_packet(conn->socket, &conn->peeraddr, &conn->construct); - - /* update send times */ - conn->last_send_time = time_get(); - - /* clear construct so we can start building a new package */ - mem_zero(&conn->construct, sizeof(conn->construct)); - return num_chunks; -} - -static int conn_queue_chunk_ex(NETCONNECTION *conn, int flags, int data_size, const void *data, int sequence) -{ - unsigned char *chunk_data; - - /* check if we have space for it, if not, flush the connection */ - if(conn->construct.data_size + data_size + NET_MAX_CHUNKHEADERSIZE > sizeof(conn->construct.chunk_data)) - conn_flush(conn); - - /* pack all the data */ - chunk_data = &conn->construct.chunk_data[conn->construct.data_size]; - chunk_data = pack_chunk_header(chunk_data, flags, data_size, sequence); - mem_copy(chunk_data, data, data_size); - chunk_data += data_size; - - /* */ - conn->construct.num_chunks++; - conn->construct.data_size = (int)(chunk_data-conn->construct.chunk_data); - - /* set packet flags aswell */ - - if(flags&NET_CHUNKFLAG_VITAL && !(flags&NET_CHUNKFLAG_RESEND)) - { - /* save packet if we need to resend */ - NETCHUNKDATA *resend = (NETCHUNKDATA *)ringbuf_allocate(conn->buffer, sizeof(NETCHUNKDATA)+data_size); - if(resend) - { - resend->sequence = sequence; - resend->flags = flags; - resend->data_size = data_size; - resend->data = (unsigned char *)(resend+1); - resend->first_send_time = time_get(); - resend->last_send_time = resend->first_send_time; - mem_copy(resend->data, data, data_size); - } - else - { - /* out of buffer */ - conn_disconnect(conn, "too weak connection (out of buffer)"); - return -1; - } - } - - return 0; -} - -int conn_queue_chunk(NETCONNECTION *conn, int flags, int data_size, const void *data) -{ - if(flags&NET_CHUNKFLAG_VITAL) - conn->seq = (conn->seq+1)%NET_MAX_SEQUENCE; - return conn_queue_chunk_ex(conn, flags, data_size, data, conn->seq); -} - - -static void conn_send_control(NETCONNECTION *conn, int controlmsg, const void *extra, int extra_size) -{ - /* send the control message */ - conn->last_send_time = time_get(); - send_controlmsg(conn->socket, &conn->peeraddr, conn->ack, controlmsg, extra, extra_size); -} - -static void conn_resend_chunk(NETCONNECTION *conn, NETCHUNKDATA *resend) -{ - conn_queue_chunk_ex(conn, resend->flags|NET_CHUNKFLAG_RESEND, resend->data_size, resend->data, resend->sequence); - resend->last_send_time = time_get(); -} - -static void conn_resend(NETCONNECTION *conn) -{ - int resend_count = 0; - int first = 0, last = 0; - void *item = ringbuf_first(conn->buffer); - - while(item) - { - NETCHUNKDATA *resend = (NETCHUNKDATA *)item; - - if(resend_count == 0) - first = resend->sequence; - last = resend->sequence; - - conn_resend_chunk(conn, resend); - item = ringbuf_next(conn->buffer, item); - resend_count++; - } - - if(config.debug) - dbg_msg("conn", "resent %d packets (%d to %d)", resend_count, first, last); -} - -int conn_connect(NETCONNECTION *conn, NETADDR *addr) -{ - if(conn->state != NET_CONNSTATE_OFFLINE) - return -1; - - /* init connection */ - conn_reset(conn); - conn->peeraddr = *addr; - mem_zero(conn->error_string, sizeof(conn->error_string)); - conn->state = NET_CONNSTATE_CONNECT; - conn_send_control(conn, NET_CTRLMSG_CONNECT, 0, 0); - return 0; -} - -void conn_disconnect(NETCONNECTION *conn, const char *reason) -{ - if(conn->state == NET_CONNSTATE_OFFLINE) - return; - - if(conn->remote_closed == 0) - { - if(reason) - conn_send_control(conn, NET_CTRLMSG_CLOSE, reason, strlen(reason)+1); - else - conn_send_control(conn, NET_CTRLMSG_CLOSE, 0, 0); - - conn->error_string[0] = 0; - if(reason) - str_copy(conn->error_string, reason, sizeof(conn->error_string)); - } - - conn_reset(conn); -} - -int conn_feed(NETCONNECTION *conn, NETPACKETCONSTRUCT *packet, NETADDR *addr) -{ - int64 now = time_get(); - conn->last_recv_time = now; - - /* check if resend is requested */ - if(packet->flags&NET_PACKETFLAG_RESEND) - conn_resend(conn); - - /* */ - if(packet->flags&NET_PACKETFLAG_CONTROL) - { - int ctrlmsg = packet->chunk_data[0]; - - if(ctrlmsg == NET_CTRLMSG_CLOSE) - { - conn->state = NET_CONNSTATE_ERROR; - conn->remote_closed = 1; - - if(packet->data_size) - { - /* make sure to sanitize the error string form the other party*/ - char str[128]; - if(packet->data_size < 128) - str_copy(str, (char *)packet->chunk_data, packet->data_size); - else - str_copy(str, (char *)packet->chunk_data, 128); - str_sanitize_strong(str); - - /* set the error string */ - conn_set_error(conn, str); - } - else - conn_set_error(conn, "no reason given"); - - if(config.debug) - dbg_msg("conn", "closed reason='%s'", conn_error(conn)); - return 0; - } - else - { - if(conn->state == NET_CONNSTATE_OFFLINE) - { - if(ctrlmsg == NET_CTRLMSG_CONNECT) - { - /* send response and init connection */ - conn_reset(conn); - conn->state = NET_CONNSTATE_PENDING; - conn->peeraddr = *addr; - conn->last_send_time = now; - conn->last_recv_time = now; - conn->last_update_time = now; - conn_send_control(conn, NET_CTRLMSG_CONNECTACCEPT, 0, 0); - if(config.debug) - dbg_msg("connection", "got connection, sending connect+accept"); - } - } - else if(conn->state == NET_CONNSTATE_CONNECT) - { - /* connection made */ - if(ctrlmsg == NET_CTRLMSG_CONNECTACCEPT) - { - conn_send_control(conn, NET_CTRLMSG_ACCEPT, 0, 0); - conn->state = NET_CONNSTATE_ONLINE; - if(config.debug) - dbg_msg("connection", "got connect+accept, sending accept. connection online"); - } - } - else if(conn->state == NET_CONNSTATE_ONLINE) - { - /* connection made */ - /* - if(ctrlmsg == NET_CTRLMSG_CONNECTACCEPT) - { - - }*/ - } - } - } - else - { - if(conn->state == NET_CONNSTATE_PENDING) - { - conn->state = NET_CONNSTATE_ONLINE; - if(config.debug) - dbg_msg("connection", "connecting online"); - } - } - - if(conn->state == NET_CONNSTATE_ONLINE) - { - - conn_ack(conn, packet->ack); - } - - return 1; -} - -int conn_update(NETCONNECTION *conn) -{ - int64 now = time_get(); - - if(conn->state == NET_CONNSTATE_OFFLINE || conn->state == NET_CONNSTATE_ERROR) - return 0; - - /* check for timeout */ - if(conn->state != NET_CONNSTATE_OFFLINE && - conn->state != NET_CONNSTATE_CONNECT && - (now-conn->last_recv_time) > time_freq()*10) - { - conn->state = NET_CONNSTATE_ERROR; - conn_set_error(conn, "timeout"); - } - - /* fix resends */ - if(ringbuf_first(conn->buffer)) - { - NETCHUNKDATA *resend = (NETCHUNKDATA *)ringbuf_first(conn->buffer); - - /* check if we have some really old stuff laying around and abort if not acked */ - if(now-resend->first_send_time > time_freq()*10) - { - conn->state = NET_CONNSTATE_ERROR; - conn_set_error(conn, "too weak connection (not acked for 10 seconds)"); - } - else - { - /* resend packet if we havn't got it acked in 1 second */ - if(now-resend->last_send_time > time_freq()) - conn_resend_chunk(conn, resend); - } - } - - /* send keep alives if nothing has happend for 250ms */ - if(conn->state == NET_CONNSTATE_ONLINE) - { - if(time_get()-conn->last_send_time > time_freq()/2) /* flush connection after 500ms if needed */ - { - int num_flushed_chunks = conn_flush(conn); - if(num_flushed_chunks && config.debug) - dbg_msg("connection", "flushed connection due to timeout. %d chunks.", num_flushed_chunks); - } - - if(time_get()-conn->last_send_time > time_freq()) - conn_send_control(conn, NET_CTRLMSG_KEEPALIVE, 0, 0); - } - else if(conn->state == NET_CONNSTATE_CONNECT) - { - if(time_get()-conn->last_send_time > time_freq()/2) /* send a new connect every 500ms */ - conn_send_control(conn, NET_CTRLMSG_CONNECT, 0, 0); - } - else if(conn->state == NET_CONNSTATE_PENDING) - { - if(time_get()-conn->last_send_time > time_freq()/2) /* send a new connect/accept every 500ms */ - conn_send_control(conn, NET_CTRLMSG_CONNECTACCEPT, 0, 0); - } - - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_internal.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_network_internal.h deleted file mode 100644 index c7d4f016f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_internal.h +++ /dev/null @@ -1,164 +0,0 @@ -#include -#include "e_network.h" -#include "e_ringbuffer.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - -CURRENT: - packet header: 3 bytes - unsigned char flags_ack; // 4bit flags, 4bit ack - unsigned char ack; // 8 bit ack - unsigned char num_chunks; // 8 bit chunks - - (unsigned char padding[3]) // 24 bit extra incase it's a connection less packet - // this is to make sure that it's compatible with the - // old protocol - - chunk header: 2-3 bytes - unsigned char flags_size; // 2bit flags, 6 bit size - unsigned char size_seq; // 4bit size, 4bit seq - (unsigned char seq;) // 8bit seq, if vital flag is set - - -*/ - -enum -{ - NET_VERSION = 2, - - NET_MAX_CHUNKSIZE = 1024, - NET_MAX_PAYLOAD = NET_MAX_CHUNKSIZE+16, - NET_MAX_PACKETSIZE = NET_MAX_PAYLOAD+16, - NET_MAX_CHUNKHEADERSIZE = 5, - NET_PACKETHEADERSIZE = 3, - NET_MAX_CLIENTS = 16, - NET_MAX_SEQUENCE = 1<<10, - NET_SEQUENCE_MASK = NET_MAX_SEQUENCE-1, - - NET_CONNSTATE_OFFLINE=0, - NET_CONNSTATE_CONNECT=1, - NET_CONNSTATE_PENDING=2, - NET_CONNSTATE_ONLINE=3, - NET_CONNSTATE_ERROR=4, - - NET_PACKETFLAG_CONTROL=1, - NET_PACKETFLAG_CONNLESS=2, - NET_PACKETFLAG_RESEND=4, - NET_PACKETFLAG_COMPRESSION=8, - - NET_CHUNKFLAG_VITAL=1, - NET_CHUNKFLAG_RESEND=2, - - NET_CTRLMSG_KEEPALIVE=0, - NET_CTRLMSG_CONNECT=1, - NET_CTRLMSG_CONNECTACCEPT=2, - NET_CTRLMSG_ACCEPT=3, - NET_CTRLMSG_CLOSE=4, - - NET_SERVER_MAXBANS=1024, - - NET_CONN_BUFFERSIZE=1024*16, - - NET_ENUM_TERMINATOR -}; - - -typedef struct NETPACKETCONSTRUCT -{ - int flags; - int ack; - int num_chunks; - int data_size; - unsigned char chunk_data[NET_MAX_PAYLOAD]; -} NETPACKETCONSTRUCT; - -typedef struct NETCHUNKHEADER -{ - int flags; - int size; - int sequence; -} NETCHUNKHEADER; - -typedef struct -{ - int flags; - int data_size; - unsigned char *data; - - int sequence; - int64 last_send_time; - int64 first_send_time; -} NETCHUNKDATA; - -typedef struct -{ - unsigned short seq; - unsigned short ack; - unsigned state; - - int token; - int remote_closed; - - RINGBUFFER *buffer; - - int64 last_update_time; - int64 last_recv_time; - int64 last_send_time; - - char error_string[256]; - - NETPACKETCONSTRUCT construct; - - NETADDR peeraddr; - NETSOCKET socket; - NETSTATS stats; - - char buffer_memory[NET_CONN_BUFFERSIZE]; -} NETCONNECTION; - -typedef struct NETRECVINFO -{ - NETADDR addr; - NETCONNECTION *conn; - int current_chunk; - int client_id; - int valid; - NETPACKETCONSTRUCT data; - unsigned char buffer[NET_MAX_PACKETSIZE]; -} NETRECVINFO; - -/* */ - -/* connection functions */ -void conn_init(NETCONNECTION *conn, NETSOCKET socket); -int conn_connect(NETCONNECTION *conn, NETADDR *addr); -void conn_disconnect(NETCONNECTION *conn, const char *reason); -int conn_update(NETCONNECTION *conn); -int conn_feed(NETCONNECTION *conn, NETPACKETCONSTRUCT *packet, NETADDR *addr); -int conn_queue_chunk(NETCONNECTION *conn, int flags, int data_size, const void *data); -const char *conn_error(NETCONNECTION *conn); -void conn_want_resend(NETCONNECTION *conn); -int conn_flush(NETCONNECTION *conn); - -/* recvinfo functions */ -void recvinfo_clear(NETRECVINFO *info); -void recvinfo_start(NETRECVINFO *info, NETADDR *addr, NETCONNECTION *conn, int cid); -int recvinfo_fetch_chunk(NETRECVINFO *info, NETCHUNK *chunk); - -/* misc helper functions */ -/* The backroom is ack-NET_MAX_SEQUENCE/2. Used for knowing if we acked a packet or not */ -int seq_in_backroom(int seq, int ack); -void send_controlmsg(NETSOCKET socket, NETADDR *addr, int ack, int controlmsg, const void *extra, int extra_size); -void send_packet_connless(NETSOCKET socket, NETADDR *addr, const void *data, int data_size); -void send_packet(NETSOCKET socket, NETADDR *addr, NETPACKETCONSTRUCT *packet); -int unpack_packet(unsigned char *buffer, int size, NETPACKETCONSTRUCT *packet); -unsigned char *pack_chunk_header(unsigned char *data, int flags, int size, int sequence); -unsigned char *unpack_chunk_header(unsigned char *data, NETCHUNKHEADER *header); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_server.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_network_server.cpp deleted file mode 100644 index 2131cb479..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_network_server.cpp +++ /dev/null @@ -1,491 +0,0 @@ -#include -#include -#include "e_network.h" -#include "e_network_internal.h" - -typedef struct -{ - NETCONNECTION conn; -} NETSLOT; - -typedef struct NETBAN -{ - NETBANINFO info; - - /* hash list */ - struct NETBAN *hashnext; - struct NETBAN *hashprev; - - /* used or free list */ - struct NETBAN *next; - struct NETBAN *prev; -} NETBAN; - -#define MACRO_LIST_LINK_FIRST(object, first, prev, next) \ - { if(first) first->prev = object; \ - object->prev = NULL; \ - object->next = first; \ - first = object; } - -#define MACRO_LIST_LINK_AFTER(object, after, prev, next) \ - { object->prev = after; \ - object->next = after->next; \ - after->next = object; \ - if(object->next) \ - object->next->prev = object; \ - } - -#define MACRO_LIST_UNLINK(object, first, prev, next) \ - { if(object->next) object->next->prev = object->prev; \ - if(object->prev) object->prev->next = object->next; \ - else first = object->next; \ - object->next = NULL; object->prev = NULL; } - -#define MACRO_LIST_FIND(start, next, expression) \ - { while(start && !(expression)) start = start->next; } - -struct NETSERVER -{ - NETSOCKET socket; - NETSLOT slots[NET_MAX_CLIENTS]; - int max_clients; - - NETBAN *bans[256]; - NETBAN banpool[NET_SERVER_MAXBANS]; - NETBAN *banpool_firstfree; - NETBAN *banpool_firstused; - - NETFUNC_NEWCLIENT new_client; - NETFUNC_NEWCLIENT del_client; - void *user_ptr; - - NETRECVINFO recv; -}; - -NETSERVER *netserver_open(NETADDR bindaddr, int max_clients, int flags) -{ - int i; - NETSERVER *server; - NETSOCKET socket = net_udp_create(bindaddr); - if(socket == NETSOCKET_INVALID) - return 0; - - server = (NETSERVER *)mem_alloc(sizeof(NETSERVER), 1); - mem_zero(server, sizeof(NETSERVER)); - server->socket = socket; - server->max_clients = max_clients; - if(server->max_clients > NET_MAX_CLIENTS) - server->max_clients = NET_MAX_CLIENTS; - if(server->max_clients < 1) - server->max_clients = 1; - - for(i = 0; i < NET_MAX_CLIENTS; i++) - conn_init(&server->slots[i].conn, server->socket); - - /* setup all pointers for bans */ - for(i = 1; i < NET_SERVER_MAXBANS-1; i++) - { - server->banpool[i].next = &server->banpool[i+1]; - server->banpool[i].prev = &server->banpool[i-1]; - } - - server->banpool[0].next = &server->banpool[1]; - server->banpool[NET_SERVER_MAXBANS-1].prev = &server->banpool[NET_SERVER_MAXBANS-2]; - server->banpool_firstfree = &server->banpool[0]; - - return server; -} - -int netserver_set_callbacks(NETSERVER *s, NETFUNC_NEWCLIENT new_client, NETFUNC_DELCLIENT del_client, void *user) -{ - s->new_client = new_client; - s->del_client = del_client; - s->user_ptr = user; - return 0; -} - -int netserver_max_clients(NETSERVER *s) -{ - return s->max_clients; -} - -int netserver_close(NETSERVER *s) -{ - /* TODO: implement me */ - return 0; -} - -int netserver_drop(NETSERVER *s, int client_id, const char *reason) -{ - /* TODO: insert lots of checks here */ - NETADDR addr; - netserver_client_addr(s, client_id, &addr); - - dbg_msg("net_server", "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"", - client_id, - addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], - reason - ); - conn_disconnect(&s->slots[client_id].conn, reason); - - if(s->del_client) - s->del_client(client_id, s->user_ptr); - - return 0; -} - -int netserver_ban_get(NETSERVER *s, int index, NETBANINFO *info) -{ - NETBAN *ban; - for(ban = s->banpool_firstused; ban && index; ban = ban->next, index--) - {} - - if(!ban) - return 0; - *info = ban->info; - return 1; -} - -int netserver_ban_num(NETSERVER *s) -{ - int count = 0; - NETBAN *ban; - for(ban = s->banpool_firstused; ban; ban = ban->next) - count++; - return count; -} - -static void netserver_ban_remove_by_object(NETSERVER *s, NETBAN *ban) -{ - int iphash = (ban->info.addr.ip[0]+ban->info.addr.ip[1]+ban->info.addr.ip[2]+ban->info.addr.ip[3])&0xff; - dbg_msg("netserver", "removing ban on %d.%d.%d.%d", - ban->info.addr.ip[0], ban->info.addr.ip[1], ban->info.addr.ip[2], ban->info.addr.ip[3]); - MACRO_LIST_UNLINK(ban, s->banpool_firstused, prev, next); - MACRO_LIST_UNLINK(ban, s->bans[iphash], hashprev, hashnext); - MACRO_LIST_LINK_FIRST(ban, s->banpool_firstfree, prev, next); -} - -int netserver_ban_remove(NETSERVER *s, NETADDR addr) -{ - int iphash = (addr.ip[0]+addr.ip[1]+addr.ip[2]+addr.ip[3])&0xff; - NETBAN *ban = s->bans[iphash]; - - MACRO_LIST_FIND(ban, hashnext, net_addr_comp(&ban->info.addr, &addr) == 0); - - if(ban) - { - netserver_ban_remove_by_object(s, ban); - return 0; - } - - return -1; -} - -int netserver_ban_add(NETSERVER *s, NETADDR addr, int seconds) -{ - int iphash = (addr.ip[0]+addr.ip[1]+addr.ip[2]+addr.ip[3])&0xff; - unsigned stamp = 0xffffffff; - NETBAN *ban; - - /* remove the port */ - addr.port = 0; - - if(seconds) - stamp = time_timestamp() + seconds; - - /* search to see if it already exists */ - ban = s->bans[iphash]; - MACRO_LIST_FIND(ban, hashnext, net_addr_comp(&ban->info.addr, &addr) == 0); - if(ban) - { - /* adjust the ban */ - ban->info.expires = stamp; - return 0; - } - - if(!s->banpool_firstfree) - return -1; - - /* fetch and clear the new ban */ - ban = s->banpool_firstfree; - MACRO_LIST_UNLINK(ban, s->banpool_firstfree, prev, next); - - /* setup the ban info */ - ban->info.expires = stamp; - ban->info.addr = addr; - - /* add it to the ban hash */ - MACRO_LIST_LINK_FIRST(ban, s->bans[iphash], hashprev, hashnext); - - /* insert it into the used list */ - { - if(s->banpool_firstused) - { - NETBAN *insert_after = s->banpool_firstused; - MACRO_LIST_FIND(insert_after, next, stamp < insert_after->info.expires); - - if(insert_after) - insert_after = insert_after->prev; - else - { - /* add to last */ - insert_after = s->banpool_firstused; - while(insert_after->next) - insert_after = insert_after->next; - } - - if(insert_after) - { - MACRO_LIST_LINK_AFTER(ban, insert_after, prev, next); - } - else - { - MACRO_LIST_LINK_FIRST(ban, s->banpool_firstused, prev, next); - } - } - else - { - MACRO_LIST_LINK_FIRST(ban, s->banpool_firstused, prev, next); - } - } - - /* drop banned clients */ - { - char buf[128]; - int i; - NETADDR banaddr; - - if(seconds) - str_format(buf, sizeof(buf), "you have been banned for %d minutes", seconds/60); - else - str_format(buf, sizeof(buf), "you have been banned for life"); - - for(i = 0; i < s->max_clients; i++) - { - banaddr = s->slots[i].conn.peeraddr; - banaddr.port = 0; - - if(net_addr_comp(&addr, &banaddr) == 0) - netserver_drop(s, i, buf); - } - } - return 0; -} - -int netserver_update(NETSERVER *s) -{ - unsigned now = time_timestamp(); - - int i; - for(i = 0; i < s->max_clients; i++) - { - conn_update(&s->slots[i].conn); - if(s->slots[i].conn.state == NET_CONNSTATE_ERROR) - netserver_drop(s, i, conn_error(&s->slots[i].conn)); - } - - /* remove expired bans */ - while(s->banpool_firstused && s->banpool_firstused->info.expires < now) - { - NETBAN *ban = s->banpool_firstused; - netserver_ban_remove_by_object(s, ban); - } - - (void)now; - - return 0; -} - -/* - TODO: chopp up this function into smaller working parts -*/ -int netserver_recv(NETSERVER *s, NETCHUNK *chunk) -{ - unsigned now = time_timestamp(); - - while(1) - { - NETADDR addr; - int i, bytes, found; - - /* check for a chunk */ - if(recvinfo_fetch_chunk(&s->recv, chunk)) - return 1; - - /* TODO: empty the recvinfo */ - bytes = net_udp_recv(s->socket, &addr, s->recv.buffer, NET_MAX_PACKETSIZE); - - /* no more packets for now */ - if(bytes <= 0) - break; - - if(unpack_packet(s->recv.buffer, bytes, &s->recv.data) == 0) - { - NETBAN *ban = 0; - NETADDR banaddr = addr; - int iphash = (addr.ip[0]+addr.ip[1]+addr.ip[2]+addr.ip[3])&0xff; - found = 0; - banaddr.port = 0; - - /* search a ban */ - for(ban = s->bans[iphash]; ban; ban = ban->hashnext) - { - if(net_addr_comp(&ban->info.addr, &banaddr) == 0) - break; - } - - /* check if we just should drop the packet */ - if(ban) - { - // banned, reply with a message - char banstr[128]; - if(ban->info.expires) - { - int mins = ((ban->info.expires - now)+59)/60; - if(mins == 1) - str_format(banstr, sizeof(banstr), "banned for %d minute", mins); - else - str_format(banstr, sizeof(banstr), "banned for %d minutes", mins); - } - else - str_format(banstr, sizeof(banstr), "banned for life"); - send_controlmsg(s->socket, &addr, 0, NET_CTRLMSG_CLOSE, banstr, str_length(banstr)+1); - continue; - } - - if(s->recv.data.flags&NET_PACKETFLAG_CONNLESS) - { - chunk->flags = NETSENDFLAG_CONNLESS; - chunk->client_id = -1; - chunk->address = addr; - chunk->data_size = s->recv.data.data_size; - chunk->data = s->recv.data.chunk_data; - return 1; - } - else - { - /* TODO: check size here */ - if(s->recv.data.flags&NET_PACKETFLAG_CONTROL && s->recv.data.chunk_data[0] == NET_CTRLMSG_CONNECT) - { - found = 0; - - /* check if we already got this client */ - for(i = 0; i < s->max_clients; i++) - { - if(s->slots[i].conn.state != NET_CONNSTATE_OFFLINE && - net_addr_comp(&s->slots[i].conn.peeraddr, &addr) == 0) - { - found = 1; /* silent ignore.. we got this client already */ - break; - } - } - - /* client that wants to connect */ - if(!found) - { - for(i = 0; i < s->max_clients; i++) - { - if(s->slots[i].conn.state == NET_CONNSTATE_OFFLINE) - { - found = 1; - conn_feed(&s->slots[i].conn, &s->recv.data, &addr); - if(s->new_client) - s->new_client(i, s->user_ptr); - break; - } - } - - if(!found) - { - const char fullmsg[] = "server is full"; - send_controlmsg(s->socket, &addr, 0, NET_CTRLMSG_CLOSE, fullmsg, sizeof(fullmsg)); - } - } - } - else - { - /* normal packet, find matching slot */ - for(i = 0; i < s->max_clients; i++) - { - if(net_addr_comp(&s->slots[i].conn.peeraddr, &addr) == 0) - { - if(conn_feed(&s->slots[i].conn, &s->recv.data, &addr)) - { - if(s->recv.data.data_size) - recvinfo_start(&s->recv, &addr, &s->slots[i].conn, i); - } - } - } - } - } - } - } - return 0; -} - -int netserver_send(NETSERVER *s, NETCHUNK *chunk) -{ - if(chunk->data_size >= NET_MAX_PAYLOAD) - { - dbg_msg("netserver", "packet payload too big. %d. dropping packet", chunk->data_size); - return -1; - } - - if(chunk->flags&NETSENDFLAG_CONNLESS) - { - /* send connectionless packet */ - send_packet_connless(s->socket, &chunk->address, chunk->data, chunk->data_size); - } - else - { - int f = 0; - dbg_assert(chunk->client_id >= 0, "errornous client id"); - dbg_assert(chunk->client_id < s->max_clients, "errornous client id"); - - if(chunk->flags&NETSENDFLAG_VITAL) - f = NET_CHUNKFLAG_VITAL; - - if(conn_queue_chunk(&s->slots[chunk->client_id].conn, f, chunk->data_size, chunk->data) == 0) - { - if(chunk->flags&NETSENDFLAG_FLUSH) - conn_flush(&s->slots[chunk->client_id].conn); - } - else - { - netserver_drop(s, chunk->client_id, "error sending data"); - } - - } - return 0; -} - -void netserver_stats(NETSERVER *s, NETSTATS *stats) -{ - int num_stats = sizeof(NETSTATS)/sizeof(int); - int *istats = (int *)stats; - int c, i; - - mem_zero(stats, sizeof(NETSTATS)); - - for(c = 0; c < s->max_clients; c++) - { - if(s->slots[c].conn.state != NET_CONNSTATE_OFFLINE) - { - int *sstats = (int *)(&(s->slots[c].conn.stats)); - for(i = 0; i < num_stats; i++) - istats[i] += sstats[i]; - } - } -} - -NETSOCKET netserver_socket(NETSERVER *s) -{ - return s->socket; -} - - -int netserver_client_addr(NETSERVER *s, int client_id, NETADDR *addr) -{ - *addr = s->slots[client_id].conn.peeraddr; - return 1; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.cpp deleted file mode 100644 index aee08aede..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include /* rand() */ -#include - -#include "e_packer.h" -#include "e_compression.h" -#include "e_engine.h" -#include "e_config.h" - -/* useful for debugging */ -#if 0 - #define packing_error(p) p->error = 1; dbg_break() -#else - #define packing_error(p) p->error = 1 -#endif - -static int stress_get_int() -{ - static const int nasty[] = {-1, 0, 1, 66000, -66000, (-1<<31), 0x7fffffff}; - if(rand()&1) - return rand(); - return nasty[rand()%6]; -} - -static const char *stress_get_string(int *size) -{ - static char noise[1024]; - int i; - int s; - s = (rand()%1024)-1; - for(i = 0; i < s; i++) - noise[i] = (rand()%254)+1; - noise[s] = 0; - if(size) - *size = s; - return noise; -} - - -static int stress_prob(float probability) -{ - if(!config.dbg_stress_network) - return 0; - if(rand()/(float)RAND_MAX < probability) - return 1; - return 0; -} - - -void packer_reset(PACKER *p) -{ - p->error = 0; - p->current = p->buffer; - p->end = p->current + PACKER_BUFFER_SIZE; -} - -void packer_add_int(PACKER *p, int i) -{ - if(p->error) - return; - - if(stress_prob(0.025f)) - i = stress_get_int(); - - /* make sure that we have space enough */ - if(p->end - p->current < 6) - { - dbg_break(); - p->error = 1; - } - else - p->current = vint_pack(p->current, i); -} - -void packer_add_string(PACKER *p, const char *str, int limit) -{ - if(p->error) - return; - - if(stress_prob(0.1f)) - { - str = stress_get_string(0); - limit = 0; - } - - /* */ - if(limit > 0) - { - while(*str && limit != 0) - { - *p->current++ = *str++; - limit--; - - if(p->current >= p->end) - { - packing_error(p); - break; - } - } - *p->current++ = 0; - } - else - { - while(*str) - { - *p->current++ = *str++; - - if(p->current >= p->end) - { - packing_error(p); - break; - } - } - *p->current++ = 0; - } -} - -void packer_add_raw(PACKER *p, const unsigned char *data, int size) -{ - if(p->error) - return; - - if(p->current+size >= p->end) - { - packing_error(p); - return; - } - - while(size) - { - *p->current++ = *data++; - size--; - } -} - -int packer_size(PACKER *p) -{ - return (const unsigned char *)p->current-(const unsigned char *)p->buffer; -} - -const unsigned char *packer_data(PACKER *p) -{ - return (const unsigned char *)p->buffer; -} - -void unpacker_reset(UNPACKER *p, const unsigned char *data, int size) -{ - p->error = 0; - p->start = data; - p->end = p->start + size; - p->current = p->start; -} - -int unpacker_get_int(UNPACKER *p) -{ - int i; - if(p->error) - return 0; - if(p->current >= p->end) - { - packing_error(p); - return 0; - } - - p->current = vint_unpack(p->current, &i); - if(p->current > p->end) - { - packing_error(p); - return 0; - } - return i; -} - -const char *unpacker_get_string(UNPACKER *p) -{ - char *ptr; - if(p->error || p->current >= p->end) - return ""; - - ptr = (char *)p->current; - while(*p->current) /* skip the string */ - { - p->current++; - if(p->current == p->end) - { - packing_error(p); - return ""; - } - } - p->current++; - - /* sanitize all strings */ - str_sanitize(ptr); - return ptr; -} - -const unsigned char *unpacker_get_raw(UNPACKER *p, int size) -{ - const unsigned char *ptr = p->current; - if(p->error) - return 0; - - /* check for nasty sizes */ - if(size < 0 || p->current+size > p->end) - { - packing_error(p); - return 0; - } - - /* "unpack" the data */ - p->current += size; - return ptr; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.h deleted file mode 100644 index c70207a78..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_packer.h +++ /dev/null @@ -1,43 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifdef __cplusplus -extern "C" { -#endif - -enum -{ - PACKER_BUFFER_SIZE=1024*2 -}; - -typedef struct -{ - - unsigned char buffer[PACKER_BUFFER_SIZE]; - unsigned char *current; - unsigned char *end; - int error; -} PACKER; - -typedef struct -{ - const unsigned char *current; - const unsigned char *start; - const unsigned char *end; - int error; -} UNPACKER; - -void packer_reset(PACKER *p); -void packer_add_int(PACKER *p, int i); -void packer_add_string(PACKER *p, const char *str, int limit); -void packer_add_raw(PACKER *p, const unsigned char *data, int size); -int packer_size(PACKER *p); -const unsigned char *packer_data(PACKER *p); - -void unpacker_reset(UNPACKER *p, const unsigned char *data, int size); -int unpacker_get_int(UNPACKER *p); -const char *unpacker_get_string(UNPACKER *p); -const unsigned char *unpacker_get_raw(UNPACKER *p, int size); - -#ifdef __cplusplus -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_protocol.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_protocol.h deleted file mode 100644 index a1feb4cce..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_protocol.h +++ /dev/null @@ -1,73 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include - -/* - Connection diagram - How the initilization works. - - Client -> INFO -> Server - Contains version info, name, and some other info. - - Client <- MAP <- Server - Contains current map. - - Client -> READY -> Server - The client has loaded the map and is ready to go, - but the mod needs to send it's information aswell. - modc_connected is called on the client and - mods_connected is called on the server. - The client should call client_entergame when the - mod has done it's initilization. - - Client -> ENTERGAME -> Server - Tells the server to start sending snapshots. - client_entergame and server_client_enter is called. -*/ - - -enum -{ - NETMSG_NULL=0, - - /* the first thing sent by the client - contains the version info for the client */ - NETMSG_INFO=1, - - /* sent by server */ - NETMSG_MAP_CHANGE, /* sent when client should switch map */ - NETMSG_MAP_DATA, /* map transfer, contains a chunk of the map file */ - NETMSG_SNAP, /* normal snapshot, multiple parts */ - NETMSG_SNAPEMPTY, /* empty snapshot */ - NETMSG_SNAPSINGLE, /* ? */ - NETMSG_SNAPSMALL, /* */ - NETMSG_INPUTTIMING, /* reports how off the input was */ - NETMSG_RCON_AUTH_STATUS,/* result of the authentication */ - NETMSG_RCON_LINE, /* line that should be printed to the remote console */ - - NETMSG_AUTH_CHALLANGE, /* */ - NETMSG_AUTH_RESULT, /* */ - - /* sent by client */ - NETMSG_READY, /* */ - NETMSG_ENTERGAME, - NETMSG_INPUT, /* contains the inputdata from the client */ - NETMSG_RCON_CMD, /* */ - NETMSG_RCON_AUTH, /* */ - NETMSG_REQUEST_MAP_DATA,/* */ - - NETMSG_AUTH_START, /* */ - NETMSG_AUTH_RESPONSE, /* */ - - /* sent by both */ - NETMSG_PING, - NETMSG_PING_REPLY, - NETMSG_ERROR -}; - - -/* this should be revised */ -enum -{ - MAX_CLANNAME_LENGTH=32, - MAX_INPUT_SIZE=128, - MAX_SNAPSHOT_PACKSIZE=900 -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.cpp deleted file mode 100644 index 39dfa3e9c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.cpp +++ /dev/null @@ -1,362 +0,0 @@ -#include - -#include "e_ringbuffer.h" - -typedef struct RBITEM -{ - struct RBITEM *prev; - struct RBITEM *next; - int free; - int size; -} RBITEM; - -/* - -*/ -struct RINGBUFFER -{ - RBITEM *produce; - RBITEM *consume; - - RBITEM *first; - RBITEM *last; - void *memory; - int size; - int flags; -}; - -RINGBUFFER *ringbuf_init(void *memory, int size, int flags) -{ - RINGBUFFER *rb = (RINGBUFFER *)memory; - mem_zero(memory, size); - - rb->memory = rb+1; - rb->size = (size-sizeof(RINGBUFFER))/sizeof(RBITEM)*sizeof(RBITEM); - rb->first = (RBITEM *)rb->memory; - rb->first->free = 1; - rb->first->size = rb->size; - rb->last = rb->first; - rb->produce = rb->first; - rb->consume = rb->first; - - rb->flags = flags; - - return rb; -} - -static RBITEM *ringbuf_nextblock(RINGBUFFER *rb, RBITEM *item) -{ - if(item->next) - return item->next; - return rb->first; -} - -static RBITEM *ringbuf_prevblock(RINGBUFFER *rb, RBITEM *item) -{ - if(item->prev) - return item->prev; - return rb->last; -} - -static RBITEM *ringbuf_mergeback(RINGBUFFER *rb, RBITEM *item) -{ - /* make sure that this block and previous block is free */ - if(!item->free || !item->prev || !item->prev->free) - return item; - - /* merge the blocks */ - item->prev->size += item->size; - item->prev->next = item->next; - - /* fixup pointers */ - if(item->next) - item->next->prev = item->prev; - else - rb->last = item->prev; - - if(item == rb->produce) - rb->produce = item->prev; - - if(item == rb->consume) - rb->consume = item->prev; - - /* return the current block */ - return item->prev; -} - -int ringbuf_popfirst(RINGBUFFER *rb) -{ - if(rb->consume->free) - return 0; - - /* set the free flag */ - rb->consume->free = 1; - - /* previous block is also free, merge them */ - rb->consume = ringbuf_mergeback(rb, rb->consume); - - /* advance the consume pointer */ - rb->consume = ringbuf_nextblock(rb, rb->consume); - while(rb->consume->free && rb->consume != rb->produce) - { - rb->consume = ringbuf_mergeback(rb, rb->consume); - rb->consume = ringbuf_nextblock(rb, rb->consume); - } - - /* in the case that we have catched up with the produce pointer */ - /* we might stand on a free block so merge em */ - ringbuf_mergeback(rb, rb->consume); - return 1; -} - -void *ringbuf_allocate(RINGBUFFER *rb, int size) -{ - int wanted_size = (size+sizeof(RBITEM)+sizeof(RBITEM)-1)/sizeof(RBITEM)*sizeof(RBITEM); - RBITEM *block = 0; - - /* check if we even can fit this block */ - if(wanted_size > rb->size) - return 0; - - while(1) - { - /* check for space */ - if(rb->produce->free) - { - if(rb->produce->size >= wanted_size) - block = rb->produce; - else - { - /* wrap around to try to find a block */ - if(rb->first->free && rb->first->size >= wanted_size) - block = rb->first; - } - } - - if(block) - break; - else - { - /* we have no block, check our policy and see what todo */ - if(rb->flags&RINGBUF_FLAG_RECYCLE) - { - if(!ringbuf_popfirst(rb)) - return 0; - } - else - return 0; - } - } - - /* okey, we have our block */ - - /* split the block if needed */ - if(block->size > wanted_size) - { - RBITEM *new_item = (RBITEM *)((char *)block + wanted_size); - new_item->prev = block; - new_item->next = block->next; - if(new_item->next) - new_item->next->prev = new_item; - block->next = new_item; - - new_item->free = 1; - new_item->size = block->size - wanted_size; - block->size = wanted_size; - - if(!new_item->next) - rb->last = new_item; - } - - - /* set next block */ - rb->produce = ringbuf_nextblock(rb, block); - - /* set as used and return the item pointer */ - block->free = 0; - return block+1; -} - -void *ringbuf_prev(RINGBUFFER *rb, void *current) -{ - RBITEM *item = ((RBITEM *)current) - 1; - - while(1) - { - item = ringbuf_prevblock(rb, item); - if(item == rb->produce) - return 0; - if(!item->free) - return item+1; - } -} - -void *ringbuf_next(RINGBUFFER *rb, void *current) -{ - RBITEM *item = ((RBITEM *)current) - 1; - - while(1) - { - item = ringbuf_nextblock(rb, item); - if(item == rb->produce) - return 0; - if(!item->free) - return item+1; - } -} - -void *ringbuf_first(RINGBUFFER *rb) -{ - if(rb->consume->free) - return 0; - return rb->consume+1; -} - -void *ringbuf_last(RINGBUFFER *rb) -{ - if(!rb->produce->free) - return rb->produce+1; - return ringbuf_prev(rb, rb->produce+1); -} - - -/* debugging and testing stuff */ - -static void ringbuf_debugdump(RINGBUFFER *rb, const char *msg) -{ - RBITEM *cur = rb->first; - - dbg_msg("ringbuf", "-- dumping --"); - - while(cur) - { - char flags[4] = " "; - if(cur->free) - flags[0] = 'F'; - if(cur == rb->consume) - flags[1] = '>'; - if(cur == rb->produce) - flags[2] = '<'; - dbg_msg("ringbuf", "%s %d", flags, cur->size); - cur = cur->next; - } - - dbg_msg("ringbuf", "-- --"); - - if(msg) - dbg_assert(0, msg); -} - - - -static void ringbuf_validate(RINGBUFFER *rb) -{ - RBITEM *prev = 0; - RBITEM *cur = rb->first; - int freechunks = 0; - int got_consume = 0; - int got_produce = 0; - - while(cur) - { - - if(cur->free) - freechunks++; - - if(freechunks > 2) ringbuf_debugdump(rb, "too many free chunks"); - if(prev && prev->free && cur->free) ringbuf_debugdump(rb, "two free chunks next to each other"); - if(cur == rb->consume) got_consume = 1; - if(cur == rb->produce) got_produce = 1; - - dbg_assert(cur->prev == prev, "prev pointers doesn't match"); - dbg_assert(!prev || prev->next == cur, "next pointers doesn't match"); - dbg_assert(cur->next || cur == rb->last, "last isn't last"); - - prev = cur; - cur = cur->next; - } - - if(!got_consume) ringbuf_debugdump(rb, "consume pointer isn't pointing at a valid block"); - if(!got_produce) ringbuf_debugdump(rb, "produce pointer isn't pointing at a valid block"); -} - -int ringbuf_test() -{ - char buffer[256]; - RINGBUFFER *rb; - int i, s, k, m; - int count; - int testcount = 0; - - void *item; - int before; - - - for(k = 100; k < sizeof(buffer); k++) - { - if((k%10) == 0) - dbg_msg("ringbuf", "testing at %d", k); - rb = ringbuf_init(buffer, k, 0); - count = 0; - - for(s = 1; s < sizeof(buffer); s++) - { - for(i = 0; i < k*8; i++, testcount++) - { - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - before = m; - - if(ringbuf_allocate(rb, s)) - { - count++; - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - if(before+1 != m) ringbuf_debugdump(rb, "alloc error"); - if(count != m) ringbuf_debugdump(rb, "count error"); - } - else - { - if(ringbuf_popfirst(rb)) - { - count--; - - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - if(before-1 != m) dbg_msg("", "popping error %d %d", before, m); - if(count != m) ringbuf_debugdump(rb, "count error"); - } - } - - /* remove an item every 10 */ - if((i%10) == 0) - { - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - before = m; - - if(ringbuf_popfirst(rb)) - { - count--; - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - if(before-1 != m) dbg_msg("", "popping error %d %d", before, m); - dbg_assert(count == m, "count error"); - } - } - - /* count items */ - for(m = 0, item = ringbuf_first(rb); item; item = ringbuf_next(rb, item), m++); - if(m != count) ringbuf_debugdump(rb, "wrong number of items during forward count"); - - for(m = 0, item = ringbuf_last(rb); item; item = ringbuf_prev(rb, item), m++); - if(m != count) ringbuf_debugdump(rb, "wrong number of items during backward count"); - - ringbuf_validate(rb); - } - - /* empty the ring buffer */ - while(ringbuf_first(rb)) - ringbuf_popfirst(rb); - ringbuf_validate(rb); - count = 0; - } - } - - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.h deleted file mode 100644 index 523443dcf..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_ringbuffer.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _RINGBUFFER_H -#define _RINGBUFFER_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct RINGBUFFER RINGBUFFER; - -enum -{ - /* Will start to destroy items to try to fit the next one */ - RINGBUF_FLAG_RECYCLE=1 -}; - -RINGBUFFER *ringbuf_init(void *memory, int size, int flags); -void ringbuf_clear(RINGBUFFER *rb); -void *ringbuf_allocate(RINGBUFFER *rb, int size); - -void *ringbuf_prev(RINGBUFFER *rb, void *current); -void *ringbuf_next(RINGBUFFER *rb, void *current); -void *ringbuf_first(RINGBUFFER *rb); -void *ringbuf_last(RINGBUFFER *rb); - -int ringbuf_popfirst(RINGBUFFER *rb); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_server_interface.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_server_interface.h deleted file mode 100644 index 5b1e63275..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_server_interface.h +++ /dev/null @@ -1,20 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_SERVER_INTERFACE_H -#define ENGINE_SERVER_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "e_if_other.h" -#include "e_if_server.h" -#include "e_if_msg.h" -#include "e_if_mods.h" - -#include "e_console.h" /* TODO: clean this up*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.cpp deleted file mode 100644 index cce8a06e4..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.cpp +++ /dev/null @@ -1,604 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "e_snapshot.h" -#include "e_engine.h" -#include "e_compression.h" -#include "e_common_interface.h" - - -/* TODO: strange arbitrary number */ -static short item_sizes[64] = {0}; - -void snap_set_staticsize(int itemtype, int size) -{ - item_sizes[itemtype] = size; -} - -int *snapitem_data(SNAPSHOT_ITEM *item) { return (int *)(item+1); } -int snapitem_type(SNAPSHOT_ITEM *item) { return item->type_and_id>>16; } -int snapitem_id(SNAPSHOT_ITEM *item) { return item->type_and_id&0xffff; } -int snapitem_key(SNAPSHOT_ITEM *item) { return item->type_and_id; } - -int *snapshot_offsets(SNAPSHOT *snap) { return (int *)(snap+1); } -char *snapshot_datastart(SNAPSHOT *snap) { return (char*)(snapshot_offsets(snap)+snap->num_items); } - -SNAPSHOT_ITEM *snapshot_get_item(SNAPSHOT *snap, int index) -{ return (SNAPSHOT_ITEM *)(snapshot_datastart(snap) + snapshot_offsets(snap)[index]); } - -int snapshot_get_item_datasize(SNAPSHOT *snap, int index) -{ - if(index == snap->num_items-1) - return (snap->data_size - snapshot_offsets(snap)[index]) - sizeof(SNAPSHOT_ITEM); - return (snapshot_offsets(snap)[index+1] - snapshot_offsets(snap)[index]) - sizeof(SNAPSHOT_ITEM); -} - -int snapshot_get_item_index(SNAPSHOT *snap, int key) -{ - /* TODO: OPT: this should not be a linear search. very bad */ - int i; - for(i = 0; i < snap->num_items; i++) - { - if(snapitem_key(snapshot_get_item(snap, i)) == key) - return i; - } - return -1; -} -typedef struct -{ - int num; - int keys[64]; - int index[64]; -} ITEMLIST; -static ITEMLIST sorted[256]; - -static int snapshot_generate_hash(SNAPSHOT *snap) -{ - int i, key, hashid; - - for(i = 0; i < 256; i++) - sorted[i].num = 0; - - for(i = 0; i < snap->num_items; i++) - { - key = snapitem_key(snapshot_get_item(snap, i)); - hashid = ((key>>8)&0xf0) | (key&0xf); - if(sorted[hashid].num != 64) - { - sorted[hashid].index[sorted[hashid].num] = i; - sorted[hashid].keys[sorted[hashid].num] = key; - sorted[hashid].num++; - } - } - return 0; -} - -int snapshot_get_item_index_hashed(SNAPSHOT *snap, int key) -{ - int hashid = ((key>>8)&0xf0) | (key&0xf); - int i; - for(i = 0; i < sorted[hashid].num; i++) - { - if(sorted[hashid].keys[i] == key) - return sorted[hashid].index[i]; - } - - return -1; -} - -typedef struct -{ - int num_deleted_items; - int num_update_items; - int num_temp_items; /* needed? */ - int data[1]; - - /* - char *data_start() { return (char *)&offsets[num_deleted_items+num_update_items+num_temp_items]; } - - int deleted_item(int index) { return offsets[index]; } - item *update_item(int index) { return (item *)(data_start() + offsets[num_deleted_items+index]); } - item *temp_item(int index) { return (item *)(data_start() + offsets[num_deleted_items+num_update_items+index]); } - */ -} SNAPSHOT_DELTA; - - -static const int MAX_ITEMS = 512; -static SNAPSHOT_DELTA empty = {0,0,0,{0}}; - -void *snapshot_empty_delta() -{ - return ∅ -} - -int snapshot_crc(SNAPSHOT *snap) -{ - int crc = 0; - int i, b; - SNAPSHOT_ITEM *item; - int size; - - for(i = 0; i < snap->num_items; i++) - { - item = snapshot_get_item(snap, i); - size = snapshot_get_item_datasize(snap, i); - - for(b = 0; b < size/4; b++) - crc += snapitem_data(item)[b]; - } - return crc; -} - -void snapshot_debug_dump(SNAPSHOT *snap) -{ - int size, i, b; - SNAPSHOT_ITEM *item; - - dbg_msg("snapshot", "data_size=%d num_items=%d", snap->data_size, snap->num_items); - for(i = 0; i < snap->num_items; i++) - { - item = snapshot_get_item(snap, i); - size = snapshot_get_item_datasize(snap, i); - dbg_msg("snapshot", "\ttype=%d id=%d", snapitem_type(item), snapitem_id(item)); - for(b = 0; b < size/4; b++) - dbg_msg("snapshot", "\t\t%3d %12d\t%08x", b, snapitem_data(item)[b], snapitem_data(item)[b]); - } -} - -static int diff_item(int *past, int *current, int *out, int size) -{ - int needed = 0; - while(size) - { - *out = *current-*past; - needed |= *out; - out++; - past++; - current++; - size--; - } - - return needed; -} - -int snapshot_data_rate[0xffff] = {0}; -int snapshot_data_updates[0xffff] = {0}; -static int snapshot_current = 0; - -static void undiff_item(int *past, int *diff, int *out, int size) -{ - while(size) - { - *out = *past+*diff; - - if(*diff == 0) - snapshot_data_rate[snapshot_current] += 1; - else - { - unsigned char buf[16]; - unsigned char *end = vint_pack(buf, *diff); - snapshot_data_rate[snapshot_current] += (int)(end - (unsigned char*)buf) * 8; - } - - out++; - past++; - diff++; - size--; - } -} - - -/* TODO: OPT: this should be made much faster */ -int snapshot_create_delta(SNAPSHOT *from, SNAPSHOT *to, void *dstdata) -{ - static PERFORMACE_INFO hash_scope = {"hash", 0}; - SNAPSHOT_DELTA *delta = (SNAPSHOT_DELTA *)dstdata; - int *data = (int *)delta->data; - int i, itemsize, pastindex; - SNAPSHOT_ITEM *fromitem; - SNAPSHOT_ITEM *curitem; - SNAPSHOT_ITEM *pastitem; - int count = 0; - int size_count = 0; - - delta->num_deleted_items = 0; - delta->num_update_items = 0; - delta->num_temp_items = 0; - - perf_start(&hash_scope); - snapshot_generate_hash(to); - perf_end(); - - /* pack deleted stuff */ - { - static PERFORMACE_INFO scope = {"delete", 0}; - perf_start(&scope); - - for(i = 0; i < from->num_items; i++) - { - fromitem = snapshot_get_item(from, i); - if(snapshot_get_item_index_hashed(to, (snapitem_key(fromitem))) == -1) - { - /* deleted */ - delta->num_deleted_items++; - *data = snapitem_key(fromitem); - data++; - } - } - - perf_end(); - } - - perf_start(&hash_scope); - snapshot_generate_hash(from); - perf_end(); - - /* pack updated stuff */ - { - static PERFORMACE_INFO scope = {"update", 0}; - int pastindecies[1024]; - perf_start(&scope); - - /* fetch previous indices */ - /* we do this as a separate pass because it helps the cache */ - { - static PERFORMACE_INFO scope = {"find", 0}; - perf_start(&scope); - for(i = 0; i < to->num_items; i++) - { - curitem = snapshot_get_item(to, i); /* O(1) .. O(n) */ - pastindecies[i] = snapshot_get_item_index_hashed(from, snapitem_key(curitem)); /* O(n) .. O(n^n)*/ - } - perf_end(); - } - - for(i = 0; i < to->num_items; i++) - { - /* do delta */ - itemsize = snapshot_get_item_datasize(to, i); /* O(1) .. O(n) */ - curitem = snapshot_get_item(to, i); /* O(1) .. O(n) */ - pastindex = pastindecies[i]; - - if(pastindex != -1) - { - static PERFORMACE_INFO scope = {"diff", 0}; - int *item_data_dst = data+3; - perf_start(&scope); - - pastitem = snapshot_get_item(from, pastindex); - - if(item_sizes[snapitem_type(curitem)]) - item_data_dst = data+2; - - if(diff_item((int*)snapitem_data(pastitem), (int*)snapitem_data(curitem), item_data_dst, itemsize/4)) - { - - *data++ = snapitem_type(curitem); - *data++ = snapitem_id(curitem); - if(!item_sizes[snapitem_type(curitem)]) - *data++ = itemsize/4; - data += itemsize/4; - delta->num_update_items++; - } - perf_end(); - } - else - { - static PERFORMACE_INFO scope = {"copy", 0}; - perf_start(&scope); - - *data++ = snapitem_type(curitem); - *data++ = snapitem_id(curitem); - if(!item_sizes[snapitem_type(curitem)]) - *data++ = itemsize/4; - - mem_copy(data, snapitem_data(curitem), itemsize); - size_count += itemsize; - data += itemsize/4; - delta->num_update_items++; - count++; - - perf_end(); - } - } - - perf_end(); - } - - if(0) - { - dbg_msg("snapshot", "%d %d %d", - delta->num_deleted_items, - delta->num_update_items, - delta->num_temp_items); - } - - /* - // TODO: pack temp stuff - - // finish - //mem_copy(delta->offsets, deleted, delta->num_deleted_items*sizeof(int)); - //mem_copy(&(delta->offsets[delta->num_deleted_items]), update, delta->num_update_items*sizeof(int)); - //mem_copy(&(delta->offsets[delta->num_deleted_items+delta->num_update_items]), temp, delta->num_temp_items*sizeof(int)); - //mem_copy(delta->data_start(), data, data_size); - //delta->data_size = data_size; - * */ - - if(!delta->num_deleted_items && !delta->num_update_items && !delta->num_temp_items) - return 0; - - return (int)((char*)data-(char*)dstdata); -} - -static int range_check(void *end, void *ptr, int size) -{ - if((const char *)ptr + size > (const char *)end) - return -1; - return 0; -} - -int snapshot_unpack_delta(SNAPSHOT *from, SNAPSHOT *to, void *srcdata, int data_size) -{ - SNAPBUILD builder; - SNAPSHOT_DELTA *delta = (SNAPSHOT_DELTA *)srcdata; - int *data = (int *)delta->data; - int *end = (int *)(((char *)srcdata + data_size)); - - SNAPSHOT_ITEM *fromitem; - int i, d, keep, itemsize; - int *deleted; - int id, type, key; - int fromindex; - int *newdata; - - snapbuild_init(&builder); - - /* unpack deleted stuff */ - deleted = data; - data += delta->num_deleted_items; - if(data > end) - return -1; - - /* copy all non deleted stuff */ - for(i = 0; i < from->num_items; i++) - { - /* dbg_assert(0, "fail!"); */ - fromitem = snapshot_get_item(from, i); - itemsize = snapshot_get_item_datasize(from, i); - keep = 1; - for(d = 0; d < delta->num_deleted_items; d++) - { - if(deleted[d] == snapitem_key(fromitem)) - { - keep = 0; - break; - } - } - - if(keep) - { - /* keep it */ - mem_copy( - snapbuild_new_item(&builder, snapitem_type(fromitem), snapitem_id(fromitem), itemsize), - snapitem_data(fromitem), itemsize); - } - } - - /* unpack updated stuff */ - for(i = 0; i < delta->num_update_items; i++) - { - if(data+2 > end) - return -1; - - type = *data++; - id = *data++; - if(item_sizes[type]) - itemsize = item_sizes[type]; - else - { - if(data+1 > end) - return -2; - itemsize = (*data++) * 4; - } - snapshot_current = type; - - if(range_check(end, data, itemsize) || itemsize < 0) return -3; - - key = (type<<16)|id; - - /* create the item if needed */ - newdata = snapbuild_get_item_data(&builder, key); - if(!newdata) - newdata = (int *)snapbuild_new_item(&builder, key>>16, key&0xffff, itemsize); - - /*if(range_check(end, newdata, itemsize)) return -4;*/ - - fromindex = snapshot_get_item_index(from, key); - if(fromindex != -1) - { - /* we got an update so we need to apply the diff */ - undiff_item((int *)snapitem_data(snapshot_get_item(from, fromindex)), data, newdata, itemsize/4); - snapshot_data_updates[snapshot_current]++; - } - else /* no previous, just copy the data */ - { - mem_copy(newdata, data, itemsize); - snapshot_data_rate[snapshot_current] += itemsize*8; - snapshot_data_updates[snapshot_current]++; - } - - data += itemsize/4; - } - - /* finish up */ - return snapbuild_finish(&builder, to); -} - -/* SNAPSTORAGE */ - -void snapstorage_init(SNAPSTORAGE *ss) -{ - ss->first = 0; -} - -void snapstorage_purge_all(SNAPSTORAGE *ss) -{ - SNAPSTORAGE_HOLDER *h = ss->first; - SNAPSTORAGE_HOLDER *next; - - while(h) - { - next = h->next; - mem_free(h); - h = next; - } - - /* no more snapshots in storage */ - ss->first = 0; - ss->last = 0; -} - -void snapstorage_purge_until(SNAPSTORAGE *ss, int tick) -{ - SNAPSTORAGE_HOLDER *next; - SNAPSTORAGE_HOLDER *h = ss->first; - - while(h) - { - next = h->next; - if(h->tick >= tick) - return; /* no more to remove */ - mem_free(h); - - /* did we come to the end of the list? */ - if (!next) - break; - - ss->first = next; - next->prev = 0x0; - - h = next; - } - - /* no more snapshots in storage */ - ss->first = 0; - ss->last = 0; -} - -void snapstorage_add(SNAPSTORAGE *ss, int tick, int64 tagtime, int data_size, void *data, int create_alt) -{ - /* allocate memory for holder + snapshot_data */ - SNAPSTORAGE_HOLDER *h; - int total_size = sizeof(SNAPSTORAGE_HOLDER)+data_size; - - if(create_alt) - total_size += data_size; - - h = (SNAPSTORAGE_HOLDER *)mem_alloc(total_size, 1); - - /* set data */ - h->tick = tick; - h->tagtime = tagtime; - h->snap_size = data_size; - h->snap = (SNAPSHOT*)(h+1); - mem_copy(h->snap, data, data_size); - - if(create_alt) /* create alternative if wanted */ - { - h->alt_snap = (SNAPSHOT*)(((char *)h->snap) + data_size); - mem_copy(h->alt_snap, data, data_size); - } - else - h->alt_snap = 0; - - - /* link */ - h->next = 0; - h->prev = ss->last; - if(ss->last) - ss->last->next = h; - else - ss->first = h; - ss->last = h; -} - -int snapstorage_get(SNAPSTORAGE *ss, int tick, int64 *tagtime, SNAPSHOT **data, SNAPSHOT **alt_data) -{ - SNAPSTORAGE_HOLDER *h = ss->first; - - while(h) - { - if(h->tick == tick) - { - if(tagtime) - *tagtime = h->tagtime; - if(data) - *data = h->snap; - if(alt_data) - *alt_data = h->alt_snap; - return h->snap_size; - } - - h = h->next; - } - - return -1; -} - -/* SNAPBUILD */ - -void snapbuild_init(SNAPBUILD *sb) -{ - sb->data_size = 0; - sb->num_items = 0; -} - -SNAPSHOT_ITEM *snapbuild_get_item(SNAPBUILD *sb, int index) -{ - return (SNAPSHOT_ITEM *)&(sb->data[sb->offsets[index]]); -} - -int *snapbuild_get_item_data(SNAPBUILD *sb, int key) -{ - int i; - for(i = 0; i < sb->num_items; i++) - { - if(snapitem_key(snapbuild_get_item(sb, i)) == key) - return (int *)snapitem_data(snapbuild_get_item(sb, i)); - } - return 0; -} - -int snapbuild_finish(SNAPBUILD *sb, void *snapdata) -{ - /* flattern and make the snapshot */ - SNAPSHOT *snap = (SNAPSHOT *)snapdata; - int offset_size = sizeof(int)*sb->num_items; - snap->data_size = sb->data_size; - snap->num_items = sb->num_items; - mem_copy(snapshot_offsets(snap), sb->offsets, offset_size); - mem_copy(snapshot_datastart(snap), sb->data, sb->data_size); - return sizeof(SNAPSHOT) + offset_size + sb->data_size; -} - -void *snapbuild_new_item(SNAPBUILD *sb, int type, int id, int size) -{ - SNAPSHOT_ITEM *obj = (SNAPSHOT_ITEM *)(sb->data+sb->data_size); - - /*if(stress_prob(0.01f)) - { - size += ((rand()%5) - 2)*4; - if(size < 0) - size = 0; - }*/ - - mem_zero(obj, sizeof(SNAPSHOT_ITEM) + size); - obj->type_and_id = (type<<16)|id; - sb->offsets[sb->num_items] = sb->data_size; - sb->data_size += sizeof(SNAPSHOT_ITEM) + size; - sb->num_items++; - - dbg_assert(sb->data_size < MAX_SNAPSHOT_SIZE, "too much data"); - dbg_assert(sb->num_items < SNAPBUILD_MAX_ITEMS, "too many items"); - - return snapitem_data(obj); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.h b/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.h deleted file mode 100644 index 17ea0447d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/e_snapshot.h +++ /dev/null @@ -1,100 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef ENGINE_SNAPSHOT_H -#define ENGINE_SNAPSHOT_H - -#include - -/* SNAPSHOT */ - -#ifdef __cplusplus -extern "C" { -#endif - -enum -{ - MAX_SNAPSHOT_SIZE=64*1024 -}; - -typedef struct -{ - int type_and_id; -} SNAPSHOT_ITEM; - -typedef struct -{ - int data_size; - int num_items; -} SNAPSHOT; - -int *snapitem_data(SNAPSHOT_ITEM *item); -int snapitem_type(SNAPSHOT_ITEM *item); -int snapitem_id(SNAPSHOT_ITEM *item); -int snapitem_key(SNAPSHOT_ITEM *item); - -int *snapshot_offsets(SNAPSHOT *snap); -char *snapshot_datastart(SNAPSHOT *snap); - -SNAPSHOT_ITEM *snapshot_get_item(SNAPSHOT *snap, int index); -int snapshot_get_item_datasize(SNAPSHOT *snap, int index); -int snapshot_get_item_index(SNAPSHOT *snap, int key); - -void *snapshot_empty_delta(); -int snapshot_crc(SNAPSHOT *snap); -void snapshot_debug_dump(SNAPSHOT *snap); -int snapshot_create_delta(SNAPSHOT *from, SNAPSHOT *to, void *data); -int snapshot_unpack_delta(SNAPSHOT *from, SNAPSHOT *to, void *data, int data_size); - -/* SNAPSTORAGE */ - -typedef struct SNAPSTORAGE_HOLDER_t -{ - struct SNAPSTORAGE_HOLDER_t *prev; - struct SNAPSTORAGE_HOLDER_t *next; - - int64 tagtime; - int tick; - - int snap_size; - SNAPSHOT *snap; - SNAPSHOT *alt_snap; -} SNAPSTORAGE_HOLDER; - -typedef struct SNAPSTORAGE_t -{ - SNAPSTORAGE_HOLDER *first; - SNAPSTORAGE_HOLDER *last; -} SNAPSTORAGE; - -void snapstorage_init(SNAPSTORAGE *ss); -void snapstorage_purge_all(SNAPSTORAGE *ss); -void snapstorage_purge_until(SNAPSTORAGE *ss, int tick); -void snapstorage_add(SNAPSTORAGE *ss, int tick, int64 tagtime, int data_size, void *data, int create_alt); -int snapstorage_get(SNAPSTORAGE *ss, int tick, int64 *tagtime, SNAPSHOT **data, SNAPSHOT **alt_data); - -/* SNAPBUILD */ - -enum -{ - SNAPBUILD_MAX_ITEMS = 1024*2 -}; - -typedef struct SNAPBUILD -{ - char data[MAX_SNAPSHOT_SIZE]; - int data_size; - - int offsets[SNAPBUILD_MAX_ITEMS]; - int num_items; -} SNAPBUILD; - -void snapbuild_init(SNAPBUILD *sb); -SNAPSHOT_ITEM *snapbuild_get_item(SNAPBUILD *sb, int index); -int *snapbuild_get_item_data(SNAPBUILD *sb, int key); -int snapbuild_finish(SNAPBUILD *sb, void *snapdata); -void *snapbuild_new_item(SNAPBUILD *sb, int type, int id, int size); - -#ifdef __cplusplus -} -#endif - -#endif /* ENGINE_SNAPSHOT_H */ diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/important.txt b/project/jni/application/teeworlds-0.5.2/src/engine/external/important.txt deleted file mode 100644 index 305ccadcc..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/important.txt +++ /dev/null @@ -1,5 +0,0 @@ -The source code under this directory are external libraries -with their own licences. The source you find here is stripped -of unnessesary information. Please visit their websites for -more information and official releases. - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.c deleted file mode 100644 index b33f60ba0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.c +++ /dev/null @@ -1,877 +0,0 @@ -/* pnglite.c - pnglite library - For conditions of distribution and use, see copyright notice in pnglite.h -*/ -#define DO_CRC_CHECKS 1 -#define USE_ZLIB 1 - -#if USE_ZLIB -#include -#else -#include "zlite.h" -#endif - -#include -#include -#include -#include "pnglite.h" - - - -static png_alloc_t png_alloc; -static png_free_t png_free; - -static size_t file_read(png_t* png, void* out, size_t size, size_t numel) -{ - size_t result; - if(png->read_fun) - { - result = png->read_fun(out, size, numel, png->user_pointer); - } - else - { - if(!out) - { - result = fseek(png->user_pointer, (long)(size*numel), SEEK_CUR); - } - else - { - result = fread(out, size, numel, png->user_pointer); - } - } - - return result; -} - -static size_t file_write(png_t* png, void* p, size_t size, size_t numel) -{ - size_t result; - - if(png->write_fun) - { - result = png->write_fun(p, size, numel, png->user_pointer); - } - else - { - result = fwrite(p, size, numel, png->user_pointer); - } - - return result; -} - -static int file_read_ul(png_t* png, unsigned *out) -{ - unsigned char buf[4]; - - if(file_read(png, buf, 1, 4) != 4) - return PNG_FILE_ERROR; - - *out = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3]; - - return PNG_NO_ERROR; -} - -static int file_write_ul(png_t* png, unsigned in) -{ - unsigned char buf[4]; - - buf[0] = (in>>24) & 0xff; - buf[1] = (in>>16) & 0xff; - buf[2] = (in>>8) & 0xff; - buf[3] = (in) & 0xff; - - if(file_write(png, buf, 1, 4) != 4) - return PNG_FILE_ERROR; - - return PNG_NO_ERROR; -} - - -static unsigned get_ul(unsigned char* buf) -{ - unsigned result; - unsigned char foo[4]; - - memcpy(foo, buf, 4); - - result = (foo[0]<<24) | (foo[1]<<16) | (foo[2]<<8) | foo[3]; - - return result; -} - -static unsigned set_ul(unsigned char* buf, unsigned in) -{ - buf[0] = (in>>24) & 0xff; - buf[1] = (in>>16) & 0xff; - buf[2] = (in>>8) & 0xff; - buf[3] = (in) & 0xff; - - return PNG_NO_ERROR; -} - -int png_init(png_alloc_t pngalloc, png_free_t pngfree) -{ - if(pngalloc) - png_alloc = pngalloc; - else - png_alloc = &malloc; - - if(pngfree) - png_free = pngfree; - else - png_free = &free; - - return PNG_NO_ERROR; -} - -static int png_get_bpp(png_t* png) -{ - int bpp; - - switch(png->color_type) - { - case PNG_GREYSCALE: - bpp = 1; break; - case PNG_TRUECOLOR: - bpp = 3; break; - case PNG_INDEXED: - bpp = 1; break; - case PNG_GREYSCALE_ALPHA: - bpp = 2; break; - case PNG_TRUECOLOR_ALPHA: - bpp = 4; break; - default: - return PNG_FILE_ERROR; - } - - bpp *= png->depth/8; - - return bpp; -} - -static int png_read_ihdr(png_t* png) -{ - unsigned length; -#if DO_CRC_CHECKS - unsigned orig_crc; - unsigned calc_crc; -#endif - unsigned char ihdr[13+4]; /* length should be 13, make room for type (IHDR) */ - - file_read_ul(png, &length); - - if(length != 13) - { - printf("%d\n", length); - return PNG_CRC_ERROR; - } - - if(file_read(png, ihdr, 1, 13+4) != 13+4) - return PNG_EOF_ERROR; -#if DO_CRC_CHECKS - file_read_ul(png, &orig_crc); - - calc_crc = crc32(0L, 0, 0); - calc_crc = crc32(calc_crc, ihdr, 13+4); - - if(orig_crc != calc_crc) - return PNG_CRC_ERROR; -#else - file_read_ul(png); -#endif - - png->width = get_ul(ihdr+4); - png->height = get_ul(ihdr+8); - png->depth = ihdr[12]; - png->color_type = ihdr[13]; - png->compression_method = ihdr[14]; - png->filter_method = ihdr[15]; - png->interlace_method = ihdr[16]; - - if(png->color_type == PNG_INDEXED) - return PNG_NOT_SUPPORTED; - - if(png->depth != 8 && png->depth != 16) - return PNG_NOT_SUPPORTED; - - if(png->interlace_method) - return PNG_NOT_SUPPORTED; - - return PNG_NO_ERROR; -} - -static int png_write_ihdr(png_t* png) -{ - unsigned char ihdr[13+4]; - unsigned char *p = ihdr; - unsigned crc; - - file_write(png, "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 1, 8); - - file_write_ul(png, 13); - - *p = 'I'; p++; - *p = 'H'; p++; - *p = 'D'; p++; - *p = 'R'; p++; - set_ul(p, png->width); p+=4; - set_ul(p, png->height); p+=4; - *p = png->depth; p++; - *p = png->color_type; p++; - *p = 0; p++; - *p = 0; p++; - *p = 0; p++; - - file_write(png, ihdr, 1, 13+4); - - crc = crc32(0L, 0, 0); - crc = crc32(crc, ihdr, 13+4); - - file_write_ul(png, crc); - - return PNG_NO_ERROR; -} - -void png_print_info(png_t* png) -{ - printf("PNG INFO:\n"); - printf("\twidth:\t\t%d\n", png->width); - printf("\theight:\t\t%d\n", png->height); - printf("\tdepth:\t\t%d\n", png->depth); - printf("\tcolor:\t\t"); - - switch(png->color_type) - { - case PNG_GREYSCALE: printf("greyscale\n"); break; - case PNG_TRUECOLOR: printf("truecolor\n"); break; - case PNG_INDEXED: printf("palette\n"); break; - case PNG_GREYSCALE_ALPHA: printf("greyscale with alpha\n"); break; - case PNG_TRUECOLOR_ALPHA: printf("truecolor with alpha\n"); break; - default: printf("unknown, this is not good\n"); break; - } - - printf("\tcompression:\t%s\n", png->compression_method?"unknown, this is not good":"inflate/deflate"); - printf("\tfilter:\t\t%s\n", png->filter_method?"unknown, this is not good":"adaptive"); - printf("\tinterlace:\t%s\n", png->interlace_method?"interlace":"no interlace"); -} - -int png_open_read(png_t* png, png_read_callback_t read_fun, void* user_pointer) -{ - char header[8]; - int result; - - png->read_fun = read_fun; - png->write_fun = 0; - png->user_pointer = user_pointer; - - if(!read_fun && !user_pointer) - return PNG_WRONG_ARGUMENTS; - - if(file_read(png, header, 1, 8) != 8) - return PNG_EOF_ERROR; - - if(memcmp(header, "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8) != 0) - return PNG_HEADER_ERROR; - - result = png_read_ihdr(png); - - png->bpp = (unsigned char)png_get_bpp(png); - - return result; -} - -int png_open_write(png_t* png, png_write_callback_t write_fun, void* user_pointer) -{ - png->write_fun = write_fun; - png->read_fun = 0; - png->user_pointer = user_pointer; - - if(!write_fun && !user_pointer) - return PNG_WRONG_ARGUMENTS; - - return PNG_NO_ERROR; -} - -int png_open(png_t* png, png_read_callback_t read_fun, void* user_pointer) -{ - return png_open_read(png, read_fun, user_pointer); -} - -int png_open_file_read(png_t *png, const char* filename) -{ - FILE* fp = fopen(filename, "rb"); - - if(!fp) - return PNG_FILE_ERROR; - - return png_open_read(png, 0, fp); -} - -int png_open_file_write(png_t *png, const char* filename) -{ - FILE* fp = fopen(filename, "wb"); - - if(!fp) - return PNG_FILE_ERROR; - - return png_open_write(png, 0, fp); -} - -int png_open_file(png_t *png, const char* filename) -{ - return png_open_file_read(png, filename); -} - -int png_close_file(png_t* png) -{ - fclose(png->user_pointer); - - return PNG_NO_ERROR; -} - -static int png_init_deflate(png_t* png, unsigned char* data, int datalen) -{ - z_stream *stream; - png->zs = png_alloc(sizeof(z_stream)); - - stream = png->zs; - - if(!stream) - return PNG_MEMORY_ERROR; - - memset(stream, 0, sizeof(z_stream)); - - if(deflateInit(stream, Z_DEFAULT_COMPRESSION) != Z_OK) - return PNG_ZLIB_ERROR; - - stream->next_in = data; - stream->avail_in = datalen; - - return PNG_NO_ERROR; -} - -static int png_init_inflate(png_t* png) -{ -#if USE_ZLIB - z_stream *stream; - png->zs = png_alloc(sizeof(z_stream)); -#else - zl_stream *stream; - png->zs = png_alloc(sizeof(zl_stream)); -#endif - - stream = png->zs; - - if(!stream) - return PNG_MEMORY_ERROR; - - - -#if USE_ZLIB - memset(stream, 0, sizeof(z_stream)); - if(inflateInit(stream) != Z_OK) - return PNG_ZLIB_ERROR; -#else - memset(stream, 0, sizeof(zl_stream)); - if(z_inflateInit(stream) != Z_OK) - return PNG_ZLIB_ERROR; -#endif - - stream->next_out = png->png_data; - stream->avail_out = png->png_datalen; - - return PNG_NO_ERROR; -} - -static int png_end_deflate(png_t* png) -{ - z_stream *stream = png->zs; - - if(!stream) - return PNG_MEMORY_ERROR; - - deflateEnd(stream); - - png_free(png->zs); - - return PNG_NO_ERROR; -} - -static int png_end_inflate(png_t* png) -{ -#if USE_ZLIB - z_stream *stream = png->zs; -#else - zl_stream *stream = png->zs; -#endif - - if(!stream) - return PNG_MEMORY_ERROR; - -#if USE_ZLIB - if(inflateEnd(stream) != Z_OK) -#else - if(z_inflateEnd(stream) != Z_OK) -#endif - { - printf("ZLIB says: %s\n", stream->msg); - return PNG_ZLIB_ERROR; - } - - png_free(png->zs); - - return PNG_NO_ERROR; -} - -static int png_inflate(png_t* png, char* data, int len) -{ - int result; -#if USE_ZLIB - z_stream *stream = png->zs; -#else - zl_stream *stream = png->zs; -#endif - - if(!stream) - return PNG_MEMORY_ERROR; - - stream->next_in = (unsigned char*)data; - stream->avail_in = len; - -#if USE_ZLIB - result = inflate(stream, Z_SYNC_FLUSH); -#else - result = z_inflate(stream); -#endif - - if(result != Z_STREAM_END && result != Z_OK) - { - printf("%s\n", stream->msg); - return PNG_ZLIB_ERROR; - } - - if(stream->avail_in != 0) - return PNG_ZLIB_ERROR; - - return PNG_NO_ERROR; -} - -static int png_deflate(png_t* png, char* outdata, int outlen, int *outwritten) -{ - int result; - - z_stream *stream = png->zs; - - - if(!stream) - return PNG_MEMORY_ERROR; - - stream->next_out = (unsigned char*)outdata; - stream->avail_out = outlen; - - result = deflate(stream, Z_SYNC_FLUSH); - - *outwritten = outlen - stream->avail_out; - - if(result != Z_STREAM_END && result != Z_OK) - { - printf("%s\n", stream->msg); - return PNG_ZLIB_ERROR; - } - - return result; -} - -static int png_write_idats(png_t* png, unsigned char* data) -{ - unsigned char *chunk; - unsigned long written; - unsigned long crc; - unsigned size = png->width * png->height * png->bpp + png->height; - - (void)png_init_deflate; - (void)png_end_deflate; - (void)png_deflate; - - chunk = png_alloc(size); - memcpy(chunk, "IDAT", 4); - - written = size; - compress(chunk+4, &written, data, size); - - crc = crc32(0L, Z_NULL, 0); - crc = crc32(crc, chunk, written+4); - set_ul(chunk+written+4, crc); - file_write_ul(png, written); - file_write(png, chunk, 1, written+8); - png_free(chunk); - - file_write_ul(png, 0); - file_write(png, "IEND", 1, 4); - crc = crc32(0L, (const unsigned char *)"IEND", 4); - file_write_ul(png, crc); - - return PNG_NO_ERROR; -} - -static int png_read_idat(png_t* png, unsigned firstlen) -{ - unsigned type = 0; - char *chunk; - int result; - unsigned length = firstlen; - unsigned old_len = length; - -#if DO_CRC_CHECKS - unsigned orig_crc; - unsigned calc_crc; -#endif - - chunk = png_alloc(firstlen); - - result = png_init_inflate(png); - - if(result != PNG_NO_ERROR) - { - png_end_inflate(png); - png_free(chunk); - return result; - } - - do - { - if(file_read(png, chunk, 1, length) != length) - { - png_end_inflate(png); - png_free(chunk); - return PNG_FILE_ERROR; - } - -#if DO_CRC_CHECKS - calc_crc = crc32(0L, Z_NULL, 0); - calc_crc = crc32(calc_crc, (unsigned char*)"IDAT", 4); - calc_crc = crc32(calc_crc, (unsigned char*)chunk, length); - - file_read_ul(png, &orig_crc); - - if(orig_crc != calc_crc) - { - result = PNG_CRC_ERROR; - break; - } -#else - file_read_ul(png); -#endif - - result = png_inflate(png, chunk, length); - - if(result != PNG_NO_ERROR) break; - - file_read_ul(png, &length); - - if(length > old_len) - { - png_free(chunk); - chunk = png_alloc(length); - old_len = length; - } - - if(file_read(png, &type, 1, 4) != 4) - { - result = PNG_FILE_ERROR; - break; - } - - }while(type == *(unsigned int*)"IDAT"); - - if(type == *(unsigned int*)"IEND") - result = PNG_DONE; - - png_free(chunk); - png_end_inflate(png); - - return result; -} - -static int png_process_chunk(png_t* png) -{ - int result = PNG_NO_ERROR; - unsigned type; - unsigned length; - - file_read_ul(png, &length); - - if(file_read(png, &type, 1, 4) != 4) - return PNG_FILE_ERROR; - - if(type == *(unsigned int*)"IDAT") /* if we found an idat, all other idats should be followed with no other chunks in between */ - { - png->png_datalen = png->width * png->height * png->bpp + png->height; - png->png_data = png_alloc(png->png_datalen); - - if(!png->png_data) - return PNG_MEMORY_ERROR; - - return png_read_idat(png, length); - } - else if(type == *(unsigned int*)"IEND") - { - return PNG_DONE; - } - else - { - file_read(png, 0, 1, length + 4); /* unknown chunk */ - } - - return result; -} - -static void png_filter_sub(int stride, unsigned char* in, unsigned char* out, int len) -{ - int i; - unsigned char a = 0; - - for(i = 0; i < len; i++) - { - if(i >= stride) - a = out[i - stride]; - - out[i] = in[i] + a; - } -} - -static void png_filter_up(int stride, unsigned char* in, unsigned char* out, unsigned char* prev_line, int len) -{ - int i; - - if(prev_line) - { - for(i = 0; i < len; i++) - out[i] = in[i] + prev_line[i]; - } - else - memcpy(out, in, len); -} - -static void png_filter_average(int stride, unsigned char* in, unsigned char* out, unsigned char* prev_line, int len) -{ - int i; - unsigned char a = 0; - unsigned char b = 0; - unsigned int sum = 0; - - for(i = 0; i < len; i++) - { - if(prev_line) - b = prev_line[i]; - - if(i >= stride) - a = out[i - stride]; - - sum = a; - sum += b; - - out[i] = (char)(in[i] + sum/2); - } -} - -static unsigned char png_paeth(unsigned char a, unsigned char b, unsigned char c) -{ - int p = (int)a + b - c; - int pa = abs(p - a); - int pb = abs(p - b); - int pc = abs(p - c); - - int pr; - - if(pa <= pb && pa <= pc) - pr = a; - else if(pb <= pc) - pr = b; - else - pr = c; - - return (char)pr; -} - -static void png_filter_paeth(int stride, unsigned char* in, unsigned char* out, unsigned char* prev_line, int len) -{ - int i; - unsigned char a; - unsigned char b; - unsigned char c; - - for(i = 0; i < len; i++) - { - if(prev_line && i >= stride) - { - a = out[i - stride]; - b = prev_line[i]; - c = prev_line[i - stride]; - } - else - { - if(prev_line) - b = prev_line[i]; - else - b = 0; - - if(i >= stride) - a = out[i - stride]; - else - a = 0; - - c = 0; - } - - out[i] = in[i] + png_paeth(a, b, c); - } -} - -static int png_filter(png_t* png, unsigned char* data) -{ - - - return PNG_NO_ERROR; -} - -static int png_unfilter(png_t* png, unsigned char* data) -{ - unsigned i; - unsigned pos = 0; - unsigned outpos = 0; - unsigned char *filtered = png->png_data; - - int stride = png->bpp; - - while(pos < png->png_datalen) - { - unsigned char filter = filtered[pos]; - - pos++; - - if(png->depth == 16) - { - for(i = 0; i < png->width * stride; i+=2) - { - *(short*)(filtered+pos+i) = (filtered[pos+i] << 8) | filtered[pos+i+1]; - } - } - - switch(filter) - { - case 0: /* none */ - memcpy(data+outpos, filtered+pos, png->width * stride); - break; - case 1: /* sub */ - png_filter_sub(stride, filtered+pos, data+outpos, png->width * stride); - break; - case 2: /* up */ - if(outpos) - png_filter_up(stride, filtered+pos, data+outpos, data + outpos - (png->width*stride), png->width*stride); - else - png_filter_up(stride, filtered+pos, data+outpos, 0, png->width*stride); - break; - case 3: /* average */ - if(outpos) - png_filter_average(stride, filtered+pos, data+outpos, data + outpos - (png->width*stride), png->width*stride); - else - png_filter_average(stride, filtered+pos, data+outpos, 0, png->width*stride); - break; - case 4: /* paeth */ - if(outpos) - png_filter_paeth(stride, filtered+pos, data+outpos, data + outpos - (png->width*stride), png->width*stride); - else - png_filter_paeth(stride, filtered+pos, data+outpos, 0, png->width*stride); - break; - default: - return PNG_UNKNOWN_FILTER; - } - - outpos += png->width * stride; - pos += png->width * stride; - } - - return PNG_NO_ERROR; -} - -int png_get_data(png_t* png, unsigned char* data) -{ - int result = PNG_NO_ERROR; - - while(result == PNG_NO_ERROR) - { - result = png_process_chunk(png); - } - - if(result != PNG_DONE) - { - png_free(png->png_data); - return result; - } - - result = png_unfilter(png, data); - - png_free(png->png_data); - - return result; -} - -int png_set_data(png_t* png, unsigned width, unsigned height, char depth, int color, unsigned char* data) -{ - int i; - unsigned char *filtered; - png->width = width; - png->height = height; - png->depth = depth; - png->color_type = color; - png->bpp = png_get_bpp(png); - - filtered = png_alloc(width * height * png->bpp + height); - - for(i = 0; i < png->height; i++) - { - filtered[i*png->width*png->bpp+i] = 0; - memcpy(&filtered[i*png->width*png->bpp+i+1], data + i * png->width*png->bpp, png->width*png->bpp); - } - - png_filter(png, filtered); - png_write_ihdr(png); - png_write_idats(png, filtered); - - png_free(filtered); - return PNG_NO_ERROR; -} - - -char* png_error_string(int error) -{ - switch(error) - { - case PNG_NO_ERROR: - return "No error"; - case PNG_FILE_ERROR: - return "Unknown file error."; - case PNG_HEADER_ERROR: - return "No PNG header found. Are you sure this is a PNG?"; - case PNG_IO_ERROR: - return "Failure while reading file."; - case PNG_EOF_ERROR: - return "Reached end of file."; - case PNG_CRC_ERROR: - return "CRC or chunk length error."; - case PNG_MEMORY_ERROR: - return "Could not allocate memory."; - case PNG_ZLIB_ERROR: - return "zlib reported an error."; - case PNG_UNKNOWN_FILTER: - return "Unknown filter method used in scanline."; - case PNG_DONE: - return "PNG done"; - case PNG_NOT_SUPPORTED: - return "The PNG is unsupported by pnglite, too bad for you!"; - case PNG_WRONG_ARGUMENTS: - return "Wrong combination of arguments passed to png_open. You must use either a read_function or supply a file pointer to use."; - default: - return "Unknown error."; - }; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.h b/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.h deleted file mode 100644 index 72ff1c52c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/pnglite/pnglite.h +++ /dev/null @@ -1,227 +0,0 @@ -/* pnglite.h - Interface for pnglite library - Copyright (c) 2007 Daniel Karling - - 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. - - Daniel Karling - daniel.karling@gmail.com - */ - - -#ifndef _PNGLITE_H_ -#define _PNGLITE_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - -/* - Enumerations for pnglite. - Negative numbers are error codes and 0 and up are okay responses. -*/ - -enum -{ - PNG_DONE = 1, - PNG_NO_ERROR = 0, - PNG_FILE_ERROR = -1, - PNG_HEADER_ERROR = -2, - PNG_IO_ERROR = -3, - PNG_EOF_ERROR = -4, - PNG_CRC_ERROR = -5, - PNG_MEMORY_ERROR = -6, - PNG_ZLIB_ERROR = -7, - PNG_UNKNOWN_FILTER = -8, - PNG_NOT_SUPPORTED = -9, - PNG_WRONG_ARGUMENTS = -10 -}; - -/* - The five different kinds of color storage in PNG files. -*/ - -enum -{ - PNG_GREYSCALE = 0, - PNG_TRUECOLOR = 2, - PNG_INDEXED = 3, - PNG_GREYSCALE_ALPHA = 4, - PNG_TRUECOLOR_ALPHA = 6 -}; - -/* - Typedefs for callbacks. -*/ - -typedef unsigned (*png_write_callback_t)(void* input, unsigned long size, unsigned long numel, void* user_pointer); -typedef unsigned (*png_read_callback_t)(void* output, unsigned long size, unsigned long numel, void* user_pointer); -typedef void (*png_free_t)(void* p); -typedef void * (*png_alloc_t)(unsigned long s); - -typedef struct -{ - void* zs; /* pointer to z_stream */ - png_read_callback_t read_fun; - png_write_callback_t write_fun; - void* user_pointer; - - unsigned char* png_data; - unsigned png_datalen; - - unsigned width; - unsigned height; - unsigned char depth; - unsigned char color_type; - unsigned char compression_method; - unsigned char filter_method; - unsigned char interlace_method; - unsigned char bpp; -}png_t; - -/* - Function: png_init - - This function initializes pnglite. The parameters can be used to set your own memory allocation routines following these formats: - - > void* (*custom_alloc)(unsigned long s) - > void (*custom_free)(void* p) - Parameters: - pngalloc - Pointer to custom allocation routine. If 0 is passed, malloc from libc will be used. - pngfree - Pointer to custom free routine. If 0 is passed, free from libc will be used. - - Returns: - Always returns PNG_NO_ERROR. -*/ - -int png_init(png_alloc_t pngalloc, png_free_t pngfree); - -/* - Function: png_open_file - - This function is used to open a png file with the internal file IO system. This function should be used instead of - png_open if no custom read function is used. - - Parameters: - png - Empty png_t struct. - filename - Filename of the file to be opened. - - Returns: - PNG_NO_ERROR on success, otherwise an error code. -*/ - -int png_open_file(png_t *png, const char* filename); - -int png_open_file_read(png_t *png, const char* filename); -int png_open_file_write(png_t *png, const char* filename); - -/* - Function: png_open - - This function reads or writes a png from/to the specified callback. The callbacks should be of the format: - - > unsigned long (*png_write_callback_t)(void* input, unsigned long size, unsigned long numel, void* user_pointer); - > unsigned long (*png_read_callback_t)(void* output, unsigned long size, unsigned long numel, void* user_pointer). - - Only one callback has to be specified. The read callback in case of PNG reading, otherwise the write callback. - - Writing: - The callback will be called like fwrite. - - Reading: - The callback will be called each time pnglite needs more data. The callback should read as much data as requested, - or return 0. This should always be possible if the PNG is sane. If the output-buffer is a null-pointer the callback - should only skip ahead the specified number of elements. If the callback is a null-pointer the user_pointer will be - treated as a file pointer (use png_open_file instead). - - Parameters: - png - png_t struct - read_fun - Callback function for reading. - user_pointer - User pointer to be passed to read_fun. - - Returns: - PNG_NO_ERROR on success, otherwise an error code. -*/ - -int png_open(png_t* png, png_read_callback_t read_fun, void* user_pointer); - -int png_open_read(png_t* png, png_read_callback_t read_fun, void* user_pointer); -int png_open_write(png_t* png, png_write_callback_t write_fun, void* user_pointer); - -/* - Function: png_print_info - - This function prints some info about the opened png file to stdout. - - Parameters: - png - png struct to get info from. -*/ - -void png_print_info(png_t* png); - -/* - Function: png_error_string - - This function translates an error code to a human readable string. - - Parameters: - error - Error code. - - Returns: - Pointer to string. -*/ - -char* png_error_string(int error); - -/* - Function: png_get_data - - This function decodes the opened png file and stores the result in data. data should be big enough to hold the decoded png. Required size will be: - - > width*height*(bytes per pixel) - - Parameters: - data - Where to store result. - - Returns: - PNG_NO_ERROR on success, otherwise an error code. -*/ - -int png_get_data(png_t* png, unsigned char* data); - -int png_set_data(png_t* png, unsigned width, unsigned height, char depth, int color, unsigned char* data); - -/* - Function: png_close_file - - Closes an open png file pointer. Should only be used when the png has been opened with png_open_file. - - Parameters: - png - png to close. - - Returns: - PNG_NO_ERROR -*/ - -int png_close_file(png_t* png); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arm.S b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arm.S deleted file mode 100644 index 4f2998923..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arm.S +++ /dev/null @@ -1,461 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -/* This is an assembly optimized version of the following WavPack function: - * - * void decorr_stereo_pass_cont (struct decorr_pass *dpp, - * long *buffer, long sample_count); - * - * It performs a single pass of stereo decorrelation on the provided buffer. - * Note that this version of the function requires that the 8 previous stereo - * samples are visible and correct. In other words, it ignores the "samples_*" - * fields in the decorr_pass structure and gets the history data directly - * from the buffer. It does, however, return the appropriate history samples - * to the decorr_pass structure before returning. - * - * This is written to work on a ARM7TDMI processor. This version only uses the - * 32-bit multiply-accumulate instruction and so will overflow with 24-bit - * WavPack files. - */ - .text - .align - .global decorr_stereo_pass_cont_arm - -/* - * on entry: - * - * r0 = struct decorr_pass *dpp - * r1 = long *buffer - * r2 = long sample_count - */ - -decorr_stereo_pass_cont_arm: - - stmfd sp!, {r4 - r8, r10, r11, lr} - mov r5, r0 @ r5 = dpp - mov r11, #512 @ r11 = 512 for rounding - ldrsh r6, [r0, #2] @ r6 = dpp->delta - ldrsh r4, [r0, #4] @ r4 = dpp->weight_A - ldrsh r0, [r0, #6] @ r0 = dpp->weight_B - cmp r2, #0 @ exit if no samples to process - beq common_exit - - add r7, r1, r2, asl #3 @ r7 = buffer ending position - ldrsh r2, [r5, #0] @ r2 = dpp->term - cmp r2, #0 - bmi minus_term - - ldr lr, [r1, #-16] @ load 2 sample history from buffer - ldr r10, [r1, #-12] @ for terms 2, 17, and 18 - ldr r8, [r1, #-8] - ldr r3, [r1, #-4] - cmp r2, #17 - beq term_17_loop - cmp r2, #18 - beq term_18_loop - cmp r2, #2 - beq term_2_loop - b term_default_loop @ else handle default (1-8, except 2) - -minus_term: - mov r10, #1024 @ r10 = -1024 for weight clipping - rsb r10, r10, #0 @ (only used for negative terms) - cmn r2, #1 - beq term_minus_1 - cmn r2, #2 - beq term_minus_2 - cmn r2, #3 - beq term_minus_3 - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = 17 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample - * r3 = previous right sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = current decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_17_loop: - rsbs ip, lr, r8, asl #1 @ decorr value = (2 * prev) - 2nd prev - mov lr, r8 @ previous becomes 2nd previous - ldr r2, [r1], #4 @ get sample & update pointer - mla r8, ip, r4, r11 @ mult decorr value by weight, round, - add r8, r2, r8, asr #10 @ shift, and add to new sample - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L325 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L325: rsbs ip, r10, r3, asl #1 @ do same thing for right channel - mov r10, r3 - ldr r2, [r1], #4 - mla r3, ip, r0, r11 - add r3, r2, r3, asr #10 - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L329 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L329: cmp r7, r1 @ loop back if more samples to do - bhi term_17_loop - b store_1718 @ common exit for terms 17 & 18 - -/* - ****************************************************************************** - * Loop to handle term = 18 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample - * r3 = previous right sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_18_loop: - sub ip, r8, lr @ decorr value = - mov lr, r8 @ ((3 * prev) - 2nd prev) >> 1 - adds ip, r8, ip, asr #1 - ldr r2, [r1], #4 @ get sample & update pointer - mla r8, ip, r4, r11 @ mult decorr value by weight, round, - add r8, r2, r8, asr #10 @ shift, and add to new sample - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L337 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L337: sub ip, r3, r10 @ do same thing for right channel - mov r10, r3 - adds ip, r3, ip, asr #1 - ldr r2, [r1], #4 - mla r3, ip, r0, r11 - add r3, r2, r3, asr #10 - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L341 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L341: cmp r7, r1 @ loop back if more samples to do - bhi term_18_loop - -/* common exit for terms 17 & 18 */ - -store_1718: - str r3, [r5, #40] @ store sample history into struct - str r8, [r5, #8] - str r10, [r5, #44] - str lr, [r5, #12] - b common_exit @ and return - -/* - ****************************************************************************** - * Loop to handle term = 2 condition - * (note that this case can be handled by the default term handler (1-8), but - * this special case is faster because it doesn't have to read memory twice) - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample - * r3 = previous right sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_2_loop: - movs ip, lr @ get decorrelation value & test - mov lr, r8 @ previous becomes 2nd previous - ldr r2, [r1], #4 @ get sample & update pointer - mla r8, ip, r4, r11 @ mult decorr value by weight, round, - add r8, r2, r8, asr #10 @ shift, and add to new sample - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L225 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L225: movs ip, r10 @ do same thing for right channel - mov r10, r3 - ldr r2, [r1], #4 - mla r3, ip, r0, r11 - add r3, r2, r3, asr #10 - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L229 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L229: cmp r7, r1 @ loop back if more samples to do - bhi term_2_loop - b default_term_exit @ this exit updates all dpp->samples - -/* - ****************************************************************************** - * Loop to handle default term condition - * - * r0 = dpp->weight_B r8 = result accumulator - * r1 = bptr r9 = - * r2 = dpp->term r10 = - * r3 = decorrelation value r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = - * r7 = eptr pc = - ******************************************************************************* - */ - -term_default_loop: - ldr ip, [r1] @ get original sample - ldr r3, [r1, -r2, asl #3] @ get decorrelation value based on term - mla r8, r3, r4, r11 @ mult decorr value by weight, round, - add r8, ip, r8, asr #10 @ shift and add to new sample - str r8, [r1], #4 @ store update sample - cmp r3, #0 - cmpne ip, #0 - beq .L350 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L350: ldr ip, [r1] @ do the same thing for right channel - ldr r3, [r1, -r2, asl #3] - mla r8, r3, r0, r11 - add r8, ip, r8, asr #10 - str r8, [r1], #4 - cmp r3, #0 - cmpne ip, #0 - beq .L354 - teq ip, r3 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L354: cmp r7, r1 @ loop back if more samples to do - bhi term_default_loop - -/* - * This exit is used by terms 1-8 to store the previous 8 samples into the decorr - * structure (even if they are not all used for the given term) - */ - -default_term_exit: - ldrsh r3, [r5, #0] - sub ip, r3, #1 - mov lr, #7 - -.L358: and r3, ip, #7 - add r3, r5, r3, asl #2 - ldr r2, [r1, #-4] - str r2, [r3, #40] - ldr r2, [r1, #-8]! - str r2, [r3, #8] - sub ip, ip, #1 - sub lr, lr, #1 - cmn lr, #1 - bne .L358 - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -1 condition - * - * r0 = dpp->weight_B r8 = - * r1 = bptr r9 = - * r2 = intermediate result r10 = -1024 (for clipping) - * r3 = previous right sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = updated left sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_1: - ldr r3, [r1, #-4] - -term_minus_1_loop: - ldr ip, [r1] @ for left channel the decorrelation value - mla r2, r3, r4, r11 @ is the previous right sample (in r3) - add lr, ip, r2, asr #10 - str lr, [r1], #8 - cmp r3, #0 - cmpne ip, #0 - beq .L361 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #1024 - movgt r4, #1024 - cmp r4, r10 - movlt r4, r10 - -.L361: ldr r2, [r1, #-4] @ for right channel the decorrelation value - mla r3, lr, r0, r11 @ is the just updated right sample (in lr) - add r3, r2, r3, asr #10 - str r3, [r1, #-4] - cmp lr, #0 - cmpne r2, #0 - beq .L369 - teq r2, lr - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #1024 @ then clip weight to +/-1024 - movgt r0, #1024 - cmp r0, r10 - movlt r0, r10 - -.L369: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_1_loop - - str r3, [r5, #8] @ else store right sample and exit - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -2 condition - * (note that the channels are processed in the reverse order here) - * - * r0 = dpp->weight_B r8 = - * r1 = bptr r9 = - * r2 = intermediate result r10 = -1024 (for clipping) - * r3 = previous left sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = updated right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_2: - ldr r3, [r1, #-8] - -term_minus_2_loop: - ldr ip, [r1, #4] @ for right channel the decorrelation value - mla r2, r3, r0, r11 @ is the previous left sample (in r3) - add lr, ip, r2, asr #10 - str lr, [r1, #4] - cmp r3, #0 - cmpne ip, #0 - beq .L380 - teq ip, r3 @ update weight based on signs - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #1024 @ then clip weight to +/-1024 - movgt r0, #1024 - cmp r0, r10 - movlt r0, r10 - -.L380: ldr r2, [r1, #0] @ for left channel the decorrelation value - mla r3, lr, r4, r11 @ is the just updated left sample (in lr) - add r3, r2, r3, asr #10 - str r3, [r1], #8 - cmp lr, #0 - cmpne r2, #0 - beq .L388 - teq r2, lr - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #1024 - movgt r4, #1024 - cmp r4, r10 - movlt r4, r10 - -.L388: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_2_loop - - str r3, [r5, #40] @ else store left channel and exit - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -3 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current left sample r10 = -1024 (for clipping) - * r3 = previous right sample r11 = 512 (for rounding) - * r4 = dpp->weight_A ip = intermediate result - * r5 = dpp sp = - * r6 = dpp->delta lr = - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_3: - ldr r3, [r1, #-4] @ load previous samples - ldr r8, [r1, #-8] - -term_minus_3_loop: - ldr ip, [r1] - mla r2, r3, r4, r11 - add r2, ip, r2, asr #10 - str r2, [r1], #4 - cmp r3, #0 - cmpne ip, #0 - beq .L399 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #1024 @ then clip weight to +/-1024 - movgt r4, #1024 - cmp r4, r10 - movlt r4, r10 - -.L399: movs ip, r8 @ ip = previous left we use now - mov r8, r2 @ r8 = current left we use next time - ldr r2, [r1], #4 - mla r3, ip, r0, r11 - add r3, r2, r3, asr #10 - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L407 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #1024 - movgt r0, #1024 - cmp r0, r10 - movlt r0, r10 - -.L407: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_3_loop - - str r3, [r5, #8] @ else store previous samples & exit - str r8, [r5, #40] - -/* - * Before finally exiting we must store weights back for next time - */ - -common_exit: - strh r4, [r5, #4] - strh r0, [r5, #6] - ldmfd sp!, {r4 - r8, r10, r11, pc} - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arml.S b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arml.S deleted file mode 100644 index 7da005139..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/arml.S +++ /dev/null @@ -1,491 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -/* This is an assembly optimized version of the following WavPack function: - * - * void decorr_stereo_pass_cont (struct decorr_pass *dpp, - * long *buffer, long sample_count); - * - * It performs a single pass of stereo decorrelation on the provided buffer. - * Note that this version of the function requires that the 8 previous stereo - * samples are visible and correct. In other words, it ignores the "samples_*" - * fields in the decorr_pass structure and gets the history data directly - * from the buffer. It does, however, return the appropriate history samples - * to the decorr_pass structure before returning. - * - * This is written to work on a ARM7TDMI processor. This version uses the - * 64-bit multiply-accumulate instruction and so can be used with all - * WavPack files. However, for optimum performance with 16-bit WavPack - * files, there is a faster version that only uses the 32-bit MLA - * instruction. - */ - - .text - .align - .global decorr_stereo_pass_cont_arml - -/* - * on entry: - * - * r0 = struct decorr_pass *dpp - * r1 = long *buffer - * r2 = long sample_count - */ - -decorr_stereo_pass_cont_arml: - - stmfd sp!, {r4 - r8, r10, r11, lr} - mov r5, r0 @ r5 = dpp - mov r11, #512 @ r11 = 512 for rounding - ldrsh r6, [r0, #2] @ r6 = dpp->delta - ldrsh r4, [r0, #4] @ r4 = dpp->weight_A - ldrsh r0, [r0, #6] @ r0 = dpp->weight_B - cmp r2, #0 @ exit if no samples to process - beq common_exit - - mov r0, r0, asl #18 @ for 64-bit math we use weights << 18 - mov r4, r4, asl #18 - mov r6, r6, asl #18 - add r7, r1, r2, asl #3 @ r7 = buffer ending position - ldrsh r2, [r5, #0] @ r2 = dpp->term - cmp r2, #0 - blt minus_term - - ldr lr, [r1, #-16] @ load 2 sample history from buffer - ldr r10, [r1, #-12] @ for terms 2, 17, and 18 - ldr r8, [r1, #-8] - ldr r3, [r1, #-4] - - cmp r2, #18 - beq term_18_loop - mov lr, lr, asl #4 - mov r10, r10, asl #4 - cmp r2, #2 - beq term_2_loop - cmp r2, #17 - beq term_17_loop - b term_default_loop - -minus_term: - mov r10, #(1024 << 18) @ r10 = -1024 << 18 for weight clipping - rsb r10, r10, #0 @ (only used for negative terms) - cmn r2, #1 - beq term_minus_1 - cmn r2, #2 - beq term_minus_2 - cmn r2, #3 - beq term_minus_3 - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = 17 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample << 4 - * r3 = previous right sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = current decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample << 4 - * r7 = eptr pc = - ******************************************************************************* - */ - -term_17_loop: - rsbs ip, lr, r8, asl #5 @ decorr value = (2 * prev) - 2nd prev - mov lr, r8, asl #4 @ previous becomes 2nd previous - ldr r2, [r1], #4 @ get sample & update pointer - mov r11, #0x80000000 - mov r8, r2 - smlalne r11, r8, r4, ip - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L325 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L325: rsbs ip, r10, r3, asl #5 @ do same thing for right channel - mov r10, r3, asl #4 - ldr r2, [r1], #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r0, ip - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L329 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L329: cmp r7, r1 @ loop back if more samples to do - bhi term_17_loop - mov lr, lr, asr #4 - mov r10, r10, asr #4 - b store_1718 @ common exit for terms 17 & 18 - -/* - ****************************************************************************** - * Loop to handle term = 18 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample - * r3 = previous right sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_18_loop: - rsb ip, lr, r8 @ decorr value = - mov lr, r8 @ ((3 * prev) - 2nd prev) >> 1 - add ip, lr, ip, asr #1 - movs ip, ip, asl #4 - ldr r2, [r1], #4 @ get sample & update pointer - mov r11, #0x80000000 - mov r8, r2 - smlalne r11, r8, r4, ip - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L337 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L337: rsb ip, r10, r3 @ do same thing for right channel - mov r10, r3 - add ip, r10, ip, asr #1 - movs ip, ip, asl #4 - ldr r2, [r1], #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r0, ip - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L341 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L341: cmp r7, r1 @ loop back if more samples to do - bhi term_18_loop - -/* common exit for terms 17 & 18 */ - -store_1718: - str r3, [r5, #40] @ store sample history into struct - str r8, [r5, #8] - str r10, [r5, #44] - str lr, [r5, #12] - b common_exit @ and return - -/* - ****************************************************************************** - * Loop to handle term = 2 condition - * (note that this case can be handled by the default term handler (1-8), but - * this special case is faster because it doesn't have to read memory twice) - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current sample r10 = second previous left sample << 4 - * r3 = previous right sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = decorrelation value - * r5 = dpp sp = - * r6 = dpp->delta lr = second previous right sample << 4 - * r7 = eptr pc = - ******************************************************************************* - */ - -term_2_loop: - movs ip, lr @ get decorrelation value & test - ldr r2, [r1], #4 @ get sample & update pointer - mov lr, r8, asl #4 @ previous becomes 2nd previous - mov r11, #0x80000000 - mov r8, r2 - smlalne r11, r8, r4, ip - strne r8, [r1, #-4] @ if change possible, store sample back - cmpne r2, #0 - beq .L225 - teq ip, r2 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L225: movs ip, r10 @ do same thing for right channel - ldr r2, [r1], #4 - mov r10, r3, asl #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r0, ip - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L229 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L229: cmp r7, r1 @ loop back if more samples to do - bhi term_2_loop - - b default_term_exit @ this exit updates all dpp->samples - -/* - ****************************************************************************** - * Loop to handle default term condition - * - * r0 = dpp->weight_B r8 = result accumulator - * r1 = bptr r9 = - * r2 = dpp->term r10 = - * r3 = decorrelation value r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = - * r7 = eptr pc = - ******************************************************************************* - */ - -term_default_loop: - ldr r3, [r1, -r2, asl #3] @ get decorrelation value based on term - ldr ip, [r1], #4 @ get original sample and bump ptr - movs r3, r3, asl #4 - mov r11, #0x80000000 - mov r8, ip - smlalne r11, r8, r4, r3 - strne r8, [r1, #-4] @ if possibly changed, store updated sample - cmpne ip, #0 - beq .L350 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - -.L350: ldr r3, [r1, -r2, asl #3] @ do the same thing for right channel - ldr ip, [r1], #4 - movs r3, r3, asl #4 - mov r11, #0x80000000 - mov r8, ip - smlalne r11, r8, r0, r3 - strne r8, [r1, #-4] - cmpne ip, #0 - beq .L354 - teq ip, r3 - submi r0, r0, r6 - addpl r0, r0, r6 - -.L354: cmp r7, r1 @ loop back if more samples to do - bhi term_default_loop - -/* - * This exit is used by terms 1-8 to store the previous 8 samples into the decorr - * structure (even if they are not all used for the given term) - */ - -default_term_exit: - ldrsh r3, [r5, #0] - sub ip, r3, #1 - mov lr, #7 - -.L358: and r3, ip, #7 - add r3, r5, r3, asl #2 - ldr r2, [r1, #-4] - str r2, [r3, #40] - ldr r2, [r1, #-8]! - str r2, [r3, #8] - sub ip, ip, #1 - sub lr, lr, #1 - cmn lr, #1 - bne .L358 - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -1 condition - * - * r0 = dpp->weight_B r8 = - * r1 = bptr r9 = - * r2 = intermediate result r10 = -1024 (for clipping) - * r3 = previous right sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = updated left sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_1: - ldr r3, [r1, #-4] - -term_minus_1_loop: - ldr ip, [r1], #8 @ for left channel the decorrelation value - movs r3, r3, asl #4 @ is the previous right sample (in r3) - mov r11, #0x80000000 - mov lr, ip - smlalne r11, lr, r4, r3 - strne lr, [r1, #-8] - cmpne ip, #0 - beq .L361 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #(1024 << 18) - movgt r4, #(1024 << 18) - cmp r4, r10 - movlt r4, r10 - -.L361: ldr r2, [r1, #-4] @ for right channel the decorrelation value - movs lr, lr, asl #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r0, lr - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L369 - teq r2, lr - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #(1024 << 18) @ then clip weight to +/-1024 - movgt r0, #(1024 << 18) - cmp r0, r10 - movlt r0, r10 - -.L369: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_1_loop - - str r3, [r5, #8] @ else store right sample and exit - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -2 condition - * (note that the channels are processed in the reverse order here) - * - * r0 = dpp->weight_B r8 = - * r1 = bptr r9 = - * r2 = intermediate result r10 = -1024 (for clipping) - * r3 = previous left sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = current sample - * r5 = dpp sp = - * r6 = dpp->delta lr = updated right sample - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_2: - ldr r3, [r1, #-8] - -term_minus_2_loop: - ldr ip, [r1, #4] @ for right channel the decorrelation value - movs r3, r3, asl #4 @ is the previous left sample (in r3) - mov r11, #0x80000000 - mov lr, ip - smlalne r11, lr, r0, r3 - strne lr, [r1, #4] - cmpne ip, #0 - beq .L380 - teq ip, r3 @ update weight based on signs - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #(1024 << 18) @ then clip weight to +/-1024 - movgt r0, #(1024 << 18) - cmp r0, r10 - movlt r0, r10 - -.L380: ldr r2, [r1], #8 @ for left channel the decorrelation value - movs lr, lr, asl #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r4, lr - strne r3, [r1, #-8] - cmpne r2, #0 - beq .L388 - teq r2, lr - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #(1024 << 18) - movgt r4, #(1024 << 18) - cmp r4, r10 - movlt r4, r10 - -.L388: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_2_loop - - str r3, [r5, #40] @ else store left channel and exit - b common_exit - -/* - ****************************************************************************** - * Loop to handle term = -3 condition - * - * r0 = dpp->weight_B r8 = previous left sample - * r1 = bptr r9 = - * r2 = current left sample r10 = -1024 (for clipping) - * r3 = previous right sample r11 = lo accumulator (for rounding) - * r4 = dpp->weight_A ip = intermediate result - * r5 = dpp sp = - * r6 = dpp->delta lr = - * r7 = eptr pc = - ******************************************************************************* - */ - -term_minus_3: - ldr r3, [r1, #-4] @ load previous samples - ldr r8, [r1, #-8] - -term_minus_3_loop: - ldr ip, [r1], #4 - movs r3, r3, asl #4 - mov r11, #0x80000000 - mov r2, ip - smlalne r11, r2, r4, r3 - strne r2, [r1, #-4] - cmpne ip, #0 - beq .L399 - teq ip, r3 @ update weight based on signs - submi r4, r4, r6 - addpl r4, r4, r6 - cmp r4, #(1024 << 18) @ then clip weight to +/-1024 - movgt r4, #(1024 << 18) - cmp r4, r10 - movlt r4, r10 - -.L399: movs ip, r8, asl #4 @ ip = previous left we use now - mov r8, r2 @ r8 = current left we use next time - ldr r2, [r1], #4 - mov r11, #0x80000000 - mov r3, r2 - smlalne r11, r3, r0, ip - strne r3, [r1, #-4] - cmpne r2, #0 - beq .L407 - teq ip, r2 - submi r0, r0, r6 - addpl r0, r0, r6 - cmp r0, #(1024 << 18) - movgt r0, #(1024 << 18) - cmp r0, r10 - movlt r0, r10 - -.L407: cmp r7, r1 @ loop back if more samples to do - bhi term_minus_3_loop - - str r3, [r5, #8] @ else store previous samples & exit - str r8, [r5, #40] - -/* - * Before finally exiting we must store weights back for next time - */ - -common_exit: - mov r0, r0, asr #18 @ restore weights to real magnitude - mov r4, r4, asr #18 - strh r4, [r5, #4] - strh r0, [r5, #6] - ldmfd sp!, {r4 - r8, r10, r11, pc} - diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/bits.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/bits.c deleted file mode 100644 index b4f03385e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/bits.c +++ /dev/null @@ -1,140 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// bits.c - -// This module provides utilities to support the BitStream structure which is -// used to read and write all WavPack audio data streams. It also contains a -// wrapper for the stream I/O functions and a set of functions dealing with -// endian-ness, both for enhancing portability. Finally, a debug wrapper for -// the malloc() system is provided. - -#include "wavpack.h" - -#include -#include - -////////////////////////// Bitstream functions //////////////////////////////// - -// Open the specified BitStream and associate with the specified buffer. - -static void bs_read (Bitstream *bs); - -void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes) -{ - CLEAR (*bs); - bs->buf = buffer_start; - bs->end = buffer_end; - - if (file) { - bs->ptr = bs->end - 1; - bs->file_bytes = file_bytes; - bs->file = file; - } - else - bs->ptr = bs->buf - 1; - - bs->wrap = bs_read; -} - -// This function is only called from the getbit() and getbits() macros when -// the BitStream has been exhausted and more data is required. Sinve these -// bistreams no longer access files, this function simple sets an error and -// resets the buffer. - -static void bs_read (Bitstream *bs) -{ - if (bs->file && bs->file_bytes) { - uint32_t bytes_read, bytes_to_read = bs->end - bs->buf; - - if (bytes_to_read > bs->file_bytes) - bytes_to_read = bs->file_bytes; - - bytes_read = bs->file (bs->buf, bytes_to_read); - - if (bytes_read) { - bs->end = bs->buf + bytes_read; - bs->file_bytes -= bytes_read; - } - else { - memset (bs->buf, -1, bs->end - bs->buf); - bs->error = 1; - } - } - else - bs->error = 1; - - if (bs->error) - memset (bs->buf, -1, bs->end - bs->buf); - - bs->ptr = bs->buf; -} - -/////////////////////// Endian Correction Routines //////////////////////////// - -void little_endian_to_native (void *data, char *format) -{ - uchar *cp = (uchar *) data; - int32_t temp; - - while (*format) { - switch (*format) { - case 'L': - temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24); - * (int32_t *) cp = temp; - cp += 4; - break; - - case 'S': - temp = cp [0] + (cp [1] << 8); - * (short *) cp = (short) temp; - cp += 2; - break; - - default: - if (isdigit (*format)) - cp += *format - '0'; - - break; - } - - format++; - } -} - -void native_to_little_endian (void *data, char *format) -{ - uchar *cp = (uchar *) data; - int32_t temp; - - while (*format) { - switch (*format) { - case 'L': - temp = * (int32_t *) cp; - *cp++ = (uchar) temp; - *cp++ = (uchar) (temp >> 8); - *cp++ = (uchar) (temp >> 16); - *cp++ = (uchar) (temp >> 24); - break; - - case 'S': - temp = * (short *) cp; - *cp++ = (uchar) temp; - *cp++ = (uchar) (temp >> 8); - break; - - default: - if (isdigit (*format)) - cp += *format - '0'; - - break; - } - - format++; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/coldfire.S b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/coldfire.S deleted file mode 100644 index 83530900c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/coldfire.S +++ /dev/null @@ -1,525 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -/* This is an assembly optimized version of the following WavPack function: - * - * void decorr_stereo_pass_cont (struct decorr_pass *dpp, - * long *buffer, long sample_count); - * - * It performs a single pass of stereo decorrelation on the provided buffer. - * Note that this version of the function requires that the 8 previous stereo - * samples are visible and correct. In other words, it ignores the "samples_*" - * fields in the decorr_pass structure and gets the history data directly - * from the buffer. It does, however, return the appropriate history samples - * to the decorr_pass structure before returning. - * - * This is written to work on a MCF5249 processor, or any processor based on - * the ColdFire V2 core with an EMAC unit. The EMAC is perfectly suited for - * the "apply_weight" function of WavPack decorrelation because it provides - * the requires 40-bit product. The fractional rounding mode of the EMAC is not - * configurable and uses "round to even" while WavPack uses "round to larger", - * so the rounding has to be done manually. - */ - - .text - .align 2 - .global decorr_stereo_pass_cont_mcf5249 - -decorr_stereo_pass_cont_mcf5249: - - lea (-44, %sp), %sp - movem.l %d2-%d7/%a2-%a6, (%sp) - move.l 44+4(%sp), %a2 | a2 = dpp-> - move.l 44+8(%sp), %a1 | a1 = bptr - move.w 2(%a2), %a3 | a3 = dpp->delta - move.w 4(%a2), %d3 | d3 = dpp->weight_A (sign extended) - ext.l %d3 - move.w 6(%a2), %d4 | d4 = dpp->weight_B (sign extended) - ext.l %d4 - move.l 44+12(%sp), %d0 | d0 = sample_count - jbeq return_only | if zero, nothing to do - - lsl.l #3, %d0 | d5 = bptr + (sample_count * 8) - move.l %d0, %d5 - add.l %a1, %d5 - - moveq.l #17, %d0 | left shift weights & delta 17 places - asl.l %d0, %d3 - asl.l %d0, %d4 - move.l %a3, %d1 - asl.l %d0, %d1 - move.l %d1, %a3 - - moveq.l #0x20, %d6 - move.l %d6, %macsr | set fractional mode for MAC - move.l #0, %acc1 | acc1 = 0x00 0000 80 (for rounding) - move.l #0x800000, %accext01 - - move.l #1024<<17, %d6 | d6 & d7 are weight clipping limits - move.l #-1024<<17, %d7 | (only used by negative terms) - - move.w (%a2), %d0 | d0 = term - ext.l %d0 - cmp.l #17, %d0 - jbeq term_17 | term = 17 - cmp.l #18, %d0 - jbeq term_18 | term = 18 - addq.l #1, %d0 - jbeq term_minus_1 | term = -1 - addq.l #1, %d0 - jbeq term_minus_2 | term = -2 - addq.l #1, %d0 - jbeq term_minus_3 | term = -3 - jbra term_default | default term = 1 - 8 - -|------------------------------------------------------------------------------ -| Loop to handle term = 17 condition -| -| a0 = d0 = (2 * bptr [-1]) - bptr [-2] -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_17: - move.l -8(%a1), %d0 | d0 = 2 * bptr [-1] - bptr [-2] - add.l %d0, %d0 - sub.l -16(%a1), %d0 - beq .L251 | if zero, skip calculation - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_A - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L255 - eor.l %d1, %d0 | else compare signs - bge .L256 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - sub.l %a3, %d3 | subtract again instead of branch -.L256: add.l %a3, %d3 | add delta to weight - -.L255: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | update bptr [0] and store - move.l %d2, (%a1)+ - -.L253: move.l -8(%a1), %d0 | d0 = 2 * bptr [-1] - bptr [-2] - add.l %d0, %d0 - sub.l -16(%a1), %d0 - beq .L257 | if zero, skip calculations - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_B - mac.l %d0, %d4, %acc0 - move.l (%a1), %d1 - beq .L254 - eor.l %d1, %d0 | else compare signs - bge .L259 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - sub.l %a3, %d4 | subtract again instead of branch -.L259: add.l %a3, %d4 | add delta to weight - -.L254: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | update bptr [0] and store - move.l %d2, (%a1)+ - -.L252: cmp.l %a1, %d5 | loop if bptr < eptr - jbhi term_17 - bra term_17_18_finish | exit through common path - -.L251: addq.l #4, %a1 | update point and jump back into loop - bra .L253 - -.L257: addq.l #4, %a1 | update point and jump back into loop - bra .L252 - -|------------------------------------------------------------------------------ -| Loop to handle term = 18 condition -| -| a0 = d0 = ((3 * bptr [-1]) - bptr [-2]) >> 1 -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_18: - move.l -8(%a1), %a0 | d0 = (3 * bptr [-1] - bptr [-2]) >> 1 - lea (%a0,%a0.l*2), %a0 - move.l %a0, %d0 - sub.l -16(%a1), %d0 - asr.l #1, %d0 - beq .L260 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_A - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L266 - eor.l %d1, %d0 | else compare signs - bge .L267 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - sub.l %a3, %d3 | subtract again instead of branch -.L267: add.l %a3, %d3 | add delta to weight - -.L266: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [0], store - move.l %d2, (%a1)+ - -.L268: move.l -8(%a1), %a0 | d0 = (3 * bptr [-1] - bptr [-2]) >> 1 - lea (%a0,%a0.l*2), %a0 - move.l %a0, %d0 - sub.l -16(%a1), %d0 - asr.l #1, %d0 - beq .L261 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_B - mac.l %d0, %d4, %acc0 - move.l (%a1), %d1 - beq .L265 - eor.l %d1, %d0 | else compare signs - bge .L270 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - sub.l %a3, %d4 | subtract again instead of branch -.L270: add.l %a3, %d4 | add delta to weight - -.L265: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [0], store - move.l %d2, (%a1)+ - -.L269: cmp.l %a1, %d5 | loop if bptr < eptr - jbhi term_18 - bra term_17_18_finish | exit through common path - -.L260: addq.l #4, %a1 | bump pointer and jump back into loop - bra .L268 - -.L261: addq.l #4, %a1 | bump pointer and jump back into loop - bra .L269 - -term_17_18_finish: - move.l -4(%a1), 40(%a2) | restore dpp->samples_A [0-1], B [0-1] - move.l -8(%a1), 8(%a2) - move.l -12(%a1), 44(%a2) - move.l -16(%a1), 12(%a2) - jbra finish_up - -|------------------------------------------------------------------------------ -| Loop to handle default terms (i.e. 1 - 8) -| -| a0 = tptr d0 = tptr [0] -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_default: - move.w (%a2), %d0 | a0 = a1 - (dpp->term * 8) - ext.l %d0 - lsl.l #3, %d0 - move.l %a1, %a0 - sub.l %d0, %a0 - -term_default_loop: - move.l (%a0)+, %d0 | d0 = tptr [0], skip ahead if zero - beq .L271 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_A - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L277 - eor.l %d1, %d0 | else compare signs - bge .L278 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - sub.l %a3, %d3 | subtract again instead of branch -.L278: add.l %a3, %d3 | add delta to weight - -.L277: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [0], store - move.l %d2, (%a1)+ - -.L275: move.l (%a0)+, %d0 | d0 = tptr [0], skip ahead if zero - beq .L272 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + (d0 << 4) * weight_B - mac.l %d0, %d4, %acc0 - move.l (%a1), %d1 - beq .L276 - eor.l %d1, %d0 | else compare signs - bge .L281 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - sub.l %a3, %d4 | subtract again instead of branch -.L281: add.l %a3, %d4 | add delta to weight - -.L276: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [0], store - move.l %d2, (%a1)+ - -.L274: cmp.l %a1, %d5 | loop back if bptr < eptr - jbhi term_default_loop - move.w (%a2), %d0 | d0 = term - 1 - moveq.l #8, %d1 | d1 = loop counter - -.L323: subq.l #1, %d0 | back up & mask index - and.l #7, %d0 - move.l -(%a1), 40(%a2,%d0.l*4) | store dpp->samples_B [d0] - move.l -(%a1), 8(%a2,%d0.l*4) | store dpp->samples_A [d0] - subq.l #1, %d1 | loop on count - jbne .L323 - jbra finish_up - -.L271: addq.l #4, %a1 | bump pointer and jump back into loop - bra .L275 - -.L272: addq.l #4, %a1 | bump pointer and jump back into loop - bra .L274 - - -|------------------------------------------------------------------------------ -| Loop to handle term = -1 condition -| -| a0 = d0 = decorrelation sample -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| a6 = d6 = 1024 << 17 -| a7 = d7 = -1024 << 17 -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_minus_1: - move.l -4(%a1), %d0 | d0 = bptr [-1] - beq .L402 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_A) - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L405 - eor.l %d1, %d0 | else compare signs - bge .L404 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - cmp.l %d7, %d3 | check for negative clip limit - bge .L405 - move.l %d7, %d3 - bra .L405 - -.L404: add.l %a3, %d3 | add delta to weight - cmp.l %d6, %d3 | check for positive clip limit - ble .L405 - move.l %d6, %d3 - -.L405: move.l %acc0, %d0 | d2 = rounded product - add.l %d1, %d0 | add applied weight to bptr [0], store - move.l %d0, (%a1)+ - beq .L401 - -.L410: move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_B) - mac.l %d0, %d4, %acc0 - move.l (%a1), %d1 - beq .L403 - eor.l %d1, %d0 | else compare signs - bge .L407 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - cmp.l %d7, %d4 | check for negative clip limit - bge .L403 - move.l %d7, %d4 - bra .L403 - -.L407: add.l %a3, %d4 | add delta to weight - cmp.l %d6, %d4 | check for positive clip limit - ble .L403 - move.l %d6, %d4 - -.L403: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [1], store - move.l %d2, (%a1)+ - -.L411: cmp.l %a1, %d5 | loop back if bptr < eptr - jbhi term_minus_1 - move.l -4(%a1), 8(%a2) | dpp->samples_A [0] = bptr [-1] - jbra finish_up - -.L402: move.l (%a1)+, %d0 - bne .L410 - -.L401: addq.l #4, %a1 - bra .L411 - - -|------------------------------------------------------------------------------ -| Loop to handle term = -2 condition -| -| a0 = d0 = decorrelation sample -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| a6 = d6 = 1024 << 17 -| a7 = d7 = -1024 << 17 -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_minus_2: - move.l -8(%a1), %d0 | d0 = bptr [-2] - beq .L511 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_B) - mac.l %d0, %d4, %acc0 - move.l 4(%a1), %d1 - beq .L505 - eor.l %d1, %d0 | else compare signs - bge .L504 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - cmp.l %d7, %d4 | ckeck for negative clip limit - bge .L505 - move.l %d7, %d4 - bra .L505 - -.L504: add.l %a3, %d4 | add delta to weight - cmp.l %d6, %d4 | check for positive clip limit - ble .L505 - move.l %d6, %d4 - -.L505: move.l %acc0, %d0 | d2 = rounded product - add.l %d1, %d0 | add applied weight to bptr [0], store - move.l %d0, 4(%a1) - beq .L512 - -.L510: move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_A) - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L503 - eor.l %d1, %d0 | else compare signs - bge .L507 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - cmp.l %d7, %d3 | check for negative clip limit - bge .L503 - move.l %d7, %d3 - bra .L503 - -.L507: add.l %a3, %d3 | add delta to weight - cmp.l %d6, %d3 | check for negative clip limit - ble .L503 - move.l %d6, %d3 - -.L503: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [1], store - move.l %d2, (%a1) - -.L512: addq.l #8, %a1 - cmp.l %a1, %d5 | loop if bptr < eptr - jbhi term_minus_2 - move.l -8(%a1), 40(%a2) | dpp->samples_B [0] = bptr [-4] - jbra finish_up - -.L511: move.l 4(%a1), %d0 - beq .L512 - bra .L510 - - -|------------------------------------------------------------------------------ -| Loop to handle term = -3 condition -| -| a0 = d0 = decorrelation sample -| a1 = bptr d1 = initial bptr [0] -| a2 = dpp-> d2 = updated bptr [0] -| a3 = dpp->delta << 17 d3 = dpp->weight_A << 17 -| a4 = d4 = dpp->weight_B << 17 -| a5 = d5 = eptr -| a6 = d6 = 1024 << 17 -| a7 = d7 = -1024 << 17 -| macsr = 0x20 acc1 = 0x00 0000 80 -|------------------------------------------------------------------------------ - -term_minus_3: - move.l -4(%a1), %d0 | d0 = bptr [-1] - beq .L301 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_A) - mac.l %d0, %d3, %acc0 - move.l (%a1), %d1 - beq .L320 - eor.l %d1, %d0 | else compare signs - bge .L319 | if same, add delta to weight - sub.l %a3, %d3 | else subtract delta from weight - cmp.l %d7, %d3 | check for negative clip limit - bge .L320 - move.l %d7, %d3 - bra .L320 - -.L319: add.l %a3, %d3 | add delta to weight - cmp.l %d6, %d3 | check for positive clip limit - ble .L320 - move.l %d6, %d3 - -.L320: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [0], store - move.l %d2, (%a1)+ - -.L330: move.l -12(%a1), %d0 | d0 = bptr [-2] - beq .L302 - move.l %acc1, %acc0 - asl.l #4, %d0 | acc0 = acc1 + ((d0 << 4) * weight_B) - mac.l %d0, %d4, %acc0 - move.l (%a1), %d1 - beq .L318 - eor.l %d1, %d0 | else compare signs - bge .L322 | if same, add delta to weight - sub.l %a3, %d4 | else subtract delta from weight - cmp.l %d7, %d4 | check for negative clip limit - bge .L318 - move.l %d7, %d4 - bra .L318 - -.L322: add.l %a3, %d4 | add delta to weight - cmp.l %d6, %d4 | check for positive clip limit - ble .L318 - move.l %d6, %d4 - -.L318: move.l %acc0, %d2 | d2 = rounded product - add.l %d1, %d2 | add applied weight to bptr [1], store - move.l %d2, (%a1)+ - -.L331: cmp.l %a1, %d5 | bptr, eptr - jbhi term_minus_3 - move.l -4(%a1), 8(%a2) | dpp->samples_A [0] = bptr [-1] - move.l -8(%a1), 40(%a2) | dpp->samples_B [0] = bptr [-2] - jbra finish_up - -.L301: addq.l #4, %a1 - bra .L330 - -.L302: addq.l #4, %a1 - bra .L331 - -| finish and return - -finish_up: - moveq.l #17, %d0 - asr.l %d0, %d3 - asr.l %d0, %d4 - move.w %d3, 4(%a2) | weight_A, dpp->weight_A - move.w %d4, 6(%a2) | weight_B, dpp->weight_B - - clr.l %d0 | clear up EMAC - move.l %d0, %acc0 - move.l %d0, %acc1 - -return_only: - movem.l (%sp), %d2-%d7/%a2-%a6 - lea (44,%sp), %sp - rts diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/float.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/float.c deleted file mode 100644 index 09f0e4c36..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/float.c +++ /dev/null @@ -1,50 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// float.c - -#include "wavpack.h" - -int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd) -{ - int bytecnt = wpmd->byte_length; - char *byteptr = wpmd->data; - - if (bytecnt != 4) - return FALSE; - - wps->float_flags = *byteptr++; - wps->float_shift = *byteptr++; - wps->float_max_exp = *byteptr++; - wps->float_norm_exp = *byteptr; - return TRUE; -} - -void float_values (WavpackStream *wps, int32_t *values, int32_t num_values) -{ - int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift; - - if (shift > 32) - shift = 32; - else if (shift < -32) - shift = -32; - - while (num_values--) { - if (shift > 0) - *values <<= shift; - else if (shift < 0) - *values >>= -shift; - - if (*values > 8388607L) - *values = 8388607L; - else if (*values < -8388608L) - *values = -8388608L; - - values++; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/license.txt b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/license.txt deleted file mode 100644 index d2ee90fc7..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/license.txt +++ /dev/null @@ -1,25 +0,0 @@ - Copyright (c) 1998 - 2006 Conifer Software - All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Conifer Software nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/metadata.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/metadata.c deleted file mode 100644 index 6a19ac9bb..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/metadata.c +++ /dev/null @@ -1,105 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// metadata.c - -// This module handles the metadata structure introduced in WavPack 4.0 - -#include "wavpack.h" - -int read_metadata_buff (WavpackContext *wpc, WavpackMetadata *wpmd) -{ - uchar tchar; - - if (!wpc->infile (&wpmd->id, 1) || !wpc->infile (&tchar, 1)) - return FALSE; - - wpmd->byte_length = tchar << 1; - - if (wpmd->id & ID_LARGE) { - wpmd->id &= ~ID_LARGE; - - if (!wpc->infile (&tchar, 1)) - return FALSE; - - wpmd->byte_length += (int32_t) tchar << 9; - - if (!wpc->infile (&tchar, 1)) - return FALSE; - - wpmd->byte_length += (int32_t) tchar << 17; - } - - if (wpmd->id & ID_ODD_SIZE) { - wpmd->id &= ~ID_ODD_SIZE; - wpmd->byte_length--; - } - - if (wpmd->byte_length && wpmd->byte_length <= sizeof (wpc->read_buffer)) { - uint32_t bytes_to_read = wpmd->byte_length + (wpmd->byte_length & 1); - - if (wpc->infile (wpc->read_buffer, bytes_to_read) != (int32_t) bytes_to_read) { - wpmd->data = NULL; - return FALSE; - } - - wpmd->data = wpc->read_buffer; - } - else - wpmd->data = NULL; - - return TRUE; -} - -int process_metadata (WavpackContext *wpc, WavpackMetadata *wpmd) -{ - WavpackStream *wps = &wpc->stream; - - switch (wpmd->id) { - case ID_DUMMY: - return TRUE; - - case ID_DECORR_TERMS: - return read_decorr_terms (wps, wpmd); - - case ID_DECORR_WEIGHTS: - return read_decorr_weights (wps, wpmd); - - case ID_DECORR_SAMPLES: - return read_decorr_samples (wps, wpmd); - - case ID_ENTROPY_VARS: - return read_entropy_vars (wps, wpmd); - - case ID_HYBRID_PROFILE: - return read_hybrid_profile (wps, wpmd); - - case ID_FLOAT_INFO: - return read_float_info (wps, wpmd); - - case ID_INT32_INFO: - return read_int32_info (wps, wpmd); - - case ID_CHANNEL_INFO: - return read_channel_info (wpc, wpmd); - - case ID_CONFIG_BLOCK: - return read_config_info (wpc, wpmd); - - case ID_WV_BITSTREAM: - return init_wv_bitstream (wpc, wpmd); - - case ID_SHAPING_WEIGHTS: - case ID_WVC_BITSTREAM: - case ID_WVX_BITSTREAM: - return TRUE; - - default: - return (wpmd->id & ID_OPTIONAL_DATA) ? TRUE : FALSE; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/readme.txt b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/readme.txt deleted file mode 100644 index 07b7a261d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/readme.txt +++ /dev/null @@ -1,68 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -This package contains a tiny version of the WavPack 4.40 decoder that might -be used in a "resource limited" CPU environment or form the basis for a -hardware decoding implementation. It is packaged with a demo command-line -program that accepts a WavPack audio file on stdin and outputs a RIFF wav -file to stdout. The program is standard C, and a win32 executable is -included which was compiled under MS Visual C++ 6.0 using this command: - -cl /O1 /DWIN32 wvfilter.c wputils.c unpack.c float.c metadata.c words.c bits.c - -WavPack data is read with a stream reading callback. No direct seeking is -provided for, but it is possible to start decoding anywhere in a WavPack -stream. In this case, WavPack will be able to provide the sample-accurate -position when it synchs with the data and begins decoding. The WIN32 macro -is used for Windows to force the stdin and stdout streams to be binary mode. - -Compared to the previous version, this library has been optimized somewhat -for improved performance in exchange for slightly larger code size. The -library also now includes hand-optimized assembly language versions of the -decorrelation functions for both the ColdFire (w/EMAC) and ARM processors. - -For demonstration purposes this uses a single static copy of the -WavpackContext structure, so obviously it cannot be used for more than one -file at a time. Also, this decoder will not handle "correction" files, plays -only the first two channels of multi-channel files, and is limited in -resolution in some large integer or floating point files (but always -provides at least 24 bits of resolution). It also will not accept WavPack -files from before version 4.0. - -The previous version of this library would handle float files by returning -32-bit floating-point data (even though no floating point math was used). -Because this library would normally be used for simply playing WavPack -files where lossless performance (beyond 24-bits) is not relevant, I have -changed this behavior. Now, these files will generate clipped 24-bit data. -The MODE_FLOAT flag will still be returned by WavpackGetMode(), but the -BitsPerSample and BytesPerSample queries will be 24 and 3, respectfully. -What this means is that an application that can handle 24-bit data will -now be able to handle floating point data (assuming that the MODE_FLOAT -flag is ignored). - -To make this code viable on the greatest number of hardware platforms, the -following are true: - - speed is about 5x realtime on an AMD K6 300 MHz - ("high" mode 16/44 stereo; normal mode is about twice that fast) - - no floating-point math required; just 32b * 32b = 32b int multiply - - large data areas are static and less than 4K total - executable code and tables are less than 40K - no malloc / free usage - -To maintain compatibility on various platforms, the following conventions -are used: - - a "char" must be exactly 8-bits - a "short" must be exactly 16-bits - an "int" must be at least 16-bits, but may be larger - the "long" type is not used to avoid problems with 64-bit compilers - -Questions or comments should be directed to david@wavpack.com diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/unpack.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/unpack.c deleted file mode 100644 index 317fe2227..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/unpack.c +++ /dev/null @@ -1,785 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// unpack.c - -// This module actually handles the decompression of the audio data, except -// for the entropy decoding which is handled by the words.c module. For -// maximum efficiency, the conversion is isolated to tight loops that handle -// an entire buffer. - -#include "wavpack.h" - -#include -#include - -#define LOSSY_MUTE - -///////////////////////////// executable code //////////////////////////////// - -// This function initializes everything required to unpack a WavPack block -// and must be called before unpack_samples() is called to obtain audio data. -// It is assumed that the WavpackHeader has been read into the wps->wphdr -// (in the current WavpackStream). This is where all the metadata blocks are -// scanned up to the one containing the audio bitstream. - -int unpack_init (WavpackContext *wpc) -{ - WavpackStream *wps = &wpc->stream; - WavpackMetadata wpmd; - - if (wps->wphdr.block_samples && wps->wphdr.block_index != (uint32_t) -1) - wps->sample_index = wps->wphdr.block_index; - - wps->mute_error = FALSE; - wps->crc = 0xffffffff; - CLEAR (wps->wvbits); - CLEAR (wps->decorr_passes); - CLEAR (wps->w); - - while (read_metadata_buff (wpc, &wpmd)) { - if (!process_metadata (wpc, &wpmd)) { - strcpy (wpc->error_message, "invalid metadata!"); - return FALSE; - } - - if (wpmd.id == ID_WV_BITSTREAM) - break; - } - - if (wps->wphdr.block_samples && !bs_is_open (&wps->wvbits)) { - strcpy (wpc->error_message, "invalid WavPack file!"); - return FALSE; - } - - if (wps->wphdr.block_samples) { - if ((wps->wphdr.flags & INT32_DATA) && wps->int32_sent_bits) - wpc->lossy_blocks = TRUE; - - if ((wps->wphdr.flags & FLOAT_DATA) && - wps->float_flags & (FLOAT_EXCEPTIONS | FLOAT_ZEROS_SENT | FLOAT_SHIFT_SENT | FLOAT_SHIFT_SAME)) - wpc->lossy_blocks = TRUE; - } - - return TRUE; -} - -// This function initialzes the main bitstream for audio samples, which must -// be in the "wv" file. - -int init_wv_bitstream (WavpackContext *wpc, WavpackMetadata *wpmd) -{ - WavpackStream *wps = &wpc->stream; - - if (wpmd->data) - bs_open_read (&wps->wvbits, wpmd->data, (unsigned char *) wpmd->data + wpmd->byte_length, NULL, 0); - else if (wpmd->byte_length) - bs_open_read (&wps->wvbits, wpc->read_buffer, wpc->read_buffer + sizeof (wpc->read_buffer), - wpc->infile, wpmd->byte_length + (wpmd->byte_length & 1)); - - return TRUE; -} - -// Read decorrelation terms from specified metadata block into the -// decorr_passes array. The terms range from -3 to 8, plus 17 & 18; -// other values are reserved and generate errors for now. The delta -// ranges from 0 to 7 with all values valid. Note that the terms are -// stored in the opposite order in the decorr_passes array compared -// to packing. - -int read_decorr_terms (WavpackStream *wps, WavpackMetadata *wpmd) -{ - int termcnt = wpmd->byte_length; - uchar *byteptr = wpmd->data; - struct decorr_pass *dpp; - - if (termcnt > MAX_NTERMS) - return FALSE; - - wps->num_terms = termcnt; - - for (dpp = wps->decorr_passes + termcnt - 1; termcnt--; dpp--) { - dpp->term = (int)(*byteptr & 0x1f) - 5; - dpp->delta = (*byteptr++ >> 5) & 0x7; - - if (!dpp->term || dpp->term < -3 || (dpp->term > MAX_TERM && dpp->term < 17) || dpp->term > 18) - return FALSE; - } - - return TRUE; -} - -// Read decorrelation weights from specified metadata block into the -// decorr_passes array. The weights range +/-1024, but are rounded and -// truncated to fit in signed chars for metadata storage. Weights are -// separate for the two channels and are specified from the "last" term -// (first during encode). Unspecified weights are set to zero. - -int read_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd) -{ - int termcnt = wpmd->byte_length, tcount; - signed char *byteptr = wpmd->data; - struct decorr_pass *dpp; - - if (!(wps->wphdr.flags & MONO_DATA)) - termcnt /= 2; - - if (termcnt > wps->num_terms) - return FALSE; - - for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) - dpp->weight_A = dpp->weight_B = 0; - - while (--dpp >= wps->decorr_passes && termcnt--) { - dpp->weight_A = restore_weight (*byteptr++); - - if (!(wps->wphdr.flags & MONO_DATA)) - dpp->weight_B = restore_weight (*byteptr++); - } - - return TRUE; -} - -// Read decorrelation samples from specified metadata block into the -// decorr_passes array. The samples are signed 32-bit values, but are -// converted to signed log2 values for storage in metadata. Values are -// stored for both channels and are specified from the "last" term -// (first during encode) with unspecified samples set to zero. The -// number of samples stored varies with the actual term value, so -// those must obviously come first in the metadata. - -int read_decorr_samples (WavpackStream *wps, WavpackMetadata *wpmd) -{ - uchar *byteptr = wpmd->data; - uchar *endptr = byteptr + wpmd->byte_length; - struct decorr_pass *dpp; - int tcount; - - for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) { - CLEAR (dpp->samples_A); - CLEAR (dpp->samples_B); - } - - if (wps->wphdr.version == 0x402 && (wps->wphdr.flags & HYBRID_FLAG)) { - byteptr += 2; - - if (!(wps->wphdr.flags & MONO_DATA)) - byteptr += 2; - } - - while (dpp-- > wps->decorr_passes && byteptr < endptr) - if (dpp->term > MAX_TERM) { - dpp->samples_A [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - dpp->samples_A [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); - byteptr += 4; - - if (!(wps->wphdr.flags & MONO_DATA)) { - dpp->samples_B [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - dpp->samples_B [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); - byteptr += 4; - } - } - else if (dpp->term < 0) { - dpp->samples_A [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - dpp->samples_B [0] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); - byteptr += 4; - } - else { - int m = 0, cnt = dpp->term; - - while (cnt--) { - dpp->samples_A [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - byteptr += 2; - - if (!(wps->wphdr.flags & MONO_DATA)) { - dpp->samples_B [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - byteptr += 2; - } - - m++; - } - } - - return byteptr == endptr; -} - -// Read the int32 data from the specified metadata into the specified stream. -// This data is used for integer data that has more than 24 bits of magnitude -// or, in some cases, used to eliminate redundant bits from any audio stream. - -int read_int32_info (WavpackStream *wps, WavpackMetadata *wpmd) -{ - int bytecnt = wpmd->byte_length; - char *byteptr = wpmd->data; - - if (bytecnt != 4) - return FALSE; - - wps->int32_sent_bits = *byteptr++; - wps->int32_zeros = *byteptr++; - wps->int32_ones = *byteptr++; - wps->int32_dups = *byteptr; - return TRUE; -} - -// Read multichannel information from metadata. The first byte is the total -// number of channels and the following bytes represent the channel_mask -// as described for Microsoft WAVEFORMATEX. - -int read_channel_info (WavpackContext *wpc, WavpackMetadata *wpmd) -{ - int bytecnt = wpmd->byte_length, shift = 0; - char *byteptr = wpmd->data; - uint32_t mask = 0; - - if (!bytecnt || bytecnt > 5) - return FALSE; - - wpc->config.num_channels = *byteptr++; - - while (--bytecnt) { - mask |= (uint32_t) *byteptr++ << shift; - shift += 8; - } - - wpc->config.channel_mask = mask; - return TRUE; -} - -// Read configuration information from metadata. - -int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd) -{ - int bytecnt = wpmd->byte_length; - uchar *byteptr = wpmd->data; - - if (bytecnt >= 3) { - wpc->config.flags &= 0xff; - wpc->config.flags |= (int32_t) *byteptr++ << 8; - wpc->config.flags |= (int32_t) *byteptr++ << 16; - wpc->config.flags |= (int32_t) *byteptr << 24; - } - - return TRUE; -} - -// This monster actually unpacks the WavPack bitstream(s) into the specified -// buffer as 32-bit integers or floats (depending on orignal data). Lossy -// samples will be clipped to their original limits (i.e. 8-bit samples are -// clipped to -128/+127) but are still returned in int32_ts. It is up to the -// caller to potentially reformat this for the final output including any -// multichannel distribution, block alignment or endian compensation. The -// function unpack_init() must have been called and the entire WavPack block -// must still be visible (although wps->blockbuff will not be accessed again). -// For maximum clarity, the function is broken up into segments that handle -// various modes. This makes for a few extra infrequent flag checks, but -// makes the code easier to follow because the nesting does not become so -// deep. For maximum efficiency, the conversion is isolated to tight loops -// that handle an entire buffer. The function returns the total number of -// samples unpacked, which can be less than the number requested if an error -// occurs or the end of the block is reached. - -#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) -extern void decorr_stereo_pass_cont_mcf5249 (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -#elif defined(CPU_ARM) && !defined(SIMULATOR) -extern void decorr_stereo_pass_cont_arm (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -extern void decorr_stereo_pass_cont_arml (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -#else -static void decorr_stereo_pass_cont (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -#endif - -static void decorr_mono_pass (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -static void decorr_stereo_pass (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count); -static void fixup_samples (WavpackStream *wps, int32_t *buffer, uint32_t sample_count); - -int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count) -{ - WavpackStream *wps = &wpc->stream; - uint32_t flags = wps->wphdr.flags, crc = wps->crc, i; - int32_t mute_limit = (1L << ((flags & MAG_MASK) >> MAG_LSB)) + 2; - struct decorr_pass *dpp; - int32_t *bptr, *eptr; - int tcount; - - if (wps->sample_index + sample_count > wps->wphdr.block_index + wps->wphdr.block_samples) - sample_count = wps->wphdr.block_index + wps->wphdr.block_samples - wps->sample_index; - - if (wps->mute_error) { - memset (buffer, 0, sample_count * (flags & MONO_FLAG ? 4 : 8)); - wps->sample_index += sample_count; - return sample_count; - } - - if (flags & HYBRID_FLAG) - mute_limit *= 2; - - ///////////////////// handle version 4 mono data ///////////////////////// - - if (flags & MONO_DATA) { - eptr = buffer + sample_count; - i = get_words (buffer, sample_count, flags, &wps->w, &wps->wvbits); - - for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) - decorr_mono_pass (dpp, buffer, sample_count); - - for (bptr = buffer; bptr < eptr; ++bptr) { - if (labs (bptr [0]) > mute_limit) { - i = bptr - buffer; - break; - } - - crc = crc * 3 + bptr [0]; - } - } - - //////////////////// handle version 4 stereo data //////////////////////// - - else { - eptr = buffer + (sample_count * 2); - i = get_words (buffer, sample_count, flags, &wps->w, &wps->wvbits); - - if (sample_count < 16) - for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) - decorr_stereo_pass (dpp, buffer, sample_count); - else - for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) { - decorr_stereo_pass (dpp, buffer, 8); -#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) - decorr_stereo_pass_cont_mcf5249 (dpp, buffer + 16, sample_count - 8); -#elif defined(CPU_ARM) && !defined(SIMULATOR) - if (((flags & MAG_MASK) >> MAG_LSB) > 15) - decorr_stereo_pass_cont_arml (dpp, buffer + 16, sample_count - 8); - else - decorr_stereo_pass_cont_arm (dpp, buffer + 16, sample_count - 8); -#else - decorr_stereo_pass_cont (dpp, buffer + 16, sample_count - 8); -#endif - } - - if (flags & JOINT_STEREO) - for (bptr = buffer; bptr < eptr; bptr += 2) { - bptr [0] += (bptr [1] -= (bptr [0] >> 1)); - - if (labs (bptr [0]) > mute_limit || labs (bptr [1]) > mute_limit) { - i = (bptr - buffer) / 2; - break; - } - - crc = (crc * 3 + bptr [0]) * 3 + bptr [1]; - } - else - for (bptr = buffer; bptr < eptr; bptr += 2) { - if (labs (bptr [0]) > mute_limit || labs (bptr [1]) > mute_limit) { - i = (bptr - buffer) / 2; - break; - } - - crc = (crc * 3 + bptr [0]) * 3 + bptr [1]; - } - } - - if (i != sample_count) { - memset (buffer, 0, sample_count * (flags & MONO_FLAG ? 4 : 8)); - wps->mute_error = TRUE; - i = sample_count; - } - - fixup_samples (wps, buffer, i); - - if (flags & FALSE_STEREO) { - int32_t *dptr = buffer + i * 2; - int32_t *sptr = buffer + i; - int32_t c = i; - - while (c--) { - *--dptr = *--sptr; - *--dptr = *sptr; - } - } - - wps->sample_index += i; - wps->crc = crc; - - return i; -} - -static void decorr_stereo_pass (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count) -{ - int32_t delta = dpp->delta, weight_A = dpp->weight_A, weight_B = dpp->weight_B; - int32_t *bptr, *eptr = buffer + (sample_count * 2), sam_A, sam_B; - int m, k; - - switch (dpp->term) { - - case 17: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = 2 * dpp->samples_A [0] - dpp->samples_A [1]; - dpp->samples_A [1] = dpp->samples_A [0]; - dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [0]; - - sam_A = 2 * dpp->samples_B [0] - dpp->samples_B [1]; - dpp->samples_B [1] = dpp->samples_B [0]; - dpp->samples_B [0] = apply_weight (weight_B, sam_A) + bptr [1]; - update_weight (weight_B, delta, sam_A, bptr [1]); - bptr [1] = dpp->samples_B [0]; - } - - break; - - case 18: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1; - dpp->samples_A [1] = dpp->samples_A [0]; - dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [0]; - - sam_A = (3 * dpp->samples_B [0] - dpp->samples_B [1]) >> 1; - dpp->samples_B [1] = dpp->samples_B [0]; - dpp->samples_B [0] = apply_weight (weight_B, sam_A) + bptr [1]; - update_weight (weight_B, delta, sam_A, bptr [1]); - bptr [1] = dpp->samples_B [0]; - } - - break; - - default: - for (m = 0, k = dpp->term & (MAX_TERM - 1), bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = dpp->samples_A [m]; - dpp->samples_A [k] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [k]; - - sam_A = dpp->samples_B [m]; - dpp->samples_B [k] = apply_weight (weight_B, sam_A) + bptr [1]; - update_weight (weight_B, delta, sam_A, bptr [1]); - bptr [1] = dpp->samples_B [k]; - - m = (m + 1) & (MAX_TERM - 1); - k = (k + 1) & (MAX_TERM - 1); - } - - if (m) { - int32_t temp_samples [MAX_TERM]; - - memcpy (temp_samples, dpp->samples_A, sizeof (dpp->samples_A)); - - for (k = 0; k < MAX_TERM; k++, m++) - dpp->samples_A [k] = temp_samples [m & (MAX_TERM - 1)]; - - memcpy (temp_samples, dpp->samples_B, sizeof (dpp->samples_B)); - - for (k = 0; k < MAX_TERM; k++, m++) - dpp->samples_B [k] = temp_samples [m & (MAX_TERM - 1)]; - } - - break; - - case -1: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = bptr [0] + apply_weight (weight_A, dpp->samples_A [0]); - update_weight_clip (weight_A, delta, dpp->samples_A [0], bptr [0]); - bptr [0] = sam_A; - dpp->samples_A [0] = bptr [1] + apply_weight (weight_B, sam_A); - update_weight_clip (weight_B, delta, sam_A, bptr [1]); - bptr [1] = dpp->samples_A [0]; - } - - break; - - case -2: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_B = bptr [1] + apply_weight (weight_B, dpp->samples_B [0]); - update_weight_clip (weight_B, delta, dpp->samples_B [0], bptr [1]); - bptr [1] = sam_B; - dpp->samples_B [0] = bptr [0] + apply_weight (weight_A, sam_B); - update_weight_clip (weight_A, delta, sam_B, bptr [0]); - bptr [0] = dpp->samples_B [0]; - } - - break; - - case -3: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = bptr [0] + apply_weight (weight_A, dpp->samples_A [0]); - update_weight_clip (weight_A, delta, dpp->samples_A [0], bptr [0]); - sam_B = bptr [1] + apply_weight (weight_B, dpp->samples_B [0]); - update_weight_clip (weight_B, delta, dpp->samples_B [0], bptr [1]); - bptr [0] = dpp->samples_B [0] = sam_A; - bptr [1] = dpp->samples_A [0] = sam_B; - } - - break; - } - - dpp->weight_A = weight_A; - dpp->weight_B = weight_B; -} - -#if (!defined(CPU_COLDFIRE) && !defined(CPU_ARM)) || defined(SIMULATOR) - -static void decorr_stereo_pass_cont (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count) -{ - int32_t delta = dpp->delta, weight_A = dpp->weight_A, weight_B = dpp->weight_B; - int32_t *bptr, *tptr, *eptr = buffer + (sample_count * 2), sam_A, sam_B; - int k, i; - - switch (dpp->term) { - - case 17: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = 2 * bptr [-2] - bptr [-4]; - bptr [0] = apply_weight (weight_A, sam_A) + (sam_B = bptr [0]); - update_weight (weight_A, delta, sam_A, sam_B); - - sam_A = 2 * bptr [-1] - bptr [-3]; - bptr [1] = apply_weight (weight_B, sam_A) + (sam_B = bptr [1]); - update_weight (weight_B, delta, sam_A, sam_B); - } - - dpp->samples_B [0] = bptr [-1]; - dpp->samples_A [0] = bptr [-2]; - dpp->samples_B [1] = bptr [-3]; - dpp->samples_A [1] = bptr [-4]; - break; - - case 18: - for (bptr = buffer; bptr < eptr; bptr += 2) { - sam_A = (3 * bptr [-2] - bptr [-4]) >> 1; - bptr [0] = apply_weight (weight_A, sam_A) + (sam_B = bptr [0]); - update_weight (weight_A, delta, sam_A, sam_B); - - sam_A = (3 * bptr [-1] - bptr [-3]) >> 1; - bptr [1] = apply_weight (weight_B, sam_A) + (sam_B = bptr [1]); - update_weight (weight_B, delta, sam_A, sam_B); - } - - dpp->samples_B [0] = bptr [-1]; - dpp->samples_A [0] = bptr [-2]; - dpp->samples_B [1] = bptr [-3]; - dpp->samples_A [1] = bptr [-4]; - break; - - default: - for (bptr = buffer, tptr = buffer - (dpp->term * 2); bptr < eptr; bptr += 2, tptr += 2) { - bptr [0] = apply_weight (weight_A, tptr [0]) + (sam_A = bptr [0]); - update_weight (weight_A, delta, tptr [0], sam_A); - - bptr [1] = apply_weight (weight_B, tptr [1]) + (sam_A = bptr [1]); - update_weight (weight_B, delta, tptr [1], sam_A); - } - - for (k = dpp->term - 1, i = 8; i--; k--) { - dpp->samples_B [k & (MAX_TERM - 1)] = *--bptr; - dpp->samples_A [k & (MAX_TERM - 1)] = *--bptr; - } - - break; - - case -1: - for (bptr = buffer; bptr < eptr; bptr += 2) { - bptr [0] = apply_weight (weight_A, bptr [-1]) + (sam_A = bptr [0]); - update_weight_clip (weight_A, delta, bptr [-1], sam_A); - bptr [1] = apply_weight (weight_B, bptr [0]) + (sam_A = bptr [1]); - update_weight_clip (weight_B, delta, bptr [0], sam_A); - } - - dpp->samples_A [0] = bptr [-1]; - break; - - case -2: - for (bptr = buffer; bptr < eptr; bptr += 2) { - bptr [1] = apply_weight (weight_B, bptr [-2]) + (sam_A = bptr [1]); - update_weight_clip (weight_B, delta, bptr [-2], sam_A); - bptr [0] = apply_weight (weight_A, bptr [1]) + (sam_A = bptr [0]); - update_weight_clip (weight_A, delta, bptr [1], sam_A); - } - - dpp->samples_B [0] = bptr [-2]; - break; - - case -3: - for (bptr = buffer; bptr < eptr; bptr += 2) { - bptr [0] = apply_weight (weight_A, bptr [-1]) + (sam_A = bptr [0]); - update_weight_clip (weight_A, delta, bptr [-1], sam_A); - bptr [1] = apply_weight (weight_B, bptr [-2]) + (sam_A = bptr [1]); - update_weight_clip (weight_B, delta, bptr [-2], sam_A); - } - - dpp->samples_A [0] = bptr [-1]; - dpp->samples_B [0] = bptr [-2]; - break; - } - - dpp->weight_A = weight_A; - dpp->weight_B = weight_B; -} - -#endif - -static void decorr_mono_pass (struct decorr_pass *dpp, int32_t *buffer, int32_t sample_count) -{ - int32_t delta = dpp->delta, weight_A = dpp->weight_A; - int32_t *bptr, *eptr = buffer + sample_count, sam_A; - int m, k; - - switch (dpp->term) { - - case 17: - for (bptr = buffer; bptr < eptr; bptr++) { - sam_A = 2 * dpp->samples_A [0] - dpp->samples_A [1]; - dpp->samples_A [1] = dpp->samples_A [0]; - dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [0]; - } - - break; - - case 18: - for (bptr = buffer; bptr < eptr; bptr++) { - sam_A = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1; - dpp->samples_A [1] = dpp->samples_A [0]; - dpp->samples_A [0] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [0]; - } - - break; - - default: - for (m = 0, k = dpp->term & (MAX_TERM - 1), bptr = buffer; bptr < eptr; bptr++) { - sam_A = dpp->samples_A [m]; - dpp->samples_A [k] = apply_weight (weight_A, sam_A) + bptr [0]; - update_weight (weight_A, delta, sam_A, bptr [0]); - bptr [0] = dpp->samples_A [k]; - m = (m + 1) & (MAX_TERM - 1); - k = (k + 1) & (MAX_TERM - 1); - } - - if (m) { - int32_t temp_samples [MAX_TERM]; - - memcpy (temp_samples, dpp->samples_A, sizeof (dpp->samples_A)); - - for (k = 0; k < MAX_TERM; k++, m++) - dpp->samples_A [k] = temp_samples [m & (MAX_TERM - 1)]; - } - - break; - } - - dpp->weight_A = weight_A; -} - - -// This is a helper function for unpack_samples() that applies several final -// operations. First, if the data is 32-bit float data, then that conversion -// is done in the float.c module (whether lossy or lossless) and we return. -// Otherwise, if the extended integer data applies, then that operation is -// executed first. If the unpacked data is lossy (and not corrected) then -// it is clipped and shifted in a single operation. Otherwise, if it's -// lossless then the last step is to apply the final shift (if any). - -static void fixup_samples (WavpackStream *wps, int32_t *buffer, uint32_t sample_count) -{ - uint32_t flags = wps->wphdr.flags; - int shift = (flags & SHIFT_MASK) >> SHIFT_LSB; - - if (flags & FLOAT_DATA) { - float_values (wps, buffer, (flags & MONO_FLAG) ? sample_count : sample_count * 2); - return; - } - - if (flags & INT32_DATA) { - uint32_t count = (flags & MONO_FLAG) ? sample_count : sample_count * 2; - int sent_bits = wps->int32_sent_bits, zeros = wps->int32_zeros; - int ones = wps->int32_ones, dups = wps->int32_dups; - int32_t *dptr = buffer; - - if (!(flags & HYBRID_FLAG) && !sent_bits && (zeros + ones + dups)) - while (count--) { - if (zeros) - *dptr <<= zeros; - else if (ones) - *dptr = ((*dptr + 1) << ones) - 1; - else if (dups) - *dptr = ((*dptr + (*dptr & 1)) << dups) - (*dptr & 1); - - dptr++; - } - else - shift += zeros + sent_bits + ones + dups; - } - - if (flags & HYBRID_FLAG) { - int32_t min_value, max_value, min_shifted, max_shifted; - - switch (flags & BYTES_STORED) { - case 0: - min_shifted = (min_value = -128 >> shift) << shift; - max_shifted = (max_value = 127 >> shift) << shift; - break; - - case 1: - min_shifted = (min_value = -32768 >> shift) << shift; - max_shifted = (max_value = 32767 >> shift) << shift; - break; - - case 2: - min_shifted = (min_value = -8388608 >> shift) << shift; - max_shifted = (max_value = 8388607 >> shift) << shift; - break; - - case 3: - default: - min_shifted = (min_value = (int32_t) 0x80000000 >> shift) << shift; - max_shifted = (max_value = (int32_t) 0x7FFFFFFF >> shift) << shift; - break; - } - - if (!(flags & MONO_FLAG)) - sample_count *= 2; - - while (sample_count--) { - if (*buffer < min_value) - *buffer++ = min_shifted; - else if (*buffer > max_value) - *buffer++ = max_shifted; - else - *buffer++ <<= shift; - } - } - else if (shift) { - if (!(flags & MONO_FLAG)) - sample_count *= 2; - - while (sample_count--) - *buffer++ <<= shift; - } -} - -// This function checks the crc value(s) for an unpacked block, returning the -// number of actual crc errors detected for the block. The block must be -// completely unpacked before this test is valid. For losslessly unpacked -// blocks of float or extended integer data the extended crc is also checked. -// Note that WavPack's crc is not a CCITT approved polynomial algorithm, but -// is a much simpler method that is virtually as robust for real world data. - -int check_crc_error (WavpackContext *wpc) -{ - WavpackStream *wps = &wpc->stream; - int result = 0; - - if (wps->crc != wps->wphdr.crc) - ++result; - - return result; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wavpack.h b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wavpack.h deleted file mode 100644 index 2e22fc51e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wavpack.h +++ /dev/null @@ -1,384 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////// */ -/* **** WAVPACK **** // */ -/* Hybrid Lossless Wavefile Compressor // */ -/* Copyright (c) 1998 - 2004 Conifer Software. // */ -/* All Rights Reserved. // */ -/* Distributed under the BSD Software License (see license.txt) // */ -/*////////////////////////////////////////////////////////////////////////// */ - -/* wavpack.h */ - -#include - -/* This header file contains all the definitions required by WavPack. */ - -#ifdef __BORLANDC__ -typedef unsigned long uint32_t; -typedef long int32_t; -#elif defined(_WIN32) && !defined(__MINGW32__) -#include -typedef unsigned __int64 uint64_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef __int32 int32_t; -#else -#include -#endif - -typedef unsigned char uchar; - -#if !defined(__GNUC__) || defined(WIN32) -typedef unsigned short ushort; -typedef unsigned int uint; -#endif - -#include - -#define FALSE 0 -#define TRUE 1 - -/*//////////////////////////// WavPack Header ///////////////////////////////// */ - -/* Note that this is the ONLY structure that is written to (or read from) */ -/* WavPack 4.0 files, and is the preamble to every block in both the .wv */ -/* and .wvc files. */ - -typedef struct { - char ckID [4]; - uint32_t ckSize; - short version; - uchar track_no, index_no; - uint32_t total_samples, block_index, block_samples, flags, crc; -} WavpackHeader; - -#define WavpackHeaderFormat "4LS2LLLLL" - -/* or-values for "flags" */ - -#define BYTES_STORED 3 /* 1-4 bytes/sample */ -#define MONO_FLAG 4 /* not stereo */ -#define HYBRID_FLAG 8 /* hybrid mode */ -#define JOINT_STEREO 0x10 /* joint stereo */ -#define CROSS_DECORR 0x20 /* no-delay cross decorrelation */ -#define HYBRID_SHAPE 0x40 /* noise shape (hybrid mode only) */ -#define FLOAT_DATA 0x80 /* ieee 32-bit floating point data */ - -#define INT32_DATA 0x100 /* special extended int handling */ -#define HYBRID_BITRATE 0x200 /* bitrate noise (hybrid mode only) */ -#define HYBRID_BALANCE 0x400 /* balance noise (hybrid stereo mode only) */ - -#define INITIAL_BLOCK 0x800 /* initial block of multichannel segment */ -#define FINAL_BLOCK 0x1000 /* final block of multichannel segment */ - -#define SHIFT_LSB 13 -#define SHIFT_MASK (0x1fL << SHIFT_LSB) - -#define MAG_LSB 18 -#define MAG_MASK (0x1fL << MAG_LSB) - -#define SRATE_LSB 23 -#define SRATE_MASK (0xfL << SRATE_LSB) - -#define FALSE_STEREO 0x40000000 /* block is stereo, but data is mono */ - -#define IGNORED_FLAGS 0x18000000 /* reserved, but ignore if encountered */ -#define NEW_SHAPING 0x20000000 /* use IIR filter for negative shaping */ -#define UNKNOWN_FLAGS 0x80000000 /* also reserved, but refuse decode if */ - /* encountered */ - -#define MONO_DATA (MONO_FLAG | FALSE_STEREO) - -#define MIN_STREAM_VERS 0x402 /* lowest stream version we'll decode */ -#define MAX_STREAM_VERS 0x410 /* highest stream version we'll decode */ - -/*////////////////////////// WavPack Metadata ///////////////////////////////// */ - -/* This is an internal representation of metadata. */ - -typedef struct { - int32_t byte_length; - void *data; - uchar id; -} WavpackMetadata; - -#define ID_OPTIONAL_DATA 0x20 -#define ID_ODD_SIZE 0x40 -#define ID_LARGE 0x80 - -#define ID_DUMMY 0x0 -#define ID_ENCODER_INFO 0x1 -#define ID_DECORR_TERMS 0x2 -#define ID_DECORR_WEIGHTS 0x3 -#define ID_DECORR_SAMPLES 0x4 -#define ID_ENTROPY_VARS 0x5 -#define ID_HYBRID_PROFILE 0x6 -#define ID_SHAPING_WEIGHTS 0x7 -#define ID_FLOAT_INFO 0x8 -#define ID_INT32_INFO 0x9 -#define ID_WV_BITSTREAM 0xa -#define ID_WVC_BITSTREAM 0xb -#define ID_WVX_BITSTREAM 0xc -#define ID_CHANNEL_INFO 0xd - -#define ID_RIFF_HEADER (ID_OPTIONAL_DATA | 0x1) -#define ID_RIFF_TRAILER (ID_OPTIONAL_DATA | 0x2) -#define ID_REPLAY_GAIN (ID_OPTIONAL_DATA | 0x3) -#define ID_CUESHEET (ID_OPTIONAL_DATA | 0x4) -#define ID_CONFIG_BLOCK (ID_OPTIONAL_DATA | 0x5) -#define ID_MD5_CHECKSUM (ID_OPTIONAL_DATA | 0x6) - -/*/////////////////////// WavPack Configuration /////////////////////////////// */ - -/* This internal structure is used during encode to provide configuration to */ -/* the encoding engine and during decoding to provide fle information back to */ -/* the higher level functions. Not all fields are used in both modes. */ - -typedef struct { - int bits_per_sample, bytes_per_sample; - int num_channels, float_norm_exp; - uint32_t flags, sample_rate, channel_mask; -} WavpackConfig; - -#define CONFIG_BYTES_STORED 3 /* 1-4 bytes/sample */ -#define CONFIG_MONO_FLAG 4 /* not stereo */ -#define CONFIG_HYBRID_FLAG 8 /* hybrid mode */ -#define CONFIG_JOINT_STEREO 0x10 /* joint stereo */ -#define CONFIG_CROSS_DECORR 0x20 /* no-delay cross decorrelation */ -#define CONFIG_HYBRID_SHAPE 0x40 /* noise shape (hybrid mode only) */ -#define CONFIG_FLOAT_DATA 0x80 /* ieee 32-bit floating point data */ - -#define CONFIG_FAST_FLAG 0x200 /* fast mode */ -#define CONFIG_HIGH_FLAG 0x800 /* high quality mode */ -#define CONFIG_VERY_HIGH_FLAG 0x1000 /* very high */ -#define CONFIG_BITRATE_KBPS 0x2000 /* bitrate is kbps, not bits / sample */ -#define CONFIG_AUTO_SHAPING 0x4000 /* automatic noise shaping */ -#define CONFIG_SHAPE_OVERRIDE 0x8000 /* shaping mode specified */ -#define CONFIG_JOINT_OVERRIDE 0x10000 /* joint-stereo mode specified */ -#define CONFIG_CREATE_EXE 0x40000 /* create executable */ -#define CONFIG_CREATE_WVC 0x80000 /* create correction file */ -#define CONFIG_OPTIMIZE_WVC 0x100000 /* maximize bybrid compression */ -#define CONFIG_CALC_NOISE 0x800000 /* calc noise in hybrid mode */ -#define CONFIG_LOSSY_MODE 0x1000000 /* obsolete (for information) */ -#define CONFIG_EXTRA_MODE 0x2000000 /* extra processing mode */ -#define CONFIG_SKIP_WVX 0x4000000 /* no wvx stream w/ floats & big ints */ -#define CONFIG_MD5_CHECKSUM 0x8000000 /* compute & store MD5 signature */ -#define CONFIG_OPTIMIZE_MONO 0x80000000 /* optimize for mono streams posing as stereo */ - -/*////////////////////////////// WavPack Stream /////////////////////////////// */ - -/* This internal structure contains everything required to handle a WavPack */ -/* "stream", which is defined as a stereo or mono stream of audio samples. For */ -/* multichannel audio several of these would be required. Each stream contains */ -/* pointers to hold a complete allocated block of WavPack data, although it's */ -/* possible to decode WavPack blocks without buffering an entire block. */ - -typedef int32_t (*read_stream)(void *, int32_t); - -typedef struct bs { - uchar *buf, *end, *ptr; - void (*wrap)(struct bs *bs); - uint32_t file_bytes, sr; - int error, bc; - read_stream file; -} Bitstream; - -#define MAX_NTERMS 16 -#define MAX_TERM 8 - -struct decorr_pass { - short term, delta, weight_A, weight_B; - int32_t samples_A [MAX_TERM], samples_B [MAX_TERM]; -}; - -struct entropy_data { - uint32_t median [3], slow_level, error_limit; -}; - -struct words_data { - uint32_t bitrate_delta [2], bitrate_acc [2]; - uint32_t pend_data, holding_one, zeros_acc; - int holding_zero, pend_count; - struct entropy_data c [2]; -}; - -typedef struct { - WavpackHeader wphdr; - Bitstream wvbits; - - struct words_data w; - - int num_terms, mute_error; - uint32_t sample_index, crc; - - uchar int32_sent_bits, int32_zeros, int32_ones, int32_dups; - uchar float_flags, float_shift, float_max_exp, float_norm_exp; - - struct decorr_pass decorr_passes [MAX_NTERMS]; - -} WavpackStream; - -/* flags for float_flags: */ - -#define FLOAT_SHIFT_ONES 1 /* bits left-shifted into float = '1' */ -#define FLOAT_SHIFT_SAME 2 /* bits left-shifted into float are the same */ -#define FLOAT_SHIFT_SENT 4 /* bits shifted into float are sent literally */ -#define FLOAT_ZEROS_SENT 8 /* "zeros" are not all real zeros */ -#define FLOAT_NEG_ZEROS 0x10 /* contains negative zeros */ -#define FLOAT_EXCEPTIONS 0x20 /* contains exceptions (inf, nan, etc.) */ - -/*///////////////////////////// WavPack Context /////////////////////////////// */ - -/* This internal structure holds everything required to encode or decode WavPack */ -/* files. It is recommended that direct access to this structure be minimized */ -/* and the provided utilities used instead. */ - -typedef struct { - WavpackConfig config; - WavpackStream stream; - - uchar read_buffer [1024]; - char error_message [80]; - - read_stream infile; - uint32_t total_samples, crc_errors, first_flags; - int open_flags, norm_offset, reduced_channels, lossy_blocks; - -} WavpackContext; - -/*////////////////////// function prototypes and macros ////////////////////// */ - -#define CLEAR(destin) memset (&destin, 0, sizeof (destin)); - -/* bits.c */ - -void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes); - -#define bs_is_open(bs) ((bs)->ptr != NULL) - -#define getbit(bs) ( \ - (((bs)->bc) ? \ - ((bs)->bc--, (bs)->sr & 1) : \ - (((++((bs)->ptr) != (bs)->end) ? (void) 0 : (bs)->wrap (bs)), (bs)->bc = 7, ((bs)->sr = *((bs)->ptr)) & 1) \ - ) ? \ - ((bs)->sr >>= 1, 1) : \ - ((bs)->sr >>= 1, 0) \ -) - -#define getbits(value, nbits, bs) { \ - while ((nbits) > (bs)->bc) { \ - if (++((bs)->ptr) == (bs)->end) (bs)->wrap (bs); \ - (bs)->sr |= (int32_t)*((bs)->ptr) << (bs)->bc; \ - (bs)->bc += 8; \ - } \ - *(value) = (bs)->sr; \ - if ((bs)->bc > 32) { \ - (bs)->bc -= (nbits); \ - (bs)->sr = *((bs)->ptr) >> (8 - (bs)->bc); \ - } \ - else { \ - (bs)->bc -= (nbits); \ - (bs)->sr >>= (nbits); \ - } \ -} - -void little_endian_to_native (void *data, char *format); -void native_to_little_endian (void *data, char *format); - -/* These macros implement the weight application and update operations */ -/* that are at the heart of the decorrelation loops. Note that when there */ -/* are several alternative versions of the same macro (marked with PERFCOND) */ -/* then the versions are functionally equivalent with respect to WavPack */ -/* decoding and the user should choose the one that provides the best */ -/* performance. This may be easier to check when NOT using the assembly */ -/* language optimizations. */ - -#if 1 /* PERFCOND */ -#define apply_weight_i(weight, sample) ((weight * sample + 512) >> 10) -#else -#define apply_weight_i(weight, sample) ((((weight * sample) >> 8) + 2) >> 2) -#endif - -#define apply_weight_f(weight, sample) (((((sample & 0xffffL) * weight) >> 9) + \ - (((sample & ~0xffffL) >> 9) * weight) + 1) >> 1) - -#if 1 /* PERFCOND */ -#define apply_weight(weight, sample) (sample != (short) sample ? \ - apply_weight_f (weight, sample) : apply_weight_i (weight, sample)) -#else -#define apply_weight(weight, sample) ((int32_t)((weight * (int64_t) sample + 512) >> 10)) -#endif - -#if 0 /* PERFCOND */ -#define update_weight(weight, delta, source, result) \ - if (source && result) { int32_t s = (int32_t) (source ^ result) >> 31; weight = (delta ^ s) + (weight - s); } -#elif 1 -#define update_weight(weight, delta, source, result) \ - if (source && result) weight += (((source ^ result) >> 30) | 1) * delta -#else -#define update_weight(weight, delta, source, result) \ - if (source && result) (source ^ result) < 0 ? (weight -= delta) : (weight += delta) -#endif - -#define update_weight_clip(weight, delta, source, result) \ - if (source && result && ((source ^ result) < 0 ? (weight -= delta) < -1024 : (weight += delta) > 1024)) \ - weight = weight < 0 ? -1024 : 1024 - -/* unpack.c */ - -int unpack_init (WavpackContext *wpc); -int init_wv_bitstream (WavpackContext *wpc, WavpackMetadata *wpmd); -int read_decorr_terms (WavpackStream *wps, WavpackMetadata *wpmd); -int read_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd); -int read_decorr_samples (WavpackStream *wps, WavpackMetadata *wpmd); -int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd); -int read_int32_info (WavpackStream *wps, WavpackMetadata *wpmd); -int read_channel_info (WavpackContext *wpc, WavpackMetadata *wpmd); -int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd); -int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count); -int check_crc_error (WavpackContext *wpc); - -/* metadata.c stuff */ - -int read_metadata_buff (WavpackContext *wpc, WavpackMetadata *wpmd); -int process_metadata (WavpackContext *wpc, WavpackMetadata *wpmd); - -/* words.c stuff */ - -int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd); -int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd); -int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, - struct words_data *w, Bitstream *bs); -int32_t exp2s (int log); -int restore_weight (signed char weight); - -#define WORD_EOF (1L << 31) - -/* float.c */ - -int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd); -void float_values (WavpackStream *wps, int32_t *values, int32_t num_values); - -/* wputils.c */ - -WavpackContext *WavpackOpenFileInput (read_stream infile, char *error); - -int WavpackGetMode (WavpackContext *wpc); - -#define MODE_WVC 0x1 -#define MODE_LOSSLESS 0x2 -#define MODE_HYBRID 0x4 -#define MODE_FLOAT 0x8 -#define MODE_VALID_TAG 0x10 -#define MODE_HIGH 0x20 -#define MODE_FAST 0x40 - -uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t samples); -uint32_t WavpackGetNumSamples (WavpackContext *wpc); -uint32_t WavpackGetSampleIndex (WavpackContext *wpc); -int WavpackGetNumErrors (WavpackContext *wpc); -int WavpackLossyBlocks (WavpackContext *wpc); -uint32_t WavpackGetSampleRate (WavpackContext *wpc); -int WavpackGetBitsPerSample (WavpackContext *wpc); -int WavpackGetBytesPerSample (WavpackContext *wpc); -int WavpackGetNumChannels (WavpackContext *wpc); -int WavpackGetReducedChannels (WavpackContext *wpc); diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/words.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/words.c deleted file mode 100644 index d39563b0c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/words.c +++ /dev/null @@ -1,560 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// words.c - -// This module provides entropy word encoding and decoding functions using -// a variation on the Rice method. This was introduced in version 3.93 -// because it allows splitting the data into a "lossy" stream and a -// "correction" stream in a very efficient manner and is therefore ideal -// for the "hybrid" mode. For 4.0, the efficiency of this method was -// significantly improved by moving away from the normal Rice restriction of -// using powers of two for the modulus divisions and now the method can be -// used for both hybrid and pure lossless encoding. - -// Samples are divided by median probabilities at 5/7 (71.43%), 10/49 (20.41%), -// and 20/343 (5.83%). Each zone has 3.5 times fewer samples than the -// previous. Using standard Rice coding on this data would result in 1.4 -// bits per sample average (not counting sign bit). However, there is a -// very simple encoding that is over 99% efficient with this data and -// results in about 1.22 bits per sample. - -#include "wavpack.h" - -#include - -//////////////////////////////// local macros ///////////////////////////////// - -#define LIMIT_ONES 16 // maximum consecutive 1s sent for "div" data - -// these control the time constant "slow_level" which is used for hybrid mode -// that controls bitrate as a function of residual level (HYBRID_BITRATE). -#define SLS 8 -#define SLO ((1 << (SLS - 1))) - -// these control the time constant of the 3 median level breakpoints -#define DIV0 128 // 5/7 of samples -#define DIV1 64 // 10/49 of samples -#define DIV2 32 // 20/343 of samples - -// this macro retrieves the specified median breakpoint (without frac; min = 1) -#define GET_MED(med) (((c->median [med]) >> 4) + 1) - -// These macros update the specified median breakpoints. Note that the median -// is incremented when the sample is higher than the median, else decremented. -// They are designed so that the median will never drop below 1 and the value -// is essentially stationary if there are 2 increments for every 5 decrements. - -#define INC_MED0() (c->median [0] += ((c->median [0] + DIV0) / DIV0) * 5) -#define DEC_MED0() (c->median [0] -= ((c->median [0] + (DIV0-2)) / DIV0) * 2) -#define INC_MED1() (c->median [1] += ((c->median [1] + DIV1) / DIV1) * 5) -#define DEC_MED1() (c->median [1] -= ((c->median [1] + (DIV1-2)) / DIV1) * 2) -#define INC_MED2() (c->median [2] += ((c->median [2] + DIV2) / DIV2) * 5) -#define DEC_MED2() (c->median [2] -= ((c->median [2] + (DIV2-2)) / DIV2) * 2) - -#define count_bits(av) ( \ - (av) < (1 << 8) ? nbits_table [av] : \ - ( \ - (av) < (1L << 16) ? nbits_table [(av) >> 8] + 8 : \ - ((av) < (1L << 24) ? nbits_table [(av) >> 16] + 16 : nbits_table [(av) >> 24] + 24) \ - ) \ -) - -///////////////////////////// local table storage //////////////////////////// - -const char nbits_table [] = { - 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, // 0 - 15 - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, // 16 - 31 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, // 32 - 47 - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, // 48 - 63 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 64 - 79 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 80 - 95 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 96 - 111 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 112 - 127 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 128 - 143 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 144 - 159 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 160 - 175 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 176 - 191 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 192 - 207 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 208 - 223 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 224 - 239 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 // 240 - 255 -}; - -static const uchar log2_table [] = { - 0x00, 0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x15, - 0x16, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2a, - 0x2c, 0x2d, 0x2e, 0x2f, 0x31, 0x32, 0x33, 0x34, 0x36, 0x37, 0x38, 0x39, 0x3b, 0x3c, 0x3d, 0x3e, - 0x3f, 0x41, 0x42, 0x43, 0x44, 0x45, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4d, 0x4e, 0x4f, 0x50, 0x51, - 0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - 0x64, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x74, 0x75, - 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, - 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, - 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb2, - 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc0, - 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xce, - 0xcf, 0xd0, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd8, 0xd9, 0xda, 0xdb, - 0xdc, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe4, 0xe5, 0xe6, 0xe7, 0xe7, - 0xe8, 0xe9, 0xea, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xee, 0xef, 0xf0, 0xf1, 0xf1, 0xf2, 0xf3, 0xf4, - 0xf4, 0xf5, 0xf6, 0xf7, 0xf7, 0xf8, 0xf9, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfe, 0xff, 0xff -}; - -static const uchar exp2_table [] = { - 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, 0x0b, - 0x0b, 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x12, 0x13, 0x13, 0x14, 0x15, 0x16, 0x16, - 0x17, 0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0x1f, 0x20, 0x20, 0x21, 0x22, 0x23, - 0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3a, 0x3b, 0x3c, 0x3d, - 0x3e, 0x3f, 0x40, 0x41, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x48, 0x49, 0x4a, 0x4b, - 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, - 0x5b, 0x5c, 0x5d, 0x5e, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, - 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, - 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8a, - 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, - 0x9c, 0x9d, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, - 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, - 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf, 0xd0, 0xd2, 0xd3, 0xd4, - 0xd6, 0xd7, 0xd8, 0xd9, 0xdb, 0xdc, 0xdd, 0xde, 0xe0, 0xe1, 0xe2, 0xe4, 0xe5, 0xe6, 0xe8, 0xe9, - 0xea, 0xec, 0xed, 0xee, 0xf0, 0xf1, 0xf2, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfc, 0xfd, 0xff -}; - -static const char ones_count_table [] = { - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5, - 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8 -}; - -///////////////////////////// executable code //////////////////////////////// - -void init_words (WavpackStream *wps) -{ - CLEAR (wps->w); -} - -static int mylog2 (uint32_t avalue); - -// Read the median log2 values from the specifed metadata structure, convert -// them back to 32-bit unsigned values and store them. If length is not -// exactly correct then we flag and return an error. - -int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd) -{ - uchar *byteptr = wpmd->data; - - if (wpmd->byte_length != ((wps->wphdr.flags & MONO_DATA) ? 6 : 12)) - return FALSE; - - wps->w.c [0].median [0] = exp2s (byteptr [0] + (byteptr [1] << 8)); - wps->w.c [0].median [1] = exp2s (byteptr [2] + (byteptr [3] << 8)); - wps->w.c [0].median [2] = exp2s (byteptr [4] + (byteptr [5] << 8)); - - if (!(wps->wphdr.flags & MONO_DATA)) { - wps->w.c [1].median [0] = exp2s (byteptr [6] + (byteptr [7] << 8)); - wps->w.c [1].median [1] = exp2s (byteptr [8] + (byteptr [9] << 8)); - wps->w.c [1].median [2] = exp2s (byteptr [10] + (byteptr [11] << 8)); - } - - return TRUE; -} - -// Read the hybrid related values from the specifed metadata structure, convert -// them back to their internal formats and store them. The extended profile -// stuff is not implemented yet, so return an error if we get more data than -// we know what to do with. - -int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd) -{ - uchar *byteptr = wpmd->data; - uchar *endptr = byteptr + wpmd->byte_length; - - if (wps->wphdr.flags & HYBRID_BITRATE) { - wps->w.c [0].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); - byteptr += 2; - - if (!(wps->wphdr.flags & MONO_DATA)) { - wps->w.c [1].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); - byteptr += 2; - } - } - - wps->w.bitrate_acc [0] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; - byteptr += 2; - - if (!(wps->wphdr.flags & MONO_DATA)) { - wps->w.bitrate_acc [1] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; - byteptr += 2; - } - - if (byteptr < endptr) { - wps->w.bitrate_delta [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - byteptr += 2; - - if (!(wps->wphdr.flags & MONO_DATA)) { - wps->w.bitrate_delta [1] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); - byteptr += 2; - } - - if (byteptr < endptr) - return FALSE; - } - else - wps->w.bitrate_delta [0] = wps->w.bitrate_delta [1] = 0; - - return TRUE; -} - -// This function is called during both encoding and decoding of hybrid data to -// update the "error_limit" variable which determines the maximum sample error -// allowed in the main bitstream. In the HYBRID_BITRATE mode (which is the only -// currently implemented) this is calculated from the slow_level values and the -// bitrate accumulators. Note that the bitrate accumulators can be changing. - -void update_error_limit (struct words_data *w, uint32_t flags) -{ - int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16; - - if (flags & MONO_DATA) { - if (flags & HYBRID_BITRATE) { - int slow_log_0 = (w->c [0].slow_level + SLO) >> SLS; - - if (slow_log_0 - bitrate_0 > -0x100) - w->c [0].error_limit = exp2s (slow_log_0 - bitrate_0 + 0x100); - else - w->c [0].error_limit = 0; - } - else - w->c [0].error_limit = exp2s (bitrate_0); - } - else { - int bitrate_1 = (w->bitrate_acc [1] += w->bitrate_delta [1]) >> 16; - - if (flags & HYBRID_BITRATE) { - int slow_log_0 = (w->c [0].slow_level + SLO) >> SLS; - int slow_log_1 = (w->c [1].slow_level + SLO) >> SLS; - - if (flags & HYBRID_BALANCE) { - int balance = (slow_log_1 - slow_log_0 + bitrate_1 + 1) >> 1; - - if (balance > bitrate_0) { - bitrate_1 = bitrate_0 * 2; - bitrate_0 = 0; - } - else if (-balance > bitrate_0) { - bitrate_0 = bitrate_0 * 2; - bitrate_1 = 0; - } - else { - bitrate_1 = bitrate_0 + balance; - bitrate_0 = bitrate_0 - balance; - } - } - - if (slow_log_0 - bitrate_0 > -0x100) - w->c [0].error_limit = exp2s (slow_log_0 - bitrate_0 + 0x100); - else - w->c [0].error_limit = 0; - - if (slow_log_1 - bitrate_1 > -0x100) - w->c [1].error_limit = exp2s (slow_log_1 - bitrate_1 + 0x100); - else - w->c [1].error_limit = 0; - } - else { - w->c [0].error_limit = exp2s (bitrate_0); - w->c [1].error_limit = exp2s (bitrate_1); - } - } -} - -static uint32_t read_code (Bitstream *bs, uint32_t maxcode); - -// Read the next word from the bitstream "wvbits" and return the value. This -// function can be used for hybrid or lossless streams, but since an -// optimized version is available for lossless this function would normally -// be used for hybrid only. If a hybrid lossless stream is being read then -// the "correction" offset is written at the specified pointer. A return value -// of WORD_EOF indicates that the end of the bitstream was reached (all 1s) or -// some other error occurred. - -int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, - struct words_data *w, Bitstream *bs) -{ - register struct entropy_data *c = w->c; - int csamples; - - if (!(flags & MONO_DATA)) - nsamples *= 2; - - for (csamples = 0; csamples < nsamples; ++csamples) { - uint32_t ones_count, low, mid, high; - - if (!(flags & MONO_DATA)) - c = w->c + (csamples & 1); - - if (!(w->c [0].median [0] & ~1) && !w->holding_zero && !w->holding_one && !(w->c [1].median [0] & ~1)) { - uint32_t mask; - int cbits; - - if (w->zeros_acc) { - if (--w->zeros_acc) { - c->slow_level -= (c->slow_level + SLO) >> SLS; - *buffer++ = 0; - continue; - } - } - else { - for (cbits = 0; cbits < 33 && getbit (bs); ++cbits); - - if (cbits == 33) - break; - - if (cbits < 2) - w->zeros_acc = cbits; - else { - for (mask = 1, w->zeros_acc = 0; --cbits; mask <<= 1) - if (getbit (bs)) - w->zeros_acc |= mask; - - w->zeros_acc |= mask; - } - - if (w->zeros_acc) { - c->slow_level -= (c->slow_level + SLO) >> SLS; - CLEAR (w->c [0].median); - CLEAR (w->c [1].median); - *buffer++ = 0; - continue; - } - } - } - - if (w->holding_zero) - ones_count = w->holding_zero = 0; - else { - int next8; - - if (bs->bc < 8) { - if (++(bs->ptr) == bs->end) - bs->wrap (bs); - - next8 = (bs->sr |= *(bs->ptr) << bs->bc) & 0xff; - bs->bc += 8; - } - else - next8 = bs->sr & 0xff; - - if (next8 == 0xff) { - bs->bc -= 8; - bs->sr >>= 8; - - for (ones_count = 8; ones_count < (LIMIT_ONES + 1) && getbit (bs); ++ones_count); - - if (ones_count == (LIMIT_ONES + 1)) - break; - - if (ones_count == LIMIT_ONES) { - uint32_t mask; - int cbits; - - for (cbits = 0; cbits < 33 && getbit (bs); ++cbits); - - if (cbits == 33) - break; - - if (cbits < 2) - ones_count = cbits; - else { - for (mask = 1, ones_count = 0; --cbits; mask <<= 1) - if (getbit (bs)) - ones_count |= mask; - - ones_count |= mask; - } - - ones_count += LIMIT_ONES; - } - } - else { - bs->bc -= (ones_count = ones_count_table [next8]) + 1; - bs->sr >>= ones_count + 1; - } - - if (w->holding_one) { - w->holding_one = ones_count & 1; - ones_count = (ones_count >> 1) + 1; - } - else { - w->holding_one = ones_count & 1; - ones_count >>= 1; - } - - w->holding_zero = ~w->holding_one & 1; - } - - if ((flags & HYBRID_FLAG) && ((flags & MONO_DATA) || !(csamples & 1))) - update_error_limit (w, flags); - - if (ones_count == 0) { - low = 0; - high = GET_MED (0) - 1; - DEC_MED0 (); - } - else { - low = GET_MED (0); - INC_MED0 (); - - if (ones_count == 1) { - high = low + GET_MED (1) - 1; - DEC_MED1 (); - } - else { - low += GET_MED (1); - INC_MED1 (); - - if (ones_count == 2) { - high = low + GET_MED (2) - 1; - DEC_MED2 (); - } - else { - low += (ones_count - 2) * GET_MED (2); - high = low + GET_MED (2) - 1; - INC_MED2 (); - } - } - } - - mid = (high + low + 1) >> 1; - - if (!c->error_limit) - mid = read_code (bs, high - low) + low; - else while (high - low > c->error_limit) { - if (getbit (bs)) - mid = (high + (low = mid) + 1) >> 1; - else - mid = ((high = mid - 1) + low + 1) >> 1; - } - - *buffer++ = getbit (bs) ? ~mid : mid; - - if (flags & HYBRID_BITRATE) - c->slow_level = c->slow_level - ((c->slow_level + SLO) >> SLS) + mylog2 (mid); - } - - return (flags & MONO_DATA) ? csamples : (csamples / 2); -} - -// Read a single unsigned value from the specified bitstream with a value -// from 0 to maxcode. If there are exactly a power of two number of possible -// codes then this will read a fixed number of bits; otherwise it reads the -// minimum number of bits and then determines whether another bit is needed -// to define the code. - -static uint32_t read_code (Bitstream *bs, uint32_t maxcode) -{ - int bitcount = count_bits (maxcode); - uint32_t extras = (1L << bitcount) - maxcode - 1, code; - - if (!bitcount) - return 0; - - getbits (&code, bitcount - 1, bs); - code &= (1L << (bitcount - 1)) - 1; - - if (code >= extras) { - code = (code << 1) - extras; - - if (getbit (bs)) - ++code; - } - - return code; -} - -// The concept of a base 2 logarithm is used in many parts of WavPack. It is -// a way of sufficiently accurately representing 32-bit signed and unsigned -// values storing only 16 bits (actually fewer). It is also used in the hybrid -// mode for quickly comparing the relative magnitude of large values (i.e. -// division) and providing smooth exponentials using only addition. - -// These are not strict logarithms in that they become linear around zero and -// can therefore represent both zero and negative values. They have 8 bits -// of precision and in "roundtrip" conversions the total error never exceeds 1 -// part in 225 except for the cases of +/-115 and +/-195 (which error by 1). - - -// This function returns the log2 for the specified 32-bit unsigned value. -// The maximum value allowed is about 0xff800000 and returns 8447. - -static int mylog2 (uint32_t avalue) -{ - int dbits; - - if ((avalue += avalue >> 9) < (1 << 8)) { - dbits = nbits_table [avalue]; - return (dbits << 8) + log2_table [(avalue << (9 - dbits)) & 0xff]; - } - else { - if (avalue < (1L << 16)) - dbits = nbits_table [avalue >> 8] + 8; - else if (avalue < (1L << 24)) - dbits = nbits_table [avalue >> 16] + 16; - else - dbits = nbits_table [avalue >> 24] + 24; - - return (dbits << 8) + log2_table [(avalue >> (dbits - 9)) & 0xff]; - } -} - -// This function returns the log2 for the specified 32-bit signed value. -// All input values are valid and the return values are in the range of -// +/- 8192. - -int log2s (int32_t value) -{ - return (value < 0) ? -mylog2 (-value) : mylog2 (value); -} - -// This function returns the original integer represented by the supplied -// logarithm (at least within the provided accuracy). The log is signed, -// but since a full 32-bit value is returned this can be used for unsigned -// conversions as well (i.e. the input range is -8192 to +8447). - -int32_t exp2s (int log) -{ - uint32_t value; - - if (log < 0) - return -exp2s (-log); - - value = exp2_table [log & 0xff] | 0x100; - - if ((log >>= 8) <= 9) - return value >> (9 - log); - else - return value << (log - 9); -} - -// These two functions convert internal weights (which are normally +/-1024) -// to and from an 8-bit signed character version for storage in metadata. The -// weights are clipped here in the case that they are outside that range. - -int restore_weight (signed char weight) -{ - int result; - - if ((result = (int) weight << 3) > 0) - result += (result + 64) >> 7; - - return result; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wputils.c b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wputils.c deleted file mode 100644 index 1bc656103..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wputils.c +++ /dev/null @@ -1,351 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// wputils.c - -// This module provides a high-level interface for decoding WavPack 4.0 audio -// streams and files. WavPack data is read with a stream reading callback. No -// direct seeking is provided for, but it is possible to start decoding -// anywhere in a WavPack stream. In this case, WavPack will be able to provide -// the sample-accurate position when it synchs with the data and begins -// decoding. - -#include "wavpack.h" - -#include - -///////////////////////////// local table storage //////////////////////////// - -const uint32_t sample_rates [] = { 6000, 8000, 9600, 11025, 12000, 16000, 22050, - 24000, 32000, 44100, 48000, 64000, 88200, 96000, 192000 }; - -///////////////////////////// executable code //////////////////////////////// - -static uint32_t read_next_header (read_stream infile, WavpackHeader *wphdr); - -// This function reads data from the specified stream in search of a valid -// WavPack 4.0 audio block. If this fails in 1 megabyte (or an invalid or -// unsupported WavPack block is encountered) then an appropriate message is -// copied to "error" and NULL is returned, otherwise a pointer to a -// WavpackContext structure is returned (which is used to call all other -// functions in this module). This can be initiated at the beginning of a -// WavPack file, or anywhere inside a WavPack file. To determine the exact -// position within the file use WavpackGetSampleIndex(). For demonstration -// purposes this uses a single static copy of the WavpackContext structure, -// so obviously it cannot be used for more than one file at a time. Also, -// this function will not handle "correction" files, plays only the first -// two channels of multi-channel files, and is limited in resolution in some -// large integer or floating point files (but always provides at least 24 bits -// of resolution). - -static WavpackContext wpc; - -WavpackContext *WavpackOpenFileInput (read_stream infile, char *error) -{ - WavpackStream *wps = &wpc.stream; - uint32_t bcount; - - CLEAR (wpc); - wpc.infile = infile; - wpc.total_samples = (uint32_t) -1; - wpc.norm_offset = 0; - wpc.open_flags = 0; - - // open the source file for reading and store the size - - while (!wps->wphdr.block_samples) { - - bcount = read_next_header (wpc.infile, &wps->wphdr); - - if (bcount == (uint32_t) -1) { - strcpy (error, "not compatible with this version of WavPack file!"); - return NULL; - } - - if (wps->wphdr.block_samples && wps->wphdr.total_samples != (uint32_t) -1) - wpc.total_samples = wps->wphdr.total_samples; - - if (!unpack_init (&wpc)) { - strcpy (error, wpc.error_message [0] ? wpc.error_message : - "not compatible with this version of WavPack file!"); - - return NULL; - } - } - - wpc.config.flags &= ~0xff; - wpc.config.flags |= wps->wphdr.flags & 0xff; - wpc.config.bytes_per_sample = (wps->wphdr.flags & BYTES_STORED) + 1; - wpc.config.float_norm_exp = wps->float_norm_exp; - - wpc.config.bits_per_sample = (wpc.config.bytes_per_sample * 8) - - ((wps->wphdr.flags & SHIFT_MASK) >> SHIFT_LSB); - - if (wpc.config.flags & FLOAT_DATA) { - wpc.config.bytes_per_sample = 3; - wpc.config.bits_per_sample = 24; - } - - if (!wpc.config.sample_rate) { - if (!wps || !wps->wphdr.block_samples || (wps->wphdr.flags & SRATE_MASK) == SRATE_MASK) - wpc.config.sample_rate = 44100; - else - wpc.config.sample_rate = sample_rates [(wps->wphdr.flags & SRATE_MASK) >> SRATE_LSB]; - } - - if (!wpc.config.num_channels) { - wpc.config.num_channels = (wps->wphdr.flags & MONO_FLAG) ? 1 : 2; - wpc.config.channel_mask = 0x5 - wpc.config.num_channels; - } - - if (!(wps->wphdr.flags & FINAL_BLOCK)) - wpc.reduced_channels = (wps->wphdr.flags & MONO_FLAG) ? 1 : 2; - - return &wpc; -} - -// This function obtains general information about an open file and returns -// a mask with the following bit values: - -// MODE_LOSSLESS: file is lossless (pure lossless only) -// MODE_HYBRID: file is hybrid mode (lossy part only) -// MODE_FLOAT: audio data is 32-bit ieee floating point (but will provided -// in 24-bit integers for convenience) -// MODE_HIGH: file was created in "high" mode (information only) -// MODE_FAST: file was created in "fast" mode (information only) - -int WavpackGetMode (WavpackContext *wpc) -{ - int mode = 0; - - if (wpc) { - if (wpc->config.flags & CONFIG_HYBRID_FLAG) - mode |= MODE_HYBRID; - else if (!(wpc->config.flags & CONFIG_LOSSY_MODE)) - mode |= MODE_LOSSLESS; - - if (wpc->lossy_blocks) - mode &= ~MODE_LOSSLESS; - - if (wpc->config.flags & CONFIG_FLOAT_DATA) - mode |= MODE_FLOAT; - - if (wpc->config.flags & CONFIG_HIGH_FLAG) - mode |= MODE_HIGH; - - if (wpc->config.flags & CONFIG_FAST_FLAG) - mode |= MODE_FAST; - } - - return mode; -} - -// Unpack the specified number of samples from the current file position. -// Note that "samples" here refers to "complete" samples, which would be -// 2 longs for stereo files. The audio data is returned right-justified in -// 32-bit longs in the endian mode native to the executing processor. So, -// if the original data was 16-bit, then the values returned would be -// +/-32k. Floating point data will be returned as 24-bit integers (and may -// also be clipped). The actual number of samples unpacked is returned, -// which should be equal to the number requested unless the end of fle is -// encountered or an error occurs. - -uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t samples) -{ - WavpackStream *wps = &wpc->stream; - uint32_t bcount, samples_unpacked = 0, samples_to_unpack; - int num_channels = wpc->config.num_channels; - - while (samples) { - if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) || - wps->sample_index >= wps->wphdr.block_index + wps->wphdr.block_samples) { - bcount = read_next_header (wpc->infile, &wps->wphdr); - - if (bcount == (uint32_t) -1) - break; - - if (!wps->wphdr.block_samples || wps->sample_index == wps->wphdr.block_index) - if (!unpack_init (wpc)) - break; - } - - if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) || - wps->sample_index >= wps->wphdr.block_index + wps->wphdr.block_samples) - continue; - - if (wps->sample_index < wps->wphdr.block_index) { - samples_to_unpack = wps->wphdr.block_index - wps->sample_index; - - if (samples_to_unpack > samples) - samples_to_unpack = samples; - - wps->sample_index += samples_to_unpack; - samples_unpacked += samples_to_unpack; - samples -= samples_to_unpack; - - if (wpc->reduced_channels) - samples_to_unpack *= wpc->reduced_channels; - else - samples_to_unpack *= num_channels; - - while (samples_to_unpack--) - *buffer++ = 0; - - continue; - } - - samples_to_unpack = wps->wphdr.block_index + wps->wphdr.block_samples - wps->sample_index; - - if (samples_to_unpack > samples) - samples_to_unpack = samples; - - unpack_samples (wpc, buffer, samples_to_unpack); - - if (wpc->reduced_channels) - buffer += samples_to_unpack * wpc->reduced_channels; - else - buffer += samples_to_unpack * num_channels; - - samples_unpacked += samples_to_unpack; - samples -= samples_to_unpack; - - if (wps->sample_index == wps->wphdr.block_index + wps->wphdr.block_samples) { - if (check_crc_error (wpc)) - wpc->crc_errors++; - } - - if (wps->sample_index == wpc->total_samples) - break; - } - - return samples_unpacked; -} - -// Get total number of samples contained in the WavPack file, or -1 if unknown - -uint32_t WavpackGetNumSamples (WavpackContext *wpc) -{ - return wpc ? wpc->total_samples : (uint32_t) -1; -} - -// Get the current sample index position, or -1 if unknown - -uint32_t WavpackGetSampleIndex (WavpackContext *wpc) -{ - if (wpc) - return wpc->stream.sample_index; - - return (uint32_t) -1; -} - -// Get the number of errors encountered so far - -int WavpackGetNumErrors (WavpackContext *wpc) -{ - return wpc ? wpc->crc_errors : 0; -} - -// return TRUE if any uncorrected lossy blocks were actually written or read - -int WavpackLossyBlocks (WavpackContext *wpc) -{ - return wpc ? wpc->lossy_blocks : 0; -} - -// Returns the sample rate of the specified WavPack file - -uint32_t WavpackGetSampleRate (WavpackContext *wpc) -{ - return wpc ? wpc->config.sample_rate : 44100; -} - -// Returns the number of channels of the specified WavPack file. Note that -// this is the actual number of channels contained in the file, but this -// version can only decode the first two. - -int WavpackGetNumChannels (WavpackContext *wpc) -{ - return wpc ? wpc->config.num_channels : 2; -} - -// Returns the actual number of valid bits per sample contained in the -// original file, which may or may not be a multiple of 8. Floating data -// always has 32 bits, integers may be from 1 to 32 bits each. When this -// value is not a multiple of 8, then the "extra" bits are located in the -// LSBs of the results. That is, values are right justified when unpacked -// into longs, but are left justified in the number of bytes used by the -// original data. - -int WavpackGetBitsPerSample (WavpackContext *wpc) -{ - return wpc ? wpc->config.bits_per_sample : 16; -} - -// Returns the number of bytes used for each sample (1 to 4) in the original -// file. This is required information for the user of this module because the -// audio data is returned in the LOWER bytes of the long buffer and must be -// left-shifted 8, 16, or 24 bits if normalized longs are required. - -int WavpackGetBytesPerSample (WavpackContext *wpc) -{ - return wpc ? wpc->config.bytes_per_sample : 2; -} - -// This function will return the actual number of channels decoded from the -// file (which may or may not be less than the actual number of channels, but -// will always be 1 or 2). Normally, this will be the front left and right -// channels of a multi-channel file. - -int WavpackGetReducedChannels (WavpackContext *wpc) -{ - if (wpc) - return wpc->reduced_channels ? wpc->reduced_channels : wpc->config.num_channels; - else - return 2; -} - -// Read from current file position until a valid 32-byte WavPack 4.0 header is -// found and read into the specified pointer. The number of bytes skipped is -// returned. If no WavPack header is found within 1 meg, then a -1 is returned -// to indicate the error. No additional bytes are read past the header and it -// is returned in the processor's native endian mode. Seeking is not required. - -static uint32_t read_next_header (read_stream infile, WavpackHeader *wphdr) -{ - char buffer [sizeof (*wphdr)], *sp = buffer + sizeof (*wphdr), *ep = sp; - uint32_t bytes_skipped = 0; - int bleft; - - while (1) { - if (sp < ep) { - bleft = ep - sp; - memcpy (buffer, sp, bleft); - } - else - bleft = 0; - - if (infile (buffer + bleft, sizeof (*wphdr) - bleft) != (int32_t) sizeof (*wphdr) - bleft) - return -1; - - sp = buffer; - - if (*sp++ == 'w' && *sp == 'v' && *++sp == 'p' && *++sp == 'k' && - !(*++sp & 1) && sp [2] < 16 && !sp [3] && sp [5] == 4 && - sp [4] >= (MIN_STREAM_VERS & 0xff) && sp [4] <= (MAX_STREAM_VERS & 0xff)) { - memcpy (wphdr, buffer, sizeof (*wphdr)); - little_endian_to_native (wphdr, WavpackHeaderFormat); - return bytes_skipped; - } - - while (sp < ep && *sp != 'w') - sp++; - - if ((bytes_skipped += sp - buffer) > 1048576L) - return -1; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wvfilter.c.no_compile b/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wvfilter.c.no_compile deleted file mode 100644 index f80d73dd0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/external/wavpack/wvfilter.c.no_compile +++ /dev/null @@ -1,200 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// wv_filter.c - -// This is the main module for the demonstration WavPack command-line -// decoder filter. It uses the tiny "hardware" version of the decoder and -// accepts WavPack files on stdin and outputs a standard MS wav file to -// stdout. Note that this involves converting the data to little-endian -// (if the executing processor is not), possibly packing the data into -// fewer bytes per sample, and generating an appropriate riff wav header. -// Note that this is NOT the copy of the RIFF header that might be stored -// in the file, and any additional RIFF information and tags are lost. -// See wputils.c for further limitations. - -#include "wavpack.h" - -#if defined(WIN32) -#include -#include -#endif - -#include - -// These structures are used to place a wav riff header at the beginning of -// the output. - -typedef struct { - char ckID [4]; - uint32_t ckSize; - char formType [4]; -} RiffChunkHeader; - -typedef struct { - char ckID [4]; - uint32_t ckSize; -} ChunkHeader; - -#define ChunkHeaderFormat "4L" - -typedef struct { - ushort FormatTag, NumChannels; - uint32_t SampleRate, BytesPerSecond; - ushort BlockAlign, BitsPerSample; -} WaveHeader; - -#define WaveHeaderFormat "SSLLSS" - -static uchar *format_samples (int bps, uchar *dst, int32_t *src, uint32_t samcnt); -static int32_t read_bytes (void *buff, int32_t bcount); -static int32_t temp_buffer [256]; - -int main () -{ - ChunkHeader FormatChunkHeader, DataChunkHeader; - RiffChunkHeader RiffChunkHeader; - WaveHeader WaveHeader; - - uint32_t total_unpacked_samples = 0, total_samples; - int num_channels, bps; - WavpackContext *wpc; - char error [80]; - -#if defined(WIN32) - setmode (fileno (stdin), O_BINARY); - setmode (fileno (stdout), O_BINARY); -#endif - - wpc = WavpackOpenFileInput (read_bytes, error); - - if (!wpc) { - fputs (error, stderr); - fputs ("\n", stderr); - return 1; - } - - num_channels = WavpackGetReducedChannels (wpc); - total_samples = WavpackGetNumSamples (wpc); - bps = WavpackGetBytesPerSample (wpc); - - strncpy (RiffChunkHeader.ckID, "RIFF", sizeof (RiffChunkHeader.ckID)); - RiffChunkHeader.ckSize = total_samples * num_channels * bps + sizeof (ChunkHeader) * 2 + sizeof (WaveHeader) + 4; - strncpy (RiffChunkHeader.formType, "WAVE", sizeof (RiffChunkHeader.formType)); - - strncpy (FormatChunkHeader.ckID, "fmt ", sizeof (FormatChunkHeader.ckID)); - FormatChunkHeader.ckSize = sizeof (WaveHeader); - - WaveHeader.FormatTag = 1; - WaveHeader.NumChannels = num_channels; - WaveHeader.SampleRate = WavpackGetSampleRate (wpc); - WaveHeader.BlockAlign = num_channels * bps; - WaveHeader.BytesPerSecond = WaveHeader.SampleRate * WaveHeader.BlockAlign; - WaveHeader.BitsPerSample = WavpackGetBitsPerSample (wpc); - - strncpy (DataChunkHeader.ckID, "data", sizeof (DataChunkHeader.ckID)); - DataChunkHeader.ckSize = total_samples * num_channels * bps; - - native_to_little_endian (&RiffChunkHeader, ChunkHeaderFormat); - native_to_little_endian (&FormatChunkHeader, ChunkHeaderFormat); - native_to_little_endian (&WaveHeader, WaveHeaderFormat); - native_to_little_endian (&DataChunkHeader, ChunkHeaderFormat); - - if (!fwrite (&RiffChunkHeader, sizeof (RiffChunkHeader), 1, stdout) || - !fwrite (&FormatChunkHeader, sizeof (FormatChunkHeader), 1, stdout) || - !fwrite (&WaveHeader, sizeof (WaveHeader), 1, stdout) || - !fwrite (&DataChunkHeader, sizeof (DataChunkHeader), 1, stdout)) { - fputs ("can't write .WAV data, disk probably full!\n", stderr); - return 1; - } - - while (1) { - uint32_t samples_unpacked; - - samples_unpacked = WavpackUnpackSamples (wpc, temp_buffer, 256 / num_channels); - total_unpacked_samples += samples_unpacked; - - if (samples_unpacked) { - format_samples (bps, (uchar *) temp_buffer, temp_buffer, samples_unpacked *= num_channels); - - if (fwrite (temp_buffer, bps, samples_unpacked, stdout) != samples_unpacked) { - fputs ("can't write .WAV data, disk probably full!\n", stderr); - return 1; - } - } - - if (!samples_unpacked) - break; - } - - fflush (stdout); - - if (WavpackGetNumSamples (wpc) != (uint32_t) -1 && - total_unpacked_samples != WavpackGetNumSamples (wpc)) { - fputs ("incorrect number of samples!\n", stderr); - return 1; - } - - if (WavpackGetNumErrors (wpc)) { - fputs ("crc errors detected!\n", stderr); - return 1; - } - - return 0; -} - -static int32_t read_bytes (void *buff, int32_t bcount) -{ - return fread (buff, 1, bcount, stdin); -} - -// Reformat samples from longs in processor's native endian mode to -// little-endian data with (possibly) less than 4 bytes / sample. - -static uchar *format_samples (int bps, uchar *dst, int32_t *src, uint32_t samcnt) -{ - int32_t temp; - - switch (bps) { - - case 1: - while (samcnt--) - *dst++ = *src++ + 128; - - break; - - case 2: - while (samcnt--) { - *dst++ = (uchar)(temp = *src++); - *dst++ = (uchar)(temp >> 8); - } - - break; - - case 3: - while (samcnt--) { - *dst++ = (uchar)(temp = *src++); - *dst++ = (uchar)(temp >> 8); - *dst++ = (uchar)(temp >> 16); - } - - break; - - case 4: - while (samcnt--) { - *dst++ = (uchar)(temp = *src++); - *dst++ = (uchar)(temp >> 8); - *dst++ = (uchar)(temp >> 16); - *dst++ = (uchar)(temp >> 24); - } - - break; - } - - return dst; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/server/es_register.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/server/es_register.cpp deleted file mode 100644 index b3ac70a6e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/server/es_register.cpp +++ /dev/null @@ -1,272 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -extern NETSERVER *net; - -enum -{ - REGISTERSTATE_START=0, - REGISTERSTATE_UPDATE_ADDRS, - REGISTERSTATE_QUERY_COUNT, - REGISTERSTATE_HEARTBEAT, - REGISTERSTATE_REGISTERED, - REGISTERSTATE_ERROR -}; - -static int register_state = REGISTERSTATE_START; -static int64 register_state_start = 0; -static int register_first = 1; -static int register_count = 0; - -static void register_new_state(int state) -{ - register_state = state; - register_state_start = time_get(); -} - -static void register_send_fwcheckresponse(NETADDR *addr) -{ - NETCHUNK packet; - packet.client_id = -1; - packet.address = *addr; - packet.flags = NETSENDFLAG_CONNLESS; - packet.data_size = sizeof(SERVERBROWSE_FWRESPONSE); - packet.data = SERVERBROWSE_FWRESPONSE; - netserver_send(net, &packet); -} - -static void register_send_heartbeat(NETADDR addr) -{ - static unsigned char data[sizeof(SERVERBROWSE_HEARTBEAT) + 2]; - unsigned short port = config.sv_port; - NETCHUNK packet; - - mem_copy(data, SERVERBROWSE_HEARTBEAT, sizeof(SERVERBROWSE_HEARTBEAT)); - - packet.client_id = -1; - packet.address = addr; - packet.flags = NETSENDFLAG_CONNLESS; - packet.data_size = sizeof(SERVERBROWSE_HEARTBEAT) + 2; - packet.data = &data; - - /* supply the set port that the master can use if it has problems */ - if(config.sv_external_port) - port = config.sv_external_port; - data[sizeof(SERVERBROWSE_HEARTBEAT)] = port >> 8; - data[sizeof(SERVERBROWSE_HEARTBEAT)+1] = port&0xff; - netserver_send(net, &packet); -} - -static void register_send_count_request(NETADDR addr) -{ - NETCHUNK packet; - packet.client_id = -1; - packet.address = addr; - packet.flags = NETSENDFLAG_CONNLESS; - packet.data_size = sizeof(SERVERBROWSE_GETCOUNT); - packet.data = SERVERBROWSE_GETCOUNT; - netserver_send(net, &packet); -} - -typedef struct -{ - NETADDR addr; - int count; - int valid; - int64 last_send; -} MASTERSERVER_INFO; - -static MASTERSERVER_INFO masterserver_info[MAX_MASTERSERVERS] = {{{0}}}; -static int register_registered_server = -1; - -void register_update() -{ - int64 now = time_get(); - int64 freq = time_freq(); - - if(!config.sv_register) - return; - - mastersrv_update(); - - if(register_state == REGISTERSTATE_START) - { - register_count = 0; - register_first = 1; - register_new_state(REGISTERSTATE_UPDATE_ADDRS); - mastersrv_refresh_addresses(); - dbg_msg("register", "refreshing ip addresses"); - } - else if(register_state == REGISTERSTATE_UPDATE_ADDRS) - { - register_registered_server = -1; - - if(!mastersrv_refreshing()) - { - int i; - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - NETADDR addr = mastersrv_get(i); - masterserver_info[i].addr = addr; - masterserver_info[i].count = 0; - - if(!addr.ip[0] && !addr.ip[1] && !addr.ip[2] && !addr.ip[3]) - masterserver_info[i].valid = 0; - else - { - masterserver_info[i].valid = 1; - masterserver_info[i].count = -1; - masterserver_info[i].last_send = 0; - } - } - - dbg_msg("register", "fetching server counts"); - register_new_state(REGISTERSTATE_QUERY_COUNT); - } - } - else if(register_state == REGISTERSTATE_QUERY_COUNT) - { - int i; - int left = 0; - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - if(!masterserver_info[i].valid) - continue; - - if(masterserver_info[i].count == -1) - { - left++; - if(masterserver_info[i].last_send+freq < now) - { - masterserver_info[i].last_send = now; - register_send_count_request(masterserver_info[i].addr); - } - } - } - - /* check if we are done or timed out */ - if(left == 0 || now > register_state_start+freq*3) - { - /* choose server */ - int best = -1; - int i; - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - if(!masterserver_info[i].valid || masterserver_info[i].count == -1) - continue; - - if(best == -1 || masterserver_info[i].count < masterserver_info[best].count) - best = i; - } - - /* server chosen */ - register_registered_server = best; - if(register_registered_server == -1) - { - dbg_msg("register", "WARNING: No master servers. Retrying in 60 seconds"); - register_new_state(REGISTERSTATE_ERROR); - } - else - { - dbg_msg("register", "choosen '%s' as master, sending heartbeats", mastersrv_name(register_registered_server)); - masterserver_info[register_registered_server].last_send = 0; - register_new_state(REGISTERSTATE_HEARTBEAT); - } - } - } - else if(register_state == REGISTERSTATE_HEARTBEAT) - { - /* check if we should send heartbeat */ - if(now > masterserver_info[register_registered_server].last_send+freq*15) - { - masterserver_info[register_registered_server].last_send = now; - register_send_heartbeat(masterserver_info[register_registered_server].addr); - } - - if(now > register_state_start+freq*60) - { - dbg_msg("register", "WARNING: Master server is not responding, switching master"); - register_new_state(REGISTERSTATE_START); - } - } - else if(register_state == REGISTERSTATE_REGISTERED) - { - if(register_first) - dbg_msg("register", "server registered"); - - register_first = 0; - - /* check if we should send new heartbeat again */ - if(now > register_state_start+freq) - { - if(register_count == 120) /* redo the whole process after 60 minutes to balance out the master servers */ - register_new_state(REGISTERSTATE_START); - else - { - register_count++; - register_new_state(REGISTERSTATE_HEARTBEAT); - } - } - } - else if(register_state == REGISTERSTATE_ERROR) - { - /* check for restart */ - if(now > register_state_start+freq*60) - register_new_state(REGISTERSTATE_START); - } -} - -static void register_got_count(NETCHUNK *p) -{ - unsigned char *data = (unsigned char *)p->data; - int count = (data[sizeof(SERVERBROWSE_COUNT)]<<8) | data[sizeof(SERVERBROWSE_COUNT)+1]; - int i; - - for(i = 0; i < MAX_MASTERSERVERS; i++) - { - if(net_addr_comp(&masterserver_info[i].addr, &p->address) == 0) - { - masterserver_info[i].count = count; - break; - } - } -} - -int register_process_packet(NETCHUNK *packet) -{ - if(packet->data_size == sizeof(SERVERBROWSE_FWCHECK) && - memcmp(packet->data, SERVERBROWSE_FWCHECK, sizeof(SERVERBROWSE_FWCHECK)) == 0) - { - register_send_fwcheckresponse(&packet->address); - return 1; - } - else if(packet->data_size == sizeof(SERVERBROWSE_FWOK) && - memcmp(packet->data, SERVERBROWSE_FWOK, sizeof(SERVERBROWSE_FWOK)) == 0) - { - if(register_first) - dbg_msg("register", "no firewall/nat problems detected"); - register_new_state(REGISTERSTATE_REGISTERED); - return 1; - } - else if(packet->data_size == sizeof(SERVERBROWSE_FWERROR) && - memcmp(packet->data, SERVERBROWSE_FWERROR, sizeof(SERVERBROWSE_FWERROR)) == 0) - { - dbg_msg("register", "ERROR: the master server reports that clients can not connect to this server."); - dbg_msg("register", "ERROR: configure your firewall/nat to let through udp on port %d.", config.sv_port); - register_new_state(REGISTERSTATE_ERROR); - return 1; - } - else if(packet->data_size == sizeof(SERVERBROWSE_COUNT)+2 && - memcmp(packet->data, SERVERBROWSE_COUNT, sizeof(SERVERBROWSE_COUNT)) == 0) - { - register_got_count(packet); - return 1; - } - - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/engine/server/es_server.cpp b/project/jni/application/teeworlds-0.5.2/src/engine/server/es_server.cpp deleted file mode 100644 index 809e492f4..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/engine/server/es_server.cpp +++ /dev/null @@ -1,1379 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#if defined(CONF_FAMILY_WINDOWS) - #define _WIN32_WINNT 0x0500 - #include -#endif - -static SNAPBUILD builder; - -static int64 game_start_time; -static int current_tick = 0; -static int run_server = 1; - -static char browseinfo_gametype[16] = {0}; -static int browseinfo_progression = -1; - -static int64 lastheartbeat; -/*static NETADDR4 master_server;*/ - -static char current_map[64]; -static int current_map_crc; -static unsigned char *current_map_data = 0; -static int current_map_size = 0; - -void *snap_new_item(int type, int id, int size) -{ - dbg_assert(type >= 0 && type <=0xffff, "incorrect type"); - dbg_assert(id >= 0 && id <=0xffff, "incorrect id"); - return snapbuild_new_item(&builder, type, id, size); -} - -typedef struct -{ - short next; - short state; /* 0 = free, 1 = alloced, 2 = timed */ - int timeout; -} SNAP_ID; - -static const int MAX_IDS = 16*1024; /* should be lowered */ -static SNAP_ID snap_ids[16*1024]; -static int snap_first_free_id; -static int snap_first_timed_id; -static int snap_last_timed_id; -static int snap_id_usage; -static int snap_id_inusage; -static int snap_id_inited = 0; - -enum -{ - SRVCLIENT_STATE_EMPTY = 0, - SRVCLIENT_STATE_AUTH, - SRVCLIENT_STATE_CONNECTING, - SRVCLIENT_STATE_READY, - SRVCLIENT_STATE_INGAME, - - SRVCLIENT_SNAPRATE_INIT=0, - SRVCLIENT_SNAPRATE_FULL, - SRVCLIENT_SNAPRATE_RECOVER -}; - -typedef struct -{ - int data[MAX_INPUT_SIZE]; - int game_tick; /* the tick that was chosen for the input */ -} CLIENT_INPUT; - -/* */ -typedef struct -{ - /* connection state info */ - int state; - int latency; - int snap_rate; - - int last_acked_snapshot; - int last_input_tick; - SNAPSTORAGE snapshots; - - CLIENT_INPUT latestinput; - CLIENT_INPUT inputs[200]; /* TODO: handle input better */ - int current_input; - - char name[MAX_NAME_LENGTH]; - char clan[MAX_CLANNAME_LENGTH]; - int score; - int authed; -} CLIENT; - -static CLIENT clients[MAX_CLIENTS]; -static NETSERVER *net; - -static void snap_init_id() -{ - int i; - if(snap_id_inited) - return; - - for(i = 0; i < MAX_IDS; i++) - { - snap_ids[i].next = i+1; - snap_ids[i].state = 0; - } - - snap_ids[MAX_IDS-1].next = -1; - snap_first_free_id = 0; - snap_first_timed_id = -1; - snap_last_timed_id = -1; - snap_id_usage = 0; - snap_id_inusage = 0; - - snap_id_inited = 1; -} - -static void snap_remove_first_timeout() -{ - int next_timed = snap_ids[snap_first_timed_id].next; - - /* add it to the free list */ - snap_ids[snap_first_timed_id].next = snap_first_free_id; - snap_ids[snap_first_timed_id].state = 0; - snap_first_free_id = snap_first_timed_id; - - /* remove it from the timed list */ - snap_first_timed_id = next_timed; - if(snap_first_timed_id == -1) - snap_last_timed_id = -1; - - snap_id_usage--; -} - -int snap_new_id() -{ - int id; - int64 now = time_get(); - if(!snap_id_inited) - snap_init_id(); - - /* process timed ids */ - while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout < now) - snap_remove_first_timeout(); - - id = snap_first_free_id; - dbg_assert(id != -1, "id error"); - snap_first_free_id = snap_ids[snap_first_free_id].next; - snap_ids[id].state = 1; - snap_id_usage++; - snap_id_inusage++; - return id; -} - -void snap_timeout_ids() -{ - /* process timed ids */ - while(snap_first_timed_id != -1) - snap_remove_first_timeout(); -} - -void snap_free_id(int id) -{ - dbg_assert(snap_ids[id].state == 1, "id is not alloced"); - - snap_id_inusage--; - snap_ids[id].state = 2; - snap_ids[id].timeout = time_get()+time_freq()*5; - snap_ids[id].next = -1; - - if(snap_last_timed_id != -1) - { - snap_ids[snap_last_timed_id].next = id; - snap_last_timed_id = id; - } - else - { - snap_first_timed_id = id; - snap_last_timed_id = id; - } -} - -int *server_latestinput(int client_id, int *size) -{ - if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY) - return 0; - return clients[client_id].latestinput.data; -} - -const char *server_clientname(int client_id) -{ - if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY) - return "(invalid client)"; - return clients[client_id].name; -} - -static const char *str_ltrim(const char *str) -{ - while(*str && *str <= 32) - str++; - return str; -} - -static void str_rtrim(char *str) -{ - int i = str_length(str)-1; - while(i >= 0) - { - if(i > 23 || str[i] <= 32) - str[i] = 0; - else - break; - i--; - } -} - -static int server_try_setclientname(int client_id, const char *name) -{ - int i; - char trimmed_name[64]; - - /* trim the name */ - str_copy(trimmed_name, str_ltrim(name), sizeof(trimmed_name)); - str_rtrim(trimmed_name); - dbg_msg("", "'%s' -> '%s'", name, trimmed_name); - name = trimmed_name; - - - /* check for empty names */ - if(!name[0]) - return -1; - - /* make sure that two clients doesn't have the same name */ - for(i = 0; i < MAX_CLIENTS; i++) - if(i != client_id && clients[i].state >= SRVCLIENT_STATE_READY) - { - if(strcmp(name, clients[i].name) == 0) - return -1; - } - - /* set the client name */ - str_copy(clients[client_id].name, name, MAX_NAME_LENGTH); - return 0; -} - -void server_setclientname(int client_id, const char *name) -{ - char nametry[MAX_NAME_LENGTH]; - int i; - if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY) - return; - - if(!name) - return; - - str_copy(nametry, name, MAX_NAME_LENGTH); - if(server_try_setclientname(client_id, nametry)) - { - /* auto rename */ - for(i = 1;; i++) - { - str_format(nametry, MAX_NAME_LENGTH, "(%d)%s", i, name); - if(server_try_setclientname(client_id, nametry) == 0) - break; - } - } -} - -void server_setclientscore(int client_id, int score) -{ - if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY) - return; - clients[client_id].score = score; -} - -void server_setbrowseinfo(const char *game_type, int progression) -{ - str_copy(browseinfo_gametype, game_type, sizeof(browseinfo_gametype)); - browseinfo_progression = progression; - if(browseinfo_progression > 100) - browseinfo_progression = 100; - if(browseinfo_progression < -1) - browseinfo_progression = -1; -} - -void server_kick(int client_id, const char *reason) -{ - if(client_id < 0 || client_id > MAX_CLIENTS) - return; - - if(clients[client_id].state != SRVCLIENT_STATE_EMPTY) - netserver_drop(net, client_id, reason); -} - -int server_tick() -{ - return current_tick; -} - -int64 server_tick_start_time(int tick) -{ - return game_start_time + (time_freq()*tick)/SERVER_TICK_SPEED; -} - -int server_tickspeed() -{ - return SERVER_TICK_SPEED; -} - -int server_init() -{ - int i; - for(i = 0; i < MAX_CLIENTS; i++) - { - clients[i].state = SRVCLIENT_STATE_EMPTY; - clients[i].name[0] = 0; - clients[i].clan[0] = 0; - snapstorage_init(&clients[i].snapshots); - } - - current_tick = 0; - - return 0; -} - -int server_getclientinfo(int client_id, CLIENT_INFO *info) -{ - dbg_assert(client_id >= 0 && client_id < MAX_CLIENTS, "client_id is not valid"); - dbg_assert(info != 0, "info can not be null"); - - if(clients[client_id].state == SRVCLIENT_STATE_INGAME) - { - info->name = clients[client_id].name; - info->latency = clients[client_id].latency; - return 1; - } - return 0; -} - -int server_send_msg(int client_id) -{ - const MSG_INFO *info = msg_get_info(); - NETCHUNK packet; - if(!info) - return -1; - - mem_zero(&packet, sizeof(NETCHUNK)); - - packet.client_id = client_id; - packet.data = info->data; - packet.data_size = info->size; - - if(info->flags&MSGFLAG_VITAL) - packet.flags |= NETSENDFLAG_VITAL; - if(info->flags&MSGFLAG_FLUSH) - packet.flags |= NETSENDFLAG_FLUSH; - - /* write message to demo recorder */ - if(!(info->flags&MSGFLAG_NORECORD)) - demorec_record_message(info->data, info->size); - - if(!(info->flags&MSGFLAG_NOSEND)) - { - if(client_id == -1) - { - /* broadcast */ - int i; - for(i = 0; i < MAX_CLIENTS; i++) - if(clients[i].state == SRVCLIENT_STATE_INGAME) - { - packet.client_id = i; - netserver_send(net, &packet); - } - } - else - netserver_send(net, &packet); - } - return 0; -} - -static void server_do_snap() -{ - int i; - - { - static PERFORMACE_INFO scope = {"presnap", 0}; - perf_start(&scope); - mods_presnap(); - perf_end(); - } - - /* create snapshot for demo recording */ - if(demorec_isrecording()) - { - char data[MAX_SNAPSHOT_SIZE]; - int snapshot_size; - - /* build snap and possibly add some messages */ - snapbuild_init(&builder); - mods_snap(-1); - snapshot_size = snapbuild_finish(&builder, data); - - /* write snapshot */ - demorec_record_snapshot(server_tick(), data, snapshot_size); - } - - /* create snapshots for all clients */ - for(i = 0; i < MAX_CLIENTS; i++) - { - /* client must be ingame to recive snapshots */ - if(clients[i].state != SRVCLIENT_STATE_INGAME) - continue; - - /* this client is trying to recover, don't spam snapshots */ - if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_RECOVER && (server_tick()%50) != 0) - continue; - - /* this client is trying to recover, don't spam snapshots */ - if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_INIT && (server_tick()%10) != 0) - continue; - - { - char data[MAX_SNAPSHOT_SIZE]; - char deltadata[MAX_SNAPSHOT_SIZE]; - char compdata[MAX_SNAPSHOT_SIZE]; - int snapshot_size; - int crc; - static SNAPSHOT emptysnap; - SNAPSHOT *deltashot = &emptysnap; - int deltashot_size; - int delta_tick = -1; - int deltasize; - static PERFORMACE_INFO scope = {"build", 0}; - perf_start(&scope); - - snapbuild_init(&builder); - - { - static PERFORMACE_INFO scope = {"modsnap", 0}; - perf_start(&scope); - mods_snap(i); - perf_end(); - } - - /* finish snapshot */ - snapshot_size = snapbuild_finish(&builder, data); - crc = snapshot_crc((SNAPSHOT*)data); - - /* remove old snapshos */ - /* keep 3 seconds worth of snapshots */ - snapstorage_purge_until(&clients[i].snapshots, current_tick-SERVER_TICK_SPEED*3); - - /* save it the snapshot */ - snapstorage_add(&clients[i].snapshots, current_tick, time_get(), snapshot_size, data, 0); - - /* find snapshot that we can preform delta against */ - emptysnap.data_size = 0; - emptysnap.num_items = 0; - - { - deltashot_size = snapstorage_get(&clients[i].snapshots, clients[i].last_acked_snapshot, 0, &deltashot, 0); - if(deltashot_size >= 0) - delta_tick = clients[i].last_acked_snapshot; - else - { - /* no acked package found, force client to recover rate */ - if(clients[i].snap_rate == SRVCLIENT_SNAPRATE_FULL) - clients[i].snap_rate = SRVCLIENT_SNAPRATE_RECOVER; - } - } - - /* create delta */ - { - static PERFORMACE_INFO scope = {"delta", 0}; - perf_start(&scope); - deltasize = snapshot_create_delta(deltashot, (SNAPSHOT*)data, deltadata); - perf_end(); - } - - - if(deltasize) - { - /* compress it */ - int snapshot_size; - const int max_size = MAX_SNAPSHOT_PACKSIZE; - int numpackets; - int n, left; - - { - static PERFORMACE_INFO scope = {"compress", 0}; - /*char buffer[512];*/ - perf_start(&scope); - snapshot_size = intpack_compress(deltadata, deltasize, compdata); - - /*str_hex(buffer, sizeof(buffer), compdata, snapshot_size); - dbg_msg("", "deltasize=%d -> %d : %s", deltasize, snapshot_size, buffer);*/ - - perf_end(); - } - - numpackets = (snapshot_size+max_size-1)/max_size; - - for(n = 0, left = snapshot_size; left; n++) - { - int chunk = left < max_size ? left : max_size; - left -= chunk; - - if(numpackets == 1) - msg_pack_start_system(NETMSG_SNAPSINGLE, MSGFLAG_FLUSH); - else - msg_pack_start_system(NETMSG_SNAP, MSGFLAG_FLUSH); - - msg_pack_int(current_tick); - msg_pack_int(current_tick-delta_tick); /* compressed with */ - - if(numpackets != 1) - { - msg_pack_int(numpackets); - msg_pack_int(n); - } - - msg_pack_int(crc); - msg_pack_int(chunk); - msg_pack_raw(&compdata[n*max_size], chunk); - msg_pack_end(); - server_send_msg(i); - } - } - else - { - msg_pack_start_system(NETMSG_SNAPEMPTY, MSGFLAG_FLUSH); - msg_pack_int(current_tick); - msg_pack_int(current_tick-delta_tick); /* compressed with */ - msg_pack_end(); - server_send_msg(i); - } - - perf_end(); - } - } - - mods_postsnap(); -} - - -static void reset_client(int cid) -{ - /* reset input */ - int i; - for(i = 0; i < 200; i++) - clients[cid].inputs[i].game_tick = -1; - clients[cid].current_input = 0; - mem_zero(&clients[cid].latestinput, sizeof(clients[cid].latestinput)); - - snapstorage_purge_all(&clients[cid].snapshots); - clients[cid].last_acked_snapshot = -1; - clients[cid].last_input_tick = -1; - clients[cid].snap_rate = SRVCLIENT_SNAPRATE_INIT; - clients[cid].score = 0; - -} - -static int new_client_callback(int cid, void *user) -{ - clients[cid].state = SRVCLIENT_STATE_AUTH; - clients[cid].name[0] = 0; - clients[cid].clan[0] = 0; - clients[cid].authed = 0; - reset_client(cid); - return 0; -} - -static int del_client_callback(int cid, void *user) -{ - /* notify the mod about the drop */ - if(clients[cid].state >= SRVCLIENT_STATE_READY) - mods_client_drop(cid); - - clients[cid].state = SRVCLIENT_STATE_EMPTY; - clients[cid].name[0] = 0; - clients[cid].clan[0] = 0; - clients[cid].authed = 0; - snapstorage_purge_all(&clients[cid].snapshots); - return 0; -} - -static void server_send_map(int cid) -{ - msg_pack_start_system(NETMSG_MAP_CHANGE, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_string(config.sv_map, 0); - msg_pack_int(current_map_crc); - msg_pack_end(); - server_send_msg(cid); -} - -static void server_send_rcon_line(int cid, const char *line) -{ - msg_pack_start_system(NETMSG_RCON_LINE, MSGFLAG_VITAL); - msg_pack_string(line, 512); - msg_pack_end(); - server_send_msg(cid); -} - -static void server_send_rcon_line_authed(const char *line, void *user_data) -{ - static volatile int reentry_guard = 0; - int i; - - if(reentry_guard) return; - reentry_guard++; - - for(i = 0; i < MAX_CLIENTS; i++) - { - if(clients[i].state != SRVCLIENT_STATE_EMPTY && clients[i].authed) - server_send_rcon_line(i, line); - } - - reentry_guard--; -} - -static void server_process_client_packet(NETCHUNK *packet) -{ - int cid = packet->client_id; - NETADDR addr; - - int sys; - int msg = msg_unpack_start(packet->data, packet->data_size, &sys); - - if(clients[cid].state == SRVCLIENT_STATE_AUTH) - { - if(sys && msg == NETMSG_INFO) - { - char version[64]; - const char *password; - str_copy(version, msg_unpack_string(), 64); - if(strcmp(version, mods_net_version()) != 0) - { - /* OH FUCK! wrong version, drop him */ - char reason[256]; - str_format(reason, sizeof(reason), "wrong version. server is running '%s' and client '%s'.", mods_net_version(), version); - netserver_drop(net, cid, reason); - return; - } - - str_copy(clients[cid].name, msg_unpack_string(), MAX_NAME_LENGTH); - str_copy(clients[cid].clan, msg_unpack_string(), MAX_CLANNAME_LENGTH); - password = msg_unpack_string(); - - if(config.password[0] != 0 && strcmp(config.password, password) != 0) - { - /* wrong password */ - netserver_drop(net, cid, "wrong password"); - return; - } - - clients[cid].state = SRVCLIENT_STATE_CONNECTING; - server_send_map(cid); - } - } - else - { - if(sys) - { - /* system message */ - if(msg == NETMSG_REQUEST_MAP_DATA) - { - int chunk = msg_unpack_int(); - int chunk_size = 1024-128; - int offset = chunk * chunk_size; - int last = 0; - - /* drop faulty map data requests */ - if(chunk < 0 || offset > current_map_size) - return; - - if(offset+chunk_size >= current_map_size) - { - chunk_size = current_map_size-offset; - if(chunk_size < 0) - chunk_size = 0; - last = 1; - } - - msg_pack_start_system(NETMSG_MAP_DATA, MSGFLAG_VITAL|MSGFLAG_FLUSH); - msg_pack_int(last); - msg_pack_int(current_map_size); - msg_pack_int(chunk_size); - msg_pack_raw(¤t_map_data[offset], chunk_size); - msg_pack_end(); - server_send_msg(cid); - - if(config.debug) - dbg_msg("server", "sending chunk %d with size %d", chunk, chunk_size); - } - else if(msg == NETMSG_READY) - { - if(clients[cid].state == SRVCLIENT_STATE_CONNECTING) - { - netserver_client_addr(net, cid, &addr); - - dbg_msg("server", "player is ready. cid=%x ip=%d.%d.%d.%d", - cid, - addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3] - ); - clients[cid].state = SRVCLIENT_STATE_READY; - mods_connected(cid); - } - } - else if(msg == NETMSG_ENTERGAME) - { - if(clients[cid].state == SRVCLIENT_STATE_READY) - { - netserver_client_addr(net, cid, &addr); - - dbg_msg("server", "player has entered the game. cid=%x ip=%d.%d.%d.%d", - cid, - addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3] - ); - clients[cid].state = SRVCLIENT_STATE_INGAME; - mods_client_enter(cid); - } - } - else if(msg == NETMSG_INPUT) - { - int tick, size, i; - CLIENT_INPUT *input; - int64 tagtime; - - clients[cid].last_acked_snapshot = msg_unpack_int(); - tick = msg_unpack_int(); - size = msg_unpack_int(); - - /* check for errors */ - if(msg_unpack_error() || size/4 > MAX_INPUT_SIZE) - return; - - if(clients[cid].last_acked_snapshot > 0) - clients[cid].snap_rate = SRVCLIENT_SNAPRATE_FULL; - - if(snapstorage_get(&clients[cid].snapshots, clients[cid].last_acked_snapshot, &tagtime, 0, 0) >= 0) - clients[cid].latency = (int)(((time_get()-tagtime)*1000)/time_freq()); - - /* add message to report the input timing */ - /* skip packets that are old */ - if(tick > clients[cid].last_input_tick) - { - int time_left = ((server_tick_start_time(tick)-time_get())*1000) / time_freq(); - msg_pack_start_system(NETMSG_INPUTTIMING, 0); - msg_pack_int(tick); - msg_pack_int(time_left); - msg_pack_end(); - server_send_msg(cid); - } - - clients[cid].last_input_tick = tick; - - input = &clients[cid].inputs[clients[cid].current_input]; - - if(tick <= server_tick()) - tick = server_tick()+1; - - input->game_tick = tick; - - for(i = 0; i < size/4; i++) - input->data[i] = msg_unpack_int(); - - mem_copy(clients[cid].latestinput.data, input->data, MAX_INPUT_SIZE*sizeof(int)); - - clients[cid].current_input++; - clients[cid].current_input %= 200; - - /* call the mod with the fresh input data */ - if(clients[cid].state == SRVCLIENT_STATE_INGAME) - mods_client_direct_input(cid, clients[cid].latestinput.data); - } - else if(msg == NETMSG_RCON_CMD) - { - const char *cmd = msg_unpack_string(); - - if(msg_unpack_error() == 0 && clients[cid].authed) - { - dbg_msg("server", "cid=%d rcon='%s'", cid, cmd); - console_execute_line(cmd); - } - } - else if(msg == NETMSG_RCON_AUTH) - { - const char *pw; - msg_unpack_string(); /* login name, not used */ - pw = msg_unpack_string(); - - if(msg_unpack_error() == 0) - { - if(config.sv_rcon_password[0] == 0) - { - server_send_rcon_line(cid, "No rcon password set on server. Set sv_rcon_password to enable the remote console."); - } - else if(strcmp(pw, config.sv_rcon_password) == 0) - { - msg_pack_start_system(NETMSG_RCON_AUTH_STATUS, MSGFLAG_VITAL); - msg_pack_int(1); - msg_pack_end(); - server_send_msg(cid); - - clients[cid].authed = 1; - server_send_rcon_line(cid, "Authentication successful. Remote console access granted."); - dbg_msg("server", "cid=%d authed", cid); - } - else - { - server_send_rcon_line(cid, "Wrong password."); - } - } - } - else if(msg == NETMSG_PING) - { - msg_pack_start_system(NETMSG_PING_REPLY, 0); - msg_pack_end(); - server_send_msg(cid); - } - else - { - char hex[] = "0123456789ABCDEF"; - char buf[512]; - int b; - - for(b = 0; b < packet->data_size && b < 32; b++) - { - buf[b*3] = hex[((const unsigned char *)packet->data)[b]>>4]; - buf[b*3+1] = hex[((const unsigned char *)packet->data)[b]&0xf]; - buf[b*3+2] = ' '; - buf[b*3+3] = 0; - } - - dbg_msg("server", "strange message cid=%d msg=%d data_size=%d", cid, msg, packet->data_size); - dbg_msg("server", "%s", buf); - - } - } - else - { - /* game message */ - if(clients[cid].state >= SRVCLIENT_STATE_READY) - mods_message(msg, cid); - } - } -} - - -int server_ban_add(NETADDR addr, int seconds) -{ - return netserver_ban_add(net, addr, seconds); -} - -int server_ban_remove(NETADDR addr) -{ - return netserver_ban_remove(net, addr); -} - -static void server_send_serverinfo(NETADDR *addr, int token) -{ - NETCHUNK packet; - PACKER p; - char buf[128]; - - /* count the players */ - int player_count = 0; - int i; - for(i = 0; i < MAX_CLIENTS; i++) - { - if(clients[i].state != SRVCLIENT_STATE_EMPTY) - player_count++; - } - - packer_reset(&p); - - if(token >= 0) - { - /* new token based format */ - packer_add_raw(&p, SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO)); - str_format(buf, sizeof(buf), "%d", token); - packer_add_string(&p, buf, 6); - } - else - { - /* old format */ - packer_add_raw(&p, SERVERBROWSE_OLD_INFO, sizeof(SERVERBROWSE_OLD_INFO)); - } - - packer_add_string(&p, mods_version(), 32); - packer_add_string(&p, config.sv_name, 64); - packer_add_string(&p, config.sv_map, 32); - - /* gametype */ - packer_add_string(&p, browseinfo_gametype, 16); - - /* flags */ - i = 0; - if(config.password[0]) /* password set */ - i |= SRVFLAG_PASSWORD; - str_format(buf, sizeof(buf), "%d", i); - packer_add_string(&p, buf, 2); - - /* progression */ - str_format(buf, sizeof(buf), "%d", browseinfo_progression); - packer_add_string(&p, buf, 4); - - str_format(buf, sizeof(buf), "%d", player_count); packer_add_string(&p, buf, 3); /* num players */ - str_format(buf, sizeof(buf), "%d", netserver_max_clients(net)); packer_add_string(&p, buf, 3); /* max players */ - - for(i = 0; i < MAX_CLIENTS; i++) - { - if(clients[i].state != SRVCLIENT_STATE_EMPTY) - { - packer_add_string(&p, clients[i].name, 48); /* player name */ - str_format(buf, sizeof(buf), "%d", clients[i].score); packer_add_string(&p, buf, 6); /* player score */ - } - } - - - packet.client_id = -1; - packet.address = *addr; - packet.flags = NETSENDFLAG_CONNLESS; - packet.data_size = packer_size(&p); - packet.data = packer_data(&p); - netserver_send(net, &packet); -} - -extern int register_process_packet(NETCHUNK *packet); -extern int register_update(); - -static void server_pump_network() -{ - NETCHUNK packet; - - netserver_update(net); - - /* process packets */ - while(netserver_recv(net, &packet)) - { - if(packet.client_id == -1) - { - /* stateless */ - if(!register_process_packet(&packet)) - { - if(packet.data_size == sizeof(SERVERBROWSE_GETINFO)+1 && - memcmp(packet.data, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO)) == 0) - { - server_send_serverinfo(&packet.address, ((unsigned char *)packet.data)[sizeof(SERVERBROWSE_GETINFO)]); - } - - - if(packet.data_size == sizeof(SERVERBROWSE_OLD_GETINFO) && - memcmp(packet.data, SERVERBROWSE_OLD_GETINFO, sizeof(SERVERBROWSE_OLD_GETINFO)) == 0) - { - server_send_serverinfo(&packet.address, -1); - } - } - } - else - server_process_client_packet(&packet); - } -} - -static int server_load_map(const char *mapname) -{ - DATAFILE *df; - char buf[512]; - str_format(buf, sizeof(buf), "maps/%s.map", mapname); - df = datafile_load(buf); - if(!df) - return 0; - - /* reinit snapshot ids */ - snap_timeout_ids(); - - /* get the crc of the map */ - current_map_crc = datafile_crc(buf); - dbg_msg("server", "%s crc is %08x", buf, current_map_crc); - - str_copy(current_map, mapname, sizeof(current_map)); - map_set(df); - - /* load compelate map into memory for download */ - { - IOHANDLE file = engine_openfile(buf, IOFLAG_READ); - current_map_size = (int)io_length(file); - if(current_map_data) - mem_free(current_map_data); - current_map_data = (unsigned char *)mem_alloc(current_map_size, 1); - io_read(file, current_map_data, current_map_size); - io_close(file); - } - return 1; -} - -static int server_run() -{ - NETADDR bindaddr; - - snap_init_id(); - net_init(); - - /* */ - console_register_print_callback(server_send_rcon_line_authed, 0); - - /* load map */ - if(!server_load_map(config.sv_map)) - { - dbg_msg("server", "failed to load map. mapname='%s'", config.sv_map); - return -1; - } - - /* start server */ - /* TODO: IPv6 support */ - if(config.sv_bindaddr[0] && net_host_lookup(config.sv_bindaddr, &bindaddr, NETTYPE_IPV4) == 0) - { - /* sweet! */ - bindaddr.port = config.sv_port; - } - else - { - mem_zero(&bindaddr, sizeof(bindaddr)); - bindaddr.port = config.sv_port; - } - - net = netserver_open(bindaddr, config.sv_max_clients, 0); - if(!net) - { - dbg_msg("server", "couldn't open socket. port might already be in use"); - return -1; - } - - netserver_set_callbacks(net, new_client_callback, del_client_callback, 0); - - dbg_msg("server", "server name is '%s'", config.sv_name); - - mods_init(); - dbg_msg("server", "version %s", mods_net_version()); - - /* start game */ - { - int64 reporttime = time_get(); - int reportinterval = 3; - - lastheartbeat = 0; - game_start_time = time_get(); - - if(config.debug) - dbg_msg("server", "baseline memory usage %dk", mem_stats()->allocated/1024); - - while(run_server) - { - static PERFORMACE_INFO rootscope = {"root", 0}; - int64 t = time_get(); - int new_ticks = 0; - - perf_start(&rootscope); - - /* load new map TODO: don't poll this */ - if(strcmp(config.sv_map, current_map) != 0 || config.sv_map_reload) - { - config.sv_map_reload = 0; - - /* load map */ - if(server_load_map(config.sv_map)) - { - int c; - - /* new map loaded */ - mods_shutdown(); - - for(c = 0; c < MAX_CLIENTS; c++) - { - if(clients[c].state == SRVCLIENT_STATE_EMPTY) - continue; - - server_send_map(c); - reset_client(c); - clients[c].state = SRVCLIENT_STATE_CONNECTING; - } - - game_start_time = time_get(); - current_tick = 0; - mods_init(); - } - else - { - dbg_msg("server", "failed to load map. mapname='%s'", config.sv_map); - config_set_sv_map(&config, current_map); - } - } - - while(t > server_tick_start_time(current_tick+1)) - { - current_tick++; - new_ticks++; - - /* apply new input */ - { - static PERFORMACE_INFO scope = {"input", 0}; - int c, i; - - perf_start(&scope); - - for(c = 0; c < MAX_CLIENTS; c++) - { - if(clients[c].state == SRVCLIENT_STATE_EMPTY) - continue; - for(i = 0; i < 200; i++) - { - if(clients[c].inputs[i].game_tick == server_tick()) - { - if(clients[c].state == SRVCLIENT_STATE_INGAME) - mods_client_predicted_input(c, clients[c].inputs[i].data); - break; - } - } - } - - perf_end(); - } - - /* progress game */ - { - static PERFORMACE_INFO scope = {"tick", 0}; - perf_start(&scope); - mods_tick(); - perf_end(); - } - } - - /* snap game */ - if(new_ticks) - { - if(config.sv_high_bandwidth || (current_tick%2) == 0) - { - static PERFORMACE_INFO scope = {"snap", 0}; - perf_start(&scope); - server_do_snap(); - perf_end(); - } - } - - /* master server stuff */ - register_update(); - - - { - static PERFORMACE_INFO scope = {"net", 0}; - perf_start(&scope); - server_pump_network(); - perf_end(); - } - - perf_end(); - - if(reporttime < time_get()) - { - if(config.debug) - { - /* - static NETSTATS prev_stats; - NETSTATS stats; - netserver_stats(net, &stats); - - perf_next(); - - if(config.dbg_pref) - perf_dump(&rootscope); - - dbg_msg("server", "send=%8d recv=%8d", - (stats.send_bytes - prev_stats.send_bytes)/reportinterval, - (stats.recv_bytes - prev_stats.recv_bytes)/reportinterval); - - prev_stats = stats; - */ - } - - reporttime += time_freq()*reportinterval; - } - - /* wait for incomming data */ - net_socket_read_wait(netserver_socket(net), 5); - } - } - - mods_shutdown(); - map_unload(); - - if(current_map_data) - mem_free(current_map_data); - return 0; -} - -static void con_kick(void *result, void *user_data) -{ - server_kick(console_arg_int(result, 0), "kicked by console"); -} - -static int str_allnum(const char *str) -{ - while(*str) - { - if(!(*str >= '0' && *str <= '9')) - return 0; - str++; - } - return 1; -} - -static void con_ban(void *result, void *user_data) -{ - NETADDR addr; - char addrstr[128]; - const char *str = console_arg_string(result, 0); - int minutes = 30; - - if(console_arg_num(result) > 1) - minutes = console_arg_int(result, 1); - - if(net_addr_from_str(&addr, str) == 0) - server_ban_add(addr, minutes*60); - else if(str_allnum(str)) - { - NETADDR addr; - int cid = atoi(str); - - if(cid < 0 || cid > MAX_CLIENTS || clients[cid].state == SRVCLIENT_STATE_EMPTY) - { - dbg_msg("server", "invalid client id"); - return; - } - - netserver_client_addr(net, cid, &addr); - server_ban_add(addr, minutes*60); - } - - addr.port = 0; - net_addr_str(&addr, addrstr, sizeof(addrstr)); - - if(minutes) - dbg_msg("server", "banned %s for %d minutes", addrstr, minutes); - else - dbg_msg("server", "banned %s for life", addrstr); -} - -static void con_unban(void *result, void *user_data) -{ - NETADDR addr; - const char *str = console_arg_string(result, 0); - - if(net_addr_from_str(&addr, str) == 0) - server_ban_remove(addr); - else - dbg_msg("server", "invalid network address"); -} - -static void con_bans(void *result, void *user_data) -{ - int i; - unsigned now = time_timestamp(); - NETBANINFO info; - NETADDR addr; - int num = netserver_ban_num(net); - for(i = 0; i < num; i++) - { - unsigned t; - netserver_ban_get(net, i, &info); - addr = info.addr; - - if(info.expires == 0xffffffff) - { - dbg_msg("server", "#%d %d.%d.%d.%d for life", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]); - } - else - { - t = info.expires - now; - dbg_msg("server", "#%d %d.%d.%d.%d for %d minutes and %d seconds", i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], t/60, t%60); - } - } - dbg_msg("server", "%d ban(s)", num); -} - -static void con_status(void *result, void *user_data) -{ - int i; - NETADDR addr; - for(i = 0; i < MAX_CLIENTS; i++) - { - if(clients[i].state == SRVCLIENT_STATE_INGAME) - { - netserver_client_addr(net, i, &addr); - dbg_msg("server", "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d", - i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], addr.port, - clients[i].name, clients[i].score); - } - } -} - -static void con_shutdown(void *result, void *user_data) -{ - run_server = 0; -} - -static void con_record(void *result, void *user_data) -{ - char filename[512]; - str_format(filename, sizeof(filename), "demos/%s.demo", console_arg_string(result, 0)); - demorec_record_start(filename, mods_net_version(), current_map, current_map_crc, "server"); -} - -static void con_stoprecord(void *result, void *user_data) -{ - demorec_record_stop(); -} - -static void server_register_commands() -{ - MACRO_REGISTER_COMMAND("kick", "i", CFGFLAG_SERVER, con_kick, 0, ""); - MACRO_REGISTER_COMMAND("ban", "s?i", CFGFLAG_SERVER, con_ban, 0, ""); - MACRO_REGISTER_COMMAND("unban", "s", CFGFLAG_SERVER, con_unban, 0, ""); - MACRO_REGISTER_COMMAND("bans", "", CFGFLAG_SERVER, con_bans, 0, ""); - MACRO_REGISTER_COMMAND("status", "", CFGFLAG_SERVER, con_status, 0, ""); - MACRO_REGISTER_COMMAND("shutdown", "", CFGFLAG_SERVER, con_shutdown, 0, ""); - - MACRO_REGISTER_COMMAND("record", "s", CFGFLAG_SERVER, con_record, 0, ""); - MACRO_REGISTER_COMMAND("stoprecord", "", CFGFLAG_SERVER, con_stoprecord, 0, ""); -} - -#if 0 -int main(int argc, char **argv) -{ -#if defined(CONF_FAMILY_WINDOWS) - int i; - for(i = 1; i < argc; i++) - { - if(strcmp("-s", argv[i]) == 0 || strcmp("--silent", argv[i]) == 0) - { - ShowWindow(GetConsoleWindow(), SW_HIDE); - break; - } - } -#endif - - /* init the engine */ - dbg_msg("server", "starting..."); - engine_init("Teeworlds"); - - /* register all console commands */ - server_register_commands(); - mods_console_init(); - - /* parse the command line arguments */ - engine_parse_arguments(argc, argv); - - /* run the server */ - server_run(); - return 0; -} -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.cpp deleted file mode 100644 index d8c20decd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -#include -#include -#include -#include - -#include "animstate.hpp" - -static void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame) -{ - if(seq->num_frames == 0) - { - frame->time = 0; - frame->x = 0; - frame->y = 0; - frame->angle = 0; - } - else if(seq->num_frames == 1) - { - *frame = seq->frames[0]; - } - else - { - //time = max(0.0f, min(1.0f, time / duration)); // TODO: use clamp - ANIM_KEYFRAME *frame1 = 0; - ANIM_KEYFRAME *frame2 = 0; - float blend = 0.0f; - - // TODO: make this smarter.. binary search - for (int i = 1; i < seq->num_frames; i++) - { - if (seq->frames[i-1].time <= time && seq->frames[i].time >= time) - { - frame1 = &seq->frames[i-1]; - frame2 = &seq->frames[i]; - blend = (time - frame1->time) / (frame2->time - frame1->time); - break; - } - } - - if (frame1 && frame2) - { - frame->time = time; - frame->x = mix(frame1->x, frame2->x, blend); - frame->y = mix(frame1->y, frame2->y, blend); - frame->angle = mix(frame1->angle, frame2->angle, blend); - } - } -} - -static void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount) -{ - seq->x += added->x*amount; - seq->y += added->y*amount; - seq->angle += added->angle*amount; -} - -static void anim_add(ANIMSTATE *state, ANIMSTATE *added, float amount) -{ - anim_add_keyframe(&state->body, &added->body, amount); - anim_add_keyframe(&state->back_foot, &added->back_foot, amount); - anim_add_keyframe(&state->front_foot, &added->front_foot, amount); - anim_add_keyframe(&state->attach, &added->attach, amount); -} - - -void ANIMSTATE::set(ANIMATION *anim, float time) -{ - anim_seq_eval(&anim->body, time, &body); - anim_seq_eval(&anim->back_foot, time, &back_foot); - anim_seq_eval(&anim->front_foot, time, &front_foot); - anim_seq_eval(&anim->attach, time, &attach); -} - -void ANIMSTATE::add(ANIMATION *anim, float time, float amount) -{ - ANIMSTATE add; - add.set(anim, time); - anim_add(this, &add, amount); -} - -ANIMSTATE *ANIMSTATE::get_idle() -{ - static ANIMSTATE state; - static bool init = true; - - if(init) - { - state.set(&data->animations[ANIM_BASE], 0); - state.add(&data->animations[ANIM_IDLE], 0, 1.0f); - init = false; - } - - return &state; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.hpp deleted file mode 100644 index 4b84dd66c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/animstate.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef GAME_CLIENT_ANIMATION_H -#define GAME_CLIENT_ANIMATION_H - -class ANIMSTATE -{ -public: - ANIM_KEYFRAME body; - ANIM_KEYFRAME back_foot; - ANIM_KEYFRAME front_foot; - ANIM_KEYFRAME attach; - - void set(ANIMATION *anim, float time); - void add(ANIMATION *added, float time, float amount); - - static ANIMSTATE *get_idle(); -}; - -//void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame); -//void anim_eval(ANIMATION *anim, float time, ANIM_STATE *state); -//void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount); -//void anim_add(ANIM_STATE *state, ANIM_STATE *added, float amount); -//void anim_eval_add(ANIM_STATE *state, ANIMATION *anim, float time, float amount); - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/clienthooks.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/clienthooks.cpp deleted file mode 100644 index 88a7722a6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/clienthooks.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include - -#include "gameclient.hpp" -#include "components/console.hpp" - - - - -// clean hooks -extern "C" void modc_entergame() {} -extern "C" void modc_shutdown() {} -extern "C" void modc_console_init() { gameclient.on_console_init(); } -extern "C" void modc_save_config() { gameclient.on_save(); } -extern "C" void modc_init() { gameclient.on_init(); } -extern "C" void modc_connected() { gameclient.on_connected(); } -extern "C" void modc_predict() { gameclient.on_predict(); } -extern "C" void modc_newsnapshot() { gameclient.on_snapshot(); } -extern "C" int modc_snap_input(int *data) { return gameclient.on_snapinput(data); } -extern "C" void modc_statechange(int state, int old) { gameclient.on_statechange(state, old); } -extern "C" void modc_render() { gameclient.on_render(); } -extern "C" void modc_message(int msgtype) { gameclient.on_message(msgtype); } -extern "C" void modc_rcon_line(const char *line) { gameclient.console->print_line(1, line); } - -extern "C" const char *modc_net_version() { return GAME_NETVERSION; } -extern "C" const char *modc_getitemname(int type) { return netobj_get_name(type); } - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/component.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/component.hpp deleted file mode 100644 index 3d5edb86d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/component.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef GAME_CLIENT_GAMESYSTEM_H -#define GAME_CLIENT_GAMESYSTEM_H - -#include - -class GAMECLIENT; - -class COMPONENT -{ -protected: - GAMECLIENT *client; -public: - virtual ~COMPONENT() {} - - virtual void on_statechange(int new_state, int old_state) {}; - virtual void on_console_init() {}; - virtual void on_init() {}; - virtual void on_save() {}; - virtual void on_reset() {}; - virtual void on_render() {}; - virtual void on_mapload() {}; - virtual void on_message(int msg, void *rawmsg) {} - virtual bool on_mousemove(float x, float y) { return false; } - virtual bool on_input(INPUT_EVENT e) { return false; } -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.cpp deleted file mode 100644 index 7ab5ba407..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.cpp +++ /dev/null @@ -1,241 +0,0 @@ -#include // atoi -#include // strcmp -#include -#include "binds.hpp" - -bool BINDS::BINDS_SPECIAL::on_input(INPUT_EVENT e) -{ - // don't handle invalid events and keys that arn't set to anything - if(e.key >= KEY_F1 && e.key <= KEY_F15 && binds->keybindings[e.key][0] != 0) - { - int stroke = 0; - if(e.flags&INPFLAG_PRESS) - stroke = 1; - console_execute_line_stroked(stroke, binds->keybindings[e.key]); - return true; - } - - return false; -} - -BINDS::BINDS() -{ - mem_zero(keybindings, sizeof(keybindings)); - special_binds.binds = this; -} - -void BINDS::bind(int keyid, const char *str) -{ - if(keyid < 0 || keyid >= KEY_LAST) - return; - - str_copy(keybindings[keyid], str, sizeof(keybindings[keyid])); - if(!keybindings[keyid][0]) - dbg_msg("binds", "unbound %s (%d)", inp_key_name(keyid), keyid); - else - dbg_msg("binds", "bound %s (%d) = %s", inp_key_name(keyid), keyid, keybindings[keyid]); -} - - -bool BINDS::on_input(INPUT_EVENT e) -{ - // don't handle invalid events and keys that arn't set to anything - if(e.key <= 0 || e.key >= KEY_LAST || keybindings[e.key][0] == 0) - return false; - - int stroke = 0; - if(e.flags&INPFLAG_PRESS) - stroke = 1; - console_execute_line_stroked(stroke, keybindings[e.key]); - return true; -} - -void BINDS::unbindall() -{ - for(int i = 0; i < KEY_LAST; i++) - keybindings[i][0] = 0; -} - -const char *BINDS::get(int keyid) -{ - if(keyid > 0 && keyid < KEY_LAST) - return keybindings[keyid]; - return ""; -} - -const char *BINDS::get_key(const char *bindstr) -{ - for(int keyid = 0; keyid < KEY_LAST; keyid++) - { - const char *bind = get(keyid); - if(!bind[0]) - continue; - - if(strcmp(bind, bindstr) == 0) - return inp_key_name(keyid); - } - - return ""; -} - -void BINDS::set_defaults() -{ - // set default key bindings - unbindall(); - -#ifdef ANDROID - - bind(KEY_MOUSE_1, "+fire"); - bind(KEY_LEFT, "+left"); - bind(KEY_RIGHT, "+right"); - bind(KEY_UP, "+jump"); - bind(KEY_DOWN, "+hook"); - bind(KEY_RETURN, "+jump"); - bind(KEY_SPACE, "+hook"); - bind(KEY_MOUSE_2, "+hook"); - bind(KEY_LSHIFT, "+nextweapon"); - bind(KEY_RSHIFT, "+prevweapon"); - -#else - - bind(KEY_F1, "toggle_local_console"); - bind(KEY_F2, "toggle_remote_console"); - bind(KEY_TAB, "+scoreboard"); - bind(KEY_F10, "screenshot"); - - bind('a', "+left"); - bind('d', "+right"); - - bind(KEY_SPACE, "+jump"); - bind(KEY_MOUSE_1, "+fire"); - bind(KEY_MOUSE_2, "+hook"); - bind(KEY_LSHIFT, "+emote"); - - bind('1', "+weapon1"); - bind('2', "+weapon2"); - bind('3', "+weapon3"); - bind('4', "+weapon4"); - bind('5', "+weapon5"); - - bind(KEY_MOUSE_WHEEL_UP, "+prevweapon"); - bind(KEY_MOUSE_WHEEL_DOWN, "+nextweapon"); - - bind('t', "chat all"); - bind('y', "chat team"); - - bind(KEY_F3, "vote yes"); - bind(KEY_F4, "vote no"); - -#endif - -} - -void BINDS::on_console_init() -{ - // bindings - MACRO_REGISTER_COMMAND("bind", "sr", CFGFLAG_CLIENT, con_bind, this, "Bind key to execute the command"); - MACRO_REGISTER_COMMAND("unbind", "s", CFGFLAG_CLIENT, con_unbind, this, "Unbind key"); - MACRO_REGISTER_COMMAND("unbindall", "", CFGFLAG_CLIENT, con_unbindall, this, "Unbind all keys"); - MACRO_REGISTER_COMMAND("dump_binds", "", CFGFLAG_CLIENT, con_dump_binds, this, "Dump binds"); - - // default bindings - set_defaults(); -} - -void BINDS::con_bind(void *result, void *user_data) -{ - BINDS *binds = (BINDS *)user_data; - const char *key_name = console_arg_string(result, 0); - int id = binds->get_key_id(key_name); - - if(!id) - { - dbg_msg("binds", "key %s not found", key_name); - return; - } - - binds->bind(id, console_arg_string(result, 1)); -} - - -void BINDS::con_unbind(void *result, void *user_data) -{ - BINDS *binds = (BINDS *)user_data; - const char *key_name = console_arg_string(result, 0); - int id = binds->get_key_id(key_name); - - if(!id) - { - dbg_msg("binds", "key %s not found", key_name); - return; - } - - binds->bind(id, ""); -} - - -void BINDS::con_unbindall(void *result, void *user_data) -{ - BINDS *binds = (BINDS *)user_data; - binds->unbindall(); -} - - -void BINDS::con_dump_binds(void *result, void *user_data) -{ - BINDS *binds = (BINDS *)user_data; - for(int i = 0; i < KEY_LAST; i++) - { - if(binds->keybindings[i][0] == 0) - continue; - dbg_msg("binds", "%s (%d) = %s", inp_key_name(i), i, binds->keybindings[i]); - } -} - -int BINDS::get_key_id(const char *key_name) -{ - // check for numeric - if(key_name[0] == '&') - { - int i = atoi(key_name+1); - if(i > 0 && i < KEY_LAST) - return i; // numeric - } - - // search for key - for(int i = 0; i < KEY_LAST; i++) - { - if(strcmp(key_name, inp_key_name(i)) == 0) - return i; - } - - return 0; -} - -void BINDS::on_save() -{ - char buffer[256]; - char *end = buffer+sizeof(buffer)-8; - client_save_line("unbindall"); - for(int i = 0; i < KEY_LAST; i++) - { - if(keybindings[i][0] == 0) - continue; - str_format(buffer, sizeof(buffer), "bind %s ", inp_key_name(i)); - - // process the string. we need to escape some characters - const char *src = keybindings[i]; - char *dst = buffer + strlen(buffer); - *dst++ = '"'; - while(*src && dst < end) - { - if(*src == '"' || *src == '\\') // escape \ and " - *dst++ = '\\'; - *dst++ = *src++; - } - *dst++ = '"'; - *dst++ = 0; - - client_save_line(buffer); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.hpp deleted file mode 100644 index bdf242f91..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/binds.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -class BINDS : public COMPONENT -{ - char keybindings[KEY_LAST][128]; - - int get_key_id(const char *key_name); - - static void con_bind(void *result, void *user_data); - static void con_unbind(void *result, void *user_data); - static void con_unbindall(void *result, void *user_data); - static void con_dump_binds(void *result, void *user_data); - -public: - BINDS(); - - class BINDS_SPECIAL : public COMPONENT - { - public: - BINDS *binds; - virtual bool on_input(INPUT_EVENT e); - }; - - BINDS_SPECIAL special_binds; - - void bind(int keyid, const char *str); - void set_defaults(); - void unbindall(); - const char *get(int keyid); - const char *get_key(const char *bindstr); - - virtual void on_save(); - virtual void on_console_init(); - virtual bool on_input(INPUT_EVENT e); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.cpp deleted file mode 100644 index 960b004c6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include - -#include - -#include "broadcast.hpp" - -void BROADCAST::on_reset() -{ - broadcast_time = 0; -} - -void BROADCAST::on_render() -{ - gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300); - - if(time_get() < broadcast_time) - { - float w = gfx_text_width(0, 14, broadcast_text, -1); - gfx_text(0, 150*gfx_screenaspect()-w/2, 35, 14, broadcast_text, -1); - } -} - -void BROADCAST::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_BROADCAST) - { - NETMSG_SV_BROADCAST *msg = (NETMSG_SV_BROADCAST *)rawmsg; - str_copy(broadcast_text, msg->message, sizeof(broadcast_text)); - broadcast_time = time_get()+time_freq()*10; - } -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.hpp deleted file mode 100644 index 102201ccd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/broadcast.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -class BROADCAST : public COMPONENT -{ -public: - // broadcasts - char broadcast_text[1024]; - int64 broadcast_time; - - virtual void on_reset(); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.cpp deleted file mode 100644 index 7b188e006..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.cpp +++ /dev/null @@ -1,40 +0,0 @@ -extern "C" { - #include - #include -} - -#include -#include -#include -#include - -#include "camera.hpp" -#include "controls.hpp" - -CAMERA::CAMERA() -{ -} - -void CAMERA::on_render() -{ - //vec2 center; - zoom = 1.0f; - - // update camera center - if(gameclient.snap.spectate) - center = gameclient.controls->mouse_pos; - else - { - - float l = length(gameclient.controls->mouse_pos); - float deadzone = config.cl_mouse_deadzone; - float follow_factor = config.cl_mouse_followfactor/100.0f; - vec2 camera_offset(0, 0); - - float offset_amount = max(l-deadzone, 0.0f) * follow_factor; - if(l > 0.0001f) // make sure that this isn't 0 - camera_offset = normalize(gameclient.controls->mouse_pos)*offset_amount; - - center = gameclient.local_character_pos + camera_offset; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.hpp deleted file mode 100644 index 1cb05f5bf..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/camera.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -class CAMERA : public COMPONENT -{ -public: - vec2 center; - float zoom; - - CAMERA(); - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.cpp deleted file mode 100644 index 8ef4e17dd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#include // strcmp - -#include -#include -#include - -#include - -#include - -#include "chat.hpp" - -void CHAT::on_statechange(int new_state, int old_state) -{ - if(old_state <= CLIENTSTATE_CONNECTING) - { - mode = MODE_NONE; - for(int i = 0; i < MAX_LINES; i++) - lines[i].time = 0; - current_line = 0; - } -} - -void CHAT::con_say(void *result, void *user_data) -{ - ((CHAT*)user_data)->say(0, console_arg_string(result, 0)); -} - -void CHAT::con_sayteam(void *result, void *user_data) -{ - ((CHAT*)user_data)->say(1, console_arg_string(result, 0)); -} - -void CHAT::con_chat(void *result, void *user_data) -{ - const char *mode = console_arg_string(result, 0); - if(strcmp(mode, "all") == 0) - ((CHAT*)user_data)->enable_mode(0); - else if(strcmp(mode, "team") == 0) - ((CHAT*)user_data)->enable_mode(1); - else - dbg_msg("console", "expected all or team as mode"); -} - -void CHAT::on_console_init() -{ - MACRO_REGISTER_COMMAND("say", "r", CFGFLAG_CLIENT, con_say, this, "Say in chat"); - MACRO_REGISTER_COMMAND("say_team", "r", CFGFLAG_CLIENT, con_sayteam, this, "Say in team chat"); - MACRO_REGISTER_COMMAND("chat", "s", CFGFLAG_CLIENT, con_chat, this, "Enable chat with all/team mode"); -} - -bool CHAT::on_input(INPUT_EVENT e) -{ - if(mode == MODE_NONE) - return false; - - if(e.flags&INPFLAG_PRESS && e.key == KEY_ESCAPE) - mode = MODE_NONE; - else if(e.flags&INPFLAG_PRESS && (e.key == KEY_RETURN || e.key == KEY_KP_ENTER)) - { - if(input.get_string()[0]) - gameclient.chat->say(mode == MODE_ALL ? 0 : 1, input.get_string()); - mode = MODE_NONE; - } - else - input.process_input(e); - - return true; -} - - -void CHAT::enable_mode(int team) -{ - if(mode == MODE_NONE) - { - if(team) - mode = MODE_TEAM; - else - mode = MODE_ALL; - - input.clear(); - inp_clear_events(); - } -} - -void CHAT::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_CHAT) - { - NETMSG_SV_CHAT *msg = (NETMSG_SV_CHAT *)rawmsg; - add_line(msg->cid, msg->team, msg->message); - - if(msg->cid >= 0) - gameclient.sounds->play(SOUNDS::CHN_GUI, SOUND_CHAT_CLIENT, 0, vec2(0,0)); - else - gameclient.sounds->play(SOUNDS::CHN_GUI, SOUND_CHAT_SERVER, 0, vec2(0,0)); - } -} - -void CHAT::add_line(int client_id, int team, const char *line) -{ - current_line = (current_line+1)%MAX_LINES; - lines[current_line].time = time_get(); - lines[current_line].client_id = client_id; - lines[current_line].team = team; - lines[current_line].name_color = -2; - - if(client_id == -1) // server message - { - str_copy(lines[current_line].name, "*** ", sizeof(lines[current_line].name)); - str_format(lines[current_line].text, sizeof(lines[current_line].text), "%s", line); - } - else - { - if(gameclient.clients[client_id].team == -1) - lines[current_line].name_color = -1; - - if(gameclient.snap.gameobj && gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) - { - if(gameclient.clients[client_id].team == 0) - lines[current_line].name_color = 0; - else if(gameclient.clients[client_id].team == 1) - lines[current_line].name_color = 1; - } - - str_copy(lines[current_line].name, gameclient.clients[client_id].name, sizeof(lines[current_line].name)); - str_format(lines[current_line].text, sizeof(lines[current_line].text), ": %s", line); - } - - dbg_msg("chat", "%s%s", lines[current_line].name, lines[current_line].text); -} - -void CHAT::on_render() -{ - gfx_mapscreen(0,0,300*gfx_screenaspect(),300); - float x = 10.0f; - float y = 300.0f-20.0f; - if(mode != MODE_NONE) - { - // render chat input - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, x, y, 8.0f, TEXTFLAG_RENDER); - cursor.line_width = 200.0f; - - if(mode == MODE_ALL) - gfx_text_ex(&cursor, "All: ", -1); - else if(mode == MODE_TEAM) - gfx_text_ex(&cursor, "Team: ", -1); - else - gfx_text_ex(&cursor, "Chat: ", -1); - - gfx_text_ex(&cursor, input.get_string(), input.cursor_offset()); - TEXT_CURSOR marker = cursor; - gfx_text_ex(&marker, "|", -1); - gfx_text_ex(&cursor, input.get_string()+input.cursor_offset(), -1); - } - - y -= 8; - - int i; - for(i = 0; i < MAX_LINES; i++) - { - int r = ((current_line-i)+MAX_LINES)%MAX_LINES; - if(time_get() > lines[r].time+15*time_freq()) - break; - - float begin = x; - float fontsize = 7.0f; - - // get the y offset - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, begin, 0, fontsize, 0); - cursor.line_width = 200.0f; - gfx_text_ex(&cursor, lines[r].name, -1); - gfx_text_ex(&cursor, lines[r].text, -1); - y -= cursor.y + cursor.font_size; - - // cut off if msgs waste too much space - if(y < 200.0f) - break; - - // reset the cursor - gfx_text_set_cursor(&cursor, begin, y, fontsize, TEXTFLAG_RENDER); - cursor.line_width = 200.0f; - - // render name - gfx_text_color(0.8f,0.8f,0.8f,1); - if(lines[r].client_id == -1) - gfx_text_color(1,1,0.5f,1); // system - else if(lines[r].team) - gfx_text_color(0.45f,0.9f,0.45f,1); // team message - else if(lines[r].name_color == 0) - gfx_text_color(1.0f,0.5f,0.5f,1); // red - else if(lines[r].name_color == 1) - gfx_text_color(0.7f,0.7f,1.0f,1); // blue - else if(lines[r].name_color == -1) - gfx_text_color(0.75f,0.5f,0.75f, 1); // spectator - - // render name - gfx_text_ex(&cursor, lines[r].name, -1); - - // render line - gfx_text_color(1,1,1,1); - if(lines[r].client_id == -1) - gfx_text_color(1,1,0.5f,1); // system - else if(lines[r].team) - gfx_text_color(0.65f,1,0.65f,1); // team message - - gfx_text_ex(&cursor, lines[r].text, -1); - } - - gfx_text_color(1,1,1,1); -} - -void CHAT::say(int team, const char *line) -{ - // send chat message - NETMSG_CL_SAY msg; - msg.team = team; - msg.message = line; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.hpp deleted file mode 100644 index ca34237d7..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/chat.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -class CHAT : public COMPONENT -{ - LINEINPUT input; - - enum - { - MAX_LINES = 10, - }; - - struct LINE - { - int64 time; - int client_id; - int team; - int name_color; - char name[64]; - char text[512]; - }; - - LINE lines[MAX_LINES]; - int current_line; - - // chat - enum - { - MODE_NONE=0, - MODE_ALL, - MODE_TEAM, - }; - - int mode; - - static void con_say(void *result, void *user_data); - static void con_sayteam(void *result, void *user_data); - static void con_chat(void *result, void *user_data); - -public: - bool is_active() const { return mode != MODE_NONE; } - - void add_line(int client_id, int team, const char *line); - - void enable_mode(int team); - - void say(int team, const char *line); - - virtual void on_console_init(); - virtual void on_statechange(int new_state, int old_state); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); - virtual bool on_input(INPUT_EVENT e); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.cpp deleted file mode 100644 index 53d5637ed..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.cpp +++ /dev/null @@ -1,538 +0,0 @@ -//#include "gc_console.hpp" -#include - -#include - -#include - -#include - -extern "C" { - #include - #include -} - -#include -#include - -#include - -#include - -#include -#include - -#include "console.hpp" - -enum -{ - CONSOLE_CLOSED, - CONSOLE_OPENING, - CONSOLE_OPEN, - CONSOLE_CLOSING, -}; - -CONSOLE::INSTANCE::INSTANCE(int t) -{ - // init ringbuffers - history = ringbuf_init(history_data, sizeof(history_data), RINGBUF_FLAG_RECYCLE); - backlog = ringbuf_init(backlog_data, sizeof(backlog_data), RINGBUF_FLAG_RECYCLE); - - history_entry = 0x0; - - type = t; - - if(t == 0) - completion_flagmask = CFGFLAG_CLIENT; - else - completion_flagmask = CFGFLAG_SERVER; - - completion_buffer[0] = 0; - completion_chosen = -1; - - command = 0x0; -} - -void CONSOLE::INSTANCE::execute_line(const char *line) -{ - if(type == 0) - console_execute_line(line); - else - { - if(client_rcon_authed()) - client_rcon(line); - else - client_rcon_auth("", line); - } -} - -void CONSOLE::INSTANCE::possible_commands_complete_callback(const char *str, void *user) -{ - CONSOLE::INSTANCE *instance = (CONSOLE::INSTANCE *)user; - if(instance->completion_chosen == instance->completion_enumeration_count) - instance->input.set(str); - instance->completion_enumeration_count++; -} - -void CONSOLE::INSTANCE::on_input(INPUT_EVENT e) -{ - bool handled = false; - - if(e.flags&INPFLAG_PRESS) - { - if(e.key == KEY_RETURN || e.key == KEY_KP_ENTER) - { - if(input.get_string()[0]) - { - char *entry = (char *)ringbuf_allocate(history, input.get_length()+1); - mem_copy(entry, input.get_string(), input.get_length()+1); - - execute_line(input.get_string()); - input.clear(); - history_entry = 0x0; - } - - handled = true; - } - else if (e.key == KEY_UP) - { - if (history_entry) - { - char *test = (char *)ringbuf_prev(history, history_entry); - - if (test) - history_entry = test; - } - else - history_entry = (char *)ringbuf_last(history); - - if (history_entry) - { - unsigned int len = strlen(history_entry); - if (len < sizeof(input) - 1) - input.set(history_entry); - } - handled = true; - } - else if (e.key == KEY_DOWN) - { - if (history_entry) - history_entry = (char *)ringbuf_next(history, history_entry); - - if (history_entry) - { - unsigned int len = strlen(history_entry); - if (len < sizeof(input) - 1) - input.set(history_entry); - } - else - input.clear(); - handled = true; - } - else if(e.key == KEY_TAB) - { - completion_chosen++; - completion_enumeration_count = 0; - console_possible_commands(completion_buffer, completion_flagmask, possible_commands_complete_callback, this); - - // handle wrapping - if(completion_enumeration_count && completion_chosen >= completion_enumeration_count) - { - completion_chosen %= completion_enumeration_count; - completion_enumeration_count = 0; - console_possible_commands(completion_buffer, completion_flagmask, possible_commands_complete_callback, this); - } - } - - if(e.key != KEY_TAB) - { - completion_chosen = -1; - str_copy(completion_buffer, input.get_string(), sizeof(completion_buffer)); - } - - // find the current command - { - char buf[64] = {0}; - const char *src = get_string(); - int i = 0; - for(; i < (int)sizeof(buf) && *src && *src != ' ' && *src != ' '; i++, src++) - buf[i] = *src; - buf[i] = 0; - - command = console_get_command(buf); - } - } - - if(!handled) - input.process_input(e); -} - -void CONSOLE::INSTANCE::print_line(const char *line) -{ - int len = strlen(line); - - if (len > 255) - len = 255; - - char *entry = (char *)ringbuf_allocate(backlog, len+1); - mem_copy(entry, line, len+1); -} - -CONSOLE::CONSOLE() -: local_console(0), remote_console(1) -{ - console_type = 0; - console_state = CONSOLE_CLOSED; - state_change_end = 0.0f; - state_change_duration = 0.1f; -} - -float CONSOLE::time_now() -{ - static long long time_start = time_get(); - return float(time_get()-time_start)/float(time_freq()); -} - -CONSOLE::INSTANCE *CONSOLE::current_console() -{ - if(console_type != 0) - return &remote_console; - return &local_console; -} - -void CONSOLE::on_reset() -{ -} - -// only defined for 0<=t<=1 -static float console_scale_func(float t) -{ - //return t; - return sinf(acosf(1.0f-t)); -} - -struct RENDERINFO -{ - TEXT_CURSOR cursor; - const char *current_cmd; - int wanted_completion; - int enum_count; -}; - -void CONSOLE::possible_commands_render_callback(const char *str, void *user) -{ - RENDERINFO *info = (RENDERINFO *)user; - - if(info->enum_count == info->wanted_completion) - { - float tw = gfx_text_width(info->cursor.font_set, info->cursor.font_size, str, -1); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(229.0f/255.0f,185.0f/255.0f,4.0f/255.0f,0.85f); - draw_round_rect(info->cursor.x-3, info->cursor.y, tw+5, info->cursor.font_size+4, info->cursor.font_size/3); - gfx_quads_end(); - - gfx_text_color(0.05f, 0.05f, 0.05f,1); - gfx_text_ex(&info->cursor, str, -1); - } - else - { - const char *match_start = str_find_nocase(str, info->current_cmd); - - if(match_start) - { - gfx_text_color(0.5f,0.5f,0.5f,1); - gfx_text_ex(&info->cursor, str, match_start-str); - gfx_text_color(229.0f/255.0f,185.0f/255.0f,4.0f/255.0f,1); - gfx_text_ex(&info->cursor, match_start, strlen(info->current_cmd)); - gfx_text_color(0.5f,0.5f,0.5f,1); - gfx_text_ex(&info->cursor, match_start+strlen(info->current_cmd), -1); - } - else - { - gfx_text_color(0.75f,0.75f,0.75f,1); - gfx_text_ex(&info->cursor, str, -1); - } - } - - info->enum_count++; - info->cursor.x += 7.0f; -} - -void CONSOLE::on_render() -{ - RECT screen = *ui_screen(); - float console_max_height = screen.h*3/5.0f; - float console_height; - - float progress = (time_now()-(state_change_end-state_change_duration))/float(state_change_duration); - - if (progress >= 1.0f) - { - if (console_state == CONSOLE_CLOSING) - console_state = CONSOLE_CLOSED; - else if (console_state == CONSOLE_OPENING) - console_state = CONSOLE_OPEN; - - progress = 1.0f; - } - - if (console_state == CONSOLE_OPEN && config.cl_editor) - toggle(0); - - if (console_state == CONSOLE_CLOSED) - return; - - if (console_state == CONSOLE_OPEN) - inp_mouse_mode_absolute(); - - float console_height_scale; - - if (console_state == CONSOLE_OPENING) - console_height_scale = console_scale_func(progress); - else if (console_state == CONSOLE_CLOSING) - console_height_scale = console_scale_func(1.0f-progress); - else //if (console_state == CONSOLE_OPEN) - console_height_scale = console_scale_func(1.0f); - - console_height = console_height_scale*console_max_height; - - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - - // do console shadow - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolorvertex(0, 0,0,0, 0.5f); - gfx_setcolorvertex(1, 0,0,0, 0.5f); - gfx_setcolorvertex(2, 0,0,0, 0.0f); - gfx_setcolorvertex(3, 0,0,0, 0.0f); - gfx_quads_drawTL(0,console_height,screen.w,10.0f); - gfx_quads_end(); - - // do background - gfx_texture_set(data->images[IMAGE_CONSOLE_BG].id); - gfx_quads_begin(); - gfx_setcolor(0.2f, 0.2f, 0.2f,0.9f); - if(console_type != 0) - gfx_setcolor(0.4f, 0.2f, 0.2f,0.9f); - gfx_quads_setsubset(0,-console_height*0.075f,screen.w*0.075f*0.5f,0); - gfx_quads_drawTL(0,0,screen.w,console_height); - gfx_quads_end(); - - // do small bar shadow - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolorvertex(0, 0,0,0, 0.0f); - gfx_setcolorvertex(1, 0,0,0, 0.0f); - gfx_setcolorvertex(2, 0,0,0, 0.25f); - gfx_setcolorvertex(3, 0,0,0, 0.25f); - gfx_quads_drawTL(0,console_height-20,screen.w,10); - gfx_quads_end(); - - // do the lower bar - gfx_texture_set(data->images[IMAGE_CONSOLE_BAR].id); - gfx_quads_begin(); - gfx_setcolor(1.0f, 1.0f, 1.0f, 0.9f); - gfx_quads_setsubset(0,0.1f,screen.w*0.015f,1-0.1f); - gfx_quads_drawTL(0,console_height-10.0f,screen.w,10.0f); - gfx_quads_end(); - - console_height -= 22.0f; - - INSTANCE *console = current_console(); - - { - float font_size = 10.0f; - float row_height = font_size*1.25f; - float x = 3; - float y = console_height - row_height - 2; - - // render prompt - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, x, y, font_size, TEXTFLAG_RENDER); - - RENDERINFO info; - info.wanted_completion = console->completion_chosen; - info.enum_count = 0; - info.current_cmd = console->completion_buffer; - gfx_text_set_cursor(&info.cursor, x, y+12.0f, font_size, TEXTFLAG_RENDER); - - const char *prompt = "> "; - if(console_type) - { - if(client_state() == CLIENTSTATE_ONLINE) - { - if(client_rcon_authed()) - prompt = "rcon> "; - else - prompt = "ENTER PASSWORD> "; - } - else - prompt = "NOT CONNECTED> "; - } - - gfx_text_ex(&cursor, prompt, -1); - - // render console input - gfx_text_ex(&cursor, console->input.get_string(), console->input.cursor_offset()); - TEXT_CURSOR marker = cursor; - gfx_text_ex(&marker, "|", -1); - gfx_text_ex(&cursor, console->input.get_string()+console->input.cursor_offset(), -1); - - // render version - char buf[128]; - str_format(buf, sizeof(buf), "v%s", GAME_VERSION); - float version_width = gfx_text_width(0, font_size, buf, -1); - gfx_text(0, screen.w-version_width-5, y, font_size, buf, -1); - - // render possible commands - if(console->input.get_string()[0] != 0) - { - console_possible_commands(console->completion_buffer, console->completion_flagmask, possible_commands_render_callback, &info); - - if(info.enum_count <= 0) - { - if(console->command) - { - - char buf[512]; - str_format(buf, sizeof(buf), "Help: %s ", console->command->help); - gfx_text_ex(&info.cursor, buf, -1); - gfx_text_color(0.75f, 0.75f, 0.75f, 1); - str_format(buf, sizeof(buf), "Syntax: %s %s", console->command->name, console->command->params); - gfx_text_ex(&info.cursor, buf, -1); - } - } - } - gfx_text_color(1,1,1,1); - - // render log - y -= row_height; - char *entry = (char *)ringbuf_last(console->backlog); - while (y > 0.0f && entry) - { - gfx_text(0, x, y, font_size, entry, -1); - y -= row_height; - - entry = (char *)ringbuf_prev(console->backlog, entry); - } - } -} - -void CONSOLE::on_message(int msgtype, void *rawmsg) -{ -} - -bool CONSOLE::on_input(INPUT_EVENT e) -{ - if(console_state == CONSOLE_CLOSED) - return false; - if(e.key >= KEY_F1 && e.key <= KEY_F15) - return false; - - if(e.key == KEY_ESCAPE && (e.flags&INPFLAG_PRESS)) - toggle(console_type); - else - current_console()->on_input(e); - - return true; -} - -void CONSOLE::toggle(int type) -{ - if(console_type != type && (console_state == CONSOLE_OPEN || console_state == CONSOLE_OPENING)) - { - // don't toggle console, just switch what console to use - } - else - { - if (console_state == CONSOLE_CLOSED || console_state == CONSOLE_OPEN) - { - state_change_end = time_now()+state_change_duration; - } - else - { - float progress = state_change_end-time_now(); - float reversed_progress = state_change_duration-progress; - - state_change_end = time_now()+reversed_progress; - } - - if (console_state == CONSOLE_CLOSED || console_state == CONSOLE_CLOSING) - { - inp_mouse_mode_absolute(); - console_state = CONSOLE_OPENING; - } - else - { - inp_mouse_mode_relative(); - console_state = CONSOLE_CLOSING; - } - } - - console_type = type; -} - -void CONSOLE::con_toggle_local_console(void *result, void *user_data) -{ - ((CONSOLE *)user_data)->toggle(0); -} - -void CONSOLE::con_toggle_remote_console(void *result, void *user_data) -{ - ((CONSOLE *)user_data)->toggle(1); -} - -void CONSOLE::client_console_print_callback(const char *str, void *user_data) -{ - ((CONSOLE *)user_data)->local_console.print_line(str); -} - -void CONSOLE::print_line(int type, const char *line) -{ - if(type == 0) - local_console.print_line(line); - else if(type == 1) - remote_console.print_line(line); -} - -void CONSOLE::on_console_init() -{ - // - console_register_print_callback(client_console_print_callback, this); - - MACRO_REGISTER_COMMAND("toggle_local_console", "", CFGFLAG_CLIENT, con_toggle_local_console, this, "Toggle local console"); - MACRO_REGISTER_COMMAND("toggle_remote_console", "", CFGFLAG_CLIENT, con_toggle_remote_console, this, "Toggle remote console"); -} - -/* -static void con_team(void *result, void *user_data) -{ - send_switch_team(console_arg_int(result, 0)); -} - -static void con_kill(void *result, void *user_data) -{ - send_kill(-1); -} - -void send_kill(int client_id); - -static void con_emote(void *result, void *user_data) -{ - send_emoticon(console_arg_int(result, 0)); -} - -extern void con_chat(void *result, void *user_data); - -void client_console_init() -{ - // - MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0); - MACRO_REGISTER_COMMAND("kill", "", con_kill, 0x0); - - // chatting - MACRO_REGISTER_COMMAND("emote", "i", con_emote, 0); - MACRO_REGISTER_COMMAND("+emote", "", con_key_input_state, &emoticon_selector_active); -} -*/ diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.hpp deleted file mode 100644 index 0a4adbda9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/console.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include - -class CONSOLE : public COMPONENT -{ - class INSTANCE - { - public: - char history_data[65536]; - struct RINGBUFFER *history; - char *history_entry; - - char backlog_data[65536]; - struct RINGBUFFER *backlog; - - LINEINPUT input; - - int type; - int completion_enumeration_count; - - public: - char completion_buffer[128]; - int completion_chosen; - int completion_flagmask; - - COMMAND *command; - - INSTANCE(int t); - - void execute_line(const char *line); - - void on_input(INPUT_EVENT e); - void print_line(const char *line); - - const char *get_string() const { return input.get_string(); } - - static void possible_commands_complete_callback(const char *str, void *user); - }; - - INSTANCE local_console; - INSTANCE remote_console; - - INSTANCE *current_console(); - float time_now(); - - int console_type; - int console_state; - float state_change_end; - float state_change_duration; - - - void toggle(int type); - - static void possible_commands_render_callback(const char *str, void *user); - static void client_console_print_callback(const char *str, void *user_data); - static void con_toggle_local_console(void *result, void *user_data); - static void con_toggle_remote_console(void *result, void *user_data); - -public: - CONSOLE(); - - void print_line(int type, const char *line); - - virtual void on_console_init(); - virtual void on_reset(); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); - virtual bool on_input(INPUT_EVENT e); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.cpp deleted file mode 100644 index 964ef7670..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "controls.hpp" - -CONTROLS::CONTROLS() -{ -} - -static void con_key_input_state(void *result, void *user_data) -{ - ((int *)user_data)[0] = console_arg_int(result, 0); -} - -#ifdef ANDROID -static bool con_key_fire_android_triggered = false; -#endif - -static void con_key_input_counter(void *result, void *user_data) -{ -#ifdef ANDROID - if(!con_key_fire_android_triggered) - return; -#endif - int *v = (int *)user_data; - if(((*v)&1) != console_arg_int(result, 0)) - (*v)++; - *v &= INPUT_STATE_MASK; -} - -struct INPUTSET -{ - CONTROLS *controls; - int *variable; - int value; -}; - -static void con_key_input_set(void *result, void *user_data) -{ - INPUTSET *set = (INPUTSET *)user_data; - *set->variable = console_arg_int(result, 0) ? *set->variable = set->value : 0; -} - -static void con_key_input_nextprev_weapon(void *result, void *user_data) -{ - INPUTSET *set = (INPUTSET *)user_data; - con_key_input_counter(result, set->variable); - set->controls->input_data.wanted_weapon = 0; -} - -void CONTROLS::on_console_init() -{ - // game commands - MACRO_REGISTER_COMMAND("+left", "", CFGFLAG_CLIENT, con_key_input_state, &input_direction_left, "Move left"); - MACRO_REGISTER_COMMAND("+right", "", CFGFLAG_CLIENT, con_key_input_state, &input_direction_right, "Move right"); - MACRO_REGISTER_COMMAND("+jump", "", CFGFLAG_CLIENT, con_key_input_state, &input_data.jump, "Jump"); - MACRO_REGISTER_COMMAND("+hook", "", CFGFLAG_CLIENT, con_key_input_state, &input_data.hook, "Hook"); - MACRO_REGISTER_COMMAND("+fire", "", CFGFLAG_CLIENT, con_key_input_counter, &input_data.fire, "Fire"); - - { static INPUTSET set = {this, &input_data.wanted_weapon, 1}; MACRO_REGISTER_COMMAND("+weapon1", "", CFGFLAG_CLIENT, con_key_input_set, (void *)&set, "Switch to hammer"); } - { static INPUTSET set = {this, &input_data.wanted_weapon, 2}; MACRO_REGISTER_COMMAND("+weapon2", "", CFGFLAG_CLIENT, con_key_input_set, (void *)&set, "Switch to gun"); } - { static INPUTSET set = {this, &input_data.wanted_weapon, 3}; MACRO_REGISTER_COMMAND("+weapon3", "", CFGFLAG_CLIENT, con_key_input_set, (void *)&set, "Switch to shotgun"); } - { static INPUTSET set = {this, &input_data.wanted_weapon, 4}; MACRO_REGISTER_COMMAND("+weapon4", "", CFGFLAG_CLIENT, con_key_input_set, (void *)&set, "Switch to grenade"); } - { static INPUTSET set = {this, &input_data.wanted_weapon, 5}; MACRO_REGISTER_COMMAND("+weapon5", "", CFGFLAG_CLIENT, con_key_input_set, (void *)&set, "Switch to rifle"); } - - { static INPUTSET set = {this, &input_data.next_weapon, 0}; MACRO_REGISTER_COMMAND("+nextweapon", "", CFGFLAG_CLIENT, con_key_input_nextprev_weapon, (void *)&set, "Switch to next weapon"); } - { static INPUTSET set = {this, &input_data.prev_weapon, 0}; MACRO_REGISTER_COMMAND("+prevweapon", "", CFGFLAG_CLIENT, con_key_input_nextprev_weapon, (void *)&set, "Switch to previous weapon"); } -} - -void CONTROLS::on_message(int msg, void *rawmsg) -{ - if(msg == NETMSGTYPE_SV_WEAPONPICKUP) - { - NETMSG_SV_WEAPONPICKUP *msg = (NETMSG_SV_WEAPONPICKUP *)rawmsg; - if(config.cl_autoswitch_weapons) - input_data.wanted_weapon = msg->weapon+1; - } -} - -int CONTROLS::snapinput(int *data) -{ - static NETOBJ_PLAYER_INPUT last_data = {0}; - static int64 last_send_time = 0; - bool send = false; - - // update player state - if(gameclient.chat->is_active()) - input_data.player_state = PLAYERSTATE_CHATTING; - else if(gameclient.menus->is_active()) - input_data.player_state = PLAYERSTATE_IN_MENU; - else - input_data.player_state = PLAYERSTATE_PLAYING; - - if(last_data.player_state != input_data.player_state) - send = true; - - last_data.player_state = input_data.player_state; - - // we freeze the input if chat or menu is activated - if(input_data.player_state != PLAYERSTATE_PLAYING) - { - last_data.direction = 0; - last_data.hook = 0; - last_data.jump = 0; - input_data = last_data; - - input_direction_left = 0; - input_direction_right = 0; - - mem_copy(data, &input_data, sizeof(input_data)); - - // send once a second just to be sure - if(time_get() > last_send_time + time_freq()) - send = true; - } - else - { - - input_data.target_x = (int)mouse_pos.x; - input_data.target_y = (int)mouse_pos.y; - if(!input_data.target_x && !input_data.target_y) - input_data.target_y = 1; - - // set direction - input_data.direction = 0; - if(input_direction_left && !input_direction_right) - input_data.direction = -1; - if(!input_direction_left && input_direction_right) - input_data.direction = 1; - - // stress testing - if(config.dbg_stress) - { - float t = client_localtime(); - mem_zero(&input_data, sizeof(input_data)); - - input_data.direction = ((int)t/2)&1; - input_data.jump = ((int)t); - input_data.fire = ((int)(t*10)); - input_data.hook = ((int)(t*2))&1; - input_data.wanted_weapon = ((int)t)%NUM_WEAPONS; - input_data.target_x = (int)(sinf(t*3)*100.0f); - input_data.target_y = (int)(cosf(t*3)*100.0f); - } - - // check if we need to send input - if(input_data.direction != last_data.direction) send = true; - else if(input_data.jump != last_data.jump) send = true; - else if(input_data.fire != last_data.fire) send = true; - else if(input_data.hook != last_data.hook) send = true; - else if(input_data.player_state != last_data.player_state) send = true; - else if(input_data.wanted_weapon != last_data.wanted_weapon) send = true; - else if(input_data.next_weapon != last_data.next_weapon) send = true; - else if(input_data.prev_weapon != last_data.prev_weapon) send = true; - - // send at at least 10hz - if(time_get() > last_send_time + time_freq()/25) - send = true; - } - - // copy and return size - last_data = input_data; - - if(!send) - return 0; - - last_send_time = time_get(); - mem_copy(data, &input_data, sizeof(input_data)); - return sizeof(input_data); -} - -void CONTROLS::on_render() -{ - // update target pos - if(!((gameclient.snap.gameobj && gameclient.snap.gameobj->paused) || gameclient.snap.spectate)) - target_pos = gameclient.local_character_pos + mouse_pos; -} - -bool CONTROLS::on_mousemove(float x, float y) -{ - if(gameclient.snap.gameobj && gameclient.snap.gameobj->paused) - return false; - mouse_pos += vec2(x, y); // TODO: ugly -#ifdef ANDROID - - if(gameclient.snap.spectate) - { - if( mouse_pos_old != vec2(x, y)) - { - mouse_pos_old = vec2(x, y); - mouse_pos += vec2((x - gfx_screenwidth()/2), (y - gfx_screenheight()/2)); - } - } - else - { - mouse_pos = vec2((x - gfx_screenwidth()/2) * 2, (y - gfx_screenheight()/2) * 2); - } -#endif - - // - float camera_max_distance = 200.0f; - float follow_factor = config.cl_mouse_followfactor/100.0f; - float deadzone = config.cl_mouse_deadzone; - float mouse_max = min(camera_max_distance/follow_factor + deadzone, (float)config.cl_mouse_max_distance); - - //vec2 camera_offset(0, 0); - - if(gameclient.snap.spectate) - { - if(mouse_pos.x < 200.0f) mouse_pos.x = 200.0f; - if(mouse_pos.y < 200.0f) mouse_pos.y = 200.0f; - if(mouse_pos.x > col_width()*32-200.0f) mouse_pos.x = col_width()*32-200.0f; - if(mouse_pos.y > col_height()*32-200.0f) mouse_pos.y = col_height()*32-200.0f; - - target_pos = mouse_pos; - } - else - { - float l = length(mouse_pos); - - if(l > mouse_max) - { - mouse_pos = normalize(mouse_pos)*mouse_max; - l = mouse_max; - } - -#ifdef ANDROID - con_key_fire_android_triggered = (l > mouse_max/4); -#endif - - //float offset_amount = max(l-deadzone, 0.0f) * follow_factor; - //if(l > 0.0001f) // make sure that this isn't 0 - //camera_offset = normalize(mouse_pos)*offset_amount; - } - - return true; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.hpp deleted file mode 100644 index 3aaef3f79..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/controls.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -class CONTROLS : public COMPONENT -{ -public: - vec2 mouse_pos; - vec2 target_pos; - vec2 mouse_pos_old; // for Android - - NETOBJ_PLAYER_INPUT input_data; - int input_direction_left; - int input_direction_right; - - CONTROLS(); - - virtual void on_render(); - virtual void on_message(int msg, void *rawmsg); - virtual bool on_mousemove(float x, float y); - virtual void on_console_init(); - - int snapinput(int *data); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.cpp deleted file mode 100644 index f585e4d30..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include - -#include // get_angle -#include -#include -#include "damageind.hpp" - -DAMAGEIND::DAMAGEIND() -{ - lastupdate = 0; - num_items = 0; -} - -DAMAGEIND::ITEM *DAMAGEIND::create_i() -{ - if (num_items < MAX_ITEMS) - { - ITEM *p = &items[num_items]; - num_items++; - return p; - } - return 0; -} - -void DAMAGEIND::destroy_i(DAMAGEIND::ITEM *i) -{ - num_items--; - *i = items[num_items]; -} - -void DAMAGEIND::create(vec2 pos, vec2 dir) -{ - ITEM *i = create_i(); - if (i) - { - i->pos = pos; - i->life = 0.75f; - i->dir = dir*-1; - i->startangle = (( (float)rand()/(float)RAND_MAX) - 1.0f) * 2.0f * pi; - } -} - -void DAMAGEIND::on_render() -{ - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - for(int i = 0; i < num_items;) - { - vec2 pos = mix(items[i].pos+items[i].dir*75.0f, items[i].pos, clamp((items[i].life-0.60f)/0.15f, 0.0f, 1.0f)); - - items[i].life -= client_frametime(); - if(items[i].life < 0.0f) - destroy_i(&items[i]); - else - { - gfx_setcolor(1.0f,1.0f,1.0f, items[i].life/0.1f); - gfx_quads_setrotation(items[i].startangle + items[i].life * 2.0f); - select_sprite(SPRITE_STAR1); - draw_sprite(pos.x, pos.y, 48.0f); - i++; - } - } - gfx_quads_end(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.hpp deleted file mode 100644 index c74af9ca8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/damageind.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -class DAMAGEIND : public COMPONENT -{ - int64 lastupdate; - struct ITEM - { - vec2 pos; - vec2 dir; - float life; - float startangle; - }; - - enum - { - MAX_ITEMS=64, - }; - - ITEM items[MAX_ITEMS]; - int num_items; - - ITEM *create_i(); - void destroy_i(ITEM *i); - -public: - DAMAGEIND(); - - void create(vec2 pos, vec2 dir); - virtual void on_render(); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.cpp deleted file mode 100644 index ada006eab..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include // memcmp - -extern "C" { - #include -} - -#include -#include -#include - -#include - -#include -#include -#include - -//#include "controls.hpp" -//#include "camera.hpp" -#include "debughud.hpp" - -void DEBUGHUD::render_netcorrections() -{ - if(!config.debug || !gameclient.snap.local_character || !gameclient.snap.local_prev_character) - return; - - gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300); - - /*float speed = distance(vec2(netobjects.local_prev_character->x, netobjects.local_prev_character->y), - vec2(netobjects.local_character->x, netobjects.local_character->y));*/ - - float velspeed = length(vec2(gameclient.snap.local_character->vx/256.0f, gameclient.snap.local_character->vy/256.0f))*50; - - float ramp = velocity_ramp(velspeed, gameclient.tuning.velramp_start, gameclient.tuning.velramp_range, gameclient.tuning.velramp_curvature); - - char buf[512]; - str_format(buf, sizeof(buf), "%.0f\n%.0f\n%.2f\n%d %s\n%d %d", - velspeed, velspeed*ramp, ramp, - netobj_num_corrections(), netobj_corrected_on(), - gameclient.snap.local_character->x, - gameclient.snap.local_character->y - ); - gfx_text(0, 150, 50, 12, buf, -1); -} - -void DEBUGHUD::render_tuning() -{ - // render tuning debugging - if(!config.dbg_tuning) - return; - - TUNING_PARAMS standard_tuning; - - gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300); - - float y = 50.0f; - int count = 0; - for(int i = 0; i < gameclient.tuning.num(); i++) - { - char buf[128]; - float current, standard; - gameclient.tuning.get(i, ¤t); - standard_tuning.get(i, &standard); - - if(standard == current) - gfx_text_color(1,1,1,1.0f); - else - gfx_text_color(1,0.25f,0.25f,1.0f); - - float w; - float x = 5.0f; - - str_format(buf, sizeof(buf), "%.2f", standard); - x += 20.0f; - w = gfx_text_width(0, 5, buf, -1); - gfx_text(0x0, x-w, y+count*6, 5, buf, -1); - - str_format(buf, sizeof(buf), "%.2f", current); - x += 20.0f; - w = gfx_text_width(0, 5, buf, -1); - gfx_text(0x0, x-w, y+count*6, 5, buf, -1); - - x += 5.0f; - gfx_text(0x0, x, y+count*6, 5, gameclient.tuning.names[i], -1); - - count++; - } - - y = y+count*6; - - gfx_texture_set(-1); - gfx_blend_normal(); - gfx_lines_begin(); - float height = 50.0f; - float pv = 1; - for(int i = 0; i < 100; i++) - { - float speed = i/100.0f * 3000; - float ramp = velocity_ramp(speed, gameclient.tuning.velramp_start, gameclient.tuning.velramp_range, gameclient.tuning.velramp_curvature); - float rampedspeed = (speed * ramp)/1000.0f; - gfx_lines_draw((i-1)*2, y+height-pv*height, i*2, y+height-rampedspeed*height); - //gfx_lines_draw((i-1)*2, 200, i*2, 200); - pv = rampedspeed; - } - gfx_lines_end(); - gfx_text_color(1,1,1,1); -} - -void DEBUGHUD::on_render() -{ - render_tuning(); - render_netcorrections(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.hpp deleted file mode 100644 index 473b2ce22..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/debughud.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -class DEBUGHUD : public COMPONENT -{ - void render_netcorrections(); - void render_tuning(); -public: - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.cpp deleted file mode 100644 index c9c47a8d4..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include -//#include -#include - -#include -#include -#include -#include -#include -#include - -#include "effects.hpp" - -inline vec2 random_dir() { return normalize(vec2(frandom()-0.5f, frandom()-0.5f)); } - -EFFECTS::EFFECTS() -{ - add_50hz = false; - add_100hz = false; -} - -void EFFECTS::air_jump(vec2 pos) -{ - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_AIRJUMP; - p.pos = pos + vec2(-6.0f, 16.0f); - p.vel = vec2(0, -200); - p.life_span = 0.5f; - p.start_size = 48.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = pi*2; - p.gravity = 500; - p.friction = 0.7f; - p.flow_affected = 0.0f; - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - - p.pos = pos + vec2(6.0f, 16.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - - gameclient.sounds->play(SOUNDS::CHN_WORLD, SOUND_PLAYER_AIRJUMP, 1.0f, pos); -} - -void EFFECTS::damage_indicator(vec2 pos, vec2 dir) -{ - gameclient.damageind->create(pos, dir); -} - -void EFFECTS::powerupshine(vec2 pos, vec2 size) -{ - if(!add_50hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SLICE; - p.pos = pos + vec2((frandom()-0.5f)*size.x, (frandom()-0.5f)*size.y); - p.vel = vec2(0, 0); - p.life_span = 0.5f; - p.start_size = 16.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = pi*2; - p.gravity = 500; - p.friction = 0.9f; - p.flow_affected = 0.0f; - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); -} - -void EFFECTS::smoketrail(vec2 pos, vec2 vel) -{ - if(!add_50hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = vel + random_dir()*50.0f; - p.life_span = 0.5f + frandom()*0.5f; - p.start_size = 12.0f + frandom()*8; - p.end_size = 0; - p.friction = 0.7; - p.gravity = frandom()*-500.0f; - gameclient.particles->add(PARTICLES::GROUP_PROJECTILE_TRAIL, &p); -} - - -void EFFECTS::skidtrail(vec2 pos, vec2 vel) -{ - if(!add_100hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = vel + random_dir()*50.0f; - p.life_span = 0.5f + frandom()*0.5f; - p.start_size = 24.0f + frandom()*12; - p.end_size = 0; - p.friction = 0.7f; - p.gravity = frandom()*-500.0f; - p.color = vec4(0.75f,0.75f,0.75f,1.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); -} - -void EFFECTS::bullettrail(vec2 pos) -{ - if(!add_100hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_BALL; - p.pos = pos; - p.life_span = 0.25f + frandom()*0.25f; - p.start_size = 8.0f; - p.end_size = 0; - p.friction = 0.7f; - gameclient.particles->add(PARTICLES::GROUP_PROJECTILE_TRAIL, &p); -} - -void EFFECTS::playerspawn(vec2 pos) -{ - for(int i = 0; i < 32; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SHELL; - p.pos = pos; - p.vel = random_dir() * (pow(frandom(), 3)*600.0f); - p.life_span = 0.3f + frandom()*0.3f; - p.start_size = 64.0f + frandom()*32; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = frandom(); - p.gravity = frandom()*-400.0f; - p.friction = 0.7f; - p.color = vec4(0xb5/255.0f, 0x50/255.0f, 0xcb/255.0f, 1.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - - } - gameclient.sounds->play(SOUNDS::CHN_WORLD, SOUND_PLAYER_SPAWN, 1.0f, pos); -} - -void EFFECTS::playerdeath(vec2 pos, int cid) -{ - vec3 blood_color(1.0f,1.0f,1.0f); - - if(cid >= 0) - { - const SKINS::SKIN *s = gameclient.skins->get(gameclient.clients[cid].skin_id); - if(s) - blood_color = s->blood_color; - } - - for(int i = 0; i < 64; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SPLAT01 + (rand()%3); - p.pos = pos; - p.vel = random_dir() * ((frandom()+0.1f)*900.0f); - p.life_span = 0.3f + frandom()*0.3f; - p.start_size = 24.0f + frandom()*16; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = (frandom()-0.5f) * pi; - p.gravity = 800.0f; - p.friction = 0.8f; - vec3 c = blood_color * (0.75f + frandom()*0.25f); - p.color = vec4(c.r, c.g, c.b, 0.75f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - } -} - - -void EFFECTS::explosion(vec2 pos) -{ - // add to flow - for(int y = -8; y <= 8; y++) - for(int x = -8; x <= 8; x++) - { - if(x == 0 && y == 0) - continue; - - float a = 1 - (length(vec2(x,y)) / length(vec2(8,8))); - gameclient.flow->add(pos+vec2(x,y)*16, normalize(vec2(x,y))*5000.0f*a, 10.0f); - } - - // add the explosion - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_EXPL01; - p.pos = pos; - p.life_span = 0.4f; - p.start_size = 150.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - gameclient.particles->add(PARTICLES::GROUP_EXPLOSIONS, &p); - - // add the smoke - for(int i = 0; i < 24; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = random_dir() * ((1.0f + frandom()*0.2f) * 1000.0f); - p.life_span = 0.5f + frandom()*0.4f; - p.start_size = 32.0f + frandom()*8; - p.end_size = 0; - p.gravity = frandom()*-800.0f; - p.friction = 0.4f; - p.color = mix(vec4(0.75f,0.75f,0.75f,1.0f), vec4(0.5f,0.5f,0.5f,1.0f), frandom()); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - } -} - - -void EFFECTS::hammerhit(vec2 pos) -{ - // add the explosion - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_EXPL01; - p.pos = pos; - p.life_span = 0.4f; - p.start_size = 150.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - gameclient.particles->add(PARTICLES::GROUP_EXPLOSIONS, &p); - gameclient.sounds->play(SOUNDS::CHN_WORLD, SOUND_HAMMER_HIT, 1.0f, pos); -} - -void EFFECTS::on_render() -{ - static int64 last_update_100hz = 0; - static int64 last_update_50hz = 0; - - if(time_get()-last_update_100hz > time_freq()/100) - { - add_100hz = true; - last_update_100hz = time_get(); - } - else - add_100hz = false; - - if(time_get()-last_update_50hz > time_freq()/100) - { - add_50hz = true; - last_update_50hz = time_get(); - } - else - add_50hz = false; - - if(add_50hz) - gameclient.flow->update(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.hpp deleted file mode 100644 index 8574bf601..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/effects.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -class EFFECTS : public COMPONENT -{ - bool add_50hz; - bool add_100hz; -public: - EFFECTS(); - - virtual void on_render(); - - void bullettrail(vec2 pos); - void smoketrail(vec2 pos, vec2 vel); - void skidtrail(vec2 pos, vec2 vel); - void explosion(vec2 pos); - void hammerhit(vec2 pos); - void air_jump(vec2 pos); - void damage_indicator(vec2 pos, vec2 dir); - void playerspawn(vec2 pos); - void playerdeath(vec2 pos, int cid); - void powerupshine(vec2 pos, vec2 size); - - void update(); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.cpp deleted file mode 100644 index 38325f0e5..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include -#include -#include - -#include // get_angle -#include -#include -#include -#include "emoticon.hpp" - -EMOTICON::EMOTICON() -{ - on_reset(); -} - -void EMOTICON::con_key_emoticon(void *result, void *user_data) -{ - ((EMOTICON *)user_data)->active = console_arg_int(result, 0) != 0; -} - -void EMOTICON::con_emote(void *result, void *user_data) -{ - ((EMOTICON *)user_data)->emote(console_arg_int(result, 0)); -} - -void EMOTICON::on_console_init() -{ - MACRO_REGISTER_COMMAND("+emote", "", CFGFLAG_CLIENT, con_key_emoticon, this, "Open emote selector"); - MACRO_REGISTER_COMMAND("emote", "i", CFGFLAG_CLIENT, con_emote, this, "Use emote"); -} - -void EMOTICON::on_reset() -{ - was_active = false; - active = false; - selected_emote = -1; -} - -void EMOTICON::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_EMOTICON) - { - NETMSG_SV_EMOTICON *msg = (NETMSG_SV_EMOTICON *)rawmsg; - gameclient.clients[msg->cid].emoticon = msg->emoticon; - gameclient.clients[msg->cid].emoticon_start = client_tick(); - } -} - -bool EMOTICON::on_mousemove(float x, float y) -{ - if(!active) - return false; - - selector_mouse += vec2(x,y); -#ifdef ANDROID - selector_mouse = vec2(x,y); -#endif - return true; -} - -void EMOTICON::draw_circle(float x, float y, float r, int segments) -{ - float f_segments = (float)segments; - for(int i = 0; i < segments; i+=2) - { - float a1 = i/f_segments * 2*pi; - float a2 = (i+1)/f_segments * 2*pi; - float a3 = (i+2)/f_segments * 2*pi; - float ca1 = cosf(a1); - float ca2 = cosf(a2); - float ca3 = cosf(a3); - float sa1 = sinf(a1); - float sa2 = sinf(a2); - float sa3 = sinf(a3); - - gfx_quads_draw_freeform( - x, y, - x+ca1*r, y+sa1*r, - x+ca3*r, y+sa3*r, - x+ca2*r, y+sa2*r); - } -} - - -void EMOTICON::on_render() -{ - if(!active) - { - if(was_active && selected_emote != -1) - emote(selected_emote); - was_active = false; - return; - } - - was_active = true; - - int x, y; -#ifdef ANDROID - // No relative mouse here, we've got touchscreen - inp_mouse_absolute(&x, &y); - - selector_mouse.x = x; - selector_mouse.y = y; -#else - inp_mouse_relative(&x, &y); - - selector_mouse.x += x; - selector_mouse.y += y; -#endif - - if (length(selector_mouse) > 140) - selector_mouse = normalize(selector_mouse) * 140; - - float selected_angle = get_angle(selector_mouse) + 2*pi/24; - if (selected_angle < 0) - selected_angle += 2*pi; - - if (length(selector_mouse) > 100) - selected_emote = (int)(selected_angle / (2*pi) * 12.0f); - - RECT screen = *ui_screen(); - - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.3f); - draw_circle(screen.w/2, screen.h/2, 160, 64); - gfx_quads_end(); - - gfx_texture_set(data->images[IMAGE_EMOTICONS].id); - gfx_quads_begin(); - - for (int i = 0; i < 12; i++) - { - float angle = 2*pi*i/12.0; - if (angle > pi) - angle -= 2*pi; - - bool selected = selected_emote == i; - - float size = selected ? 96 : 64; - - float nudge_x = 120 * cos(angle); - float nudge_y = 120 * sin(angle); - select_sprite(SPRITE_OOP + i); - gfx_quads_draw(screen.w/2 + nudge_x, screen.h/2 + nudge_y, size, size); - } - - gfx_quads_end(); - - gfx_texture_set(data->images[IMAGE_CURSOR].id); - gfx_quads_begin(); - gfx_setcolor(1,1,1,1); - gfx_quads_drawTL(selector_mouse.x+screen.w/2,selector_mouse.y+screen.h/2,24,24); - gfx_quads_end(); -} - -void EMOTICON::emote(int emoticon) -{ - NETMSG_CL_EMOTICON msg; - msg.emoticon = emoticon; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.hpp deleted file mode 100644 index 446b4b00a..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/emoticon.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -class EMOTICON : public COMPONENT -{ - void draw_circle(float x, float y, float r, int segments); - - bool was_active; - bool active; - - vec2 selector_mouse; - int selected_emote; - - static void con_key_emoticon(void *result, void *user_data); - static void con_emote(void *result, void *user_data); - -public: - EMOTICON(); - - virtual void on_reset(); - virtual void on_console_init(); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); - virtual bool on_mousemove(float x, float y); - - void emote(int emoticon); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.cpp deleted file mode 100644 index b2f983e64..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include "flow.hpp" - -FLOW::FLOW() -{ - cells = 0; - height = 0; - width = 0; - spacing = 16; -} - -void FLOW::dbg_render() -{ - if(!cells) - return; - - gfx_texture_set(-1); - gfx_lines_begin(); - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - { - vec2 pos(x*spacing, y*spacing); - vec2 vel = cells[y*width+x].vel * 0.01f; - gfx_lines_draw(pos.x, pos.y, pos.x+vel.x, pos.y+vel.y); - } - - gfx_lines_end(); -} - -void FLOW::init() -{ - if(cells) - { - mem_free(cells); - cells = 0; - } - - MAPITEM_LAYER_TILEMAP *tilemap = layers_game_layer(); - width = tilemap->width*32/spacing; - height = tilemap->height*32/spacing; - - // allocate and clear - cells = (CELL *)mem_alloc(sizeof(CELL)*width*height, 1); - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - cells[y*width+x].vel = vec2(0.0f, 0.0f); -} - -void FLOW::update() -{ - if(!cells) - return; - - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - cells[y*width+x].vel *= 0.85f; -} - -vec2 FLOW::get(vec2 pos) -{ - if(!cells) - return vec2(0,0); - - int x = (int)(pos.x / spacing); - int y = (int)(pos.y / spacing); - if(x < 0 || y < 0 || x >= width || y >= height) - return vec2(0,0); - - return cells[y*width+x].vel; -} - -void FLOW::add(vec2 pos, vec2 vel, float size) -{ - if(!cells) - return; - - int x = (int)(pos.x / spacing); - int y = (int)(pos.y / spacing); - if(x < 0 || y < 0 || x >= width || y >= height) - return; - - cells[y*width+x].vel += vel; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.hpp deleted file mode 100644 index 351b1f69e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/flow.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -class FLOW : public COMPONENT -{ - struct CELL - { - vec2 vel; - }; - - CELL *cells; - int height; - int width; - int spacing; - - void dbg_render(); - void init(); -public: - FLOW(); - - vec2 get(vec2 pos); - void add(vec2 pos, vec2 vel, float size); - void update(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.cpp deleted file mode 100644 index b1926ab48..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.cpp +++ /dev/null @@ -1,307 +0,0 @@ -#include // memcmp - -#include -#include -#include - -#include - -#include -#include -#include - -#include "controls.hpp" -#include "camera.hpp" -#include "hud.hpp" -#include "voting.hpp" -#include "binds.hpp" - -HUD::HUD() -{ - -} - -void HUD::on_reset() -{ -} - -void HUD::render_goals() -{ - // TODO: split this up into these: - // render_gametimer - // render_suddendeath - // render_scorehud - // render_warmuptimer - - int gameflags = gameclient.snap.gameobj->flags; - - float whole = 300*gfx_screenaspect(); - float half = whole/2.0f; - - - gfx_mapscreen(0,0,300*gfx_screenaspect(),300); - if(!gameclient.snap.gameobj->sudden_death) - { - char buf[32]; - int time = 0; - if(gameclient.snap.gameobj->time_limit) - { - time = gameclient.snap.gameobj->time_limit*60 - ((client_tick()-gameclient.snap.gameobj->round_start_tick)/client_tickspeed()); - - if(gameclient.snap.gameobj->game_over) - time = 0; - } - else - time = (client_tick()-gameclient.snap.gameobj->round_start_tick)/client_tickspeed(); - - str_format(buf, sizeof(buf), "%d:%02d", time /60, time %60); - float w = gfx_text_width(0, 16, buf, -1); - gfx_text(0, half-w/2, 2, 16, buf, -1); - } - - if(gameclient.snap.gameobj->sudden_death) - { - const char *text = "Sudden Death"; - float w = gfx_text_width(0, 16, text, -1); - gfx_text(0, half-w/2, 2, 16, text, -1); - } - - // render small score hud - if(!(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over) && (gameflags&GAMEFLAG_TEAMS)) - { - for(int t = 0; t < 2; t++) - { - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - if(t == 0) - gfx_setcolor(1,0,0,0.25f); - else - gfx_setcolor(0,0,1,0.25f); - draw_round_rect(whole-40, 300-40-15+t*20, 50, 18, 5.0f); - gfx_quads_end(); - - char buf[32]; - str_format(buf, sizeof(buf), "%d", t?gameclient.snap.gameobj->teamscore_blue:gameclient.snap.gameobj->teamscore_red); - float w = gfx_text_width(0, 14, buf, -1); - - if(gameflags&GAMEFLAG_FLAGS) - { - gfx_text(0, whole-20-w/2+5, 300-40-15+t*20, 14, buf, -1); - if(gameclient.snap.flags[t]) - { - if(gameclient.snap.flags[t]->carried_by == -2 || (gameclient.snap.flags[t]->carried_by == -1 && ((client_tick()/10)&1))) - { - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - if(t == 0) select_sprite(SPRITE_FLAG_RED); - else select_sprite(SPRITE_FLAG_BLUE); - - float size = 16; - gfx_quads_drawTL(whole-40+5, 300-40-15+t*20+1, size/2, size); - gfx_quads_end(); - } - else if(gameclient.snap.flags[t]->carried_by >= 0) - { - int id = gameclient.snap.flags[t]->carried_by%MAX_CLIENTS; - const char *name = gameclient.clients[id].name; - float w = gfx_text_width(0, 10, name, -1); - gfx_text(0, whole-40-5-w, 300-40-15+t*20+2, 10, name, -1); - TEE_RENDER_INFO info = gameclient.clients[id].render_info; - info.size = 18.0f; - - render_tee(ANIMSTATE::get_idle(), &info, EMOTE_NORMAL, vec2(1,0), - vec2(whole-40+10, 300-40-15+9+t*20+1)); - } - } - } - else - gfx_text(0, whole-20-w/2, 300-40-15+t*20, 14, buf, -1); - } - } - - // render warmup timer - if(gameclient.snap.gameobj->warmup) - { - char buf[256]; - float w = gfx_text_width(0, 24, "Warmup", -1); - gfx_text(0, 150*gfx_screenaspect()+-w/2, 50, 24, "Warmup", -1); - - int seconds = gameclient.snap.gameobj->warmup/SERVER_TICK_SPEED; - if(seconds < 5) - str_format(buf, sizeof(buf), "%d.%d", seconds, (gameclient.snap.gameobj->warmup*10/SERVER_TICK_SPEED)%10); - else - str_format(buf, sizeof(buf), "%d", seconds); - w = gfx_text_width(0, 24, buf, -1); - gfx_text(0, 150*gfx_screenaspect()+-w/2, 75, 24, buf, -1); - } -} - -static void mapscreen_to_group(float center_x, float center_y, MAPITEM_GROUP *group) -{ - float points[4]; - mapscreen_to_world(center_x, center_y, group->parallax_x/100.0f, group->parallax_y/100.0f, - group->offset_x, group->offset_y, gfx_screenaspect(), 1.0f, points); - gfx_mapscreen(points[0], points[1], points[2], points[3]); -} - -void HUD::render_fps() -{ - if(config.cl_showfps) - { - char buf[512]; - str_format(buf, sizeof(buf), "%d", (int)(1.0f/client_frametime())); - gfx_text(0, width-10-gfx_text_width(0,12,buf,-1), 5, 12, buf, -1); - } -} - -void HUD::render_connectionwarning() -{ - if(client_connection_problems()) - { - const char *text = "Connection Problems..."; - float w = gfx_text_width(0, 24, text, -1); - gfx_text(0, 150*gfx_screenaspect()-w/2, 50, 24, text, -1); - } -} - -void HUD::render_teambalancewarning() -{ - // render prompt about team-balance - bool flash = time_get()/(time_freq()/2)%2 == 0; - if (gameclient.snap.gameobj && (gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) != 0) - { - if (config.cl_warning_teambalance && abs(gameclient.snap.team_size[0]-gameclient.snap.team_size[1]) >= 2) - { - const char *text = "Please balance teams!"; - if(flash) - gfx_text_color(1,1,0.5f,1); - else - gfx_text_color(0.7f,0.7f,0.2f,1.0f); - gfx_text(0x0, 5, 50, 6, text, -1); - gfx_text_color(1,1,1,1); - } - } -} - - -void HUD::render_voting() -{ - if(!gameclient.voting->is_voting()) - return; - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.40f); - draw_round_rect(-10, 60-2, 100+10+4+5, 28, 5.0f); - gfx_quads_end(); - - gfx_text_color(1,1,1,1); - - char buf[512]; - gfx_text(0x0, 5, 60, 6, gameclient.voting->vote_description(), -1); - - str_format(buf, sizeof(buf), "%ds left", gameclient.voting->seconds_left()); - float tw = gfx_text_width(0x0, 6, buf, -1); - gfx_text(0x0, 5+100-tw, 60, 6, buf, -1); - - - RECT base = {5, 70, 100, 4}; - gameclient.voting->render_bars(base, false); - - const char *yes_key = gameclient.binds->get_key("vote yes"); - const char *no_key = gameclient.binds->get_key("vote no"); - str_format(buf, sizeof(buf), "%s - Vote Yes", yes_key); - base.y += base.h+1; - ui_do_label(&base, buf, 6.0f, -1); - - str_format(buf, sizeof(buf), "Vote No - %s", no_key); - ui_do_label(&base, buf, 6.0f, 1); -} - -void HUD::render_cursor() -{ - if(!gameclient.snap.local_character) - return; - - mapscreen_to_group(gameclient.camera->center.x, gameclient.camera->center.y, layers_game_group()); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - // render cursor - select_sprite(data->weapons.id[gameclient.snap.local_character->weapon%NUM_WEAPONS].sprite_cursor); - float cursorsize = 64; - draw_sprite(gameclient.controls->target_pos.x, gameclient.controls->target_pos.y, cursorsize); - gfx_quads_end(); -} - -void HUD::render_healthandammo() -{ - //mapscreen_to_group(gacenter_x, center_y, layers_game_group()); - - float x = 5; - float y = 5; - - // render ammo count - // render gui stuff - - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_mapscreen(0,0,width,300); - - gfx_quads_begin(); - - // if weaponstage is active, put a "glow" around the stage ammo - select_sprite(data->weapons.id[gameclient.snap.local_character->weapon%NUM_WEAPONS].sprite_proj); - for (int i = 0; i < min(gameclient.snap.local_character->ammocount, 10); i++) - gfx_quads_drawTL(x+i*12,y+24,10,10); - - gfx_quads_end(); - - gfx_quads_begin(); - int h = 0; - - // render health - select_sprite(SPRITE_HEALTH_FULL); - for(; h < gameclient.snap.local_character->health; h++) - gfx_quads_drawTL(x+h*12,y,10,10); - - select_sprite(SPRITE_HEALTH_EMPTY); - for(; h < 10; h++) - gfx_quads_drawTL(x+h*12,y,10,10); - - // render armor meter - h = 0; - select_sprite(SPRITE_ARMOR_FULL); - for(; h < gameclient.snap.local_character->armor; h++) - gfx_quads_drawTL(x+h*12,y+12,10,10); - - select_sprite(SPRITE_ARMOR_EMPTY); - for(; h < 10; h++) - gfx_quads_drawTL(x+h*12,y+12,10,10); - gfx_quads_end(); -} - -void HUD::on_render() -{ - if(!gameclient.snap.gameobj) - return; - - width = 300*gfx_screenaspect(); - - bool spectate = false; - if(gameclient.snap.local_info && gameclient.snap.local_info->team == -1) - spectate = true; - - if(gameclient.snap.local_character && !spectate && !(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over)) - render_healthandammo(); - - render_goals(); - render_fps(); - if(client_state() != CLIENTSTATE_DEMOPLAYBACK) - render_connectionwarning(); - render_teambalancewarning(); - render_voting(); - render_cursor(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.hpp deleted file mode 100644 index 41fa0ff29..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/hud.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -class HUD : public COMPONENT -{ - float width; - - void render_cursor(); - - void render_fps(); - void render_connectionwarning(); - void render_teambalancewarning(); - void render_voting(); - void render_healthandammo(); - void render_goals(); - -public: - HUD(); - - virtual void on_reset(); - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.cpp deleted file mode 100644 index 1d579619d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.cpp +++ /dev/null @@ -1,258 +0,0 @@ -#include -#include -#include - -#include // get_angle -#include -#include -#include - -#include -#include - -#include "items.hpp" - -void ITEMS::render_projectile(const NETOBJ_PROJECTILE *current, int itemid) -{ - - // get positions - float curvature = 0; - float speed = 0; - if(current->type == WEAPON_GRENADE) - { - curvature = gameclient.tuning.grenade_curvature; - speed = gameclient.tuning.grenade_speed; - } - else if(current->type == WEAPON_SHOTGUN) - { - curvature = gameclient.tuning.shotgun_curvature; - speed = gameclient.tuning.shotgun_speed; - } - else if(current->type == WEAPON_GUN) - { - curvature = gameclient.tuning.gun_curvature; - speed = gameclient.tuning.gun_speed; - } - - float ct = (client_prevtick()-current->start_tick)/(float)SERVER_TICK_SPEED + client_ticktime(); - if(ct < 0) - return; // projectile havn't been shot yet - - vec2 startpos(current->x, current->y); - vec2 startvel(current->vx/100.0f, current->vy/100.0f); - vec2 pos = calc_pos(startpos, startvel, curvature, speed, ct); - vec2 prevpos = calc_pos(startpos, startvel, curvature, speed, ct-0.001f); - - - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - select_sprite(data->weapons.id[clamp(current->type, 0, NUM_WEAPONS-1)].sprite_proj); - vec2 vel = pos-prevpos; - //vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), client_intratick()); - - - // add particle for this projectile - if(current->type == WEAPON_GRENADE) - { - gameclient.effects->smoketrail(pos, vel*-1); - gameclient.flow->add(pos, vel*1000*client_frametime(), 10.0f); - gfx_quads_setrotation(client_localtime()*pi*2*2 + itemid); - } - else - { - gameclient.effects->bullettrail(pos); - gameclient.flow->add(pos, vel*1000*client_frametime(), 10.0f); - - if(length(vel) > 0.00001f) - gfx_quads_setrotation(get_angle(vel)); - else - gfx_quads_setrotation(0); - - } - - gfx_quads_draw(pos.x, pos.y, 32, 32); - gfx_quads_setrotation(0); - gfx_quads_end(); -} - -void ITEMS::render_pickup(const NETOBJ_PICKUP *prev, const NETOBJ_PICKUP *current) -{ - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), client_intratick()); - float angle = 0.0f; - float size = 64.0f; - if (current->type == POWERUP_WEAPON) - { - angle = 0; //-pi/6;//-0.25f * pi * 2.0f; - select_sprite(data->weapons.id[clamp(current->subtype, 0, NUM_WEAPONS-1)].sprite_body); - size = data->weapons.id[clamp(current->subtype, 0, NUM_WEAPONS-1)].visual_size; - } - else - { - const int c[] = { - SPRITE_PICKUP_HEALTH, - SPRITE_PICKUP_ARMOR, - SPRITE_PICKUP_WEAPON, - SPRITE_PICKUP_NINJA - }; - select_sprite(c[current->type]); - - if(c[current->type] == SPRITE_PICKUP_NINJA) - { - gameclient.effects->powerupshine(pos, vec2(96,18)); - size *= 2.0f; - pos.x += 10.0f; - } - } - - gfx_quads_setrotation(angle); - - float offset = pos.y/32.0f + pos.x/32.0f; - pos.x += cosf(client_localtime()*2.0f+offset)*2.5f; - pos.y += sinf(client_localtime()*2.0f+offset)*2.5f; - draw_sprite(pos.x, pos.y, size); - gfx_quads_end(); -} - -void ITEMS::render_flag(const NETOBJ_FLAG *prev, const NETOBJ_FLAG *current) -{ - float angle = 0.0f; - float size = 42.0f; - - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - if(current->team == 0) // red team - select_sprite(SPRITE_FLAG_RED); - else - select_sprite(SPRITE_FLAG_BLUE); - - gfx_quads_setrotation(angle); - - vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), client_intratick()); - - // make sure that the flag isn't interpolated between capture and return - if(prev->carried_by != current->carried_by) - pos = vec2(current->x, current->y); - - // make sure to use predicted position if we are the carrier - if(gameclient.snap.local_info && current->carried_by == gameclient.snap.local_info->cid) - pos = gameclient.local_character_pos; - - gfx_quads_draw(pos.x, pos.y-size*0.75f, size, size*2); - gfx_quads_end(); -} - - -void ITEMS::render_laser(const struct NETOBJ_LASER *current) -{ - vec2 pos = vec2(current->x, current->y); - vec2 from = vec2(current->from_x, current->from_y); - vec2 dir = normalize(pos-from); - - float ticks = client_tick() + client_intratick() - current->start_tick; - float ms = (ticks/50.0f) * 1000.0f; - float a = ms / gameclient.tuning.laser_bounce_delay; - a = clamp(a, 0.0f, 1.0f); - float ia = 1-a; - - vec2 out, border; - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - - //vec4 inner_color(0.15f,0.35f,0.75f,1.0f); - //vec4 outer_color(0.65f,0.85f,1.0f,1.0f); - - // do outline - vec4 outer_color(0.075f,0.075f,0.25f,1.0f); - gfx_setcolor(outer_color.r,outer_color.g,outer_color.b,1.0f); - out = vec2(dir.y, -dir.x) * (7.0f*ia); - - gfx_quads_draw_freeform( - from.x-out.x, from.y-out.y, - from.x+out.x, from.y+out.y, - pos.x-out.x, pos.y-out.y, - pos.x+out.x, pos.y+out.y - ); - - // do inner - vec4 inner_color(0.5f,0.5f,1.0f,1.0f); - out = vec2(dir.y, -dir.x) * (5.0f*ia); - gfx_setcolor(inner_color.r, inner_color.g, inner_color.b, 1.0f); // center - - gfx_quads_draw_freeform( - from.x-out.x, from.y-out.y, - from.x+out.x, from.y+out.y, - pos.x-out.x, pos.y-out.y, - pos.x+out.x, pos.y+out.y - ); - - gfx_quads_end(); - - // render head - { - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_PARTICLES].id); - gfx_quads_begin(); - - int sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03}; - select_sprite(sprites[client_tick()%3]); - gfx_quads_setrotation(client_tick()); - gfx_setcolor(outer_color.r,outer_color.g,outer_color.b,1.0f); - gfx_quads_draw(pos.x, pos.y, 24,24); - gfx_setcolor(inner_color.r, inner_color.g, inner_color.b, 1.0f); - gfx_quads_draw(pos.x, pos.y, 20,20); - gfx_quads_end(); - } - - gfx_blend_normal(); -} - -void ITEMS::on_render() -{ - int num = snap_num_items(SNAP_CURRENT); - for(int i = 0; i < num; i++) - { - SNAP_ITEM item; - const void *data = snap_get_item(SNAP_CURRENT, i, &item); - - if(item.type == NETOBJTYPE_PROJECTILE) - { - render_projectile((const NETOBJ_PROJECTILE *)data, item.id); - } - else if(item.type == NETOBJTYPE_PICKUP) - { - const void *prev = snap_find_item(SNAP_PREV, item.type, item.id); - if(prev) - render_pickup((const NETOBJ_PICKUP *)prev, (const NETOBJ_PICKUP *)data); - } - else if(item.type == NETOBJTYPE_LASER) - { - render_laser((const NETOBJ_LASER *)data); - } - else if(item.type == NETOBJTYPE_FLAG) - { - const void *prev = snap_find_item(SNAP_PREV, item.type, item.id); - if (prev) - render_flag((const NETOBJ_FLAG *)prev, (const NETOBJ_FLAG *)data); - } - } - - // render extra projectiles - /* - for(int i = 0; i < extraproj_num; i++) - { - if(extraproj_projectiles[i].start_tick < client_tick()) - { - extraproj_projectiles[i] = extraproj_projectiles[extraproj_num-1]; - extraproj_num--; - } - else - render_projectile(&extraproj_projectiles[i], 0); - }*/ -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.hpp deleted file mode 100644 index 2f33c8c4b..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/items.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -class ITEMS : public COMPONENT -{ - void render_projectile(const NETOBJ_PROJECTILE *current, int itemid); - void render_pickup(const NETOBJ_PICKUP *prev, const NETOBJ_PICKUP *current); - void render_flag(const NETOBJ_FLAG *prev, const NETOBJ_FLAG *current); - void render_laser(const struct NETOBJ_LASER *current); - -public: - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.cpp deleted file mode 100644 index 410f2c3d4..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include - -#include -#include -#include "killmessages.hpp" - -void KILLMESSAGES::on_reset() -{ - killmsg_current = 0; - for(int i = 0; i < killmsg_max; i++) - killmsgs[i].tick = -100000; -} - -void KILLMESSAGES::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_KILLMSG) - { - NETMSG_SV_KILLMSG *msg = (NETMSG_SV_KILLMSG *)rawmsg; - - // unpack messages - KILLMSG kill; - kill.killer = msg->killer; - kill.victim = msg->victim; - kill.weapon = msg->weapon; - kill.mode_special = msg->mode_special; - kill.tick = client_tick(); - - // add the message - killmsg_current = (killmsg_current+1)%killmsg_max; - killmsgs[killmsg_current] = kill; - } -} - -void KILLMESSAGES::on_render() -{ - float width = 400*3.0f*gfx_screenaspect(); - float height = 400*3.0f; - - gfx_mapscreen(0, 0, width*1.5f, height*1.5f); - float startx = width*1.5f-10.0f; - float y = 20.0f; - - for(int i = 0; i < killmsg_max; i++) - { - - int r = (killmsg_current+i+1)%killmsg_max; - if(client_tick() > killmsgs[r].tick+50*10) - continue; - - float font_size = 36.0f; - float killername_w = gfx_text_width(0, font_size, gameclient.clients[killmsgs[r].killer].name, -1); - float victimname_w = gfx_text_width(0, font_size, gameclient.clients[killmsgs[r].victim].name, -1); - - float x = startx; - - // render victim name - x -= victimname_w; - gfx_text(0, x, y, font_size, gameclient.clients[killmsgs[r].victim].name, -1); - - // render victim tee - x -= 24.0f; - - if(gameclient.snap.gameobj && gameclient.snap.gameobj->flags&GAMEFLAG_FLAGS) - { - if(killmsgs[r].mode_special&1) - { - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - if(gameclient.clients[killmsgs[r].victim].team == 0) select_sprite(SPRITE_FLAG_BLUE); - else select_sprite(SPRITE_FLAG_RED); - - float size = 56.0f; - gfx_quads_drawTL(x, y-16, size/2, size); - gfx_quads_end(); - } - } - - render_tee(ANIMSTATE::get_idle(), &gameclient.clients[killmsgs[r].victim].render_info, EMOTE_PAIN, vec2(-1,0), vec2(x, y+28)); - x -= 32.0f; - - // render weapon - x -= 44.0f; - if (killmsgs[r].weapon >= 0) - { - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - select_sprite(data->weapons.id[killmsgs[r].weapon].sprite_body); - draw_sprite(x, y+28, 96); - gfx_quads_end(); - } - x -= 52.0f; - - if(killmsgs[r].victim != killmsgs[r].killer) - { - if(gameclient.snap.gameobj && gameclient.snap.gameobj->flags&GAMEFLAG_FLAGS) - { - if(killmsgs[r].mode_special&2) - { - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - if(gameclient.clients[killmsgs[r].killer].team == 0) select_sprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X); - else select_sprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X); - - float size = 56.0f; - gfx_quads_drawTL(x-56, y-16, size/2, size); - gfx_quads_end(); - } - } - - // render killer tee - x -= 24.0f; - render_tee(ANIMSTATE::get_idle(), &gameclient.clients[killmsgs[r].killer].render_info, EMOTE_ANGRY, vec2(1,0), vec2(x, y+28)); - x -= 32.0f; - - // render killer name - x -= killername_w; - gfx_text(0, x, y, font_size, gameclient.clients[killmsgs[r].killer].name, -1); - } - - y += 44; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.hpp deleted file mode 100644 index f29e0bdf9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/killmessages.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -class KILLMESSAGES : public COMPONENT -{ -public: - // kill messages - struct KILLMSG - { - int weapon; - int victim; - int killer; - int mode_special; // for CTF, if the guy is carrying a flag for example - int tick; - }; - - static const int killmsg_max = 5; - KILLMSG killmsgs[killmsg_max]; - int killmsg_current; - - virtual void on_reset(); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.cpp deleted file mode 100644 index 7f839da05..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -#include "mapimages.hpp" - -MAPIMAGES::MAPIMAGES() -{ - count = 0; -} - -void MAPIMAGES::on_mapload() -{ - // unload all textures - for(int i = 0; i < count; i++) - { - gfx_unload_texture(textures[i]); - textures[i] = -1; - } - count = 0; - - int start; - map_get_type(MAPITEMTYPE_IMAGE, &start, &count); - - // load new textures - for(int i = 0; i < count; i++) - { - textures[i] = 0; - - MAPITEM_IMAGE *img = (MAPITEM_IMAGE *)map_get_item(start+i, 0, 0); - if(img->external) - { - char buf[256]; - char *name = (char *)map_get_data(img->image_name); - str_format(buf, sizeof(buf), "mapres/%s.png", name); - textures[i] = gfx_load_texture(buf, IMG_AUTO, 0); - } - else - { - void *data = map_get_data(img->image_data); - textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_RGBA, data, IMG_RGBA, 0); - map_unload_data(img->image_data); - } - } -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.hpp deleted file mode 100644 index cba460332..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/mapimages.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -class MAPIMAGES : public COMPONENT -{ - int textures[64]; - int count; -public: - MAPIMAGES(); - - int get(int index) const { return textures[index]; } - int num() const { return count; } - - virtual void on_mapload(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.cpp deleted file mode 100644 index 847350e62..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#include -#include -#include -#include - -#include -#include - -#include "maplayers.hpp" - -MAPLAYERS::MAPLAYERS(int t) -{ - type = t; -} - - -static void mapscreen_to_group(float center_x, float center_y, MAPITEM_GROUP *group) -{ - float points[4]; - mapscreen_to_world(center_x, center_y, group->parallax_x/100.0f, group->parallax_y/100.0f, - group->offset_x, group->offset_y, gfx_screenaspect(), 1.0f, points); - gfx_mapscreen(points[0], points[1], points[2], points[3]); -} - -static void envelope_eval(float time_offset, int env, float *channels) -{ - channels[0] = 0; - channels[1] = 0; - channels[2] = 0; - channels[3] = 0; - - ENVPOINT *points; - - { - int start, num; - map_get_type(MAPITEMTYPE_ENVPOINTS, &start, &num); - if(num) - points = (ENVPOINT *)map_get_item(start, 0, 0); - } - - int start, num; - map_get_type(MAPITEMTYPE_ENVELOPE, &start, &num); - - if(env >= num) - return; - - MAPITEM_ENVELOPE *item = (MAPITEM_ENVELOPE *)map_get_item(start+env, 0, 0); - render_eval_envelope(points+item->start_point, item->num_points, 4, client_localtime()+time_offset, channels); -} - -void MAPLAYERS::on_render() -{ - if(client_state() != CLIENTSTATE_ONLINE && client_state() != CLIENTSTATE_DEMOPLAYBACK) - return; - - RECT screen; - gfx_getscreen(&screen.x, &screen.y, &screen.w, &screen.h); - - vec2 center = gameclient.camera->center; - //float center_x = gameclient.camera->center.x; - //float center_y = gameclient.camera->center.y; - - bool passed_gamelayer = false; - - for(int g = 0; g < layers_num_groups(); g++) - { - MAPITEM_GROUP *group = layers_get_group(g); - - if(!config.gfx_noclip && group->version >= 2 && group->use_clipping) - { - // set clipping - float points[4]; - mapscreen_to_group(center.x, center.y, layers_game_group()); - gfx_getscreen(&points[0], &points[1], &points[2], &points[3]); - float x0 = (group->clip_x - points[0]) / (points[2]-points[0]); - float y0 = (group->clip_y - points[1]) / (points[3]-points[1]); - float x1 = ((group->clip_x+group->clip_w) - points[0]) / (points[2]-points[0]); - float y1 = ((group->clip_y+group->clip_h) - points[1]) / (points[3]-points[1]); - - gfx_clip_enable((int)(x0*gfx_screenwidth()), (int)(y0*gfx_screenheight()), - (int)((x1-x0)*gfx_screenwidth()), (int)((y1-y0)*gfx_screenheight())); - } - - mapscreen_to_group(center.x, center.y, group); - - for(int l = 0; l < group->num_layers; l++) - { - MAPITEM_LAYER *layer = layers_get_layer(group->start_layer+l); - bool render = false; - bool is_game_layer = false; - - if(layer == (MAPITEM_LAYER*)layers_game_layer()) - { - is_game_layer = true; - passed_gamelayer = 1; - } - - // skip rendering if detail layers if not wanted - if(layer->flags&LAYERFLAG_DETAIL && !config.gfx_high_detail && !is_game_layer) - continue; - - if(type == -1) - render = true; - else if(type == 0) - { - if(passed_gamelayer) - return; - render = true; - } - else - { - if(passed_gamelayer && !is_game_layer) - render = true; - } - - if(render && !is_game_layer) - { - //layershot_begin(); - - if(layer->type == LAYERTYPE_TILES) - { - MAPITEM_LAYER_TILEMAP *tmap = (MAPITEM_LAYER_TILEMAP *)layer; - if(tmap->image == -1) - gfx_texture_set(-1); - else - gfx_texture_set(gameclient.mapimages->get(tmap->image)); - - TILE *tiles = (TILE *)map_get_data(tmap->data); - gfx_blend_none(); - render_tilemap(tiles, tmap->width, tmap->height, 32.0f, vec4(1,1,1,1), TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE); - gfx_blend_normal(); - render_tilemap(tiles, tmap->width, tmap->height, 32.0f, vec4(1,1,1,1), TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT); - } - else if(layer->type == LAYERTYPE_QUADS) - { - MAPITEM_LAYER_QUADS *qlayer = (MAPITEM_LAYER_QUADS *)layer; - if(qlayer->image == -1) - gfx_texture_set(-1); - else - gfx_texture_set(gameclient.mapimages->get(qlayer->image)); - - QUAD *quads = (QUAD *)map_get_data_swapped(qlayer->data); - - gfx_blend_none(); - render_quads(quads, qlayer->num_quads, envelope_eval, LAYERRENDERFLAG_OPAQUE); - gfx_blend_normal(); - render_quads(quads, qlayer->num_quads, envelope_eval, LAYERRENDERFLAG_TRANSPARENT); - } - - //layershot_end(); - } - } - if(!config.gfx_noclip) - gfx_clip_disable(); - } - - if(!config.gfx_noclip) - gfx_clip_disable(); - - // reset the screen like it was before - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.hpp deleted file mode 100644 index c2919f082..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/maplayers.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -class MAPLAYERS : public COMPONENT -{ - int type; -public: - enum - { - TYPE_BACKGROUND=0, - TYPE_FOREGROUND, - }; - - MAPLAYERS(int type); - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.cpp deleted file mode 100644 index 7d9e3b4cd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.cpp +++ /dev/null @@ -1,1145 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include - -#include -#include -#include - -#include "menus.hpp" -#include "skins.hpp" - -#include - -extern "C" { - #include -} - -#include -#include - -#include -#include -#include - -vec4 MENUS::gui_color; -vec4 MENUS::color_tabbar_inactive_outgame; -vec4 MENUS::color_tabbar_active_outgame; -vec4 MENUS::color_tabbar_inactive; -vec4 MENUS::color_tabbar_active; -vec4 MENUS::color_tabbar_inactive_ingame; -vec4 MENUS::color_tabbar_active_ingame; - - -float MENUS::button_height = 25.0f; -float MENUS::listheader_height = 17.0f; -float MENUS::fontmod_height = 0.8f; - -INPUT_EVENT MENUS::inputevents[MAX_INPUTEVENTS]; -int MENUS::num_inputevents; - -inline float hue_to_rgb(float v1, float v2, float h) -{ - if(h < 0) h += 1; - if(h > 1) h -= 1; - if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h; - if((2 * h) < 1) return v2; - if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6; - return v1; -} - -inline vec3 hsl_to_rgb(vec3 in) -{ - float v1, v2; - vec3 out; - - if(in.s == 0) - { - out.r = in.l; - out.g = in.l; - out.b = in.l; - } - else - { - if(in.l < 0.5f) - v2 = in.l * (1 + in.s); - else - v2 = (in.l+in.s) - (in.s*in.l); - - v1 = 2 * in.l - v2; - - out.r = hue_to_rgb(v1, v2, in.h + (1.0f/3.0f)); - out.g = hue_to_rgb(v1, v2, in.h); - out.b = hue_to_rgb(v1, v2, in.h - (1.0f/3.0f)); - } - - return out; -} - - -MENUS::MENUS() -{ - popup = POPUP_NONE; - active_page = PAGE_INTERNET; - game_page = PAGE_GAME; - - need_restart = false; - need_sendinfo = false; - menu_active = true; - - escape_pressed = false; - enter_pressed = false; - num_inputevents = 0; - - demos = 0; - num_demos = 0; - - last_input = time_get(); -} - -vec4 MENUS::button_color_mul(const void *id) -{ - if(ui_active_item() == id) - return vec4(1,1,1,0.5f); - else if(ui_hot_item() == id) - return vec4(1,1,1,1.5f); - return vec4(1,1,1,1); -} - -void MENUS::ui_draw_browse_icon(int what, const RECT *r) -{ - gfx_texture_set(data->images[IMAGE_BROWSEICONS].id); - gfx_quads_begin(); - select_sprite(what); - gfx_quads_drawTL(r->x,r->y,r->w,r->h); - gfx_quads_end(); -} - - -void MENUS::ui_draw_menu_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - ui_draw_rect(r, vec4(1,1,1,0.5f)*button_color_mul(id), CORNER_ALL, 5.0f); - ui_do_label(r, text, r->h*fontmod_height, 0); -} - -void MENUS::ui_draw_keyselect_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - ui_draw_rect(r, vec4(1,1,1,0.5f)*button_color_mul(id), CORNER_ALL, 5.0f); - ui_do_label(r, text, r->h*fontmod_height, 0); -} - -void MENUS::ui_draw_menu_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - int corners = CORNER_T; - vec4 colormod(1,1,1,1); - if(extra) - corners = *(int *)extra; - - if(checked) - ui_draw_rect(r, color_tabbar_active, corners, 10.0f); - else - ui_draw_rect(r, color_tabbar_inactive, corners, 10.0f); - ui_do_label(r, text, r->h*fontmod_height, 0); -} - - -void MENUS::ui_draw_settings_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(checked) - ui_draw_rect(r, color_tabbar_active, CORNER_R, 10.0f); - else - ui_draw_rect(r, color_tabbar_inactive, CORNER_R, 10.0f); - ui_do_label(r, text, r->h*fontmod_height, 0); -} - -void MENUS::ui_draw_grid_header(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(checked) - ui_draw_rect(r, vec4(1,1,1,0.5f), CORNER_T, 5.0f); - RECT t; - ui_vsplit_l(r, 5.0f, 0, &t); - ui_do_label(&t, text, r->h*fontmod_height, -1); -} - -void MENUS::ui_draw_list_row(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(checked) - { - RECT sr = *r; - ui_margin(&sr, 1.5f, &sr); - ui_draw_rect(&sr, vec4(1,1,1,0.5f), CORNER_ALL, 4.0f); - } - ui_do_label(r, text, r->h*fontmod_height, -1); -} - -void MENUS::ui_draw_checkbox_common(const void *id, const char *text, const char *boxtext, const RECT *r) -{ - RECT c = *r; - RECT t = *r; - c.w = c.h; - t.x += c.w; - t.w -= c.w; - ui_vsplit_l(&t, 5.0f, 0, &t); - - ui_margin(&c, 2.0f, &c); - ui_draw_rect(&c, vec4(1,1,1,0.25f)*button_color_mul(id), CORNER_ALL, 3.0f); - c.y += 2; - ui_do_label(&c, boxtext, r->h*fontmod_height*0.75f, 0); - ui_do_label(&t, text, r->h*fontmod_height*0.8f, -1); -} - -void MENUS::ui_draw_checkbox(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - ui_draw_checkbox_common(id, text, checked?"X":"", r); -} - - -void MENUS::ui_draw_checkbox_number(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - char buf[16]; - str_format(buf, sizeof(buf), "%d", checked); - ui_draw_checkbox_common(id, text, buf, r); -} - -int MENUS::ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float font_size, bool hidden) -{ - int inside = ui_mouse_inside(rect); - int r = 0; - static int at_index = 0; - - if(ui_last_active_item() == id) - { - int len = strlen(str); - - if (inside && ui_mouse_button(0)) - { - int mx_rel = (int)(ui_mouse_x() - rect->x); - - for (int i = 1; i <= len; i++) - { - if (gfx_text_width(0, font_size, str, i) + 10 > mx_rel) - { - at_index = i - 1; - break; - } - - if (i == len) - at_index = len; - } - } - - for(int i = 0; i < num_inputevents; i++) - { - len = strlen(str); - INPUT_EVENT e = inputevents[i]; - char c = e.ch; - int k = e.key; - - if (at_index > len) - at_index = len; - - if (!(c >= 0 && c < 32) && c != 127) - { - if (len < str_size - 1 && at_index < str_size - 1) - { - memmove(str + at_index + 1, str + at_index, len - at_index + 1); - str[at_index] = c; - at_index++; - r = 1; - } - } - - if(e.flags&INPFLAG_PRESS) - { - if (k == KEY_BACKSPACE && at_index > 0) - { - memmove(str + at_index - 1, str + at_index, len - at_index + 1); - at_index--; - r = 1; - } - else if (k == KEY_DELETE && at_index < len) - { - memmove(str + at_index, str + at_index + 1, len - at_index); - r = 1; - } - else if (k == KEY_RETURN) - ui_clear_last_active_item(); - else if (k == KEY_LEFT && at_index > 0) - at_index--; - else if (k == KEY_RIGHT && at_index < len) - at_index++; - else if (k == KEY_HOME) - at_index = 0; - else if (k == KEY_END) - at_index = len; - } - } - } - - bool just_got_active = false; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - if (ui_last_active_item() != id) - just_got_active = true; - ui_set_active_item(id); - } - } - - if(inside) - ui_set_hot_item(id); - - RECT textbox = *rect; - ui_draw_rect(&textbox, vec4(1,1,1,0.5f), CORNER_ALL, 5.0f); - ui_vmargin(&textbox, 5.0f, &textbox); - - const char *display_str = str; - char stars[128]; - - if(hidden) - { - unsigned s = strlen(str); - if(s >= sizeof(stars)) - s = sizeof(stars)-1; - memset(stars, '*', s); - stars[s] = 0; - display_str = stars; - } - - ui_do_label(&textbox, display_str, font_size, -1); - - if (ui_last_active_item() == id && !just_got_active) - { - float w = gfx_text_width(0, font_size, display_str, at_index); - textbox.x += w*ui_scale(); - ui_do_label(&textbox, "_", font_size, -1); - } - - return r; -} - -float MENUS::ui_do_scrollbar_v(const void *id, const RECT *rect, float current) -{ - RECT handle; - static float offset_y; - ui_hsplit_t(rect, 33, &handle, 0); - - handle.y += (rect->h-handle.h)*current; - - /* logic */ - float ret = current; - int inside = ui_mouse_inside(&handle); - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - - float min = rect->y; - float max = rect->h-handle.h; - float cur = ui_mouse_y()-offset_y; - ret = (cur-min)/max; - if(ret < 0.0f) ret = 0.0f; - if(ret > 1.0f) ret = 1.0f; - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - ui_set_active_item(id); - offset_y = ui_mouse_y()-handle.y; - } - } - - if(inside) - ui_set_hot_item(id); - - // render - RECT rail; - ui_vmargin(rect, 5.0f, &rail); - ui_draw_rect(&rail, vec4(1,1,1,0.25f), 0, 0.0f); - - RECT slider = handle; - slider.w = rail.x-slider.x; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_L, 2.5f); - slider.x = rail.x+rail.w; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_R, 2.5f); - - slider = handle; - ui_margin(&slider, 5.0f, &slider); - ui_draw_rect(&slider, vec4(1,1,1,0.25f)*button_color_mul(id), CORNER_ALL, 2.5f); - - return ret; -} - - - -float MENUS::ui_do_scrollbar_h(const void *id, const RECT *rect, float current) -{ - RECT handle; - static float offset_x; - ui_vsplit_l(rect, 33, &handle, 0); - - handle.x += (rect->w-handle.w)*current; - - /* logic */ - float ret = current; - int inside = ui_mouse_inside(&handle); - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - - float min = rect->x; - float max = rect->w-handle.w; - float cur = ui_mouse_x()-offset_x; - ret = (cur-min)/max; - if(ret < 0.0f) ret = 0.0f; - if(ret > 1.0f) ret = 1.0f; - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - ui_set_active_item(id); - offset_x = ui_mouse_x()-handle.x; - } - } - - if(inside) - ui_set_hot_item(id); - - // render - RECT rail; - ui_hmargin(rect, 5.0f, &rail); - ui_draw_rect(&rail, vec4(1,1,1,0.25f), 0, 0.0f); - - RECT slider = handle; - slider.h = rail.y-slider.y; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_T, 2.5f); - slider.y = rail.y+rail.h; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_B, 2.5f); - - slider = handle; - ui_margin(&slider, 5.0f, &slider); - ui_draw_rect(&slider, vec4(1,1,1,0.25f)*button_color_mul(id), CORNER_ALL, 2.5f); - - return ret; -} - -int MENUS::ui_do_key_reader(void *id, const RECT *rect, int key) -{ - // process - static void *grabbed_id = 0; - static bool mouse_released = true; - int inside = ui_mouse_inside(rect); - int new_key = key; - - if(!ui_mouse_button(0) && grabbed_id == id) - mouse_released = true; - - if(ui_active_item() == id) - { - if(binder.got_key) - { - new_key = binder.key.key; - binder.got_key = false; - ui_set_active_item(0); - mouse_released = false; - grabbed_id = id; - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0) && mouse_released) - { - binder.take_key = true; - binder.got_key = false; - ui_set_active_item(id); - } - } - - if(inside) - ui_set_hot_item(id); - - // draw - if (ui_active_item() == id) - ui_draw_keyselect_button(id, "???", 0, rect, 0); - else - { - if(key == 0) - ui_draw_keyselect_button(id, "", 0, rect, 0); - else - ui_draw_keyselect_button(id, inp_key_name(key), 0, rect, 0); - } - return new_key; -} - - -int MENUS::render_menubar(RECT r) -{ - RECT box = r; - RECT button; - - int active_page = config.ui_page; - int new_page = -1; - - if(client_state() != CLIENTSTATE_OFFLINE) - active_page = game_page; - - if(client_state() == CLIENTSTATE_OFFLINE) - { - /* offline menus */ - if(0) // this is not done yet - { - ui_vsplit_l(&box, 90.0f, &button, &box); - static int news_button=0; - if (ui_do_button(&news_button, "News", active_page==PAGE_NEWS, &button, ui_draw_menu_tab_button, 0)) - new_page = PAGE_NEWS; - ui_vsplit_l(&box, 30.0f, 0, &box); - } - - ui_vsplit_l(&box, 100.0f, &button, &box); - static int internet_button=0; - int corners = CORNER_TL; - if (ui_do_button(&internet_button, "Internet", active_page==PAGE_INTERNET, &button, ui_draw_menu_tab_button, &corners)) - { - client_serverbrowse_refresh(BROWSETYPE_INTERNET); - new_page = PAGE_INTERNET; - } - - //ui_vsplit_l(&box, 4.0f, 0, &box); - ui_vsplit_l(&box, 80.0f, &button, &box); - static int lan_button=0; - corners = 0; - if (ui_do_button(&lan_button, "LAN", active_page==PAGE_LAN, &button, ui_draw_menu_tab_button, &corners)) - { - client_serverbrowse_refresh(BROWSETYPE_LAN); - new_page = PAGE_LAN; - } - - //ui_vsplit_l(&box, 4.0f, 0, &box); - ui_vsplit_l(&box, 110.0f, &button, &box); - static int favorites_button=0; - corners = CORNER_TR; - if (ui_do_button(&favorites_button, "Favorites", active_page==PAGE_FAVORITES, &button, ui_draw_menu_tab_button, &corners)) - { - client_serverbrowse_refresh(BROWSETYPE_FAVORITES); - new_page = PAGE_FAVORITES; - } - - ui_vsplit_l(&box, 4.0f*5, 0, &box); - ui_vsplit_l(&box, 100.0f, &button, &box); - static int demos_button=0; - if (ui_do_button(&demos_button, "Demos", active_page==PAGE_DEMOS, &button, ui_draw_menu_tab_button, 0)) - { - demolist_populate(); - new_page = PAGE_DEMOS; - } - } - else - { - /* online menus */ - ui_vsplit_l(&box, 90.0f, &button, &box); - static int game_button=0; - if (ui_do_button(&game_button, "Game", active_page==PAGE_GAME, &button, ui_draw_menu_tab_button, 0)) - new_page = PAGE_GAME; - - ui_vsplit_l(&box, 4.0f, 0, &box); - ui_vsplit_l(&box, 140.0f, &button, &box); - static int server_info_button=0; - if (ui_do_button(&server_info_button, "Server Info", active_page==PAGE_SERVER_INFO, &button, ui_draw_menu_tab_button, 0)) - new_page = PAGE_SERVER_INFO; - - ui_vsplit_l(&box, 4.0f, 0, &box); - ui_vsplit_l(&box, 140.0f, &button, &box); - static int callvote_button=0; - if (ui_do_button(&callvote_button, "Call Vote", active_page==PAGE_CALLVOTE, &button, ui_draw_menu_tab_button, 0)) - new_page = PAGE_CALLVOTE; - - ui_vsplit_l(&box, 30.0f, 0, &box); - } - - /* - ui_vsplit_r(&box, 110.0f, &box, &button); - static int system_button=0; - if (ui_do_button(&system_button, "System", config.ui_page==PAGE_SYSTEM, &button, ui_draw_menu_tab_button, 0)) - config.ui_page = PAGE_SYSTEM; - - ui_vsplit_r(&box, 30.0f, &box, 0); - */ - - ui_vsplit_r(&box, 90.0f, &box, &button); - static int quit_button=0; - if (ui_do_button(&quit_button, "Quit", 0, &button, ui_draw_menu_tab_button, 0)) - popup = POPUP_QUIT; - - ui_vsplit_r(&box, 10.0f, &box, &button); - ui_vsplit_r(&box, 120.0f, &box, &button); - static int settings_button=0; - if (ui_do_button(&settings_button, "Settings", active_page==PAGE_SETTINGS, &button, ui_draw_menu_tab_button, 0)) - new_page = PAGE_SETTINGS; - - if(new_page != -1) - { - if(client_state() == CLIENTSTATE_OFFLINE) - config.ui_page = new_page; - else - game_page = new_page; - } - - return 0; -} - -void MENUS::render_loading(float percent) -{ - // need up date this here to get correct - vec3 rgb = hsl_to_rgb(vec3(config.ui_color_hue/255.0f, config.ui_color_sat/255.0f, config.ui_color_lht/255.0f)); - gui_color = vec4(rgb.r, rgb.g, rgb.b, config.ui_color_alpha/255.0f); - - RECT screen = *ui_screen(); - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - - render_background(); - - float tw; - - float w = 700; - float h = 200; - float x = screen.w/2-w/2; - float y = screen.h/2-h/2; - - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.50f); - draw_round_rect(x, y, w, h, 40.0f); - gfx_quads_end(); - - - const char *caption = "Loading"; - - tw = gfx_text_width(0, 48.0f, caption, -1); - RECT r; - r.x = x; - r.y = y+20; - r.w = w; - r.h = h; - ui_do_label(&r, caption, 48.0f, 0, -1); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(1,1,1,0.75f); - draw_round_rect(x+40, y+h-75, (w-80)*percent, 25, 5.0f); - gfx_quads_end(); - - gfx_swap(); -} - -void MENUS::render_news(RECT main_view) -{ - ui_draw_rect(&main_view, color_tabbar_active, CORNER_ALL, 10.0f); -} - -void MENUS::init() -{ - if(config.cl_show_welcome) - popup = POPUP_FIRST_LAUNCH; - config.cl_show_welcome = 0; -} - -int MENUS::render() -{ - RECT screen = *ui_screen(); - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - - static bool first = true; - if(first) - { - if(config.ui_page == PAGE_INTERNET) - client_serverbrowse_refresh(0); - else if(config.ui_page == PAGE_LAN) - client_serverbrowse_refresh(1); - first = false; - } - - if(client_state() == CLIENTSTATE_ONLINE) - { - color_tabbar_inactive = color_tabbar_inactive_ingame; - color_tabbar_active = color_tabbar_active_ingame; - } - else - { - render_background(); - color_tabbar_inactive = color_tabbar_inactive_outgame; - color_tabbar_active = color_tabbar_active_outgame; - } - - RECT tab_bar; - RECT main_view; - - // some margin around the screen - ui_margin(&screen, 10.0f, &screen); - - if(popup == POPUP_NONE) - { - // do tab bar - ui_hsplit_t(&screen, 24.0f, &tab_bar, &main_view); - ui_vmargin(&tab_bar, 20.0f, &tab_bar); - render_menubar(tab_bar); - - // news is not implemented yet - if(config.ui_page <= PAGE_NEWS || config.ui_page > PAGE_SETTINGS || (client_state() == CLIENTSTATE_OFFLINE && config.ui_page >= PAGE_GAME && config.ui_page <= PAGE_CALLVOTE)) - { - client_serverbrowse_refresh(BROWSETYPE_INTERNET); - config.ui_page = PAGE_INTERNET; - } - - // render current page - if(client_state() != CLIENTSTATE_OFFLINE) - { - if(game_page == PAGE_GAME) - render_game(main_view); - else if(game_page == PAGE_SERVER_INFO) - render_serverinfo(main_view); - else if(game_page == PAGE_CALLVOTE) - render_servercontrol(main_view); - else if(game_page == PAGE_SETTINGS) - render_settings(main_view); - } - else if(config.ui_page == PAGE_NEWS) - render_news(main_view); - else if(config.ui_page == PAGE_INTERNET) - render_serverbrowser(main_view); - else if(config.ui_page == PAGE_LAN) - render_serverbrowser(main_view); - else if(config.ui_page == PAGE_DEMOS) - render_demolist(main_view); - else if(config.ui_page == PAGE_FAVORITES) - render_serverbrowser(main_view); - else if(config.ui_page == PAGE_SETTINGS) - render_settings(main_view); - } - else - { - // make sure that other windows doesn't do anything funnay! - //ui_set_hot_item(0); - //ui_set_active_item(0); - char buf[128]; - const char *title = ""; - const char *extra_text = ""; - const char *button_text = ""; - int extra_align = 0; - - if(popup == POPUP_CONNECTING) - { - title = "Connecting to"; - extra_text = config.ui_server_address; // TODO: query the client about the address - button_text = "Abort"; - if(client_mapdownload_totalsize() > 0) - { - title = "Downloading map"; - str_format(buf, sizeof(buf), "%d/%d KiB", client_mapdownload_amount()/1024, client_mapdownload_totalsize()/1024); - extra_text = buf; - } - } - else if(popup == POPUP_DISCONNECTED) - { - title = "Disconnected"; - extra_text = client_error_string(); - button_text = "Ok"; - extra_align = -1; - } - else if(popup == POPUP_PURE) - { - title = "Disconnected"; - extra_text = "The server is running a non-standard tuning on a pure game mode."; - button_text = "Ok"; - extra_align = -1; - } - else if(popup == POPUP_PASSWORD) - { - title = "Password Error"; - extra_text = client_error_string(); - button_text = "Try Again"; - } - else if(popup == POPUP_QUIT) - { - title = "Quit"; - extra_text = "Are you sure that you want to quit?"; - } - else if(popup == POPUP_FIRST_LAUNCH) - { - title = "Welcome to Teeworlds"; - extra_text = - "As this is the first time you launch the game, please enter your nick name below. " - "It's recommended that you check the settings to adjust them to your liking " - "before joining a server."; - button_text = "Ok"; - extra_align = -1; - } - - RECT box, part; - box = screen; - ui_vmargin(&box, 150.0f, &box); - ui_hmargin(&box, 150.0f, &box); - - // render the box - ui_draw_rect(&box, vec4(0,0,0,0.5f), CORNER_ALL, 15.0f); - - ui_hsplit_t(&box, 20.f, &part, &box); - ui_hsplit_t(&box, 24.f, &part, &box); - ui_do_label(&part, title, 24.f, 0); - ui_hsplit_t(&box, 20.f, &part, &box); - ui_hsplit_t(&box, 24.f, &part, &box); - ui_vmargin(&part, 20.f, &part); - - if(extra_align == -1) - ui_do_label(&part, extra_text, 20.f, -1, (int)part.w); - else - ui_do_label(&part, extra_text, 20.f, 0, -1); - - if(popup == POPUP_QUIT) - { - RECT yes, no; - ui_hsplit_b(&box, 20.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - ui_vmargin(&part, 80.0f, &part); - - ui_vsplit_mid(&part, &no, &yes); - - ui_vmargin(&yes, 20.0f, &yes); - ui_vmargin(&no, 20.0f, &no); - - static int button_abort = 0; - if(ui_do_button(&button_abort, "No", 0, &no, ui_draw_menu_button, 0) || escape_pressed) - popup = POPUP_NONE; - - static int button_tryagain = 0; - if(ui_do_button(&button_tryagain, "Yes", 0, &yes, ui_draw_menu_button, 0) || enter_pressed) - client_quit(); - } - else if(popup == POPUP_PASSWORD) - { - RECT label, textbox, tryagain, abort; - - ui_hsplit_b(&box, 20.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - ui_vmargin(&part, 80.0f, &part); - - ui_vsplit_mid(&part, &abort, &tryagain); - - ui_vmargin(&tryagain, 20.0f, &tryagain); - ui_vmargin(&abort, 20.0f, &abort); - - static int button_abort = 0; - if(ui_do_button(&button_abort, "Abort", 0, &abort, ui_draw_menu_button, 0) || escape_pressed) - popup = POPUP_NONE; - - static int button_tryagain = 0; - if(ui_do_button(&button_tryagain, "Try again", 0, &tryagain, ui_draw_menu_button, 0) || enter_pressed) - { - client_connect(config.ui_server_address); - } - - ui_hsplit_b(&box, 60.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - - ui_vsplit_l(&part, 60.0f, 0, &label); - ui_vsplit_l(&label, 100.0f, 0, &textbox); - ui_vsplit_l(&textbox, 20.0f, 0, &textbox); - ui_vsplit_r(&textbox, 60.0f, &textbox, 0); - ui_do_label(&label, "Password:", 20, -1); - ui_do_edit_box(&config.password, &textbox, config.password, sizeof(config.password), 14.0f, true); - } - else if(popup == POPUP_FIRST_LAUNCH) - { - RECT label, textbox; - - ui_hsplit_b(&box, 20.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - ui_vmargin(&part, 80.0f, &part); - - static int enter_button = 0; - if(ui_do_button(&enter_button, "Enter", 0, &part, ui_draw_menu_button, 0) || enter_pressed) - popup = POPUP_NONE; - - ui_hsplit_b(&box, 40.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - - ui_vsplit_l(&part, 60.0f, 0, &label); - ui_vsplit_l(&label, 100.0f, 0, &textbox); - ui_vsplit_l(&textbox, 20.0f, 0, &textbox); - ui_vsplit_r(&textbox, 60.0f, &textbox, 0); - ui_do_label(&label, "Nickname:", 20, -1); - ui_do_edit_box(&config.player_name, &textbox, config.player_name, sizeof(config.player_name), 14.0f); - } - else - { - ui_hsplit_b(&box, 20.f, &box, &part); - ui_hsplit_b(&box, 24.f, &box, &part); - ui_vmargin(&part, 120.0f, &part); - - static int button = 0; - if(ui_do_button(&button, button_text, 0, &part, ui_draw_menu_button, 0) || escape_pressed || enter_pressed) - { - if(popup == POPUP_CONNECTING) - client_disconnect(); - popup = POPUP_NONE; - } - } - } - - return 0; -} - - -void MENUS::set_active(bool active) -{ - menu_active = active; - if(!menu_active && need_sendinfo) - { - gameclient.send_info(false); - need_sendinfo = false; - } -} - -void MENUS::on_reset() -{ -} - -bool MENUS::on_mousemove(float x, float y) -{ - last_input = time_get(); - - if(!menu_active) - return false; - - mouse_pos.x += x; - mouse_pos.y += y; - -#ifdef ANDROID - mouse_pos.x = x; - mouse_pos.y = y; -#endif - - if(mouse_pos.x < 0) mouse_pos.x = 0; - if(mouse_pos.y < 0) mouse_pos.y = 0; - if(mouse_pos.x > gfx_screenwidth()) mouse_pos.x = gfx_screenwidth(); - if(mouse_pos.y > gfx_screenheight()) mouse_pos.y = gfx_screenheight(); - - return true; -} - -bool MENUS::on_input(INPUT_EVENT e) -{ - last_input = time_get(); - - // special handle esc and enter for popup purposes - if(e.flags&INPFLAG_PRESS) - { - if(e.key == KEY_ESCAPE) - { - escape_pressed = true; - set_active(!is_active()); - return true; - } - } - - if(is_active()) - { - // special for popups - if(e.flags&INPFLAG_PRESS && e.key == KEY_RETURN) - enter_pressed = true; - - if(num_inputevents < MAX_INPUTEVENTS) - inputevents[num_inputevents++] = e; - return true; - } - return false; -} - -void MENUS::on_statechange(int new_state, int old_state) -{ - if(new_state == CLIENTSTATE_OFFLINE) - { - popup = POPUP_NONE; - if(client_error_string() && client_error_string()[0] != 0) - { - if(strstr(client_error_string(), "password")) - { - popup = POPUP_PASSWORD; - ui_set_hot_item(&config.password); - ui_set_active_item(&config.password); - } - else - popup = POPUP_DISCONNECTED; - } } - else if(new_state == CLIENTSTATE_LOADING) - { - popup = POPUP_CONNECTING; - client_serverinfo_request(); - } - else if(new_state == CLIENTSTATE_CONNECTING) - popup = POPUP_CONNECTING; - else if (new_state == CLIENTSTATE_ONLINE || new_state == CLIENTSTATE_DEMOPLAYBACK) - { - popup = POPUP_NONE; - set_active(false); - } -} - -void MENUS::on_render() -{ - if(client_state() != CLIENTSTATE_ONLINE && client_state() != CLIENTSTATE_DEMOPLAYBACK) - set_active(true); - - if(client_state() == CLIENTSTATE_DEMOPLAYBACK) - { - RECT screen = *ui_screen(); - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - render_demoplayer(screen); - } - - if(client_state() == CLIENTSTATE_ONLINE && gameclient.servermode == gameclient.SERVERMODE_PUREMOD) - { - client_disconnect(); - set_active(true); - popup = POPUP_PURE; - } - - if(!is_active()) - { - escape_pressed = false; - enter_pressed = false; - num_inputevents = 0; - return; - } - - // update colors - vec3 rgb = hsl_to_rgb(vec3(config.ui_color_hue/255.0f, config.ui_color_sat/255.0f, config.ui_color_lht/255.0f)); - gui_color = vec4(rgb.r, rgb.g, rgb.b, config.ui_color_alpha/255.0f); - - color_tabbar_inactive_outgame = vec4(0,0,0,0.25f); - color_tabbar_active_outgame = vec4(0,0,0,0.5f); - - float color_ingame_scale_i = 0.5f; - float color_ingame_scale_a = 0.2f; - color_tabbar_inactive_ingame = vec4( - gui_color.r*color_ingame_scale_i, - gui_color.g*color_ingame_scale_i, - gui_color.b*color_ingame_scale_i, - gui_color.a*0.8f); - - color_tabbar_active_ingame = vec4( - gui_color.r*color_ingame_scale_a, - gui_color.g*color_ingame_scale_a, - gui_color.b*color_ingame_scale_a, - gui_color.a); - - // update the ui - RECT *screen = ui_screen(); - float mx = (mouse_pos.x/(float)gfx_screenwidth())*screen->w; - float my = (mouse_pos.y/(float)gfx_screenheight())*screen->h; - - int buttons = 0; - if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1; - if(inp_key_pressed(KEY_MOUSE_2)) buttons |= 2; - if(inp_key_pressed(KEY_MOUSE_3)) buttons |= 4; - - ui_update(mx,my,mx*3.0f,my*3.0f,buttons); - - // render - if(client_state() != CLIENTSTATE_DEMOPLAYBACK) - render(); - - // render cursor - gfx_texture_set(data->images[IMAGE_CURSOR].id); - gfx_quads_begin(); - gfx_setcolor(1,1,1,1); - gfx_quads_drawTL(mx,my,24,24); - gfx_quads_end(); - - // render debug information - if(config.debug) - { - RECT screen = *ui_screen(); - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h); - - char buf[512]; - str_format(buf, sizeof(buf), "%p %p %p", ui_hot_item(), ui_active_item(), ui_last_active_item()); - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, 10, 10, 10, TEXTFLAG_RENDER); - gfx_text_ex(&cursor, buf, -1); - } - - escape_pressed = false; - enter_pressed = false; - num_inputevents = 0; -} - -static int texture_blob = -1; - -void MENUS::render_background() -{ - //gfx_clear(1,1,1); - //render_sunrays(0,0); - if(texture_blob == -1) - texture_blob = gfx_load_texture("blob.png", IMG_AUTO, 0); - - - float sw = 300*gfx_screenaspect(); - float sh = 300; - gfx_mapscreen(0, 0, sw, sh); - - RECT s = *ui_screen(); - - // render background color - gfx_texture_set(-1); - gfx_quads_begin(); - //vec4 bottom(gui_color.r*0.3f, gui_color.g*0.3f, gui_color.b*0.3f, 1.0f); - //vec4 bottom(0, 0, 0, 1.0f); - vec4 bottom(gui_color.r, gui_color.g, gui_color.b, 1.0f); - vec4 top(gui_color.r, gui_color.g, gui_color.b, 1.0f); - gfx_setcolorvertex(0, top.r, top.g, top.b, top.a); - gfx_setcolorvertex(1, top.r, top.g, top.b, top.a); - gfx_setcolorvertex(2, bottom.r, bottom.g, bottom.b, bottom.a); - gfx_setcolorvertex(3, bottom.r, bottom.g, bottom.b, bottom.a); - gfx_quads_drawTL(0, 0, sw, sh); - gfx_quads_end(); - - // render the tiles - gfx_texture_set(-1); - gfx_quads_begin(); - float size = 15.0f; - float offset_time = fmod(client_localtime()*0.15f, 2.0f); - for(int y = -2; y < (int)(sw/size); y++) - for(int x = -2; x < (int)(sh/size); x++) - { - gfx_setcolor(0,0,0,0.045f); - gfx_quads_drawTL((x-offset_time)*size*2+(y&1)*size, (y+offset_time)*size, size, size); - } - gfx_quads_end(); - - // render border fade - gfx_texture_set(texture_blob); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - gfx_quads_drawTL(-100, -100, sw+200, sh+200); - gfx_quads_end(); - - // restore screen - {RECT screen = *ui_screen(); - gfx_mapscreen(screen.x, screen.y, screen.w, screen.h);} -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.hpp deleted file mode 100644 index 8a50c1227..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus.hpp +++ /dev/null @@ -1,183 +0,0 @@ -#include - -#include -#include - - -// compnent to fetch keypresses, override all other input -class MENUS_KEYBINDER : public COMPONENT -{ -public: - bool take_key; - bool got_key; - INPUT_EVENT key; - MENUS_KEYBINDER(); - virtual bool on_input(INPUT_EVENT e); -}; - -class MENUS : public COMPONENT -{ - static vec4 gui_color; - static vec4 color_tabbar_inactive_outgame; - static vec4 color_tabbar_active_outgame; - static vec4 color_tabbar_inactive_ingame; - static vec4 color_tabbar_active_ingame; - static vec4 color_tabbar_inactive; - static vec4 color_tabbar_active; - - static vec4 button_color_mul(const void *id); - - - static void ui_draw_demoplayer_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); - - static void ui_draw_browse_icon(int what, const RECT *r); - static void ui_draw_menu_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_keyselect_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_menu_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_grid_header(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_list_row(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_checkbox_common(const void *id, const char *text, const char *boxtext, const RECT *r); - static void ui_draw_checkbox(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static void ui_draw_checkbox_number(const void *id, const char *text, int checked, const RECT *r, const void *extra); - static int ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float font_size, bool hidden=false); - - static float ui_do_scrollbar_v(const void *id, const RECT *rect, float current); - static float ui_do_scrollbar_h(const void *id, const RECT *rect, float current); - - static int ui_do_key_reader(void *id, const RECT *rect, int key); - static void ui_do_getbuttons(int start, int stop, RECT view); - - struct LISTBOXITEM - { - int visible; - int selected; - RECT rect; - }; - - static void ui_do_listbox_start(void *id, const RECT *rect, float row_height, const char *title, int num_items, int selected_index); - static LISTBOXITEM ui_do_listbox_nextitem(void *id); - static int ui_do_listbox_end(); - - //static void demolist_listdir_callback(const char *name, int is_dir, void *user); - //static void demolist_list_callback(const RECT *rect, int index, void *user); - - enum - { - POPUP_NONE=0, - POPUP_FIRST_LAUNCH, - POPUP_CONNECTING, - POPUP_DISCONNECTED, - POPUP_PURE, - POPUP_PASSWORD, - POPUP_QUIT, - }; - - enum - { - PAGE_NEWS=1, - PAGE_GAME, - PAGE_SERVER_INFO, - PAGE_CALLVOTE, - PAGE_INTERNET, - PAGE_LAN, - PAGE_FAVORITES, - PAGE_DEMOS, - PAGE_SETTINGS, - PAGE_SYSTEM, - }; - - int game_page; - int popup; - int active_page; - bool menu_active; - vec2 mouse_pos; - - int64 last_input; - - // TODO: this is a bit ugly but.. well.. yeah - enum { MAX_INPUTEVENTS = 32 }; - static INPUT_EVENT inputevents[MAX_INPUTEVENTS]; - static int num_inputevents; - - // some settings - static float button_height; - static float listheader_height; - static float fontmod_height; - - // for graphic settings - bool need_restart; - bool need_sendinfo; - - // - bool escape_pressed; - bool enter_pressed; - - // for call vote - int callvote_selectedoption; - int callvote_selectedplayer; - - // demo - struct DEMOITEM - { - char filename[512]; - char name[256]; - }; - - DEMOITEM *demos; - int num_demos; - - void demolist_populate(); - static void demolist_count_callback(const char *name, int is_dir, void *user); - static void demolist_fetch_callback(const char *name, int is_dir, void *user); - - // found in menus.cpp - int render(); - void render_background(); - //void render_loading(float percent); - int render_menubar(RECT r); - void render_news(RECT main_view); - - // found in menus_demo.cpp - void render_demoplayer(RECT main_view); - void render_demolist(RECT main_view); - - // found in menus_ingame.cpp - void render_game(RECT main_view); - void render_serverinfo(RECT main_view); - void render_servercontrol(RECT main_view); - void render_servercontrol_kick(RECT main_view); - void render_servercontrol_server(RECT main_view); - - // found in menus_browser.cpp - int selected_index; - void render_serverbrowser_serverlist(RECT view); - void render_serverbrowser_serverdetail(RECT view); - void render_serverbrowser_filters(RECT view); - void render_serverbrowser(RECT main_view); - - // found in menus_settings.cpp - void render_settings_player(RECT main_view); - void render_settings_controls(RECT main_view); - void render_settings_graphics(RECT main_view); - void render_settings_sound(RECT main_view); - void render_settings(RECT main_view); - - void set_active(bool active); -public: - static MENUS_KEYBINDER binder; - - MENUS(); - - void render_loading(float percent); - - bool is_active() const { return menu_active; } - - void init(); - - virtual void on_statechange(int new_state, int old_state); - virtual void on_reset(); - virtual void on_render(); - virtual bool on_input(INPUT_EVENT e); - virtual bool on_mousemove(float x, float y); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_browser.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_browser.cpp deleted file mode 100644 index 1c1837e4b..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_browser.cpp +++ /dev/null @@ -1,669 +0,0 @@ - -#include // strcmp, strlen, strncpy -#include // atoi - -#include - -extern "C" { - #include -} - -#include -#include - -#include -#include -#include "menus.hpp" -#include - -void MENUS::render_serverbrowser_serverlist(RECT view) -{ - RECT headers; - RECT status; - - ui_hsplit_t(&view, listheader_height, &headers, &view); - ui_hsplit_b(&view, 28.0f, &view, &status); - - // split of the scrollbar - ui_draw_rect(&headers, vec4(1,1,1,0.25f), CORNER_T, 5.0f); - ui_vsplit_r(&headers, 20.0f, &headers, 0); - - struct column - { - int id; - int sort; - const char *caption; - int direction; - float width; - int flags; - RECT rect; - RECT spacer; - }; - - enum - { - FIXED=1, - SPACER=2, - - COL_FLAG_LOCK=0, - COL_FLAG_PURE, - COL_FLAG_FAV, - COL_NAME, - COL_GAMETYPE, - COL_MAP, - COL_PLAYERS, - COL_PING, - COL_PROGRESS, - COL_VERSION, - }; - - static column cols[] = { - {-1, -1, " ", -1, 2.0f, 0, {0}, {0}}, - {COL_FLAG_LOCK, -1, " ", -1, 14.0f, 0, {0}, {0}}, - {COL_FLAG_PURE, -1, " ", -1, 14.0f, 0, {0}, {0}}, - {COL_FLAG_FAV, -1, " ", -1, 14.0f, 0, {0}, {0}}, - {COL_NAME, BROWSESORT_NAME, "Name", 0, 300.0f, 0, {0}, {0}}, - {COL_GAMETYPE, BROWSESORT_GAMETYPE, "Type", 1, 50.0f, 0, {0}, {0}}, - {COL_MAP, BROWSESORT_MAP, "Map", 1, 100.0f, 0, {0}, {0}}, - {COL_PLAYERS, BROWSESORT_NUMPLAYERS, "Players", 1, 60.0f, 0, {0}, {0}}, - {-1, -1, " ", 1, 10.0f, 0, {0}, {0}}, - {COL_PING, BROWSESORT_PING, "Ping", 1, 40.0f, FIXED, {0}, {0}}, - }; - - int num_cols = sizeof(cols)/sizeof(column); - - // do layout - for(int i = 0; i < num_cols; i++) - { - if(cols[i].direction == -1) - { - ui_vsplit_l(&headers, cols[i].width, &cols[i].rect, &headers); - - if(i+1 < num_cols) - { - //cols[i].flags |= SPACER; - ui_vsplit_l(&headers, 2, &cols[i].spacer, &headers); - } - } - } - - for(int i = num_cols-1; i >= 0; i--) - { - if(cols[i].direction == 1) - { - ui_vsplit_r(&headers, cols[i].width, &headers, &cols[i].rect); - ui_vsplit_r(&headers, 2, &headers, &cols[i].spacer); - } - } - - for(int i = 0; i < num_cols; i++) - { - if(cols[i].direction == 0) - cols[i].rect = headers; - } - - // do headers - for(int i = 0; i < num_cols; i++) - { - if(ui_do_button(cols[i].caption, cols[i].caption, config.b_sort == cols[i].sort, &cols[i].rect, ui_draw_grid_header, 0)) - { - if(cols[i].sort != -1) - { - if(config.b_sort == cols[i].sort) - config.b_sort_order ^= 1; - else - config.b_sort_order = 0; - config.b_sort = cols[i].sort; - } - } - } - - ui_draw_rect(&view, vec4(0,0,0,0.15f), 0, 0); - - RECT scroll; - ui_vsplit_r(&view, 15, &view, &scroll); - - int num_servers = client_serverbrowse_sorted_num(); - - // display important messages in the middle of the screen so no - // users misses it - { - RECT msgbox = view; - msgbox.y += view.h/3; - - if(active_page == PAGE_INTERNET && client_serverbrowse_refreshingmasters()) - ui_do_label(&msgbox, "Refreshing master servers", 16.0f, 0); - else if(!client_serverbrowse_num()) - ui_do_label(&msgbox, "No servers found", 16.0f, 0); - else if(client_serverbrowse_num() && !num_servers) - ui_do_label(&msgbox, "No servers match your filter criteria", 16.0f, 0); - } - - int num = (int)(view.h/cols[0].rect.h); - static int scrollbar = 0; - static float scrollvalue = 0; - //static int selected_index = -1; - ui_hmargin(&scroll, 5.0f, &scroll); - scrollvalue = ui_do_scrollbar_v(&scrollbar, &scroll, scrollvalue); - - int scrollnum = num_servers-num+10; - if(scrollnum > 0) - { - if(inp_key_presses(KEY_MOUSE_WHEEL_UP)) - scrollvalue -= 1.0f/scrollnum; - if(inp_key_presses(KEY_MOUSE_WHEEL_DOWN)) - scrollvalue += 1.0f/scrollnum; - - if(scrollvalue < 0) scrollvalue = 0; - if(scrollvalue > 1) scrollvalue = 1; - } - else - scrollnum = 0; - - // set clipping - ui_clip_enable(&view); - - int start = (int)(scrollnum*scrollvalue); - if(start < 0) - start = 0; - - RECT original_view = view; - view.y -= scrollvalue*scrollnum*cols[0].rect.h; - - int new_selected = -1; - int num_players = 0; - - selected_index = -1; - - for (int i = 0; i < num_servers; i++) - { - SERVER_INFO *item = client_serverbrowse_sorted_get(i); - num_players += item->num_players; - } - - for (int i = 0; i < num_servers; i++) - { - int item_index = i; - SERVER_INFO *item = client_serverbrowse_sorted_get(item_index); - RECT row; - RECT select_hit_box; - - int selected = strcmp(item->address, config.ui_server_address) == 0; //selected_index==item_index; - - ui_hsplit_t(&view, 17.0f, &row, &view); - select_hit_box = row; - - if(selected) - { - selected_index = i; - RECT r = row; - ui_margin(&r, 1.5f, &r); - ui_draw_rect(&r, vec4(1,1,1,0.5f), CORNER_ALL, 4.0f); - } - - - // make sure that only those in view can be selected - if(row.y+row.h > original_view.y) - { - if(select_hit_box.y < original_view.y) // clip the selection - { - select_hit_box.h -= original_view.y-select_hit_box.y; - select_hit_box.y = original_view.y; - } - - if(ui_do_button(item, "", selected, &select_hit_box, 0, 0)) - { - new_selected = item_index; - } - } - - // check if we need to do more - if(row.y > original_view.y+original_view.h && !ui_active_item()) - break; - - for(int c = 0; c < num_cols; c++) - { - RECT button; - char temp[64]; - button.x = cols[c].rect.x; - button.y = row.y; - button.h = row.h; - button.w = cols[c].rect.w; - - //int s = 0; - int id = cols[c].id; - - //s = ui_do_button(item, "L", l, &button, ui_draw_browse_icon, 0); - - if(id == COL_FLAG_LOCK) - { - if(item->flags & SRVFLAG_PASSWORD) - ui_draw_browse_icon(SPRITE_BROWSE_LOCK, &button); - } - else if(id == COL_FLAG_PURE) - { - if(strcmp(item->gametype, "DM") == 0 || strcmp(item->gametype, "TDM") == 0 || strcmp(item->gametype, "CTF") == 0) - { - // pure server - } - else - { - // unpure - ui_draw_browse_icon(SPRITE_BROWSE_UNPURE, &button); - } - } - else if(id == COL_FLAG_FAV) - { - if(item->favorite) - ui_draw_browse_icon(SPRITE_BROWSE_HEART, &button); - } - else if(id == COL_NAME) - { - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, button.x, button.y, 12.0f*ui_scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); - cursor.line_width = button.w; - - if(config.b_filter_string[0] && (item->quicksearch_hit&BROWSEQUICK_SERVERNAME)) - { - // highlight the parts that matches - const char *s = str_find_nocase(item->name, config.b_filter_string); - if(s) - { - gfx_text_ex(&cursor, item->name, (int)(s-item->name)); - gfx_text_color(0.4f,0.4f,1.0f,1); - gfx_text_ex(&cursor, s, strlen(config.b_filter_string)); - gfx_text_color(1,1,1,1); - gfx_text_ex(&cursor, s+strlen(config.b_filter_string), -1); - } - else - gfx_text_ex(&cursor, item->name, -1); - } - else - gfx_text_ex(&cursor, item->name, -1); - } - else if(id == COL_MAP) - ui_do_label(&button, item->map, 12.0f, -1); - else if(id == COL_PLAYERS) - { - str_format(temp, sizeof(temp), "%i/%i", item->num_players, item->max_players); - if(config.b_filter_string[0] && (item->quicksearch_hit&BROWSEQUICK_PLAYERNAME)) - gfx_text_color(0.4f,0.4f,1.0f,1); - ui_do_label(&button, temp, 12.0f, 1); - gfx_text_color(1,1,1,1); - } - else if(id == COL_PING) - { - str_format(temp, sizeof(temp), "%i", item->latency); - ui_do_label(&button, temp, 12.0f, 1); - } - else if(id == COL_PROGRESS) - { - if(item->progression > 100) - item->progression = 100; - ui_draw_browse_icon(item->progression, &button); - } - else if(id == COL_VERSION) - { - const char *version = item->version; - if(strcmp(version, "0.3 e2d7973c6647a13c") == 0) // TODO: remove me later on - version = "0.3.0"; - ui_do_label(&button, version, 12.0f, 1); - } - else if(id == COL_GAMETYPE) - { - ui_do_label(&button, item->gametype, 12.0f, 0); - } - - } - } - - ui_clip_disable(); - - if(new_selected != -1) - { - // select the new server - SERVER_INFO *item = client_serverbrowse_sorted_get(new_selected); - strncpy(config.ui_server_address, item->address, sizeof(config.ui_server_address)); - if(inp_mouse_doubleclick()) - client_connect(config.ui_server_address); - } - - ui_draw_rect(&status, vec4(1,1,1,0.25f), CORNER_B, 5.0f); - ui_margin(&status, 5.0f, &status); - - // render quick search - RECT quicksearch, button; - ui_vsplit_l(&status, 250.0f, &quicksearch, &status); - ui_do_label(&quicksearch, "Quick search: ", 14.0f, -1); - ui_vsplit_l(&quicksearch, gfx_text_width(0, 14.0f, "Quick search: ", -1), 0, &quicksearch); - ui_do_edit_box(&config.b_filter_string, &quicksearch, config.b_filter_string, sizeof(config.b_filter_string), 14.0f); - ui_vsplit_l(&quicksearch, 135.0f, &quicksearch, &button); - ui_vmargin(&button, 0.0f, &button); - static int clear_button = 0; - if(ui_do_button(&clear_button, "x", 0, &button, ui_draw_menu_button, 0)) - config.b_filter_string[0] = 0; - - // render status - char buf[128]; - str_format(buf, sizeof(buf), "%d of %d servers, %d players", client_serverbrowse_sorted_num(), client_serverbrowse_num(), num_players); - ui_vsplit_r(&status, gfx_text_width(0, 14.0f, buf, -1), 0, &status); - ui_do_label(&status, buf, 14.0f, -1); -} - -void MENUS::render_serverbrowser_filters(RECT view) -{ - // filters - RECT button; - - ui_hsplit_t(&view, 5.0f, 0, &view); - ui_vsplit_l(&view, 5.0f, 0, &view); - ui_vsplit_r(&view, 5.0f, &view, 0); - ui_hsplit_b(&view, 5.0f, &view, 0); - - // render filters - ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button(&config.b_filter_empty, "Has people playing", config.b_filter_empty, &button, ui_draw_checkbox, 0)) - config.b_filter_empty ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button(&config.b_filter_full, "Server not full", config.b_filter_full, &button, ui_draw_checkbox, 0)) - config.b_filter_full ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button(&config.b_filter_pw, "No password", config.b_filter_pw, &button, ui_draw_checkbox, 0)) - config.b_filter_pw ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button((char *)&config.b_filter_compatversion, "Compatible Version", config.b_filter_compatversion, &button, ui_draw_checkbox, 0)) - config.b_filter_compatversion ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button((char *)&config.b_filter_pure, "Standard gametype", config.b_filter_pure, &button, ui_draw_checkbox, 0)) - config.b_filter_pure ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - /*ui_vsplit_l(&button, 20.0f, 0, &button);*/ - if (ui_do_button((char *)&config.b_filter_pure_map, "Standard map", config.b_filter_pure_map, &button, ui_draw_checkbox, 0)) - config.b_filter_pure_map ^= 1; - - ui_hsplit_t(&view, 20.0f, &button, &view); - ui_do_label(&button, "Game types: ", 14.0f, -1); - ui_vsplit_l(&button, 95.0f, 0, &button); - ui_margin(&button, 1.0f, &button); - ui_do_edit_box(&config.b_filter_gametype, &button, config.b_filter_gametype, sizeof(config.b_filter_gametype), 14.0f); - - { - ui_hsplit_t(&view, 20.0f, &button, &view); - RECT editbox; - ui_vsplit_l(&button, 40.0f, &editbox, &button); - ui_vsplit_l(&button, 5.0f, &button, &button); - - char buf[8]; - str_format(buf, sizeof(buf), "%d", config.b_filter_ping); - ui_do_edit_box(&config.b_filter_ping, &editbox, buf, sizeof(buf), 14.0f); - config.b_filter_ping = atoi(buf); - - ui_do_label(&button, "Maximum ping", 14.0f, -1); - } - - ui_hsplit_b(&view, button_height, &view, &button); - static int clear_button = 0; - if(ui_do_button(&clear_button, "Reset Filter", 0, &button, ui_draw_menu_button, 0)) - { - config.b_filter_full = 0; - config.b_filter_empty = 0; - config.b_filter_pw = 0; - config.b_filter_ping = 999; - config.b_filter_gametype[0] = 0; - config.b_filter_compatversion = 1; - config.b_filter_string[0] = 0; - config.b_filter_pure = 1; - } -} - -void MENUS::render_serverbrowser_serverdetail(RECT view) -{ - RECT server_details = view; - RECT server_scoreboard, server_header; - - SERVER_INFO *selected_server = client_serverbrowse_sorted_get(selected_index); - - //ui_vsplit_l(&server_details, 10.0f, 0x0, &server_details); - - // split off a piece to use for scoreboard - ui_hsplit_t(&server_details, 140.0f, &server_details, &server_scoreboard); - ui_hsplit_b(&server_details, 10.0f, &server_details, 0x0); - - // server details - const float font_size = 12.0f; - ui_hsplit_t(&server_details, 20.0f, &server_header, &server_details); - ui_draw_rect(&server_header, vec4(1,1,1,0.25f), CORNER_T, 4.0f); - ui_draw_rect(&server_details, vec4(0,0,0,0.15f), CORNER_B, 4.0f); - ui_vsplit_l(&server_header, 8.0f, 0x0, &server_header); - ui_do_label(&server_header, "Server Details: ", font_size+2.0f, -1); - - ui_vsplit_l(&server_details, 5.0f, 0x0, &server_details); - - ui_margin(&server_details, 3.0f, &server_details); - - if (selected_server) - { - RECT row; - static const char *labels[] = { "Version:", "Game Type:", "Progression:", "Ping:" }; - - RECT left_column; - RECT right_column; - - // - { - RECT button; - ui_hsplit_b(&server_details, 20.0f, &server_details, &button); - static int add_fav_button = 0; - if (ui_do_button(&add_fav_button, "Favorite", selected_server->favorite, &button, ui_draw_checkbox, 0)) - { - if(selected_server->favorite) - client_serverbrowse_removefavorite(selected_server->netaddr); - else - client_serverbrowse_addfavorite(selected_server->netaddr); - } - } - //ui_do_label(&row, temp, font_size, -1); - - ui_vsplit_l(&server_details, 5.0f, 0x0, &server_details); - ui_vsplit_l(&server_details, 80.0f, &left_column, &right_column); - - for (unsigned int i = 0; i < sizeof(labels) / sizeof(labels[0]); i++) - { - ui_hsplit_t(&left_column, 15.0f, &row, &left_column); - ui_do_label(&row, labels[i], font_size, -1); - } - - ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, selected_server->version, font_size, -1); - - ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, selected_server->gametype, font_size, -1); - - char temp[16]; - - if(selected_server->progression < 0) - str_format(temp, sizeof(temp), "N/A"); - else - str_format(temp, sizeof(temp), "%d%%", selected_server->progression); - ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, temp, font_size, -1); - - str_format(temp, sizeof(temp), "%d", selected_server->latency); - ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, temp, font_size, -1); - - } - - // server scoreboard - - ui_hsplit_b(&server_scoreboard, 10.0f, &server_scoreboard, 0x0); - ui_hsplit_t(&server_scoreboard, 20.0f, &server_header, &server_scoreboard); - ui_draw_rect(&server_header, vec4(1,1,1,0.25f), CORNER_T, 4.0f); - ui_draw_rect(&server_scoreboard, vec4(0,0,0,0.15f), CORNER_B, 4.0f); - ui_vsplit_l(&server_header, 8.0f, 0x0, &server_header); - ui_do_label(&server_header, "Scoreboard: ", font_size+2.0f, -1); - - ui_vsplit_l(&server_scoreboard, 5.0f, 0x0, &server_scoreboard); - - ui_margin(&server_scoreboard, 3.0f, &server_scoreboard); - - if (selected_server) - { - for (int i = 0; i < selected_server->num_players; i++) - { - RECT row; - char temp[16]; - ui_hsplit_t(&server_scoreboard, 16.0f, &row, &server_scoreboard); - - str_format(temp, sizeof(temp), "%d", selected_server->players[i].score); - ui_do_label(&row, temp, font_size, -1); - - ui_vsplit_l(&row, 25.0f, 0x0, &row); - - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, row.x, row.y, 12.0f, TEXTFLAG_RENDER); - - const char *name = selected_server->players[i].name; - if(config.b_filter_string[0]) - { - // highlight the parts that matches - const char *s = str_find_nocase(name, config.b_filter_string); - if(s) - { - gfx_text_ex(&cursor, name, (int)(s-name)); - gfx_text_color(0.4f,0.4f,1,1); - gfx_text_ex(&cursor, s, strlen(config.b_filter_string)); - gfx_text_color(1,1,1,1); - gfx_text_ex(&cursor, s+strlen(config.b_filter_string), -1); - } - else - gfx_text_ex(&cursor, name, -1); - } - else - gfx_text_ex(&cursor, name, -1); - - } - } -} - -void MENUS::render_serverbrowser(RECT main_view) -{ - ui_draw_rect(&main_view, color_tabbar_active, CORNER_ALL, 10.0f); - - RECT view; - ui_margin(&main_view, 10.0f, &view); - - /* - +-----------------+ +------+ - | | | | - | | | tool | - | | | box | - | | | | - | | +------+ - +-----------------+ button - status toolbar box - */ - - - //RECT filters; - RECT status_toolbar; - RECT toolbox; - RECT button_box; - - // split off a piece for filters, details and scoreboard - ui_vsplit_r(&view, 200.0f, &view, &toolbox); - ui_hsplit_b(&toolbox, 80.0f, &toolbox, &button_box); - ui_hsplit_b(&view, button_height+5.0f, &view, &status_toolbar); - - render_serverbrowser_serverlist(view); - - int toolbox_page = config.ui_toolbox_page; - - ui_vsplit_l(&toolbox, 5.0f, 0, &toolbox); - - // do tabbar - { - RECT tab_bar; - RECT tabbutton0, tabbutton1; - ui_hsplit_t(&toolbox, 22.0f, &tab_bar, &toolbox); - - ui_vsplit_mid(&tab_bar, &tabbutton0, &tabbutton1); - ui_vsplit_r(&tabbutton0, 5.0f, &tabbutton0, 0); - ui_vsplit_l(&tabbutton1, 5.0f, 0, &tabbutton1); - - static int filters_tab = 0; - if (ui_do_button(&filters_tab, "Filter", toolbox_page==0, &tabbutton0, ui_draw_menu_tab_button, 0)) - toolbox_page = 0; - - static int info_tab = 0; - if (ui_do_button(&info_tab, "Info", toolbox_page==1, &tabbutton1, ui_draw_menu_tab_button, 0)) - toolbox_page = 1; - } - - config.ui_toolbox_page = toolbox_page; - - ui_draw_rect(&toolbox, vec4(0,0,0,0.15f), 0, 0); - - ui_hsplit_t(&toolbox, 5.0f, 0, &toolbox); - - if(toolbox_page == 0) - render_serverbrowser_filters(toolbox); - else if(toolbox_page == 1) - render_serverbrowser_serverdetail(toolbox); - - { - ui_hsplit_t(&status_toolbar, 5.0f, 0, &status_toolbar); - - RECT button; - //ui_vsplit_r(&buttons, 20.0f, &buttons, &button); - ui_vsplit_r(&status_toolbar, 100.0f, &status_toolbar, &button); - ui_vmargin(&button, 2.0f, &button); - static int refresh_button = 0; - if(ui_do_button(&refresh_button, "Refresh", 0, &button, ui_draw_menu_button, 0)) - { - if(config.ui_page == PAGE_INTERNET) - client_serverbrowse_refresh(BROWSETYPE_INTERNET); - else if(config.ui_page == PAGE_LAN) - client_serverbrowse_refresh(BROWSETYPE_LAN); - else if(config.ui_page == PAGE_FAVORITES) - client_serverbrowse_refresh(BROWSETYPE_FAVORITES); - } - - char buf[512]; - if(strcmp(client_latestversion(), "0") != 0) - str_format(buf, sizeof(buf), "Teeworlds %s is out! Download it at www.teeworlds.com!\nCurrent version: %s", client_latestversion(), GAME_VERSION); - else - str_format(buf, sizeof(buf), "Current version: %s", GAME_VERSION); - ui_do_label(&status_toolbar, buf, 14.0f, -1); - } - - // do the button box - { - - ui_vsplit_l(&button_box, 5.0f, 0, &button_box); - ui_vsplit_r(&button_box, 5.0f, &button_box, 0); - - RECT button; - ui_hsplit_b(&button_box, button_height, &button_box, &button); - ui_vsplit_r(&button, 120.0f, 0, &button); - ui_vmargin(&button, 2.0f, &button); - //ui_vmargin(&button, 2.0f, &button); - static int join_button = 0; - if(ui_do_button(&join_button, "Connect", 0, &button, ui_draw_menu_button, 0) || enter_pressed) - { - client_connect(config.ui_server_address); - enter_pressed = false; - } - - ui_hsplit_b(&button_box, 5.0f, &button_box, &button); - ui_hsplit_b(&button_box, 20.0f, &button_box, &button); - ui_do_edit_box(&config.ui_server_address, &button, config.ui_server_address, sizeof(config.ui_server_address), 14.0f); - ui_hsplit_b(&button_box, 20.0f, &button_box, &button); - ui_do_label(&button, "Host address:", 14.0f, -1); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_demo.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_demo.cpp deleted file mode 100644 index 2966160f8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_demo.cpp +++ /dev/null @@ -1,408 +0,0 @@ - -#include - -//#include // strcmp, strlen, strncpy -//#include // atoi - -#include -#include -#include - -//#include -//#include - -#include -//#include -//#include - -#include "menus.hpp" - -void MENUS::ui_draw_demoplayer_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - ui_draw_rect(r, vec4(1,1,1, checked ? 0.10f : 0.5f)*button_color_mul(id), CORNER_ALL, 5.0f); - ui_do_label(r, text, 14.0f, 0); -} - -void MENUS::render_demoplayer(RECT main_view) -{ - const DEMOPLAYBACK_INFO *info = client_demoplayer_getinfo(); - - const float seekbar_height = 15.0f; - const float buttonbar_height = 20.0f; - const float margins = 5.0f; - float total_height; - - if(menu_active) - total_height = seekbar_height+buttonbar_height+margins*3; - else - total_height = seekbar_height+margins*2; - - ui_hsplit_b(&main_view, total_height, 0, &main_view); - ui_vsplit_l(&main_view, 250.0f, 0, &main_view); - ui_vsplit_r(&main_view, 250.0f, &main_view, 0); - - ui_draw_rect(&main_view, color_tabbar_active, CORNER_T, 10.0f); - - ui_margin(&main_view, 5.0f, &main_view); - - RECT seekbar, buttonbar; - - if(menu_active) - { - ui_hsplit_t(&main_view, seekbar_height, &seekbar, &buttonbar); - ui_hsplit_t(&buttonbar, margins, 0, &buttonbar); - } - else - seekbar = main_view; - - // do seekbar - { - static int seekbar_id = 0; - void *id = &seekbar_id; - char buffer[128]; - - ui_draw_rect(&seekbar, vec4(0,0,0,0.5f), CORNER_ALL, 5.0f); - - int current_tick = info->current_tick - info->first_tick; - int total_ticks = info->last_tick - info->first_tick; - - float amount = current_tick/(float)total_ticks; - - RECT filledbar = seekbar; - filledbar.w = 10.0f + (filledbar.w-10.0f)*amount; - - ui_draw_rect(&filledbar, vec4(1,1,1,0.5f), CORNER_ALL, 5.0f); - - str_format(buffer, sizeof(buffer), "%d:%02d / %d:%02d", - current_tick/SERVER_TICK_SPEED/60, (current_tick/SERVER_TICK_SPEED)%60, - total_ticks/SERVER_TICK_SPEED/60, (total_ticks/SERVER_TICK_SPEED)%60); - ui_do_label(&seekbar, buffer, seekbar.h*0.70f, 0); - - // do the logic - int inside = ui_mouse_inside(&seekbar); - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - else - { - float amount = (ui_mouse_x()-seekbar.x)/(float)seekbar.w; - if(amount > 0 && amount < 1.0f) - { - gameclient.on_reset(); - gameclient.suppress_events = true; - client_demoplayer_setpos(amount); - gameclient.suppress_events = false; - } - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - ui_set_active_item(id); - } - - if(inside) - ui_set_hot_item(id); - } - - - if(menu_active) - { - // do buttons - RECT button; - - // pause button - ui_vsplit_l(&buttonbar, buttonbar_height, &button, &buttonbar); - static int pause_button = 0; - if(ui_do_button(&pause_button, "| |", info->paused, &button, ui_draw_demoplayer_button, 0)) - client_demoplayer_setpause(!info->paused); - - // play button - ui_vsplit_l(&buttonbar, margins, 0, &buttonbar); - ui_vsplit_l(&buttonbar, buttonbar_height, &button, &buttonbar); - static int play_button = 0; - if(ui_do_button(&play_button, ">", !info->paused, &button, ui_draw_demoplayer_button, 0)) - { - client_demoplayer_setpause(0); - client_demoplayer_setspeed(1.0f); - } - - // slowdown - ui_vsplit_l(&buttonbar, margins, 0, &buttonbar); - ui_vsplit_l(&buttonbar, buttonbar_height, &button, &buttonbar); - static int slowdown_button = 0; - if(ui_do_button(&slowdown_button, "<<", 0, &button, ui_draw_demoplayer_button, 0)) - { - if(info->speed > 4.0f) client_demoplayer_setspeed(4.0f); - else if(info->speed > 2.0f) client_demoplayer_setspeed(2.0f); - else if(info->speed > 1.0f) client_demoplayer_setspeed(1.0f); - else if(info->speed > 0.5f) client_demoplayer_setspeed(0.5f); - else client_demoplayer_setspeed(0.05f); - } - - // fastforward - ui_vsplit_l(&buttonbar, margins, 0, &buttonbar); - ui_vsplit_l(&buttonbar, buttonbar_height, &button, &buttonbar); - static int fastforward_button = 0; - if(ui_do_button(&fastforward_button, ">>", 0, &button, ui_draw_demoplayer_button, 0)) - { - if(info->speed < 0.5f) client_demoplayer_setspeed(0.5f); - else if(info->speed < 1.0f) client_demoplayer_setspeed(1.0f); - else if(info->speed < 2.0f) client_demoplayer_setspeed(2.0f); - else if(info->speed < 4.0f) client_demoplayer_setspeed(4.0f); - else client_demoplayer_setspeed(8.0f); - } - - // speed meter - ui_vsplit_l(&buttonbar, margins*3, 0, &buttonbar); - char buffer[64]; - if(info->speed >= 1.0f) - str_format(buffer, sizeof(buffer), "x%.0f", info->speed); - else - str_format(buffer, sizeof(buffer), "x%.1f", info->speed); - ui_do_label(&buttonbar, buffer, button.h*0.7f, -1); - - // exit button - ui_vsplit_r(&buttonbar, buttonbar_height*3, &buttonbar, &button); - static int exit_button = 0; - if(ui_do_button(&exit_button, "Exit", 0, &button, ui_draw_demoplayer_button, 0)) - client_disconnect(); - } -} - -static RECT listbox_originalview; -static RECT listbox_view; -static float listbox_rowheight; -static int listbox_itemindex; -static int listbox_selected_index; -static int listbox_new_selected; - -void MENUS::ui_do_listbox_start(void *id, const RECT *rect, float row_height, const char *title, int num_items, int selected_index) -{ - RECT scroll, row; - RECT view = *rect; - RECT header, footer; - - // draw header - ui_hsplit_t(&view, listheader_height, &header, &view); - ui_draw_rect(&header, vec4(1,1,1,0.25f), CORNER_T, 5.0f); - ui_do_label(&header, title, header.h*fontmod_height, 0); - - // draw footers - ui_hsplit_b(&view, listheader_height, &view, &footer); - ui_draw_rect(&footer, vec4(1,1,1,0.25f), CORNER_B, 5.0f); - ui_vsplit_l(&footer, 10.0f, 0, &footer); - - // background - ui_draw_rect(&view, vec4(0,0,0,0.15f), 0, 0); - - // prepare the scroll - ui_vsplit_r(&view, 15, &view, &scroll); - - // setup the variables - listbox_originalview = view; - listbox_selected_index = selected_index; - listbox_new_selected = selected_index; - listbox_itemindex = 0; - listbox_rowheight = row_height; - //int num_servers = client_serverbrowse_sorted_num(); - - - // do the scrollbar - ui_hsplit_t(&view, listbox_rowheight, &row, 0); - - int num = (int)(listbox_originalview.h/row.h); - static float scrollvalue = 0; - ui_hmargin(&scroll, 5.0f, &scroll); - scrollvalue = ui_do_scrollbar_v(id, &scroll, scrollvalue); - - int start = (int)(num*scrollvalue); - if(start < 0) - start = 0; - - // the list - listbox_view = listbox_originalview; - ui_vmargin(&listbox_view, 5.0f, &listbox_view); - ui_clip_enable(&listbox_view); - listbox_view.y -= scrollvalue*num*row.h; -} - -MENUS::LISTBOXITEM MENUS::ui_do_listbox_nextitem(void *id) -{ - RECT row; - LISTBOXITEM item = {0}; - ui_hsplit_t(&listbox_view, listbox_rowheight-2.0f, &row, &listbox_view); - ui_hsplit_t(&listbox_view, 2.0f, 0, &listbox_view); - - RECT select_hit_box = row; - - item.visible = 1; - if(listbox_selected_index == listbox_itemindex) - item.selected = 1; - - // make sure that only those in view can be selected - if(row.y+row.h > listbox_originalview.y) - { - - if(select_hit_box.y < listbox_originalview.y) // clip the selection - { - select_hit_box.h -= listbox_originalview.y-select_hit_box.y; - select_hit_box.y = listbox_originalview.y; - } - - if(ui_do_button(id, "", listbox_selected_index==listbox_itemindex, &select_hit_box, 0, 0)) - listbox_new_selected = listbox_itemindex; - } - else - item.visible = 0; - - item.rect = row; - - // check if we need to do more - if(row.y > listbox_originalview.y+listbox_originalview.h) - item.visible = 0; - - if(listbox_selected_index==listbox_itemindex) - { - //selected_index = i; - RECT r = row; - ui_margin(&r, 1.5f, &r); - ui_draw_rect(&r, vec4(1,1,1,0.5f), CORNER_ALL, 4.0f); - } - - listbox_itemindex++; - - ui_vmargin(&item.rect, 5.0f, &item.rect); - - return item; -} - -int MENUS::ui_do_listbox_end() -{ - ui_clip_disable(); - return listbox_new_selected; -} - -/* -void MENUS::demolist_listdir_callback(const char *name, int is_dir, void *user) -{ - - (*count)++; - LISTBOXITEM item = ui_do_listbox_nextitem((void*)(10+*count)); - if(item.visible) - ui_do_label(&item.rect, name, item.rect.h*fontmod_height, -1); -} - - - DEMOITEM *demos; - int num_demos; - */ - -void MENUS::demolist_count_callback(const char *name, int is_dir, void *user) -{ - if(is_dir || name[0] == '.') - return; - (*(int *)user)++; -} - -struct FETCH_CALLBACKINFO -{ - MENUS *self; - const char *prefix; - int count; -}; - -void MENUS::demolist_fetch_callback(const char *name, int is_dir, void *user) -{ - if(is_dir || name[0] == '.') - return; - - FETCH_CALLBACKINFO *info = (FETCH_CALLBACKINFO *)user; - - if(info->count == info->self->num_demos) - return; - - str_format(info->self->demos[info->count].filename, sizeof(info->self->demos[info->count].filename), "%s/%s", info->prefix, name); - str_copy(info->self->demos[info->count].name, name, sizeof(info->self->demos[info->count].name)); - info->count++; -} - - -void MENUS::demolist_populate() -{ - if(demos) - mem_free(demos); - demos = 0; - num_demos = 0; - - char buf[512]; - str_format(buf, sizeof(buf), "%s/demos", client_user_directory()); - fs_listdir(buf, demolist_count_callback, &num_demos); - fs_listdir("demos", demolist_count_callback, &num_demos); - - demos = (DEMOITEM *)mem_alloc(sizeof(DEMOITEM)*num_demos, 1); - mem_zero(demos, sizeof(DEMOITEM)*num_demos); - - FETCH_CALLBACKINFO info = {this, buf, 0}; - fs_listdir(buf, demolist_fetch_callback, &info); - info.prefix = "demos"; - fs_listdir("demos", demolist_fetch_callback, &info); -} - - -void MENUS::render_demolist(RECT main_view) -{ - static int inited = 0; - if(!inited) - demolist_populate(); - inited = 1; - - // render background - ui_draw_rect(&main_view, color_tabbar_active, CORNER_ALL, 10.0f); - ui_margin(&main_view, 10.0f, &main_view); - - RECT buttonbar; - ui_hsplit_b(&main_view, button_height+5.0f, &main_view, &buttonbar); - ui_hsplit_t(&buttonbar, 5.0f, 0, &buttonbar); - - static int selected_item = -1; - static int num_items = 0; - static int demolist_id = 0; - - ui_do_listbox_start(&demolist_id, &main_view, 17.0f, "Demos", num_items, selected_item); - for(int i = 0; i < num_demos; i++) - { - LISTBOXITEM item = ui_do_listbox_nextitem((void*)(10+i)); - if(item.visible) - ui_do_label(&item.rect, demos[i].name, item.rect.h*fontmod_height, -1); - } - selected_item = ui_do_listbox_end(); - - if(selected_item >= 0 && selected_item < num_demos && inp_mouse_doubleclick()) - { - ui_set_active_item(0); - client_demoplayer_play(demos[selected_item].filename); - } - - RECT refresh_rect, play_rect; - ui_vsplit_r(&buttonbar, 250.0f, &buttonbar, &refresh_rect); - ui_vsplit_r(&refresh_rect, 130.0f, &refresh_rect, &play_rect); - ui_vsplit_r(&play_rect, 120.0f, 0x0, &play_rect); - - static int refresh_button = 0; - if(ui_do_button(&refresh_button, "Refresh", 0, &refresh_rect, ui_draw_menu_button, 0)) - { - demolist_populate(); - } - - static int play_button = 0; - if(ui_do_button(&play_button, "Play", 0, &play_rect, ui_draw_menu_button, 0)) - { - if(selected_item >= 0 && selected_item < num_demos) - client_demoplayer_play(demos[selected_item].filename); - } - -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_ingame.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_ingame.cpp deleted file mode 100644 index 1623075d9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_ingame.cpp +++ /dev/null @@ -1,398 +0,0 @@ - -#include - -#include // strcmp, strlen, strncpy -#include // atoi - -#include - -#include -#include - -#include -#include -#include - -#include "menus.hpp" -#include "motd.hpp" -#include "voting.hpp" - -void MENUS::render_game(RECT main_view) -{ - RECT button; - //RECT votearea; - ui_hsplit_t(&main_view, 45.0f, &main_view, 0); - ui_draw_rect(&main_view, color_tabbar_active, CORNER_ALL, 10.0f); - - ui_hsplit_t(&main_view, 10.0f, 0, &main_view); - ui_hsplit_t(&main_view, 25.0f, &main_view, 0); - ui_vmargin(&main_view, 10.0f, &main_view); - - ui_vsplit_r(&main_view, 120.0f, &main_view, &button); - static int disconnect_button = 0; - if(ui_do_button(&disconnect_button, "Disconnect", 0, &button, ui_draw_menu_button, 0)) - client_disconnect(); - - if(gameclient.snap.local_info && gameclient.snap.gameobj) - { - if(gameclient.snap.local_info->team != -1) - { - ui_vsplit_l(&main_view, 10.0f, &button, &main_view); - ui_vsplit_l(&main_view, 120.0f, &button, &main_view); - static int spectate_button = 0; - if(ui_do_button(&spectate_button, "Spectate", 0, &button, ui_draw_menu_button, 0)) - { - gameclient.send_switch_team(-1); - set_active(false); - } - } - - if(gameclient.snap.gameobj->flags & GAMEFLAG_TEAMS) - { - if(gameclient.snap.local_info->team != 0) - { - ui_vsplit_l(&main_view, 10.0f, &button, &main_view); - ui_vsplit_l(&main_view, 120.0f, &button, &main_view); - static int spectate_button = 0; - if(ui_do_button(&spectate_button, "Join Red", 0, &button, ui_draw_menu_button, 0)) - { - gameclient.send_switch_team(0); - set_active(false); - } - } - - if(gameclient.snap.local_info->team != 1) - { - ui_vsplit_l(&main_view, 10.0f, &button, &main_view); - ui_vsplit_l(&main_view, 120.0f, &button, &main_view); - static int spectate_button = 0; - if(ui_do_button(&spectate_button, "Join Blue", 0, &button, ui_draw_menu_button, 0)) - { - gameclient.send_switch_team(1); - set_active(false); - } - } - } - else - { - if(gameclient.snap.local_info->team != 0) - { - ui_vsplit_l(&main_view, 10.0f, &button, &main_view); - ui_vsplit_l(&main_view, 120.0f, &button, &main_view); - static int spectate_button = 0; - if(ui_do_button(&spectate_button, "Join Game", 0, &button, ui_draw_menu_button, 0)) - { - gameclient.send_switch_team(0); - set_active(false); - } - } - } - } - - /* - RECT bars; - ui_hsplit_t(&votearea, 10.0f, 0, &votearea); - ui_hsplit_t(&votearea, 25.0f + 10.0f*3 + 25.0f, &votearea, &bars); - - ui_draw_rect(&votearea, color_tabbar_active, CORNER_ALL, 10.0f); - - ui_vmargin(&votearea, 20.0f, &votearea); - ui_hmargin(&votearea, 10.0f, &votearea); - - ui_hsplit_b(&votearea, 35.0f, &votearea, &bars); - - if(gameclient.voting->is_voting()) - { - // do yes button - ui_vsplit_l(&votearea, 50.0f, &button, &votearea); - static int yes_button = 0; - if(ui_do_button(&yes_button, "Yes", 0, &button, ui_draw_menu_button, 0)) - gameclient.voting->vote(1); - - // do no button - ui_vsplit_l(&votearea, 5.0f, 0, &votearea); - ui_vsplit_l(&votearea, 50.0f, &button, &votearea); - static int no_button = 0; - if(ui_do_button(&no_button, "No", 0, &button, ui_draw_menu_button, 0)) - gameclient.voting->vote(-1); - - // do time left - ui_vsplit_r(&votearea, 50.0f, &votearea, &button); - char buf[256]; - str_format(buf, sizeof(buf), "%d", gameclient.voting->seconds_left()); - ui_do_label(&button, buf, 24.0f, 0); - - // do description and command - ui_vsplit_l(&votearea, 5.0f, 0, &votearea); - ui_do_label(&votearea, gameclient.voting->vote_description(), 14.0f, -1); - ui_hsplit_t(&votearea, 16.0f, 0, &votearea); - ui_do_label(&votearea, gameclient.voting->vote_command(), 10.0f, -1); - - // do bars - ui_hsplit_t(&bars, 10.0f, 0, &bars); - ui_hmargin(&bars, 5.0f, &bars); - - gameclient.voting->render_bars(bars, true); - - } - else - { - ui_do_label(&votearea, "No vote in progress", 18.0f, -1); - }*/ -} - -void MENUS::render_serverinfo(RECT main_view) -{ - // fetch server info - SERVER_INFO current_server_info; - client_serverinfo(¤t_server_info); - - if(!gameclient.snap.local_info) - return; - - // count players for server info-box - int num_players = 0; - for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++) - { - SNAP_ITEM item; - snap_get_item(SNAP_CURRENT, i, &item); - - if(item.type == NETOBJTYPE_PLAYER_INFO) - { - num_players++; - } - } - - // render background - ui_draw_rect(&main_view, color_tabbar_active, CORNER_ALL, 10.0f); - - RECT view, serverinfo, gameinfo, motd; - - float x = 0.0f; - float y = 0.0f; - - char buf[1024]; - - // set view to use for all sub-modules - ui_margin(&main_view, 10.0f, &view); - - /* serverinfo */ - ui_hsplit_t(&view, view.h/2-5.0f, &serverinfo, &motd); - ui_vsplit_l(&serverinfo, view.w/2-5.0f, &serverinfo, &gameinfo); - ui_draw_rect(&serverinfo, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - - ui_margin(&serverinfo, 5.0f, &serverinfo); - - x = 5.0f; - y = 0.0f; - - gfx_text(0, serverinfo.x+x, serverinfo.y+y, 32, "Server info", 250); - y += 32.0f+5.0f; - - mem_zero(buf, sizeof(buf)); - str_format( - buf, - sizeof(buf), - "%s\n\n" - "Address: %s\n" - "Ping: %d\n" - "Version: %s\n" - "Password: %s\n", - current_server_info.name, - config.ui_server_address, - gameclient.snap.local_info->latency, - current_server_info.version, - current_server_info.flags&1 ? "Yes" : "No" - ); - - gfx_text(0, serverinfo.x+x, serverinfo.y+y, 20, buf, 250); - - { - RECT button; - int is_favorite = client_serverbrowse_isfavorite(current_server_info.netaddr); - ui_hsplit_b(&serverinfo, 20.0f, &serverinfo, &button); - static int add_fav_button = 0; - if (ui_do_button(&add_fav_button, "Favorite", is_favorite, &button, ui_draw_checkbox, 0)) - { - if(is_favorite) - client_serverbrowse_removefavorite(current_server_info.netaddr); - else - client_serverbrowse_addfavorite(current_server_info.netaddr); - } - } - - /* gameinfo */ - ui_vsplit_l(&gameinfo, 10.0f, 0x0, &gameinfo); - ui_draw_rect(&gameinfo, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - - ui_margin(&gameinfo, 5.0f, &gameinfo); - - x = 5.0f; - y = 0.0f; - - gfx_text(0, gameinfo.x+x, gameinfo.y+y, 32, "Game info", 250); - y += 32.0f+5.0f; - - mem_zero(buf, sizeof(buf)); - str_format( - buf, - sizeof(buf), - "\n\n" - "Gametype: %s\n" - "Map: %s\n" - "Score limit: %d\n" - "Time limit: %d\n" - "\n" - "Players: %d/%d\n", - current_server_info.gametype, - current_server_info.map, - gameclient.snap.gameobj->score_limit, - gameclient.snap.gameobj->time_limit, - gameclient.snap.num_players, - current_server_info.max_players - ); - gfx_text(0, gameinfo.x+x, gameinfo.y+y, 20, buf, 250); - - /* motd */ - ui_hsplit_t(&motd, 10.0f, 0, &motd); - ui_draw_rect(&motd, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&motd, 5.0f, &motd); - y = 0.0f; - x = 5.0f; - gfx_text(0, motd.x+x, motd.y+y, 32, "MOTD", -1); - y += 32.0f+5.0f; - gfx_text(0, motd.x+x, motd.y+y, 16, gameclient.motd->server_motd, (int)motd.w); -} - -static const char *format_command(const char *cmd) -{ - return cmd; -} - -void MENUS::render_servercontrol_server(RECT main_view) -{ - int num_options = 0; - for(VOTING::VOTEOPTION *option = gameclient.voting->first; option; option = option->next) - num_options++; - - static int votelist = 0; - RECT list = main_view; - ui_do_listbox_start(&votelist, &list, 24.0f, "Options", num_options, callvote_selectedoption); - - for(VOTING::VOTEOPTION *option = gameclient.voting->first; option; option = option->next) - { - LISTBOXITEM item = ui_do_listbox_nextitem(option); - - if(item.visible) - ui_do_label(&item.rect, format_command(option->command), 16.0f, -1); - } - - callvote_selectedoption = ui_do_listbox_end(); -} - -void MENUS::render_servercontrol_kick(RECT main_view) -{ - // draw header - RECT header, footer; - ui_hsplit_t(&main_view, 20, &header, &main_view); - ui_draw_rect(&header, vec4(1,1,1,0.25f), CORNER_T, 5.0f); - ui_do_label(&header, "Players", 18.0f, 0); - - // draw footers - ui_hsplit_b(&main_view, 20, &main_view, &footer); - ui_draw_rect(&footer, vec4(1,1,1,0.25f), CORNER_B, 5.0f); - ui_vsplit_l(&footer, 10.0f, 0, &footer); - - // players - ui_draw_rect(&main_view, vec4(0,0,0,0.15f), 0, 0); - RECT list = main_view; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(!gameclient.snap.player_infos[i]) - continue; - - RECT button; - ui_hsplit_t(&list, button_height, &button, &list); - - if(ui_do_button((char *)&gameclient.snap+i, "", callvote_selectedplayer == i, &button, ui_draw_list_row, 0)) - callvote_selectedplayer = i; - - TEE_RENDER_INFO info = gameclient.clients[i].render_info; - info.size = button.h; - render_tee(ANIMSTATE::get_idle(), &info, EMOTE_NORMAL, vec2(1,0), vec2(button.x+button.h/2, button.y+button.h/2)); - - button.x += button.h; - ui_do_label(&button, gameclient.clients[i].name, 18.0f, -1); - } -} - -void MENUS::render_servercontrol(RECT main_view) -{ - static int control_page = 0; - - // render background - RECT temp, tabbar; - ui_vsplit_r(&main_view, 120.0f, &main_view, &tabbar); - ui_draw_rect(&main_view, color_tabbar_active, CORNER_B|CORNER_TL, 10.0f); - ui_hsplit_t(&tabbar, 50.0f, &temp, &tabbar); - ui_draw_rect(&temp, color_tabbar_active, CORNER_R, 10.0f); - - ui_hsplit_t(&main_view, 10.0f, 0, &main_view); - - RECT button; - - const char *tabs[] = {"Options", "Kick"}; - int num_tabs = (int)(sizeof(tabs)/sizeof(*tabs)); - - for(int i = 0; i < num_tabs; i++) - { - ui_hsplit_t(&tabbar, 10, &button, &tabbar); - ui_hsplit_t(&tabbar, 26, &button, &tabbar); - if(ui_do_button(tabs[i], tabs[i], control_page == i, &button, ui_draw_settings_tab_button, 0)) - { - control_page = i; - callvote_selectedplayer = -1; - callvote_selectedoption = -1; - } - } - - ui_margin(&main_view, 10.0f, &main_view); - RECT bottom; - ui_hsplit_b(&main_view, button_height + 5*2, &main_view, &bottom); - ui_hmargin(&bottom, 5.0f, &bottom); - - // render page - if(control_page == 0) - render_servercontrol_server(main_view); - else if(control_page == 1) - render_servercontrol_kick(main_view); - - - { - RECT button; - ui_vsplit_r(&bottom, 120.0f, &bottom, &button); - - static int callvote_button = 0; - if(ui_do_button(&callvote_button, "Call vote", 0, &button, ui_draw_menu_button, 0)) - { - if(control_page == 0) - { - // - gameclient.voting->callvote_option(callvote_selectedoption); - /* - if(callvote_selectedmap >= 0 && callvote_selectedmap < gameclient.maplist->num()) - gameclient.voting->callvote_map(gameclient.maplist->name(callvote_selectedmap));*/ - } - else if(control_page == 1) - { - if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && - gameclient.snap.player_infos[callvote_selectedplayer]) - { - gameclient.voting->callvote_kick(callvote_selectedplayer); - set_active(false); - } - } - } - } -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_settings.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_settings.cpp deleted file mode 100644 index b240c6078..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/menus_settings.cpp +++ /dev/null @@ -1,667 +0,0 @@ - -#include - -#include // strcmp, strlen, strncpy -#include // atoi - -#include - -#include -#include - -#include -#include -#include -#include - -#include "binds.hpp" -#include "menus.hpp" -#include "skins.hpp" - -MENUS_KEYBINDER MENUS::binder; - -MENUS_KEYBINDER::MENUS_KEYBINDER() -{ - take_key = false; - got_key = false; -} - -bool MENUS_KEYBINDER::on_input(INPUT_EVENT e) -{ - if(take_key) - { - if(e.flags&INPFLAG_PRESS && e.key != KEY_ESCAPE) - { - key = e; - got_key = true; - take_key = false; - } - return true; - } - - return false; -} - -void MENUS::render_settings_player(RECT main_view) -{ - RECT button; - RECT skinselection; - ui_vsplit_l(&main_view, 300.0f, &main_view, &skinselection); - - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - - // render settings - { - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - ui_do_label(&button, "Name:", 14.0, -1); - ui_vsplit_l(&button, 80.0f, 0, &button); - ui_vsplit_l(&button, 180.0f, &button, 0); - if(ui_do_edit_box(config.player_name, &button, config.player_name, sizeof(config.player_name), 14.0f)) - need_sendinfo = true; - - static int dynamic_camera_button = 0; - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if(ui_do_button(&dynamic_camera_button, "Dynamic Camera", config.cl_mouse_deadzone != 0, &button, ui_draw_checkbox, 0)) - { - - if(config.cl_mouse_deadzone) - { - config.cl_mouse_followfactor = 0; - config.cl_mouse_max_distance = 400; - config.cl_mouse_deadzone = 0; - } - else - { - config.cl_mouse_followfactor = 60; - config.cl_mouse_max_distance = 1000; - config.cl_mouse_deadzone = 300; - } - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.cl_autoswitch_weapons, "Switch weapon on pickup", config.cl_autoswitch_weapons, &button, ui_draw_checkbox, 0)) - config.cl_autoswitch_weapons ^= 1; - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.cl_nameplates, "Show name plates", config.cl_nameplates, &button, ui_draw_checkbox, 0)) - config.cl_nameplates ^= 1; - - //if(config.cl_nameplates) - { - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - ui_vsplit_l(&button, 15.0f, 0, &button); - if (ui_do_button(&config.cl_nameplates_always, "Always show name plates", config.cl_nameplates_always, &button, ui_draw_checkbox, 0)) - config.cl_nameplates_always ^= 1; - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.player_color_body, "Custom colors", config.player_use_custom_color, &button, ui_draw_checkbox, 0)) - { - config.player_use_custom_color = config.player_use_custom_color?0:1; - need_sendinfo = true; - } - - if(config.player_use_custom_color) - { - int *colors[2]; - colors[0] = &config.player_color_body; - colors[1] = &config.player_color_feet; - - const char *parts[] = {"Body", "Feet"}; - const char *labels[] = {"Hue", "Sat.", "Lht."}; - static int color_slider[2][3] = {{0}}; - //static float v[2][3] = {{0, 0.5f, 0.25f}, {0, 0.5f, 0.25f}}; - - for(int i = 0; i < 2; i++) - { - RECT text; - ui_hsplit_t(&main_view, 20.0f, &text, &main_view); - ui_vsplit_l(&text, 15.0f, 0, &text); - ui_do_label(&text, parts[i], 14.0f, -1); - - int prevcolor = *colors[i]; - int color = 0; - for(int s = 0; s < 3; s++) - { - RECT text; - ui_hsplit_t(&main_view, 19.0f, &button, &main_view); - ui_vsplit_l(&button, 30.0f, 0, &button); - ui_vsplit_l(&button, 30.0f, &text, &button); - ui_vsplit_r(&button, 5.0f, &button, 0); - ui_hsplit_t(&button, 4.0f, 0, &button); - - float k = ((prevcolor>>((2-s)*8))&0xff) / 255.0f; - k = ui_do_scrollbar_h(&color_slider[i][s], &button, k); - color <<= 8; - color += clamp((int)(k*255), 0, 255); - ui_do_label(&text, labels[s], 15.0f, -1); - - } - - if(*colors[i] != color) - need_sendinfo = true; - - *colors[i] = color; - ui_hsplit_t(&main_view, 5.0f, 0, &main_view); - } - } - } - - // draw header - RECT header, footer; - ui_hsplit_t(&skinselection, 20, &header, &skinselection); - ui_draw_rect(&header, vec4(1,1,1,0.25f), CORNER_T, 5.0f); - ui_do_label(&header, "Skins", 18.0f, 0); - - // draw footers - ui_hsplit_b(&skinselection, 20, &skinselection, &footer); - ui_draw_rect(&footer, vec4(1,1,1,0.25f), CORNER_B, 5.0f); - ui_vsplit_l(&footer, 10.0f, 0, &footer); - - // modes - ui_draw_rect(&skinselection, vec4(0,0,0,0.15f), 0, 0); - - RECT scroll; - ui_vsplit_r(&skinselection, 15, &skinselection, &scroll); - - RECT list = skinselection; - ui_hsplit_t(&list, 50, &button, &list); - - int num = (int)(skinselection.h/button.h); - static float scrollvalue = 0; - static int scrollbar = 0; - ui_hmargin(&scroll, 5.0f, &scroll); - scrollvalue = ui_do_scrollbar_v(&scrollbar, &scroll, scrollvalue); - - int start = (int)((gameclient.skins->num()-num)*scrollvalue); - if(start < 0) - start = 0; - - for(int i = start; i < start+num && i < gameclient.skins->num(); i++) - { - const SKINS::SKIN *s = gameclient.skins->get(i); - - // no special skins - if(s->name[0] == 'x' && s->name[1] == '_') - { - num++; - continue; - } - - char buf[128]; - str_format(buf, sizeof(buf), "%s", s->name); - int selected = 0; - if(strcmp(s->name, config.player_skin) == 0) - selected = 1; - - TEE_RENDER_INFO info; - info.texture = s->org_texture; - info.color_body = vec4(1,1,1,1); - info.color_feet = vec4(1,1,1,1); - if(config.player_use_custom_color) - { - info.color_body = gameclient.skins->get_color(config.player_color_body); - info.color_feet = gameclient.skins->get_color(config.player_color_feet); - info.texture = s->color_texture; - } - - info.size = ui_scale()*50.0f; - - RECT icon; - RECT text; - ui_vsplit_l(&button, 50.0f, &icon, &text); - - if(ui_do_button(s, "", selected, &button, ui_draw_list_row, 0)) - { - config_set_player_skin(&config, s->name); - need_sendinfo = true; - } - - ui_hsplit_t(&text, 12.0f, 0, &text); // some margin from the top - ui_do_label(&text, buf, 18.0f, 0); - - ui_hsplit_t(&icon, 5.0f, 0, &icon); // some margin from the top - render_tee(ANIMSTATE::get_idle(), &info, 0, vec2(1, 0), vec2(icon.x+icon.w/2, icon.y+icon.h/2)); - - if(config.debug) - { - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(s->blood_color.r, s->blood_color.g, s->blood_color.b, 1.0f); - gfx_quads_drawTL(icon.x, icon.y, 12, 12); - gfx_quads_end(); - } - - ui_hsplit_t(&list, 50, &button, &list); - } -} - -typedef void (*assign_func_callback)(CONFIGURATION *config, int value); - -typedef struct -{ - const char *name; - const char *command; - int keyid; -} KEYINFO; - -KEYINFO keys[] = -{ - { "Move Left:", "+left", 0}, - { "Move Right:", "+right", 0 }, - { "Jump:", "+jump", 0 }, - { "Fire:", "+fire", 0 }, - { "Hook:", "+hook", 0 }, - { "Hammer:", "+weapon1", 0 }, - { "Pistol:", "+weapon2", 0 }, - { "Shotgun:", "+weapon3", 0 }, - { "Grenade:", "+weapon4", 0 }, - { "Rifle:", "+weapon5", 0 }, - { "Next Weapon:", "+nextweapon", 0 }, - { "Prev. Weapon:", "+prevweapon", 0 }, - { "Vote Yes:", "vote yes", 0 }, - { "Vote No:", "vote no", 0 }, - { "Chat:", "chat all", 0 }, - { "Team Chat:", "chat team", 0 }, - { "Emoticon:", "+emote", 0 }, - { "Console:", "toggle_local_console", 0 }, - { "Remote Console:", "toggle_remote_console", 0 }, - { "Screenshot:", "screenshot", 0 }, - { "Scoreboard:", "+scoreboard", 0 }, -}; - -const int key_count = sizeof(keys) / sizeof(KEYINFO); - -void MENUS::ui_do_getbuttons(int start, int stop, RECT view) -{ - for (int i = start; i < stop; i++) - { - KEYINFO key = keys[i]; - RECT button, label; - ui_hsplit_t(&view, 20.0f, &button, &view); - ui_vsplit_l(&button, 130.0f, &label, &button); - - ui_do_label(&label, key.name, 14.0f, -1); - int oldid = key.keyid; - int newid = ui_do_key_reader((void *)keys[i].name, &button, oldid); - if(newid != oldid) - { - gameclient.binds->bind(oldid, ""); - gameclient.binds->bind(newid, keys[i].command); - } - ui_hsplit_t(&view, 5.0f, 0, &view); - } -} - -void MENUS::render_settings_controls(RECT main_view) -{ - // this is kinda slow, but whatever - for(int i = 0; i < key_count; i++) - keys[i].keyid = 0; - - for(int keyid = 0; keyid < KEY_LAST; keyid++) - { - const char *bind = gameclient.binds->get(keyid); - if(!bind[0]) - continue; - - for(int i = 0; i < key_count; i++) - if(strcmp(bind, keys[i].command) == 0) - { - keys[i].keyid = keyid; - break; - } - } - - RECT movement_settings, weapon_settings, voting_settings, chat_settings, misc_settings, reset_button; - ui_vsplit_l(&main_view, main_view.w/2-5.0f, &movement_settings, &voting_settings); - - /* movement settings */ - { - ui_hsplit_t(&movement_settings, main_view.h/2-5.0f, &movement_settings, &weapon_settings); - ui_draw_rect(&movement_settings, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&movement_settings, 10.0f, &movement_settings); - - gfx_text(0, movement_settings.x, movement_settings.y, 14, "Movement", -1); - - ui_hsplit_t(&movement_settings, 14.0f+5.0f+10.0f, 0, &movement_settings); - - { - RECT button, label; - ui_hsplit_t(&movement_settings, 20.0f, &button, &movement_settings); - ui_vsplit_l(&button, 130.0f, &label, &button); - ui_do_label(&label, "Mouse sens.", 14.0f, -1); - ui_hmargin(&button, 2.0f, &button); - config.inp_mousesens = (int)(ui_do_scrollbar_h(&config.inp_mousesens, &button, (config.inp_mousesens-5)/500.0f)*500.0f)+5; - //*key.key = ui_do_key_reader(key.key, &button, *key.key); - ui_hsplit_t(&movement_settings, 20.0f, 0, &movement_settings); - } - - ui_do_getbuttons(0, 5, movement_settings); - - } - - /* weapon settings */ - { - ui_hsplit_t(&weapon_settings, 10.0f, 0, &weapon_settings); - ui_draw_rect(&weapon_settings, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&weapon_settings, 10.0f, &weapon_settings); - - gfx_text(0, weapon_settings.x, weapon_settings.y, 14, "Weapon", -1); - - ui_hsplit_t(&weapon_settings, 14.0f+5.0f+10.0f, 0, &weapon_settings); - ui_do_getbuttons(5, 12, weapon_settings); - } - - /* voting settings */ - { - ui_vsplit_l(&voting_settings, 10.0f, 0, &voting_settings); - ui_hsplit_t(&voting_settings, main_view.h/4-5.0f, &voting_settings, &chat_settings); - ui_draw_rect(&voting_settings, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&voting_settings, 10.0f, &voting_settings); - - gfx_text(0, voting_settings.x, voting_settings.y, 14, "Voting", -1); - - ui_hsplit_t(&voting_settings, 14.0f+5.0f+10.0f, 0, &voting_settings); - ui_do_getbuttons(12, 14, voting_settings); - } - - /* chat settings */ - { - ui_hsplit_t(&chat_settings, 10.0f, 0, &chat_settings); - ui_hsplit_t(&chat_settings, main_view.h/4-10.0f, &chat_settings, &misc_settings); - ui_draw_rect(&chat_settings, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&chat_settings, 10.0f, &chat_settings); - - gfx_text(0, chat_settings.x, chat_settings.y, 14, "Chat", -1); - - ui_hsplit_t(&chat_settings, 14.0f+5.0f+10.0f, 0, &chat_settings); - ui_do_getbuttons(14, 16, chat_settings); - } - - /* misc settings */ - { - ui_hsplit_t(&misc_settings, 10.0f, 0, &misc_settings); - ui_hsplit_t(&misc_settings, main_view.h/2-5.0f-45.0f, &misc_settings, &reset_button); - ui_draw_rect(&misc_settings, vec4(1,1,1,0.25f), CORNER_ALL, 10.0f); - ui_margin(&misc_settings, 10.0f, &misc_settings); - - gfx_text(0, misc_settings.x, misc_settings.y, 14, "Miscellaneous", -1); - - ui_hsplit_t(&misc_settings, 14.0f+5.0f+10.0f, 0, &misc_settings); - ui_do_getbuttons(16, 21, misc_settings); - } - - // defaults - ui_hsplit_t(&reset_button, 10.0f, 0, &reset_button); - static int default_button = 0; - if (ui_do_button((void*)&default_button, "Reset to defaults", 0, &reset_button, ui_draw_menu_button, 0)) - gameclient.binds->set_defaults(); -} - -void MENUS::render_settings_graphics(RECT main_view) -{ - RECT button; - char buf[128]; - - static const int MAX_RESOLUTIONS = 256; - static VIDEO_MODE modes[MAX_RESOLUTIONS]; - static int num_modes = -1; - - if(num_modes == -1) - num_modes = gfx_get_video_modes(modes, MAX_RESOLUTIONS); - - RECT modelist; - ui_vsplit_l(&main_view, 300.0f, &main_view, &modelist); - - // draw allmodes switch - RECT header, footer; - ui_hsplit_t(&modelist, 20, &button, &modelist); - if (ui_do_button(&config.gfx_display_all_modes, "Show only supported", config.gfx_display_all_modes^1, &button, ui_draw_checkbox, 0)) - { - config.gfx_display_all_modes ^= 1; - num_modes = gfx_get_video_modes(modes, MAX_RESOLUTIONS); - } - - // draw header - ui_hsplit_t(&modelist, 20, &header, &modelist); - ui_draw_rect(&header, vec4(1,1,1,0.25f), CORNER_T, 5.0f); - ui_do_label(&header, "Display Modes", 14.0f, 0); - - // draw footers - ui_hsplit_b(&modelist, 20, &modelist, &footer); - str_format(buf, sizeof(buf), "Current: %dx%d %d bit", config.gfx_screen_width, config.gfx_screen_height, config.gfx_color_depth); - ui_draw_rect(&footer, vec4(1,1,1,0.25f), CORNER_B, 5.0f); - ui_vsplit_l(&footer, 10.0f, 0, &footer); - ui_do_label(&footer, buf, 14.0f, -1); - - // modes - ui_draw_rect(&modelist, vec4(0,0,0,0.15f), 0, 0); - - RECT scroll; - ui_vsplit_r(&modelist, 15, &modelist, &scroll); - - RECT list = modelist; - ui_hsplit_t(&list, 20, &button, &list); - - int num = (int)(modelist.h/button.h); - static float scrollvalue = 0; - static int scrollbar = 0; - ui_hmargin(&scroll, 5.0f, &scroll); - scrollvalue = ui_do_scrollbar_v(&scrollbar, &scroll, scrollvalue); - - int start = (int)((num_modes-num)*scrollvalue); - if(start < 0) - start = 0; - - for(int i = start; i < start+num && i < num_modes; i++) - { - int depth = modes[i].red+modes[i].green+modes[i].blue; - if(depth < 16) - depth = 16; - else if(depth > 16) - depth = 24; - - int selected = 0; - if(config.gfx_color_depth == depth && - config.gfx_screen_width == modes[i].width && - config.gfx_screen_height == modes[i].height) - { - selected = 1; - } - - str_format(buf, sizeof(buf), " %dx%d %d bit", modes[i].width, modes[i].height, depth); - if(ui_do_button(&modes[i], buf, selected, &button, ui_draw_list_row, 0)) - { - config.gfx_color_depth = depth; - config.gfx_screen_width = modes[i].width; - config.gfx_screen_height = modes[i].height; - if(!selected) - need_restart = true; - } - - ui_hsplit_t(&list, 20, &button, &list); - } - - - // switches - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_fullscreen, "Fullscreen", config.gfx_fullscreen, &button, ui_draw_checkbox, 0)) - { - config.gfx_fullscreen ^= 1; - need_restart = true; - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_vsync, "V-Sync", config.gfx_vsync, &button, ui_draw_checkbox, 0)) - { - config.gfx_vsync ^= 1; - need_restart = true; - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_fsaa_samples, "FSAA samples", config.gfx_fsaa_samples, &button, ui_draw_checkbox_number, 0)) - { - config.gfx_fsaa_samples = (config.gfx_fsaa_samples+1)%17; - need_restart = true; - } - - ui_hsplit_t(&main_view, 40.0f, &button, &main_view); - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_texture_quality, "Quality Textures", config.gfx_texture_quality, &button, ui_draw_checkbox, 0)) - { - config.gfx_texture_quality ^= 1; - need_restart = true; - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_texture_compression, "Texture Compression", config.gfx_texture_compression, &button, ui_draw_checkbox, 0)) - { - config.gfx_texture_compression ^= 1; - need_restart = true; - } - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.gfx_high_detail, "High Detail", config.gfx_high_detail, &button, ui_draw_checkbox, 0)) - config.gfx_high_detail ^= 1; - - // - - RECT text; - ui_hsplit_t(&main_view, 20.0f, 0, &main_view); - ui_hsplit_t(&main_view, 20.0f, &text, &main_view); - //ui_vsplit_l(&text, 15.0f, 0, &text); - ui_do_label(&text, "UI Color", 14.0f, -1); - - const char *labels[] = {"Hue", "Sat.", "Lht.", "Alpha"}; - int *color_slider[4] = {&config.ui_color_hue, &config.ui_color_sat, &config.ui_color_lht, &config.ui_color_alpha}; - for(int s = 0; s < 4; s++) - { - RECT text; - ui_hsplit_t(&main_view, 19.0f, &button, &main_view); - ui_vmargin(&button, 15.0f, &button); - ui_vsplit_l(&button, 50.0f, &text, &button); - ui_vsplit_r(&button, 5.0f, &button, 0); - ui_hsplit_t(&button, 4.0f, 0, &button); - - float k = (*color_slider[s]) / 255.0f; - k = ui_do_scrollbar_h(color_slider[s], &button, k); - *color_slider[s] = (int)(k*255.0f); - ui_do_label(&text, labels[s], 15.0f, -1); - } -} - -void MENUS::render_settings_sound(RECT main_view) -{ - RECT button; - ui_vsplit_l(&main_view, 300.0f, &main_view, 0); - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.snd_enable, "Use Sounds", config.snd_enable, &button, ui_draw_checkbox, 0)) - { - config.snd_enable ^= 1; - need_restart = true; - } - - if(!config.snd_enable) - return; - - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui_do_button(&config.snd_nonactive_mute, "Mute when not active", config.snd_nonactive_mute, &button, ui_draw_checkbox, 0)) - config.snd_nonactive_mute ^= 1; - - // sample rate box - { - char buf[64]; - str_format(buf, sizeof(buf), "%d", config.snd_rate); - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - ui_do_label(&button, "Sample Rate", 14.0f, -1); - ui_vsplit_l(&button, 110.0f, 0, &button); - ui_vsplit_l(&button, 180.0f, &button, 0); - ui_do_edit_box(&config.snd_rate, &button, buf, sizeof(buf), 14.0f); - int before = config.snd_rate; - config.snd_rate = atoi(buf); - - if(config.snd_rate != before) - need_restart = true; - - if(config.snd_rate < 1) - config.snd_rate = 1; - } - - // volume slider - { - RECT button, label; - ui_hsplit_t(&main_view, 5.0f, &button, &main_view); - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - ui_vsplit_l(&button, 110.0f, &label, &button); - ui_hmargin(&button, 2.0f, &button); - ui_do_label(&label, "Sound Volume", 14.0f, -1); - config.snd_volume = (int)(ui_do_scrollbar_h(&config.snd_volume, &button, config.snd_volume/100.0f)*100.0f); - ui_hsplit_t(&main_view, 20.0f, 0, &main_view); - } -} - - - /* -static void menu2_render_settings_network(RECT main_view) -{ - RECT button; - ui_vsplit_l(&main_view, 300.0f, &main_view, 0); - - { - ui_hsplit_t(&main_view, 20.0f, &button, &main_view); - ui_do_label(&button, "Rcon Password", 14.0, -1); - ui_vsplit_l(&button, 110.0f, 0, &button); - ui_vsplit_l(&button, 180.0f, &button, 0); - ui_do_edit_box(&config.rcon_password, &button, config.rcon_password, sizeof(config.rcon_password), true); - } -}*/ - -void MENUS::render_settings(RECT main_view) -{ - static int settings_page = 0; - - // render background - RECT temp, tabbar; - ui_vsplit_r(&main_view, 120.0f, &main_view, &tabbar); - ui_draw_rect(&main_view, color_tabbar_active, CORNER_B|CORNER_TL, 10.0f); - ui_hsplit_t(&tabbar, 50.0f, &temp, &tabbar); - ui_draw_rect(&temp, color_tabbar_active, CORNER_R, 10.0f); - - ui_hsplit_t(&main_view, 10.0f, 0, &main_view); - - RECT button; - - const char *tabs[] = {"Player", "Controls", "Graphics", "Sound"}; - int num_tabs = (int)(sizeof(tabs)/sizeof(*tabs)); - - for(int i = 0; i < num_tabs; i++) - { - ui_hsplit_t(&tabbar, 10, &button, &tabbar); - ui_hsplit_t(&tabbar, 26, &button, &tabbar); - if(ui_do_button(tabs[i], tabs[i], settings_page == i, &button, ui_draw_settings_tab_button, 0)) - settings_page = i; - } - - ui_margin(&main_view, 10.0f, &main_view); - - if(settings_page == 0) - render_settings_player(main_view); - else if(settings_page == 1) - render_settings_controls(main_view); - else if(settings_page == 2) - render_settings_graphics(main_view); - else if(settings_page == 3) - render_settings_sound(main_view); - - if(need_restart) - { - RECT restart_warning; - ui_hsplit_b(&main_view, 40, &main_view, &restart_warning); - ui_do_label(&restart_warning, "You must restart the game for all settings to take effect.", 15.0f, -1, 220); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.cpp deleted file mode 100644 index 3b8f2243b..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include -#include -#include - -#include - -#include "motd.hpp" - -void MOTD::on_reset() -{ - clear(); -} - -void MOTD::clear() -{ - server_motd_time = 0; -} - -bool MOTD::is_active() -{ - return time_get() < server_motd_time; -} - -void MOTD::on_render() -{ - if(!is_active()) - return; - - float width = 400*3.0f*gfx_screenaspect(); - float height = 400*3.0f; - - gfx_mapscreen(0, 0, width, height); - - float h = 800.0f; - float w = 650.0f; - float x = width/2 - w/2; - float y = 150.0f; - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(x, y, w, h, 40.0f); - gfx_quads_end(); - - gfx_text(0, x+40.0f, y+40.0f, 32.0f, server_motd, (int)(w-80.0f)); -} - -void MOTD::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_MOTD) - { - NETMSG_SV_MOTD *msg = (NETMSG_SV_MOTD *)rawmsg; - - // process escaping - str_copy(server_motd, msg->message, sizeof(server_motd)); - for(int i = 0; server_motd[i]; i++) - { - if(server_motd[i] == '\\') - { - if(server_motd[i+1] == 'n') - { - server_motd[i] = ' '; - server_motd[i+1] = '\n'; - i++; - } - } - } - - if(server_motd[0] && config.cl_motd_time) - server_motd_time = time_get()+time_freq()*config.cl_motd_time; - else - server_motd_time = 0; - } -} - -bool MOTD::on_input(INPUT_EVENT e) -{ - if(is_active() && e.flags&INPFLAG_PRESS && e.key == KEY_ESCAPE) - { - clear(); - return true; - } - return false; -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.hpp deleted file mode 100644 index 5ee16086e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/motd.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -class MOTD : public COMPONENT -{ - // motd - int64 server_motd_time; -public: - char server_motd[900]; - - void clear(); - bool is_active(); - - virtual void on_reset(); - virtual void on_render(); - virtual void on_message(int msgtype, void *rawmsg); - virtual bool on_input(INPUT_EVENT e); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.cpp deleted file mode 100644 index 4a47ea376..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include - -#include -#include -#include "nameplates.hpp" -#include "controls.hpp" - -void NAMEPLATES::render_nameplate( - const NETOBJ_CHARACTER *prev_char, - const NETOBJ_CHARACTER *player_char, - const NETOBJ_PLAYER_INFO *player_info - ) -{ - float intratick = client_intratick(); - - vec2 position = mix(vec2(prev_char->x, prev_char->y), vec2(player_char->x, player_char->y), intratick); - - // render name plate - if(!player_info->local) - { - //gfx_text_color - float a = 1; - if(config.cl_nameplates_always == 0) - a = clamp(1-powf(distance(gameclient.controls->target_pos, position)/200.0f,16.0f), 0.0f, 1.0f); - - const char *name = gameclient.clients[player_info->cid].name; - float tw = gfx_text_width(0, 28.0f, name, -1); - gfx_text_color(1,1,1,a); - gfx_text(0, position.x-tw/2.0f, position.y-60, 28.0f, name, -1); - - if(config.debug) // render client id when in debug aswell - { - char buf[128]; - str_format(buf, sizeof(buf),"%d", player_info->cid); - gfx_text(0, position.x, position.y-90, 28.0f, buf, -1); - } - - gfx_text_color(1,1,1,1); - } -} - -void NAMEPLATES::on_render() -{ - if (!config.cl_nameplates) - return; - - for(int i = 0; i < MAX_CLIENTS; i++) - { - // only render active characters - if(!gameclient.snap.characters[i].active) - continue; - - const void *info = snap_find_item(SNAP_CURRENT, NETOBJTYPE_PLAYER_INFO, i); - - if(info) - { - render_nameplate( - &gameclient.snap.characters[i].prev, - &gameclient.snap.characters[i].cur, - (const NETOBJ_PLAYER_INFO *)info); - } - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.hpp deleted file mode 100644 index 2695f5ac0..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/nameplates.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -class NAMEPLATES : public COMPONENT -{ - void render_nameplate( - const class NETOBJ_CHARACTER *prev_char, - const class NETOBJ_CHARACTER *player_char, - const class NETOBJ_PLAYER_INFO *player_info - ); - -public: - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.cpp deleted file mode 100644 index ef6dbbe90..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include -#include -#include "particles.hpp" - -PARTICLES::PARTICLES() -{ - on_reset(); - render_trail.parts = this; - render_explosions.parts = this; - render_general.parts = this; -} - - -void PARTICLES::on_reset() -{ - // reset particles - for(int i = 0; i < MAX_PARTICLES; i++) - { - particles[i].prev_part = i-1; - particles[i].next_part = i+1; - } - - particles[0].prev_part = 0; - particles[MAX_PARTICLES-1].next_part = -1; - first_free = 0; - - for(int i = 0; i < NUM_GROUPS; i++) - first_part[i] = -1; -} - -void PARTICLES::add(int group, PARTICLE *part) -{ - if (first_free == -1) - return; - - // remove from the free list - int id = first_free; - first_free = particles[id].next_part; - particles[first_free].prev_part = -1; - - // copy data - particles[id] = *part; - - // insert to the group list - particles[id].prev_part = -1; - particles[id].next_part = first_part[group]; - if(first_part[group] != -1) - particles[first_part[group]].prev_part = id; - first_part[group] = id; - - // set some parameters - particles[id].life = 0; -} - -void PARTICLES::update(float time_passed) -{ - static float friction_fraction = 0; - friction_fraction += time_passed; - - if(friction_fraction > 2.0f) // safty messure - friction_fraction = 0; - - int friction_count = 0; - while(friction_fraction > 0.05f) - { - friction_count++; - friction_fraction -= 0.05f; - } - - for(int g = 0; g < NUM_GROUPS; g++) - { - int i = first_part[g]; - while(i != -1) - { - int next = particles[i].next_part; - //particles[i].vel += flow_get(particles[i].pos)*time_passed * particles[i].flow_affected; - particles[i].vel.y += particles[i].gravity*time_passed; - - for(int f = 0; f < friction_count; f++) // apply friction - particles[i].vel *= particles[i].friction; - - // move the point - vec2 vel = particles[i].vel*time_passed; - move_point(&particles[i].pos, &vel, 0.1f+0.9f*frandom(), NULL); - particles[i].vel = vel* (1.0f/time_passed); - - particles[i].life += time_passed; - particles[i].rot += time_passed * particles[i].rotspeed; - - // check particle death - if(particles[i].life > particles[i].life_span) - { - // remove it from the group list - if(particles[i].prev_part != -1) - particles[particles[i].prev_part].next_part = particles[i].next_part; - else - first_part[g] = particles[i].next_part; - - if(particles[i].next_part != -1) - particles[particles[i].next_part].prev_part = particles[i].prev_part; - - // insert to the free list - if(first_free != -1) - particles[first_free].prev_part = i; - particles[i].prev_part = -1; - particles[i].next_part = first_free; - first_free = i; - } - - i = next; - } - } -} - -void PARTICLES::on_render() -{ - static int64 lasttime = 0; - int64 t = time_get(); - update((float)((t-lasttime)/(double)time_freq())); - lasttime = t; -} - -void PARTICLES::render_group(int group) -{ - gfx_blend_normal(); - //gfx_blend_additive(); - gfx_texture_set(data->images[IMAGE_PARTICLES].id); - gfx_quads_begin(); - - int i = first_part[group]; - while(i != -1) - { - select_sprite(particles[i].spr); - float a = particles[i].life / particles[i].life_span; - vec2 p = particles[i].pos; - float size = mix(particles[i].start_size, particles[i].end_size, a); - - gfx_quads_setrotation(particles[i].rot); - - gfx_setcolor( - particles[i].color.r, - particles[i].color.g, - particles[i].color.b, - particles[i].color.a); // pow(a, 0.75f) * - - gfx_quads_draw(p.x, p.y, size, size); - - i = particles[i].next_part; - } - gfx_quads_end(); - gfx_blend_normal(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.hpp deleted file mode 100644 index 6c466d941..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/particles.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include - -// particles -struct PARTICLE -{ - void set_default() - { - vel = vec2(0,0); - life_span = 0; - start_size = 32; - end_size = 32; - rot = 0; - rotspeed = 0; - gravity = 0; - friction = 0; - flow_affected = 1.0f; - color = vec4(1,1,1,1); - } - - vec2 pos; - vec2 vel; - - int spr; - - float flow_affected; - - float life_span; - - float start_size; - float end_size; - - float rot; - float rotspeed; - - float gravity; - float friction; - - vec4 color; - - // set by the particle system - float life; - int prev_part; - int next_part; -}; - -class PARTICLES : public COMPONENT -{ - friend class GAMECLIENT; -public: - enum - { - GROUP_PROJECTILE_TRAIL=0, - GROUP_EXPLOSIONS, - GROUP_GENERAL, - NUM_GROUPS - }; - - PARTICLES(); - - void add(int group, PARTICLE *part); - - virtual void on_reset(); - virtual void on_render(); - -private: - - enum - { - MAX_PARTICLES=1024*8, - }; - - PARTICLE particles[MAX_PARTICLES]; - int first_free; - int first_part[NUM_GROUPS]; - - void render_group(int group); - void update(float time_passed); - - template - class RENDER_GROUP : public COMPONENT - { - public: - PARTICLES *parts; - virtual void on_render() { parts->render_group(TGROUP); } - }; - - RENDER_GROUP render_trail; - RENDER_GROUP render_explosions; - RENDER_GROUP render_general; -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.cpp deleted file mode 100644 index af1700de6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.cpp +++ /dev/null @@ -1,494 +0,0 @@ -#include -#include -#include - -#include // get_angle -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "players.hpp" - -void PLAYERS::render_hand(TEE_RENDER_INFO *info, vec2 center_pos, vec2 dir, float angle_offset, vec2 post_rot_offset) -{ - // for drawing hand - //const skin *s = skin_get(skin_id); - - float basesize = 10.0f; - //dir = normalize(hook_pos-pos); - - vec2 hand_pos = center_pos + dir; - float angle = get_angle(dir); - if (dir.x < 0) - angle -= angle_offset; - else - angle += angle_offset; - - vec2 dirx = dir; - vec2 diry(-dir.y,dir.x); - - if (dir.x < 0) - diry = -diry; - - hand_pos += dirx * post_rot_offset.x; - hand_pos += diry * post_rot_offset.y; - - //gfx_texture_set(data->images[IMAGE_CHAR_DEFAULT].id); - gfx_texture_set(info->texture); - gfx_quads_begin(); - gfx_setcolor(info->color_body.r, info->color_body.g, info->color_body.b, info->color_body.a); - - // two passes - for (int i = 0; i < 2; i++) - { - bool outline = i == 0; - - select_sprite(outline?SPRITE_TEE_HAND_OUTLINE:SPRITE_TEE_HAND, 0, 0, 0); - gfx_quads_setrotation(angle); - gfx_quads_draw(hand_pos.x, hand_pos.y, 2*basesize, 2*basesize); - } - - gfx_quads_setrotation(0); - gfx_quads_end(); -} - -inline float normalize_angular(float f) -{ - return fmod(f+pi*2, pi*2); -} - -inline float angular_mix_direction(float src, float dst) { return sinf(dst-src) >0?1:-1; } -inline float angular_distance(float src, float dst) { return asinf(sinf(dst-src)); } - -inline float angular_approach(float src, float dst, float amount) -{ - float d = angular_mix_direction(src, dst); - float n = src + amount*d; - if(angular_mix_direction(n, dst) != d) - return dst; - return n; -} - -void PLAYERS::render_player( - const NETOBJ_CHARACTER *prev_char, - const NETOBJ_CHARACTER *player_char, - const NETOBJ_PLAYER_INFO *prev_info, - const NETOBJ_PLAYER_INFO *player_info - ) -{ - NETOBJ_CHARACTER prev; - NETOBJ_CHARACTER player; - prev = *prev_char; - player = *player_char; - - NETOBJ_PLAYER_INFO info = *player_info; - TEE_RENDER_INFO render_info = gameclient.clients[info.cid].render_info; - - // check for teamplay modes - bool is_teamplay = false; - bool new_tick = gameclient.new_tick; - if(gameclient.snap.gameobj) - is_teamplay = (gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) != 0; - - // check for ninja - if (player.weapon == WEAPON_NINJA) - { - // change the skin for the player to the ninja - int skin = gameclient.skins->find("x_ninja"); - if(skin != -1) - { - if(is_teamplay) - render_info.texture = gameclient.skins->get(skin)->color_texture; - else - { - render_info.texture = gameclient.skins->get(skin)->org_texture; - render_info.color_body = vec4(1,1,1,1); - render_info.color_feet = vec4(1,1,1,1); - } - } - } - - // set size - render_info.size = 64.0f; - - float intratick = client_intratick(); - - if(player.health < 0) // dont render dead players - return; - - float angle = mix((float)prev.angle, (float)player.angle, intratick)/256.0f; - - //float angle = 0; - - if(info.local && client_state() != CLIENTSTATE_DEMOPLAYBACK) - { - // just use the direct input if it's local player we are rendering - angle = get_angle(gameclient.controls->mouse_pos); - } - else - { - /* - float mixspeed = client_frametime()*2.5f; - if(player.attacktick != prev.attacktick) // shooting boosts the mixing speed - mixspeed *= 15.0f; - - // move the delta on a constant speed on a x^2 curve - float current = gameclient.clients[info.cid].angle; - float target = player.angle/256.0f; - float delta = angular_distance(current, target); - float sign = delta < 0 ? -1 : 1; - float new_delta = delta - 2*mixspeed*sqrt(delta*sign)*sign + mixspeed*mixspeed; - - // make sure that it doesn't vibrate when it's still - if(fabs(delta) < 2/256.0f) - angle = target; - else - angle = angular_approach(current, target, fabs(delta-new_delta)); - - gameclient.clients[info.cid].angle = angle;*/ - } - - // use preditect players if needed - if(info.local && config.cl_predict && client_state() != CLIENTSTATE_DEMOPLAYBACK) - { - if(!gameclient.snap.local_character || (gameclient.snap.local_character->health < 0) || (gameclient.snap.gameobj && gameclient.snap.gameobj->game_over)) - { - } - else - { - // apply predicted results - gameclient.predicted_char.write(&player); - gameclient.predicted_prev_char.write(&prev); - intratick = client_predintratick(); - new_tick = gameclient.new_predicted_tick; - } - } - - vec2 direction = get_direction((int)(angle*256.0f)); - vec2 position = mix(vec2(prev.x, prev.y), vec2(player.x, player.y), intratick); - vec2 vel = mix(vec2(prev.vx/256.0f, prev.vy/256.0f), vec2(player.vx/256.0f, player.vy/256.0f), intratick); - - gameclient.flow->add(position, vel*100.0f, 10.0f); - - render_info.got_airjump = player.jumped&2?0:1; - - - // detect events - if(new_tick) - { - // detect air jump - if(!render_info.got_airjump && !(prev.jumped&2)) - gameclient.effects->air_jump(position); - } - - if(prev.health < 0) // Don't flicker from previous position - position = vec2(player.x, player.y); - - bool stationary = player.vx <= 1 && player.vx >= -1; - bool inair = col_check_point(player.x, player.y+16) == 0; - bool want_other_dir = (player.direction == -1 && vel.x > 0) || (player.direction == 1 && vel.x < 0); - - // evaluate animation - float walk_time = fmod(position.x, 100.0f)/100.0f; - ANIMSTATE state; - state.set(&data->animations[ANIM_BASE], 0); - - if(inair) - state.add(&data->animations[ANIM_INAIR], 0, 1.0f); // TODO: some sort of time here - else if(stationary) - state.add(&data->animations[ANIM_IDLE], 0, 1.0f); // TODO: some sort of time here - else if(!want_other_dir) - state.add(&data->animations[ANIM_WALK], walk_time, 1.0f); - - if (player.weapon == WEAPON_HAMMER) - { - float ct = (client_prevtick()-player.attacktick)/(float)SERVER_TICK_SPEED + client_ticktime(); - state.add(&data->animations[ANIM_HAMMER_SWING], clamp(ct*5.0f,0.0f,1.0f), 1.0f); - } - if (player.weapon == WEAPON_NINJA) - { - float ct = (client_prevtick()-player.attacktick)/(float)SERVER_TICK_SPEED + client_ticktime(); - state.add(&data->animations[ANIM_NINJA_SWING], clamp(ct*2.0f,0.0f,1.0f), 1.0f); - } - - // do skidding - if(!inair && want_other_dir && length(vel*50) > 500.0f) - { - static int64 skid_sound_time = 0; - if(time_get()-skid_sound_time > time_freq()/10) - { - gameclient.sounds->play(SOUNDS::CHN_WORLD, SOUND_PLAYER_SKID, 0.25f, position); - skid_sound_time = time_get(); - } - - gameclient.effects->skidtrail( - position+vec2(-player.direction*6,12), - vec2(-player.direction*100*length(vel),-50) - ); - } - - // draw hook - if (prev.hook_state>0 && player.hook_state>0) - { - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - //gfx_quads_begin(); - - vec2 pos = position; - vec2 hook_pos; - - if(player_char->hooked_player != -1) - { - if(gameclient.snap.local_info && player_char->hooked_player == gameclient.snap.local_info->cid) - { - hook_pos = mix(vec2(gameclient.predicted_prev_char.pos.x, gameclient.predicted_prev_char.pos.y), - vec2(gameclient.predicted_char.pos.x, gameclient.predicted_char.pos.y), client_predintratick()); - } - else - hook_pos = mix(vec2(prev_char->hook_x, prev_char->hook_y), vec2(player_char->hook_x, player_char->hook_y), client_intratick()); - } - else - hook_pos = mix(vec2(prev.hook_x, prev.hook_y), vec2(player.hook_x, player.hook_y), intratick); - - float d = distance(pos, hook_pos); - vec2 dir = normalize(pos-hook_pos); - - gfx_quads_setrotation(get_angle(dir)+pi); - - // render head - select_sprite(SPRITE_HOOK_HEAD); - gfx_quads_draw(hook_pos.x, hook_pos.y, 24,16); - - // render chain - select_sprite(SPRITE_HOOK_CHAIN); - int i = 0; - for(float f = 24; f < d && i < 1024; f += 24, i++) - { - vec2 p = hook_pos + dir*f; - gfx_quads_draw(p.x, p.y,24,16); - } - - gfx_quads_setrotation(0); - gfx_quads_end(); - - render_hand(&render_info, position, normalize(hook_pos-pos), -pi/2, vec2(20, 0)); - } - - // draw gun - { - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - gfx_quads_setrotation(state.attach.angle*pi*2+angle); - - // normal weapons - int iw = clamp(player.weapon, 0, NUM_WEAPONS-1); - select_sprite(data->weapons.id[iw].sprite_body, direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0); - - vec2 dir = direction; - float recoil = 0.0f; - vec2 p; - if (player.weapon == WEAPON_HAMMER) - { - // Static position for hammer - p = position + vec2(state.attach.x, state.attach.y); - p.y += data->weapons.id[iw].offsety; - // if attack is under way, bash stuffs - if(direction.x < 0) - { - gfx_quads_setrotation(-pi/2-state.attach.angle*pi*2); - p.x -= data->weapons.id[iw].offsetx; - } - else - { - gfx_quads_setrotation(-pi/2+state.attach.angle*pi*2); - } - draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size); - } - else if (player.weapon == WEAPON_NINJA) - { - p = position; - p.y += data->weapons.id[iw].offsety; - - if(direction.x < 0) - { - gfx_quads_setrotation(-pi/2-state.attach.angle*pi*2); - p.x -= data->weapons.id[iw].offsetx; - gameclient.effects->powerupshine(p+vec2(32,0), vec2(32,12)); - } - else - { - gfx_quads_setrotation(-pi/2+state.attach.angle*pi*2); - gameclient.effects->powerupshine(p-vec2(32,0), vec2(32,12)); - } - draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size); - - // HADOKEN - if ((client_tick()-player.attacktick) <= (SERVER_TICK_SPEED / 6) && data->weapons.id[iw].num_sprite_muzzles) - { - int itex = rand() % data->weapons.id[iw].num_sprite_muzzles; - float alpha = 1.0f; - if (alpha > 0.0f && data->weapons.id[iw].sprite_muzzles[itex]) - { - vec2 dir = vec2(player_char->x,player_char->y) - vec2(prev_char->x, prev_char->y); - dir = normalize(dir); - float hadokenangle = get_angle(dir); - gfx_quads_setrotation(hadokenangle); - //float offsety = -data->weapons[iw].muzzleoffsety; - select_sprite(data->weapons.id[iw].sprite_muzzles[itex], 0); - vec2 diry(-dir.y,dir.x); - p = position; - float offsetx = data->weapons.id[iw].muzzleoffsetx; - p -= dir * offsetx; - draw_sprite(p.x, p.y, 160.0f); - } - } - } - else - { - // TODO: should be an animation - recoil = 0; - float a = (client_tick()-player.attacktick+intratick)/5.0f; - if(a < 1) - recoil = sinf(a*pi); - p = position + dir * data->weapons.id[iw].offsetx - dir*recoil*10.0f; - p.y += data->weapons.id[iw].offsety; - draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size); - } - - if (player.weapon == WEAPON_GUN || player.weapon == WEAPON_SHOTGUN) - { - // check if we're firing stuff - if(data->weapons.id[iw].num_sprite_muzzles)//prev.attackticks) - { - float alpha = 0.0f; - int phase1tick = (client_tick() - player.attacktick); - if (phase1tick < (data->weapons.id[iw].muzzleduration + 3)) - { - float t = ((((float)phase1tick) + intratick)/(float)data->weapons.id[iw].muzzleduration); - alpha = LERP(2.0, 0.0f, min(1.0f,max(0.0f,t))); - } - - int itex = rand() % data->weapons.id[iw].num_sprite_muzzles; - if (alpha > 0.0f && data->weapons.id[iw].sprite_muzzles[itex]) - { - float offsety = -data->weapons.id[iw].muzzleoffsety; - select_sprite(data->weapons.id[iw].sprite_muzzles[itex], direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0); - if(direction.x < 0) - offsety = -offsety; - - vec2 diry(-dir.y,dir.x); - vec2 muzzlepos = p + dir * data->weapons.id[iw].muzzleoffsetx + diry * offsety; - - draw_sprite(muzzlepos.x, muzzlepos.y, data->weapons.id[iw].visual_size); - } - } - } - gfx_quads_end(); - - switch (player.weapon) - { - case WEAPON_GUN: render_hand(&render_info, p, direction, -3*pi/4, vec2(-15, 4)); break; - case WEAPON_SHOTGUN: render_hand(&render_info, p, direction, -pi/2, vec2(-5, 4)); break; - case WEAPON_GRENADE: render_hand(&render_info, p, direction, -pi/2, vec2(-4, 7)); break; - } - - } - - // render the "shadow" tee - if(info.local && config.debug) - { - vec2 ghost_position = mix(vec2(prev_char->x, prev_char->y), vec2(player_char->x, player_char->y), client_intratick()); - TEE_RENDER_INFO ghost = render_info; - ghost.color_body.a = 0.5f; - ghost.color_feet.a = 0.5f; - render_tee(&state, &ghost, player.emote, direction, ghost_position); // render ghost - } - - render_info.size = 64.0f; // force some settings - render_info.color_body.a = 1.0f; - render_info.color_feet.a = 1.0f; - render_tee(&state, &render_info, player.emote, direction, position); - - if(player.player_state == PLAYERSTATE_CHATTING) - { - gfx_texture_set(data->images[IMAGE_EMOTICONS].id); - gfx_quads_begin(); - select_sprite(SPRITE_DOTDOT); - gfx_quads_draw(position.x + 24, position.y - 40, 64,64); - gfx_quads_end(); - } - - if (gameclient.clients[info.cid].emoticon_start != -1 && gameclient.clients[info.cid].emoticon_start + 2 * client_tickspeed() > client_tick()) - { - gfx_texture_set(data->images[IMAGE_EMOTICONS].id); - gfx_quads_begin(); - - int since_start = client_tick() - gameclient.clients[info.cid].emoticon_start; - int from_end = gameclient.clients[info.cid].emoticon_start + 2 * client_tickspeed() - client_tick(); - - float a = 1; - - if (from_end < client_tickspeed() / 5) - a = from_end / (client_tickspeed() / 5.0); - - float h = 1; - if (since_start < client_tickspeed() / 10) - h = since_start / (client_tickspeed() / 10.0); - - float wiggle = 0; - if (since_start < client_tickspeed() / 5) - wiggle = since_start / (client_tickspeed() / 5.0); - - float wiggle_angle = sin(5*wiggle); - - gfx_quads_setrotation(pi/6*wiggle_angle); - - gfx_setcolor(1.0f,1.0f,1.0f,a); - // client_datas::emoticon is an offset from the first emoticon - select_sprite(SPRITE_OOP + gameclient.clients[info.cid].emoticon); - gfx_quads_draw(position.x, position.y - 23 - 32*h, 64, 64*h); - gfx_quads_end(); - } -} - -void PLAYERS::on_render() -{ - // render other players in two passes, first pass we render the other, second pass we render our self - for(int p = 0; p < 2; p++) - { - for(int i = 0; i < MAX_CLIENTS; i++) - { - // only render active characters - if(!gameclient.snap.characters[i].active) - continue; - - const void *prev_info = snap_find_item(SNAP_PREV, NETOBJTYPE_PLAYER_INFO, i); - const void *info = snap_find_item(SNAP_CURRENT, NETOBJTYPE_PLAYER_INFO, i); - - if(prev_info && info) - { - // - bool local = ((const NETOBJ_PLAYER_INFO *)info)->local !=0; - if(p == 0 && local) continue; - if(p == 1 && !local) continue; - - NETOBJ_CHARACTER prev_char = gameclient.snap.characters[i].prev; - NETOBJ_CHARACTER cur_char = gameclient.snap.characters[i].cur; - - render_player( - &prev_char, - &cur_char, - (const NETOBJ_PLAYER_INFO *)prev_info, - (const NETOBJ_PLAYER_INFO *)info - ); - } - } - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.hpp deleted file mode 100644 index bdce91de3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/players.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -class PLAYERS : public COMPONENT -{ - void render_hand(class TEE_RENDER_INFO *info, vec2 center_pos, vec2 dir, float angle_offset, vec2 post_rot_offset); - void render_player( - const class NETOBJ_CHARACTER *prev_char, - const class NETOBJ_CHARACTER *player_char, - const class NETOBJ_PLAYER_INFO *prev_info, - const class NETOBJ_PLAYER_INFO *player_info - ); - -public: - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.cpp deleted file mode 100644 index dc1c42837..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.cpp +++ /dev/null @@ -1,314 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "scoreboard.hpp" - - -SCOREBOARD::SCOREBOARD() -{ - on_reset(); -} - -void SCOREBOARD::con_key_scoreboard(void *result, void *user_data) -{ - ((SCOREBOARD *)user_data)->active = console_arg_int(result, 0) != 0; -} - -void SCOREBOARD::on_reset() -{ - active = false; -} - -void SCOREBOARD::on_console_init() -{ - MACRO_REGISTER_COMMAND("+scoreboard", "", CFGFLAG_CLIENT, con_key_scoreboard, this, "Show scoreboard"); -} - -void SCOREBOARD::render_goals(float x, float y, float w) -{ - float h = 50.0f; - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(x-10.f, y-10.f, w, h, 10.0f); - gfx_quads_end(); - - // render goals - //y = ystart+h-54; - float tw = 0.0f; - if(gameclient.snap.gameobj && gameclient.snap.gameobj->score_limit) - { - char buf[64]; - str_format(buf, sizeof(buf), "Score Limit: %d", gameclient.snap.gameobj->score_limit); - gfx_text(0, x+20.0f, y, 22.0f, buf, -1); - tw += gfx_text_width(0, 22.0f, buf, -1); - } - if(gameclient.snap.gameobj && gameclient.snap.gameobj->time_limit) - { - char buf[64]; - str_format(buf, sizeof(buf), "Time Limit: %d min", gameclient.snap.gameobj->time_limit); - gfx_text(0, x+220.0f, y, 22.0f, buf, -1); - tw += gfx_text_width(0, 22.0f, buf, -1); - } - if(gameclient.snap.gameobj && gameclient.snap.gameobj->round_num && gameclient.snap.gameobj->round_current) - { - char buf[64]; - str_format(buf, sizeof(buf), "Round %d/%d", gameclient.snap.gameobj->round_current, gameclient.snap.gameobj->round_num); - gfx_text(0, x+450.0f, y, 22.0f, buf, -1); - - /*[48c3fd4c][game/scoreboard]: timelimit x:219.428558 - [48c3fd4c][game/scoreboard]: round x:453.142822*/ - } -} - -void SCOREBOARD::render_spectators(float x, float y, float w) -{ - char buffer[1024*4]; - int count = 0; - float h = 120.0f; - - str_copy(buffer, "Spectators: ", sizeof(buffer)); - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(x-10.f, y-10.f, w, h, 10.0f); - gfx_quads_end(); - - for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++) - { - SNAP_ITEM item; - const void *data = snap_get_item(SNAP_CURRENT, i, &item); - - if(item.type == NETOBJTYPE_PLAYER_INFO) - { - const NETOBJ_PLAYER_INFO *info = (const NETOBJ_PLAYER_INFO *)data; - if(info->team == -1) - { - if(count) - strcat(buffer, ", "); - strcat(buffer, gameclient.clients[info->cid].name); - count++; - } - } - } - - gfx_text(0, x+10, y, 32, buffer, (int)w-20); -} - -void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const char *title) -{ - //float ystart = y; - float h = 750.0f; - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(x-10.f, y-10.f, w, h, 17.0f); - gfx_quads_end(); - - // render title - if(!title) - { - if(gameclient.snap.gameobj->game_over) - title = "Game Over"; - else - title = "Score Board"; - } - - float tw = gfx_text_width(0, 48, title, -1); - - if(team == -1) - { - gfx_text(0, x+w/2-tw/2, y, 48, title, -1); - } - else - { - gfx_text(0, x+10, y, 48, title, -1); - - if(gameclient.snap.gameobj) - { - char buf[128]; - int score = team ? gameclient.snap.gameobj->teamscore_blue : gameclient.snap.gameobj->teamscore_red; - str_format(buf, sizeof(buf), "%d", score); - tw = gfx_text_width(0, 48, buf, -1); - gfx_text(0, x+w-tw-30, y, 48, buf, -1); - } - } - - y += 54.0f; - - // find players - const NETOBJ_PLAYER_INFO *players[MAX_CLIENTS] = {0}; - int num_players = 0; - for(int i = 0; i < snap_num_items(SNAP_CURRENT); i++) - { - SNAP_ITEM item; - const void *data = snap_get_item(SNAP_CURRENT, i, &item); - - if(item.type == NETOBJTYPE_PLAYER_INFO) - { - const NETOBJ_PLAYER_INFO *info = (const NETOBJ_PLAYER_INFO *)data; - if(info->team == team) - { - players[num_players] = info; - num_players++; - } - } - } - - // sort players - for(int k = 0; k < num_players; k++) // ffs, bubblesort - { - for(int i = 0; i < num_players-k-1; i++) - { - if(players[i]->score < players[i+1]->score) - { - const NETOBJ_PLAYER_INFO *tmp = players[i]; - players[i] = players[i+1]; - players[i+1] = tmp; - } - } - } - - // render headlines - gfx_text(0, x+10, y, 24.0f, "Score", -1); - gfx_text(0, x+125, y, 24.0f, "Name", -1); - gfx_text(0, x+w-70, y, 24.0f, "Ping", -1); - y += 29.0f; - - float font_size = 35.0f; - float line_height = 50.0f; - float tee_sizemod = 1.0f; - float tee_offset = 0.0f; - - if(num_players > 13) - { - font_size = 30.0f; - line_height = 40.0f; - tee_sizemod = 0.8f; - tee_offset = -5.0f; - } - - // render player scores - for(int i = 0; i < num_players; i++) - { - const NETOBJ_PLAYER_INFO *info = players[i]; - - // make sure that we render the correct team - - char buf[128]; - if(info->local) - { - // background so it's easy to find the local player - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(1,1,1,0.25f); - draw_round_rect(x, y, w-20, line_height*0.95f, 17.0f); - gfx_quads_end(); - } - - str_format(buf, sizeof(buf), "%4d", info->score); - gfx_text(0, x+60-gfx_text_width(0, font_size,buf,-1), y, font_size, buf, -1); - - gfx_text(0, x+128, y, font_size, gameclient.clients[info->cid].name, -1); - - str_format(buf, sizeof(buf), "%4d", info->latency); - float tw = gfx_text_width(0, font_size, buf, -1); - gfx_text(0, x+w-tw-35, y, font_size, buf, -1); - - // render avatar - if((gameclient.snap.flags[0] && gameclient.snap.flags[0]->carried_by == info->cid) || - (gameclient.snap.flags[1] && gameclient.snap.flags[1]->carried_by == info->cid)) - { - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GAME].id); - gfx_quads_begin(); - - if(info->team == 0) select_sprite(SPRITE_FLAG_BLUE, SPRITE_FLAG_FLIP_X); - else select_sprite(SPRITE_FLAG_RED, SPRITE_FLAG_FLIP_X); - - float size = 64.0f; - gfx_quads_drawTL(x+55, y-15, size/2, size); - gfx_quads_end(); - } - - TEE_RENDER_INFO teeinfo = gameclient.clients[info->cid].render_info; - teeinfo.size *= tee_sizemod; - render_tee(ANIMSTATE::get_idle(), &teeinfo, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28+tee_offset)); - - - y += line_height; - } -} - -void SCOREBOARD::on_render() -{ - bool do_scoreboard = false; - - // if we activly wanna look on the scoreboard - if(active) - do_scoreboard = true; - - if(gameclient.snap.local_info && gameclient.snap.local_info->team != -1) - { - // we are not a spectator, check if we are ead - if(!gameclient.snap.local_character || gameclient.snap.local_character->health < 0) - do_scoreboard = true; - } - - // if we the game is over - if(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over) - do_scoreboard = true; - - if(!do_scoreboard) - return; - - // if the score board is active, then we should clear the motd message aswell - if(active) - gameclient.motd->clear(); - - - float width = 400*3.0f*gfx_screenaspect(); - float height = 400*3.0f; - - gfx_mapscreen(0, 0, width, height); - - float w = 650.0f; - - if(gameclient.snap.gameobj && !(gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS)) - { - render_scoreboard(width/2-w/2, 150.0f, w, 0, 0); - //render_scoreboard(gameobj, 0, 0, -1, 0); - } - else - { - - if(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over) - { - const char *text = "DRAW!"; - if(gameclient.snap.gameobj->teamscore_red > gameclient.snap.gameobj->teamscore_blue) - text = "Red Team Wins!"; - else if(gameclient.snap.gameobj->teamscore_blue > gameclient.snap.gameobj->teamscore_red) - text = "Blue Team Wins!"; - - float w = gfx_text_width(0, 92.0f, text, -1); - gfx_text(0, width/2-w/2, 45, 92.0f, text, -1); - } - - render_scoreboard(width/2-w-20, 150.0f, w, 0, "Red Team"); - render_scoreboard(width/2 + 20, 150.0f, w, 1, "Blue Team"); - } - - render_goals(width/2-w/2, 150+750+25, w); - render_spectators(width/2-w/2, 150+750+25+50+25, w); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.hpp deleted file mode 100644 index 222dab9da..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/scoreboard.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -class SCOREBOARD : public COMPONENT -{ - void render_goals(float x, float y, float w); - void render_spectators(float x, float y, float w); - void render_scoreboard(float x, float y, float w, int team, const char *title); - - static void con_key_scoreboard(void *result, void *user_data); - - bool active; - -public: - SCOREBOARD(); - virtual void on_reset(); - virtual void on_console_init(); - virtual void on_render(); -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.cpp deleted file mode 100644 index 451a77f33..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include -#include - -#include - -extern "C" -{ - #include -} - -#include "skins.hpp" - -SKINS::SKINS() -{ - num_skins = 0; -} - -void SKINS::skinscan(const char *name, int is_dir, void *user) -{ - SKINS *self = (SKINS *)user; - int l = strlen(name); - if(l < 4 || is_dir || self->num_skins == MAX_SKINS) - return; - if(strcmp(name+l-4, ".png") != 0) - return; - - char buf[512]; - str_format(buf, sizeof(buf), "skins/%s", name); - IMAGE_INFO info; - if(!gfx_load_png(&info, buf)) - { - dbg_msg("game", "failed to load skin from %s", name); - return; - } - - self->skins[self->num_skins].org_texture = gfx_load_texture_raw(info.width, info.height, info.format, info.data, info.format, 0); - - int body_size = 96; // body size - unsigned char *d = (unsigned char *)info.data; - int pitch = info.width*4; - - // dig out blood color - { - int colors[3] = {0}; - for(int y = 0; y < body_size; y++) - for(int x = 0; x < body_size; x++) - { - if(d[y*pitch+x*4+3] > 128) - { - colors[0] += d[y*pitch+x*4+0]; - colors[1] += d[y*pitch+x*4+1]; - colors[2] += d[y*pitch+x*4+2]; - } - } - - self->skins[self->num_skins].blood_color = normalize(vec3(colors[0], colors[1], colors[2])); - } - - // create colorless version - int step = info.format == IMG_RGBA ? 4 : 3; - - // make the texture gray scale - for(int i = 0; i < info.width*info.height; i++) - { - int v = (d[i*step]+d[i*step+1]+d[i*step+2])/3; - d[i*step] = v; - d[i*step+1] = v; - d[i*step+2] = v; - } - - - if(1) - { - int freq[256] = {0}; - int org_weight = 0; - int new_weight = 192; - - // find most common frequence - for(int y = 0; y < body_size; y++) - for(int x = 0; x < body_size; x++) - { - if(d[y*pitch+x*4+3] > 128) - freq[d[y*pitch+x*4]]++; - } - - for(int i = 1; i < 256; i++) - { - if(freq[org_weight] < freq[i]) - org_weight = i; - } - - // reorder - int inv_org_weight = 255-org_weight; - int inv_new_weight = 255-new_weight; - for(int y = 0; y < body_size; y++) - for(int x = 0; x < body_size; x++) - { - int v = d[y*pitch+x*4]; - if(v <= org_weight) - v = (int)(((v/(float)org_weight) * new_weight)); - else - v = (int)(((v-org_weight)/(float)inv_org_weight)*inv_new_weight + new_weight); - d[y*pitch+x*4] = v; - d[y*pitch+x*4+1] = v; - d[y*pitch+x*4+2] = v; - } - } - - self->skins[self->num_skins].color_texture = gfx_load_texture_raw(info.width, info.height, info.format, info.data, info.format, 0); - mem_free(info.data); - - // set skin data - strncpy(self->skins[self->num_skins].name, name, min((int)sizeof(self->skins[self->num_skins].name),l-4)); - dbg_msg("game", "load skin %s", self->skins[self->num_skins].name); - self->num_skins++; -} - - -void SKINS::init() -{ - // load skins - num_skins = 0; - engine_listdir(LISTDIRTYPE_ALL, "skins", skinscan, this); -} - -int SKINS::num() -{ - return num_skins; -} - -const SKINS::SKIN *SKINS::get(int index) -{ - return &skins[index%num_skins]; -} - -int SKINS::find(const char *name) -{ - for(int i = 0; i < num_skins; i++) - { - if(strcmp(skins[i].name, name) == 0) - return i; - } - return -1; -} - -// these converter functions were nicked from some random internet pages -static float hue_to_rgb(float v1, float v2, float h) -{ - if(h < 0) h += 1; - if(h > 1) h -= 1; - if((6 * h) < 1) return v1 + ( v2 - v1 ) * 6 * h; - if((2 * h) < 1) return v2; - if((3 * h) < 2) return v1 + ( v2 - v1 ) * ((2.0f/3.0f) - h) * 6; - return v1; -} - -static vec3 hsl_to_rgb(vec3 in) -{ - float v1, v2; - vec3 out; - - if(in.s == 0) - { - out.r = in.l; - out.g = in.l; - out.b = in.l; - } - else - { - if(in.l < 0.5f) - v2 = in.l * (1 + in.s); - else - v2 = (in.l+in.s) - (in.s*in.l); - - v1 = 2 * in.l - v2; - - out.r = hue_to_rgb(v1, v2, in.h + (1.0f/3.0f)); - out.g = hue_to_rgb(v1, v2, in.h); - out.b = hue_to_rgb(v1, v2, in.h - (1.0f/3.0f)); - } - - return out; -} - -vec4 SKINS::get_color(int v) -{ - vec3 r = hsl_to_rgb(vec3((v>>16)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f)); - return vec4(r.r, r.g, r.b, 1.0f); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.hpp deleted file mode 100644 index 078fd71d9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/skins.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -class SKINS : public COMPONENT -{ -public: - // do this better and nicer - typedef struct - { - int org_texture; - int color_texture; - char name[31]; - char term[1]; - vec3 blood_color; - } SKIN; - - SKINS(); - - void init(); - - vec4 get_color(int v); - int num(); - const SKIN *get(int index); - int find(const char *name); - -private: - enum - { - MAX_SKINS=256, - }; - - SKIN skins[MAX_SKINS]; - int num_skins; - - static void skinscan(const char *name, int is_dir, void *user); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.cpp deleted file mode 100644 index dfa7e31b9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include "sounds.hpp" - -void SOUNDS::on_init() -{ - // setup sound channels - snd_set_channel(SOUNDS::CHN_GUI, 1.0f, 0.0f); - snd_set_channel(SOUNDS::CHN_MUSIC, 1.0f, 0.0f); - snd_set_channel(SOUNDS::CHN_WORLD, 0.9f, 1.0f); - snd_set_channel(SOUNDS::CHN_GLOBAL, 1.0f, 0.0f); - - snd_set_listener_pos(0.0f, 0.0f); -} - -void SOUNDS::on_render() -{ - // set listner pos - snd_set_listener_pos(gameclient.camera->center.x, gameclient.camera->center.y); -} - -void SOUNDS::play_and_record(int chn, int setid, float vol, vec2 pos) -{ - NETMSG_SV_SOUNDGLOBAL msg; - msg.soundid = setid; - msg.pack(MSGFLAG_NOSEND|MSGFLAG_RECORD); - client_send_msg(); - - play(chn, setid, vol, pos); -} - -void SOUNDS::play(int chn, int setid, float vol, vec2 pos) -{ - SOUNDSET *set = &data->sounds[setid]; - - if(!set->num_sounds) - return; - - if(set->num_sounds == 1) - { - snd_play_at(chn, set->sounds[0].id, 0, pos.x, pos.y); - return; - } - - // play a random one - int id; - do { - id = rand() % set->num_sounds; - } while(id == set->last); - snd_play_at(chn, set->sounds[id].id, 0, pos.x, pos.y); - set->last = id; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.hpp deleted file mode 100644 index 95ddb1ecc..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/sounds.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -class SOUNDS : public COMPONENT -{ -public: - // sound channels - enum - { - CHN_GUI=0, - CHN_MUSIC, - CHN_WORLD, - CHN_GLOBAL, - }; - - virtual void on_init(); - virtual void on_render(); - - void play(int chn, int setid, float vol, vec2 pos); - void play_and_record(int chn, int setid, float vol, vec2 pos); -}; - - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.cpp deleted file mode 100644 index 190ba2246..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include -#include -#include -#include -//#include -#include "voting.hpp" - -void VOTING::con_callvote(void *result, void *user_data) -{ - VOTING *self = (VOTING*)user_data; - self->callvote(console_arg_string(result, 0), console_arg_string(result, 1)); -} - -void VOTING::con_vote(void *result, void *user_data) -{ - VOTING *self = (VOTING *)user_data; - if(str_comp_nocase(console_arg_string(result, 0), "yes") == 0) - self->vote(1); - else if(str_comp_nocase(console_arg_string(result, 0), "no") == 0) - self->vote(-1); -} - -void VOTING::callvote(const char *type, const char *value) -{ - NETMSG_CL_CALLVOTE msg = {0}; - msg.type = type; - msg.value = value; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} - -void VOTING::callvote_kick(int client_id) -{ - char buf[32]; - str_format(buf, sizeof(buf), "%d", client_id); - callvote("kick", buf); -} - -void VOTING::callvote_option(int option_id) -{ - VOTEOPTION *option = this->first; - while(option && option_id >= 0) - { - if(option_id == 0) - { - callvote("option", option->command); - break; - } - - option_id--; - option = option->next; - } -} - -void VOTING::vote(int v) -{ - NETMSG_CL_VOTE msg = {v}; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} - -VOTING::VOTING() -{ - heap = 0; - clearoptions(); - on_reset(); -} - - -void VOTING::clearoptions() -{ - if(heap) - memheap_destroy(heap); - heap = memheap_create(); - - first = 0; - last = 0; -} - -void VOTING::on_reset() -{ - closetime = 0; - description[0] = 0; - command[0] = 0; - yes = no = pass = total = 0; - voted = 0; -} - -void VOTING::on_console_init() -{ - MACRO_REGISTER_COMMAND("callvote", "sr", CFGFLAG_CLIENT, con_callvote, this, "Call vote"); - MACRO_REGISTER_COMMAND("vote", "r", CFGFLAG_CLIENT, con_vote, this, "Vote yes/no"); -} - -void VOTING::on_message(int msgtype, void *rawmsg) -{ - if(msgtype == NETMSGTYPE_SV_VOTE_SET) - { - NETMSG_SV_VOTE_SET *msg = (NETMSG_SV_VOTE_SET *)rawmsg; - if(msg->timeout) - { - on_reset(); - str_copy(description, msg->description, sizeof(description)); - str_copy(command, msg->command, sizeof(description)); - closetime = time_get() + time_freq() * msg->timeout; - } - else - on_reset(); - } - else if(msgtype == NETMSGTYPE_SV_VOTE_STATUS) - { - NETMSG_SV_VOTE_STATUS *msg = (NETMSG_SV_VOTE_STATUS *)rawmsg; - yes = msg->yes; - no = msg->no; - pass = msg->pass; - total = msg->total; - } - else if(msgtype == NETMSGTYPE_SV_VOTE_CLEAROPTIONS) - { - clearoptions(); - } - else if(msgtype == NETMSGTYPE_SV_VOTE_OPTION) - { - NETMSG_SV_VOTE_OPTION *msg = (NETMSG_SV_VOTE_OPTION *)rawmsg; - int len = str_length(msg->command); - - VOTEOPTION *option = (VOTEOPTION *)memheap_allocate(heap, sizeof(VOTEOPTION) + len); - option->next = 0; - option->prev = last; - if(option->prev) - option->prev->next = option; - last = option; - if(!first) - first = option; - - mem_copy(option->command, msg->command, len+1); - - } -} - -void VOTING::on_render() -{ -} - - -void VOTING::render_bars(RECT bars, bool text) -{ - ui_draw_rect(&bars, vec4(0.8f,0.8f,0.8f,0.5f), CORNER_ALL, bars.h/3); - - RECT splitter = bars; - splitter.x = splitter.x+splitter.w/2; - splitter.w = splitter.h/2.0f; - splitter.x -= splitter.w/2; - ui_draw_rect(&splitter, vec4(0.4f,0.4f,0.4f,0.5f), CORNER_ALL, splitter.h/4); - - if(total) - { - RECT pass_area = bars; - if(yes) - { - RECT yes_area = bars; - yes_area.w *= yes/(float)total; - ui_draw_rect(&yes_area, vec4(0.2f,0.9f,0.2f,0.85f), CORNER_ALL, bars.h/3); - - if(text) - { - char buf[256]; - str_format(buf, sizeof(buf), "%d", yes); - ui_do_label(&yes_area, buf, bars.h*0.75f, 0); - } - - pass_area.x += yes_area.w; - pass_area.w -= yes_area.w; - } - - if(no) - { - RECT no_area = bars; - no_area.w *= no/(float)total; - no_area.x = (bars.x + bars.w)-no_area.w; - ui_draw_rect(&no_area, vec4(0.9f,0.2f,0.2f,0.85f), CORNER_ALL, bars.h/3); - - if(text) - { - char buf[256]; - str_format(buf, sizeof(buf), "%d", no); - ui_do_label(&no_area, buf, bars.h*0.75f, 0); - } - - pass_area.w -= no_area.w; - } - - if(text && pass) - { - char buf[256]; - str_format(buf, sizeof(buf), "%d", pass); - ui_do_label(&pass_area, buf, bars.h*0.75f, 0); - } - } -} - - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.hpp deleted file mode 100644 index 3341edea2..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/components/voting.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -extern "C" -{ - #include -} - -class VOTING : public COMPONENT -{ - HEAP *heap; - - static void con_callvote(void *result, void *user_data); - static void con_vote(void *result, void *user_data); - - int64 closetime; - char description[512]; - char command[512]; - int voted; - - void clearoptions(); - void callvote(const char *type, const char *value); - -public: - - struct VOTEOPTION - { - VOTEOPTION *next; - VOTEOPTION *prev; - char command[1]; - }; - VOTEOPTION *first; - VOTEOPTION *last; - - VOTING(); - virtual void on_reset(); - virtual void on_console_init(); - virtual void on_message(int msgtype, void *rawmsg); - virtual void on_render(); - - void render_bars(RECT bars, bool text); - - void callvote_kick(int client_id); - void callvote_option(int option); - - void vote(int v); // -1 = no, 1 = yes - - int seconds_left() { return (closetime - time_get())/time_freq(); } - bool is_voting() { return closetime != 0; } - int taken_choice() const { return voted; } - const char *vote_description() const { return description; } - const char *vote_command() const { return command; } - - int yes, no, pass, total; -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.cpp deleted file mode 100644 index a8a62ddfe..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.cpp +++ /dev/null @@ -1,890 +0,0 @@ -#include -#include -#include - -#include -#include - -#include -#include "render.hpp" - -#include "gameclient.hpp" - -#include "components/binds.hpp" -#include "components/broadcast.hpp" -#include "components/camera.hpp" -#include "components/chat.hpp" -#include "components/console.hpp" -#include "components/controls.hpp" -#include "components/damageind.hpp" -#include "components/debughud.hpp" -#include "components/effects.hpp" -#include "components/emoticon.hpp" -#include "components/flow.hpp" -#include "components/hud.hpp" -#include "components/items.hpp" -#include "components/killmessages.hpp" -#include "components/mapimages.hpp" -#include "components/maplayers.hpp" -#include "components/menus.hpp" -#include "components/motd.hpp" -#include "components/particles.hpp" -#include "components/players.hpp" -#include "components/nameplates.hpp" -#include "components/scoreboard.hpp" -#include "components/skins.hpp" -#include "components/sounds.hpp" -#include "components/voting.hpp" - -GAMECLIENT gameclient; - -// instanciate all systems -static KILLMESSAGES killmessages; -static CAMERA camera; -static CHAT chat; -static MOTD motd; -static BROADCAST broadcast; -static CONSOLE console; -static BINDS binds; -static PARTICLES particles; -static MENUS menus; -static SKINS skins; -static FLOW flow; -static HUD hud; -static DEBUGHUD debughud; -static CONTROLS controls; -static EFFECTS effects; -static SCOREBOARD scoreboard; -static SOUNDS sounds; -static EMOTICON emoticon; -static DAMAGEIND damageind; -static VOTING voting; - -static PLAYERS players; -static NAMEPLATES nameplates; -static ITEMS items; -static MAPIMAGES mapimages; - -static MAPLAYERS maplayers_background(MAPLAYERS::TYPE_BACKGROUND); -static MAPLAYERS maplayers_foreground(MAPLAYERS::TYPE_FOREGROUND); - -GAMECLIENT::STACK::STACK() { num = 0; } -void GAMECLIENT::STACK::add(class COMPONENT *component) { components[num++] = component; } - -static int load_current; -static int load_total; - -static void load_sounds_thread(void *do_render) -{ - // load sounds - for(int s = 0; s < data->num_sounds; s++) - { - if(do_render) - gameclient.menus->render_loading(load_current/(float)load_total); - for(int i = 0; i < data->sounds[s].num_sounds; i++) - { - int id = snd_load_wv(data->sounds[s].sounds[i].filename); - data->sounds[s].sounds[i].id = id; - } - - if(do_render) - load_current++; - } -} - -static void con_serverdummy(void *result, void *user_data) -{ - dbg_msg("client", "this command is not available on the client"); -} - -void GAMECLIENT::on_console_init() -{ - // setup pointers - binds = &::binds; - console = &::console; - particles = &::particles; - menus = &::menus; - skins = &::skins; - chat = &::chat; - flow = &::flow; - camera = &::camera; - controls = &::controls; - effects = &::effects; - sounds = &::sounds; - motd = &::motd; - damageind = &::damageind; - mapimages = &::mapimages; - voting = &::voting; - - // make a list of all the systems, make sure to add them in the corrent render order - all.add(skins); - all.add(mapimages); - all.add(effects); // doesn't render anything, just updates effects - all.add(particles); - all.add(binds); - all.add(controls); - all.add(camera); - all.add(sounds); - all.add(voting); - all.add(particles); // doesn't render anything, just updates all the particles - - all.add(&maplayers_background); // first to render - all.add(&particles->render_trail); - all.add(&particles->render_explosions); - all.add(&items); - all.add(&players); - all.add(&maplayers_foreground); - all.add(&nameplates); - all.add(&particles->render_general); - all.add(damageind); - all.add(&hud); - all.add(&emoticon); - all.add(&killmessages); - all.add(chat); - all.add(&broadcast); - all.add(&debughud); - all.add(&scoreboard); - all.add(motd); - all.add(menus); - all.add(console); - - // build the input stack - input.add(&menus->binder); // this will take over all input when we want to bind a key - input.add(&binds->special_binds); - input.add(console); - input.add(chat); // chat has higher prio due to tha you can quit it by pressing esc - input.add(motd); // for pressing esc to remove it - input.add(menus); - input.add(&emoticon); - input.add(controls); - input.add(binds); - - // add the some console commands - MACRO_REGISTER_COMMAND("team", "i", CFGFLAG_CLIENT, con_team, this, "Switch team"); - MACRO_REGISTER_COMMAND("kill", "", CFGFLAG_CLIENT, con_kill, this, "Kill yourself"); - - // register server dummy commands for tab completion - MACRO_REGISTER_COMMAND("tune", "si", CFGFLAG_SERVER, con_serverdummy, 0, "Tune variable to value"); - MACRO_REGISTER_COMMAND("tune_reset", "", CFGFLAG_SERVER, con_serverdummy, 0, "Reset tuning"); - MACRO_REGISTER_COMMAND("tune_dump", "", CFGFLAG_SERVER, con_serverdummy, 0, "Dump tuning"); - MACRO_REGISTER_COMMAND("change_map", "r", CFGFLAG_SERVER, con_serverdummy, 0, "Change map"); - MACRO_REGISTER_COMMAND("restart", "?i", CFGFLAG_SERVER, con_serverdummy, 0, "Restart in x seconds"); - MACRO_REGISTER_COMMAND("broadcast", "r", CFGFLAG_SERVER, con_serverdummy, 0, "Broadcast message"); - /*MACRO_REGISTER_COMMAND("say", "r", CFGFLAG_SERVER, con_serverdummy, 0);*/ - MACRO_REGISTER_COMMAND("set_team", "ii", CFGFLAG_SERVER, con_serverdummy, 0, "Set team of player to team"); - MACRO_REGISTER_COMMAND("addvote", "r", CFGFLAG_SERVER, con_serverdummy, 0, "Add a voting option"); - /*MACRO_REGISTER_COMMAND("vote", "", CFGFLAG_SERVER, con_serverdummy, 0);*/ - - // let all the other components register their console commands - for(int i = 0; i < all.num; i++) - all.components[i]->on_console_init(); - - // - suppress_events = false; -} - -void GAMECLIENT::on_init() -{ - // init all components - for(int i = 0; i < all.num; i++) - all.components[i]->on_init(); - - // setup item sizes - for(int i = 0; i < NUM_NETOBJTYPES; i++) - snap_set_staticsize(i, netobj_get_size(i)); - - // load default font - static FONT_SET default_font; - int64 start = time_get(); - - int before = gfx_memory_usage(); - font_set_load(&default_font, "fonts/default_font%d.tfnt", "fonts/default_font%d.png", "fonts/default_font%d_b.png", 14, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 36); - dbg_msg("font", "gfx memory used for font textures: %d", gfx_memory_usage()-before); - - gfx_text_set_default_font(&default_font); - - config.cl_threadsoundloading = 0; - - // setup load amount - load_total = data->num_images; - load_current = 0; - if(!config.cl_threadsoundloading) - load_total += data->num_sounds; - - // load textures - for(int i = 0; i < data->num_images; i++) - { - gameclient.menus->render_loading(load_current/load_total); - data->images[i].id = gfx_load_texture(data->images[i].filename, IMG_AUTO, 0); - load_current++; - } - - ::skins.init(); - - if(config.cl_threadsoundloading) - thread_create(load_sounds_thread, 0); - else - load_sounds_thread((void*)1); - - for(int i = 0; i < all.num; i++) - all.components[i]->on_reset(); - - int64 end = time_get(); - dbg_msg("", "%f.2ms", ((end-start)*1000)/(float)time_freq()); - - servermode = SERVERMODE_PURE; -} - -void GAMECLIENT::on_save() -{ - for(int i = 0; i < all.num; i++) - all.components[i]->on_save(); -} - -void GAMECLIENT::dispatch_input() -{ - // handle mouse movement - int x=0, y=0; -#ifdef ANDROID - // No relative mouse here, we've got touchscreen - inp_mouse_absolute(&x, &y); -#else - inp_mouse_relative(&x, &y); - if(x || y) -#endif - { - for(int h = 0; h < input.num; h++) - { - if(input.components[h]->on_mousemove(x, y)) - break; - } - } - - // handle key presses - for(int i = 0; i < inp_num_events(); i++) - { - INPUT_EVENT e = inp_get_event(i); - - for(int h = 0; h < input.num; h++) - { - if(input.components[h]->on_input(e)) - { - //dbg_msg("", "%d char=%d key=%d flags=%d", h, e.ch, e.key, e.flags); - break; - } - } - } - - // clear all events for this frame - inp_clear_events(); -} - - -int GAMECLIENT::on_snapinput(int *data) -{ - return controls->snapinput(data); -} - -void GAMECLIENT::on_connected() -{ - layers_init(); - col_init(); - render_tilemap_generate_skip(); - - for(int i = 0; i < all.num; i++) - { - all.components[i]->on_mapload(); - all.components[i]->on_reset(); - } - - SERVER_INFO current_server_info; - client_serverinfo(¤t_server_info); - - servermode = SERVERMODE_PURE; - - // send the inital info - send_info(true); -} - -void GAMECLIENT::on_reset() -{ - // clear out the invalid pointers - last_new_predicted_tick = -1; - mem_zero(&gameclient.snap, sizeof(gameclient.snap)); - - for(int i = 0; i < MAX_CLIENTS; i++) - { - clients[i].name[0] = 0; - clients[i].skin_id = 0; - clients[i].team = 0; - clients[i].angle = 0; - clients[i].emoticon = 0; - clients[i].emoticon_start = -1; - clients[i].skin_info.texture = gameclient.skins->get(0)->color_texture; - clients[i].skin_info.color_body = vec4(1,1,1,1); - clients[i].skin_info.color_feet = vec4(1,1,1,1); - clients[i].update_render_info(); - } - - for(int i = 0; i < all.num; i++) - all.components[i]->on_reset(); -} - - -void GAMECLIENT::update_local_character_pos() -{ - if(config.cl_predict && client_state() != CLIENTSTATE_DEMOPLAYBACK) - { - if(!snap.local_character || (snap.local_character->health < 0) || (snap.gameobj && snap.gameobj->game_over)) - { - // don't use predicted - } - else - local_character_pos = mix(predicted_prev_char.pos, predicted_char.pos, client_predintratick()); - } - else if(snap.local_character && snap.local_prev_character) - { - local_character_pos = mix( - vec2(snap.local_prev_character->x, snap.local_prev_character->y), - vec2(snap.local_character->x, snap.local_character->y), client_intratick()); - } -} - - -static void evolve(NETOBJ_CHARACTER *character, int tick) -{ - WORLD_CORE tempworld; - CHARACTER_CORE tempcore; - mem_zero(&tempcore, sizeof(tempcore)); - tempcore.world = &tempworld; - tempcore.read(character); - - while(character->tick < tick) - { - character->tick++; - tempcore.tick(false); - tempcore.move(); - tempcore.quantize(); - } - - tempcore.write(character); -} - - -void GAMECLIENT::on_render() -{ - // update the local character position - update_local_character_pos(); - - // dispatch all input to systems - dispatch_input(); - - // render all systems - for(int i = 0; i < all.num; i++) - all.components[i]->on_render(); - - // clear new tick flags - new_tick = false; - new_predicted_tick = false; -} - -void GAMECLIENT::on_message(int msgtype) -{ - - // special messages - if(msgtype == NETMSGTYPE_SV_EXTRAPROJECTILE) - { - /* - int num = msg_unpack_int(); - - for(int k = 0; k < num; k++) - { - NETOBJ_PROJECTILE proj; - for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++) - ((int *)&proj)[i] = msg_unpack_int(); - - if(msg_unpack_error()) - return; - - if(extraproj_num != MAX_EXTRA_PROJECTILES) - { - extraproj_projectiles[extraproj_num] = proj; - extraproj_num++; - } - } - - return;*/ - } - else if(msgtype == NETMSGTYPE_SV_TUNEPARAMS) - { - // unpack the new tuning - TUNING_PARAMS new_tuning; - int *params = (int *)&new_tuning; - for(unsigned i = 0; i < sizeof(TUNING_PARAMS)/sizeof(int); i++) - params[i] = msg_unpack_int(); - - // check for unpacking errors - if(msg_unpack_error()) - return; - - servermode = SERVERMODE_PURE; - - // apply new tuning - tuning = new_tuning; - return; - } - - void *rawmsg = netmsg_secure_unpack(msgtype); - if(!rawmsg) - { - dbg_msg("client", "dropped weird message '%s' (%d), failed on '%s'", netmsg_get_name(msgtype), msgtype, netmsg_failed_on()); - return; - } - - // TODO: this should be done smarter - for(int i = 0; i < all.num; i++) - all.components[i]->on_message(msgtype, rawmsg); - - if(msgtype == NETMSGTYPE_SV_READYTOENTER) - { - client_entergame(); - } - else if (msgtype == NETMSGTYPE_SV_EMOTICON) - { - NETMSG_SV_EMOTICON *msg = (NETMSG_SV_EMOTICON *)rawmsg; - - // apply - clients[msg->cid].emoticon = msg->emoticon; - clients[msg->cid].emoticon_start = client_tick(); - } - else if(msgtype == NETMSGTYPE_SV_SOUNDGLOBAL) - { - if(suppress_events) - return; - - NETMSG_SV_SOUNDGLOBAL *msg = (NETMSG_SV_SOUNDGLOBAL *)rawmsg; - gameclient.sounds->play(SOUNDS::CHN_GLOBAL, msg->soundid, 1.0f, vec2(0,0)); - } -} - -void GAMECLIENT::on_statechange(int new_state, int old_state) -{ - if(demorec_isrecording()) - demorec_record_stop(); - - // reset everything - on_reset(); - - // then change the state - for(int i = 0; i < all.num; i++) - all.components[i]->on_statechange(new_state, old_state); -} - - - -void GAMECLIENT::process_events() -{ - if(suppress_events) - return; - - int snaptype = SNAP_CURRENT; - int num = snap_num_items(snaptype); - for(int index = 0; index < num; index++) - { - SNAP_ITEM item; - const void *data = snap_get_item(snaptype, index, &item); - - if(item.type == NETEVENTTYPE_DAMAGEIND) - { - NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)data; - gameclient.effects->damage_indicator(vec2(ev->x, ev->y), get_direction(ev->angle)); - } - else if(item.type == NETEVENTTYPE_EXPLOSION) - { - NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)data; - gameclient.effects->explosion(vec2(ev->x, ev->y)); - } - else if(item.type == NETEVENTTYPE_HAMMERHIT) - { - NETEVENT_HAMMERHIT *ev = (NETEVENT_HAMMERHIT *)data; - gameclient.effects->hammerhit(vec2(ev->x, ev->y)); - } - else if(item.type == NETEVENTTYPE_SPAWN) - { - NETEVENT_SPAWN *ev = (NETEVENT_SPAWN *)data; - gameclient.effects->playerspawn(vec2(ev->x, ev->y)); - } - else if(item.type == NETEVENTTYPE_DEATH) - { - NETEVENT_DEATH *ev = (NETEVENT_DEATH *)data; - gameclient.effects->playerdeath(vec2(ev->x, ev->y), ev->cid); - } - else if(item.type == NETEVENTTYPE_SOUNDWORLD) - { - NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)data; - gameclient.sounds->play(SOUNDS::CHN_WORLD, ev->soundid, 1.0f, vec2(ev->x, ev->y)); - } - } -} - -void GAMECLIENT::on_snapshot() -{ - new_tick = true; - - // clear out the invalid pointers - mem_zero(&gameclient.snap, sizeof(gameclient.snap)); - snap.local_cid = -1; - - // secure snapshot - { - int num = snap_num_items(SNAP_CURRENT); - for(int index = 0; index < num; index++) - { - SNAP_ITEM item; - void *data = snap_get_item(SNAP_CURRENT, index, &item); - if(netobj_validate(item.type, data, item.datasize) != 0) - { - if(config.debug) - dbg_msg("game", "invalidated index=%d type=%d (%s) size=%d id=%d", index, item.type, netobj_get_name(item.type), item.datasize, item.id); - snap_invalidate_item(SNAP_CURRENT, index); - } - } - } - - process_events(); - - if(config.dbg_stress) - { - if((client_tick()%100) == 0) - { - char message[64]; - int msglen = rand()%(sizeof(message)-1); - for(int i = 0; i < msglen; i++) - message[i] = 'a'+(rand()%('z'-'a')); - message[msglen] = 0; - - NETMSG_CL_SAY msg; - msg.team = rand()&1; - msg.message = message; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); - } - } - - // go trough all the items in the snapshot and gather the info we want - { - snap.team_size[0] = snap.team_size[1] = 0; - - int num = snap_num_items(SNAP_CURRENT); - for(int i = 0; i < num; i++) - { - SNAP_ITEM item; - const void *data = snap_get_item(SNAP_CURRENT, i, &item); - - if(item.type == NETOBJTYPE_CLIENT_INFO) - { - const NETOBJ_CLIENT_INFO *info = (const NETOBJ_CLIENT_INFO *)data; - int cid = item.id; - ints_to_str(&info->name0, 6, clients[cid].name); - ints_to_str(&info->skin0, 6, clients[cid].skin_name); - - clients[cid].use_custom_color = info->use_custom_color; - clients[cid].color_body = info->color_body; - clients[cid].color_feet = info->color_feet; - - // prepare the info - if(clients[cid].skin_name[0] == 'x' || clients[cid].skin_name[1] == '_') - str_copy(clients[cid].skin_name, "default", 64); - - clients[cid].skin_info.color_body = skins->get_color(clients[cid].color_body); - clients[cid].skin_info.color_feet = skins->get_color(clients[cid].color_feet); - clients[cid].skin_info.size = 64; - - // find new skin - clients[cid].skin_id = gameclient.skins->find(clients[cid].skin_name); - if(clients[cid].skin_id < 0) - { - clients[cid].skin_id = gameclient.skins->find("default"); - if(clients[cid].skin_id < 0) - clients[cid].skin_id = 0; - } - - if(clients[cid].use_custom_color) - clients[cid].skin_info.texture = gameclient.skins->get(clients[cid].skin_id)->color_texture; - else - { - clients[cid].skin_info.texture = gameclient.skins->get(clients[cid].skin_id)->org_texture; - clients[cid].skin_info.color_body = vec4(1,1,1,1); - clients[cid].skin_info.color_feet = vec4(1,1,1,1); - } - - clients[cid].update_render_info(); - gameclient.snap.num_players++; - - } - else if(item.type == NETOBJTYPE_PLAYER_INFO) - { - const NETOBJ_PLAYER_INFO *info = (const NETOBJ_PLAYER_INFO *)data; - - clients[info->cid].team = info->team; - snap.player_infos[info->cid] = info; - - if(info->local) - { - snap.local_cid = item.id; - snap.local_info = info; - - if (info->team == -1) - snap.spectate = true; - } - - // calculate team-balance - if(info->team != -1) - snap.team_size[info->team]++; - - } - else if(item.type == NETOBJTYPE_CHARACTER) - { - const void *old = snap_find_item(SNAP_PREV, NETOBJTYPE_CHARACTER, item.id); - if(old) - { - snap.characters[item.id].active = true; - snap.characters[item.id].prev = *((const NETOBJ_CHARACTER *)old); - snap.characters[item.id].cur = *((const NETOBJ_CHARACTER *)data); - - if(snap.characters[item.id].prev.tick) - evolve(&snap.characters[item.id].prev, client_prevtick()); - if(snap.characters[item.id].cur.tick) - evolve(&snap.characters[item.id].cur, client_tick()); - } - } - else if(item.type == NETOBJTYPE_GAME) - snap.gameobj = (NETOBJ_GAME *)data; - else if(item.type == NETOBJTYPE_FLAG) - snap.flags[item.id%2] = (const NETOBJ_FLAG *)data; - } - } - - // setup local pointers - if(snap.local_cid >= 0) - { - SNAPSTATE::CHARACTERINFO *c = &snap.characters[snap.local_cid]; - if(c->active) - { - snap.local_character = &c->cur; - snap.local_prev_character = &c->prev; - local_character_pos = vec2(snap.local_character->x, snap.local_character->y); - } - } - else - snap.spectate = true; - - TUNING_PARAMS standard_tuning; - SERVER_INFO current_server_info; - client_serverinfo(¤t_server_info); - if(current_server_info.gametype[0] != '0') - { - if(strcmp(current_server_info.gametype, "DM") != 0 && strcmp(current_server_info.gametype, "TDM") != 0 && strcmp(current_server_info.gametype, "CTF") != 0) - servermode = SERVERMODE_MOD; - else if(memcmp(&standard_tuning, &tuning, sizeof(TUNING_PARAMS)) == 0) - servermode = SERVERMODE_PURE; - else - servermode = SERVERMODE_PUREMOD; - } - - - // update render info - for(int i = 0; i < MAX_CLIENTS; i++) - clients[i].update_render_info(); -} - -void GAMECLIENT::on_predict() -{ - // store the previous values so we can detect prediction errors - CHARACTER_CORE before_prev_char = predicted_prev_char; - CHARACTER_CORE before_char = predicted_char; - - // we can't predict without our own id or own character - if(snap.local_cid == -1 || !snap.characters[snap.local_cid].active) - return; - - // don't predict anything if we are paused - if(snap.gameobj && snap.gameobj->paused) - { - if(snap.local_character) - predicted_char.read(snap.local_character); - if(snap.local_prev_character) - predicted_prev_char.read(snap.local_prev_character); - return; - } - - // repredict character - WORLD_CORE world; - world.tuning = tuning; - - // search for players - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(!snap.characters[i].active) - continue; - - gameclient.clients[i].predicted.world = &world; - world.characters[i] = &gameclient.clients[i].predicted; - gameclient.clients[i].predicted.read(&snap.characters[i].cur); - } - - // predict - for(int tick = client_tick()+1; tick <= client_predtick(); tick++) - { - // fetch the local - if(tick == client_predtick() && world.characters[snap.local_cid]) - predicted_prev_char = *world.characters[snap.local_cid]; - - // first calculate where everyone should move - for(int c = 0; c < MAX_CLIENTS; c++) - { - if(!world.characters[c]) - continue; - - mem_zero(&world.characters[c]->input, sizeof(world.characters[c]->input)); - if(snap.local_cid == c) - { - // apply player input - int *input = client_get_input(tick); - if(input) - world.characters[c]->input = *((NETOBJ_PLAYER_INPUT*)input); - world.characters[c]->tick(true); - } - else - world.characters[c]->tick(false); - - } - - // move all players and quantize their data - for(int c = 0; c < MAX_CLIENTS; c++) - { - if(!world.characters[c]) - continue; - - world.characters[c]->move(); - world.characters[c]->quantize(); - } - - // check if we want to trigger effects - if(tick > last_new_predicted_tick) - { - last_new_predicted_tick = tick; - new_predicted_tick = true; - - if(snap.local_cid != -1 && world.characters[snap.local_cid]) - { - vec2 pos = world.characters[snap.local_cid]->pos; - int events = world.characters[snap.local_cid]->triggered_events; - if(events&COREEVENT_GROUND_JUMP) gameclient.sounds->play_and_record(SOUNDS::CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, pos); - - /*if(events&COREEVENT_AIR_JUMP) - { - gameclient.effects->air_jump(pos); - gameclient.sounds->play_and_record(SOUNDS::CHN_WORLD, SOUND_PLAYER_AIRJUMP, 1.0f, pos); - }*/ - - //if(events&COREEVENT_HOOK_LAUNCH) snd_play_random(CHN_WORLD, SOUND_HOOK_LOOP, 1.0f, pos); - //if(events&COREEVENT_HOOK_ATTACH_PLAYER) snd_play_random(CHN_WORLD, SOUND_HOOK_ATTACH_PLAYER, 1.0f, pos); - if(events&COREEVENT_HOOK_ATTACH_GROUND) gameclient.sounds->play_and_record(SOUNDS::CHN_WORLD, SOUND_HOOK_ATTACH_GROUND, 1.0f, pos); - if(events&COREEVENT_HOOK_HIT_NOHOOK) gameclient.sounds->play_and_record(SOUNDS::CHN_WORLD, SOUND_HOOK_NOATTACH, 1.0f, pos); - //if(events&COREEVENT_HOOK_RETRACT) snd_play_random(CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, pos); - } - } - - if(tick == client_predtick() && world.characters[snap.local_cid]) - predicted_char = *world.characters[snap.local_cid]; - } - - if(config.debug && config.cl_predict && predicted_tick == client_predtick()) - { - NETOBJ_CHARACTER_CORE before = {0}, now = {0}, before_prev = {0}, now_prev = {0}; - before_char.write(&before); - before_prev_char.write(&before_prev); - predicted_char.write(&now); - predicted_prev_char.write(&now_prev); - - if(mem_comp(&before, &now, sizeof(NETOBJ_CHARACTER_CORE)) != 0) - { - dbg_msg("client", "prediction error"); - for(unsigned i = 0; i < sizeof(NETOBJ_CHARACTER_CORE)/sizeof(int); i++) - if(((int *)&before)[i] != ((int *)&now)[i]) - { - dbg_msg("", "\t%d %d %d (%d %d)", i, ((int *)&before)[i], ((int *)&now)[i], ((int *)&before_prev)[i], ((int *)&now_prev)[i]); - } - } - } - - predicted_tick = client_predtick(); -} - -void GAMECLIENT::CLIENT_DATA::update_render_info() -{ - render_info = skin_info; - - // force team colors - if(gameclient.snap.gameobj && gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) - { - const int team_colors[2] = {65387, 10223467}; - if(team >= 0 || team <= 1) - { - render_info.texture = gameclient.skins->get(skin_id)->color_texture; - render_info.color_body = gameclient.skins->get_color(team_colors[team]); - render_info.color_feet = gameclient.skins->get_color(team_colors[team]); - } - } -} - -void GAMECLIENT::send_switch_team(int team) -{ - NETMSG_CL_SETTEAM msg; - msg.team = team; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} - -void GAMECLIENT::send_info(bool start) -{ - if(start) - { - NETMSG_CL_STARTINFO msg; - msg.name = config.player_name; - msg.skin = config.player_skin; - msg.use_custom_color = config.player_use_custom_color; - msg.color_body = config.player_color_body; - msg.color_feet = config.player_color_feet; - msg.pack(MSGFLAG_VITAL); - } - else - { - NETMSG_CL_CHANGEINFO msg; - msg.name = config.player_name; - msg.skin = config.player_skin; - msg.use_custom_color = config.player_use_custom_color; - msg.color_body = config.player_color_body; - msg.color_feet = config.player_color_feet; - msg.pack(MSGFLAG_VITAL); - } - client_send_msg(); -} - -void GAMECLIENT::send_kill(int client_id) -{ - NETMSG_CL_KILL msg; - msg.pack(MSGFLAG_VITAL); - client_send_msg(); -} - -void GAMECLIENT::con_team(void *result, void *user_data) -{ - ((GAMECLIENT*)user_data)->send_switch_team(console_arg_int(result, 0)); -} - -void GAMECLIENT::con_kill(void *result, void *user_data) -{ - ((GAMECLIENT*)user_data)->send_kill(-1); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.hpp deleted file mode 100644 index 041df10d3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/gameclient.hpp +++ /dev/null @@ -1,159 +0,0 @@ - -#include -#include -#include "render.hpp" - -class GAMECLIENT -{ - class STACK - { - public: - enum - { - MAX_COMPONENTS = 64, - }; - - STACK(); - void add(class COMPONENT *component); - - class COMPONENT *components[MAX_COMPONENTS]; - int num; - }; - - STACK all; - STACK input; - - - void dispatch_input(); - void process_events(); - void update_local_character_pos(); - - int predicted_tick; - int last_new_predicted_tick; - - static void con_team(void *result, void *user_data); - static void con_kill(void *result, void *user_data); - -public: - bool suppress_events; - bool new_tick; - bool new_predicted_tick; - - // TODO: move this - TUNING_PARAMS tuning; - - enum - { - SERVERMODE_PURE=0, - SERVERMODE_MOD, - SERVERMODE_PUREMOD, - }; - int servermode; - - vec2 local_character_pos; - - // predicted players - CHARACTER_CORE predicted_prev_char; - CHARACTER_CORE predicted_char; - - // snap pointers - struct SNAPSTATE - { - const NETOBJ_CHARACTER *local_character; - const NETOBJ_CHARACTER *local_prev_character; - const NETOBJ_PLAYER_INFO *local_info; - const NETOBJ_FLAG *flags[2]; - const NETOBJ_GAME *gameobj; - - const NETOBJ_PLAYER_INFO *player_infos[MAX_CLIENTS]; - const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS]; - - int local_cid; - int num_players; - int team_size[2]; - bool spectate; - - // - struct CHARACTERINFO - { - bool active; - - // snapshots - NETOBJ_CHARACTER prev; - NETOBJ_CHARACTER cur; - - // interpolated position - vec2 position; - }; - - CHARACTERINFO characters[MAX_CLIENTS]; - }; - - SNAPSTATE snap; - - // client data - struct CLIENT_DATA - { - int use_custom_color; - int color_body; - int color_feet; - - char name[64]; - char skin_name[64]; - int skin_id; - int skin_color; - int team; - int emoticon; - int emoticon_start; - CHARACTER_CORE predicted; - - TEE_RENDER_INFO skin_info; // this is what the server reports - TEE_RENDER_INFO render_info; // this is what we use - - float angle; - - void update_render_info(); - }; - - CLIENT_DATA clients[MAX_CLIENTS]; - - void on_reset(); - - // hooks - void on_connected(); - void on_render(); - void on_init(); - void on_save(); - void on_console_init(); - void on_statechange(int new_state, int old_state); - void on_message(int msgtype); - void on_snapshot(); - void on_predict(); - int on_snapinput(int *data); - - // actions - // TODO: move these - void send_switch_team(int team); - void send_info(bool start); - void send_kill(int client_id); - - // pointers to all systems - class CONSOLE *console; - class BINDS *binds; - class PARTICLES *particles; - class MENUS *menus; - class SKINS *skins; - class FLOW *flow; - class CHAT *chat; - class DAMAGEIND *damageind; - class CAMERA *camera; - class CONTROLS *controls; - class EFFECTS *effects; - class SOUNDS *sounds; - class MOTD *motd; - class MAPIMAGES *mapimages; - class VOTING *voting; -}; - -extern GAMECLIENT gameclient; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.cpp deleted file mode 100644 index 40c47d411..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include // strlen -#include "lineinput.hpp" - -LINEINPUT::LINEINPUT() -{ - clear(); -} - -void LINEINPUT::clear() -{ - mem_zero(str, sizeof(str)); - len = 0; - cursor_pos = 0; -} - -void LINEINPUT::set(const char *string) -{ - str_copy(str, string, sizeof(str)); - len = strlen(str); - cursor_pos = len; -} - -void LINEINPUT::process_input(INPUT_EVENT e) -{ - if(cursor_pos > len) - cursor_pos = len; - - char c = e.ch; - int k = e.key; - - // 127 is produced on Mac OS X and corresponds to the delete key - if (!(c >= 0 && c < 32) && c != 127) - { - if (len < sizeof(str) - 1 && cursor_pos < sizeof(str) - 1) - { - memmove(str + cursor_pos + 1, str + cursor_pos, len - cursor_pos + 1); - str[cursor_pos] = c; - cursor_pos++; - len++; - } - } - - if(e.flags&INPFLAG_PRESS) - { - if (k == KEY_BACKSPACE && cursor_pos > 0) - { - memmove(str + cursor_pos - 1, str + cursor_pos, len - cursor_pos + 1); - cursor_pos--; - len--; - } - else if (k == KEY_DELETE && cursor_pos < len) - { - memmove(str + cursor_pos, str + cursor_pos + 1, len - cursor_pos); - len--; - } - else if (k == KEY_LEFT && cursor_pos > 0) - cursor_pos--; - else if (k == KEY_RIGHT && cursor_pos < len) - cursor_pos++; - else if (k == KEY_HOME) - cursor_pos = 0; - else if (k == KEY_END) - cursor_pos = len; - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.hpp deleted file mode 100644 index 80ef3c521..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/lineinput.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef GAME_CLIENT_LINEINPUT_H -#define GAME_CLIENT_LINEINPUT_H - -// line input helter -class LINEINPUT -{ - char str[256]; - unsigned len; - unsigned cursor_pos; -public: - class CALLBACK - { - public: - virtual ~CALLBACK() {} - virtual bool event(INPUT_EVENT e) = 0; - }; - - LINEINPUT(); - void clear(); - void process_input(INPUT_EVENT e); - void set(const char *string); - const char *get_string() const { return str; } - int get_length() const { return len; } - unsigned cursor_offset() const { return cursor_pos; } -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/render.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/render.cpp deleted file mode 100644 index f63e86922..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/render.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include - -#include - -#include -#include -#include -#include -#include -#include "animstate.hpp" -#include "render.hpp" - -static float sprite_w_scale; -static float sprite_h_scale; -/* -static void layershot_begin() -{ - if(!config.cl_layershot) - return; - - gfx_clear(0,0,0); -} - -static void layershot_end() -{ - if(!config.cl_layershot) - return; - - char buf[256]; - str_format(buf, sizeof(buf), "screenshots/layers_%04d.png", config.cl_layershot); - gfx_screenshot_direct(buf); - config.cl_layershot++; -}*/ - -void select_sprite(SPRITE *spr, int flags, int sx, int sy) -{ - int x = spr->x+sx; - int y = spr->y+sy; - int w = spr->w; - int h = spr->h; - int cx = spr->set->gridx; - int cy = spr->set->gridy; - - float f = sqrtf(h*h + w*w); - sprite_w_scale = w/f; - sprite_h_scale = h/f; - - float x1 = x/(float)cx; - float x2 = (x+w)/(float)cx; - float y1 = y/(float)cy; - float y2 = (y+h)/(float)cy; - float temp = 0; - - if(flags&SPRITE_FLAG_FLIP_Y) - { - temp = y1; - y1 = y2; - y2 = temp; - } - - if(flags&SPRITE_FLAG_FLIP_X) - { - temp = x1; - x1 = x2; - x2 = temp; - } - - gfx_quads_setsubset(x1, y1, x2, y2); -} - -void select_sprite(int id, int flags, int sx, int sy) -{ - if(id < 0 || id > data->num_sprites) - return; - select_sprite(&data->sprites[id], flags, sx, sy); -} - -void draw_sprite(float x, float y, float size) -{ - gfx_quads_draw(x, y, size*sprite_w_scale, size*sprite_h_scale); -} - -void draw_round_rect_ext(float x, float y, float w, float h, float r, int corners) -{ - int num = 8; - for(int i = 0; i < num; i+=2) - { - float a1 = i/(float)num * pi/2; - float a2 = (i+1)/(float)num * pi/2; - float a3 = (i+2)/(float)num * pi/2; - float ca1 = cosf(a1); - float ca2 = cosf(a2); - float ca3 = cosf(a3); - float sa1 = sinf(a1); - float sa2 = sinf(a2); - float sa3 = sinf(a3); - - if(corners&1) // TL - gfx_quads_draw_freeform( - x+r, y+r, - x+(1-ca1)*r, y+(1-sa1)*r, - x+(1-ca3)*r, y+(1-sa3)*r, - x+(1-ca2)*r, y+(1-sa2)*r); - - if(corners&2) // TR - gfx_quads_draw_freeform( - x+w-r, y+r, - x+w-r+ca1*r, y+(1-sa1)*r, - x+w-r+ca3*r, y+(1-sa3)*r, - x+w-r+ca2*r, y+(1-sa2)*r); - - if(corners&4) // BL - gfx_quads_draw_freeform( - x+r, y+h-r, - x+(1-ca1)*r, y+h-r+sa1*r, - x+(1-ca3)*r, y+h-r+sa3*r, - x+(1-ca2)*r, y+h-r+sa2*r); - - if(corners&8) // BR - gfx_quads_draw_freeform( - x+w-r, y+h-r, - x+w-r+ca1*r, y+h-r+sa1*r, - x+w-r+ca3*r, y+h-r+sa3*r, - x+w-r+ca2*r, y+h-r+sa2*r); - } - - gfx_quads_drawTL(x+r, y+r, w-r*2, h-r*2); // center - gfx_quads_drawTL(x+r, y, w-r*2, r); // top - gfx_quads_drawTL(x+r, y+h-r, w-r*2, r); // bottom - gfx_quads_drawTL(x, y+r, r, h-r*2); // left - gfx_quads_drawTL(x+w-r, y+r, r, h-r*2); // right - - if(!(corners&1)) gfx_quads_drawTL(x, y, r, r); // TL - if(!(corners&2)) gfx_quads_drawTL(x+w, y, -r, r); // TR - if(!(corners&4)) gfx_quads_drawTL(x, y+h, r, -r); // BL - if(!(corners&8)) gfx_quads_drawTL(x+w, y+h, -r, -r); // BR -} - -void draw_round_rect(float x, float y, float w, float h, float r) -{ - draw_round_rect_ext(x,y,w,h,r,0xf); -} - -void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding) -{ - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(color.r, color.g, color.b, color.a); - draw_round_rect_ext(r->x,r->y,r->w,r->h,rounding*ui_scale(), corners); - gfx_quads_end(); -} - -void render_tee(ANIMSTATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos) -{ - vec2 direction = dir; - vec2 position = pos; - - //gfx_texture_set(data->images[IMAGE_CHAR_DEFAULT].id); - gfx_texture_set(info->texture); - gfx_quads_begin(); - //gfx_quads_draw(pos.x, pos.y-128, 128, 128); - - // first pass we draw the outline - // second pass we draw the filling - for(int p = 0; p < 2; p++) - { - int outline = p==0 ? 1 : 0; - - for(int f = 0; f < 2; f++) - { - float animscale = info->size * 1.0f/64.0f; - float basesize = info->size; - if(f == 1) - { - gfx_quads_setrotation(anim->body.angle*pi*2); - - // draw body - gfx_setcolor(info->color_body.r, info->color_body.g, info->color_body.b, 1.0f); - vec2 body_pos = position + vec2(anim->body.x, anim->body.y)*animscale; - select_sprite(outline?SPRITE_TEE_BODY_OUTLINE:SPRITE_TEE_BODY, 0, 0, 0); - gfx_quads_draw(body_pos.x, body_pos.y, basesize, basesize); - - // draw eyes - if(p == 1) - { - switch (emote) - { - case EMOTE_PAIN: - select_sprite(SPRITE_TEE_EYE_PAIN, 0, 0, 0); - break; - case EMOTE_HAPPY: - select_sprite(SPRITE_TEE_EYE_HAPPY, 0, 0, 0); - break; - case EMOTE_SURPRISE: - select_sprite(SPRITE_TEE_EYE_SURPRISE, 0, 0, 0); - break; - case EMOTE_ANGRY: - select_sprite(SPRITE_TEE_EYE_ANGRY, 0, 0, 0); - break; - default: - select_sprite(SPRITE_TEE_EYE_NORMAL, 0, 0, 0); - break; - } - - float eyescale = basesize*0.40f; - float h = emote == EMOTE_BLINK ? basesize*0.15f : eyescale; - float eyeseparation = (0.075f - 0.010f*fabs(direction.x))*basesize; - vec2 offset = vec2(direction.x*0.125f, -0.05f+direction.y*0.10f)*basesize; - gfx_quads_draw(body_pos.x-eyeseparation+offset.x, body_pos.y+offset.y, eyescale, h); - gfx_quads_draw(body_pos.x+eyeseparation+offset.x, body_pos.y+offset.y, -eyescale, h); - } - } - - // draw feet - ANIM_KEYFRAME *foot = f ? &anim->front_foot : &anim->back_foot; - - float w = basesize; - float h = basesize/2; - - gfx_quads_setrotation(foot->angle*pi*2); - - bool indicate = !info->got_airjump && config.cl_airjumpindicator; - float cs = 1.0f; // color scale - - if(outline) - select_sprite(SPRITE_TEE_FOOT_OUTLINE, 0, 0, 0); - else - { - select_sprite(SPRITE_TEE_FOOT, 0, 0, 0); - if(indicate) - cs = 0.5f; - } - - gfx_setcolor(info->color_feet.r*cs, info->color_feet.g*cs, info->color_feet.b*cs, 1.0f); - gfx_quads_draw(position.x+foot->x*animscale, position.y+foot->y*animscale, w, h); - } - } - - gfx_quads_end(); - - -} - -static void calc_screen_params(float amount, float wmax, float hmax, float aspect, float *w, float *h) -{ - float f = sqrt(amount) / sqrt(aspect); - *w = f*aspect; - *h = f; - - // limit the view - if(*w > wmax) - { - *w = wmax; - *h = *w/aspect; - } - - if(*h > hmax) - { - *h = hmax; - *w = *h*aspect; - } -} - -void mapscreen_to_world(float center_x, float center_y, float parallax_x, float parallax_y, - float offset_x, float offset_y, float aspect, float zoom, float *points) -{ - float width, height; - calc_screen_params(1150*1000, 1500, 1050, aspect, &width, &height); - center_x *= parallax_x; - center_y *= parallax_y; - width *= zoom; - height *= zoom; - points[0] = offset_x+center_x-width/2; - points[1] = offset_y+center_y-height/2; - points[2] = offset_x+center_x+width/2; - points[3] = offset_y+center_y+height/2; -} - -void render_tilemap_generate_skip() -{ - for(int g = 0; g < layers_num_groups(); g++) - { - MAPITEM_GROUP *group = layers_get_group(g); - - for(int l = 0; l < group->num_layers; l++) - { - MAPITEM_LAYER *layer = layers_get_layer(group->start_layer+l); - - if(layer->type == LAYERTYPE_TILES) - { - MAPITEM_LAYER_TILEMAP *tmap = (MAPITEM_LAYER_TILEMAP *)layer; - TILE *tiles = (TILE *)map_get_data(tmap->data); - for(int y = 0; y < tmap->height; y++) - { - for(int x = 1; x < tmap->width; x++) - { - int sx; - for(sx = 1; x+sx < tmap->width && sx < 255; sx++) - { - if(tiles[y*tmap->width+x+sx].index) - break; - } - - tiles[y*tmap->width+x].skip = sx-1; - } - } - } - } - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/render.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/render.hpp deleted file mode 100644 index edbe9cb08..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/render.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef GAME_CLIENT_RENDER_H -#define GAME_CLIENT_RENDER_H - -#include - -#include "../mapitems.hpp" -#include "ui.hpp" - -struct TEE_RENDER_INFO -{ - TEE_RENDER_INFO() - { - texture = -1; - color_body = vec4(1,1,1,1); - color_feet = vec4(1,1,1,1); - size = 1.0f; - got_airjump = 1; - }; - - int texture; - vec4 color_body; - vec4 color_feet; - float size; - int got_airjump; -}; - -// sprite renderings -enum -{ - SPRITE_FLAG_FLIP_Y=1, - SPRITE_FLAG_FLIP_X=2, - - LAYERRENDERFLAG_OPAQUE=1, - LAYERRENDERFLAG_TRANSPARENT=2, - - TILERENDERFLAG_EXTEND=4, -}; - -struct SPRITE; - -void select_sprite(SPRITE *spr, int flags=0, int sx=0, int sy=0); -void select_sprite(int id, int flags=0, int sx=0, int sy=0); - -void draw_sprite(float x, float y, float size); - -// rects -void draw_round_rect(float x, float y, float w, float h, float r); -void draw_round_rect_ext(float x, float y, float w, float h, float r, int corners); -void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding); - -// larger rendering methods -void render_tilemap_generate_skip(); - -// object render methods (gc_render_obj.cpp) -void render_tee(class ANIMSTATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos); - -// map render methods (gc_render_map.cpp) -void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result); -void render_quads(QUAD *quads, int num_quads, void (*eval)(float time_offset, int env, float *channels), int flags); -void render_tilemap(TILE *tiles, int w, int h, float scale, vec4 color, int flags); - -// helpers -void mapscreen_to_world(float center_x, float center_y, float parallax_x, float parallax_y, - float offset_x, float offset_y, float aspect, float zoom, float *points); - - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/render_map.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/render_map.cpp deleted file mode 100644 index 118a4d736..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/render_map.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include "render.hpp" - -void render_eval_envelope(ENVPOINT *points, int num_points, int channels, float time, float *result) -{ - if(num_points == 0) - { - result[0] = 0; - result[1] = 0; - result[2] = 0; - result[3] = 0; - return; - } - - if(num_points == 1) - { - result[0] = fx2f(points[0].values[0]); - result[1] = fx2f(points[0].values[1]); - result[2] = fx2f(points[0].values[2]); - result[3] = fx2f(points[0].values[3]); - return; - } - - time = fmod(time, points[num_points-1].time/1000.0f)*1000.0f; - for(int i = 0; i < num_points-1; i++) - { - if(time >= points[i].time && time <= points[i+1].time) - { - float delta = points[i+1].time-points[i].time; - float a = (time-points[i].time)/delta; - - - if(points[i].curvetype == CURVETYPE_SMOOTH) - a = -2*a*a*a + 3*a*a; // second hermite basis - else if(points[i].curvetype == CURVETYPE_SLOW) - a = a*a*a; - else if(points[i].curvetype == CURVETYPE_FAST) - { - a = 1-a; - a = 1-a*a*a; - } - else if (points[i].curvetype == CURVETYPE_STEP) - a = 0; - else - { - // linear - } - - for(int c = 0; c < channels; c++) - { - float v0 = fx2f(points[i].values[c]); - float v1 = fx2f(points[i+1].values[c]); - result[c] = v0 + (v1-v0) * a; - } - - return; - } - } - - result[0] = fx2f(points[num_points-1].values[0]); - result[1] = fx2f(points[num_points-1].values[1]); - result[2] = fx2f(points[num_points-1].values[2]); - result[3] = fx2f(points[num_points-1].values[3]); - return; -} - - -static void rotate(POINT *center, POINT *point, float rotation) -{ - int x = point->x - center->x; - int y = point->y - center->y; - point->x = (int)(x * cosf(rotation) - y * sinf(rotation) + center->x); - point->y = (int)(x * sinf(rotation) + y * cosf(rotation) + center->y); -} - -void render_quads(QUAD *quads, int num_quads, void (*eval)(float time_offset, int env, float *channels), int renderflags) -{ - gfx_quads_begin(); - float conv = 1/255.0f; - for(int i = 0; i < num_quads; i++) - { - QUAD *q = &quads[i]; - - float r=1, g=1, b=1, a=1; - - if(q->color_env >= 0) - { - float channels[4]; - eval(q->color_env_offset/1000.0f, q->color_env, channels); - r = channels[0]; - g = channels[1]; - b = channels[2]; - a = channels[3]; - } - - bool opaque = false; - if(a < 0.01f || (q->colors[0].a < 0.01f && q->colors[1].a < 0.01f && q->colors[2].a < 0.01f && q->colors[3].a < 0.01f)) - opaque = true; - - if(opaque && !(renderflags&LAYERRENDERFLAG_OPAQUE)) - continue; - if(!opaque && !(renderflags&LAYERRENDERFLAG_TRANSPARENT)) - continue; - - gfx_quads_setsubset_free( - fx2f(q->texcoords[0].x), fx2f(q->texcoords[0].y), - fx2f(q->texcoords[1].x), fx2f(q->texcoords[1].y), - fx2f(q->texcoords[2].x), fx2f(q->texcoords[2].y), - fx2f(q->texcoords[3].x), fx2f(q->texcoords[3].y) - ); - - float offset_x = 0; - float offset_y = 0; - float rot = 0; - - // TODO: fix this - if(q->pos_env >= 0) - { - float channels[4]; - eval(q->pos_env_offset/1000.0f, q->pos_env, channels); - offset_x = channels[0]; - offset_y = channels[1]; - rot = channels[2]/360.0f*pi*2; - } - - - gfx_setcolorvertex(0, q->colors[0].r*conv*r, q->colors[0].g*conv*g, q->colors[0].b*conv*b, q->colors[0].a*conv*a); - gfx_setcolorvertex(1, q->colors[1].r*conv*r, q->colors[1].g*conv*g, q->colors[1].b*conv*b, q->colors[1].a*conv*a); - gfx_setcolorvertex(2, q->colors[2].r*conv*r, q->colors[2].g*conv*g, q->colors[2].b*conv*b, q->colors[2].a*conv*a); - gfx_setcolorvertex(3, q->colors[3].r*conv*r, q->colors[3].g*conv*g, q->colors[3].b*conv*b, q->colors[3].a*conv*a); - - POINT *points = q->points; - - if(rot != 0) - { - static POINT rotated[4]; - rotated[0] = q->points[0]; - rotated[1] = q->points[1]; - rotated[2] = q->points[2]; - rotated[3] = q->points[3]; - points = rotated; - - rotate(&q->points[4], &rotated[0], rot); - rotate(&q->points[4], &rotated[1], rot); - rotate(&q->points[4], &rotated[2], rot); - rotate(&q->points[4], &rotated[3], rot); - } - - gfx_quads_draw_freeform( - fx2f(points[0].x)+offset_x, fx2f(points[0].y)+offset_y, - fx2f(points[1].x)+offset_x, fx2f(points[1].y)+offset_y, - fx2f(points[2].x)+offset_x, fx2f(points[2].y)+offset_y, - fx2f(points[3].x)+offset_x, fx2f(points[3].y)+offset_y - ); - } - gfx_quads_end(); -} - -void render_tilemap(TILE *tiles, int w, int h, float scale, vec4 color, int renderflags) -{ - //gfx_texture_set(img_get(tmap->image)); - float screen_x0, screen_y0, screen_x1, screen_y1; - gfx_getscreen(&screen_x0, &screen_y0, &screen_x1, &screen_y1); - //gfx_mapscreen(screen_x0-50, screen_y0-50, screen_x1+50, screen_y1+50); - - // calculate the final pixelsize for the tiles - float tile_pixelsize = 1024/32.0f; - float final_tilesize = scale/(screen_x1-screen_x0) * gfx_screenwidth(); - float final_tilesize_scale = final_tilesize/tile_pixelsize; - - gfx_quads_begin(); - gfx_setcolor(color.r, color.g, color.b, color.a); - - int starty = (int)(screen_y0/scale)-1; - int startx = (int)(screen_x0/scale)-1; - int endy = (int)(screen_y1/scale)+1; - int endx = (int)(screen_x1/scale)+1; - - // adjust the texture shift according to mipmap level - float texsize = 1024.0f; - float frac = (1.25f/texsize) * (1/final_tilesize_scale); - float nudge = (0.5f/texsize) * (1/final_tilesize_scale); - - for(int y = starty; y < endy; y++) - for(int x = startx; x < endx; x++) - { - int mx = x; - int my = y; - - if(renderflags&TILERENDERFLAG_EXTEND) - { - if(mx<0) - mx = 0; - if(mx>=w) - mx = w-1; - if(my<0) - my = 0; - if(my>=h) - my = h-1; - } - else - { - if(mx<0) - continue; // mx = 0; - if(mx>=w) - continue; // mx = w-1; - if(my<0) - continue; // my = 0; - if(my>=h) - continue; // my = h-1; - } - - int c = mx + my*w; - - unsigned char index = tiles[c].index; - if(index) - { - unsigned char flags = tiles[c].flags; - - bool render = false; - if(flags&TILEFLAG_OPAQUE) - { - if(renderflags&LAYERRENDERFLAG_OPAQUE) - render = true; - } - else - { - if(renderflags&LAYERRENDERFLAG_TRANSPARENT) - render = true; - } - - if(render) - { - - int tx = index%16; - int ty = index/16; - int px0 = tx*(1024/16); - int py0 = ty*(1024/16); - int px1 = (tx+1)*(1024/16)-1; - int py1 = (ty+1)*(1024/16)-1; - - float u0 = nudge + px0/texsize+frac; - float v0 = nudge + py0/texsize+frac; - float u1 = nudge + px1/texsize-frac; - float v1 = nudge + py1/texsize-frac; - - if(flags&TILEFLAG_VFLIP) - { - float tmp = u0; - u0 = u1; - u1 = tmp; - } - - if(flags&TILEFLAG_HFLIP) - { - float tmp = v0; - v0 = v1; - v1 = tmp; - } - - gfx_quads_setsubset(u0,v0,u1,v1); - gfx_quads_drawTL(x*scale, y*scale, scale, scale); - } - } - x += tiles[c].skip; - } - - gfx_quads_end(); - gfx_mapscreen(screen_x0, screen_y0, screen_x1, screen_y1); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/ui.cpp b/project/jni/application/teeworlds-0.5.2/src/game/client/ui.cpp deleted file mode 100644 index 1361b85c3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/ui.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include - -#include -#include -#include "ui.hpp" - -/******************************************************** - UI -*********************************************************/ -static const void *hot_item = 0; -static const void *active_item = 0; -static const void *last_active_item = 0; -static const void *becomming_hot_item = 0; -static float mouse_x, mouse_y; /* in gui space */ -static float mouse_wx, mouse_wy; /* in world space */ -static unsigned mouse_buttons = 0; -static unsigned last_mouse_buttons = 0; - -float ui_mouse_x() { return mouse_x; } -float ui_mouse_y() { return mouse_y; } -float ui_mouse_world_x() { return mouse_wx; } -float ui_mouse_world_y() { return mouse_wy; } -int ui_mouse_button(int index) { return (mouse_buttons>>index)&1; } -int ui_mouse_button_clicked(int index) { return ui_mouse_button(index) && !((last_mouse_buttons>>index)&1) ; } - -void ui_set_hot_item(const void *id) { becomming_hot_item = id; } -void ui_set_active_item(const void *id) { active_item = id; if (id) last_active_item = id; } -void ui_clear_last_active_item() { last_active_item = 0; } -const void *ui_hot_item() { return hot_item; } -const void *ui_next_hot_item() { return becomming_hot_item; } -const void *ui_active_item() { return active_item; } -const void *ui_last_active_item() { return last_active_item; } - -int ui_update(float mx, float my, float mwx, float mwy, int buttons) -{ - mouse_x = mx; - mouse_y = my; - mouse_wx = mwx; - mouse_wy = mwy; - last_mouse_buttons = mouse_buttons; - mouse_buttons = buttons; - hot_item = becomming_hot_item; - if(active_item) - hot_item = active_item; - becomming_hot_item = 0; - return 0; -} -/* -bool ui_ -*/ -int ui_mouse_inside(const RECT *r) -{ - if(mouse_x >= r->x && mouse_x <= r->x+r->w && mouse_y >= r->y && mouse_y <= r->y+r->h) - return 1; - return 0; -} - -static RECT screen = { 0.0f, 0.0f, 848.0f, 480.0f }; - -RECT *ui_screen() -{ - float aspect = gfx_screenaspect(); - float w, h; - - h = 600; - w = aspect*h; - - screen.w = w; - screen.h = h; - - return &screen; -} - -void ui_set_scale(float s) -{ - config.ui_scale = (int)(s*100.0f); -} - -float ui_scale() -{ - return config.ui_scale/100.0f; -} - -void ui_clip_enable(const RECT *r) -{ - float xscale = gfx_screenwidth()/ui_screen()->w; - float yscale = gfx_screenheight()/ui_screen()->h; - gfx_clip_enable((int)(r->x*xscale), (int)(r->y*yscale), (int)(r->w*xscale), (int)(r->h*yscale)); -} - -void ui_clip_disable() -{ - gfx_clip_disable(); -} - -void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom) -{ - RECT r = *original; - cut *= ui_scale(); - - if (top) - { - top->x = r.x; - top->y = r.y; - top->w = r.w; - top->h = cut; - } - - if (bottom) - { - bottom->x = r.x; - bottom->y = r.y + cut; - bottom->w = r.w; - bottom->h = r.h - cut; - } -} - -void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom) -{ - RECT r = *original; - cut *= ui_scale(); - - if (top) - { - top->x = r.x; - top->y = r.y; - top->w = r.w; - top->h = r.h - cut; - } - - if (bottom) - { - bottom->x = r.x; - bottom->y = r.y + r.h - cut; - bottom->w = r.w; - bottom->h = cut; - } -} - - -void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right) -{ - RECT r = *original; - float cut = r.w/2; - - if (left) - { - left->x = r.x; - left->y = r.y; - left->w = cut; - left->h = r.h; - } - - if (right) - { - right->x = r.x + cut; - right->y = r.y; - right->w = r.w - cut; - right->h = r.h; - } -} - -void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right) -{ - RECT r = *original; - cut *= ui_scale(); - - if (left) - { - left->x = r.x; - left->y = r.y; - left->w = cut; - left->h = r.h; - } - - if (right) - { - right->x = r.x + cut; - right->y = r.y; - right->w = r.w - cut; - right->h = r.h; - } -} - -void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right) -{ - RECT r = *original; - cut *= ui_scale(); - - if (left) - { - left->x = r.x; - left->y = r.y; - left->w = r.w - cut; - left->h = r.h; - } - - if (right) - { - right->x = r.x + r.w - cut; - right->y = r.y; - right->w = cut; - right->h = r.h; - } -} - -void ui_margin(const RECT *original, float cut, RECT *other_rect) -{ - RECT r = *original; - cut *= ui_scale(); - - other_rect->x = r.x + cut; - other_rect->y = r.y + cut; - other_rect->w = r.w - 2*cut; - other_rect->h = r.h - 2*cut; -} - -void ui_vmargin(const RECT *original, float cut, RECT *other_rect) -{ - RECT r = *original; - cut *= ui_scale(); - - other_rect->x = r.x + cut; - other_rect->y = r.y; - other_rect->w = r.w - 2*cut; - other_rect->h = r.h; -} - -void ui_hmargin(const RECT *original, float cut, RECT *other_rect) -{ - RECT r = *original; - cut *= ui_scale(); - - other_rect->x = r.x; - other_rect->y = r.y + cut; - other_rect->w = r.w; - other_rect->h = r.h - 2*cut; -} - - -int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra) -{ - /* logic */ - int ret = 0; - int inside = ui_mouse_inside(r); - static int button_used = 0; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(button_used)) - { - if(inside && checked >= 0) - ret = 1+button_used; - ui_set_active_item(0); - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - ui_set_active_item(id); - button_used = 0; - } - - if(ui_mouse_button(1)) - { - ui_set_active_item(id); - button_used = 1; - } - } - - if(inside) - ui_set_hot_item(id); - - if(draw_func) - draw_func(id, text, checked, r, extra); - return ret; -} - -void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width) -{ - gfx_blend_normal(); - size *= ui_scale(); - if(align == 0) - { - float tw = gfx_text_width(0, size, text, max_width); - gfx_text(0, r->x + r->w/2-tw/2, r->y, size, text, max_width); - } - else if(align < 0) - gfx_text(0, r->x, r->y, size, text, max_width); - else if(align > 0) - { - float tw = gfx_text_width(0, size, text, max_width); - gfx_text(0, r->x + r->w-tw, r->y, size, text, max_width); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/client/ui.hpp b/project/jni/application/teeworlds-0.5.2/src/game/client/ui.hpp deleted file mode 100644 index 7a6cb5ded..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/client/ui.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef FILE_GAME_CLIENT_UI_H -#define FILE_GAME_CLIENT_UI_H - -typedef struct -{ - float x, y, w, h; -} RECT; - -enum -{ - CORNER_TL=1, - CORNER_TR=2, - CORNER_BL=4, - CORNER_BR=8, - - CORNER_T=CORNER_TL|CORNER_TR, - CORNER_B=CORNER_BL|CORNER_BR, - CORNER_R=CORNER_TR|CORNER_BR, - CORNER_L=CORNER_TL|CORNER_BL, - - CORNER_ALL=CORNER_T|CORNER_B -}; - -int ui_update(float mx, float my, float mwx, float mwy, int buttons); - -float ui_mouse_x(); -float ui_mouse_y(); -float ui_mouse_world_x(); -float ui_mouse_world_y(); -int ui_mouse_button(int index); -int ui_mouse_button_clicked(int index); - -void ui_set_hot_item(const void *id); -void ui_set_active_item(const void *id); -void ui_clear_last_active_item(); -const void *ui_hot_item(); -const void *ui_next_hot_item(); -const void *ui_active_item(); -const void *ui_last_active_item(); - -int ui_mouse_inside(const RECT *r); - -RECT *ui_screen(); -void ui_set_scale(float s); -float ui_scale(); -void ui_clip_enable(const RECT *r); -void ui_clip_disable(); - -void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom); -void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom); -void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right); -void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right); -void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right); - -void ui_margin(const RECT *original, float cut, RECT *other_rect); -void ui_vmargin(const RECT *original, float cut, RECT *other_rect); -void ui_hmargin(const RECT *original, float cut, RECT *other_rect); - -typedef void (*ui_draw_button_func)(const void *id, const char *text, int checked, const RECT *r, const void *extra); -int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra); -void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width = -1); - - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/collision.cpp b/project/jni/application/teeworlds-0.5.2/src/game/collision.cpp deleted file mode 100644 index 73f4a9c5d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/collision.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include -#include -#include -#include -#include - -static TILE *tiles; -static int width = 0; -static int height = 0; - -int col_width() { return width; } -int col_height() { return height; } - -int col_init() -{ - width = layers_game_layer()->width; - height = layers_game_layer()->height; - tiles = (TILE *)map_get_data(layers_game_layer()->data); - - for(int i = 0; i < width*height; i++) - { - int index = tiles[i].index; - - if(index > 128) - continue; - - if(index == TILE_DEATH) - tiles[i].index = COLFLAG_DEATH; - else if(index == TILE_SOLID) - tiles[i].index = COLFLAG_SOLID; - else if(index == TILE_NOHOOK) - tiles[i].index = COLFLAG_SOLID|COLFLAG_NOHOOK; - else - tiles[i].index = 0; - } - - return 1; -} - - -int col_get(int x, int y) -{ - int nx = clamp(x/32, 0, width-1); - int ny = clamp(y/32, 0, height-1); - - if(tiles[ny*width+nx].index > 128) - return 0; - return tiles[ny*width+nx].index; -} - -int col_is_solid(int x, int y) -{ - return col_get(x,y)&COLFLAG_SOLID; -} - - -// TODO: rewrite this smarter! -int col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out_collision, vec2 *out_before_collision) -{ - float d = distance(pos0, pos1); - vec2 last = pos0; - - for(float f = 0; f < d; f++) - { - float a = f/d; - vec2 pos = mix(pos0, pos1, a); - if(col_is_solid(round(pos.x), round(pos.y))) - { - if(out_collision) - *out_collision = pos; - if(out_before_collision) - *out_before_collision = last; - return col_get(round(pos.x), round(pos.y)); - } - last = pos; - } - if(out_collision) - *out_collision = pos1; - if(out_before_collision) - *out_before_collision = pos1; - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/collision.hpp b/project/jni/application/teeworlds-0.5.2/src/game/collision.hpp deleted file mode 100644 index 0f072daa7..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/collision.hpp +++ /dev/null @@ -1,21 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef GAME_MAPRES_COL_H -#define GAME_MAPRES_COL_H - -#include - -enum -{ - COLFLAG_SOLID=1, - COLFLAG_DEATH=2, - COLFLAG_NOHOOK=4, -}; - -int col_init(); -int col_is_solid(int x, int y); -int col_get(int x, int y); -int col_width(); -int col_height(); -int col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out_collision, vec2 *out_before_collision); - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/array.hpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/array.hpp deleted file mode 100755 index fe9f2739a..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/array.hpp +++ /dev/null @@ -1,238 +0,0 @@ - -template -class array -{ - // - // - void init() - { - list = 0; - clear(); - } - -public: - array() - { - init(); - } - - // - array(const array &other) - { - init(); - setsize(other.len()); - for(int i = 0; i < len(); i++) - (*this)[i] = other[i]; - } - - - // - // - virtual ~array() - { - delete [] list; - list = 0; - } - - // - // - void deleteall() - { - for(int i = 0; i < len(); i++) - delete list[i]; - - clear(); - } - - - // - // - void clear() - { - delete [] list; - - list_size = 1; - list = new T[1]; - num_elements = 0; - } - - int find(T val) - { - for(int i = 0; i < len(); i++) - if((*this)[i] == val) - return i; - return -1; - } - - bool exist(T val) - { - return find(val) != -1; - } - - // - // returns the number of elements in the list - // - int len() const - { - return num_elements; - } - - // - // This doesn't conserve the order in the list. Be careful - // - void removebyindexfast(int index) - { - //ASSUME(_Pos >= 0 && _Pos < num_elements); - list[index] = list[num_elements-1]; - setsize(len()-1); - } - - void removefast(const T& _Elem) - { - for(int i = 0; i < len(); i++) - if(list[i] == _Elem) - { - removebyindexfast(i); - return; - } - } - - // - // - void removebyindex(int index) - { - //ASSUME(_Pos >= 0 && _Pos < num_elements); - - for(int i = index+1; i < num_elements; i++) - list[i-1] = list[i]; - - setsize(len()-1); - } - - void insert(int index, const T& element) - { - int some_len = len(); - if (index < some_len) - setsize(some_len+1); - else - setsize(index + 1); - - for(int i = num_elements-2; i >= index; i--) - list[i+1] = list[i]; - - list[index] = element; - } - - bool remove(const T& element) - { - for(int i = 0; i < len(); i++) - if(list[i] == element) - { - removebyindex(i); - return true; - } - return false; - } - - // - // - int add(const T& element) - { - //if(num_elements == list_size) - setsize(len()+1); - list[num_elements-1] = element; - return num_elements-1; - } - - // - // - int add(const T& elem, int index) - { - setsize(len()+1); - - for(int i = num_elements-1; i > index; i--) - list[i] = list[i-1]; - - list[index] = elem; - - //num_elements++; - return num_elements-1; - } - - // - // - T& operator[] (int index) - { - return list[index]; - } - - const T& operator[] (int index) const - { - return list[index]; - } - - // - // - T *getptr() - { - return list; - } - - const T *getptr() const - { - return list; - } - - // - // - // - void setsize(int new_len) - { - if (list_size < new_len) - allocsize(new_len); - num_elements = new_len; - } - - // removes unnessasary data, returns how many bytes was earned - int optimize() - { - int Before = memoryusage(); - setsize(num_elements); - return Before - memoryusage(); - } - - // returns how much memory this dynamic array is using - int memoryusage() - { - return sizeof(array) + sizeof(T)*list_size; - } - - // - array &operator = (const array &other) - { - setsize(other.len()); - for(int i = 0; i < len(); i++) - (*this)[i] = other[i]; - return *this; - } -private: - void allocsize(int new_len) - { - list_size = new_len; - T *new_list = new T[list_size]; - - long end = num_elements < list_size ? num_elements : list_size; - for(int i = 0; i < end; i++) - new_list[i] = list[i]; - - delete [] list; - list = 0; - num_elements = num_elements < list_size ? num_elements : list_size; - list = new_list; - } - - T *list; - long list_size; - long num_elements; -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.cpp deleted file mode 100644 index 07f105118..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.cpp +++ /dev/null @@ -1,2781 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "ed_editor.hpp" - -static int checker_texture = 0; -static int background_texture = 0; -static int cursor_texture = 0; -static int entities_texture = 0; - - -static const void *ui_got_context = 0; - -EDITOR editor; - -LAYERGROUP::LAYERGROUP() -{ - name = ""; - visible = true; - game_group = false; - offset_x = 0; - offset_y = 0; - parallax_x = 100; - parallax_y = 100; - - use_clipping = 0; - clip_x = 0; - clip_y = 0; - clip_w = 0; - clip_h = 0; -} - -LAYERGROUP::~LAYERGROUP() -{ - clear(); -} - -void LAYERGROUP::convert(RECT *rect) -{ - rect->x += offset_x; - rect->y += offset_y; -} - -void LAYERGROUP::mapping(float *points) -{ - mapscreen_to_world( - editor.world_offset_x, editor.world_offset_y, - parallax_x/100.0f, parallax_y/100.0f, - offset_x, offset_y, - gfx_screenaspect(), editor.world_zoom, points); - - points[0] += editor.editor_offset_x; - points[1] += editor.editor_offset_y; - points[2] += editor.editor_offset_x; - points[3] += editor.editor_offset_y; -} - -void LAYERGROUP::mapscreen() -{ - float points[4]; - mapping(points); - gfx_mapscreen(points[0], points[1], points[2], points[3]); -} - -void LAYERGROUP::render() -{ - mapscreen(); - - if(use_clipping) - { - float points[4]; - editor.map.game_group->mapping(points); - float x0 = (clip_x - points[0]) / (points[2]-points[0]); - float y0 = (clip_y - points[1]) / (points[3]-points[1]); - float x1 = ((clip_x+clip_w) - points[0]) / (points[2]-points[0]); - float y1 = ((clip_y+clip_h) - points[1]) / (points[3]-points[1]); - - gfx_clip_enable((int)(x0*gfx_screenwidth()), (int)(y0*gfx_screenheight()), - (int)((x1-x0)*gfx_screenwidth()), (int)((y1-y0)*gfx_screenheight())); - } - - for(int i = 0; i < layers.len(); i++) - { - if(layers[i]->visible && layers[i] != editor.map.game_layer) - { - if(editor.show_detail || !(layers[i]->flags&LAYERFLAG_DETAIL)) - layers[i]->render(); - } - } - - gfx_clip_disable(); -} - -bool LAYERGROUP::is_empty() const { return layers.len() == 0; } -void LAYERGROUP::clear() { layers.deleteall(); } -void LAYERGROUP::add_layer(LAYER *l) { layers.add(l); } - -void LAYERGROUP::delete_layer(int index) -{ - if(index < 0 || index >= layers.len()) return; - delete layers[index]; - layers.removebyindex(index); -} - -void LAYERGROUP::get_size(float *w, float *h) -{ - *w = 0; *h = 0; - for(int i = 0; i < layers.len(); i++) - { - float lw, lh; - layers[i]->get_size(&lw, &lh); - *w = max(*w, lw); - *h = max(*h, lh); - } -} - - -int LAYERGROUP::swap_layers(int index0, int index1) -{ - if(index0 < 0 || index0 >= layers.len()) return index0; - if(index1 < 0 || index1 >= layers.len()) return index0; - if(index0 == index1) return index0; - swap(layers[index0], layers[index1]); - return index1; -} - -void EDITOR_IMAGE::analyse_tileflags() -{ - mem_zero(tileflags, sizeof(tileflags)); - - int tw = width/16; // tilesizes - int th = height/16; - if ( tw == th ) { - unsigned char *pixeldata = (unsigned char *)data; - - int tile_id = 0; - for(int ty = 0; ty < 16; ty++) - for(int tx = 0; tx < 16; tx++, tile_id++) - { - bool opaque = true; - for(int x = 0; x < tw; x++) - for(int y = 0; y < th; y++) - { - int p = (ty*tw+y)*width + tx*tw+x; - if(pixeldata[p*4+3] < 250) - { - opaque = false; - break; - } - } - - if(opaque) - tileflags[tile_id] |= TILEFLAG_OPAQUE; - } - } - -} - -/******************************************************** - OTHER -*********************************************************/ - -// copied from gc_menu.cpp, should be more generalized -//extern int ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float font_size, bool hidden=false); - -int ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float font_size, bool hidden=false) -{ - int inside = ui_mouse_inside(rect); - int r = 0; - static int at_index = 0; - - if(ui_last_active_item() == id) - { - int len = strlen(str); - - if (inside && ui_mouse_button(0)) - { - int mx_rel = (int)(ui_mouse_x() - rect->x); - - for (int i = 1; i <= len; i++) - { - if (gfx_text_width(0, font_size, str, i) + 10 > mx_rel) - { - at_index = i - 1; - break; - } - - if (i == len) - at_index = len; - } - } - - for(int i = 0; i < inp_num_events(); i++) - { - len = strlen(str); - - INPUT_EVENT e = inp_get_event(i); - char c = e.ch; - int k = e.key; - - if (at_index > len) - at_index = len; - - if (!(c >= 0 && c < 32) && c != 127) - { - if (len < str_size - 1 && at_index < str_size - 1) - { - memmove(str + at_index + 1, str + at_index, len - at_index + 1); - str[at_index] = c; - at_index++; - } - } - - if(e.flags&INPFLAG_PRESS) - { - if (k == KEY_BACKSPACE && at_index > 0) - { - memmove(str + at_index - 1, str + at_index, len - at_index + 1); - at_index--; - } - else if (k == KEY_DELETE && at_index < len) - memmove(str + at_index, str + at_index + 1, len - at_index); - else if (k == KEY_RETURN) - ui_clear_last_active_item(); - else if (k == KEY_LEFT && at_index > 0) - at_index--; - else if (k == KEY_RIGHT && at_index < len) - at_index++; - else if (k == KEY_HOME) - at_index = 0; - else if (k == KEY_END) - at_index = len; - } - } - - r = 1; - } - - bool just_got_active = false; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - if (ui_last_active_item() != id) - just_got_active = true; - ui_set_active_item(id); - } - } - - if(inside) - ui_set_hot_item(id); - - RECT textbox = *rect; - ui_draw_rect(&textbox, vec4(1,1,1,0.5f), CORNER_ALL, 5.0f); - ui_vmargin(&textbox, 5.0f, &textbox); - - const char *display_str = str; - char stars[128]; - - if(hidden) - { - unsigned s = strlen(str); - if(s >= sizeof(stars)) - s = sizeof(stars)-1; - memset(stars, '*', s); - stars[s] = 0; - display_str = stars; - } - - ui_do_label(&textbox, display_str, font_size, -1); - - if (ui_last_active_item() == id && !just_got_active) - { - float w = gfx_text_width(0, font_size, display_str, at_index); - textbox.x += w*ui_scale(); - ui_do_label(&textbox, "_", font_size, -1); - } - - return r; -} - -vec4 button_color_mul(const void *id) -{ - if(ui_active_item() == id) - return vec4(1,1,1,0.5f); - else if(ui_hot_item() == id) - return vec4(1,1,1,1.5f); - return vec4(1,1,1,1); -} - -float ui_do_scrollbar_v(const void *id, const RECT *rect, float current) -{ - RECT handle; - static float offset_y; - ui_hsplit_t(rect, 33, &handle, 0); - - handle.y += (rect->h-handle.h)*current; - - /* logic */ - float ret = current; - int inside = ui_mouse_inside(&handle); - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - - float min = rect->y; - float max = rect->h-handle.h; - float cur = ui_mouse_y()-offset_y; - ret = (cur-min)/max; - if(ret < 0.0f) ret = 0.0f; - if(ret > 1.0f) ret = 1.0f; - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - ui_set_active_item(id); - offset_y = ui_mouse_y()-handle.y; - } - } - - if(inside) - ui_set_hot_item(id); - - // render - RECT rail; - ui_vmargin(rect, 5.0f, &rail); - ui_draw_rect(&rail, vec4(1,1,1,0.25f), 0, 0.0f); - - RECT slider = handle; - slider.w = rail.x-slider.x; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_L, 2.5f); - slider.x = rail.x+rail.w; - ui_draw_rect(&slider, vec4(1,1,1,0.25f), CORNER_R, 2.5f); - - slider = handle; - ui_margin(&slider, 5.0f, &slider); - ui_draw_rect(&slider, vec4(1,1,1,0.25f)*button_color_mul(id), CORNER_ALL, 2.5f); - - return ret; -} - -static vec4 get_button_color(const void *id, int checked) -{ - if(checked < 0) - return vec4(0,0,0,0.5f); - - if(checked > 0) - { - if(ui_hot_item() == id) - return vec4(1,0,0,0.75f); - return vec4(1,0,0,0.5f); - } - - if(ui_hot_item() == id) - return vec4(1,1,1,0.75f); - return vec4(1,1,1,0.5f); -} - -void draw_editor_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), CORNER_ALL, 3.0f); - ui_do_label(r, text, 10, 0, -1); -} - -static void draw_editor_button_file(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - if(ui_hot_item() == id) - ui_draw_rect(r, get_button_color(id, checked), CORNER_ALL, 3.0f); - - RECT t = *r; - ui_vmargin(&t, 5.0f, &t); - ui_do_label(&t, text, 10, -1, -1); -} - -static void draw_editor_button_menu(const void *id, const char *text, int checked, const RECT *rect, const void *extra) -{ - /* - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - if(ui_hot_item() == id) - ui_draw_rect(r, get_button_color(id, checked), CORNER_ALL, 3.0f); - */ - - RECT r = *rect; - /* - if(ui_popups[id == id) - { - ui_draw_rect(&r, vec4(0.5f,0.5f,0.5f,0.75f), CORNER_T, 3.0f); - ui_margin(&r, 1.0f, &r); - ui_draw_rect(&r, vec4(0,0,0,0.75f), CORNER_T, 3.0f); - } - else*/ - ui_draw_rect(&r, vec4(0.5f,0.5f,0.5f, 1.0f), CORNER_T, 3.0f); - - - r = *rect; - ui_vmargin(&r, 5.0f, &r); - ui_do_label(&r, text, 10, -1, -1); - - //RECT t = *r; -} - -void draw_editor_button_menuitem(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - if(ui_hot_item() == id || checked) - ui_draw_rect(r, get_button_color(id, checked), CORNER_ALL, 3.0f); - - RECT t = *r; - ui_vmargin(&t, 5.0f, &t); - ui_do_label(&t, text, 10, -1, -1); -} - -static void draw_editor_button_l(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), CORNER_L, 3.0f); - ui_do_label(r, text, 10, 0, -1); -} - -static void draw_editor_button_m(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), 0, 3.0f); - ui_do_label(r, text, 10, 0, -1); -} - -static void draw_editor_button_r(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item() == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), CORNER_R, 3.0f); - ui_do_label(r, text, 10, 0, -1); -} - -static void draw_inc_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), CORNER_R, 3.0f); - ui_do_label(r, text?text:">", 10, 0, -1); -} - -static void draw_dec_button(const void *id, const char *text, int checked, const RECT *r, const void *extra) -{ - if(ui_hot_item == id) if(extra) editor.tooltip = (const char *)extra; - ui_draw_rect(r, get_button_color(id, checked), CORNER_L, 3.0f); - ui_do_label(r, text?text:"<", 10, 0, -1); -} - -enum -{ - BUTTON_CONTEXT=1, -}; - -int do_editor_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, int flags, const char *tooltip) -{ - if(ui_mouse_inside(r)) - { - if(flags&BUTTON_CONTEXT) - ui_got_context = id; - if(tooltip) - editor.tooltip = tooltip; - } - - return ui_do_button(id, text, checked, r, draw_func, 0); -} - - -static void render_background(RECT view, int texture, float size, float brightness) -{ - gfx_texture_set(texture); - gfx_blend_normal(); - gfx_quads_begin(); - gfx_setcolor(brightness,brightness,brightness,1.0f); - gfx_quads_setsubset(0,0, view.w/size, view.h/size); - gfx_quads_drawTL(view.x, view.y, view.w, view.h); - gfx_quads_end(); -} - -static LAYERGROUP brush; -static LAYER_TILES tileset_picker(16, 16); - -static int ui_do_value_selector(void *id, RECT *r, const char *label, int current, int min, int max, float scale) -{ - /* logic */ - static float value; - int ret = 0; - int inside = ui_mouse_inside(r); - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - { - if(inside) - ret = 1; - editor.lock_mouse = false; - ui_set_active_item(0); - } - else - { - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - value += editor.mouse_delta_x*0.05f; - else - value += editor.mouse_delta_x; - - if(fabs(value) > scale) - { - int count = (int)(value/scale); - value = fmod(value, scale); - current += count; - if(current < min) - current = min; - if(current > max) - current = max; - } - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - editor.lock_mouse = true; - value = 0; - ui_set_active_item(id); - } - } - - if(inside) - ui_set_hot_item(id); - - // render - char buf[128]; - sprintf(buf, "%s %d", label, current); - ui_draw_rect(r, get_button_color(id, 0), CORNER_ALL, 5.0f); - ui_do_label(r, buf, 10, 0, -1); - return current; -} - -LAYERGROUP *EDITOR::get_selected_group() -{ - if(selected_group >= 0 && selected_group < editor.map.groups.len()) - return editor.map.groups[selected_group]; - return 0x0; -} - -LAYER *EDITOR::get_selected_layer(int index) -{ - LAYERGROUP *group = get_selected_group(); - if(!group) - return 0x0; - - if(selected_layer >= 0 && selected_layer < editor.map.groups[selected_group]->layers.len()) - return group->layers[selected_layer]; - return 0x0; -} - -LAYER *EDITOR::get_selected_layer_type(int index, int type) -{ - LAYER *p = get_selected_layer(index); - if(p && p->type == type) - return p; - return 0x0; -} - -QUAD *EDITOR::get_selected_quad() -{ - LAYER_QUADS *ql = (LAYER_QUADS *)get_selected_layer_type(0, LAYERTYPE_QUADS); - if(!ql) - return 0; - if(selected_quad >= 0 && selected_quad < ql->quads.len()) - return &ql->quads[selected_quad]; - return 0; -} - -static void callback_open_map(const char *filename) { editor.load(filename); } -static void callback_append_map(const char *filename) { editor.append(filename); } -static void callback_save_map(const char *filename) { editor.save(filename); } - -static void do_toolbar(RECT toolbar) -{ - RECT button; - - // ctrl+o to open - if(inp_key_down('o') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL))) - editor.invoke_file_dialog(LISTDIRTYPE_ALL, "Open Map", "Open", "maps/", "", callback_open_map); - - // ctrl+s to save - if(inp_key_down('s') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL))) - editor.invoke_file_dialog(LISTDIRTYPE_SAVE, "Save Map", "Save", "maps/", "", callback_save_map); - - // detail button - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int hq_button = 0; - if(do_editor_button(&hq_button, "Detail", editor.show_detail, &button, draw_editor_button, 0, "[ctrl+h] Toggle High Detail") || - (inp_key_down('h') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL)))) - { - editor.show_detail = !editor.show_detail; - } - - ui_vsplit_l(&toolbar, 5.0f, 0, &toolbar); - - // animation button - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int animate_button = 0; - if(do_editor_button(&animate_button, "Anim", editor.animate, &button, draw_editor_button, 0, "[ctrl+m] Toggle animation") || - (inp_key_down('m') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL)))) - { - editor.animate_start = time_get(); - editor.animate = !editor.animate; - } - - ui_vsplit_l(&toolbar, 5.0f, 0, &toolbar); - - // proof button - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int proof_button = 0; - if(do_editor_button(&proof_button, "Proof", editor.proof_borders, &button, draw_editor_button, 0, "[ctrl-p] Toggles proof borders. These borders represent what a player maximum can see.") || - (inp_key_down('p') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL)))) - { - editor.proof_borders = !editor.proof_borders; - } - - ui_vsplit_l(&toolbar, 15.0f, 0, &toolbar); - - // zoom group - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int zoom_out_button = 0; - if(do_editor_button(&zoom_out_button, "ZO", 0, &button, draw_editor_button_l, 0, "[NumPad-] Zoom out") || inp_key_down(KEY_KP_MINUS)) - editor.zoom_level += 50; - - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int zoom_normal_button = 0; - if(do_editor_button(&zoom_normal_button, "1:1", 0, &button, draw_editor_button_m, 0, "[NumPad*] Zoom to normal and remove editor offset") || inp_key_down(KEY_KP_MULTIPLY)) - { - editor.editor_offset_x = 0; - editor.editor_offset_y = 0; - editor.zoom_level = 100; - } - - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int zoom_in_button = 0; - if(do_editor_button(&zoom_in_button, "ZI", 0, &button, draw_editor_button_r, 0, "[NumPad+] Zoom in") || inp_key_down(KEY_KP_PLUS)) - editor.zoom_level -= 50; - - ui_vsplit_l(&toolbar, 15.0f, 0, &toolbar); - - // animation speed - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int anim_faster_button = 0; - if(do_editor_button(&anim_faster_button, "A+", 0, &button, draw_editor_button_l, 0, "Increase animation speed")) - editor.animate_speed += 0.5f; - - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int anim_normal_button = 0; - if(do_editor_button(&anim_normal_button, "1", 0, &button, draw_editor_button_m, 0, "Normal animation speed")) - editor.animate_speed = 1.0f; - - ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); - static int anim_slower_button = 0; - if(do_editor_button(&anim_slower_button, "A-", 0, &button, draw_editor_button_r, 0, "Decrease animation speed")) - { - if(editor.animate_speed > 0.5f) - editor.animate_speed -= 0.5f; - } - - if(inp_key_presses(KEY_MOUSE_WHEEL_UP) && editor.dialog == DIALOG_NONE) - editor.zoom_level -= 20; - - if(inp_key_presses(KEY_MOUSE_WHEEL_DOWN) && editor.dialog == DIALOG_NONE) - editor.zoom_level += 20; - - if(editor.zoom_level < 50) - editor.zoom_level = 50; - editor.world_zoom = editor.zoom_level/100.0f; - - ui_vsplit_l(&toolbar, 10.0f, &button, &toolbar); - - - // brush manipulation - { - int enabled = brush.is_empty()?-1:0; - - // flip buttons - ui_vsplit_l(&toolbar, 20.0f, &button, &toolbar); - static int flipx_button = 0; - if(do_editor_button(&flipx_button, "^X", enabled, &button, draw_editor_button_l, 0, "[N] Flip brush horizontal") || inp_key_down('n')) - { - for(int i = 0; i < brush.layers.len(); i++) - brush.layers[i]->brush_flip_x(); - } - - ui_vsplit_l(&toolbar, 20.0f, &button, &toolbar); - static int flipy_button = 0; - if(do_editor_button(&flipy_button, "^Y", enabled, &button, draw_editor_button_r, 0, "[M] Flip brush vertical") || inp_key_down('m')) - { - for(int i = 0; i < brush.layers.len(); i++) - brush.layers[i]->brush_flip_y(); - } - - // rotate buttons - ui_vsplit_l(&toolbar, 20.0f, &button, &toolbar); - - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int rotation_amount = 90; - rotation_amount = ui_do_value_selector(&rotation_amount, &button, "", rotation_amount, 1, 360, 2.0f); - - ui_vsplit_l(&toolbar, 5.0f, &button, &toolbar); - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int ccw_button = 0; - if(do_editor_button(&ccw_button, "CCW", enabled, &button, draw_editor_button_l, 0, "[R] Rotates the brush counter clockwise") || inp_key_down('r')) - { - for(int i = 0; i < brush.layers.len(); i++) - brush.layers[i]->brush_rotate(-rotation_amount/360.0f*pi*2); - } - - ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); - static int cw_button = 0; - if(do_editor_button(&cw_button, "CW", enabled, &button, draw_editor_button_r, 0, "[T] Rotates the brush clockwise") || inp_key_down('t')) - { - for(int i = 0; i < brush.layers.len(); i++) - brush.layers[i]->brush_rotate(rotation_amount/360.0f*pi*2); - } - } - - // quad manipulation - { - // do add button - ui_vsplit_l(&toolbar, 10.0f, &button, &toolbar); - ui_vsplit_l(&toolbar, 60.0f, &button, &toolbar); - static int new_button = 0; - - LAYER_QUADS *qlayer = (LAYER_QUADS *)editor.get_selected_layer_type(0, LAYERTYPE_QUADS); - //LAYER_TILES *tlayer = (LAYER_TILES *)editor.get_selected_layer_type(0, LAYERTYPE_TILES); - if(do_editor_button(&new_button, "Add Quad", qlayer?0:-1, &button, draw_editor_button, 0, "Adds a new quad")) - { - if(qlayer) - { - float mapping[4]; - LAYERGROUP *g = editor.get_selected_group(); - g->mapping(mapping); - int add_x = f2fx(mapping[0] + (mapping[2]-mapping[0])/2); - int add_y = f2fx(mapping[1] + (mapping[3]-mapping[1])/2); - - QUAD *q = qlayer->new_quad(); - for(int i = 0; i < 5; i++) - { - q->points[i].x += add_x; - q->points[i].y += add_y; - } - } - } - } -} - -static void rotate(POINT *center, POINT *point, float rotation) -{ - int x = point->x - center->x; - int y = point->y - center->y; - point->x = (int)(x * cosf(rotation) - y * sinf(rotation) + center->x); - point->y = (int)(x * sinf(rotation) + y * cosf(rotation) + center->y); -} - -static void do_quad(QUAD *q, int index) -{ - enum - { - OP_NONE=0, - OP_MOVE_ALL, - OP_MOVE_PIVOT, - OP_ROTATE, - OP_CONTEXT_MENU, - }; - - // some basic values - void *id = &q->points[4]; // use pivot addr as id - static POINT rotate_points[4]; - static float last_wx; - static float last_wy; - static int operation = OP_NONE; - static float rotate_angle = 0; - float wx = ui_mouse_world_x(); - float wy = ui_mouse_world_y(); - - // get pivot - float center_x = fx2f(q->points[4].x); - float center_y = fx2f(q->points[4].y); - - float dx = (center_x - wx); - float dy = (center_y - wy); - if(dx*dx+dy*dy < 10*10) - ui_set_hot_item(id); - - // draw selection background - if(editor.selected_quad == index) - { - gfx_setcolor(0,0,0,1); - gfx_quads_draw(center_x, center_y, 7.0f, 7.0f); - } - - if(ui_active_item() == id) - { - // check if we only should move pivot - if(operation == OP_MOVE_PIVOT) - { - q->points[4].x += f2fx(wx-last_wx); - q->points[4].y += f2fx(wy-last_wy); - } - else if(operation == OP_MOVE_ALL) - { - // move all points including pivot - for(int v = 0; v < 5; v++) - { - q->points[v].x += f2fx(wx-last_wx); - q->points[v].y += f2fx(wy-last_wy); - } - } - else if(operation == OP_ROTATE) - { - for(int v = 0; v < 4; v++) - { - q->points[v] = rotate_points[v]; - rotate(&q->points[4], &q->points[v], rotate_angle); - } - } - - rotate_angle += (editor.mouse_delta_x) * 0.002f; - last_wx = wx; - last_wy = wy; - - if(operation == OP_CONTEXT_MENU) - { - if(!ui_mouse_button(1)) - { - static int quad_popup_id = 0; - ui_invoke_popup_menu(&quad_popup_id, 0, ui_mouse_x(), ui_mouse_y(), 120, 150, popup_quad); - editor.lock_mouse = false; - operation = OP_NONE; - ui_set_active_item(0); - } - } - else - { - if(!ui_mouse_button(0)) - { - editor.lock_mouse = false; - operation = OP_NONE; - ui_set_active_item(0); - } - } - - gfx_setcolor(1,1,1,1); - } - else if(ui_hot_item() == id) - { - ui_got_context = id; - - gfx_setcolor(1,1,1,1); - editor.tooltip = "Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate"; - - if(ui_mouse_button(0)) - { - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - operation = OP_MOVE_PIVOT; - else if(inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL)) - { - editor.lock_mouse = true; - operation = OP_ROTATE; - rotate_angle = 0; - rotate_points[0] = q->points[0]; - rotate_points[1] = q->points[1]; - rotate_points[2] = q->points[2]; - rotate_points[3] = q->points[3]; - } - else - operation = OP_MOVE_ALL; - - ui_set_active_item(id); - editor.selected_quad = index; - last_wx = wx; - last_wy = wy; - } - - if(ui_mouse_button(1)) - { - editor.selected_quad = index; - operation = OP_CONTEXT_MENU; - ui_set_active_item(id); - } - } - else - gfx_setcolor(0,1,0,1); - - gfx_quads_draw(center_x, center_y, 5.0f, 5.0f); -} - -static void do_quad_point(QUAD *q, int quad_index, int v) -{ - void *id = &q->points[v]; - - float wx = ui_mouse_world_x(); - float wy = ui_mouse_world_y(); - - float px = fx2f(q->points[v].x); - float py = fx2f(q->points[v].y); - - float dx = (px - wx); - float dy = (py - wy); - if(dx*dx+dy*dy < 10*10) - ui_set_hot_item(id); - - // draw selection background - if(editor.selected_quad == quad_index && editor.selected_points&(1< 0.5f) - moved = true; - } - - if(moved) - { - if(operation == OP_MOVEPOINT) - { - for(int m = 0; m < 4; m++) - if(editor.selected_points&(1<points[m].x += f2fx(dx); - q->points[m].y += f2fx(dy); - } - } - else if(operation == OP_MOVEUV) - { - for(int m = 0; m < 4; m++) - if(editor.selected_points&(1<texcoords[m].x += f2fx(dx*0.001f); - q->texcoords[m].y += f2fx(dy*0.001f); - } - } - } - - if(operation == OP_CONTEXT_MENU) - { - if(!ui_mouse_button(1)) - { - static int point_popup_id = 0; - ui_invoke_popup_menu(&point_popup_id, 0, ui_mouse_x(), ui_mouse_y(), 120, 150, popup_point); - ui_set_active_item(0); - } - } - else - { - if(!ui_mouse_button(0)) - { - if(!moved) - { - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - editor.selected_points ^= 1<visible) - editor.map.groups[g]->render(); - //ui_clip_enable(&view); - } - - // render the game above everything else - if(editor.map.game_group->visible && editor.map.game_layer->visible) - { - editor.map.game_group->mapscreen(); - editor.map.game_layer->render(); - } - } - - static void *editor_id = (void *)&editor_id; - int inside = ui_mouse_inside(&view); - - // fetch mouse position - float wx = ui_mouse_world_x(); - float wy = ui_mouse_world_y(); - float mx = ui_mouse_x(); - float my = ui_mouse_y(); - - static float start_wx = 0; - static float start_wy = 0; - static float start_mx = 0; - static float start_my = 0; - - enum - { - OP_NONE=0, - OP_BRUSH_GRAB, - OP_BRUSH_DRAW, - OP_PAN_WORLD, - OP_PAN_EDITOR, - }; - - // remap the screen so it can display the whole tileset - if(show_picker) - { - RECT screen = *ui_screen(); - float size = 32.0*16.0f; - float w = size*(screen.w/view.w); - float h = size*(screen.h/view.h); - float x = -(view.x/screen.w)*w; - float y = -(view.y/screen.h)*h; - wx = x+w*mx/screen.w; - wy = y+h*my/screen.h; - gfx_mapscreen(x, y, x+w, y+h); - LAYER_TILES *t = (LAYER_TILES *)editor.get_selected_layer_type(0, LAYERTYPE_TILES); - if(t) - { - tileset_picker.image = t->image; - tileset_picker.tex_id = t->tex_id; - tileset_picker.render(); - } - } - - static int operation = OP_NONE; - - // draw layer borders - LAYER *edit_layers[16]; - int num_edit_layers = 0; - num_edit_layers = 0; - - if(show_picker) - { - edit_layers[0] = &tileset_picker; - num_edit_layers++; - } - else - { - edit_layers[0] = editor.get_selected_layer(0); - if(edit_layers[0]) - num_edit_layers++; - - LAYERGROUP *g = editor.get_selected_group(); - if(g) - { - g->mapscreen(); - - for(int i = 0; i < num_edit_layers; i++) - { - if(edit_layers[i]->type != LAYERTYPE_TILES) - continue; - - float w, h; - edit_layers[i]->get_size(&w, &h); - - gfx_texture_set(-1); - gfx_lines_begin(); - gfx_lines_draw(0,0, w,0); - gfx_lines_draw(w,0, w,h); - gfx_lines_draw(w,h, 0,h); - gfx_lines_draw(0,h, 0,0); - gfx_lines_end(); - } - } - } - - if(inside) - { - ui_set_hot_item(editor_id); - - // do global operations like pan and zoom - if(ui_active_item() == 0 && (ui_mouse_button(0) || ui_mouse_button(2))) - { - start_wx = wx; - start_wy = wy; - start_mx = mx; - start_my = my; - - if(inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL) || ui_mouse_button(2)) - { - if(inp_key_pressed(KEY_LSHIFT)) - operation = OP_PAN_EDITOR; - else - operation = OP_PAN_WORLD; - ui_set_active_item(editor_id); - } - } - - // brush editing - if(ui_hot_item() == editor_id) - { - if(brush.is_empty()) - editor.tooltip = "Use left mouse button to drag and create a brush."; - else - editor.tooltip = "Use left mouse button to paint with the brush. Right button clears the brush."; - - if(ui_active_item() == editor_id) - { - RECT r; - r.x = start_wx; - r.y = start_wy; - r.w = wx-start_wx; - r.h = wy-start_wy; - if(r.w < 0) - { - r.x += r.w; - r.w = -r.w; - } - - if(r.h < 0) - { - r.y += r.h; - r.h = -r.h; - } - - if(operation == OP_BRUSH_DRAW) - { - if(!brush.is_empty()) - { - // draw with brush - for(int k = 0; k < num_edit_layers; k++) - { - if(edit_layers[k]->type == brush.layers[0]->type) - edit_layers[k]->brush_draw(brush.layers[0], wx, wy); - } - } - } - else if(operation == OP_BRUSH_GRAB) - { - if(!ui_mouse_button(0)) - { - // grab brush - dbg_msg("editor", "grabbing %f %f %f %f", r.x, r.y, r.w, r.h); - - // TODO: do all layers - int grabs = 0; - for(int k = 0; k < num_edit_layers; k++) - grabs += edit_layers[k]->brush_grab(&brush, r); - if(grabs == 0) - brush.clear(); - } - else - { - //editor.map.groups[selected_group]->mapscreen(); - for(int k = 0; k < num_edit_layers; k++) - edit_layers[k]->brush_selecting(r); - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - } - } - } - else - { - if(ui_mouse_button(1)) - brush.clear(); - - if(ui_mouse_button(0) && operation == OP_NONE) - { - ui_set_active_item(editor_id); - - if(brush.is_empty()) - operation = OP_BRUSH_GRAB; - else - { - operation = OP_BRUSH_DRAW; - for(int k = 0; k < num_edit_layers; k++) - { - if(edit_layers[k]->type == brush.layers[0]->type) - edit_layers[k]->brush_place(brush.layers[0], wx, wy); - } - - } - } - - if(!brush.is_empty()) - { - brush.offset_x = -(int)wx; - brush.offset_y = -(int)wy; - for(int i = 0; i < brush.layers.len(); i++) - { - if(brush.layers[i]->type == LAYERTYPE_TILES) - { - brush.offset_x = -(int)(wx/32.0f)*32; - brush.offset_y = -(int)(wy/32.0f)*32; - break; - } - } - - LAYERGROUP *g = editor.get_selected_group(); - brush.offset_x += g->offset_x; - brush.offset_y += g->offset_y; - brush.parallax_x = g->parallax_x; - brush.parallax_y = g->parallax_y; - brush.render(); - float w, h; - brush.get_size(&w, &h); - - gfx_texture_set(-1); - gfx_lines_begin(); - gfx_lines_draw(0,0, w,0); - gfx_lines_draw(w,0, w,h); - gfx_lines_draw(w,h, 0,h); - gfx_lines_draw(0,h, 0,0); - gfx_lines_end(); - - } - } - } - - // quad editing - { - if(!show_picker && brush.is_empty()) - { - // fetch layers - LAYERGROUP *g = editor.get_selected_group(); - if(g) - g->mapscreen(); - - for(int k = 0; k < num_edit_layers; k++) - { - if(edit_layers[k]->type == LAYERTYPE_QUADS) - { - LAYER_QUADS *layer = (LAYER_QUADS *)edit_layers[k]; - - gfx_texture_set(-1); - gfx_quads_begin(); - for(int i = 0; i < layer->quads.len(); i++) - { - for(int v = 0; v < 4; v++) - do_quad_point(&layer->quads[i], i, v); - - do_quad(&layer->quads[i], i); - } - gfx_quads_end(); - } - } - - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - } - - // do panning - if(ui_active_item() == editor_id) - { - if(operation == OP_PAN_WORLD) - { - editor.world_offset_x -= editor.mouse_delta_x*editor.world_zoom; - editor.world_offset_y -= editor.mouse_delta_y*editor.world_zoom; - } - else if(operation == OP_PAN_EDITOR) - { - editor.editor_offset_x -= editor.mouse_delta_x*editor.world_zoom; - editor.editor_offset_y -= editor.mouse_delta_y*editor.world_zoom; - } - - // release mouse - if(!ui_mouse_button(0)) - { - operation = OP_NONE; - ui_set_active_item(0); - } - } - } - } - - if(editor.get_selected_group() && editor.get_selected_group()->use_clipping) - { - LAYERGROUP *g = editor.map.game_group; - g->mapscreen(); - - gfx_texture_set(-1); - gfx_lines_begin(); - - RECT r; - r.x = editor.get_selected_group()->clip_x; - r.y = editor.get_selected_group()->clip_y; - r.w = editor.get_selected_group()->clip_w; - r.h = editor.get_selected_group()->clip_h; - - gfx_setcolor(1,0,0,1); - gfx_lines_draw(r.x, r.y, r.x+r.w, r.y); - gfx_lines_draw(r.x+r.w, r.y, r.x+r.w, r.y+r.h); - gfx_lines_draw(r.x+r.w, r.y+r.h, r.x, r.y+r.h); - gfx_lines_draw(r.x, r.y+r.h, r.x, r.y); - - gfx_lines_end(); - } - - // render screen sizes - if(editor.proof_borders) - { - LAYERGROUP *g = editor.map.game_group; - g->mapscreen(); - - gfx_texture_set(-1); - gfx_lines_begin(); - - float last_points[4]; - float start = 1.0f; //9.0f/16.0f; - float end = 16.0f/9.0f; - const int num_steps = 20; - for(int i = 0; i <= num_steps; i++) - { - float points[4]; - float aspect = start + (end-start)*(i/(float)num_steps); - - mapscreen_to_world( - editor.world_offset_x, editor.world_offset_y, - 1.0f, 1.0f, 0.0f, 0.0f, aspect, 1.0f, points); - - if(i == 0) - { - gfx_lines_draw(points[0], points[1], points[2], points[1]); - gfx_lines_draw(points[0], points[3], points[2], points[3]); - } - - if(i != 0) - { - gfx_lines_draw(points[0], points[1], last_points[0], last_points[1]); - gfx_lines_draw(points[2], points[1], last_points[2], last_points[1]); - gfx_lines_draw(points[0], points[3], last_points[0], last_points[3]); - gfx_lines_draw(points[2], points[3], last_points[2], last_points[3]); - } - - if(i == num_steps) - { - gfx_lines_draw(points[0], points[1], points[0], points[3]); - gfx_lines_draw(points[2], points[1], points[2], points[3]); - } - - mem_copy(last_points, points, sizeof(points)); - } - - if(1) - { - gfx_setcolor(1,0,0,1); - for(int i = 0; i < 2; i++) - { - float points[4]; - float aspects[] = {4.0f/3.0f, 16.0f/10.0f, 5.0f/4.0f, 16.0f/9.0f}; - float aspect = aspects[i]; - - mapscreen_to_world( - editor.world_offset_x, editor.world_offset_y, - 1.0f, 1.0f, 0.0f, 0.0f, aspect, 1.0f, points); - - RECT r; - r.x = points[0]; - r.y = points[1]; - r.w = points[2]-points[0]; - r.h = points[3]-points[1]; - - gfx_lines_draw(r.x, r.y, r.x+r.w, r.y); - gfx_lines_draw(r.x+r.w, r.y, r.x+r.w, r.y+r.h); - gfx_lines_draw(r.x+r.w, r.y+r.h, r.x, r.y+r.h); - gfx_lines_draw(r.x, r.y+r.h, r.x, r.y); - gfx_setcolor(0,1,0,1); - } - } - - gfx_lines_end(); - } - - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - //ui_clip_disable(); -} - - -int EDITOR::do_properties(RECT *toolbox, PROPERTY *props, int *ids, int *new_val) -{ - int change = -1; - - for(int i = 0; props[i].name; i++) - { - RECT slot; - ui_hsplit_t(toolbox, 13.0f, &slot, toolbox); - RECT label, shifter; - ui_vsplit_mid(&slot, &label, &shifter); - ui_hmargin(&shifter, 1.0f, &shifter); - ui_do_label(&label, props[i].name, 10.0f, -1, -1); - - if(props[i].type == PROPTYPE_INT_STEP) - { - RECT inc, dec; - char buf[64]; - - ui_vsplit_r(&shifter, 10.0f, &shifter, &inc); - ui_vsplit_l(&shifter, 10.0f, &dec, &shifter); - sprintf(buf, "%d", props[i].value); - ui_draw_rect(&shifter, vec4(1,1,1,0.5f), 0, 0.0f); - ui_do_label(&shifter, buf, 10.0f, 0, -1); - - if(do_editor_button(&ids[i], 0, 0, &dec, draw_dec_button, 0, "Decrease")) - { - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - *new_val = props[i].value-5; - else - *new_val = props[i].value-1; - change = i; - } - if(do_editor_button(((char *)&ids[i])+1, 0, 0, &inc, draw_inc_button, 0, "Increase")) - { - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - *new_val = props[i].value+5; - else - *new_val = props[i].value+1; - change = i; - } - } - else if(props[i].type == PROPTYPE_BOOL) - { - RECT no, yes; - ui_vsplit_mid(&shifter, &no, &yes); - if(do_editor_button(&ids[i], "No", !props[i].value, &no, draw_dec_button, 0, "")) - { - *new_val = 0; - change = i; - } - if(do_editor_button(((char *)&ids[i])+1, "Yes", props[i].value, &yes, draw_inc_button, 0, "")) - { - *new_val = 1; - change = i; - } - } - else if(props[i].type == PROPTYPE_INT_SCROLL) - { - int new_value = ui_do_value_selector(&ids[i], &shifter, "", props[i].value, props[i].min, props[i].max, 1.0f); - if(new_value != props[i].value) - { - *new_val = new_value; - change = i; - } - } - else if(props[i].type == PROPTYPE_COLOR) - { - static const char *texts[4] = {"R", "G", "B", "A"}; - static int shift[] = {24, 16, 8, 0}; - int new_color = 0; - - for(int c = 0; c < 4; c++) - { - int v = (props[i].value >> shift[c])&0xff; - new_color |= ui_do_value_selector(((char *)&ids[i])+c, &shifter, texts[c], v, 0, 255, 1.0f)<name); - - if(do_editor_button(&ids[i], buf, 0, &shifter, draw_editor_button, 0, 0)) - popup_select_image_invoke(props[i].value, ui_mouse_x(), ui_mouse_y()); - - int r = popup_select_image_result(); - if(r >= -1) - { - *new_val = r; - change = i; - } - } - } - - return change; -} - -static void render_layers(RECT toolbox, RECT toolbar, RECT view) -{ - RECT layersbox = toolbox; - - if(!editor.gui_active) - return; - - RECT slot, button; - char buf[64]; - - int valid_group = 0; - int valid_layer = 0; - if(editor.selected_group >= 0 && editor.selected_group < editor.map.groups.len()) - valid_group = 1; - - if(valid_group && editor.selected_layer >= 0 && editor.selected_layer < editor.map.groups[editor.selected_group]->layers.len()) - valid_layer = 1; - - // render layers - { - for(int g = 0; g < editor.map.groups.len(); g++) - { - RECT visible_toggle; - ui_hsplit_t(&layersbox, 12.0f, &slot, &layersbox); - ui_vsplit_l(&slot, 12, &visible_toggle, &slot); - if(do_editor_button(&editor.map.groups[g]->visible, editor.map.groups[g]->visible?"V":"H", 0, &visible_toggle, draw_editor_button_l, 0, "Toggle group visibility")) - editor.map.groups[g]->visible = !editor.map.groups[g]->visible; - - sprintf(buf, "#%d %s", g, editor.map.groups[g]->name); - if(int result = do_editor_button(&editor.map.groups[g], buf, g==editor.selected_group, &slot, draw_editor_button_r, - BUTTON_CONTEXT, "Select group. Right click for properties.")) - { - editor.selected_group = g; - editor.selected_layer = 0; - - static int group_popup_id = 0; - if(result == 2) - ui_invoke_popup_menu(&group_popup_id, 0, ui_mouse_x(), ui_mouse_y(), 120, 200, popup_group); - } - - - ui_hsplit_t(&layersbox, 2.0f, &slot, &layersbox); - - for(int i = 0; i < editor.map.groups[g]->layers.len(); i++) - { - //visible - ui_hsplit_t(&layersbox, 12.0f, &slot, &layersbox); - ui_vsplit_l(&slot, 12.0f, 0, &button); - ui_vsplit_l(&button, 15, &visible_toggle, &button); - - if(do_editor_button(&editor.map.groups[g]->layers[i]->visible, editor.map.groups[g]->layers[i]->visible?"V":"H", 0, &visible_toggle, draw_editor_button_l, 0, "Toggle layer visibility")) - editor.map.groups[g]->layers[i]->visible = !editor.map.groups[g]->layers[i]->visible; - - sprintf(buf, "#%d %s ", i, editor.map.groups[g]->layers[i]->type_name); - if(int result = do_editor_button(editor.map.groups[g]->layers[i], buf, g==editor.selected_group&&i==editor.selected_layer, &button, draw_editor_button_r, - BUTTON_CONTEXT, "Select layer. Right click for properties.")) - { - editor.selected_layer = i; - editor.selected_group = g; - static int layer_popup_id = 0; - if(result == 2) - ui_invoke_popup_menu(&layer_popup_id, 0, ui_mouse_x(), ui_mouse_y(), 120, 150, popup_layer); - } - - - ui_hsplit_t(&layersbox, 2.0f, &slot, &layersbox); - } - ui_hsplit_t(&layersbox, 5.0f, &slot, &layersbox); - } - } - - - { - ui_hsplit_t(&layersbox, 12.0f, &slot, &layersbox); - - static int new_group_button = 0; - if(do_editor_button(&new_group_button, "Add Group", 0, &slot, draw_editor_button, 0, "Adds a new group")) - { - editor.map.new_group(); - editor.selected_group = editor.map.groups.len()-1; - } - } - - ui_hsplit_t(&layersbox, 5.0f, &slot, &layersbox); - -} - -static void extract_name(const char *filename, char *name) -{ - int len = strlen(filename); - int start = len; - int end = len; - - while(start > 0) - { - start--; - if(filename[start] == '/' || filename[start] == '\\') - { - start++; - break; - } - } - - end = start; - for(int i = start; i < len; i++) - { - if(filename[i] == '.') - end = i; - } - - if(end == start) - end = len; - - int final_len = end-start; - mem_copy(name, &filename[start], final_len); - name[final_len] = 0; - dbg_msg("", "%s %s %d %d", filename, name, start, end); -} - -static void replace_image(const char *filename) -{ - EDITOR_IMAGE imginfo; - if(!gfx_load_png(&imginfo, filename)) - return; - - EDITOR_IMAGE *img = editor.map.images[editor.selected_image]; - gfx_unload_texture(img->tex_id); - *img = imginfo; - extract_name(filename, img->name); - img->tex_id = gfx_load_texture_raw(imginfo.width, imginfo.height, imginfo.format, imginfo.data, IMG_AUTO, 0); -} - -static void add_image(const char *filename) -{ - EDITOR_IMAGE imginfo; - if(!gfx_load_png(&imginfo, filename)) - return; - - EDITOR_IMAGE *img = new EDITOR_IMAGE; - *img = imginfo; - img->tex_id = gfx_load_texture_raw(imginfo.width, imginfo.height, imginfo.format, imginfo.data, IMG_AUTO, 0); - img->external = 1; // external by default - extract_name(filename, img->name); - editor.map.images.add(img); -} - - -static int modify_index_deleted_index; -static void modify_index_deleted(int *index) -{ - if(*index == modify_index_deleted_index) - *index = -1; - else if(*index > modify_index_deleted_index) - *index = *index - 1; -} - -static int popup_image(RECT view) -{ - static int replace_button = 0; - static int remove_button = 0; - - RECT slot; - ui_hsplit_t(&view, 2.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - EDITOR_IMAGE *img = editor.map.images[editor.selected_image]; - - static int external_button = 0; - if(img->external) - { - if(do_editor_button(&external_button, "Embedd", 0, &slot, draw_editor_button_menuitem, 0, "Embedds the image into the map file.")) - { - img->external = 0; - return 1; - } - } - else - { - if(do_editor_button(&external_button, "Make external", 0, &slot, draw_editor_button_menuitem, 0, "Removes the image from the map file.")) - { - img->external = 1; - return 1; - } - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&replace_button, "Replace", 0, &slot, draw_editor_button_menuitem, 0, "Replaces the image with a new one")) - { - editor.invoke_file_dialog(LISTDIRTYPE_ALL, "Replace Image", "Replace", "mapres/", "", replace_image); - return 1; - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&remove_button, "Remove", 0, &slot, draw_editor_button_menuitem, 0, "Removes the image from the map")) - { - delete img; - editor.map.images.removebyindex(editor.selected_image); - modify_index_deleted_index = editor.selected_image; - editor.map.modify_image_index(modify_index_deleted); - return 1; - } - - return 0; -} - - -static void render_images(RECT toolbox, RECT toolbar, RECT view) -{ - for(int e = 0; e < 2; e++) // two passes, first embedded, then external - { - RECT slot; - ui_hsplit_t(&toolbox, 15.0f, &slot, &toolbox); - if(e == 0) - ui_do_label(&slot, "Embedded", 12.0f, 0); - else - ui_do_label(&slot, "External", 12.0f, 0); - - for(int i = 0; i < editor.map.images.len(); i++) - { - if((e && !editor.map.images[i]->external) || - (!e && editor.map.images[i]->external)) - { - continue; - } - - char buf[128]; - sprintf(buf, "%s", editor.map.images[i]->name); - ui_hsplit_t(&toolbox, 12.0f, &slot, &toolbox); - - if(int result = do_editor_button(&editor.map.images[i], buf, editor.selected_image == i, &slot, draw_editor_button, - BUTTON_CONTEXT, "Select image")) - { - editor.selected_image = i; - - static int popup_image_id = 0; - if(result == 2) - ui_invoke_popup_menu(&popup_image_id, 0, ui_mouse_x(), ui_mouse_y(), 120, 80, popup_image); - } - - ui_hsplit_t(&toolbox, 2.0f, 0, &toolbox); - - // render image - if(editor.selected_image == i) - { - RECT r; - ui_margin(&view, 10.0f, &r); - if(r.h < r.w) - r.w = r.h; - else - r.h = r.w; - gfx_texture_set(editor.map.images[i]->tex_id); - gfx_blend_normal(); - gfx_quads_begin(); - gfx_quads_drawTL(r.x, r.y, r.w, r.h); - gfx_quads_end(); - - } - } - } - - RECT slot; - ui_hsplit_t(&toolbox, 5.0f, &slot, &toolbox); - - // new image - static int new_image_button = 0; - ui_hsplit_t(&toolbox, 10.0f, &slot, &toolbox); - ui_hsplit_t(&toolbox, 12.0f, &slot, &toolbox); - if(do_editor_button(&new_image_button, "Add", 0, &slot, draw_editor_button, 0, "Load a new image to use in the map")) - editor.invoke_file_dialog(LISTDIRTYPE_ALL, "Add Image", "Add", "mapres/", "", add_image); -} - - -static int file_dialog_dirtypes = 0; -static const char *file_dialog_title = 0; -static const char *file_dialog_button_text = 0; -static void (*file_dialog_func)(const char *filename); -static char file_dialog_filename[512] = {0}; -static char file_dialog_path[512] = {0}; -static char file_dialog_complete_filename[512] = {0}; -static int files_num = 0; -int files_startat = 0; -int files_cur = 0; -int files_stopat = 999; - -static void editor_listdir_callback(const char *name, int is_dir, void *user) -{ - if(name[0] == '.' || is_dir) // skip this shit! - return; - - if(files_cur > files_num) - files_num = files_cur; - - files_cur++; - if(files_cur-1 < files_startat || files_cur > files_stopat) - return; - - RECT *view = (RECT *)user; - RECT button; - ui_hsplit_t(view, 15.0f, &button, view); - ui_hsplit_t(view, 2.0f, 0, view); - //char buf[512]; - - if(do_editor_button((void*)(10+(int)button.y), name, 0, &button, draw_editor_button_file, 0, 0)) - { - strncpy(file_dialog_filename, name, sizeof(file_dialog_filename)); - - file_dialog_complete_filename[0] = 0; - strcat(file_dialog_complete_filename, file_dialog_path); - strcat(file_dialog_complete_filename, file_dialog_filename); - - if(inp_mouse_doubleclick()) - { - if(file_dialog_func) - file_dialog_func(file_dialog_complete_filename); - editor.dialog = DIALOG_NONE; - } - } -} - -static void render_file_dialog() -{ - // GUI coordsys - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - - RECT view = *ui_screen(); - ui_draw_rect(&view, vec4(0,0,0,0.25f), 0, 0); - ui_vmargin(&view, 150.0f, &view); - ui_hmargin(&view, 50.0f, &view); - ui_draw_rect(&view, vec4(0,0,0,0.75f), CORNER_ALL, 5.0f); - ui_margin(&view, 10.0f, &view); - - RECT title, filebox, filebox_label, buttonbar, scroll; - ui_hsplit_t(&view, 18.0f, &title, &view); - ui_hsplit_t(&view, 5.0f, 0, &view); // some spacing - ui_hsplit_b(&view, 14.0f, &view, &buttonbar); - ui_hsplit_b(&view, 10.0f, &view, 0); // some spacing - ui_hsplit_b(&view, 14.0f, &view, &filebox); - ui_vsplit_l(&filebox, 50.0f, &filebox_label, &filebox); - ui_vsplit_r(&view, 15.0f, &view, &scroll); - - // title - ui_draw_rect(&title, vec4(1,1,1,0.25f), CORNER_ALL, 5.0f); - ui_vmargin(&title, 10.0f, &title); - ui_do_label(&title, file_dialog_title, 14.0f, -1, -1); - - // filebox - ui_do_label(&filebox_label, "Filename:", 10.0f, -1, -1); - - static int filebox_id = 0; - ui_do_edit_box(&filebox_id, &filebox, file_dialog_filename, sizeof(file_dialog_filename), 10.0f); - - file_dialog_complete_filename[0] = 0; - strcat(file_dialog_complete_filename, file_dialog_path); - strcat(file_dialog_complete_filename, file_dialog_filename); - - int num = (int)(view.h/17.0); - static float scrollvalue = 0; - static int scrollbar = 0; - ui_hmargin(&scroll, 5.0f, &scroll); - scrollvalue = ui_do_scrollbar_v(&scrollbar, &scroll, scrollvalue); - - int scrollnum = files_num-num+10; - if(scrollnum > 0) - { - if(inp_key_presses(KEY_MOUSE_WHEEL_UP)) - scrollvalue -= 3.0f/scrollnum; - if(inp_key_presses(KEY_MOUSE_WHEEL_DOWN)) - scrollvalue += 3.0f/scrollnum; - - if(scrollvalue < 0) scrollvalue = 0; - if(scrollvalue > 1) scrollvalue = 1; - } - else - scrollnum = 0; - - files_startat = (int)(scrollnum*scrollvalue); - if(files_startat < 0) - files_startat = 0; - - files_stopat = files_startat+num; - - files_cur = 0; - - // set clipping - ui_clip_enable(&view); - - // the list - engine_listdir(file_dialog_dirtypes, file_dialog_path, editor_listdir_callback, &view); - - // disable clipping again - ui_clip_disable(); - - // the buttons - static int ok_button = 0; - static int cancel_button = 0; - - RECT button; - ui_vsplit_r(&buttonbar, 50.0f, &buttonbar, &button); - if(do_editor_button(&ok_button, file_dialog_button_text, 0, &button, draw_editor_button, 0, 0) || inp_key_pressed(KEY_RETURN)) - { - if(file_dialog_func) - file_dialog_func(file_dialog_complete_filename); - editor.dialog = DIALOG_NONE; - } - - ui_vsplit_r(&buttonbar, 40.0f, &buttonbar, &button); - ui_vsplit_r(&buttonbar, 50.0f, &buttonbar, &button); - if(do_editor_button(&cancel_button, "Cancel", 0, &button, draw_editor_button, 0, 0) || inp_key_pressed(KEY_ESCAPE)) - editor.dialog = DIALOG_NONE; -} - -void EDITOR::invoke_file_dialog(int listdirtypes, const char *title, const char *button_text, - const char *basepath, const char *default_name, - void (*func)(const char *filename)) -{ - file_dialog_dirtypes = listdirtypes; - file_dialog_title = title; - file_dialog_button_text = button_text; - file_dialog_func = func; - file_dialog_filename[0] = 0; - file_dialog_path[0] = 0; - - if(default_name) - strncpy(file_dialog_filename, default_name, sizeof(file_dialog_filename)); - if(basepath) - strncpy(file_dialog_path, basepath, sizeof(file_dialog_path)); - - editor.dialog = DIALOG_FILE; -} - - - -static void render_modebar(RECT view) -{ - RECT button; - - // mode buttons - { - ui_vsplit_l(&view, 40.0f, &button, &view); - static int tile_button = 0; - if(do_editor_button(&tile_button, "Layers", editor.mode == MODE_LAYERS, &button, draw_editor_button_m, 0, "Switch to edit layers.")) - editor.mode = MODE_LAYERS; - - ui_vsplit_l(&view, 40.0f, &button, &view); - static int img_button = 0; - if(do_editor_button(&img_button, "Images", editor.mode == MODE_IMAGES, &button, draw_editor_button_r, 0, "Switch to manage images.")) - editor.mode = MODE_IMAGES; - } - - ui_vsplit_l(&view, 5.0f, 0, &view); - - // spacing - //ui_vsplit_l(&view, 10.0f, 0, &view); -} - -static void render_statusbar(RECT view) -{ - RECT button; - ui_vsplit_r(&view, 60.0f, &view, &button); - static int envelope_button = 0; - if(do_editor_button(&envelope_button, "Envelopes", editor.show_envelope_editor, &button, draw_editor_button, 0, "Toggles the envelope editor.")) - editor.show_envelope_editor = (editor.show_envelope_editor+1)%4; - - if(editor.tooltip) - { - if(ui_got_context && ui_got_context == ui_hot_item()) - { - char buf[512]; - sprintf(buf, "%s Right click for context menu.", editor.tooltip); - ui_do_label(&view, buf, 10.0f, -1, -1); - } - else - ui_do_label(&view, editor.tooltip, 10.0f, -1, -1); - } -} - -static void render_envelopeeditor(RECT view) -{ - if(editor.selected_envelope < 0) editor.selected_envelope = 0; - if(editor.selected_envelope >= editor.map.envelopes.len()) editor.selected_envelope--; - - ENVELOPE *envelope = 0; - if(editor.selected_envelope >= 0 && editor.selected_envelope < editor.map.envelopes.len()) - envelope = editor.map.envelopes[editor.selected_envelope]; - - bool show_colorbar = false; - if(envelope && envelope->channels == 4) - show_colorbar = true; - - RECT toolbar, curvebar, colorbar; - ui_hsplit_t(&view, 15.0f, &toolbar, &view); - ui_hsplit_t(&view, 15.0f, &curvebar, &view); - ui_margin(&toolbar, 2.0f, &toolbar); - ui_margin(&curvebar, 2.0f, &curvebar); - - if(show_colorbar) - { - ui_hsplit_t(&view, 20.0f, &colorbar, &view); - ui_margin(&colorbar, 2.0f, &colorbar); - render_background(colorbar, checker_texture, 16.0f, 1.0f); - } - - render_background(view, checker_texture, 32.0f, 0.1f); - - // do the toolbar - { - RECT button; - ENVELOPE *new_env = 0; - - ui_vsplit_r(&toolbar, 50.0f, &toolbar, &button); - static int new_4d_button = 0; - if(do_editor_button(&new_4d_button, "Color+", 0, &button, draw_editor_button, 0, "Creates a new color envelope")) - new_env = editor.map.new_envelope(4); - - ui_vsplit_r(&toolbar, 5.0f, &toolbar, &button); - ui_vsplit_r(&toolbar, 50.0f, &toolbar, &button); - static int new_2d_button = 0; - if(do_editor_button(&new_2d_button, "Pos.+", 0, &button, draw_editor_button, 0, "Creates a new pos envelope")) - new_env = editor.map.new_envelope(3); - - if(new_env) // add the default points - { - if(new_env->channels == 4) - { - new_env->add_point(0, 1,1,1,1); - new_env->add_point(1000, 1,1,1,1); - } - else - { - new_env->add_point(0, 0); - new_env->add_point(1000, 0); - } - } - - RECT shifter, inc, dec; - ui_vsplit_l(&toolbar, 60.0f, &shifter, &toolbar); - ui_vsplit_r(&shifter, 15.0f, &shifter, &inc); - ui_vsplit_l(&shifter, 15.0f, &dec, &shifter); - char buf[512]; - sprintf(buf, "%d/%d", editor.selected_envelope+1, editor.map.envelopes.len()); - ui_draw_rect(&shifter, vec4(1,1,1,0.5f), 0, 0.0f); - ui_do_label(&shifter, buf, 10.0f, 0, -1); - - static int prev_button = 0; - if(do_editor_button(&prev_button, 0, 0, &dec, draw_dec_button, 0, "Previous Envelope")) - editor.selected_envelope--; - - static int next_button = 0; - if(do_editor_button(&next_button, 0, 0, &inc, draw_inc_button, 0, "Next Envelope")) - editor.selected_envelope++; - - if(envelope) - { - ui_vsplit_l(&toolbar, 15.0f, &button, &toolbar); - ui_vsplit_l(&toolbar, 35.0f, &button, &toolbar); - ui_do_label(&button, "Name:", 10.0f, -1, -1); - - ui_vsplit_l(&toolbar, 80.0f, &button, &toolbar); - - static int name_box = 0; - ui_do_edit_box(&name_box, &button, envelope->name, sizeof(envelope->name), 10.0f); - } - } - - if(envelope) - { - static array selection; - static int envelope_editor_id = 0; - static int active_channels = 0xf; - - if(envelope) - { - RECT button; - - ui_vsplit_l(&toolbar, 15.0f, &button, &toolbar); - - static const char *names[4][4] = { - {"X", "", "", ""}, - {"X", "Y", "", ""}, - {"X", "Y", "R", ""}, - {"R", "G", "B", "A"}, - }; - - static int channel_buttons[4] = {0}; - int bit = 1; - ui_draw_button_func draw_func; - - for(int i = 0; i < envelope->channels; i++, bit<<=1) - { - ui_vsplit_l(&toolbar, 15.0f, &button, &toolbar); - - if(i == 0) draw_func = draw_editor_button_l; - else if(i == envelope->channels-1) draw_func = draw_editor_button_r; - else draw_func = draw_editor_button_m; - - if(do_editor_button(&channel_buttons[i], names[envelope->channels-1][i], active_channels&bit, &button, draw_func, 0, 0)) - active_channels ^= bit; - } - } - - float end_time = envelope->end_time(); - if(end_time < 1) - end_time = 1; - - envelope->find_top_bottom(active_channels); - float top = envelope->top; - float bottom = envelope->bottom; - - if(top < 1) - top = 1; - if(bottom >= 0) - bottom = 0; - - float timescale = end_time/view.w; - float valuescale = (top-bottom)/view.h; - - if(ui_mouse_inside(&view)) - ui_set_hot_item(&envelope_editor_id); - - if(ui_hot_item() == &envelope_editor_id) - { - // do stuff - if(envelope) - { - if(ui_mouse_button_clicked(1)) - { - // add point - int time = (int)(((ui_mouse_x()-view.x)*timescale)*1000.0f); - //float env_y = (ui_mouse_y()-view.y)/timescale; - float channels[4]; - envelope->eval(time, channels); - envelope->add_point(time, - f2fx(channels[0]), f2fx(channels[1]), - f2fx(channels[2]), f2fx(channels[3])); - } - - editor.tooltip = "Press right mouse button to create a new point"; - } - } - - vec3 colors[] = {vec3(1,0.2f,0.2f), vec3(0.2f,1,0.2f), vec3(0.2f,0.2f,1), vec3(1,1,0.2f)}; - - // render lines - { - ui_clip_enable(&view); - gfx_texture_set(-1); - gfx_lines_begin(); - for(int c = 0; c < envelope->channels; c++) - { - if(active_channels&(1<eval(0.000001f, results); - float prev_value = results[c]; - - int steps = (int)((view.w/ui_screen()->w) * gfx_screenwidth()); - for(int i = 1; i <= steps; i++) - { - float a = i/(float)steps; - envelope->eval(a*end_time, results); - float v = results[c]; - v = (v-bottom)/(top-bottom); - - gfx_lines_draw(view.x + prev_x*view.w, view.y+view.h - prev_value*view.h, view.x + a*view.w, view.y+view.h - v*view.h); - prev_x = a; - prev_value = v; - } - } - gfx_lines_end(); - ui_clip_disable(); - } - - // render curve options - { - for(int i = 0; i < envelope->points.len()-1; i++) - { - float t0 = envelope->points[i].time/1000.0f/end_time; - float t1 = envelope->points[i+1].time/1000.0f/end_time; - - //dbg_msg("", "%f", end_time); - - RECT v; - v.x = curvebar.x + (t0+(t1-t0)*0.5f) * curvebar.w; - v.y = curvebar.y; - v.h = curvebar.h; - v.w = curvebar.h; - v.x -= v.w/2; - void *id = &envelope->points[i].curvetype; - const char *type_name[] = { - "N", "L", "S", "F", "M" - }; - - if(do_editor_button(id, type_name[envelope->points[i].curvetype], 0, &v, draw_editor_button, 0, "Switch curve type")) - envelope->points[i].curvetype = (envelope->points[i].curvetype+1)%NUM_CURVETYPES; - } - } - - // render colorbar - if(show_colorbar) - { - gfx_texture_set(-1); - gfx_quads_begin(); - for(int i = 0; i < envelope->points.len()-1; i++) - { - float r0 = fx2f(envelope->points[i].values[0]); - float g0 = fx2f(envelope->points[i].values[1]); - float b0 = fx2f(envelope->points[i].values[2]); - float a0 = fx2f(envelope->points[i].values[3]); - float r1 = fx2f(envelope->points[i+1].values[0]); - float g1 = fx2f(envelope->points[i+1].values[1]); - float b1 = fx2f(envelope->points[i+1].values[2]); - float a1 = fx2f(envelope->points[i+1].values[3]); - - gfx_setcolorvertex(0, r0, g0, b0, a0); - gfx_setcolorvertex(1, r1, g1, b1, a1); - gfx_setcolorvertex(2, r1, g1, b1, a1); - gfx_setcolorvertex(3, r0, g0, b0, a0); - - float x0 = envelope->points[i].time/1000.0f/end_time; -// float y0 = (fx2f(envelope->points[i].values[c])-bottom)/(top-bottom); - float x1 = envelope->points[i+1].time/1000.0f/end_time; - //float y1 = (fx2f(envelope->points[i+1].values[c])-bottom)/(top-bottom); - RECT v; - v.x = colorbar.x + x0*colorbar.w; - v.y = colorbar.y; - v.w = (x1-x0)*colorbar.w; - v.h = colorbar.h; - - gfx_quads_drawTL(v.x, v.y, v.w, v.h); - } - gfx_quads_end(); - } - - // render handles - { - static bool move = false; - - int current_value = 0, current_time = 0; - - gfx_texture_set(-1); - gfx_quads_begin(); - for(int c = 0; c < envelope->channels; c++) - { - if(!(active_channels&(1<points.len(); i++) - { - float x0 = envelope->points[i].time/1000.0f/end_time; - float y0 = (fx2f(envelope->points[i].values[c])-bottom)/(top-bottom); - RECT final; - final.x = view.x + x0*view.w; - final.y = view.y+view.h - y0*view.h; - final.x -= 2.0f; - final.y -= 2.0f; - final.w = 4.0f; - final.h = 4.0f; - - void *id = &envelope->points[i].values[c]; - - if(ui_mouse_inside(&final)) - ui_set_hot_item(id); - - float colormod = 1.0f; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - { - ui_set_active_item(0); - move = false; - } - else - { - envelope->points[i].values[c] -= f2fx(editor.mouse_delta_y*valuescale); - if(inp_key_pressed(KEY_LSHIFT) || inp_key_pressed(KEY_RSHIFT)) - { - if(i != 0) - { - envelope->points[i].time += (int)((editor.mouse_delta_x*timescale)*1000.0f); - if(envelope->points[i].time < envelope->points[i-1].time) - envelope->points[i].time = envelope->points[i-1].time + 1; - if(i+1 != envelope->points.len() && envelope->points[i].time > envelope->points[i+1].time) - envelope->points[i].time = envelope->points[i+1].time - 1; - } - } - } - - colormod = 100.0f; - gfx_setcolor(1,1,1,1); - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - selection.clear(); - selection.add(i); - ui_set_active_item(id); - } - - // remove point - if(ui_mouse_button_clicked(1)) - envelope->points.removebyindex(i); - - colormod = 100.0f; - gfx_setcolor(1,0.75f,0.75f,1); - editor.tooltip = "Left mouse to drag. Hold shift to alter time point aswell. Right click to delete."; - } - - if(ui_active_item() == id || ui_hot_item() == id) - { - current_time = envelope->points[i].time; - current_value = envelope->points[i].values[c]; - } - - gfx_setcolor(colors[c].r*colormod, colors[c].g*colormod, colors[c].b*colormod, 1.0f); - gfx_quads_drawTL(final.x, final.y, final.w, final.h); - } - } - gfx_quads_end(); - - char buf[512]; - sprintf(buf, "%.3f %.3f", current_time/1000.0f, fx2f(current_value)); - ui_do_label(&toolbar, buf, 10.0f, 0, -1); - } - } -} - -static int popup_menu_file(RECT view) -{ - static int new_map_button = 0; - static int save_button = 0; - static int save_as_button = 0; - static int open_button = 0; - static int append_button = 0; - static int exit_button = 0; - - RECT slot; - ui_hsplit_t(&view, 2.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&new_map_button, "New", 0, &slot, draw_editor_button_menuitem, 0, "Creates a new map")) - { - editor.reset(); - return 1; - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&open_button, "Open", 0, &slot, draw_editor_button_menuitem, 0, "Opens a map for editing")) - { - editor.invoke_file_dialog(LISTDIRTYPE_ALL, "Open Map", "Open", "maps/", "", callback_open_map); - return 1; - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&append_button, "Append", 0, &slot, draw_editor_button_menuitem, 0, "Opens a map and adds everything from that map to the current one")) - { - editor.invoke_file_dialog(LISTDIRTYPE_ALL, "Append Map", "Append", "maps/", "", callback_append_map); - return 1; - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&save_button, "Save (NOT IMPL)", 0, &slot, draw_editor_button_menuitem, 0, "Saves the current map")) - { - return 1; - } - - ui_hsplit_t(&view, 2.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&save_as_button, "Save As", 0, &slot, draw_editor_button_menuitem, 0, "Saves the current map under a new name")) - { - editor.invoke_file_dialog(LISTDIRTYPE_SAVE, "Save Map", "Save", "maps/", "", callback_save_map); - return 1; - } - - ui_hsplit_t(&view, 10.0f, &slot, &view); - ui_hsplit_t(&view, 12.0f, &slot, &view); - if(do_editor_button(&exit_button, "Exit", 0, &slot, draw_editor_button_menuitem, 0, "Exits from the editor")) - { - config.cl_editor = 0; - return 1; - } - - return 0; -} - -static void render_menubar(RECT menubar) -{ - static RECT file /*, view, help*/; - - ui_vsplit_l(&menubar, 60.0f, &file, &menubar); - if(do_editor_button(&file, "File", 0, &file, draw_editor_button_menu, 0, 0)) - ui_invoke_popup_menu(&file, 1, file.x, file.y+file.h-1.0f, 120, 150, popup_menu_file); - - /* - ui_vsplit_l(&menubar, 5.0f, 0, &menubar); - ui_vsplit_l(&menubar, 60.0f, &view, &menubar); - if(do_editor_button(&view, "View", 0, &view, draw_editor_button_menu, 0, 0)) - (void)0; - - ui_vsplit_l(&menubar, 5.0f, 0, &menubar); - ui_vsplit_l(&menubar, 60.0f, &help, &menubar); - if(do_editor_button(&help, "Help", 0, &help, draw_editor_button_menu, 0, 0)) - (void)0; - */ -} - -void EDITOR::render() -{ - // basic start - gfx_clear(1.0f,0.0f,1.0f); - RECT view = *ui_screen(); - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - - // reset tip - editor.tooltip = 0; - - // render checker - render_background(view, checker_texture, 32.0f, 1.0f); - - RECT menubar, modebar, toolbar, statusbar, envelope_editor, toolbox; - - if(editor.gui_active) - { - - ui_hsplit_t(&view, 16.0f, &menubar, &view); - ui_vsplit_l(&view, 80.0f, &toolbox, &view); - ui_hsplit_t(&view, 16.0f, &toolbar, &view); - ui_hsplit_b(&view, 16.0f, &view, &statusbar); - - if(editor.show_envelope_editor) - { - float size = 125.0f; - if(editor.show_envelope_editor == 2) - size *= 2.0f; - else if(editor.show_envelope_editor == 3) - size *= 3.0f; - ui_hsplit_b(&view, size, &view, &envelope_editor); - } - } - - // a little hack for now - if(editor.mode == MODE_LAYERS) - do_map_editor(view, toolbar); - - if(editor.gui_active) - { - float brightness = 0.25f; - render_background(menubar, background_texture, 128.0f, brightness*0); - ui_margin(&menubar, 2.0f, &menubar); - - render_background(toolbox, background_texture, 128.0f, brightness); - ui_margin(&toolbox, 2.0f, &toolbox); - - render_background(toolbar, background_texture, 128.0f, brightness); - ui_margin(&toolbar, 2.0f, &toolbar); - ui_vsplit_l(&toolbar, 150.0f, &modebar, &toolbar); - - render_background(statusbar, background_texture, 128.0f, brightness); - ui_margin(&statusbar, 2.0f, &statusbar); - - // do the toolbar - if(editor.mode == MODE_LAYERS) - do_toolbar(toolbar); - - if(editor.show_envelope_editor) - { - render_background(envelope_editor, background_texture, 128.0f, brightness); - ui_margin(&envelope_editor, 2.0f, &envelope_editor); - } - } - - - if(editor.mode == MODE_LAYERS) - render_layers(toolbox, toolbar, view); - else if(editor.mode == MODE_IMAGES) - render_images(toolbox, toolbar, view); - - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - - if(editor.gui_active) - { - render_menubar(menubar); - - render_modebar(modebar); - if(editor.show_envelope_editor) - render_envelopeeditor(envelope_editor); - } - - if(editor.dialog == DIALOG_FILE) - { - static int null_ui_target = 0; - ui_set_hot_item(&null_ui_target); - render_file_dialog(); - } - - - ui_do_popup_menu(); - - if(editor.gui_active) - render_statusbar(statusbar); - - // - if(config.ed_showkeys) - { - gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h); - TEXT_CURSOR cursor; - gfx_text_set_cursor(&cursor, view.x+10, view.y+view.h-24-10, 24.0f, TEXTFLAG_RENDER); - - int nkeys = 0; - for(int i = 0; i < KEY_LAST; i++) - { - if(inp_key_pressed(i)) - { - if(nkeys) - gfx_text_ex(&cursor, " + ", -1); - gfx_text_ex(&cursor, inp_key_name(i), -1); - nkeys++; - } - } - } - - if (editor.show_mouse_pointer) - { - // render butt ugly mouse cursor - float mx = ui_mouse_x(); - float my = ui_mouse_y(); - gfx_texture_set(cursor_texture); - gfx_quads_begin(); - if(ui_got_context == ui_hot_item()) - gfx_setcolor(1,0,0,1); - gfx_quads_drawTL(mx,my, 16.0f, 16.0f); - gfx_quads_end(); - } - -} - -void EDITOR::reset(bool create_default) -{ - editor.map.clean(); - - // create default layers - if(create_default) - editor.map.create_default(entities_texture); - - /* - { - }*/ - - selected_layer = 0; - selected_group = 0; - selected_quad = -1; - selected_points = 0; - selected_envelope = 0; - selected_image = 0; -} - -void MAP::make_game_layer(LAYER *layer) -{ - game_layer = (LAYER_GAME *)layer; - game_layer->tex_id = entities_texture; -} - -void MAP::make_game_group(LAYERGROUP *group) -{ - game_group = group; - game_group->game_group = true; - game_group->name = "Game"; -} - - - -void MAP::clean() -{ - groups.deleteall(); - envelopes.deleteall(); - images.deleteall(); - - game_layer = 0x0; - game_group = 0x0; -} - -void MAP::create_default(int entities_texture) -{ - make_game_group(new_group()); - make_game_layer(new LAYER_GAME(50, 50)); - game_group->add_layer(game_layer); -} - -extern "C" void editor_init() -{ - checker_texture = gfx_load_texture("editor/checker.png", IMG_AUTO, 0); - background_texture = gfx_load_texture("editor/background.png", IMG_AUTO, 0); - cursor_texture = gfx_load_texture("editor/cursor.png", IMG_AUTO, 0); - entities_texture = gfx_load_texture("editor/entities.png", IMG_AUTO, 0); - - tileset_picker.make_palette(); - tileset_picker.readonly = true; - - editor.reset(); -} - -extern "C" void editor_update_and_render() -{ - static int mouse_x = 0; - static int mouse_y = 0; - - if(editor.animate) - editor.animate_time = (time_get()-editor.animate_start)/(float)time_freq(); - else - editor.animate_time = 0; - ui_got_context = 0; - - // handle mouse movement - float mx, my, mwx, mwy; - int rx, ry; - { -#ifdef ANDROID - // No relative mouse here, we've got touchscreen - inp_mouse_absolute(&rx, &ry); - editor.mouse_delta_x = rx - mouse_x; - editor.mouse_delta_y = ry - mouse_y; - mouse_x = rx; - mouse_y = ry; -#else - inp_mouse_relative(&rx, &ry); - editor.mouse_delta_x = rx; - editor.mouse_delta_y = ry; - - if(!editor.lock_mouse) - { - mouse_x += rx; - mouse_y += ry; - } -#endif - - if(mouse_x < 0) mouse_x = 0; - if(mouse_y < 0) mouse_y = 0; - if(mouse_x > ui_screen()->w) mouse_x = (int)ui_screen()->w; - if(mouse_y > ui_screen()->h) mouse_y = (int)ui_screen()->h; - - // update the ui - mx = mouse_x; - my = mouse_y; - mwx = 0; - mwy = 0; - - // fix correct world x and y - LAYERGROUP *g = editor.get_selected_group(); - if(g) - { - float points[4]; - g->mapping(points); - - float world_width = points[2]-points[0]; - float world_height = points[3]-points[1]; - - mwx = points[0] + world_width * (mouse_x/ui_screen()->w); - mwy = points[1] + world_height * (mouse_y/ui_screen()->h); - editor.mouse_delta_wx = editor.mouse_delta_x*(world_width / ui_screen()->w); - editor.mouse_delta_wy = editor.mouse_delta_y*(world_height / ui_screen()->h); - } - - int buttons = 0; - if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1; - if(inp_key_pressed(KEY_MOUSE_2)) buttons |= 2; - if(inp_key_pressed(KEY_MOUSE_3)) buttons |= 4; - - ui_update(mx,my,mwx,mwy,buttons); - } - - // toggle gui - if(inp_key_down(KEY_TAB)) - editor.gui_active = !editor.gui_active; - - if(inp_key_down(KEY_F5)) - editor.save("maps/debug_test2.map"); - - if(inp_key_down(KEY_F6)) - editor.load("maps/debug_test2.map"); - - if(inp_key_down(KEY_F8)) - editor.load("maps/debug_test.map"); - - if(inp_key_down(KEY_F10)) - editor.show_mouse_pointer = false; - - editor.render(); - - if(inp_key_down(KEY_F10)) - { - gfx_screenshot(); - editor.show_mouse_pointer = true; - } - - inp_clear_events(); -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.hpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.hpp deleted file mode 100644 index 313a381ff..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_editor.hpp +++ /dev/null @@ -1,522 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include -#include - -#include -#include -#include "array.hpp" -#include "../mapitems.hpp" -#include "../client/render.hpp" - -extern "C" { - #include - #include - #include -} - -#include - -typedef void (*INDEX_MODIFY_FUNC)(int *index); - -// EDITOR SPECIFIC -template -void swap(T &a, T &b) -{ - T tmp = a; - a = b; - b = tmp; -} - -enum -{ - MODE_LAYERS=0, - MODE_IMAGES, - - DIALOG_NONE=0, - DIALOG_FILE, -}; - -typedef struct -{ - POINT position; - int type; -} ENTITY; - -class ENVELOPE -{ -public: - int channels; - array points; - char name[32]; - float bottom, top; - - ENVELOPE(int chan) - { - channels = chan; - name[0] = 0; - bottom = 0; - top = 0; - } - - static int sort_comp(const void *v0, const void *v1) - { - const ENVPOINT *p0 = (const ENVPOINT *)v0; - const ENVPOINT *p1 = (const ENVPOINT *)v1; - if(p0->time < p1->time) - return -1; - if(p0->time > p1->time) - return 1; - return 0; - } - - void resort() - { - qsort(points.getptr(), points.len(), sizeof(ENVPOINT), sort_comp); - find_top_bottom(0xf); - } - - void find_top_bottom(int channelmask) - { - top = -1000000000.0f; - bottom = 1000000000.0f; - for(int i = 0; i < points.len(); i++) - { - for(int c = 0; c < channels; c++) - { - if(channelmask&(1< top) top = v; - if(v < bottom) bottom = v; - } - } - } - } - - int eval(float time, float *result) - { - render_eval_envelope(points.getptr(), points.len(), channels, time, result); - return channels; - } - - void add_point(int time, int v0, int v1=0, int v2=0, int v3=0) - { - ENVPOINT p; - p.time = time; - p.values[0] = v0; - p.values[1] = v1; - p.values[2] = v2; - p.values[3] = v3; - p.curvetype = CURVETYPE_LINEAR; - points.add(p); - resort(); - } - - float end_time() - { - if(points.len()) - return points[points.len()-1].time*(1.0f/1000.0f); - return 0; - } -}; - - -class LAYER; -class LAYERGROUP; -class MAP; - -class LAYER -{ -public: - LAYER() - { - type = LAYERTYPE_INVALID; - type_name = "(invalid)"; - visible = true; - readonly = false; - flags = 0; - } - - virtual ~LAYER() - { - } - - - virtual void brush_selecting(RECT rect) {} - virtual int brush_grab(LAYERGROUP *brush, RECT rect) { return 0; } - virtual void brush_draw(LAYER *brush, float x, float y) {} - virtual void brush_place(LAYER *brush, float x, float y) {} - virtual void brush_flip_x() {} - virtual void brush_flip_y() {} - virtual void brush_rotate(float amount) {} - - virtual void render() {} - virtual int render_properties(RECT *toolbox) { return 0; } - - virtual void modify_image_index(INDEX_MODIFY_FUNC func) {} - virtual void modify_envelope_index(INDEX_MODIFY_FUNC func) {} - - virtual void get_size(float *w, float *h) { *w = 0; *h = 0;} - - const char *type_name; - int type; - int flags; - - bool readonly; - bool visible; -}; - -class LAYERGROUP -{ -public: - array layers; - - int offset_x; - int offset_y; - - int parallax_x; - int parallax_y; - - int use_clipping; - int clip_x; - int clip_y; - int clip_w; - int clip_h; - - const char *name; - bool game_group; - bool visible; - - LAYERGROUP(); - ~LAYERGROUP(); - - void convert(RECT *rect); - void render(); - void mapscreen(); - void mapping(float *points); - - bool is_empty() const; - void clear(); - void add_layer(LAYER *l); - - void get_size(float *w, float *h); - - void delete_layer(int index); - int swap_layers(int index0, int index1); - - void modify_image_index(INDEX_MODIFY_FUNC func) - { - for(int i = 0; i < layers.len(); i++) - layers[i]->modify_image_index(func); - } - - void modify_envelope_index(INDEX_MODIFY_FUNC func) - { - for(int i = 0; i < layers.len(); i++) - layers[i]->modify_envelope_index(func); - } -}; - -class EDITOR_IMAGE : public IMAGE_INFO -{ -public: - EDITOR_IMAGE() - { - tex_id = -1; - name[0] = 0; - external = 0; - width = 0; - height = 0; - data = 0; - format = 0; - } - - ~EDITOR_IMAGE() - { - gfx_unload_texture(tex_id); - } - - void analyse_tileflags(); - - int tex_id; - int external; - char name[128]; - unsigned char tileflags[256]; -}; - -class MAP -{ - void make_game_group(LAYERGROUP *group); - void make_game_layer(LAYER *layer); -public: - MAP() - { - clean(); - } - - array groups; - array images; - array envelopes; - - class LAYER_GAME *game_layer; - LAYERGROUP *game_group; - - ENVELOPE *new_envelope(int channels) - { - ENVELOPE *e = new ENVELOPE(channels); - envelopes.add(e); - return e; - } - - LAYERGROUP *new_group() - { - LAYERGROUP *g = new LAYERGROUP; - groups.add(g); - return g; - } - - int swap_groups(int index0, int index1) - { - if(index0 < 0 || index0 >= groups.len()) return index0; - if(index1 < 0 || index1 >= groups.len()) return index0; - if(index0 == index1) return index0; - swap(groups[index0], groups[index1]); - return index1; - } - - void delete_group(int index) - { - if(index < 0 || index >= groups.len()) return; - delete groups[index]; - groups.removebyindex(index); - } - - void modify_image_index(INDEX_MODIFY_FUNC func) - { - for(int i = 0; i < groups.len(); i++) - groups[i]->modify_image_index(func); - } - - void modify_envelope_index(INDEX_MODIFY_FUNC func) - { - for(int i = 0; i < groups.len(); i++) - groups[i]->modify_envelope_index(func); - } - - void clean(); - void create_default(int entities_texture); - - // io - int save(const char *filename); - int load(const char *filename); -}; - - -struct PROPERTY -{ - const char *name; - int value; - int type; - int min; - int max; -}; - -enum -{ - PROPTYPE_NULL=0, - PROPTYPE_BOOL, - PROPTYPE_INT_STEP, - PROPTYPE_INT_SCROLL, - PROPTYPE_COLOR, - PROPTYPE_IMAGE, - PROPTYPE_ENVELOPE, -}; - -class EDITOR -{ -public: - EDITOR() - { - mode = MODE_LAYERS; - dialog = 0; - tooltip = 0; - - world_offset_x = 0; - world_offset_y = 0; - editor_offset_x = 0.0f; - editor_offset_y = 0.0f; - - world_zoom = 1.0f; - zoom_level = 100; - lock_mouse = false; - show_mouse_pointer = true; - mouse_delta_x = 0; - mouse_delta_y = 0; - mouse_delta_wx = 0; - mouse_delta_wy = 0; - - gui_active = true; - proof_borders = false; - - show_detail = true; - animate = false; - animate_start = 0; - animate_time = 0; - animate_speed = 1; - - show_envelope_editor = 0; - } - - void invoke_file_dialog(int listdir_type, const char *title, const char *button_text, - const char *basepath, const char *default_name, - void (*func)(const char *filename)); - - void reset(bool create_default=true); - int save(const char *filename); - int load(const char *filename); - int append(const char *filename); - void render(); - - QUAD *get_selected_quad(); - LAYER *get_selected_layer_type(int index, int type); - LAYER *get_selected_layer(int index); - LAYERGROUP *get_selected_group(); - - int do_properties(RECT *toolbox, PROPERTY *props, int *ids, int *new_val); - - int mode; - int dialog; - const char *tooltip; - - float world_offset_x; - float world_offset_y; - float editor_offset_x; - float editor_offset_y; - float world_zoom; - int zoom_level; - bool lock_mouse; - bool show_mouse_pointer; - bool gui_active; - bool proof_borders; - float mouse_delta_x; - float mouse_delta_y; - float mouse_delta_wx; - float mouse_delta_wy; - - bool show_detail; - bool animate; - int64 animate_start; - float animate_time; - float animate_speed; - - int show_envelope_editor; - - int selected_layer; - int selected_group; - int selected_quad; - int selected_points; - int selected_envelope; - int selected_image; - - MAP map; -}; - -extern EDITOR editor; - -typedef struct -{ - int x, y; - int w, h; -} RECTi; - -class LAYER_TILES : public LAYER -{ -public: - LAYER_TILES(int w, int h); - ~LAYER_TILES(); - - void resize(int new_w, int new_h); - - void make_palette(); - virtual void render(); - - int convert_x(float x) const; - int convert_y(float y) const; - void convert(RECT rect, RECTi *out); - void snap(RECT *rect); - void clamp(RECTi *rect); - - virtual void brush_selecting(RECT rect); - virtual int brush_grab(LAYERGROUP *brush, RECT rect); - virtual void brush_draw(LAYER *brush, float wx, float wy); - virtual void brush_flip_x(); - virtual void brush_flip_y(); - - virtual int render_properties(RECT *toolbox); - - virtual void modify_image_index(INDEX_MODIFY_FUNC func); - virtual void modify_envelope_index(INDEX_MODIFY_FUNC func); - - void prepare_for_save(); - - void get_size(float *w, float *h) { *w = width*32.0f; *h = height*32.0f; } - - int tex_id; - int game; - int image; - int width; - int height; - TILE *tiles; -}; - -class LAYER_QUADS : public LAYER -{ -public: - LAYER_QUADS(); - ~LAYER_QUADS(); - - virtual void render(); - QUAD *new_quad(); - - virtual void brush_selecting(RECT rect); - virtual int brush_grab(LAYERGROUP *brush, RECT rect); - virtual void brush_place(LAYER *brush, float wx, float wy); - virtual void brush_flip_x(); - virtual void brush_flip_y(); - virtual void brush_rotate(float amount); - - virtual int render_properties(RECT *toolbox); - - virtual void modify_image_index(INDEX_MODIFY_FUNC func); - virtual void modify_envelope_index(INDEX_MODIFY_FUNC func); - - void get_size(float *w, float *h); - - int image; - array quads; -}; - -class LAYER_GAME : public LAYER_TILES -{ -public: - LAYER_GAME(int w, int h); - ~LAYER_GAME(); - - virtual int render_properties(RECT *toolbox); -}; - -int do_editor_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, int flags, const char *tooltip); -void draw_editor_button(const void *id, const char *text, int checked, const RECT *r, const void *extra); -void draw_editor_button_menuitem(const void *id, const char *text, int checked, const RECT *r, const void *extra); - -void ui_invoke_popup_menu(void *id, int flags, float x, float y, float w, float h, int (*func)(RECT rect), void *extra=0); -void ui_do_popup_menu(); - -int popup_group(RECT view); -int popup_layer(RECT view); -int popup_quad(RECT view); -int popup_point(RECT view); - -void popup_select_image_invoke(int current, float x, float y); -int popup_select_image_result(); diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_io.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_io.cpp deleted file mode 100644 index dfaa0e2c3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_io.cpp +++ /dev/null @@ -1,602 +0,0 @@ -#include -#include -#include "ed_editor.hpp" - -template -static int make_version(int i, const T &v) -{ return (i<<16)+sizeof(T); } - -// backwards compatiblity -void editor_load_old(DATAFILE *df, MAP *map) -{ - class mapres_image - { - public: - int width; - int height; - int image_data; - }; - - struct mapres_tilemap - { - int image; - int width; - int height; - int x, y; - int scale; - int data; - int main; - }; - - struct mapres_entity - { - int x, y; - int data[1]; - }; - - struct mapres_spawnpoint - { - int x, y; - }; - - struct mapres_item - { - int x, y; - int type; - }; - - struct mapres_flagstand - { - int x, y; - }; - - enum - { - MAPRES_ENTS_START=1, - MAPRES_SPAWNPOINT=1, - MAPRES_ITEM=2, - MAPRES_SPAWNPOINT_RED=3, - MAPRES_SPAWNPOINT_BLUE=4, - MAPRES_FLAGSTAND_RED=5, - MAPRES_FLAGSTAND_BLUE=6, - MAPRES_ENTS_END, - - ITEM_NULL=0, - ITEM_WEAPON_GUN=0x00010001, - ITEM_WEAPON_SHOTGUN=0x00010002, - ITEM_WEAPON_ROCKET=0x00010003, - ITEM_WEAPON_SNIPER=0x00010004, - ITEM_WEAPON_HAMMER=0x00010005, - ITEM_HEALTH =0x00020001, - ITEM_ARMOR=0x00030001, - ITEM_NINJA=0x00040001, - }; - - enum - { - MAPRES_REGISTERED=0x8000, - MAPRES_IMAGE=0x8001, - MAPRES_TILEMAP=0x8002, - MAPRES_COLLISIONMAP=0x8003, - MAPRES_TEMP_THEME=0x8fff, - }; - - // load tilemaps - int game_width = 0; - int game_height = 0; - { - int start, num; - datafile_get_type(df, MAPRES_TILEMAP, &start, &num); - for(int t = 0; t < num; t++) - { - mapres_tilemap *tmap = (mapres_tilemap *)datafile_get_item(df, start+t,0,0); - - LAYER_TILES *l = new LAYER_TILES(tmap->width, tmap->height); - - if(tmap->main) - { - // move game layer to correct position - for(int i = 0; i < map->groups[0]->layers.len()-1; i++) - { - if(map->groups[0]->layers[i] == editor.map.game_layer) - map->groups[0]->swap_layers(i, i+1); - } - - game_width = tmap->width; - game_height = tmap->height; - } - - // add new layer - map->groups[0]->add_layer(l); - - // process the data - unsigned char *src_data = (unsigned char *)datafile_get_data(df, tmap->data); - TILE *dst_data = l->tiles; - - for(int y = 0; y < tmap->height; y++) - for(int x = 0; x < tmap->width; x++, dst_data++, src_data+=2) - { - dst_data->index = src_data[0]; - dst_data->flags = src_data[1]; - } - - l->image = tmap->image; - } - } - - // load images - { - int start, count; - datafile_get_type(df, MAPRES_IMAGE, &start, &count); - for(int i = 0; i < count; i++) - { - mapres_image *imgres = (mapres_image *)datafile_get_item(df, start+i, 0, 0); - void *data = datafile_get_data(df, imgres->image_data); - - EDITOR_IMAGE *img = new EDITOR_IMAGE; - img->width = imgres->width; - img->height = imgres->height; - img->format = IMG_RGBA; - - // copy image data - img->data = mem_alloc(img->width*img->height*4, 1); - mem_copy(img->data, data, img->width*img->height*4); - img->tex_id = gfx_load_texture_raw(img->width, img->height, img->format, img->data, IMG_AUTO, 0); - map->images.add(img); - - // unload image - datafile_unload_data(df, imgres->image_data); - } - } - - // load entities - { - LAYER_GAME *g = map->game_layer; - g->resize(game_width, game_height); - for(int t = MAPRES_ENTS_START; t < MAPRES_ENTS_END; t++) - { - // fetch entities of this class - int start, num; - datafile_get_type(df, t, &start, &num); - - - for(int i = 0; i < num; i++) - { - mapres_entity *e = (mapres_entity *)datafile_get_item(df, start+i,0,0); - int x = e->x/32; - int y = e->y/32; - int id = -1; - - if(t == MAPRES_SPAWNPOINT) id = ENTITY_SPAWN; - else if(t == MAPRES_SPAWNPOINT_RED) id = ENTITY_SPAWN_RED; - else if(t == MAPRES_SPAWNPOINT_BLUE) id = ENTITY_SPAWN_BLUE; - else if(t == MAPRES_FLAGSTAND_RED) id = ENTITY_FLAGSTAND_RED; - else if(t == MAPRES_FLAGSTAND_BLUE) id = ENTITY_FLAGSTAND_BLUE; - else if(t == MAPRES_ITEM) - { - if(e->data[0] == ITEM_WEAPON_SHOTGUN) id = ENTITY_WEAPON_SHOTGUN; - else if(e->data[0] == ITEM_WEAPON_ROCKET) id = ENTITY_WEAPON_GRENADE; - else if(e->data[0] == ITEM_NINJA) id = ENTITY_POWERUP_NINJA; - else if(e->data[0] == ITEM_ARMOR) id = ENTITY_ARMOR_1; - else if(e->data[0] == ITEM_HEALTH) id = ENTITY_HEALTH_1; - } - - if(id > 0 && x >= 0 && x < g->width && y >= 0 && y < g->height) - g->tiles[y*g->width+x].index = id+ENTITY_OFFSET; - } - } - } -} - -int EDITOR::save(const char *filename) -{ - return map.save(filename); -} - -int MAP::save(const char *filename) -{ - dbg_msg("editor", "saving to '%s'...", filename); - DATAFILE_OUT *df = datafile_create(filename); - if(!df) - { - dbg_msg("editor", "failed to open file '%s'...", filename); - return 0; - } - - // save version - { - MAPITEM_VERSION item; - item.version = 1; - datafile_add_item(df, MAPITEMTYPE_VERSION, 0, sizeof(item), &item); - } - - // save images - for(int i = 0; i < images.len(); i++) - { - EDITOR_IMAGE *img = images[i]; - - // analyse the image for when saving (should be done when we load the image) - // TODO! - img->analyse_tileflags(); - - MAPITEM_IMAGE item; - item.version = 1; - - item.width = img->width; - item.height = img->height; - item.external = img->external; - item.image_name = datafile_add_data(df, strlen(img->name)+1, img->name); - if(img->external) - item.image_data = -1; - else - item.image_data = datafile_add_data(df, item.width*item.height*4, img->data); - datafile_add_item(df, MAPITEMTYPE_IMAGE, i, sizeof(item), &item); - } - - // save layers - int layer_count = 0; - for(int g = 0; g < groups.len(); g++) - { - LAYERGROUP *group = groups[g]; - MAPITEM_GROUP gitem; - gitem.version = MAPITEM_GROUP::CURRENT_VERSION; - - gitem.parallax_x = group->parallax_x; - gitem.parallax_y = group->parallax_y; - gitem.offset_x = group->offset_x; - gitem.offset_y = group->offset_y; - gitem.use_clipping = group->use_clipping; - gitem.clip_x = group->clip_x; - gitem.clip_y = group->clip_y; - gitem.clip_w = group->clip_w; - gitem.clip_h = group->clip_h; - gitem.start_layer = layer_count; - gitem.num_layers = 0; - - for(int l = 0; l < group->layers.len(); l++) - { - if(group->layers[l]->type == LAYERTYPE_TILES) - { - dbg_msg("editor", "saving tiles layer"); - LAYER_TILES *layer = (LAYER_TILES *)group->layers[l]; - layer->prepare_for_save(); - - MAPITEM_LAYER_TILEMAP item; - item.version = 2; - - item.layer.flags = layer->flags; - item.layer.type = layer->type; - - item.color.r = 255; // not in use right now - item.color.g = 255; - item.color.b = 255; - item.color.a = 255; - item.color_env = -1; - item.color_env_offset = 0; - - item.width = layer->width; - item.height = layer->height; - item.flags = layer->game; - item.image = layer->image; - item.data = datafile_add_data(df, layer->width*layer->height*sizeof(TILE), layer->tiles); - datafile_add_item(df, MAPITEMTYPE_LAYER, layer_count, sizeof(item), &item); - - gitem.num_layers++; - layer_count++; - } - else if(group->layers[l]->type == LAYERTYPE_QUADS) - { - dbg_msg("editor", "saving quads layer"); - LAYER_QUADS *layer = (LAYER_QUADS *)group->layers[l]; - if(layer->quads.len()) - { - MAPITEM_LAYER_QUADS item; - item.version = 1; - item.layer.flags = layer->flags; - item.layer.type = layer->type; - item.image = layer->image; - - // add the data - item.num_quads = layer->quads.len(); - item.data = datafile_add_data_swapped(df, layer->quads.len()*sizeof(QUAD), layer->quads.getptr()); - datafile_add_item(df, MAPITEMTYPE_LAYER, layer_count, sizeof(item), &item); - - // clean up - //mem_free(quads); - - gitem.num_layers++; - layer_count++; - } - } - } - - datafile_add_item(df, MAPITEMTYPE_GROUP, g, sizeof(gitem), &gitem); - } - - // save envelopes - int point_count = 0; - for(int e = 0; e < envelopes.len(); e++) - { - MAPITEM_ENVELOPE item; - item.version = 1; - item.channels = envelopes[e]->channels; - item.start_point = point_count; - item.num_points = envelopes[e]->points.len(); - item.name = -1; - - datafile_add_item(df, MAPITEMTYPE_ENVELOPE, e, sizeof(item), &item); - point_count += item.num_points; - } - - // save points - int totalsize = sizeof(ENVPOINT) * point_count; - ENVPOINT *points = (ENVPOINT *)mem_alloc(totalsize, 1); - point_count = 0; - - for(int e = 0; e < envelopes.len(); e++) - { - int count = envelopes[e]->points.len(); - mem_copy(&points[point_count], envelopes[e]->points.getptr(), sizeof(ENVPOINT)*count); - point_count += count; - } - - datafile_add_item(df, MAPITEMTYPE_ENVPOINTS, 0, totalsize, points); - - // finish the data file - datafile_finish(df); - dbg_msg("editor", "done"); - - // send rcon.. if we can - if(client_rcon_authed()) - { - client_rcon("sv_map_reload 1"); - } - - return 1; -} - -int EDITOR::load(const char *filename) -{ - reset(); - return map.load(filename); -} - -int MAP::load(const char *filename) -{ - DATAFILE *df = datafile_load(filename); - if(!df) - return 0; - - clean(); - - // check version - MAPITEM_VERSION *item = (MAPITEM_VERSION *)datafile_find_item(df, MAPITEMTYPE_VERSION, 0); - if(!item) - { - // import old map - MAP old_mapstuff; - editor.reset(); - editor_load_old(df, this); - } - else if(item->version == 1) - { - //editor.reset(false); - - // load images - { - int start, num; - datafile_get_type(df, MAPITEMTYPE_IMAGE, &start, &num); - for(int i = 0; i < num; i++) - { - MAPITEM_IMAGE *item = (MAPITEM_IMAGE *)datafile_get_item(df, start+i, 0, 0); - char *name = (char *)datafile_get_data(df, item->image_name); - - // copy base info - EDITOR_IMAGE *img = new EDITOR_IMAGE; - img->external = item->external; - - if(item->external) - { - char buf[256]; - sprintf(buf, "mapres/%s.png", name); - - // load external - EDITOR_IMAGE imginfo; - if(gfx_load_png(&imginfo, buf)) - { - *img = imginfo; - img->tex_id = gfx_load_texture_raw(imginfo.width, imginfo.height, imginfo.format, imginfo.data, IMG_AUTO, 0); - img->external = 1; - } - } - else - { - img->width = item->width; - img->height = item->height; - img->format = IMG_RGBA; - - // copy image data - void *data = datafile_get_data(df, item->image_data); - img->data = mem_alloc(img->width*img->height*4, 1); - mem_copy(img->data, data, img->width*img->height*4); - img->tex_id = gfx_load_texture_raw(img->width, img->height, img->format, img->data, IMG_AUTO, 0); - } - - // copy image name - if(name) - strncpy(img->name, name, 128); - - images.add(img); - - // unload image - datafile_unload_data(df, item->image_data); - datafile_unload_data(df, item->image_name); - } - } - - // load groups - { - int layers_start, layers_num; - datafile_get_type(df, MAPITEMTYPE_LAYER, &layers_start, &layers_num); - - int start, num; - datafile_get_type(df, MAPITEMTYPE_GROUP, &start, &num); - for(int g = 0; g < num; g++) - { - MAPITEM_GROUP *gitem = (MAPITEM_GROUP *)datafile_get_item(df, start+g, 0, 0); - - if(gitem->version < 1 || gitem->version > MAPITEM_GROUP::CURRENT_VERSION) - continue; - - LAYERGROUP *group = new_group(); - group->parallax_x = gitem->parallax_x; - group->parallax_y = gitem->parallax_y; - group->offset_x = gitem->offset_x; - group->offset_y = gitem->offset_y; - - if(gitem->version >= 2) - { - group->use_clipping = gitem->use_clipping; - group->clip_x = gitem->clip_x; - group->clip_y = gitem->clip_y; - group->clip_w = gitem->clip_w; - group->clip_h = gitem->clip_h; - } - - for(int l = 0; l < gitem->num_layers; l++) - { - LAYER *layer = 0; - MAPITEM_LAYER *layer_item = (MAPITEM_LAYER *)datafile_get_item(df, layers_start+gitem->start_layer+l, 0, 0); - if(!layer_item) - continue; - - if(layer_item->type == LAYERTYPE_TILES) - { - MAPITEM_LAYER_TILEMAP *tilemap_item = (MAPITEM_LAYER_TILEMAP *)layer_item; - LAYER_TILES *tiles = 0; - - if(tilemap_item->flags&1) - { - tiles = new LAYER_GAME(tilemap_item->width, tilemap_item->height); - make_game_layer(tiles); - make_game_group(group); - } - else - tiles = new LAYER_TILES(tilemap_item->width, tilemap_item->height); - - layer = tiles; - - group->add_layer(tiles); - void *data = datafile_get_data(df, tilemap_item->data); - tiles->image = tilemap_item->image; - tiles->game = tilemap_item->flags&1; - - mem_copy(tiles->tiles, data, tiles->width*tiles->height*sizeof(TILE)); - - if(tiles->game && tilemap_item->version == make_version(1, *tilemap_item)) - { - for(int i = 0; i < tiles->width*tiles->height; i++) - { - if(tiles->tiles[i].index) - tiles->tiles[i].index += ENTITY_OFFSET; - } - } - - datafile_unload_data(df, tilemap_item->data); - } - else if(layer_item->type == LAYERTYPE_QUADS) - { - MAPITEM_LAYER_QUADS *quads_item = (MAPITEM_LAYER_QUADS *)layer_item; - LAYER_QUADS *quads = new LAYER_QUADS; - layer = quads; - quads->image = quads_item->image; - if(quads->image < -1 || quads->image >= images.len()) - quads->image = -1; - void *data = datafile_get_data_swapped(df, quads_item->data); - group->add_layer(quads); - quads->quads.setsize(quads_item->num_quads); - mem_copy(quads->quads.getptr(), data, sizeof(QUAD)*quads_item->num_quads); - datafile_unload_data(df, quads_item->data); - } - - if(layer) - layer->flags = layer_item->flags; - } - } - } - - // load envelopes - { - ENVPOINT *points = 0; - - { - int start, num; - datafile_get_type(df, MAPITEMTYPE_ENVPOINTS, &start, &num); - if(num) - points = (ENVPOINT *)datafile_get_item(df, start, 0, 0); - } - - int start, num; - datafile_get_type(df, MAPITEMTYPE_ENVELOPE, &start, &num); - for(int e = 0; e < num; e++) - { - MAPITEM_ENVELOPE *item = (MAPITEM_ENVELOPE *)datafile_get_item(df, start+e, 0, 0); - ENVELOPE *env = new ENVELOPE(item->channels); - env->points.setsize(item->num_points); - mem_copy(env->points.getptr(), &points[item->start_point], sizeof(ENVPOINT)*item->num_points); - envelopes.add(env); - } - } - } - - datafile_unload(df); - - return 0; -} - -static int modify_add_amount = 0; -static void modify_add(int *index) -{ - if(*index >= 0) - *index += modify_add_amount; -} - -int EDITOR::append(const char *filename) -{ - MAP new_map; - int err; - err = new_map.load(filename); - if(err) - return err; - - // modify indecies - modify_add_amount = map.images.len(); - new_map.modify_image_index(modify_add); - - modify_add_amount = map.envelopes.len(); - new_map.modify_envelope_index(modify_add); - - // transfer images - for(int i = 0; i < new_map.images.len(); i++) - map.images.add(new_map.images[i]); - new_map.images.clear(); - - // transfer envelopes - for(int i = 0; i < new_map.envelopes.len(); i++) - map.envelopes.add(new_map.envelopes[i]); - new_map.envelopes.clear(); - - // transfer groups - - for(int i = 0; i < new_map.groups.len(); i++) - { - if(new_map.groups[i] == new_map.game_group) - delete new_map.groups[i]; - else - map.groups.add(new_map.groups[i]); - } - new_map.groups.clear(); - - // all done \o/ - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_game.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_game.cpp deleted file mode 100644 index 60825ec3e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_game.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "ed_editor.hpp" - - -LAYER_GAME::LAYER_GAME(int w, int h) -: LAYER_TILES(w, h) -{ - type_name = "Game"; - game = 1; -} - -LAYER_GAME::~LAYER_GAME() -{ -} - -int LAYER_GAME::render_properties(RECT *toolbox) -{ - int r = LAYER_TILES::render_properties(toolbox); - image = -1; - return r; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_quads.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_quads.cpp deleted file mode 100644 index bbe5fb6dc..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_quads.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include - -#include "ed_editor.hpp" -#include -#include - -LAYER_QUADS::LAYER_QUADS() -{ - type = LAYERTYPE_QUADS; - type_name = "Quads"; - image = -1; -} - -LAYER_QUADS::~LAYER_QUADS() -{ -} - -static void envelope_eval(float time_offset, int env, float *channels) -{ - if(env < 0 || env > editor.map.envelopes.len()) - { - channels[0] = 0; - channels[1] = 0; - channels[2] = 0; - channels[3] = 0; - return; - } - - ENVELOPE *e = editor.map.envelopes[env]; - float t = editor.animate_time+time_offset; - t *= editor.animate_speed; - e->eval(t, channels); -} - -void LAYER_QUADS::render() -{ - gfx_texture_set(-1); - if(image >= 0 && image < editor.map.images.len()) - gfx_texture_set(editor.map.images[image]->tex_id); - - render_quads(quads.getptr(), quads.len(), envelope_eval, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT); -} - -QUAD *LAYER_QUADS::new_quad() -{ - QUAD *q = &quads[quads.add(QUAD())]; - - q->pos_env = -1; - q->color_env = -1; - q->pos_env_offset = 0; - q->color_env_offset = 0; - int x = 0, y = 0; - q->points[0].x = x; - q->points[0].y = y; - q->points[1].x = x+64; - q->points[1].y = y; - q->points[2].x = x; - q->points[2].y = y+64; - q->points[3].x = x+64; - q->points[3].y = y+64; - - q->points[4].x = x+32; // pivot - q->points[4].y = y+32; - - for(int i = 0; i < 5; i++) - { - q->points[i].x <<= 10; - q->points[i].y <<= 10; - } - - - q->texcoords[0].x = 0; - q->texcoords[0].y = 0; - - q->texcoords[1].x = 1<<10; - q->texcoords[1].y = 0; - - q->texcoords[2].x = 0; - q->texcoords[2].y = 1<<10; - - q->texcoords[3].x = 1<<10; - q->texcoords[3].y = 1<<10; - - q->colors[0].r = 255; q->colors[0].g = 255; q->colors[0].b = 255; q->colors[0].a = 255; - q->colors[1].r = 255; q->colors[1].g = 255; q->colors[1].b = 255; q->colors[1].a = 255; - q->colors[2].r = 255; q->colors[2].g = 255; q->colors[2].b = 255; q->colors[2].a = 255; - q->colors[3].r = 255; q->colors[3].g = 255; q->colors[3].b = 255; q->colors[3].a = 255; - - return q; -} - -void LAYER_QUADS::brush_selecting(RECT rect) -{ - // draw selection rectangle - gfx_texture_set(-1); - gfx_lines_begin(); - gfx_lines_draw(rect.x, rect.y, rect.x+rect.w, rect.y); - gfx_lines_draw(rect.x+rect.w, rect.y, rect.x+rect.w, rect.y+rect.h); - gfx_lines_draw(rect.x+rect.w, rect.y+rect.h, rect.x, rect.y+rect.h); - gfx_lines_draw(rect.x, rect.y+rect.h, rect.x, rect.y); - gfx_lines_end(); -} - -int LAYER_QUADS::brush_grab(LAYERGROUP *brush, RECT rect) -{ - // create new layers - LAYER_QUADS *grabbed = new LAYER_QUADS(); - grabbed->image = image; - brush->add_layer(grabbed); - - //dbg_msg("", "%f %f %f %f", rect.x, rect.y, rect.w, rect.h); - for(int i = 0; i < quads.len(); i++) - { - QUAD *q = &quads[i]; - float px = fx2f(q->points[4].x); - float py = fx2f(q->points[4].y); - - if(px > rect.x && px < rect.x+rect.w && py > rect.y && py < rect.y+rect.h) - { - dbg_msg("", "grabbed one"); - QUAD n; - n = *q; - - for(int p = 0; p < 5; p++) - { - n.points[p].x -= f2fx(rect.x); - n.points[p].y -= f2fx(rect.y); - } - - grabbed->quads.add(n); - } - } - - return grabbed->quads.len()?1:0; -} - -void LAYER_QUADS::brush_place(LAYER *brush, float wx, float wy) -{ - LAYER_QUADS *l = (LAYER_QUADS *)brush; - for(int i = 0; i < l->quads.len(); i++) - { - QUAD n = l->quads[i]; - - for(int p = 0; p < 5; p++) - { - n.points[p].x += f2fx(wx); - n.points[p].y += f2fx(wy); - } - - quads.add(n); - } -} - -void LAYER_QUADS::brush_flip_x() -{ -} - -void LAYER_QUADS::brush_flip_y() -{ -} - -void rotate(vec2 *center, vec2 *point, float rotation) -{ - float x = point->x - center->x; - float y = point->y - center->y; - point->x = x * cosf(rotation) - y * sinf(rotation) + center->x; - point->y = x * sinf(rotation) + y * cosf(rotation) + center->y; -} - -void LAYER_QUADS::brush_rotate(float amount) -{ - vec2 center; - get_size(¢er.x, ¢er.y); - center.x /= 2; - center.y /= 2; - - for(int i = 0; i < quads.len(); i++) - { - QUAD *q = &quads[i]; - - for(int p = 0; p < 5; p++) - { - vec2 pos(fx2f(q->points[p].x), fx2f(q->points[p].y)); - rotate(¢er, &pos, amount); - q->points[p].x = f2fx(pos.x); - q->points[p].y = f2fx(pos.y); - } - } -} - -void LAYER_QUADS::get_size(float *w, float *h) -{ - *w = 0; *h = 0; - - for(int i = 0; i < quads.len(); i++) - { - for(int p = 0; p < 5; p++) - { - *w = max(*w, fx2f(quads[i].points[p].x)); - *h = max(*h, fx2f(quads[i].points[p].y)); - } - } -} - -extern int selected_points; - -int LAYER_QUADS::render_properties(RECT *toolbox) -{ - // layer props - enum - { - PROP_IMAGE=0, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Image", image, PROPTYPE_IMAGE, -1, 0}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(toolbox, props, ids, &new_val); - - if(prop == PROP_IMAGE) - { - if(new_val >= 0) - image = new_val%editor.map.images.len(); - else - image = -1; - } - - return 0; -} - - -void LAYER_QUADS::modify_image_index(INDEX_MODIFY_FUNC func) -{ - func(&image); -} - -void LAYER_QUADS::modify_envelope_index(INDEX_MODIFY_FUNC func) -{ - for(int i = 0; i < quads.len(); i++) - { - func(&quads[i].pos_env); - func(&quads[i].color_env); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_tiles.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_tiles.cpp deleted file mode 100644 index 80ccaa3ad..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_layer_tiles.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include - -#include -#include -#include "ed_editor.hpp" - -LAYER_TILES::LAYER_TILES(int w, int h) -{ - type = LAYERTYPE_TILES; - type_name = "Tiles"; - width = w; - height = h; - image = -1; - tex_id = -1; - game = 0; - - tiles = new TILE[width*height]; - mem_zero(tiles, width*height*sizeof(TILE)); -} - -LAYER_TILES::~LAYER_TILES() -{ - delete [] tiles; -} - -void LAYER_TILES::prepare_for_save() -{ - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - tiles[y*width+x].flags &= TILEFLAG_VFLIP|TILEFLAG_HFLIP; - - if(image != -1) - { - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - tiles[y*width+x].flags |= editor.map.images[image]->tileflags[tiles[y*width+x].index]; - } -} - -void LAYER_TILES::make_palette() -{ - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - tiles[y*width+x].index = y*16+x; -} - -void LAYER_TILES::render() -{ - if(image >= 0 && image < editor.map.images.len()) - tex_id = editor.map.images[image]->tex_id; - gfx_texture_set(tex_id); - render_tilemap(tiles, width, height, 32.0f, vec4(1,1,1,1), LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT); -} - -int LAYER_TILES::convert_x(float x) const { return (int)(x/32.0f); } -int LAYER_TILES::convert_y(float y) const { return (int)(y/32.0f); } - -void LAYER_TILES::convert(RECT rect, RECTi *out) -{ - out->x = convert_x(rect.x); - out->y = convert_y(rect.y); - out->w = convert_x(rect.x+rect.w+31) - out->x; - out->h = convert_y(rect.y+rect.h+31) - out->y; -} - -void LAYER_TILES::snap(RECT *rect) -{ - RECTi out; - convert(*rect, &out); - rect->x = out.x*32.0f; - rect->y = out.y*32.0f; - rect->w = out.w*32.0f; - rect->h = out.h*32.0f; -} - -void LAYER_TILES::clamp(RECTi *rect) -{ - if(rect->x < 0) - { - rect->w += rect->x; - rect->x = 0; - } - - if(rect->y < 0) - { - rect->h += rect->y; - rect->y = 0; - } - - if(rect->x+rect->w > width) - rect->w = width-rect->x; - - if(rect->y+rect->h > height) - rect->h = height-rect->y; - - if(rect->h < 0) - rect->h = 0; - if(rect->w < 0) - rect->w = 0; -} - -void LAYER_TILES::brush_selecting(RECT rect) -{ - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(1,1,1,0.4f); - snap(&rect); - gfx_quads_drawTL(rect.x, rect.y, rect.w, rect.h); - gfx_quads_end(); - char buf[16]; - str_format(buf, sizeof(buf), "%d,%d", convert_x(rect.w), convert_y(rect.h)); - gfx_text(0, rect.x+3.0f, rect.y+3.0f, 15.0f*editor.world_zoom, buf, -1); -} - -int LAYER_TILES::brush_grab(LAYERGROUP *brush, RECT rect) -{ - RECTi r; - convert(rect, &r); - clamp(&r); - - if(!r.w || !r.h) - return 0; - - // create new layers - LAYER_TILES *grabbed = new LAYER_TILES(r.w, r.h); - grabbed->tex_id = tex_id; - grabbed->image = image; - brush->add_layer(grabbed); - - // copy the tiles - for(int y = 0; y < r.h; y++) - for(int x = 0; x < r.w; x++) - grabbed->tiles[y*grabbed->width+x] = tiles[(r.y+y)*width+(r.x+x)]; - - return 1; -} - -void LAYER_TILES::brush_draw(LAYER *brush, float wx, float wy) -{ - if(readonly) - return; - - // - LAYER_TILES *l = (LAYER_TILES *)brush; - int sx = convert_x(wx); - int sy = convert_y(wy); - - for(int y = 0; y < l->height; y++) - for(int x = 0; x < l->width; x++) - { - int fx = x+sx; - int fy = y+sy; - if(fx<0 || fx >= width || fy < 0 || fy >= height) - continue; - - tiles[fy*width+fx] = l->tiles[y*l->width+x]; - } -} - -void LAYER_TILES::brush_flip_x() -{ - for(int y = 0; y < height; y++) - for(int x = 0; x < width/2; x++) - { - TILE tmp = tiles[y*width+x]; - tiles[y*width+x] = tiles[y*width+width-1-x]; - tiles[y*width+width-1-x] = tmp; - } - - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - tiles[y*width+x].flags ^= TILEFLAG_VFLIP; -} - -void LAYER_TILES::brush_flip_y() -{ - for(int y = 0; y < height/2; y++) - for(int x = 0; x < width; x++) - { - TILE tmp = tiles[y*width+x]; - tiles[y*width+x] = tiles[(height-1-y)*width+x]; - tiles[(height-1-y)*width+x] = tmp; - } - - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) - tiles[y*width+x].flags ^= TILEFLAG_HFLIP; -} - -void LAYER_TILES::resize(int new_w, int new_h) -{ - TILE *new_data = new TILE[new_w*new_h]; - mem_zero(new_data, new_w*new_h*sizeof(TILE)); - - // copy old data - for(int y = 0; y < min(new_h, height); y++) - mem_copy(&new_data[y*new_w], &tiles[y*width], min(width, new_w)*sizeof(TILE)); - - // replace old - delete [] tiles; - tiles = new_data; - width = new_w; - height = new_h; -} - - -int LAYER_TILES::render_properties(RECT *toolbox) -{ - RECT button; - ui_hsplit_b(toolbox, 12.0f, toolbox, &button); - bool in_gamegroup = editor.map.game_group->layers.find(this) != -1; - if(editor.map.game_layer == this) - in_gamegroup = false; - static int colcl_button = 0; - if(do_editor_button(&colcl_button, "Clear Collision", in_gamegroup?0:-1, &button, draw_editor_button, 0, "Removes collision from this layer")) - { - LAYER_TILES *gl = editor.map.game_layer; - int w = min(gl->width, width); - int h = min(gl->height, height); - for(int y = 0; y < h; y++) - for(int x = 0; x < w; x++) - { - if(gl->tiles[y*gl->width+x].index <= TILE_SOLID) - if(tiles[y*width+x].index) - gl->tiles[y*gl->width+x].index = TILE_AIR; - } - - return 1; - } - static int col_button = 0; - ui_hsplit_b(toolbox, 5.0f, toolbox, &button); - ui_hsplit_b(toolbox, 12.0f, toolbox, &button); - if(do_editor_button(&col_button, "Make Collision", in_gamegroup?0:-1, &button, draw_editor_button, 0, "Constructs collision from this layer")) - { - LAYER_TILES *gl = editor.map.game_layer; - int w = min(gl->width, width); - int h = min(gl->height, height); - for(int y = 0; y < h; y++) - for(int x = 0; x < w; x++) - { - if(gl->tiles[y*gl->width+x].index <= TILE_SOLID) - gl->tiles[y*gl->width+x].index = tiles[y*width+x].index?TILE_SOLID:TILE_AIR; - } - - return 1; - } - - enum - { - PROP_WIDTH=0, - PROP_HEIGHT, - PROP_IMAGE, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Width", width, PROPTYPE_INT_STEP, 1, 1000000000}, - {"Height", height, PROPTYPE_INT_STEP, 1, 1000000000}, - {"Image", image, PROPTYPE_IMAGE, 0, 0}, - {0}, - }; - - if(editor.map.game_layer == this) // remove the image from the selection if this is the game layer - props[2].name = 0; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(toolbox, props, ids, &new_val); - - if(prop == PROP_WIDTH && new_val > 1) - resize(new_val, height); - else if(prop == PROP_HEIGHT && new_val > 1) - resize(width, new_val); - else if(prop == PROP_IMAGE) - { - if (new_val == -1) - { - tex_id = -1; - image = -1; - } - else - image = new_val%editor.map.images.len(); - } - - return 0; -} - - -void LAYER_TILES::modify_image_index(INDEX_MODIFY_FUNC func) -{ - func(&image); -} - -void LAYER_TILES::modify_envelope_index(INDEX_MODIFY_FUNC func) -{ -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_popups.cpp b/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_popups.cpp deleted file mode 100644 index 13bfe243e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/editor/ed_popups.cpp +++ /dev/null @@ -1,424 +0,0 @@ -#include -#include "ed_editor.hpp" - - -// popup menu handling -static struct -{ - RECT rect; - void *id; - int (*func)(RECT rect); - int is_menu; - void *extra; -} ui_popups[8]; - -static int ui_num_popups = 0; - -void ui_invoke_popup_menu(void *id, int flags, float x, float y, float w, float h, int (*func)(RECT rect), void *extra) -{ - dbg_msg("", "invoked"); - ui_popups[ui_num_popups].id = id; - ui_popups[ui_num_popups].is_menu = flags; - ui_popups[ui_num_popups].rect.x = x; - ui_popups[ui_num_popups].rect.y = y; - ui_popups[ui_num_popups].rect.w = w; - ui_popups[ui_num_popups].rect.h = h; - ui_popups[ui_num_popups].func = func; - ui_popups[ui_num_popups].extra = extra; - ui_num_popups++; -} - -void ui_do_popup_menu() -{ - for(int i = 0; i < ui_num_popups; i++) - { - bool inside = ui_mouse_inside(&ui_popups[i].rect); - ui_set_hot_item(&ui_popups[i].id); - - if(ui_active_item() == &ui_popups[i].id) - { - if(!ui_mouse_button(0)) - { - if(!inside) - ui_num_popups--; - ui_set_active_item(0); - } - } - else if(ui_hot_item() == &ui_popups[i].id) - { - if(ui_mouse_button(0)) - ui_set_active_item(&ui_popups[i].id); - } - - int corners = CORNER_ALL; - if(ui_popups[i].is_menu) - corners = CORNER_R|CORNER_B; - - RECT r = ui_popups[i].rect; - ui_draw_rect(&r, vec4(0.5f,0.5f,0.5f,0.75f), corners, 3.0f); - ui_margin(&r, 1.0f, &r); - ui_draw_rect(&r, vec4(0,0,0,0.75f), corners, 3.0f); - ui_margin(&r, 4.0f, &r); - - if(ui_popups[i].func(r)) - ui_num_popups--; - - if(inp_key_down(KEY_ESCAPE)) - ui_num_popups--; - } -} - - -int popup_group(RECT view) -{ - // remove group button - RECT button; - ui_hsplit_b(&view, 12.0f, &view, &button); - static int delete_button = 0; - - // don't allow deletion of game group - if(editor.map.game_group != editor.get_selected_group() && - do_editor_button(&delete_button, "Delete Group", 0, &button, draw_editor_button, 0, "Delete group")) - { - editor.map.delete_group(editor.selected_group); - return 1; - } - - // new tile layer - ui_hsplit_b(&view, 10.0f, &view, &button); - ui_hsplit_b(&view, 12.0f, &view, &button); - static int new_quad_layer_button = 0; - if(do_editor_button(&new_quad_layer_button, "Add Quads Layer", 0, &button, draw_editor_button, 0, "Creates a new quad layer")) - { - LAYER *l = new LAYER_QUADS; - editor.map.groups[editor.selected_group]->add_layer(l); - editor.selected_layer = editor.map.groups[editor.selected_group]->layers.len()-1; - return 1; - } - - // new quad layer - ui_hsplit_b(&view, 5.0f, &view, &button); - ui_hsplit_b(&view, 12.0f, &view, &button); - static int new_tile_layer_button = 0; - if(do_editor_button(&new_tile_layer_button, "Add Tile Layer", 0, &button, draw_editor_button, 0, "Creates a new tile layer")) - { - LAYER *l = new LAYER_TILES(50, 50); - editor.map.groups[editor.selected_group]->add_layer(l); - editor.selected_layer = editor.map.groups[editor.selected_group]->layers.len()-1; - return 1; - } - - enum - { - PROP_ORDER=0, - PROP_POS_X, - PROP_POS_Y, - PROP_PARA_X, - PROP_PARA_Y, - PROP_USE_CLIPPING, - PROP_CLIP_X, - PROP_CLIP_Y, - PROP_CLIP_W, - PROP_CLIP_H, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Order", editor.selected_group, PROPTYPE_INT_STEP, 0, editor.map.groups.len()-1}, - {"Pos X", -editor.map.groups[editor.selected_group]->offset_x, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Pos Y", -editor.map.groups[editor.selected_group]->offset_y, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Para X", editor.map.groups[editor.selected_group]->parallax_x, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Para Y", editor.map.groups[editor.selected_group]->parallax_y, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - - {"Use Clipping", editor.map.groups[editor.selected_group]->use_clipping, PROPTYPE_BOOL, 0, 1}, - {"Clip X", editor.map.groups[editor.selected_group]->clip_x, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Clip Y", editor.map.groups[editor.selected_group]->clip_y, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Clip W", editor.map.groups[editor.selected_group]->clip_w, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Clip H", editor.map.groups[editor.selected_group]->clip_h, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - - // cut the properties that isn't needed - if(editor.get_selected_group()->game_group) - props[PROP_POS_X].name = 0; - - int prop = editor.do_properties(&view, props, ids, &new_val); - if(prop == PROP_ORDER) - editor.selected_group = editor.map.swap_groups(editor.selected_group, new_val); - - // these can not be changed on the game group - if(!editor.get_selected_group()->game_group) - { - if(prop == PROP_PARA_X) editor.map.groups[editor.selected_group]->parallax_x = new_val; - else if(prop == PROP_PARA_Y) editor.map.groups[editor.selected_group]->parallax_y = new_val; - else if(prop == PROP_POS_X) editor.map.groups[editor.selected_group]->offset_x = -new_val; - else if(prop == PROP_POS_Y) editor.map.groups[editor.selected_group]->offset_y = -new_val; - else if(prop == PROP_USE_CLIPPING) editor.map.groups[editor.selected_group]->use_clipping = new_val; - else if(prop == PROP_CLIP_X) editor.map.groups[editor.selected_group]->clip_x = new_val; - else if(prop == PROP_CLIP_Y) editor.map.groups[editor.selected_group]->clip_y = new_val; - else if(prop == PROP_CLIP_W) editor.map.groups[editor.selected_group]->clip_w = new_val; - else if(prop == PROP_CLIP_H) editor.map.groups[editor.selected_group]->clip_h = new_val; - } - - return 0; -} - -int popup_layer(RECT view) -{ - // remove layer button - RECT button; - ui_hsplit_b(&view, 12.0f, &view, &button); - static int delete_button = 0; - - // don't allow deletion of game layer - if(editor.map.game_layer != editor.get_selected_layer(0) && - do_editor_button(&delete_button, "Delete Layer", 0, &button, draw_editor_button, 0, "Deletes the layer")) - { - editor.map.groups[editor.selected_group]->delete_layer(editor.selected_layer); - return 1; - } - - ui_hsplit_b(&view, 10.0f, &view, 0); - - LAYERGROUP *current_group = editor.map.groups[editor.selected_group]; - LAYER *current_layer = editor.get_selected_layer(0); - - enum - { - PROP_GROUP=0, - PROP_ORDER, - PROP_HQ, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Group", editor.selected_group, PROPTYPE_INT_STEP, 0, editor.map.groups.len()-1}, - {"Order", editor.selected_layer, PROPTYPE_INT_STEP, 0, current_group->layers.len()}, - {"Detail", current_layer->flags&LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(&view, props, ids, &new_val); - - if(prop == PROP_ORDER) - editor.selected_layer = current_group->swap_layers(editor.selected_layer, new_val); - else if(prop == PROP_GROUP && current_layer->type != LAYERTYPE_GAME) - { - if(new_val >= 0 && new_val < editor.map.groups.len()) - { - current_group->layers.remove(current_layer); - editor.map.groups[new_val]->layers.add(current_layer); - editor.selected_group = new_val; - editor.selected_layer = editor.map.groups[new_val]->layers.len()-1; - } - } - else if(prop == PROP_HQ) - { - current_layer->flags &= ~LAYERFLAG_DETAIL; - if(new_val) - current_layer->flags |= LAYERFLAG_DETAIL; - } - - return current_layer->render_properties(&view); -} - -int popup_quad(RECT view) -{ - QUAD *quad = editor.get_selected_quad(); - - RECT button; - - // delete button - ui_hsplit_b(&view, 12.0f, &view, &button); - static int delete_button = 0; - if(do_editor_button(&delete_button, "Delete", 0, &button, draw_editor_button, 0, "Deletes the current quad")) - { - LAYER_QUADS *layer = (LAYER_QUADS *)editor.get_selected_layer_type(0, LAYERTYPE_QUADS); - if(layer) - { - layer->quads.removebyindex(editor.selected_quad); - editor.selected_quad--; - } - return 1; - } - - // square button - ui_hsplit_b(&view, 10.0f, &view, &button); - ui_hsplit_b(&view, 12.0f, &view, &button); - static int sq_button = 0; - if(do_editor_button(&sq_button, "Square", 0, &button, draw_editor_button, 0, "Squares the current quad")) - { - int top = quad->points[0].y; - int left = quad->points[0].x; - int bottom = quad->points[0].y; - int right = quad->points[0].x; - - for(int k = 1; k < 4; k++) - { - if(quad->points[k].y < top) top = quad->points[k].y; - if(quad->points[k].x < left) left = quad->points[k].x; - if(quad->points[k].y > bottom) bottom = quad->points[k].y; - if(quad->points[k].x > right) right = quad->points[k].x; - } - - quad->points[0].x = left; quad->points[0].y = top; - quad->points[1].x = right; quad->points[1].y = top; - quad->points[2].x = left; quad->points[2].y = bottom; - quad->points[3].x = right; quad->points[3].y = bottom; - return 1; - } - - - enum - { - PROP_POS_ENV=0, - PROP_POS_ENV_OFFSET, - PROP_COLOR_ENV, - PROP_COLOR_ENV_OFFSET, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Pos. Env", quad->pos_env, PROPTYPE_INT_STEP, -1, editor.map.envelopes.len()}, - {"Pos. TO", quad->pos_env_offset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Color Env", quad->color_env, PROPTYPE_INT_STEP, -1, editor.map.envelopes.len()}, - {"Color TO", quad->color_env_offset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(&view, props, ids, &new_val); - - if(prop == PROP_POS_ENV) quad->pos_env = clamp(new_val, -1, editor.map.envelopes.len()-1); - if(prop == PROP_POS_ENV_OFFSET) quad->pos_env_offset = new_val; - if(prop == PROP_COLOR_ENV) quad->color_env = clamp(new_val, -1, editor.map.envelopes.len()-1); - if(prop == PROP_COLOR_ENV_OFFSET) quad->color_env_offset = new_val; - - return 0; -} - -int popup_point(RECT view) -{ - QUAD *quad = editor.get_selected_quad(); - - enum - { - PROP_COLOR=0, - NUM_PROPS, - }; - - int color = 0; - - for(int v = 0; v < 4; v++) - { - if(editor.selected_points&(1<colors[v].r<<24; - color |= quad->colors[v].g<<16; - color |= quad->colors[v].b<<8; - color |= quad->colors[v].a; - } - } - - - PROPERTY props[] = { - {"Color", color, PROPTYPE_COLOR, -1, editor.map.envelopes.len()}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(&view, props, ids, &new_val); - if(prop == PROP_COLOR) - { - for(int v = 0; v < 4; v++) - { - if(editor.selected_points&(1<colors[v].r = (new_val>>24)&0xff; - quad->colors[v].g = (new_val>>16)&0xff; - quad->colors[v].b = (new_val>>8)&0xff; - quad->colors[v].a = new_val&0xff; - } - } - } - - return 0; -} - - - -static int select_image_selected = -100; -static int select_image_current = -100; - -int popup_select_image(RECT view) -{ - RECT buttonbar, imageview; - ui_vsplit_l(&view, 80.0f, &buttonbar, &view); - ui_margin(&view, 10.0f, &imageview); - - int show_image = select_image_current; - - for(int i = -1; i < editor.map.images.len(); i++) - { - RECT button; - ui_hsplit_t(&buttonbar, 12.0f, &button, &buttonbar); - ui_hsplit_t(&buttonbar, 2.0f, 0, &buttonbar); - - if(ui_mouse_inside(&button)) - show_image = i; - - if(i == -1) - { - if(do_editor_button(&editor.map.images[i], "None", i==select_image_current, &button, draw_editor_button_menuitem, 0, 0)) - select_image_selected = -1; - } - else - { - if(do_editor_button(&editor.map.images[i], editor.map.images[i]->name, i==select_image_current, &button, draw_editor_button_menuitem, 0, 0)) - select_image_selected = i; - } - } - - if(show_image >= 0 && show_image < editor.map.images.len()) - gfx_texture_set(editor.map.images[show_image]->tex_id); - else - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_quads_drawTL(imageview.x, imageview.y, imageview.w, imageview.h); - gfx_quads_end(); - - return 0; -} - -void popup_select_image_invoke(int current, float x, float y) -{ - static int select_image_popup_id = 0; - select_image_selected = -100; - select_image_current = current; - ui_invoke_popup_menu(&select_image_popup_id, 0, x, y, 400, 300, popup_select_image); -} - -int popup_select_image_result() -{ - if(select_image_selected == -100) - return -100; - - select_image_current = select_image_selected; - select_image_selected = -100; - return select_image_current; -} - - - - - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/gamecore.cpp b/project/jni/application/teeworlds-0.5.2/src/game/gamecore.cpp deleted file mode 100644 index ceb63be3a..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/gamecore.cpp +++ /dev/null @@ -1,514 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include "gamecore.hpp" - -const char *TUNING_PARAMS::names[] = -{ - #define MACRO_TUNING_PARAM(name,value) #name, - #include "tuning.hpp" - #undef MACRO_TUNING_PARAM -}; - - -bool TUNING_PARAMS::set(int index, float value) -{ - if(index < 0 || index >= num()) - return false; - ((tune_param *)this)[index] = value; - return true; -} - -bool TUNING_PARAMS::get(int index, float *value) -{ - if(index < 0 || index >= num()) - return false; - *value = (float)((tune_param *)this)[index]; - return true; -} - -bool TUNING_PARAMS::set(const char *name, float value) -{ - for(int i = 0; i < num(); i++) - if(strcmp(name, names[i]) == 0) - return set(i, value); - return false; -} - -bool TUNING_PARAMS::get(const char *name, float *value) -{ - for(int i = 0; i < num(); i++) - if(strcmp(name, names[i]) == 0) - return get(i, value); - - return false; -} - -// TODO: OPT: rewrite this smarter! -void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces) -{ - if(bounces) - *bounces = 0; - - vec2 pos = *inout_pos; - vec2 vel = *inout_vel; - if(col_check_point(pos + vel)) - { - int affected = 0; - if(col_check_point(pos.x + vel.x, pos.y)) - { - inout_vel->x *= -elasticity; - if(bounces) - (*bounces)++; - affected++; - } - - if(col_check_point(pos.x, pos.y + vel.y)) - { - inout_vel->y *= -elasticity; - if(bounces) - (*bounces)++; - affected++; - } - - if(affected == 0) - { - inout_vel->x *= -elasticity; - inout_vel->y *= -elasticity; - } - } - else - { - *inout_pos = pos + vel; - } -} - -bool test_box(vec2 pos, vec2 size) -{ - size *= 0.5f; - if(col_check_point(pos.x-size.x, pos.y-size.y)) - return true; - if(col_check_point(pos.x+size.x, pos.y-size.y)) - return true; - if(col_check_point(pos.x-size.x, pos.y+size.y)) - return true; - if(col_check_point(pos.x+size.x, pos.y+size.y)) - return true; - return false; -} - -void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity) -{ - // do the move - vec2 pos = *inout_pos; - vec2 vel = *inout_vel; - - float distance = length(vel); - int max = (int)distance; - - if(distance > 0.00001f) - { - //vec2 old_pos = pos; - float fraction = 1.0f/(float)(max+1); - for(int i = 0; i <= max; i++) - { - //float amount = i/(float)max; - //if(max == 0) - //amount = 0; - - vec2 new_pos = pos + vel*fraction; // TODO: this row is not nice - - if(test_box(vec2(new_pos.x, new_pos.y), size)) - { - int hits = 0; - - if(test_box(vec2(pos.x, new_pos.y), size)) - { - new_pos.y = pos.y; - vel.y *= -elasticity; - hits++; - } - - if(test_box(vec2(new_pos.x, pos.y), size)) - { - new_pos.x = pos.x; - vel.x *= -elasticity; - hits++; - } - - // neither of the tests got a collision. - // this is a real _corner case_! - if(hits == 0) - { - new_pos.y = pos.y; - vel.y *= -elasticity; - new_pos.x = pos.x; - vel.x *= -elasticity; - } - } - - pos = new_pos; - } - } - - *inout_pos = pos; - *inout_vel = vel; -} - -float hermite_basis1(float v) -{ - return 2*v*v*v - 3*v*v+1; -} - -float velocity_ramp(float value, float start, float range, float curvature) -{ - if(value < start) - return 1.0f; - return 1.0f/pow(curvature, (value-start)/range); -} - -void CHARACTER_CORE::reset() -{ - pos = vec2(0,0); - vel = vec2(0,0); - hook_pos = vec2(0,0); - hook_dir = vec2(0,0); - hook_tick = 0; - hook_state = HOOK_IDLE; - hooked_player = -1; - jumped = 0; - triggered_events = 0; -} - -void CHARACTER_CORE::tick(bool use_input) -{ - float phys_size = 28.0f; - triggered_events = 0; - - // get ground state - bool grounded = false; - if(col_check_point(pos.x+phys_size/2, pos.y+phys_size/2+5)) - grounded = true; - if(col_check_point(pos.x-phys_size/2, pos.y+phys_size/2+5)) - grounded = true; - - vec2 target_direction = normalize(vec2(input.target_x, input.target_y)); - - vel.y += world->tuning.gravity; - - float max_speed = grounded ? world->tuning.ground_control_speed : world->tuning.air_control_speed; - float accel = grounded ? world->tuning.ground_control_accel : world->tuning.air_control_accel; - float friction = grounded ? world->tuning.ground_friction : world->tuning.air_friction; - - // handle input - if(use_input) - { - direction = input.direction; - - // setup angle - float a = 0; - if(input.target_x == 0) - a = atan((float)input.target_y); - else - a = atan((float)input.target_y/(float)input.target_x); - - if(input.target_x < 0) - a = a+pi; - - angle = (int)(a*256.0f); - - // handle jump - if(input.jump) - { - if(!(jumped&1)) - { - if(grounded) - { - triggered_events |= COREEVENT_GROUND_JUMP; - vel.y = -world->tuning.ground_jump_impulse; - jumped |= 1; - } - else if(!(jumped&2)) - { - triggered_events |= COREEVENT_AIR_JUMP; - vel.y = -world->tuning.air_jump_impulse; - jumped |= 3; - } - } - } - else - jumped &= ~1; - - // handle hook - if(input.hook) - { - if(hook_state == HOOK_IDLE) - { - hook_state = HOOK_FLYING; - hook_pos = pos+target_direction*phys_size*1.5f; - hook_dir = target_direction; - hooked_player = -1; - hook_tick = 0; - triggered_events |= COREEVENT_HOOK_LAUNCH; - } - } - else - { - hooked_player = -1; - hook_state = HOOK_IDLE; - hook_pos = pos; - } - } - - // add the speed modification according to players wanted direction - if(direction < 0) - vel.x = saturated_add(-max_speed, max_speed, vel.x, -accel); - if(direction > 0) - vel.x = saturated_add(-max_speed, max_speed, vel.x, accel); - if(direction == 0) - vel.x *= friction; - - // handle jumping - // 1 bit = to keep track if a jump has been made on this input - // 2 bit = to keep track if a air-jump has been made - if(grounded) - jumped &= ~2; - - // do hook - if(hook_state == HOOK_IDLE) - { - hooked_player = -1; - hook_state = HOOK_IDLE; - hook_pos = pos; - } - else if(hook_state >= HOOK_RETRACT_START && hook_state < HOOK_RETRACT_END) - { - hook_state++; - } - else if(hook_state == HOOK_RETRACT_END) - { - hook_state = HOOK_RETRACTED; - triggered_events |= COREEVENT_HOOK_RETRACT; - hook_state = HOOK_RETRACTED; - } - else if(hook_state == HOOK_FLYING) - { - vec2 new_pos = hook_pos+hook_dir*world->tuning.hook_fire_speed; - if(distance(pos, new_pos) > world->tuning.hook_length) - { - hook_state = HOOK_RETRACT_START; - new_pos = pos + normalize(new_pos-pos) * world->tuning.hook_length; - } - - // make sure that the hook doesn't go though the ground - bool going_to_hit_ground = false; - bool going_to_retract = false; - int hit = col_intersect_line(hook_pos, new_pos, &new_pos, 0); - if(hit) - { - if(hit&COLFLAG_NOHOOK) - going_to_retract = true; - else - going_to_hit_ground = true; - } - - // Check against other players first - if(world && world->tuning.player_hooking) - { - float dist = 0.0f; - for(int i = 0; i < MAX_CLIENTS; i++) - { - CHARACTER_CORE *p = world->characters[i]; - if(!p || p == this) - continue; - - vec2 closest_point = closest_point_on_line(hook_pos, new_pos, p->pos); - if(distance(p->pos, closest_point) < phys_size+2.0f) - { - if (hooked_player == -1 || distance (hook_pos, p->pos) < dist) - { - triggered_events |= COREEVENT_HOOK_ATTACH_PLAYER; - hook_state = HOOK_GRABBED; - hooked_player = i; - dist = distance (hook_pos, p->pos); - } - } - } - } - - if(hook_state == HOOK_FLYING) - { - // check against ground - if(going_to_hit_ground) - { - triggered_events |= COREEVENT_HOOK_ATTACH_GROUND; - hook_state = HOOK_GRABBED; - } - else if(going_to_retract) - { - triggered_events |= COREEVENT_HOOK_HIT_NOHOOK; - hook_state = HOOK_RETRACT_START; - } - - hook_pos = new_pos; - } - } - - if(hook_state == HOOK_GRABBED) - { - if(hooked_player != -1) - { - CHARACTER_CORE *p = world->characters[hooked_player]; - if(p) - hook_pos = p->pos; - else - { - // release hook - hooked_player = -1; - hook_state = HOOK_RETRACTED; - hook_pos = pos; - } - - // keep players hooked for a max of 1.5sec - //if(server_tick() > hook_tick+(server_tickspeed()*3)/2) - //release_hooked(); - } - - // don't do this hook rutine when we are hook to a player - if(hooked_player == -1 && distance(hook_pos, pos) > 46.0f) - { - vec2 hookvel = normalize(hook_pos-pos)*world->tuning.hook_drag_accel; - // the hook as more power to drag you up then down. - // this makes it easier to get on top of an platform - if(hookvel.y > 0) - hookvel.y *= 0.3f; - - // the hook will boost it's power if the player wants to move - // in that direction. otherwise it will dampen everything abit - if((hookvel.x < 0 && direction < 0) || (hookvel.x > 0 && direction > 0)) - hookvel.x *= 0.95f; - else - hookvel.x *= 0.75f; - - vec2 new_vel = vel+hookvel; - - // check if we are under the legal limit for the hook - if(length(new_vel) < world->tuning.hook_drag_speed || length(new_vel) < length(vel)) - vel = new_vel; // no problem. apply - - } - - // release hook (max hook time is 1.25 - hook_tick++; - if(hooked_player != -1 && (hook_tick > SERVER_TICK_SPEED+SERVER_TICK_SPEED/5 || !world->characters[hooked_player])) - { - hooked_player = -1; - hook_state = HOOK_RETRACTED; - hook_pos = pos; - } - } - - if(world && world->tuning.player_collision) - { - for(int i = 0; i < MAX_CLIENTS; i++) - { - CHARACTER_CORE *p = world->characters[i]; - if(!p) - continue; - - //player *p = (player*)ent; - if(p == this) // || !(p->flags&FLAG_ALIVE) - continue; // make sure that we don't nudge our self - - // handle player <-> player collision - float d = distance(pos, p->pos); - vec2 dir = normalize(pos - p->pos); - if(d < phys_size*1.25f && d > 1.0f) - { - float a = (phys_size*1.45f - d); - - // make sure that we don't add excess force by checking the - // direction against the current velocity - vec2 veldir = normalize(vel); - float v = 1-(dot(veldir, dir)+1)/2; - vel = vel + dir*a*(v*0.75f); - vel = vel * 0.85f; - } - - // handle hook influence - if(hooked_player == i) - { - if(d > phys_size*1.50f) // TODO: fix tweakable variable - { - float accel = world->tuning.hook_drag_accel * (d/world->tuning.hook_length); - float drag_speed = world->tuning.hook_drag_speed; - - // add force to the hooked player - p->vel.x = saturated_add(-drag_speed, drag_speed, p->vel.x, accel*dir.x*1.5f); - p->vel.y = saturated_add(-drag_speed, drag_speed, p->vel.y, accel*dir.y*1.5f); - - // add a little bit force to the guy who has the grip - vel.x = saturated_add(-drag_speed, drag_speed, vel.x, -accel*dir.x*0.25f); - vel.y = saturated_add(-drag_speed, drag_speed, vel.y, -accel*dir.y*0.25f); - } - } - } - } - - // clamp the velocity to something sane - if(length(vel) > 6000) - vel = normalize(vel) * 6000; -} - -void CHARACTER_CORE::move() -{ - float rampvalue = velocity_ramp(length(vel)*50, world->tuning.velramp_start, world->tuning.velramp_range, world->tuning.velramp_curvature); - - vel.x = vel.x*rampvalue; - move_box(&pos, &vel, vec2(28.0f, 28.0f), 0); - vel.x = vel.x*(1.0f/rampvalue); -} - -void CHARACTER_CORE::write(NETOBJ_CHARACTER_CORE *obj_core) -{ - obj_core->x = round(pos.x); - obj_core->y = round(pos.y); - - obj_core->vx = round(vel.x*256.0f); - obj_core->vy = round(vel.y*256.0f); - obj_core->hook_state = hook_state; - obj_core->hook_tick = hook_tick; - obj_core->hook_x = round(hook_pos.x); - obj_core->hook_y = round(hook_pos.y); - obj_core->hook_dx = round(hook_dir.x*256.0f); - obj_core->hook_dy = round(hook_dir.y*256.0f); - obj_core->hooked_player = hooked_player; - obj_core->jumped = jumped; - obj_core->direction = direction; - obj_core->angle = angle; -} - -void CHARACTER_CORE::read(const NETOBJ_CHARACTER_CORE *obj_core) -{ - pos.x = obj_core->x; - pos.y = obj_core->y; - vel.x = obj_core->vx/256.0f; - vel.y = obj_core->vy/256.0f; - hook_state = obj_core->hook_state; - hook_tick = obj_core->hook_tick; - hook_pos.x = obj_core->hook_x; - hook_pos.y = obj_core->hook_y; - hook_dir.x = obj_core->hook_dx/256.0f; - hook_dir.y = obj_core->hook_dy/256.0f; - hooked_player = obj_core->hooked_player; - jumped = obj_core->jumped; - direction = obj_core->direction; - angle = obj_core->angle; -} - -void CHARACTER_CORE::quantize() -{ - NETOBJ_CHARACTER_CORE c; - write(&c); - read(&c); -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/gamecore.hpp b/project/jni/application/teeworlds-0.5.2/src/game/gamecore.hpp deleted file mode 100644 index 2734820c8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/gamecore.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef GAME_GAME_H -#define GAME_GAME_H - -#include -#include - -#include -#include -#include "collision.hpp" -#include - -struct TUNING_PARAMS -{ - TUNING_PARAMS() - { - const float ticks_per_second = 50.0f; - #define MACRO_TUNING_PARAM(name,value) name.set((int)(value*100.0f)); - #include "tuning.hpp" - #undef MACRO_TUNING_PARAM - } - - static const char *names[]; - - #define MACRO_TUNING_PARAM(name,value) tune_param name; - #include "tuning.hpp" - #undef MACRO_TUNING_PARAM - - static int num() { return sizeof(TUNING_PARAMS)/sizeof(int); } - bool set(int index, float value); - bool set(const char *name, float value); - bool get(int index, float *value); - bool get(const char *name, float *value); -}; - - -inline vec2 get_direction(int angle) -{ - float a = angle/256.0f; - return vec2(cosf(a), sinf(a)); -} - -inline vec2 get_dir(float a) -{ - return vec2(cosf(a), sinf(a)); -} - -inline float get_angle(vec2 dir) -{ - float a = atan(dir.y/dir.x); - if(dir.x < 0) - a = a+pi; - return a; -} - -inline void str_to_ints(int *ints, int num, const char *str) -{ - int index = 0; - while(num) - { - char buf[4] = {0,0,0,0}; - for(int c = 0; c < 4 && str[index]; c++, index++) - buf[c] = str[index]; - *ints = ((buf[0]+128)<<24)|((buf[1]+128)<<16)|((buf[2]+128)<<8)|(buf[3]+128); - ints++; - num--; - } - - // null terminate - ints[-1] &= 0xffffff00; -} - -inline void ints_to_str(const int *ints, int num, char *str) -{ - while(num) - { - str[0] = (((*ints)>>24)&0xff)-128; - str[1] = (((*ints)>>16)&0xff)-128; - str[2] = (((*ints)>>8)&0xff)-128; - str[3] = ((*ints)&0xff)-128; - str += 4; - ints++; - num--; - } - - // null terminate - str[-1] = 0; -} - - - -inline vec2 calc_pos(vec2 p, vec2 v, float curvature, float speed, float t) -{ - vec2 n; - t *= speed; - n.x = p.x + v.x*t; - n.y = p.y + v.y*t + curvature/10000*(t*t); - return n; -} - - -template -inline T saturated_add(T min, T max, T current, T modifier) -{ - if(modifier < 0) - { - if(current < min) - return current; - current += modifier; - if(current < min) - current = min; - return current; - } - else - { - if(current > max) - return current; - current += modifier; - if(current > max) - current = max; - return current; - } -} - -void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces); -void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity); -bool test_box(vec2 pos, vec2 size); -float velocity_ramp(float value, float start, float range, float curvature); - -// hooking stuff -enum -{ - HOOK_RETRACTED=-1, - HOOK_IDLE=0, - HOOK_RETRACT_START=1, - HOOK_RETRACT_END=3, - HOOK_FLYING, - HOOK_GRABBED, - - COREEVENT_GROUND_JUMP=0x01, - COREEVENT_AIR_JUMP=0x02, - COREEVENT_HOOK_LAUNCH=0x04, - COREEVENT_HOOK_ATTACH_PLAYER=0x08, - COREEVENT_HOOK_ATTACH_GROUND=0x10, - COREEVENT_HOOK_HIT_NOHOOK=0x20, - COREEVENT_HOOK_RETRACT=0x40, -}; - -class WORLD_CORE -{ -public: - WORLD_CORE() - { - mem_zero(characters, sizeof(characters)); - } - - TUNING_PARAMS tuning; - class CHARACTER_CORE *characters[MAX_CLIENTS]; -}; - -class CHARACTER_CORE -{ -public: - WORLD_CORE *world; - - vec2 pos; - vec2 vel; - - vec2 hook_pos; - vec2 hook_dir; - int hook_tick; - int hook_state; - int hooked_player; - - int jumped; - - int direction; - int angle; - NETOBJ_PLAYER_INPUT input; - - int triggered_events; - - void reset(); - void tick(bool use_input); - void move(); - - void read(const NETOBJ_CHARACTER_CORE *obj_core); - void write(NETOBJ_CHARACTER_CORE *obj_core); - void quantize(); -}; - - -#define LERP(a,b,t) (a + (b-a) * t) -#define min(a, b) ( a > b ? b : a) -#define max(a, b) ( a > b ? a : b) - -inline bool col_check_point(float x, float y) { return col_is_solid(round(x), round(y)) != 0; } -inline bool col_check_point(vec2 p) { return col_check_point(p.x, p.y); } - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/createdir.txt b/project/jni/application/teeworlds-0.5.2/src/game/generated/createdir.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.cpp b/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.cpp deleted file mode 100644 index 75348b7cd..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.cpp +++ /dev/null @@ -1,528 +0,0 @@ -#include -#include "g_protocol.hpp" -const char *msg_failed_on = ""; -const char *obj_corrected_on = ""; -static int num_corrections = 0; -int netobj_num_corrections() { return num_corrections; } -const char *netobj_corrected_on() { return obj_corrected_on; } -const char *netmsg_failed_on() { return msg_failed_on; } -const int max_int = 0x7fffffff; -static int netobj_clamp_int(const char *error_msg, int v, int min, int max) -{ - if(vmax) { obj_corrected_on = error_msg; num_corrections++; return max; } - return v; -} -static const char *netobj_names[] = { - "invalid", - "player_input", - "projectile", - "laser", - "pickup", - "flag", - "game", - "character_core", - "character", - "player_info", - "client_info", - "common", - "explosion", - "spawn", - "hammerhit", - "death", - "soundglobal", - "soundworld", - "damageind", - "" -}; - -static int netobj_sizes[] = { - 0, - sizeof(NETOBJ_PLAYER_INPUT), - sizeof(NETOBJ_PROJECTILE), - sizeof(NETOBJ_LASER), - sizeof(NETOBJ_PICKUP), - sizeof(NETOBJ_FLAG), - sizeof(NETOBJ_GAME), - sizeof(NETOBJ_CHARACTER_CORE), - sizeof(NETOBJ_CHARACTER), - sizeof(NETOBJ_PLAYER_INFO), - sizeof(NETOBJ_CLIENT_INFO), - sizeof(NETEVENT_COMMON), - sizeof(NETEVENT_EXPLOSION), - sizeof(NETEVENT_SPAWN), - sizeof(NETEVENT_HAMMERHIT), - sizeof(NETEVENT_DEATH), - sizeof(NETEVENT_SOUNDGLOBAL), - sizeof(NETEVENT_SOUNDWORLD), - sizeof(NETEVENT_DAMAGEIND), - 0 -}; - -static int validate_player_input(void *data, int size) -{ - NETOBJ_PLAYER_INPUT *obj = (NETOBJ_PLAYER_INPUT *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("player_state", obj->player_state, 0, 4); - return 0; -} - -static int validate_projectile(void *data, int size) -{ - NETOBJ_PROJECTILE *obj = (NETOBJ_PROJECTILE *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("type", obj->type, 0, NUM_WEAPONS-1); - netobj_clamp_int("start_tick", obj->start_tick, 0, max_int); - return 0; -} - -static int validate_laser(void *data, int size) -{ - NETOBJ_LASER *obj = (NETOBJ_LASER *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("start_tick", obj->start_tick, 0, max_int); - return 0; -} - -static int validate_pickup(void *data, int size) -{ - NETOBJ_PICKUP *obj = (NETOBJ_PICKUP *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("type", obj->type, 0, max_int); - netobj_clamp_int("subtype", obj->subtype, 0, max_int); - return 0; -} - -static int validate_flag(void *data, int size) -{ - NETOBJ_FLAG *obj = (NETOBJ_FLAG *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("team", obj->team, 0, 1); - netobj_clamp_int("carried_by", obj->carried_by, -2, MAX_CLIENTS-1); - return 0; -} - -static int validate_game(void *data, int size) -{ - NETOBJ_GAME *obj = (NETOBJ_GAME *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("flags", obj->flags, 0, 256); - netobj_clamp_int("round_start_tick", obj->round_start_tick, 0, max_int); - netobj_clamp_int("game_over", obj->game_over, 0, 1); - netobj_clamp_int("sudden_death", obj->sudden_death, 0, 1); - netobj_clamp_int("paused", obj->paused, 0, 1); - netobj_clamp_int("score_limit", obj->score_limit, 0, max_int); - netobj_clamp_int("time_limit", obj->time_limit, 0, max_int); - netobj_clamp_int("warmup", obj->warmup, 0, max_int); - netobj_clamp_int("round_num", obj->round_num, 0, max_int); - netobj_clamp_int("round_current", obj->round_current, 0, max_int); - return 0; -} - -static int validate_character_core(void *data, int size) -{ - NETOBJ_CHARACTER_CORE *obj = (NETOBJ_CHARACTER_CORE *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("direction", obj->direction, -1, 1); - netobj_clamp_int("jumped", obj->jumped, 0, 3); - netobj_clamp_int("hooked_player", obj->hooked_player, 0, MAX_CLIENTS-1); - netobj_clamp_int("hook_state", obj->hook_state, -1, 5); - netobj_clamp_int("hook_tick", obj->hook_tick, 0, max_int); - return 0; -} - -static int validate_character(void *data, int size) -{ - NETOBJ_CHARACTER *obj = (NETOBJ_CHARACTER *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("player_state", obj->player_state, 0, NUM_PLAYERSTATES-1); - netobj_clamp_int("health", obj->health, 0, 10); - netobj_clamp_int("armor", obj->armor, 0, 10); - netobj_clamp_int("ammocount", obj->ammocount, 0, 10); - netobj_clamp_int("weapon", obj->weapon, 0, NUM_WEAPONS-1); - netobj_clamp_int("emote", obj->emote, 0, 6); - netobj_clamp_int("attacktick", obj->attacktick, 0, max_int); - return 0; -} - -static int validate_player_info(void *data, int size) -{ - NETOBJ_PLAYER_INFO *obj = (NETOBJ_PLAYER_INFO *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("local", obj->local, 0, 1); - netobj_clamp_int("cid", obj->cid, 0, MAX_CLIENTS-1); - netobj_clamp_int("team", obj->team, -1, 1); - return 0; -} - -static int validate_client_info(void *data, int size) -{ - NETOBJ_CLIENT_INFO *obj = (NETOBJ_CLIENT_INFO *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("use_custom_color", obj->use_custom_color, 0, 1); - return 0; -} - -static int validate_common(void *data, int size) -{ - NETEVENT_COMMON *obj = (NETEVENT_COMMON *)data; - if(sizeof(*obj) != size) return -1; - return 0; -} - -static int validate_explosion(void *data, int size) -{ - NETEVENT_EXPLOSION *obj = (NETEVENT_EXPLOSION *)data; - if(sizeof(*obj) != size) return -1; - return 0; -} - -static int validate_spawn(void *data, int size) -{ - NETEVENT_SPAWN *obj = (NETEVENT_SPAWN *)data; - if(sizeof(*obj) != size) return -1; - return 0; -} - -static int validate_hammerhit(void *data, int size) -{ - NETEVENT_HAMMERHIT *obj = (NETEVENT_HAMMERHIT *)data; - if(sizeof(*obj) != size) return -1; - return 0; -} - -static int validate_death(void *data, int size) -{ - NETEVENT_DEATH *obj = (NETEVENT_DEATH *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("cid", obj->cid, 0, MAX_CLIENTS-1); - return 0; -} - -static int validate_soundglobal(void *data, int size) -{ - NETEVENT_SOUNDGLOBAL *obj = (NETEVENT_SOUNDGLOBAL *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("soundid", obj->soundid, 0, NUM_SOUNDS-1); - return 0; -} - -static int validate_soundworld(void *data, int size) -{ - NETEVENT_SOUNDWORLD *obj = (NETEVENT_SOUNDWORLD *)data; - if(sizeof(*obj) != size) return -1; - netobj_clamp_int("soundid", obj->soundid, 0, NUM_SOUNDS-1); - return 0; -} - -static int validate_damageind(void *data, int size) -{ - NETEVENT_DAMAGEIND *obj = (NETEVENT_DAMAGEIND *)data; - if(sizeof(*obj) != size) return -1; - return 0; -} - -static void *secure_unpack_sv_motd() -{ - static NETMSG_SV_MOTD msg; - msg.message = msg_unpack_string(); - return &msg; -} - -static void *secure_unpack_sv_broadcast() -{ - static NETMSG_SV_BROADCAST msg; - msg.message = msg_unpack_string(); - return &msg; -} - -static void *secure_unpack_sv_chat() -{ - static NETMSG_SV_CHAT msg; - msg.team = msg_unpack_int(); - msg.cid = msg_unpack_int(); - msg.message = msg_unpack_string(); - if(msg.team < -1 || msg.team > 1) { msg_failed_on = "team"; return 0; } - if(msg.cid < -1 || msg.cid > MAX_CLIENTS-1) { msg_failed_on = "cid"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_killmsg() -{ - static NETMSG_SV_KILLMSG msg; - msg.killer = msg_unpack_int(); - msg.victim = msg_unpack_int(); - msg.weapon = msg_unpack_int(); - msg.mode_special = msg_unpack_int(); - if(msg.killer < 0 || msg.killer > MAX_CLIENTS-1) { msg_failed_on = "killer"; return 0; } - if(msg.victim < 0 || msg.victim > MAX_CLIENTS-1) { msg_failed_on = "victim"; return 0; } - if(msg.weapon < -3 || msg.weapon > NUM_WEAPONS-1) { msg_failed_on = "weapon"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_soundglobal() -{ - static NETMSG_SV_SOUNDGLOBAL msg; - msg.soundid = msg_unpack_int(); - if(msg.soundid < 0 || msg.soundid > NUM_SOUNDS-1) { msg_failed_on = "soundid"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_tuneparams() -{ - static NETMSG_SV_TUNEPARAMS msg; - return &msg; -} - -static void *secure_unpack_sv_extraprojectile() -{ - static NETMSG_SV_EXTRAPROJECTILE msg; - return &msg; -} - -static void *secure_unpack_sv_readytoenter() -{ - static NETMSG_SV_READYTOENTER msg; - return &msg; -} - -static void *secure_unpack_sv_weaponpickup() -{ - static NETMSG_SV_WEAPONPICKUP msg; - msg.weapon = msg_unpack_int(); - if(msg.weapon < 0 || msg.weapon > NUM_WEAPONS-1) { msg_failed_on = "weapon"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_emoticon() -{ - static NETMSG_SV_EMOTICON msg; - msg.cid = msg_unpack_int(); - msg.emoticon = msg_unpack_int(); - if(msg.cid < 0 || msg.cid > MAX_CLIENTS-1) { msg_failed_on = "cid"; return 0; } - if(msg.emoticon < 0 || msg.emoticon > NUM_EMOTICONS-1) { msg_failed_on = "emoticon"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_vote_clearoptions() -{ - static NETMSG_SV_VOTE_CLEAROPTIONS msg; - return &msg; -} - -static void *secure_unpack_sv_vote_option() -{ - static NETMSG_SV_VOTE_OPTION msg; - msg.command = msg_unpack_string(); - return &msg; -} - -static void *secure_unpack_sv_vote_set() -{ - static NETMSG_SV_VOTE_SET msg; - msg.timeout = msg_unpack_int(); - msg.description = msg_unpack_string(); - msg.command = msg_unpack_string(); - if(msg.timeout < 0 || msg.timeout > 60) { msg_failed_on = "timeout"; return 0; } - return &msg; -} - -static void *secure_unpack_sv_vote_status() -{ - static NETMSG_SV_VOTE_STATUS msg; - msg.yes = msg_unpack_int(); - msg.no = msg_unpack_int(); - msg.pass = msg_unpack_int(); - msg.total = msg_unpack_int(); - if(msg.yes < 0 || msg.yes > MAX_CLIENTS) { msg_failed_on = "yes"; return 0; } - if(msg.no < 0 || msg.no > MAX_CLIENTS) { msg_failed_on = "no"; return 0; } - if(msg.pass < 0 || msg.pass > MAX_CLIENTS) { msg_failed_on = "pass"; return 0; } - if(msg.total < 0 || msg.total > MAX_CLIENTS) { msg_failed_on = "total"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_say() -{ - static NETMSG_CL_SAY msg; - msg.team = msg_unpack_int(); - msg.message = msg_unpack_string(); - if(msg.team < 0 || msg.team > 1) { msg_failed_on = "team"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_setteam() -{ - static NETMSG_CL_SETTEAM msg; - msg.team = msg_unpack_int(); - if(msg.team < -1 || msg.team > 1) { msg_failed_on = "team"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_startinfo() -{ - static NETMSG_CL_STARTINFO msg; - msg.name = msg_unpack_string(); - msg.skin = msg_unpack_string(); - msg.use_custom_color = msg_unpack_int(); - msg.color_body = msg_unpack_int(); - msg.color_feet = msg_unpack_int(); - if(msg.use_custom_color < 0 || msg.use_custom_color > 1) { msg_failed_on = "use_custom_color"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_changeinfo() -{ - static NETMSG_CL_CHANGEINFO msg; - msg.name = msg_unpack_string(); - msg.skin = msg_unpack_string(); - msg.use_custom_color = msg_unpack_int(); - msg.color_body = msg_unpack_int(); - msg.color_feet = msg_unpack_int(); - if(msg.use_custom_color < 0 || msg.use_custom_color > 1) { msg_failed_on = "use_custom_color"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_kill() -{ - static NETMSG_CL_KILL msg; - return &msg; -} - -static void *secure_unpack_cl_emoticon() -{ - static NETMSG_CL_EMOTICON msg; - msg.emoticon = msg_unpack_int(); - if(msg.emoticon < 0 || msg.emoticon > NUM_EMOTICONS-1) { msg_failed_on = "emoticon"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_vote() -{ - static NETMSG_CL_VOTE msg; - msg.vote = msg_unpack_int(); - if(msg.vote < -1 || msg.vote > 1) { msg_failed_on = "vote"; return 0; } - return &msg; -} - -static void *secure_unpack_cl_callvote() -{ - static NETMSG_CL_CALLVOTE msg; - msg.type = msg_unpack_string(); - msg.value = msg_unpack_string(); - return &msg; -} - -static int validate_invalid(void *data, int size) { return -1; } -typedef int(*VALIDATEFUNC)(void *data, int size); -static VALIDATEFUNC validate_funcs[] = { - validate_invalid, - validate_player_input, - validate_projectile, - validate_laser, - validate_pickup, - validate_flag, - validate_game, - validate_character_core, - validate_character, - validate_player_info, - validate_client_info, - validate_common, - validate_explosion, - validate_spawn, - validate_hammerhit, - validate_death, - validate_soundglobal, - validate_soundworld, - validate_damageind, - 0x0 -}; - -int netobj_validate(int type, void *data, int size) -{ - if(type < 0 || type >= NUM_NETOBJTYPES) return -1; - return validate_funcs[type](data, size); -}; - -const char *netobj_get_name(int type) -{ - if(type < 0 || type >= NUM_NETOBJTYPES) return "(out of range)"; - return netobj_names[type]; -}; - -int netobj_get_size(int type) -{ - if(type < 0 || type >= NUM_NETOBJTYPES) return 0; - return netobj_sizes[type]; -}; - -static void *secure_unpack_invalid() { return 0; } -typedef void *(*SECUREUNPACKFUNC)(); -static SECUREUNPACKFUNC secure_unpack_funcs[] = { - secure_unpack_invalid, - secure_unpack_sv_motd, - secure_unpack_sv_broadcast, - secure_unpack_sv_chat, - secure_unpack_sv_killmsg, - secure_unpack_sv_soundglobal, - secure_unpack_sv_tuneparams, - secure_unpack_sv_extraprojectile, - secure_unpack_sv_readytoenter, - secure_unpack_sv_weaponpickup, - secure_unpack_sv_emoticon, - secure_unpack_sv_vote_clearoptions, - secure_unpack_sv_vote_option, - secure_unpack_sv_vote_set, - secure_unpack_sv_vote_status, - secure_unpack_cl_say, - secure_unpack_cl_setteam, - secure_unpack_cl_startinfo, - secure_unpack_cl_changeinfo, - secure_unpack_cl_kill, - secure_unpack_cl_emoticon, - secure_unpack_cl_vote, - secure_unpack_cl_callvote, - 0x0 -}; -void *netmsg_secure_unpack(int type) -{ - void *msg; - msg_failed_on = ""; - if(type < 0 || type >= NUM_NETMSGTYPES) { msg_failed_on = "(type out of range)"; return 0; } - msg = secure_unpack_funcs[type](); - if(msg_unpack_error()) { msg_failed_on = "(unpack error)"; return 0; } - return msg; -}; - -static const char *message_names[] = { - "invalid", - "sv_motd", - "sv_broadcast", - "sv_chat", - "sv_killmsg", - "sv_soundglobal", - "sv_tuneparams", - "sv_extraprojectile", - "sv_readytoenter", - "sv_weaponpickup", - "sv_emoticon", - "sv_vote_clearoptions", - "sv_vote_option", - "sv_vote_set", - "sv_vote_status", - "cl_say", - "cl_setteam", - "cl_startinfo", - "cl_changeinfo", - "cl_kill", - "cl_emoticon", - "cl_vote", - "cl_callvote", - "" -}; - -const char *netmsg_get_name(int type) -{ - if(type < 0 || type >= NUM_NETMSGTYPES) return "(out of range)"; - return message_names[type]; -}; - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.hpp b/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.hpp deleted file mode 100644 index 55769a947..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/g_protocol.hpp +++ /dev/null @@ -1,613 +0,0 @@ -#ifndef FILE_G_PROTOCOL_H -#define FILE_G_PROTOCOL_H - -enum -{ - INPUT_STATE_MASK=0x3f, -}; - -enum -{ - PLAYERSTATE_UNKNOWN=0, - PLAYERSTATE_PLAYING, - PLAYERSTATE_IN_MENU, - PLAYERSTATE_CHATTING, - NUM_PLAYERSTATES -}; - -enum -{ - EMOTE_NORMAL=0, - EMOTE_PAIN, - EMOTE_HAPPY, - EMOTE_SURPRISE, - EMOTE_ANGRY, - EMOTE_BLINK, - NUM_EMOTES -}; - -enum -{ - POWERUP_HEALTH=0, - POWERUP_ARMOR, - POWERUP_WEAPON, - POWERUP_NINJA, - NUM_POWERUPS -}; - -enum -{ - EMOTICON_1=0, - EMOTICON_2, - EMOTICON_3, - EMOTICON_4, - EMOTICON_5, - EMOTICON_6, - EMOTICON_7, - EMOTICON_8, - EMOTICON_9, - EMOTICON_10, - EMOTICON_11, - EMOTICON_12, - EMOTICON_13, - EMOTICON_14, - EMOTICON_15, - NUM_EMOTICONS -}; - -enum -{ - GAMEFLAG_TEAMS = 1<<0, - GAMEFLAG_FLAGS = 1<<1, -}; - -enum -{ - NETOBJ_INVALID=0, - NETOBJTYPE_PLAYER_INPUT, - NETOBJTYPE_PROJECTILE, - NETOBJTYPE_LASER, - NETOBJTYPE_PICKUP, - NETOBJTYPE_FLAG, - NETOBJTYPE_GAME, - NETOBJTYPE_CHARACTER_CORE, - NETOBJTYPE_CHARACTER, - NETOBJTYPE_PLAYER_INFO, - NETOBJTYPE_CLIENT_INFO, - NETEVENTTYPE_COMMON, - NETEVENTTYPE_EXPLOSION, - NETEVENTTYPE_SPAWN, - NETEVENTTYPE_HAMMERHIT, - NETEVENTTYPE_DEATH, - NETEVENTTYPE_SOUNDGLOBAL, - NETEVENTTYPE_SOUNDWORLD, - NETEVENTTYPE_DAMAGEIND, - NUM_NETOBJTYPES -}; - -enum -{ - NETMSG_INVALID=0, - NETMSGTYPE_SV_MOTD, - NETMSGTYPE_SV_BROADCAST, - NETMSGTYPE_SV_CHAT, - NETMSGTYPE_SV_KILLMSG, - NETMSGTYPE_SV_SOUNDGLOBAL, - NETMSGTYPE_SV_TUNEPARAMS, - NETMSGTYPE_SV_EXTRAPROJECTILE, - NETMSGTYPE_SV_READYTOENTER, - NETMSGTYPE_SV_WEAPONPICKUP, - NETMSGTYPE_SV_EMOTICON, - NETMSGTYPE_SV_VOTE_CLEAROPTIONS, - NETMSGTYPE_SV_VOTE_OPTION, - NETMSGTYPE_SV_VOTE_SET, - NETMSGTYPE_SV_VOTE_STATUS, - NETMSGTYPE_CL_SAY, - NETMSGTYPE_CL_SETTEAM, - NETMSGTYPE_CL_STARTINFO, - NETMSGTYPE_CL_CHANGEINFO, - NETMSGTYPE_CL_KILL, - NETMSGTYPE_CL_EMOTICON, - NETMSGTYPE_CL_VOTE, - NETMSGTYPE_CL_CALLVOTE, - NUM_NETMSGTYPES -}; - -struct NETOBJ_PLAYER_INPUT -{ - int direction; - int target_x; - int target_y; - int jump; - int fire; - int hook; - int player_state; - int wanted_weapon; - int next_weapon; - int prev_weapon; -}; - -struct NETOBJ_PROJECTILE -{ - int x; - int y; - int vx; - int vy; - int type; - int start_tick; -}; - -struct NETOBJ_LASER -{ - int x; - int y; - int from_x; - int from_y; - int start_tick; -}; - -struct NETOBJ_PICKUP -{ - int x; - int y; - int type; - int subtype; -}; - -struct NETOBJ_FLAG -{ - int x; - int y; - int team; - int carried_by; -}; - -struct NETOBJ_GAME -{ - int flags; - int round_start_tick; - int game_over; - int sudden_death; - int paused; - int score_limit; - int time_limit; - int warmup; - int round_num; - int round_current; - int teamscore_red; - int teamscore_blue; -}; - -struct NETOBJ_CHARACTER_CORE -{ - int tick; - int x; - int y; - int vx; - int vy; - int angle; - int direction; - int jumped; - int hooked_player; - int hook_state; - int hook_tick; - int hook_x; - int hook_y; - int hook_dx; - int hook_dy; -}; - -struct NETOBJ_CHARACTER : public NETOBJ_CHARACTER_CORE -{ - int player_state; - int health; - int armor; - int ammocount; - int weapon; - int emote; - int attacktick; -}; - -struct NETOBJ_PLAYER_INFO -{ - int local; - int cid; - int team; - int score; - int latency; - int latency_flux; -}; - -struct NETOBJ_CLIENT_INFO -{ - int name0; - int name1; - int name2; - int name3; - int name4; - int name5; - int skin0; - int skin1; - int skin2; - int skin3; - int skin4; - int skin5; - int use_custom_color; - int color_body; - int color_feet; -}; - -struct NETEVENT_COMMON -{ - int x; - int y; -}; - -struct NETEVENT_EXPLOSION : public NETEVENT_COMMON -{ -}; - -struct NETEVENT_SPAWN : public NETEVENT_COMMON -{ -}; - -struct NETEVENT_HAMMERHIT : public NETEVENT_COMMON -{ -}; - -struct NETEVENT_DEATH : public NETEVENT_COMMON -{ - int cid; -}; - -struct NETEVENT_SOUNDGLOBAL : public NETEVENT_COMMON -{ - int soundid; -}; - -struct NETEVENT_SOUNDWORLD : public NETEVENT_COMMON -{ - int soundid; -}; - -struct NETEVENT_DAMAGEIND : public NETEVENT_COMMON -{ - int angle; -}; - -struct NETMSG_SV_MOTD -{ - const char *message; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_MOTD, flags); - msg_pack_string(message, -1); - msg_pack_end(); - } -}; - -struct NETMSG_SV_BROADCAST -{ - const char *message; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_BROADCAST, flags); - msg_pack_string(message, -1); - msg_pack_end(); - } -}; - -struct NETMSG_SV_CHAT -{ - int team; - int cid; - const char *message; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_CHAT, flags); - msg_pack_int(team); - msg_pack_int(cid); - msg_pack_string(message, -1); - msg_pack_end(); - } -}; - -struct NETMSG_SV_KILLMSG -{ - int killer; - int victim; - int weapon; - int mode_special; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_KILLMSG, flags); - msg_pack_int(killer); - msg_pack_int(victim); - msg_pack_int(weapon); - msg_pack_int(mode_special); - msg_pack_end(); - } -}; - -struct NETMSG_SV_SOUNDGLOBAL -{ - int soundid; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_SOUNDGLOBAL, flags); - msg_pack_int(soundid); - msg_pack_end(); - } -}; - -struct NETMSG_SV_TUNEPARAMS -{ - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_TUNEPARAMS, flags); - msg_pack_end(); - } -}; - -struct NETMSG_SV_EXTRAPROJECTILE -{ - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, flags); - msg_pack_end(); - } -}; - -struct NETMSG_SV_READYTOENTER -{ - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_READYTOENTER, flags); - msg_pack_end(); - } -}; - -struct NETMSG_SV_WEAPONPICKUP -{ - int weapon; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_WEAPONPICKUP, flags); - msg_pack_int(weapon); - msg_pack_end(); - } -}; - -struct NETMSG_SV_EMOTICON -{ - int cid; - int emoticon; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_EMOTICON, flags); - msg_pack_int(cid); - msg_pack_int(emoticon); - msg_pack_end(); - } -}; - -struct NETMSG_SV_VOTE_CLEAROPTIONS -{ - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_VOTE_CLEAROPTIONS, flags); - msg_pack_end(); - } -}; - -struct NETMSG_SV_VOTE_OPTION -{ - const char *command; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_VOTE_OPTION, flags); - msg_pack_string(command, -1); - msg_pack_end(); - } -}; - -struct NETMSG_SV_VOTE_SET -{ - int timeout; - const char *description; - const char *command; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_VOTE_SET, flags); - msg_pack_int(timeout); - msg_pack_string(description, -1); - msg_pack_string(command, -1); - msg_pack_end(); - } -}; - -struct NETMSG_SV_VOTE_STATUS -{ - int yes; - int no; - int pass; - int total; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_SV_VOTE_STATUS, flags); - msg_pack_int(yes); - msg_pack_int(no); - msg_pack_int(pass); - msg_pack_int(total); - msg_pack_end(); - } -}; - -struct NETMSG_CL_SAY -{ - int team; - const char *message; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_SAY, flags); - msg_pack_int(team); - msg_pack_string(message, -1); - msg_pack_end(); - } -}; - -struct NETMSG_CL_SETTEAM -{ - int team; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_SETTEAM, flags); - msg_pack_int(team); - msg_pack_end(); - } -}; - -struct NETMSG_CL_STARTINFO -{ - const char *name; - const char *skin; - int use_custom_color; - int color_body; - int color_feet; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_STARTINFO, flags); - msg_pack_string(name, -1); - msg_pack_string(skin, -1); - msg_pack_int(use_custom_color); - msg_pack_int(color_body); - msg_pack_int(color_feet); - msg_pack_end(); - } -}; - -struct NETMSG_CL_CHANGEINFO -{ - const char *name; - const char *skin; - int use_custom_color; - int color_body; - int color_feet; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_CHANGEINFO, flags); - msg_pack_string(name, -1); - msg_pack_string(skin, -1); - msg_pack_int(use_custom_color); - msg_pack_int(color_body); - msg_pack_int(color_feet); - msg_pack_end(); - } -}; - -struct NETMSG_CL_KILL -{ - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_KILL, flags); - msg_pack_end(); - } -}; - -struct NETMSG_CL_EMOTICON -{ - int emoticon; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_EMOTICON, flags); - msg_pack_int(emoticon); - msg_pack_end(); - } -}; - -struct NETMSG_CL_VOTE -{ - int vote; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_VOTE, flags); - msg_pack_int(vote); - msg_pack_end(); - } -}; - -struct NETMSG_CL_CALLVOTE -{ - const char *type; - const char *value; - void pack(int flags) - { - msg_pack_start(NETMSGTYPE_CL_CALLVOTE, flags); - msg_pack_string(type, -1); - msg_pack_string(value, -1); - msg_pack_end(); - } -}; - -enum -{ - SOUND_GUN_FIRE=0, - SOUND_SHOTGUN_FIRE, - SOUND_GRENADE_FIRE, - SOUND_HAMMER_FIRE, - SOUND_HAMMER_HIT, - SOUND_NINJA_FIRE, - SOUND_GRENADE_EXPLODE, - SOUND_NINJA_HIT, - SOUND_RIFLE_FIRE, - SOUND_RIFLE_BOUNCE, - SOUND_WEAPON_SWITCH, - SOUND_PLAYER_PAIN_SHORT, - SOUND_PLAYER_PAIN_LONG, - SOUND_BODY_LAND, - SOUND_PLAYER_AIRJUMP, - SOUND_PLAYER_JUMP, - SOUND_PLAYER_DIE, - SOUND_PLAYER_SPAWN, - SOUND_PLAYER_SKID, - SOUND_TEE_CRY, - SOUND_HOOK_LOOP, - SOUND_HOOK_ATTACH_GROUND, - SOUND_HOOK_ATTACH_PLAYER, - SOUND_HOOK_NOATTACH, - SOUND_PICKUP_HEALTH, - SOUND_PICKUP_ARMOR, - SOUND_PICKUP_GRENADE, - SOUND_PICKUP_SHOTGUN, - SOUND_PICKUP_NINJA, - SOUND_WEAPON_SPAWN, - SOUND_WEAPON_NOAMMO, - SOUND_HIT, - SOUND_CHAT_SERVER, - SOUND_CHAT_CLIENT, - SOUND_CTF_DROP, - SOUND_CTF_RETURN, - SOUND_CTF_GRAB_PL, - SOUND_CTF_GRAB_EN, - SOUND_CTF_CAPTURE, - NUM_SOUNDS -}; -enum -{ - WEAPON_HAMMER=0, - WEAPON_GUN, - WEAPON_SHOTGUN, - WEAPON_GRENADE, - WEAPON_RIFLE, - WEAPON_NINJA, - NUM_WEAPONS -}; -int netobj_validate(int type, void *data, int size); -const char *netobj_get_name(int type); -int netobj_get_size(int type); -void *netmsg_secure_unpack(int type); -const char *netmsg_get_name(int type); -const char *netmsg_failed_on(); -int netobj_num_corrections(); -const char *netobj_corrected_on(); -#endif // FILE_G_PROTOCOL_H diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.cpp b/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.cpp deleted file mode 100644 index 9399feb50..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.cpp +++ /dev/null @@ -1,469 +0,0 @@ -#include "gc_data.hpp" -static SOUND x1890[] = { - /* x1890[0] */ { 0, "audio/wp_gun_fire-01.wv", }, - /* x1890[1] */ { 0, "audio/wp_gun_fire-02.wv", }, - /* x1890[2] */ { 0, "audio/wp_gun_fire-03.wv", }, -}; -static SOUND x1906[] = { - /* x1906[0] */ { 0, "audio/wp_shotty_fire-01.wv", }, - /* x1906[1] */ { 0, "audio/wp_shotty_fire-02.wv", }, - /* x1906[2] */ { 0, "audio/wp_shotty_fire-03.wv", }, -}; -static SOUND x1922[] = { - /* x1922[0] */ { 0, "audio/wp_flump_launch-01.wv", }, - /* x1922[1] */ { 0, "audio/wp_flump_launch-02.wv", }, - /* x1922[2] */ { 0, "audio/wp_flump_launch-03.wv", }, -}; -static SOUND x1938[] = { - /* x1938[0] */ { 0, "audio/wp_hammer_swing-01.wv", }, - /* x1938[1] */ { 0, "audio/wp_hammer_swing-02.wv", }, - /* x1938[2] */ { 0, "audio/wp_hammer_swing-03.wv", }, -}; -static SOUND x1954[] = { - /* x1954[0] */ { 0, "audio/wp_hammer_hit-01.wv", }, - /* x1954[1] */ { 0, "audio/wp_hammer_hit-02.wv", }, - /* x1954[2] */ { 0, "audio/wp_hammer_hit-03.wv", }, -}; -static SOUND x1970[] = { - /* x1970[0] */ { 0, "audio/wp_ninja_attack-01.wv", }, - /* x1970[1] */ { 0, "audio/wp_ninja_attack-02.wv", }, - /* x1970[2] */ { 0, "audio/wp_ninja_attack-03.wv", }, -}; -static SOUND x1986[] = { - /* x1986[0] */ { 0, "audio/wp_flump_explo-01.wv", }, - /* x1986[1] */ { 0, "audio/wp_flump_explo-02.wv", }, - /* x1986[2] */ { 0, "audio/wp_flump_explo-03.wv", }, -}; -static SOUND x2002[] = { - /* x2002[0] */ { 0, "audio/wp_ninja_hit-01.wv", }, - /* x2002[1] */ { 0, "audio/wp_ninja_hit-02.wv", }, - /* x2002[2] */ { 0, "audio/wp_ninja_hit-03.wv", }, -}; -static SOUND x2018[] = { - /* x2018[0] */ { 0, "audio/wp_rifle_fire-01.wv", }, - /* x2018[1] */ { 0, "audio/wp_rifle_fire-02.wv", }, - /* x2018[2] */ { 0, "audio/wp_rifle_fire-03.wv", }, -}; -static SOUND x2034[] = { - /* x2034[0] */ { 0, "audio/wp_rifle_bnce-01.wv", }, - /* x2034[1] */ { 0, "audio/wp_rifle_bnce-02.wv", }, - /* x2034[2] */ { 0, "audio/wp_rifle_bnce-03.wv", }, -}; -static SOUND x2050[] = { - /* x2050[0] */ { 0, "audio/wp_switch-01.wv", }, - /* x2050[1] */ { 0, "audio/wp_switch-02.wv", }, - /* x2050[2] */ { 0, "audio/wp_switch-03.wv", }, -}; -static SOUND x2066[] = { - /* x2066[0] */ { 0, "audio/vo_teefault_pain_short-01.wv", }, - /* x2066[1] */ { 0, "audio/vo_teefault_pain_short-02.wv", }, - /* x2066[2] */ { 0, "audio/vo_teefault_pain_short-03.wv", }, - /* x2066[3] */ { 0, "audio/vo_teefault_pain_short-04.wv", }, - /* x2066[4] */ { 0, "audio/vo_teefault_pain_short-05.wv", }, - /* x2066[5] */ { 0, "audio/vo_teefault_pain_short-06.wv", }, - /* x2066[6] */ { 0, "audio/vo_teefault_pain_short-07.wv", }, - /* x2066[7] */ { 0, "audio/vo_teefault_pain_short-08.wv", }, - /* x2066[8] */ { 0, "audio/vo_teefault_pain_short-09.wv", }, - /* x2066[9] */ { 0, "audio/vo_teefault_pain_short-10.wv", }, - /* x2066[10] */ { 0, "audio/vo_teefault_pain_short-11.wv", }, - /* x2066[11] */ { 0, "audio/vo_teefault_pain_short-12.wv", }, -}; -static SOUND x2109[] = { - /* x2109[0] */ { 0, "audio/vo_teefault_pain_long-01.wv", }, - /* x2109[1] */ { 0, "audio/vo_teefault_pain_long-02.wv", }, -}; -static SOUND x2122[] = { - /* x2122[0] */ { 0, "audio/foley_land-01.wv", }, - /* x2122[1] */ { 0, "audio/foley_land-02.wv", }, - /* x2122[2] */ { 0, "audio/foley_land-03.wv", }, - /* x2122[3] */ { 0, "audio/foley_land-04.wv", }, -}; -static SOUND x2141[] = { - /* x2141[0] */ { 0, "audio/foley_dbljump-01.wv", }, - /* x2141[1] */ { 0, "audio/foley_dbljump-02.wv", }, - /* x2141[2] */ { 0, "audio/foley_dbljump-03.wv", }, -}; -static SOUND x2157[] = { - /* x2157[0] */ { 0, "audio/foley_foot_left-01.wv", }, - /* x2157[1] */ { 0, "audio/foley_foot_left-02.wv", }, - /* x2157[2] */ { 0, "audio/foley_foot_left-03.wv", }, - /* x2157[3] */ { 0, "audio/foley_foot_left-04.wv", }, - /* x2157[4] */ { 0, "audio/foley_foot_right-01.wv", }, - /* x2157[5] */ { 0, "audio/foley_foot_right-02.wv", }, - /* x2157[6] */ { 0, "audio/foley_foot_right-03.wv", }, - /* x2157[7] */ { 0, "audio/foley_foot_right-04.wv", }, -}; -static SOUND x2188[] = { - /* x2188[0] */ { 0, "audio/foley_body_splat-01.wv", }, - /* x2188[1] */ { 0, "audio/foley_body_splat-02.wv", }, - /* x2188[2] */ { 0, "audio/foley_body_splat-03.wv", }, -}; -static SOUND x2204[] = { - /* x2204[0] */ { 0, "audio/vo_teefault_spawn-01.wv", }, - /* x2204[1] */ { 0, "audio/vo_teefault_spawn-02.wv", }, - /* x2204[2] */ { 0, "audio/vo_teefault_spawn-03.wv", }, - /* x2204[3] */ { 0, "audio/vo_teefault_spawn-04.wv", }, - /* x2204[4] */ { 0, "audio/vo_teefault_spawn-05.wv", }, - /* x2204[5] */ { 0, "audio/vo_teefault_spawn-06.wv", }, - /* x2204[6] */ { 0, "audio/vo_teefault_spawn-07.wv", }, -}; -static SOUND x2232[] = { - /* x2232[0] */ { 0, "audio/sfx_skid-01.wv", }, - /* x2232[1] */ { 0, "audio/sfx_skid-02.wv", }, - /* x2232[2] */ { 0, "audio/sfx_skid-03.wv", }, - /* x2232[3] */ { 0, "audio/sfx_skid-04.wv", }, -}; -static SOUND x2251[] = { - /* x2251[0] */ { 0, "audio/vo_teefault_cry-01.wv", }, - /* x2251[1] */ { 0, "audio/vo_teefault_cry-02.wv", }, -}; -static SOUND x2264[] = { - /* x2264[0] */ { 0, "audio/hook_loop-01.wv", }, - /* x2264[1] */ { 0, "audio/hook_loop-02.wv", }, -}; -static SOUND x2277[] = { - /* x2277[0] */ { 0, "audio/hook_attach-01.wv", }, - /* x2277[1] */ { 0, "audio/hook_attach-02.wv", }, - /* x2277[2] */ { 0, "audio/hook_attach-03.wv", }, -}; -static SOUND x2293[] = { - /* x2293[0] */ { 0, "audio/foley_body_impact-01.wv", }, - /* x2293[1] */ { 0, "audio/foley_body_impact-02.wv", }, - /* x2293[2] */ { 0, "audio/foley_body_impact-03.wv", }, -}; -static SOUND x2309[] = { - /* x2309[0] */ { 0, "audio/hook_noattach-01.wv", }, - /* x2309[1] */ { 0, "audio/hook_noattach-02.wv", }, -}; -static SOUND x2322[] = { - /* x2322[0] */ { 0, "audio/sfx_pickup_hrt-01.wv", }, - /* x2322[1] */ { 0, "audio/sfx_pickup_hrt-02.wv", }, -}; -static SOUND x2335[] = { - /* x2335[0] */ { 0, "audio/sfx_pickup_arm-01.wv", }, - /* x2335[1] */ { 0, "audio/sfx_pickup_arm-02.wv", }, - /* x2335[2] */ { 0, "audio/sfx_pickup_arm-03.wv", }, - /* x2335[3] */ { 0, "audio/sfx_pickup_arm-04.wv", }, -}; -static SOUND x2354[] = { - /* x2354[0] */ { 0, "audio/sfx_pickup_launcher.wv", }, -}; -static SOUND x2364[] = { - /* x2364[0] */ { 0, "audio/sfx_pickup_sg.wv", }, -}; -static SOUND x2374[] = { - /* x2374[0] */ { 0, "audio/sfx_pickup_ninja.wv", }, -}; -static SOUND x2384[] = { - /* x2384[0] */ { 0, "audio/sfx_spawn_wpn-01.wv", }, - /* x2384[1] */ { 0, "audio/sfx_spawn_wpn-02.wv", }, - /* x2384[2] */ { 0, "audio/sfx_spawn_wpn-03.wv", }, -}; -static SOUND x2400[] = { - /* x2400[0] */ { 0, "audio/wp_noammo-01.wv", }, - /* x2400[1] */ { 0, "audio/wp_noammo-02.wv", }, - /* x2400[2] */ { 0, "audio/wp_noammo-03.wv", }, - /* x2400[3] */ { 0, "audio/wp_noammo-04.wv", }, - /* x2400[4] */ { 0, "audio/wp_noammo-05.wv", }, -}; -static SOUND x2422[] = { - /* x2422[0] */ { 0, "audio/sfx_hit_weak-01.wv", }, - /* x2422[1] */ { 0, "audio/sfx_hit_weak-02.wv", }, -}; -static SOUND x2435[] = { - /* x2435[0] */ { 0, "audio/sfx_msg-server.wv", }, -}; -static SOUND x2445[] = { - /* x2445[0] */ { 0, "audio/sfx_msg-client.wv", }, -}; -static SOUND x2455[] = { - /* x2455[0] */ { 0, "audio/sfx_ctf_drop.wv", }, -}; -static SOUND x2465[] = { - /* x2465[0] */ { 0, "audio/sfx_ctf_rtn.wv", }, -}; -static SOUND x2475[] = { - /* x2475[0] */ { 0, "audio/sfx_ctf_grab_pl.wv", }, -}; -static SOUND x2485[] = { - /* x2485[0] */ { 0, "audio/sfx_ctf_grab_en.wv", }, -}; -static SOUND x2495[] = { - /* x2495[0] */ { 0, "audio/sfx_ctf_cap_pl.wv", }, -}; -static SOUNDSET x9[] = { - /* x9[0] */ { "gun_fire", 3,x1890, -1, }, - /* x9[1] */ { "shotgun_fire", 3,x1906, -1, }, - /* x9[2] */ { "grenade_fire", 3,x1922, -1, }, - /* x9[3] */ { "hammer_fire", 3,x1938, -1, }, - /* x9[4] */ { "hammer_hit", 3,x1954, -1, }, - /* x9[5] */ { "ninja_fire", 3,x1970, -1, }, - /* x9[6] */ { "grenade_explode", 3,x1986, -1, }, - /* x9[7] */ { "ninja_hit", 3,x2002, -1, }, - /* x9[8] */ { "rifle_fire", 3,x2018, -1, }, - /* x9[9] */ { "rifle_bounce", 3,x2034, -1, }, - /* x9[10] */ { "weapon_switch", 3,x2050, -1, }, - /* x9[11] */ { "player_pain_short", 12,x2066, -1, }, - /* x9[12] */ { "player_pain_long", 2,x2109, -1, }, - /* x9[13] */ { "body_land", 4,x2122, -1, }, - /* x9[14] */ { "player_airjump", 3,x2141, -1, }, - /* x9[15] */ { "player_jump", 8,x2157, -1, }, - /* x9[16] */ { "player_die", 3,x2188, -1, }, - /* x9[17] */ { "player_spawn", 7,x2204, -1, }, - /* x9[18] */ { "player_skid", 4,x2232, -1, }, - /* x9[19] */ { "tee_cry", 2,x2251, -1, }, - /* x9[20] */ { "hook_loop", 2,x2264, -1, }, - /* x9[21] */ { "hook_attach_ground", 3,x2277, -1, }, - /* x9[22] */ { "hook_attach_player", 3,x2293, -1, }, - /* x9[23] */ { "hook_noattach", 2,x2309, -1, }, - /* x9[24] */ { "pickup_health", 2,x2322, -1, }, - /* x9[25] */ { "pickup_armor", 4,x2335, -1, }, - /* x9[26] */ { "pickup_grenade", 1,x2354, -1, }, - /* x9[27] */ { "pickup_shotgun", 1,x2364, -1, }, - /* x9[28] */ { "pickup_ninja", 1,x2374, -1, }, - /* x9[29] */ { "weapon_spawn", 3,x2384, -1, }, - /* x9[30] */ { "weapon_noammo", 5,x2400, -1, }, - /* x9[31] */ { "hit", 2,x2422, -1, }, - /* x9[32] */ { "chat_server", 1,x2435, -1, }, - /* x9[33] */ { "chat_client", 1,x2445, -1, }, - /* x9[34] */ { "ctf_drop", 1,x2455, -1, }, - /* x9[35] */ { "ctf_return", 1,x2465, -1, }, - /* x9[36] */ { "ctf_grab_pl", 1,x2475, -1, }, - /* x9[37] */ { "ctf_grab_en", 1,x2485, -1, }, - /* x9[38] */ { "ctf_capture", 1,x2495, -1, }, -}; -static IMAGE x14[] = { - /* x14[0] */ { "null", "", -1, }, - /* x14[1] */ { "game", "game.png", -1, }, - /* x14[2] */ { "particles", "particles.png", -1, }, - /* x14[3] */ { "cursor", "gui_cursor.png", -1, }, - /* x14[4] */ { "banner", "gui_logo.png", -1, }, - /* x14[5] */ { "emoticons", "emoticons.png", -1, }, - /* x14[6] */ { "browseicons", "browse_icons.png", -1, }, - /* x14[7] */ { "console_bg", "console.png", -1, }, - /* x14[8] */ { "console_bar", "console_bar.png", -1, }, -}; -static PICKUPSPEC x19[] = { - /* x19[0] */ { "health", 15, 0, }, - /* x19[1] */ { "armor", 15, 0, }, - /* x19[2] */ { "weapon", 15, 0, }, - /* x19[3] */ { "ninja", 90, 90, }, -}; -static SPRITESET x28[] = { - /* x28[0] */ { &x14[2], 8, 8, }, - /* x28[1] */ { &x14[1], 32, 16, }, - /* x28[2] */ { &x14[0], 8, 4, }, - /* x28[3] */ { &x14[6], 4, 1, }, - /* x28[4] */ { &x14[5], 4, 4, }, -}; -static SPRITE x44[] = { - /* x44[0] */ { "part_slice", &x28[0], 0, 0, 1, 1, }, - /* x44[1] */ { "part_ball", &x28[0], 1, 0, 1, 1, }, - /* x44[2] */ { "part_splat01", &x28[0], 2, 0, 1, 1, }, - /* x44[3] */ { "part_splat02", &x28[0], 3, 0, 1, 1, }, - /* x44[4] */ { "part_splat03", &x28[0], 4, 0, 1, 1, }, - /* x44[5] */ { "part_smoke", &x28[0], 0, 1, 1, 1, }, - /* x44[6] */ { "part_shell", &x28[0], 0, 2, 2, 2, }, - /* x44[7] */ { "part_expl01", &x28[0], 0, 4, 4, 4, }, - /* x44[8] */ { "part_airjump", &x28[0], 2, 2, 2, 2, }, - /* x44[9] */ { "health_full", &x28[1], 21, 0, 2, 2, }, - /* x44[10] */ { "health_empty", &x28[1], 23, 0, 2, 2, }, - /* x44[11] */ { "armor_full", &x28[1], 21, 2, 2, 2, }, - /* x44[12] */ { "armor_empty", &x28[1], 23, 2, 2, 2, }, - /* x44[13] */ { "star1", &x28[1], 15, 0, 2, 2, }, - /* x44[14] */ { "star2", &x28[1], 17, 0, 2, 2, }, - /* x44[15] */ { "star3", &x28[1], 19, 0, 2, 2, }, - /* x44[16] */ { "part1", &x28[1], 6, 0, 1, 1, }, - /* x44[17] */ { "part2", &x28[1], 6, 1, 1, 1, }, - /* x44[18] */ { "part3", &x28[1], 7, 0, 1, 1, }, - /* x44[19] */ { "part4", &x28[1], 7, 1, 1, 1, }, - /* x44[20] */ { "part5", &x28[1], 8, 0, 1, 1, }, - /* x44[21] */ { "part6", &x28[1], 8, 1, 1, 1, }, - /* x44[22] */ { "part7", &x28[1], 9, 0, 2, 2, }, - /* x44[23] */ { "part8", &x28[1], 11, 0, 2, 2, }, - /* x44[24] */ { "part9", &x28[1], 13, 0, 2, 2, }, - /* x44[25] */ { "weapon_gun_body", &x28[1], 2, 4, 4, 2, }, - /* x44[26] */ { "weapon_gun_cursor", &x28[1], 0, 4, 2, 2, }, - /* x44[27] */ { "weapon_gun_proj", &x28[1], 6, 4, 2, 2, }, - /* x44[28] */ { "weapon_gun_muzzle1", &x28[1], 8, 4, 3, 2, }, - /* x44[29] */ { "weapon_gun_muzzle2", &x28[1], 12, 4, 3, 2, }, - /* x44[30] */ { "weapon_gun_muzzle3", &x28[1], 16, 4, 3, 2, }, - /* x44[31] */ { "weapon_shotgun_body", &x28[1], 2, 6, 8, 2, }, - /* x44[32] */ { "weapon_shotgun_cursor", &x28[1], 0, 6, 2, 2, }, - /* x44[33] */ { "weapon_shotgun_proj", &x28[1], 10, 6, 2, 2, }, - /* x44[34] */ { "weapon_shotgun_muzzle1", &x28[1], 12, 6, 3, 2, }, - /* x44[35] */ { "weapon_shotgun_muzzle2", &x28[1], 16, 6, 3, 2, }, - /* x44[36] */ { "weapon_shotgun_muzzle3", &x28[1], 20, 6, 3, 2, }, - /* x44[37] */ { "weapon_grenade_body", &x28[1], 2, 8, 7, 2, }, - /* x44[38] */ { "weapon_grenade_cursor", &x28[1], 0, 8, 2, 2, }, - /* x44[39] */ { "weapon_grenade_proj", &x28[1], 10, 8, 2, 2, }, - /* x44[40] */ { "weapon_hammer_body", &x28[1], 2, 1, 4, 3, }, - /* x44[41] */ { "weapon_hammer_cursor", &x28[1], 0, 0, 2, 2, }, - /* x44[42] */ { "weapon_hammer_proj", &x28[1], 0, 0, 0, 0, }, - /* x44[43] */ { "weapon_ninja_body", &x28[1], 2, 10, 7, 2, }, - /* x44[44] */ { "weapon_ninja_cursor", &x28[1], 0, 10, 2, 2, }, - /* x44[45] */ { "weapon_ninja_proj", &x28[1], 0, 0, 0, 0, }, - /* x44[46] */ { "weapon_rifle_body", &x28[1], 2, 12, 7, 3, }, - /* x44[47] */ { "weapon_rifle_cursor", &x28[1], 0, 12, 2, 2, }, - /* x44[48] */ { "weapon_rifle_proj", &x28[1], 10, 12, 2, 2, }, - /* x44[49] */ { "hook_chain", &x28[1], 2, 0, 1, 1, }, - /* x44[50] */ { "hook_head", &x28[1], 3, 0, 2, 1, }, - /* x44[51] */ { "weapon_ninja_muzzle1", &x28[1], 25, 0, 7, 4, }, - /* x44[52] */ { "weapon_ninja_muzzle2", &x28[1], 25, 4, 7, 4, }, - /* x44[53] */ { "weapon_ninja_muzzle3", &x28[1], 25, 8, 7, 4, }, - /* x44[54] */ { "pickup_health", &x28[1], 10, 2, 2, 2, }, - /* x44[55] */ { "pickup_armor", &x28[1], 12, 2, 2, 2, }, - /* x44[56] */ { "pickup_weapon", &x28[1], 3, 0, 6, 2, }, - /* x44[57] */ { "pickup_ninja", &x28[1], 3, 10, 7, 2, }, - /* x44[58] */ { "flag_blue", &x28[1], 12, 8, 4, 8, }, - /* x44[59] */ { "flag_red", &x28[1], 16, 8, 4, 8, }, - /* x44[60] */ { "tee_body", &x28[2], 0, 0, 3, 3, }, - /* x44[61] */ { "tee_body_outline", &x28[2], 3, 0, 3, 3, }, - /* x44[62] */ { "tee_foot", &x28[2], 6, 1, 2, 1, }, - /* x44[63] */ { "tee_foot_outline", &x28[2], 6, 2, 2, 1, }, - /* x44[64] */ { "tee_hand", &x28[2], 6, 0, 1, 1, }, - /* x44[65] */ { "tee_hand_outline", &x28[2], 7, 0, 1, 1, }, - /* x44[66] */ { "tee_eye_normal", &x28[2], 2, 3, 1, 1, }, - /* x44[67] */ { "tee_eye_angry", &x28[2], 3, 3, 1, 1, }, - /* x44[68] */ { "tee_eye_pain", &x28[2], 4, 3, 1, 1, }, - /* x44[69] */ { "tee_eye_happy", &x28[2], 5, 3, 1, 1, }, - /* x44[70] */ { "tee_eye_dead", &x28[2], 6, 3, 1, 1, }, - /* x44[71] */ { "tee_eye_surprise", &x28[2], 7, 3, 1, 1, }, - /* x44[72] */ { "oop", &x28[4], 0, 0, 1, 1, }, - /* x44[73] */ { "exclamation", &x28[4], 1, 0, 1, 1, }, - /* x44[74] */ { "hearts", &x28[4], 2, 0, 1, 1, }, - /* x44[75] */ { "drop", &x28[4], 3, 0, 1, 1, }, - /* x44[76] */ { "dotdot", &x28[4], 0, 1, 1, 1, }, - /* x44[77] */ { "music1", &x28[4], 1, 1, 1, 1, }, - /* x44[78] */ { "music2", &x28[4], 2, 1, 1, 1, }, - /* x44[79] */ { "ghost", &x28[4], 3, 1, 1, 1, }, - /* x44[80] */ { "sushi", &x28[4], 0, 2, 1, 1, }, - /* x44[81] */ { "splattee", &x28[4], 1, 2, 1, 1, }, - /* x44[82] */ { "deviltee", &x28[4], 2, 2, 1, 1, }, - /* x44[83] */ { "zomg", &x28[4], 3, 2, 1, 1, }, - /* x44[84] */ { "zzz", &x28[4], 0, 3, 1, 1, }, - /* x44[85] */ { "blank1", &x28[4], 1, 3, 1, 1, }, - /* x44[86] */ { "deadtee", &x28[4], 2, 3, 1, 1, }, - /* x44[87] */ { "blank2", &x28[4], 3, 3, 1, 1, }, - /* x44[88] */ { "browse_lock", &x28[3], 0, 0, 1, 1, }, - /* x44[89] */ { "browse_heart", &x28[3], 1, 0, 1, 1, }, - /* x44[90] */ { "browse_unpure", &x28[3], 3, 0, 1, 1, }, -}; -static ANIM_KEYFRAME x3965[] = { - /* x3965[0] */ { 0.000000, 0.000000, -4.000000, 0.000000, }, -}; -static ANIM_KEYFRAME x3972[] = { - /* x3972[0] */ { 0.000000, 0.000000, 10.000000, 0.000000, }, -}; -static ANIM_KEYFRAME x3979[] = { - /* x3979[0] */ { 0.000000, 0.000000, 10.000000, 0.000000, }, -}; -static ANIM_KEYFRAME *x3986 = 0; -static ANIM_KEYFRAME *x4010 = 0; -static ANIM_KEYFRAME x4017[] = { - /* x4017[0] */ { 0.000000, -7.000000, 0.000000, 0.000000, }, -}; -static ANIM_KEYFRAME x4024[] = { - /* x4024[0] */ { 0.000000, 7.000000, 0.000000, 0.000000, }, -}; -static ANIM_KEYFRAME *x4031 = 0; -static ANIM_KEYFRAME *x4050 = 0; -static ANIM_KEYFRAME x4057[] = { - /* x4057[0] */ { 0.000000, -3.000000, 0.000000, -0.100000, }, -}; -static ANIM_KEYFRAME x4064[] = { - /* x4064[0] */ { 0.000000, 3.000000, 0.000000, -0.100000, }, -}; -static ANIM_KEYFRAME *x4071 = 0; -static ANIM_KEYFRAME x4090[] = { - /* x4090[0] */ { 0.000000, 0.000000, 0.000000, 0.000000, }, - /* x4090[1] */ { 0.200000, 0.000000, -1.000000, 0.000000, }, - /* x4090[2] */ { 0.400000, 0.000000, 0.000000, 0.000000, }, - /* x4090[3] */ { 0.600000, 0.000000, 0.000000, 0.000000, }, - /* x4090[4] */ { 0.800000, 0.000000, -1.000000, 0.000000, }, - /* x4090[5] */ { 1.000000, 0.000000, 0.000000, 0.000000, }, -}; -static ANIM_KEYFRAME x4097[] = { - /* x4097[0] */ { 0.000000, 8.000000, 0.000000, 0.000000, }, - /* x4097[1] */ { 0.200000, -8.000000, 0.000000, 0.000000, }, - /* x4097[2] */ { 0.400000, -10.000000, -4.000000, 0.200000, }, - /* x4097[3] */ { 0.600000, -8.000000, -8.000000, 0.300000, }, - /* x4097[4] */ { 0.800000, 4.000000, -4.000000, -0.200000, }, - /* x4097[5] */ { 1.000000, 8.000000, 0.000000, 0.000000, }, -}; -static ANIM_KEYFRAME x4104[] = { - /* x4104[0] */ { 0.000000, -10.000000, -4.000000, 0.200000, }, - /* x4104[1] */ { 0.200000, -8.000000, -8.000000, 0.300000, }, - /* x4104[2] */ { 0.400000, 4.000000, -4.000000, -0.200000, }, - /* x4104[3] */ { 0.600000, 8.000000, 0.000000, 0.000000, }, - /* x4104[4] */ { 0.800000, 8.000000, 0.000000, 0.000000, }, - /* x4104[5] */ { 1.000000, -10.000000, -4.000000, 0.200000, }, -}; -static ANIM_KEYFRAME *x4111 = 0; -static ANIM_KEYFRAME *x4210 = 0; -static ANIM_KEYFRAME *x4217 = 0; -static ANIM_KEYFRAME *x4224 = 0; -static ANIM_KEYFRAME x4231[] = { - /* x4231[0] */ { 0.000000, 0.000000, 0.000000, -0.100000, }, - /* x4231[1] */ { 0.300000, 0.000000, 0.000000, 0.250000, }, - /* x4231[2] */ { 0.400000, 0.000000, 0.000000, 0.300000, }, - /* x4231[3] */ { 0.500000, 0.000000, 0.000000, 0.250000, }, - /* x4231[4] */ { 1.000000, 0.000000, 0.000000, -0.100000, }, -}; -static ANIM_KEYFRAME *x4265 = 0; -static ANIM_KEYFRAME *x4272 = 0; -static ANIM_KEYFRAME *x4279 = 0; -static ANIM_KEYFRAME x4286[] = { - /* x4286[0] */ { 0.000000, 0.000000, 0.000000, -0.250000, }, - /* x4286[1] */ { 0.100000, 0.000000, 0.000000, -0.050000, }, - /* x4286[2] */ { 0.150000, 0.000000, 0.000000, 0.350000, }, - /* x4286[3] */ { 0.420000, 0.000000, 0.000000, 0.400000, }, - /* x4286[4] */ { 0.500000, 0.000000, 0.000000, 0.350000, }, - /* x4286[5] */ { 1.000000, 0.000000, 0.000000, -0.250000, }, -}; -static ANIMATION x75[] = { - /* x75[0] */ { "base", /* x75[0].body */ { 1,x3965, }, /* x75[0].back_foot */ { 1,x3972, }, /* x75[0].front_foot */ { 1,x3979, }, /* x75[0].attach */ { 0,x3986, }, }, - /* x75[1] */ { "idle", /* x75[1].body */ { 0,x4010, }, /* x75[1].back_foot */ { 1,x4017, }, /* x75[1].front_foot */ { 1,x4024, }, /* x75[1].attach */ { 0,x4031, }, }, - /* x75[2] */ { "inair", /* x75[2].body */ { 0,x4050, }, /* x75[2].back_foot */ { 1,x4057, }, /* x75[2].front_foot */ { 1,x4064, }, /* x75[2].attach */ { 0,x4071, }, }, - /* x75[3] */ { "walk", /* x75[3].body */ { 6,x4090, }, /* x75[3].back_foot */ { 6,x4097, }, /* x75[3].front_foot */ { 6,x4104, }, /* x75[3].attach */ { 0,x4111, }, }, - /* x75[4] */ { "hammer_swing", /* x75[4].body */ { 0,x4210, }, /* x75[4].back_foot */ { 0,x4217, }, /* x75[4].front_foot */ { 0,x4224, }, /* x75[4].attach */ { 5,x4231, }, }, - /* x75[5] */ { "ninja_swing", /* x75[5].body */ { 0,x4265, }, /* x75[5].back_foot */ { 0,x4272, }, /* x75[5].front_foot */ { 0,x4279, }, /* x75[5].attach */ { 6,x4286, }, }, -}; -static SPRITE* *x4443 = 0; -static SPRITE* x4580[] = { - &x44[28], - &x44[29], - &x44[30], -}; -static SPRITE* x4765[] = { - &x44[34], - &x44[35], - &x44[36], -}; -static SPRITE* *x4950 = 0; -static SPRITE* *x5087 = 0; -static SPRITE* x5224[] = { - &x44[51], - &x44[52], - &x44[53], -}; -static WEAPONSPEC x1884[] = { - /* x1884[0] */ { "hammer", &x44[40], &x44[41], &x44[42], 0,x4443, 96, 125, 10, 0, 3, 4.000000, -20.000000, 0.000000, 0.000000, 5.000000, }, - /* x1884[1] */ { "gun", &x44[25], &x44[26], &x44[27], 3,x4580, 64, 125, 10, 500, 1, 32.000000, -4.000000, 50.000000, 6.000000, 5.000000, }, - /* x1884[2] */ { "shotgun", &x44[31], &x44[32], &x44[33], 3,x4765, 96, 500, 10, 0, 1, 24.000000, -2.000000, 70.000000, 6.000000, 5.000000, }, - /* x1884[3] */ { "grenade", &x44[37], &x44[38], &x44[39], 0,x4950, 96, 500, 10, 0, 1, 24.000000, -2.000000, 0.000000, 0.000000, 5.000000, }, - /* x1884[4] */ { "rifle", &x44[46], &x44[47], &x44[48], 0,x5087, 92, 800, 10, 0, 5, 24.000000, -2.000000, 0.000000, 0.000000, 5.000000, }, - /* x1884[5] */ { "ninja", &x44[43], &x44[44], &x44[45], 3,x5224, 96, 800, 10, 0, 9, 0.000000, 0.000000, 40.000000, -4.000000, 5.000000, }, -}; -DATACONTAINER datacontainer = -/* datacontainer */ { - 39,x9, - 9,x14, - 4,x19, - 5,x28, - 91,x44, - 6,x75, - /* datacontainer.weapons */ { /* datacontainer.weapons.hammer */ { &x1884[0], }, /* datacontainer.weapons.gun */ { &x1884[1], }, /* datacontainer.weapons.shotgun */ { &x1884[2], 1.250000, 2200.000000, 0.800000, 0.250000, }, /* datacontainer.weapons.grenade */ { &x1884[3], 7.000000, 1000.000000, 2.000000, }, /* datacontainer.weapons.rifle */ { &x1884[4], 800.000000, 150, 1, 0.000000, }, /* datacontainer.weapons.ninja */ { &x1884[5], 15000, 200, 50, }, 6,x1884, }, -} -; -DATACONTAINER *data = &datacontainer; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.hpp b/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.hpp deleted file mode 100644 index 3faf49852..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/gc_data.hpp +++ /dev/null @@ -1,268 +0,0 @@ -#ifndef CLIENT_CONTENT_HEADER -#define CLIENT_CONTENT_HEADER -struct SOUND -{ - int id; - const char* filename; -}; -struct SOUNDSET -{ - const char* name; - int num_sounds; - SOUND *sounds; - int last; -}; -struct IMAGE -{ - const char* name; - const char* filename; - int id; -}; -struct SPRITESET -{ - IMAGE* image; - int gridx; - int gridy; -}; -struct SPRITE -{ - const char* name; - SPRITESET* set; - int x; - int y; - int w; - int h; -}; -struct PICKUPSPEC -{ - const char* name; - int respawntime; - int spawndelay; -}; -struct ANIM_KEYFRAME -{ - float time; - float x; - float y; - float angle; -}; -struct ANIM_SEQUENCE -{ - int num_frames; - ANIM_KEYFRAME *frames; -}; -struct ANIMATION -{ - const char* name; - ANIM_SEQUENCE body; - ANIM_SEQUENCE back_foot; - ANIM_SEQUENCE front_foot; - ANIM_SEQUENCE attach; -}; -struct WEAPONSPEC -{ - const char* name; - SPRITE* sprite_body; - SPRITE* sprite_cursor; - SPRITE* sprite_proj; - int num_sprite_muzzles; - SPRITE* *sprite_muzzles; - int visual_size; - int firedelay; - int maxammo; - int ammoregentime; - int damage; - float offsetx; - float offsety; - float muzzleoffsetx; - float muzzleoffsety; - float muzzleduration; -}; -struct WEAPONSPEC_HAMMER -{ - WEAPONSPEC* base; -}; -struct WEAPONSPEC_GUN -{ - WEAPONSPEC* base; - float curvature; - float speed; - float lifetime; -}; -struct WEAPONSPEC_SHOTGUN -{ - WEAPONSPEC* base; - float curvature; - float speed; - float speeddiff; - float lifetime; -}; -struct WEAPONSPEC_GRENADE -{ - WEAPONSPEC* base; - float curvature; - float speed; - float lifetime; -}; -struct WEAPONSPEC_RIFLE -{ - WEAPONSPEC* base; - float reach; - int bounce_delay; - int bounce_num; - float bounce_cost; -}; -struct WEAPONSPEC_NINJA -{ - WEAPONSPEC* base; - int duration; - int movetime; - int velocity; -}; -struct WEAPONSPECS -{ - WEAPONSPEC_HAMMER hammer; - WEAPONSPEC_HAMMER gun; - WEAPONSPEC_SHOTGUN shotgun; - WEAPONSPEC_GRENADE grenade; - WEAPONSPEC_RIFLE rifle; - WEAPONSPEC_NINJA ninja; - int num_id; - WEAPONSPEC *id; -}; -struct DATACONTAINER -{ - int num_sounds; - SOUNDSET *sounds; - int num_images; - IMAGE *images; - int num_pickups; - PICKUPSPEC *pickups; - int num_spritesets; - SPRITESET *spritesets; - int num_sprites; - SPRITE *sprites; - int num_animations; - ANIMATION *animations; - WEAPONSPECS weapons; -}; -extern DATACONTAINER *data; -enum -{ - IMAGE_NULL=0, - IMAGE_GAME, - IMAGE_PARTICLES, - IMAGE_CURSOR, - IMAGE_BANNER, - IMAGE_EMOTICONS, - IMAGE_BROWSEICONS, - IMAGE_CONSOLE_BG, - IMAGE_CONSOLE_BAR, - NUM_IMAGES -}; -enum -{ - ANIM_BASE=0, - ANIM_IDLE, - ANIM_INAIR, - ANIM_WALK, - ANIM_HAMMER_SWING, - ANIM_NINJA_SWING, - NUM_ANIMS -}; -enum -{ - SPRITE_PART_SLICE=0, - SPRITE_PART_BALL, - SPRITE_PART_SPLAT01, - SPRITE_PART_SPLAT02, - SPRITE_PART_SPLAT03, - SPRITE_PART_SMOKE, - SPRITE_PART_SHELL, - SPRITE_PART_EXPL01, - SPRITE_PART_AIRJUMP, - SPRITE_HEALTH_FULL, - SPRITE_HEALTH_EMPTY, - SPRITE_ARMOR_FULL, - SPRITE_ARMOR_EMPTY, - SPRITE_STAR1, - SPRITE_STAR2, - SPRITE_STAR3, - SPRITE_PART1, - SPRITE_PART2, - SPRITE_PART3, - SPRITE_PART4, - SPRITE_PART5, - SPRITE_PART6, - SPRITE_PART7, - SPRITE_PART8, - SPRITE_PART9, - SPRITE_WEAPON_GUN_BODY, - SPRITE_WEAPON_GUN_CURSOR, - SPRITE_WEAPON_GUN_PROJ, - SPRITE_WEAPON_GUN_MUZZLE1, - SPRITE_WEAPON_GUN_MUZZLE2, - SPRITE_WEAPON_GUN_MUZZLE3, - SPRITE_WEAPON_SHOTGUN_BODY, - SPRITE_WEAPON_SHOTGUN_CURSOR, - SPRITE_WEAPON_SHOTGUN_PROJ, - SPRITE_WEAPON_SHOTGUN_MUZZLE1, - SPRITE_WEAPON_SHOTGUN_MUZZLE2, - SPRITE_WEAPON_SHOTGUN_MUZZLE3, - SPRITE_WEAPON_GRENADE_BODY, - SPRITE_WEAPON_GRENADE_CURSOR, - SPRITE_WEAPON_GRENADE_PROJ, - SPRITE_WEAPON_HAMMER_BODY, - SPRITE_WEAPON_HAMMER_CURSOR, - SPRITE_WEAPON_HAMMER_PROJ, - SPRITE_WEAPON_NINJA_BODY, - SPRITE_WEAPON_NINJA_CURSOR, - SPRITE_WEAPON_NINJA_PROJ, - SPRITE_WEAPON_RIFLE_BODY, - SPRITE_WEAPON_RIFLE_CURSOR, - SPRITE_WEAPON_RIFLE_PROJ, - SPRITE_HOOK_CHAIN, - SPRITE_HOOK_HEAD, - SPRITE_WEAPON_NINJA_MUZZLE1, - SPRITE_WEAPON_NINJA_MUZZLE2, - SPRITE_WEAPON_NINJA_MUZZLE3, - SPRITE_PICKUP_HEALTH, - SPRITE_PICKUP_ARMOR, - SPRITE_PICKUP_WEAPON, - SPRITE_PICKUP_NINJA, - SPRITE_FLAG_BLUE, - SPRITE_FLAG_RED, - SPRITE_TEE_BODY, - SPRITE_TEE_BODY_OUTLINE, - SPRITE_TEE_FOOT, - SPRITE_TEE_FOOT_OUTLINE, - SPRITE_TEE_HAND, - SPRITE_TEE_HAND_OUTLINE, - SPRITE_TEE_EYE_NORMAL, - SPRITE_TEE_EYE_ANGRY, - SPRITE_TEE_EYE_PAIN, - SPRITE_TEE_EYE_HAPPY, - SPRITE_TEE_EYE_DEAD, - SPRITE_TEE_EYE_SURPRISE, - SPRITE_OOP, - SPRITE_EXCLAMATION, - SPRITE_HEARTS, - SPRITE_DROP, - SPRITE_DOTDOT, - SPRITE_MUSIC1, - SPRITE_MUSIC2, - SPRITE_GHOST, - SPRITE_SUSHI, - SPRITE_SPLATTEE, - SPRITE_DEVILTEE, - SPRITE_ZOMG, - SPRITE_ZZZ, - SPRITE_BLANK1, - SPRITE_DEADTEE, - SPRITE_BLANK2, - SPRITE_BROWSE_LOCK, - SPRITE_BROWSE_HEART, - SPRITE_BROWSE_UNPURE, - NUM_SPRITES -}; -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/gs_data.hpp b/project/jni/application/teeworlds-0.5.2/src/game/generated/gs_data.hpp deleted file mode 100644 index ecc150450..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/gs_data.hpp +++ /dev/null @@ -1,268 +0,0 @@ -#ifndef SERVER_CONTENT_HEADER -#define SERVER_CONTENT_HEADER -struct SOUND -{ - int id; - const char* filename; -}; -struct SOUNDSET -{ - const char* name; - int num_sounds; - SOUND *sounds; - int last; -}; -struct IMAGE -{ - const char* name; - const char* filename; - int id; -}; -struct SPRITESET -{ - IMAGE* image; - int gridx; - int gridy; -}; -struct SPRITE -{ - const char* name; - SPRITESET* set; - int x; - int y; - int w; - int h; -}; -struct PICKUPSPEC -{ - const char* name; - int respawntime; - int spawndelay; -}; -struct ANIM_KEYFRAME -{ - float time; - float x; - float y; - float angle; -}; -struct ANIM_SEQUENCE -{ - int num_frames; - ANIM_KEYFRAME *frames; -}; -struct ANIMATION -{ - const char* name; - ANIM_SEQUENCE body; - ANIM_SEQUENCE back_foot; - ANIM_SEQUENCE front_foot; - ANIM_SEQUENCE attach; -}; -struct WEAPONSPEC -{ - const char* name; - SPRITE* sprite_body; - SPRITE* sprite_cursor; - SPRITE* sprite_proj; - int num_sprite_muzzles; - SPRITE* *sprite_muzzles; - int visual_size; - int firedelay; - int maxammo; - int ammoregentime; - int damage; - float offsetx; - float offsety; - float muzzleoffsetx; - float muzzleoffsety; - float muzzleduration; -}; -struct WEAPONSPEC_HAMMER -{ - WEAPONSPEC* base; -}; -struct WEAPONSPEC_GUN -{ - WEAPONSPEC* base; - float curvature; - float speed; - float lifetime; -}; -struct WEAPONSPEC_SHOTGUN -{ - WEAPONSPEC* base; - float curvature; - float speed; - float speeddiff; - float lifetime; -}; -struct WEAPONSPEC_GRENADE -{ - WEAPONSPEC* base; - float curvature; - float speed; - float lifetime; -}; -struct WEAPONSPEC_RIFLE -{ - WEAPONSPEC* base; - float reach; - int bounce_delay; - int bounce_num; - float bounce_cost; -}; -struct WEAPONSPEC_NINJA -{ - WEAPONSPEC* base; - int duration; - int movetime; - int velocity; -}; -struct WEAPONSPECS -{ - WEAPONSPEC_HAMMER hammer; - WEAPONSPEC_HAMMER gun; - WEAPONSPEC_SHOTGUN shotgun; - WEAPONSPEC_GRENADE grenade; - WEAPONSPEC_RIFLE rifle; - WEAPONSPEC_NINJA ninja; - int num_id; - WEAPONSPEC *id; -}; -struct DATACONTAINER -{ - int num_sounds; - SOUNDSET *sounds; - int num_images; - IMAGE *images; - int num_pickups; - PICKUPSPEC *pickups; - int num_spritesets; - SPRITESET *spritesets; - int num_sprites; - SPRITE *sprites; - int num_animations; - ANIMATION *animations; - WEAPONSPECS weapons; -}; -extern DATACONTAINER *data; -enum -{ - IMAGE_NULL=0, - IMAGE_GAME, - IMAGE_PARTICLES, - IMAGE_CURSOR, - IMAGE_BANNER, - IMAGE_EMOTICONS, - IMAGE_BROWSEICONS, - IMAGE_CONSOLE_BG, - IMAGE_CONSOLE_BAR, - NUM_IMAGES -}; -enum -{ - ANIM_BASE=0, - ANIM_IDLE, - ANIM_INAIR, - ANIM_WALK, - ANIM_HAMMER_SWING, - ANIM_NINJA_SWING, - NUM_ANIMS -}; -enum -{ - SPRITE_PART_SLICE=0, - SPRITE_PART_BALL, - SPRITE_PART_SPLAT01, - SPRITE_PART_SPLAT02, - SPRITE_PART_SPLAT03, - SPRITE_PART_SMOKE, - SPRITE_PART_SHELL, - SPRITE_PART_EXPL01, - SPRITE_PART_AIRJUMP, - SPRITE_HEALTH_FULL, - SPRITE_HEALTH_EMPTY, - SPRITE_ARMOR_FULL, - SPRITE_ARMOR_EMPTY, - SPRITE_STAR1, - SPRITE_STAR2, - SPRITE_STAR3, - SPRITE_PART1, - SPRITE_PART2, - SPRITE_PART3, - SPRITE_PART4, - SPRITE_PART5, - SPRITE_PART6, - SPRITE_PART7, - SPRITE_PART8, - SPRITE_PART9, - SPRITE_WEAPON_GUN_BODY, - SPRITE_WEAPON_GUN_CURSOR, - SPRITE_WEAPON_GUN_PROJ, - SPRITE_WEAPON_GUN_MUZZLE1, - SPRITE_WEAPON_GUN_MUZZLE2, - SPRITE_WEAPON_GUN_MUZZLE3, - SPRITE_WEAPON_SHOTGUN_BODY, - SPRITE_WEAPON_SHOTGUN_CURSOR, - SPRITE_WEAPON_SHOTGUN_PROJ, - SPRITE_WEAPON_SHOTGUN_MUZZLE1, - SPRITE_WEAPON_SHOTGUN_MUZZLE2, - SPRITE_WEAPON_SHOTGUN_MUZZLE3, - SPRITE_WEAPON_GRENADE_BODY, - SPRITE_WEAPON_GRENADE_CURSOR, - SPRITE_WEAPON_GRENADE_PROJ, - SPRITE_WEAPON_HAMMER_BODY, - SPRITE_WEAPON_HAMMER_CURSOR, - SPRITE_WEAPON_HAMMER_PROJ, - SPRITE_WEAPON_NINJA_BODY, - SPRITE_WEAPON_NINJA_CURSOR, - SPRITE_WEAPON_NINJA_PROJ, - SPRITE_WEAPON_RIFLE_BODY, - SPRITE_WEAPON_RIFLE_CURSOR, - SPRITE_WEAPON_RIFLE_PROJ, - SPRITE_HOOK_CHAIN, - SPRITE_HOOK_HEAD, - SPRITE_WEAPON_NINJA_MUZZLE1, - SPRITE_WEAPON_NINJA_MUZZLE2, - SPRITE_WEAPON_NINJA_MUZZLE3, - SPRITE_PICKUP_HEALTH, - SPRITE_PICKUP_ARMOR, - SPRITE_PICKUP_WEAPON, - SPRITE_PICKUP_NINJA, - SPRITE_FLAG_BLUE, - SPRITE_FLAG_RED, - SPRITE_TEE_BODY, - SPRITE_TEE_BODY_OUTLINE, - SPRITE_TEE_FOOT, - SPRITE_TEE_FOOT_OUTLINE, - SPRITE_TEE_HAND, - SPRITE_TEE_HAND_OUTLINE, - SPRITE_TEE_EYE_NORMAL, - SPRITE_TEE_EYE_ANGRY, - SPRITE_TEE_EYE_PAIN, - SPRITE_TEE_EYE_HAPPY, - SPRITE_TEE_EYE_DEAD, - SPRITE_TEE_EYE_SURPRISE, - SPRITE_OOP, - SPRITE_EXCLAMATION, - SPRITE_HEARTS, - SPRITE_DROP, - SPRITE_DOTDOT, - SPRITE_MUSIC1, - SPRITE_MUSIC2, - SPRITE_GHOST, - SPRITE_SUSHI, - SPRITE_SPLATTEE, - SPRITE_DEVILTEE, - SPRITE_ZOMG, - SPRITE_ZZZ, - SPRITE_BLANK1, - SPRITE_DEADTEE, - SPRITE_BLANK2, - SPRITE_BROWSE_LOCK, - SPRITE_BROWSE_HEART, - SPRITE_BROWSE_UNPURE, - NUM_SPRITES -}; -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/generated/nethash.c b/project/jni/application/teeworlds-0.5.2/src/game/generated/nethash.c deleted file mode 100644 index e1e0a9beb..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/generated/nethash.c +++ /dev/null @@ -1 +0,0 @@ -#define GAME_NETVERSION_HASH "b67d1f1a1eea234e" diff --git a/project/jni/application/teeworlds-0.5.2/src/game/layers.cpp b/project/jni/application/teeworlds-0.5.2/src/game/layers.cpp deleted file mode 100644 index 832dc766d..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/layers.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include "layers.hpp" - -static MAPITEM_LAYER_TILEMAP *game_layer = 0; -static MAPITEM_GROUP *game_group = 0; - -static int groups_start = 0; -static int groups_num = 0; -static int layers_start = 0; -static int layers_num = 0; - -void layers_init() -{ - map_get_type(MAPITEMTYPE_GROUP, &groups_start, &groups_num); - map_get_type(MAPITEMTYPE_LAYER, &layers_start, &layers_num); - - for(int g = 0; g < layers_num_groups(); g++) - { - MAPITEM_GROUP *group = layers_get_group(g); - for(int l = 0; l < group->num_layers; l++) - { - MAPITEM_LAYER *layer = layers_get_layer(group->start_layer+l); - - if(layer->type == LAYERTYPE_TILES) - { - MAPITEM_LAYER_TILEMAP *tilemap = (MAPITEM_LAYER_TILEMAP *)layer; - if(tilemap->flags&1) - { - game_layer = tilemap; - game_group = group; - } - } - } - } -} - -int layers_num_groups() { return groups_num; } -MAPITEM_GROUP *layers_get_group(int index) -{ - return (MAPITEM_GROUP *)map_get_item(groups_start+index, 0, 0); -} - -MAPITEM_LAYER *layers_get_layer(int index) -{ - return (MAPITEM_LAYER *)map_get_item(layers_start+index, 0, 0); -} - -MAPITEM_LAYER_TILEMAP *layers_game_layer() -{ - return game_layer; -} - -MAPITEM_GROUP *layers_game_group() -{ - return game_group; -} - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/layers.hpp b/project/jni/application/teeworlds-0.5.2/src/game/layers.hpp deleted file mode 100644 index cb18419be..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/layers.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "mapitems.hpp" - -void layers_init(); - -MAPITEM_LAYER_TILEMAP *layers_game_layer(); -MAPITEM_GROUP *layers_game_group(); - -int layers_num_groups(); -MAPITEM_GROUP *layers_get_group(int index); -MAPITEM_LAYER *layers_get_layer(int index); - - diff --git a/project/jni/application/teeworlds-0.5.2/src/game/mapitems.hpp b/project/jni/application/teeworlds-0.5.2/src/game/mapitems.hpp deleted file mode 100644 index 9c9936d27..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/mapitems.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#ifndef GAME_MAPITEMS_H -#define GAME_MAPITEMS_H - -// layer types -enum -{ - LAYERTYPE_INVALID=0, - LAYERTYPE_GAME, // not used - LAYERTYPE_TILES, - LAYERTYPE_QUADS, - - MAPITEMTYPE_VERSION=0, - MAPITEMTYPE_INFO, - MAPITEMTYPE_IMAGE, - MAPITEMTYPE_ENVELOPE, - MAPITEMTYPE_GROUP, - MAPITEMTYPE_LAYER, - MAPITEMTYPE_ENVPOINTS, - - - CURVETYPE_STEP=0, - CURVETYPE_LINEAR, - CURVETYPE_SLOW, - CURVETYPE_FAST, - CURVETYPE_SMOOTH, - NUM_CURVETYPES, - - // game layer tiles - ENTITY_NULL=0, - ENTITY_SPAWN, - ENTITY_SPAWN_RED, - ENTITY_SPAWN_BLUE, - ENTITY_FLAGSTAND_RED, - ENTITY_FLAGSTAND_BLUE, - ENTITY_ARMOR_1, - ENTITY_HEALTH_1, - ENTITY_WEAPON_SHOTGUN, - ENTITY_WEAPON_GRENADE, - ENTITY_POWERUP_NINJA, - ENTITY_WEAPON_RIFLE, - NUM_ENTITIES, - - TILE_AIR=0, - TILE_SOLID, - TILE_DEATH, - TILE_NOHOOK, - - TILEFLAG_VFLIP=1, - TILEFLAG_HFLIP=2, - TILEFLAG_OPAQUE=4, - - LAYERFLAG_DETAIL=1, - - ENTITY_OFFSET=255-16*4, -}; - -typedef struct -{ - int x, y; // 22.10 fixed point -} POINT; - -typedef struct -{ - int r, g, b, a; -} COLOR; - -typedef struct -{ - POINT points[5]; - COLOR colors[4]; - POINT texcoords[4]; - - int pos_env; - int pos_env_offset; - - int color_env; - int color_env_offset; -} QUAD; - -typedef struct -{ - unsigned char index; - unsigned char flags; - unsigned char skip; - unsigned char reserved; -} TILE; - -typedef struct -{ - int version; - int width; - int height; - int external; - int image_name; - int image_data; -} MAPITEM_IMAGE; - -struct MAPITEM_GROUP_v1 -{ - int version; - int offset_x; - int offset_y; - int parallax_x; - int parallax_y; - - int start_layer; - int num_layers; -} ; - - -struct MAPITEM_GROUP : public MAPITEM_GROUP_v1 -{ - enum { CURRENT_VERSION=2 }; - - int use_clipping; - int clip_x; - int clip_y; - int clip_w; - int clip_h; -} ; - -typedef struct -{ - int version; - int type; - int flags; -} MAPITEM_LAYER; - -typedef struct -{ - MAPITEM_LAYER layer; - int version; - - int width; - int height; - int flags; - - COLOR color; - int color_env; - int color_env_offset; - - int image; - int data; -} MAPITEM_LAYER_TILEMAP; - -typedef struct -{ - MAPITEM_LAYER layer; - int version; - - int num_quads; - int data; - int image; -} MAPITEM_LAYER_QUADS; - -typedef struct -{ - int version; -} MAPITEM_VERSION; - -typedef struct -{ - int time; // in ms - int curvetype; - int values[4]; // 1-4 depending on envelope (22.10 fixed point) -} ENVPOINT; - -typedef struct -{ - int version; - int channels; - int start_point; - int num_points; - int name; -} MAPITEM_ENVELOPE; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.cpp deleted file mode 100644 index 3bbe86709..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.cpp +++ /dev/null @@ -1,838 +0,0 @@ -#include -#include -#include -#include -#include - -#include "character.hpp" -#include "laser.hpp" -#include "projectile.hpp" - -struct INPUT_COUNT -{ - int presses; - int releases; -}; - -static INPUT_COUNT count_input(int prev, int cur) -{ - INPUT_COUNT c = {0,0}; - prev &= INPUT_STATE_MASK; - cur &= INPUT_STATE_MASK; - int i = prev; - while(i != cur) - { - i = (i+1)&INPUT_STATE_MASK; - if(i&1) - c.presses++; - else - c.releases++; - } - - return c; -} - - -MACRO_ALLOC_POOL_ID_IMPL(CHARACTER, MAX_CLIENTS) - -// player -CHARACTER::CHARACTER() -: ENTITY(NETOBJTYPE_CHARACTER) -{ - proximity_radius = phys_size; -} - -void CHARACTER::reset() -{ - destroy(); -} - -bool CHARACTER::spawn(PLAYER *player, vec2 pos, int team) -{ - player_state = PLAYERSTATE_UNKNOWN; - emote_stop = -1; - last_action = -1; - active_weapon = WEAPON_GUN; - last_weapon = WEAPON_HAMMER; - queued_weapon = -1; - - //clear(); - this->player = player; - this->pos = pos; - this->team = team; - - core.reset(); - core.world = &game.world.core; - core.pos = pos; - game.world.core.characters[player->client_id] = &core; - - reckoning_tick = 0; - mem_zero(&sendcore, sizeof(sendcore)); - mem_zero(&reckoningcore, sizeof(reckoningcore)); - - game.world.insert_entity(this); - alive = true; - player->force_balanced = false; - - game.controller->on_character_spawn(this); - - return true; -} - -void CHARACTER::destroy() -{ - game.world.core.characters[player->client_id] = 0; - alive = false; -} - -void CHARACTER::set_weapon(int w) -{ - if(w == active_weapon) - return; - - last_weapon = active_weapon; - queued_weapon = -1; - active_weapon = w; - if(active_weapon < 0 || active_weapon >= NUM_WEAPONS) - active_weapon = 0; - - game.create_sound(pos, SOUND_WEAPON_SWITCH); -} - -bool CHARACTER::is_grounded() -{ - if(col_check_point((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2+5))) - return true; - if(col_check_point((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2+5))) - return true; - return false; -} - - -int CHARACTER::handle_ninja() -{ - if(active_weapon != WEAPON_NINJA) - return 0; - - vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y)); - - if ((server_tick() - ninja.activationtick) > (data->weapons.ninja.duration * server_tickspeed() / 1000)) - { - // time's up, return - weapons[WEAPON_NINJA].got = false; - active_weapon = last_weapon; - if(active_weapon == WEAPON_NINJA) - active_weapon = WEAPON_GUN; - set_weapon(active_weapon); - return 0; - } - - // force ninja weapon - set_weapon(WEAPON_NINJA); - - ninja.currentmovetime--; - - if (ninja.currentmovetime == 0) - { - // reset player velocity - core.vel *= 0.2f; - //return MODIFIER_RETURNFLAGS_OVERRIDEWEAPON; - } - - if (ninja.currentmovetime > 0) - { - // Set player velocity - core.vel = ninja.activationdir * data->weapons.ninja.velocity; - vec2 oldpos = pos; - move_box(&core.pos, &core.vel, vec2(phys_size, phys_size), 0.0f); - // reset velocity so the client doesn't predict stuff - core.vel = vec2(0.0f,0.0f); - if ((ninja.currentmovetime % 2) == 0) - { - //create_smoke(pos); - } - - // check if we hit anything along the way - { - CHARACTER *ents[64]; - vec2 dir = pos - oldpos; - float radius = phys_size * 2.0f; //length(dir * 0.5f); - vec2 center = oldpos + dir * 0.5f; - int num = game.world.find_entities(center, radius, (ENTITY**)ents, 64, NETOBJTYPE_CHARACTER); - - for (int i = 0; i < num; i++) - { - // Check if entity is a player - if (ents[i] == this) - continue; - // make sure we haven't hit this object before - bool balreadyhit = false; - for (int j = 0; j < numobjectshit; j++) - { - if (hitobjects[j] == ents[i]) - balreadyhit = true; - } - if (balreadyhit) - continue; - - // check so we are sufficiently close - if (distance(ents[i]->pos, pos) > (phys_size * 2.0f)) - continue; - - // hit a player, give him damage and stuffs... - game.create_sound(ents[i]->pos, SOUND_NINJA_HIT); - // set his velocity to fast upward (for now) - if(numobjectshit < 10) - hitobjects[numobjectshit++] = ents[i]; - - ents[i]->take_damage(vec2(0,10.0f), data->weapons.ninja.base->damage, player->client_id,WEAPON_NINJA); - } - } - return 0; - } - - return 0; -} - - -void CHARACTER::do_weaponswitch() -{ - if(reload_timer != 0) // make sure we have reloaded - return; - - if(queued_weapon == -1) // check for a queued weapon - return; - - if(weapons[WEAPON_NINJA].got) // if we have ninja, no weapon selection is possible - return; - - // switch weapon - set_weapon(queued_weapon); -} - -void CHARACTER::handle_weaponswitch() -{ - int wanted_weapon = active_weapon; - if(queued_weapon != -1) - wanted_weapon = queued_weapon; - - // select weapon - int next = count_input(latest_previnput.next_weapon, latest_input.next_weapon).presses; - int prev = count_input(latest_previnput.prev_weapon, latest_input.prev_weapon).presses; - - if(next < 128) // make sure we only try sane stuff - { - while(next) // next weapon selection - { - wanted_weapon = (wanted_weapon+1)%NUM_WEAPONS; - if(weapons[wanted_weapon].got) - next--; - } - } - - if(prev < 128) // make sure we only try sane stuff - { - while(prev) // prev weapon selection - { - wanted_weapon = (wanted_weapon-1)<0?NUM_WEAPONS-1:wanted_weapon-1; - if(weapons[wanted_weapon].got) - prev--; - } - } - - // direct weapon selection - if(latest_input.wanted_weapon) - wanted_weapon = input.wanted_weapon-1; - - // check for insane values - if(wanted_weapon >= 0 && wanted_weapon < NUM_WEAPONS && wanted_weapon != active_weapon && weapons[wanted_weapon].got) - queued_weapon = wanted_weapon; - - do_weaponswitch(); -} - -void CHARACTER::fire_weapon() -{ - if(reload_timer != 0) - return; - - do_weaponswitch(); - - vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y)); - - bool fullauto = false; - if(active_weapon == WEAPON_GRENADE || active_weapon == WEAPON_SHOTGUN || active_weapon == WEAPON_RIFLE) - fullauto = true; - - - // check if we gonna fire - bool will_fire = false; - if(count_input(latest_previnput.fire, latest_input.fire).presses) will_fire = true; - if(fullauto && (latest_input.fire&1) && weapons[active_weapon].ammo) will_fire = true; - if(!will_fire) - return; - - // check for ammo - if(!weapons[active_weapon].ammo) - { - // 125ms is a magical limit of how fast a human can click - reload_timer = 125 * server_tickspeed() / 1000;; - game.create_sound(pos, SOUND_WEAPON_NOAMMO); - return; - } - - vec2 projectile_startpos = pos+direction*phys_size*0.75f; - - switch(active_weapon) - { - case WEAPON_HAMMER: - { - // reset objects hit - numobjectshit = 0; - game.create_sound(pos, SOUND_HAMMER_FIRE); - - CHARACTER *ents[64]; - int hits = 0; - int num = game.world.find_entities(pos+direction*phys_size*0.75f, phys_size*0.5f, (ENTITY**)ents, 64, NETOBJTYPE_CHARACTER); - - for (int i = 0; i < num; i++) - { - CHARACTER *target = ents[i]; - if (target == this) - continue; - - // hit a player, give him damage and stuffs... - vec2 fdir = normalize(ents[i]->pos - pos); - - // set his velocity to fast upward (for now) - game.create_hammerhit(pos); - ents[i]->take_damage(vec2(0,-1.0f), data->weapons.hammer.base->damage, player->client_id, active_weapon); - vec2 dir; - if (length(target->pos - pos) > 0.0f) - dir = normalize(target->pos - pos); - else - dir = vec2(0,-1); - - target->core.vel += normalize(dir + vec2(0,-1.1f)) * 10.0f; - hits++; - } - - // if we hit anything, we have to wait for the reload - if(hits) - reload_timer = server_tickspeed()/3; - - } break; - - case WEAPON_GUN: - { - PROJECTILE *proj = new PROJECTILE(WEAPON_GUN, - player->client_id, - projectile_startpos, - direction, - (int)(server_tickspeed()*tuning.gun_lifetime), - 1, 0, 0, -1, WEAPON_GUN); - - // pack the projectile and send it to the client directly - NETOBJ_PROJECTILE p; - proj->fill_info(&p); - - msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0); - msg_pack_int(1); - for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++) - msg_pack_int(((int *)&p)[i]); - msg_pack_end(); - server_send_msg(player->client_id); - - game.create_sound(pos, SOUND_GUN_FIRE); - } break; - - case WEAPON_SHOTGUN: - { - int shotspread = 2; - - msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0); - msg_pack_int(shotspread*2+1); - - for(int i = -shotspread; i <= shotspread; i++) - { - float spreading[] = {-0.185f, -0.070f, 0, 0.070f, 0.185f}; - float a = get_angle(direction); - a += spreading[i+2]; - float v = 1-(abs(i)/(float)shotspread); - float speed = mix((float)tuning.shotgun_speeddiff, 1.0f, v); - PROJECTILE *proj = new PROJECTILE(WEAPON_SHOTGUN, - player->client_id, - projectile_startpos, - vec2(cosf(a), sinf(a))*speed, - (int)(server_tickspeed()*tuning.shotgun_lifetime), - 1, 0, 0, -1, WEAPON_SHOTGUN); - - // pack the projectile and send it to the client directly - NETOBJ_PROJECTILE p; - proj->fill_info(&p); - - for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++) - msg_pack_int(((int *)&p)[i]); - } - - msg_pack_end(); - server_send_msg(player->client_id); - - game.create_sound(pos, SOUND_SHOTGUN_FIRE); - } break; - - case WEAPON_GRENADE: - { - PROJECTILE *proj = new PROJECTILE(WEAPON_GRENADE, - player->client_id, - projectile_startpos, - direction, - (int)(server_tickspeed()*tuning.grenade_lifetime), - 1, PROJECTILE::PROJECTILE_FLAGS_EXPLODE, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE); - - // pack the projectile and send it to the client directly - NETOBJ_PROJECTILE p; - proj->fill_info(&p); - - msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0); - msg_pack_int(1); - for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++) - msg_pack_int(((int *)&p)[i]); - msg_pack_end(); - server_send_msg(player->client_id); - - game.create_sound(pos, SOUND_GRENADE_FIRE); - } break; - - case WEAPON_RIFLE: - { - new LASER(pos, direction, tuning.laser_reach, player->client_id); - game.create_sound(pos, SOUND_RIFLE_FIRE); - } break; - - case WEAPON_NINJA: - { - attack_tick = server_tick(); - ninja.activationdir = direction; - ninja.currentmovetime = data->weapons.ninja.movetime * server_tickspeed() / 1000; - - //reload_timer = data->weapons.ninja.base->firedelay * server_tickspeed() / 1000 + server_tick(); - - // reset hit objects - numobjectshit = 0; - - game.create_sound(pos, SOUND_NINJA_FIRE); - - } break; - - } - - if(weapons[active_weapon].ammo > 0) // -1 == unlimited - weapons[active_weapon].ammo--; - attack_tick = server_tick(); - if(!reload_timer) - reload_timer = data->weapons.id[active_weapon].firedelay * server_tickspeed() / 1000; -} - -int CHARACTER::handle_weapons() -{ - vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y)); - - /* - if(config.dbg_stress) - { - for(int i = 0; i < NUM_WEAPONS; i++) - { - weapons[i].got = true; - weapons[i].ammo = 10; - } - - if(reload_timer) // twice as fast reload - reload_timer--; - } */ - - //if(active_weapon == WEAPON_NINJA) - handle_ninja(); - - - // check reload timer - if(reload_timer) - { - reload_timer--; - return 0; - } - - /* - if (active_weapon == WEAPON_NINJA) - { - // don't update other weapons while ninja is active - return handle_ninja(); - }*/ - - // fire weapon, if wanted - fire_weapon(); - - // ammo regen - int ammoregentime = data->weapons.id[active_weapon].ammoregentime; - if(ammoregentime) - { - // If equipped and not active, regen ammo? - if (reload_timer <= 0) - { - if (weapons[active_weapon].ammoregenstart < 0) - weapons[active_weapon].ammoregenstart = server_tick(); - - if ((server_tick() - weapons[active_weapon].ammoregenstart) >= ammoregentime * server_tickspeed() / 1000) - { - // Add some ammo - weapons[active_weapon].ammo = min(weapons[active_weapon].ammo + 1, 10); - weapons[active_weapon].ammoregenstart = -1; - } - } - else - { - weapons[active_weapon].ammoregenstart = -1; - } - } - - return 0; -} - -void CHARACTER::on_predicted_input(NETOBJ_PLAYER_INPUT *new_input) -{ - // check for changes - if(mem_comp(&input, new_input, sizeof(NETOBJ_PLAYER_INPUT)) != 0) - last_action = server_tick(); - - // copy new input - mem_copy(&input, new_input, sizeof(input)); - num_inputs++; - - // or are not allowed to aim in the center - if(input.target_x == 0 && input.target_y == 0) - input.target_y = -1; -} - -void CHARACTER::on_direct_input(NETOBJ_PLAYER_INPUT *new_input) -{ - mem_copy(&latest_previnput, &latest_input, sizeof(latest_input)); - mem_copy(&latest_input, new_input, sizeof(latest_input)); - - if(num_inputs > 2 && team != -1) - { - handle_weaponswitch(); - fire_weapon(); - } - - mem_copy(&latest_previnput, &latest_input, sizeof(latest_input)); -} - -void CHARACTER::tick() -{ - if(player->force_balanced) - { - char buf[128]; - str_format(buf, sizeof(buf), "You were moved to %s due to team balancing", game.controller->get_team_name(team)); - game.send_broadcast(buf, player->client_id); - - player->force_balanced = false; - } - - //player_core core; - //core.pos = pos; - //core.jumped = jumped; - core.input = input; - core.tick(true); - - float phys_size = 28.0f; - // handle death-tiles - if(col_get((int)(pos.x+phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH) - { - die(player->client_id, WEAPON_WORLD); - } - - // handle weapons - handle_weapons(); - - player_state = input.player_state; - - // Previnput - previnput = input; - return; -} - -void CHARACTER::tick_defered() -{ - // advance the dummy - { - WORLD_CORE tempworld; - reckoningcore.world = &tempworld; - reckoningcore.tick(false); - reckoningcore.move(); - reckoningcore.quantize(); - } - - //lastsentcore; - /*if(!dead) - {*/ - vec2 start_pos = core.pos; - vec2 start_vel = core.vel; - bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f)); - - core.move(); - bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f)); - core.quantize(); - bool stuck_after_quant = test_box(core.pos, vec2(28.0f, 28.0f)); - pos = core.pos; - - if(!stuck_before && (stuck_after_move || stuck_after_quant)) - { - dbg_msg("player", "STUCK!!! %d %d %d %f %f %f %f %x %x %x %x", - stuck_before, - stuck_after_move, - stuck_after_quant, - start_pos.x, start_pos.y, - start_vel.x, start_vel.y, - *((unsigned *)&start_pos.x), *((unsigned *)&start_pos.y), - *((unsigned *)&start_vel.x), *((unsigned *)&start_vel.y)); - } - - int events = core.triggered_events; - int mask = cmask_all_except_one(player->client_id); - - if(events&COREEVENT_GROUND_JUMP) game.create_sound(pos, SOUND_PLAYER_JUMP, mask); - - //if(events&COREEVENT_HOOK_LAUNCH) snd_play_random(CHN_WORLD, SOUND_HOOK_LOOP, 1.0f, pos); - if(events&COREEVENT_HOOK_ATTACH_PLAYER) game.create_sound(pos, SOUND_HOOK_ATTACH_PLAYER, cmask_all()); - if(events&COREEVENT_HOOK_ATTACH_GROUND) game.create_sound(pos, SOUND_HOOK_ATTACH_GROUND, mask); - if(events&COREEVENT_HOOK_HIT_NOHOOK) game.create_sound(pos, SOUND_HOOK_NOATTACH, mask); - //if(events&COREEVENT_HOOK_RETRACT) snd_play_random(CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, pos); - //} - - if(team == -1) - { - pos.x = input.target_x; - pos.y = input.target_y; - } - - // update the sendcore if needed - { - NETOBJ_CHARACTER predicted; - NETOBJ_CHARACTER current; - mem_zero(&predicted, sizeof(predicted)); - mem_zero(¤t, sizeof(current)); - reckoningcore.write(&predicted); - core.write(¤t); - - // only allow dead reackoning for a top of 3 seconds - if(reckoning_tick+server_tickspeed()*3 < server_tick() || mem_comp(&predicted, ¤t, sizeof(NETOBJ_CHARACTER)) != 0) - { - reckoning_tick = server_tick(); - sendcore = core; - reckoningcore = core; - } - } -} - -bool CHARACTER::increase_health(int amount) -{ - if(health >= 10) - return false; - health = clamp(health+amount, 0, 10); - return true; -} - -bool CHARACTER::increase_armor(int amount) -{ - if(armor >= 10) - return false; - armor = clamp(armor+amount, 0, 10); - return true; -} - -void CHARACTER::die(int killer, int weapon) -{ - /*if (dead || team == -1) - return;*/ - int mode_special = game.controller->on_character_death(this, game.players[killer], weapon); - - dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d", - killer, server_clientname(killer), - player->client_id, server_clientname(player->client_id), weapon, mode_special); - - // send the kill message - NETMSG_SV_KILLMSG msg; - msg.killer = killer; - msg.victim = player->client_id; - msg.weapon = weapon; - msg.mode_special = mode_special; - msg.pack(MSGFLAG_VITAL); - server_send_msg(-1); - - // a nice sound - game.create_sound(pos, SOUND_PLAYER_DIE); - - // set dead state - // TODO: do stuff here - /* - die_pos = pos; - dead = true; - */ - - // this is for auto respawn after 3 secs - player->die_tick = server_tick(); - - alive = false; - game.world.remove_entity(this); - game.world.core.characters[player->client_id] = 0; - game.create_death(pos, player->client_id); - - // we got to wait 0.5 secs before respawning - player->respawn_tick = server_tick()+server_tickspeed()/2; -} - -bool CHARACTER::take_damage(vec2 force, int dmg, int from, int weapon) -{ - core.vel += force; - - if(game.controller->is_friendly_fire(player->client_id, from) && !config.sv_teamdamage) - return false; - - // player only inflicts half damage on self - if(from == player->client_id) - dmg = max(1, dmg/2); - - damage_taken++; - - // create healthmod indicator - if(server_tick() < damage_taken_tick+25) - { - // make sure that the damage indicators doesn't group together - game.create_damageind(pos, damage_taken*0.25f, dmg); - } - else - { - damage_taken = 0; - game.create_damageind(pos, 0, dmg); - } - - if(dmg) - { - if(armor) - { - if(dmg > 1) - { - health--; - dmg--; - } - - if(dmg > armor) - { - dmg -= armor; - armor = 0; - } - else - { - armor -= dmg; - dmg = 0; - } - } - - health -= dmg; - } - - damage_taken_tick = server_tick(); - - // do damage hit sound - if(from >= 0 && from != player->client_id && game.players[from]) - game.create_sound(game.players[from]->view_pos, SOUND_HIT, cmask_one(from)); - - // check for death - if(health <= 0) - { - die(from, weapon); - - // set attacker's face to happy (taunt!) - if (from >= 0 && from != player->client_id && game.players[from]) - { - CHARACTER *chr = game.players[from]->get_character(); - if (chr) - { - chr->emote_type = EMOTE_HAPPY; - chr->emote_stop = server_tick() + server_tickspeed(); - } - } - - return false; - } - - if (dmg > 2) - game.create_sound(pos, SOUND_PLAYER_PAIN_LONG); - else - game.create_sound(pos, SOUND_PLAYER_PAIN_SHORT); - - emote_type = EMOTE_PAIN; - emote_stop = server_tick() + 500 * server_tickspeed() / 1000; - - // spawn blood? - return true; -} - -void CHARACTER::snap(int snapping_client) -{ - if(networkclipped(snapping_client)) - return; - - NETOBJ_CHARACTER *character = (NETOBJ_CHARACTER *)snap_new_item(NETOBJTYPE_CHARACTER, player->client_id, sizeof(NETOBJ_CHARACTER)); - - // write down the core - if(game.world.paused) - { - // no dead reckoning when paused because the client doesn't know - // how far to perform the reckoning - character->tick = 0; - core.write(character); - } - else - { - character->tick = reckoning_tick; - sendcore.write(character); - } - - // set emote - if (emote_stop < server_tick()) - { - emote_type = EMOTE_NORMAL; - emote_stop = -1; - } - - character->emote = emote_type; - - character->ammocount = 0; - character->health = 0; - character->armor = 0; - - character->weapon = active_weapon; - character->attacktick = attack_tick; - - character->direction = input.direction; - - if(player->client_id == snapping_client) - { - character->health = health; - character->armor = armor; - if(weapons[active_weapon].ammo > 0) - character->ammocount = weapons[active_weapon].ammo; - } - - if (character->emote == EMOTE_NORMAL) - { - if(250 - ((server_tick() - last_action)%(250)) < 5) - character->emote = EMOTE_BLINK; - } - - character->player_state = player_state; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.hpp deleted file mode 100644 index bd2f7afe8..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/character.hpp +++ /dev/null @@ -1,134 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifndef GAME_SERVER_ENTITY_CHARACTER_H -#define GAME_SERVER_ENTITY_CHARACTER_H - -#include -#include -#include - -#include - -enum -{ - WEAPON_GAME = -3, // team switching etc - WEAPON_SELF = -2, // console kill command - WEAPON_WORLD = -1, // death tiles etc -}; - -class CHARACTER : public ENTITY -{ - MACRO_ALLOC_POOL_ID() -public: - // player controlling this character - class PLAYER *player; - - bool alive; - - // weapon info - ENTITY *hitobjects[10]; - int numobjectshit; - struct WEAPONSTAT - { - int ammoregenstart; - int ammo; - int ammocost; - bool got; - } weapons[NUM_WEAPONS]; - - int active_weapon; - int last_weapon; - int queued_weapon; - - int reload_timer; - int attack_tick; - - int damage_taken; - - int emote_type; - int emote_stop; - - // TODO: clean this up - char skin_name[64]; - int use_custom_color; - int color_body; - int color_feet; - - int last_action; // last tick that the player took any action ie some input - - // these are non-heldback inputs - NETOBJ_PLAYER_INPUT latest_previnput; - NETOBJ_PLAYER_INPUT latest_input; - - // input - NETOBJ_PLAYER_INPUT previnput; - NETOBJ_PLAYER_INPUT input; - int num_inputs; - int jumped; - - int damage_taken_tick; - - int health; - int armor; - - // ninja - struct - { - vec2 activationdir; - int activationtick; - int currentmovetime; - } ninja; - - // - //int score; - int team; - int player_state; // if the client is chatting, accessing a menu or so - - // the player core for the physics - CHARACTER_CORE core; - - // info for dead reckoning - int reckoning_tick; // tick that we are performing dead reckoning from - CHARACTER_CORE sendcore; // core that we should send - CHARACTER_CORE reckoningcore; // the dead reckoning core - - // - CHARACTER(); - - virtual void reset(); - virtual void destroy(); - - bool is_grounded(); - - void set_weapon(int w); - - void handle_weaponswitch(); - void do_weaponswitch(); - - int handle_weapons(); - int handle_ninja(); - - void on_predicted_input(NETOBJ_PLAYER_INPUT *new_input); - void on_direct_input(NETOBJ_PLAYER_INPUT *new_input); - void fire_weapon(); - - void die(int killer, int weapon); - - bool take_damage(vec2 force, int dmg, int from, int weapon); - - - bool spawn(PLAYER *player, vec2 pos, int team); - //bool init_tryspawn(int team); - bool remove(); - - static const int phys_size = 28; - - virtual void tick(); - virtual void tick_defered(); - virtual void snap(int snapping_client); - - bool increase_health(int amount); - bool increase_armor(int amount); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.cpp deleted file mode 100644 index 2c6fa0ff7..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include "laser.hpp" - -////////////////////////////////////////////////// -// laser -////////////////////////////////////////////////// -LASER::LASER(vec2 pos, vec2 direction, float start_energy, int owner) -: ENTITY(NETOBJTYPE_LASER) -{ - this->pos = pos; - this->owner = owner; - energy = start_energy; - dir = direction; - bounces = 0; - do_bounce(); - - game.world.insert_entity(this); -} - - -bool LASER::hit_character(vec2 from, vec2 to) -{ - vec2 at; - CHARACTER *owner_char = game.get_player_char(owner); - CHARACTER *hit = game.world.intersect_character(pos, to, 0.0f, at, owner_char); - if(!hit) - return false; - - this->from = from; - pos = at; - energy = -1; - hit->take_damage(vec2(0,0), tuning.laser_damage, owner, WEAPON_RIFLE); - return true; -} - -void LASER::do_bounce() -{ - eval_tick = server_tick(); - - if(energy < 0) - { - //dbg_msg("laser", "%d removed", server_tick()); - game.world.destroy_entity(this); - return; - } - - vec2 to = pos + dir*energy; - vec2 org_to = to; - - if(col_intersect_line(pos, to, 0x0, &to)) - { - if(!hit_character(pos, to)) - { - // intersected - from = pos; - pos = to; - - vec2 temp_pos = pos; - vec2 temp_dir = dir*4.0f; - - move_point(&temp_pos, &temp_dir, 1.0f, 0); - pos = temp_pos; - dir = normalize(temp_dir); - - energy -= distance(from, pos) + tuning.laser_bounce_cost; - bounces++; - - if(bounces > tuning.laser_bounce_num) - energy = -1; - - game.create_sound(pos, SOUND_RIFLE_BOUNCE); - } - } - else - { - if(!hit_character(pos, to)) - { - from = pos; - pos = to; - energy = -1; - } - } - - //dbg_msg("laser", "%d done %f %f %f %f", server_tick(), from.x, from.y, pos.x, pos.y); -} - -void LASER::reset() -{ - game.world.destroy_entity(this); -} - -void LASER::tick() -{ - if(server_tick() > eval_tick+(server_tickspeed()*tuning.laser_bounce_delay)/1000.0f) - { - do_bounce(); - } - -} - -void LASER::snap(int snapping_client) -{ - if(networkclipped(snapping_client)) - return; - - NETOBJ_LASER *obj = (NETOBJ_LASER *)snap_new_item(NETOBJTYPE_LASER, id, sizeof(NETOBJ_LASER)); - obj->x = (int)pos.x; - obj->y = (int)pos.y; - obj->from_x = (int)from.x; - obj->from_y = (int)from.y; - obj->start_tick = eval_tick; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.hpp deleted file mode 100644 index aa4c22843..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/laser.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifndef GAME_SERVER_ENTITY_LASER_H -#define GAME_SERVER_ENTITY_LASER_H - -#include - -class CHARACTER; - -class LASER : public ENTITY -{ - vec2 from; - vec2 dir; - float energy; - int bounces; - int eval_tick; - int owner; - - bool hit_character(vec2 from, vec2 to); - void do_bounce(); - -public: - - LASER(vec2 pos, vec2 direction, float start_energy, int owner); - - virtual void reset(); - virtual void tick(); - virtual void snap(int snapping_client); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.cpp deleted file mode 100644 index 92d5c3e75..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include -#include -#include "pickup.hpp" - -////////////////////////////////////////////////// -// pickup -////////////////////////////////////////////////// -PICKUP::PICKUP(int _type, int _subtype) -: ENTITY(NETOBJTYPE_PICKUP) -{ - type = _type; - subtype = _subtype; - proximity_radius = phys_size; - - reset(); - - // TODO: should this be done here? - game.world.insert_entity(this); -} - -void PICKUP::reset() -{ - if (data->pickups[type].spawndelay > 0) - spawntick = server_tick() + server_tickspeed() * data->pickups[type].spawndelay; - else - spawntick = -1; -} - -void PICKUP::tick() -{ - // wait for respawn - if(spawntick > 0) - { - if(server_tick() > spawntick) - { - // respawn - spawntick = -1; - - if(type == POWERUP_WEAPON) - game.create_sound(pos, SOUND_WEAPON_SPAWN); - } - else - return; - } - - // Check if a player intersected us - CHARACTER *chr = game.world.closest_character(pos, 20.0f, 0); - if(chr && chr->alive) - { - // player picked us up, is someone was hooking us, let them go - int respawntime = -1; - switch (type) - { - case POWERUP_HEALTH: - if(chr->increase_health(1)) - { - game.create_sound(pos, SOUND_PICKUP_HEALTH); - respawntime = data->pickups[type].respawntime; - } - break; - case POWERUP_ARMOR: - if(chr->increase_armor(1)) - { - game.create_sound(pos, SOUND_PICKUP_ARMOR); - respawntime = data->pickups[type].respawntime; - } - break; - - case POWERUP_WEAPON: - if(subtype >= 0 && subtype < NUM_WEAPONS) - { - if(chr->weapons[subtype].ammo < data->weapons.id[subtype].maxammo || !chr->weapons[subtype].got) - { - chr->weapons[subtype].got = true; - chr->weapons[subtype].ammo = min(data->weapons.id[subtype].maxammo, chr->weapons[subtype].ammo + 10); - respawntime = data->pickups[type].respawntime; - - // TODO: data compiler should take care of stuff like this - if(subtype == WEAPON_GRENADE) - game.create_sound(pos, SOUND_PICKUP_GRENADE); - else if(subtype == WEAPON_SHOTGUN) - game.create_sound(pos, SOUND_PICKUP_SHOTGUN); - else if(subtype == WEAPON_RIFLE) - game.create_sound(pos, SOUND_PICKUP_SHOTGUN); - - if(chr->player) - game.send_weapon_pickup(chr->player->client_id, subtype); - } - } - break; - case POWERUP_NINJA: - { - // activate ninja on target player - chr->ninja.activationtick = server_tick(); - chr->weapons[WEAPON_NINJA].got = true; - chr->weapons[WEAPON_NINJA].ammo = -1; - chr->last_weapon = chr->active_weapon; - chr->active_weapon = WEAPON_NINJA; - respawntime = data->pickups[type].respawntime; - game.create_sound(pos, SOUND_PICKUP_NINJA); - - // loop through all players, setting their emotes - ENTITY *ents[64]; - int num = game.world.find_entities(vec2(0, 0), 1000000, ents, 64, NETOBJTYPE_CHARACTER); - for (int i = 0; i < num; i++) - { - CHARACTER *c = (CHARACTER *)ents[i]; - if (c != chr) - { - c->emote_type = EMOTE_SURPRISE; - c->emote_stop = server_tick() + server_tickspeed(); - } - } - - chr->emote_type = EMOTE_ANGRY; - chr->emote_stop = server_tick() + 1200 * server_tickspeed() / 1000; - - break; - } - default: - break; - }; - - if(respawntime >= 0) - { - dbg_msg("game", "pickup player='%d:%s' item=%d/%d", - chr->player->client_id, server_clientname(chr->player->client_id), type, subtype); - spawntick = server_tick() + server_tickspeed() * respawntime; - } - } -} - -void PICKUP::snap(int snapping_client) -{ - if(spawntick != -1) - return; - - NETOBJ_PICKUP *up = (NETOBJ_PICKUP *)snap_new_item(NETOBJTYPE_PICKUP, id, sizeof(NETOBJ_PICKUP)); - up->x = (int)pos.x; - up->y = (int)pos.y; - up->type = type; // TODO: two diffrent types? what gives? - up->subtype = subtype; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.hpp deleted file mode 100644 index cd480d92a..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/pickup.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifndef GAME_SERVER_ENTITY_PICKUP_H -#define GAME_SERVER_ENTITY_PICKUP_H - -#include - -// TODO: move to seperate file -class PICKUP : public ENTITY -{ -public: - static const int phys_size = 14; - - int type; - int subtype; // weapon type for instance? - int spawntick; - PICKUP(int _type, int _subtype = 0); - - virtual void reset(); - virtual void tick(); - virtual void snap(int snapping_client); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.cpp deleted file mode 100644 index 2a8de766b..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include -#include -#include -#include "projectile.hpp" - - -////////////////////////////////////////////////// -// projectile -////////////////////////////////////////////////// -PROJECTILE::PROJECTILE(int type, int owner, vec2 pos, vec2 dir, int span, - int damage, int flags, float force, int sound_impact, int weapon) -: ENTITY(NETOBJTYPE_PROJECTILE) -{ - this->type = type; - this->pos = pos; - this->direction = dir; - this->lifespan = span; - this->owner = owner; - this->flags = flags; - this->force = force; - this->damage = damage; - this->sound_impact = sound_impact; - this->weapon = weapon; - this->bounce = 0; - this->start_tick = server_tick(); - game.world.insert_entity(this); -} - -void PROJECTILE::reset() -{ - game.world.destroy_entity(this); -} - -vec2 PROJECTILE::get_pos(float time) -{ - float curvature = 0; - float speed = 0; - if(type == WEAPON_GRENADE) - { - curvature = tuning.grenade_curvature; - speed = tuning.grenade_speed; - } - else if(type == WEAPON_SHOTGUN) - { - curvature = tuning.shotgun_curvature; - speed = tuning.shotgun_speed; - } - else if(type == WEAPON_GUN) - { - curvature = tuning.gun_curvature; - speed = tuning.gun_speed; - } - - return calc_pos(pos, direction, curvature, speed, time); -} - - -void PROJECTILE::tick() -{ - - float pt = (server_tick()-start_tick-1)/(float)server_tickspeed(); - float ct = (server_tick()-start_tick)/(float)server_tickspeed(); - vec2 prevpos = get_pos(pt); - vec2 curpos = get_pos(ct); - - lifespan--; - - int collide = col_intersect_line(prevpos, curpos, &curpos, 0); - //int collide = col_check_point((int)curpos.x, (int)curpos.y); - CHARACTER *ownerchar = game.get_player_char(owner); - CHARACTER *targetchr = game.world.intersect_character(prevpos, curpos, 6.0f, curpos, ownerchar); - if(targetchr || collide || lifespan < 0) - { - if(lifespan >= 0 || weapon == WEAPON_GRENADE) - game.create_sound(curpos, sound_impact); - - if(flags & PROJECTILE_FLAGS_EXPLODE) - game.create_explosion(curpos, owner, weapon, false); - else if(targetchr) - targetchr->take_damage(direction * max(0.001f, force), damage, owner, weapon); - - game.world.destroy_entity(this); - } -} - -void PROJECTILE::fill_info(NETOBJ_PROJECTILE *proj) -{ - proj->x = (int)pos.x; - proj->y = (int)pos.y; - proj->vx = (int)(direction.x*100.0f); - proj->vy = (int)(direction.y*100.0f); - proj->start_tick = start_tick; - proj->type = type; -} - -void PROJECTILE::snap(int snapping_client) -{ - float ct = (server_tick()-start_tick)/(float)server_tickspeed(); - - if(networkclipped(snapping_client, get_pos(ct))) - return; - - NETOBJ_PROJECTILE *proj = (NETOBJ_PROJECTILE *)snap_new_item(NETOBJTYPE_PROJECTILE, id, sizeof(NETOBJ_PROJECTILE)); - fill_info(proj); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.hpp deleted file mode 100644 index a5c3b88f6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entities/projectile.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#ifndef GAME_SERVER_ENTITY_PROJECTILE_H -#define GAME_SERVER_ENTITY_PROJECTILE_H - -class PROJECTILE : public ENTITY -{ -public: - enum - { - PROJECTILE_FLAGS_EXPLODE = 1 << 0, - }; - - vec2 direction; - int lifespan; - int owner; - int type; - int flags; - int damage; - int sound_impact; - int weapon; - int bounce; - float force; - int start_tick; - - PROJECTILE(int type, int owner, vec2 pos, vec2 vel, int span, - int damage, int flags, float force, int sound_impact, int weapon); - - vec2 get_pos(float time); - void fill_info(NETOBJ_PROJECTILE *proj); - - virtual void reset(); - virtual void tick(); - virtual void snap(int snapping_client); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entity.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entity.cpp deleted file mode 100644 index 8e3345ab3..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entity.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -#include -#include "entity.hpp" -#include "gamecontext.hpp" - -////////////////////////////////////////////////// -// Entity -////////////////////////////////////////////////// -ENTITY::ENTITY(int objtype) -{ - this->objtype = objtype; - pos = vec2(0,0); - proximity_radius = 0; - - marked_for_destroy = false; - id = snap_new_id(); - - next_entity = 0; - prev_entity = 0; - prev_type_entity = 0; - next_type_entity = 0; -} - -ENTITY::~ENTITY() -{ - game.world.remove_entity(this); - snap_free_id(id); -} - -int ENTITY::networkclipped(int snapping_client) -{ - return networkclipped(snapping_client, pos); -} - -int ENTITY::networkclipped(int snapping_client, vec2 check_pos) -{ - if(snapping_client == -1) - return 0; - - float dx = game.players[snapping_client]->view_pos.x-check_pos.x; - float dy = game.players[snapping_client]->view_pos.y-check_pos.y; - - if(fabs(dx) > 1000.0f || fabs(dy) > 800.0f) - return 1; - - if(distance(game.players[snapping_client]->view_pos, check_pos) > 1100.0f) - return 1; - return 0; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/entity.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/entity.hpp deleted file mode 100644 index 6bdb25dee..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/entity.hpp +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef GAME_SERVER_ENTITY_H -#define GAME_SERVER_ENTITY_H - -#include -#include -#include - -#define MACRO_ALLOC_HEAP() \ - public: \ - void *operator new(size_t size) \ - { \ - void *p = mem_alloc(size, 1); \ - /*dbg_msg("", "++ %p %d", p, size);*/ \ - mem_zero(p, size); \ - return p; \ - } \ - void operator delete(void *p) \ - { \ - /*dbg_msg("", "-- %p", p);*/ \ - mem_free(p); \ - } \ - private: - -#define MACRO_ALLOC_POOL_ID() \ - public: \ - void *operator new(size_t size, int id); \ - void operator delete(void *p); \ - private: - -#define MACRO_ALLOC_POOL_ID_IMPL(POOLTYPE, poolsize) \ - static char pool_data_##POOLTYPE[poolsize][sizeof(POOLTYPE)] = {{0}}; \ - static int pool_used_##POOLTYPE[poolsize] = {0}; \ - void *POOLTYPE::operator new(size_t size, int id) \ - { \ - dbg_assert(sizeof(POOLTYPE) == size, "size error"); \ - dbg_assert(!pool_used_##POOLTYPE[id], "already used"); \ - /*dbg_msg("pool", "++ %s %d", #POOLTYPE, id);*/ \ - pool_used_##POOLTYPE[id] = 1; \ - mem_zero(pool_data_##POOLTYPE[id], size); \ - return pool_data_##POOLTYPE[id]; \ - } \ - void POOLTYPE::operator delete(void *p) \ - { \ - int id = (POOLTYPE*)p - (POOLTYPE*)pool_data_##POOLTYPE; \ - dbg_assert(pool_used_##POOLTYPE[id], "not used"); \ - /*dbg_msg("pool", "-- %s %d", #POOLTYPE, id);*/ \ - pool_used_##POOLTYPE[id] = 0; \ - mem_zero(pool_data_##POOLTYPE[id], sizeof(POOLTYPE)); \ - } - -/* - Class: Entity - Basic entity class. -*/ -class ENTITY -{ - MACRO_ALLOC_HEAP() -private: - friend class GAMEWORLD; // thy these? - ENTITY *prev_entity; - ENTITY *next_entity; - - ENTITY *prev_type_entity; - ENTITY *next_type_entity; -protected: - bool marked_for_destroy; - int id; - int objtype; -public: - ENTITY(int objtype); - virtual ~ENTITY(); - - ENTITY *typenext() { return next_type_entity; } - ENTITY *typeprev() { return prev_type_entity; } - - /* - Function: destroy - Destorys the entity. - */ - virtual void destroy() { delete this; } - - /* - Function: reset - Called when the game resets the map. Puts the entity - back to it's starting state or perhaps destroys it. - */ - virtual void reset() {} - - /* - Function: tick - Called progress the entity to the next tick. Updates - and moves the entity to it's new state and position. - */ - virtual void tick() {} - - /* - Function: tick_defered - Called after all entities tick() function has been called. - */ - virtual void tick_defered() {} - - /* - Function: snap - Called when a new snapshot is being generated for a specific - client. - - Arguments: - snapping_client - ID of the client which snapshot is - being generated. Could be -1 to create a complete - snapshot of everything in the game for demo - recording. - */ - virtual void snap(int snapping_client) {} - - /* - Function: networkclipped(int snapping_client) - Performs a series of test to see if a client can see the - entity. - - Arguments: - snapping_client - ID of the client which snapshot is - being generated. Could be -1 to create a complete - snapshot of everything in the game for demo - recording. - - Returns: - Non-zero if the entity doesn't have to be in the snapshot. - */ - int networkclipped(int snapping_client); - int networkclipped(int snapping_client, vec2 check_pos); - - - /* - Variable: proximity_radius - Contains the physical size of the entity. - */ - float proximity_radius; - - /* - Variable: pos - Contains the current posititon of the entity. - */ - vec2 pos; -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.cpp deleted file mode 100644 index 761eaf2c6..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "eventhandler.hpp" -#include "gamecontext.hpp" - -////////////////////////////////////////////////// -// Event handler -////////////////////////////////////////////////// -EVENTHANDLER::EVENTHANDLER() -{ - clear(); -} - -void *EVENTHANDLER::create(int type, int size, int mask) -{ - if(num_events == MAX_EVENTS) - return 0; - if(current_offset+size >= MAX_DATASIZE) - return 0; - - void *p = &data[current_offset]; - offsets[num_events] = current_offset; - types[num_events] = type; - sizes[num_events] = size; - client_masks[num_events] = mask; - current_offset += size; - num_events++; - return p; -} - -void EVENTHANDLER::clear() -{ - num_events = 0; - current_offset = 0; -} - -void EVENTHANDLER::snap(int snapping_client) -{ - for(int i = 0; i < num_events; i++) - { - if(snapping_client == -1 || cmask_is_set(client_masks[i], snapping_client)) - { - NETEVENT_COMMON *ev = (NETEVENT_COMMON *)&data[offsets[i]]; - if(snapping_client == -1 || distance(game.players[snapping_client]->view_pos, vec2(ev->x, ev->y)) < 1500.0f) - { - void *d = snap_new_item(types[i], i, sizes[i]); - mem_copy(d, &data[offsets[i]], sizes[i]); - } - } - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.hpp deleted file mode 100644 index 4d5131545..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/eventhandler.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef GAME_SERVER_EVENTHANDLER_H -#define GAME_SERVER_EVENTHANDLER_H - -// -class EVENTHANDLER -{ - static const int MAX_EVENTS = 128; - static const int MAX_DATASIZE = 128*64; - - int types[MAX_EVENTS]; // TODO: remove some of these arrays - int offsets[MAX_EVENTS]; - int sizes[MAX_EVENTS]; - int client_masks[MAX_EVENTS]; - char data[MAX_DATASIZE]; - - int current_offset; - int num_events; -public: - EVENTHANDLER(); - void *create(int type, int size, int mask = -1); - void clear(); - void snap(int snapping_client); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.cpp deleted file mode 100644 index 9e53d6ffb..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.cpp +++ /dev/null @@ -1,377 +0,0 @@ -#include -#include -#include -#include "gamecontext.hpp" - -GAMECONTEXT game; - -GAMECONTEXT::GAMECONTEXT() -{ - for(int i = 0; i < MAX_CLIENTS; i++) - players[i] = 0; - - controller = 0; - vote_closetime = 0; -} - -GAMECONTEXT::~GAMECONTEXT() -{ - for(int i = 0; i < MAX_CLIENTS; i++) - delete players[i]; -} - -void GAMECONTEXT::clear() -{ - this->~GAMECONTEXT(); - mem_zero(this, sizeof(*this)); - new (this) GAMECONTEXT(); -} - - -class CHARACTER *GAMECONTEXT::get_player_char(int client_id) -{ - if(client_id < 0 || client_id >= MAX_CLIENTS || !players[client_id]) - return 0; - return players[client_id]->get_character(); -} - -void GAMECONTEXT::create_damageind(vec2 p, float angle, int amount) -{ - float a = 3 * 3.14159f / 2 + angle; - //float a = get_angle(dir); - float s = a-pi/3; - float e = a+pi/3; - for(int i = 0; i < amount; i++) - { - float f = mix(s, e, float(i+1)/float(amount+2)); - NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)events.create(NETEVENTTYPE_DAMAGEIND, sizeof(NETEVENT_DAMAGEIND)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - ev->angle = (int)(f*256.0f); - } - } -} - -void GAMECONTEXT::create_hammerhit(vec2 p) -{ - // create the event - NETEVENT_HAMMERHIT *ev = (NETEVENT_HAMMERHIT *)events.create(NETEVENTTYPE_HAMMERHIT, sizeof(NETEVENT_HAMMERHIT)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - } -} - - -void GAMECONTEXT::create_explosion(vec2 p, int owner, int weapon, bool bnodamage) -{ - // create the event - NETEVENT_EXPLOSION *ev = (NETEVENT_EXPLOSION *)events.create(NETEVENTTYPE_EXPLOSION, sizeof(NETEVENT_EXPLOSION)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - } - - if (!bnodamage) - { - // deal damage - CHARACTER *ents[64]; - float radius = 135.0f; - float innerradius = 48.0f; - int num = game.world.find_entities(p, radius, (ENTITY**)ents, 64, NETOBJTYPE_CHARACTER); - for(int i = 0; i < num; i++) - { - vec2 diff = ents[i]->pos - p; - vec2 forcedir(0,1); - float l = length(diff); - if(l) - forcedir = normalize(diff); - l = 1-clamp((l-innerradius)/(radius-innerradius), 0.0f, 1.0f); - float dmg = 6 * l; - if((int)dmg) - ents[i]->take_damage(forcedir*dmg*2, (int)dmg, owner, weapon); - } - } -} - -/* -void create_smoke(vec2 p) -{ - // create the event - EV_EXPLOSION *ev = (EV_EXPLOSION *)events.create(EVENT_SMOKE, sizeof(EV_EXPLOSION)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - } -}*/ - -void GAMECONTEXT::create_playerspawn(vec2 p) -{ - // create the event - NETEVENT_SPAWN *ev = (NETEVENT_SPAWN *)events.create(NETEVENTTYPE_SPAWN, sizeof(NETEVENT_SPAWN)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - } -} - -void GAMECONTEXT::create_death(vec2 p, int cid) -{ - // create the event - NETEVENT_DEATH *ev = (NETEVENT_DEATH *)events.create(NETEVENTTYPE_DEATH, sizeof(NETEVENT_DEATH)); - if(ev) - { - ev->x = (int)p.x; - ev->y = (int)p.y; - ev->cid = cid; - } -} - -void GAMECONTEXT::create_sound(vec2 pos, int sound, int mask) -{ - if (sound < 0) - return; - - // create a sound - NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)events.create(NETEVENTTYPE_SOUNDWORLD, sizeof(NETEVENT_SOUNDWORLD), mask); - if(ev) - { - ev->x = (int)pos.x; - ev->y = (int)pos.y; - ev->soundid = sound; - } -} - -void GAMECONTEXT::create_sound_global(int sound, int target) -{ - if (sound < 0) - return; - - NETMSG_SV_SOUNDGLOBAL msg; - msg.soundid = sound; - msg.pack(MSGFLAG_VITAL); - server_send_msg(target); -} - - -void GAMECONTEXT::send_chat_target(int to, const char *text) -{ - NETMSG_SV_CHAT msg; - msg.team = 0; - msg.cid = -1; - msg.message = text; - msg.pack(MSGFLAG_VITAL); - server_send_msg(to); -} - - -void GAMECONTEXT::send_chat(int chatter_cid, int team, const char *text) -{ - if(chatter_cid >= 0 && chatter_cid < MAX_CLIENTS) - dbg_msg("chat", "%d:%d:%s: %s", chatter_cid, team, server_clientname(chatter_cid), text); - else - dbg_msg("chat", "*** %s", text); - - if(team == CHAT_ALL) - { - NETMSG_SV_CHAT msg; - msg.team = 0; - msg.cid = chatter_cid; - msg.message = text; - msg.pack(MSGFLAG_VITAL); - server_send_msg(-1); - } - else - { - NETMSG_SV_CHAT msg; - msg.team = 1; - msg.cid = chatter_cid; - msg.message = text; - msg.pack(MSGFLAG_VITAL); - - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i] && game.players[i]->team == team) - server_send_msg(i); - } - } -} - -void GAMECONTEXT::send_emoticon(int cid, int emoticon) -{ - NETMSG_SV_EMOTICON msg; - msg.cid = cid; - msg.emoticon = emoticon; - msg.pack(MSGFLAG_VITAL); - server_send_msg(-1); -} - -void GAMECONTEXT::send_weapon_pickup(int cid, int weapon) -{ - NETMSG_SV_WEAPONPICKUP msg; - msg.weapon = weapon; - msg.pack(MSGFLAG_VITAL); - server_send_msg(cid); -} - - -void GAMECONTEXT::send_broadcast(const char *text, int cid) -{ - NETMSG_SV_BROADCAST msg; - msg.message = text; - msg.pack(MSGFLAG_VITAL); - server_send_msg(cid); -} - -// -void GAMECONTEXT::start_vote(const char *desc, const char *command) -{ - // check if a vote is already running - if(vote_closetime) - return; - - // reset votes - vote_enforce = VOTE_ENFORCE_UNKNOWN; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i]) - players[i]->vote = 0; - } - - // start vote - vote_closetime = time_get() + time_freq()*25; - str_copy(vote_description, desc, sizeof(vote_description)); - str_copy(vote_command, command, sizeof(vote_description)); - send_vote_set(-1); - send_vote_status(-1); -} - - -void GAMECONTEXT::end_vote() -{ - vote_closetime = 0; - send_vote_set(-1); -} - -void GAMECONTEXT::send_vote_set(int cid) -{ - NETMSG_SV_VOTE_SET msg; - if(vote_closetime) - { - msg.timeout = (vote_closetime-time_get())/time_freq(); - msg.description = vote_description; - msg.command = vote_command; - } - else - { - msg.timeout = 0; - msg.description = ""; - msg.command = ""; - } - msg.pack(MSGFLAG_VITAL); - server_send_msg(cid); -} - -void GAMECONTEXT::send_vote_status(int cid) -{ - NETMSG_SV_VOTE_STATUS msg = {0}; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i]) - { - msg.total++; - if(players[i]->vote > 0) - msg.yes++; - else if(players[i]->vote < 0) - msg.no++; - else - msg.pass++; - } - } - - msg.pack(MSGFLAG_VITAL); - server_send_msg(cid); - -} - -void GAMECONTEXT::abort_vote_kick_on_disconnect(int client_id) -{ - if(vote_closetime && !strncmp(vote_command, "kick ", 5) && atoi(&vote_command[5]) == client_id) - vote_closetime = -1; -} - -void GAMECONTEXT::tick() -{ - world.core.tuning = tuning; - world.tick(); - - //if(world.paused) // make sure that the game object always updates - controller->tick(); - - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i]) - players[i]->tick(); - } - - // update voting - if(vote_closetime) - { - // abort the kick-vote on player-leave - if(vote_closetime == -1) - { - send_chat(-1, GAMECONTEXT::CHAT_ALL, "Vote aborted"); - end_vote(); - } - else - { - // count votes - int total = 0, yes = 0, no = 0; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i]) - { - total++; - if(players[i]->vote > 0) - yes++; - else if(players[i]->vote < 0) - no++; - } - } - - if(vote_enforce == VOTE_ENFORCE_YES || yes >= total/2+1) - { - console_execute_line(vote_command); - end_vote(); - send_chat(-1, GAMECONTEXT::CHAT_ALL, "Vote passed"); - - if(players[vote_creator]) - players[vote_creator]->last_votecall = 0; - } - else if(vote_enforce == VOTE_ENFORCE_NO || time_get() > vote_closetime || no >= total/2+1 || yes+no == total) - { - end_vote(); - send_chat(-1, GAMECONTEXT::CHAT_ALL, "Vote failed"); - } - } - } -} - -void GAMECONTEXT::snap(int client_id) -{ - world.snap(client_id); - controller->snap(client_id); - events.snap(client_id); - - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i]) - players[i]->snap(client_id); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.hpp deleted file mode 100644 index bea087cb9..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontext.hpp +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef GAME_SERVER_GAMECONTEXT_H -#define GAME_SERVER_GAMECONTEXT_H - -#include "eventhandler.hpp" -#include "gamecontroller.hpp" -#include "gameworld.hpp" -#include "player.hpp" - -/* - Tick - Game Context (GAMECONTEXT::tick) - Game World (GAMEWORLD::tick) - Reset world if requested (GAMEWORLD::reset) - All entities in the world (ENTITY::tick) - All entities in the world (ENTITY::tick_defered) - Remove entities marked for deletion (GAMEWORLD::remove_entities) - Game Controller (GAMECONTROLLER::tick) - All players (PLAYER::tick) - - - Snap - Game Context (GAMECONTEXT::snap) - Game World (GAMEWORLD::snap) - All entities in the world (ENTITY::snap) - Game Controller (GAMECONTROLLER::snap) - Events handler (EVENT_HANDLER::snap) - All players (PLAYER::snap) - -*/ -class GAMECONTEXT -{ -public: - GAMECONTEXT(); - ~GAMECONTEXT(); - - void clear(); - - EVENTHANDLER events; - PLAYER *players[MAX_CLIENTS]; - - GAMECONTROLLER *controller; - GAMEWORLD world; - - void tick(); - void snap(int client_id); - - // helper functions - class CHARACTER *get_player_char(int client_id); - - // voting - void start_vote(const char *desc, const char *command); - void end_vote(); - void send_vote_set(int cid); - void send_vote_status(int cid); - void abort_vote_kick_on_disconnect(int client_id); - int vote_creator; - int64 vote_closetime; - char vote_description[512]; - char vote_command[512]; - int vote_enforce; - enum - { - VOTE_ENFORCE_UNKNOWN=0, - VOTE_ENFORCE_NO, - VOTE_ENFORCE_YES, - }; - - // helper functions - void create_damageind(vec2 p, float angle_mod, int amount); - void create_explosion(vec2 p, int owner, int weapon, bool bnodamage); - void create_smoke(vec2 p); - void create_hammerhit(vec2 p); - void create_playerspawn(vec2 p); - void create_death(vec2 p, int who); - void create_sound(vec2 pos, int sound, int mask=-1); - void create_sound_global(int sound, int target=-1); - - - enum - { - CHAT_ALL=-2, - CHAT_SPEC=-1, - CHAT_RED=0, - CHAT_BLUE=1 - }; - - // network - void send_chat_target(int to, const char *text); - void send_chat(int cid, int team, const char *text); - void send_emoticon(int cid, int emoticon); - void send_weapon_pickup(int cid, int weapon); - void send_broadcast(const char *text, int cid); - -}; - -extern GAMECONTEXT game; - -// MISC stuff, move to a better place later on - -extern TUNING_PARAMS tuning; -inline int cmask_all() { return -1; } -inline int cmask_one(int cid) { return 1< -#include -#include -#include - -#include - -#include "entities/pickup.hpp" -#include "gamecontroller.hpp" -#include "gamecontext.hpp" - - - -GAMECONTROLLER::GAMECONTROLLER() -{ - gametype = "unknown"; - - // - do_warmup(config.sv_warmup); - game_over_tick = -1; - sudden_death = 0; - round_start_tick = server_tick(); - round_count = 0; - game_flags = 0; - teamscore[0] = 0; - teamscore[1] = 0; - map_wish[0] = 0; - - unbalanced_tick = -1; - force_balanced = false; - - num_spawn_points[0] = 0; - num_spawn_points[1] = 0; - num_spawn_points[2] = 0; -} - -GAMECONTROLLER::~GAMECONTROLLER() -{ -} - -float GAMECONTROLLER::evaluate_spawn_pos(SPAWNEVAL *eval, vec2 pos) -{ - float score = 0.0f; - CHARACTER *c = (CHARACTER *)game.world.find_first(NETOBJTYPE_CHARACTER); - for(; c; c = (CHARACTER *)c->typenext()) - { - // team mates are not as dangerous as enemies - float scoremod = 1.0f; - if(eval->friendly_team != -1 && c->team == eval->friendly_team) - scoremod = 0.5f; - - float d = distance(pos, c->pos); - if(d == 0) - score += 1000000000.0f; - else - score += 1.0f/d; - } - - return score; -} - -void GAMECONTROLLER::evaluate_spawn_type(SPAWNEVAL *eval, int t) -{ - // get spawn point - for(int i = 0; i < num_spawn_points[t]; i++) - { - vec2 p = spawn_points[t][i]; - float s = evaluate_spawn_pos(eval, p); - if(!eval->got || eval->score > s) - { - eval->got = true; - eval->score = s; - eval->pos = p; - } - } -} - -bool GAMECONTROLLER::can_spawn(PLAYER *player, vec2 *out_pos) -{ - SPAWNEVAL eval; - - // spectators can't spawn - if(player->team == -1) - return false; - - if(is_teamplay()) - { - eval.friendly_team = player->team; - - // try first try own team spawn, then normal spawn and then enemy - evaluate_spawn_type(&eval, 1+(player->team&1)); - if(!eval.got) - { - evaluate_spawn_type(&eval, 0); - if(!eval.got) - evaluate_spawn_type(&eval, 1+((player->team+1)&1)); - } - } - else - { - evaluate_spawn_type(&eval, 0); - evaluate_spawn_type(&eval, 1); - evaluate_spawn_type(&eval, 2); - } - - *out_pos = eval.pos; - return eval.got; -} - - -bool GAMECONTROLLER::on_entity(int index, vec2 pos) -{ - int type = -1; - int subtype = 0; - - if(index == ENTITY_SPAWN) - spawn_points[0][num_spawn_points[0]++] = pos; - else if(index == ENTITY_SPAWN_RED) - spawn_points[1][num_spawn_points[1]++] = pos; - else if(index == ENTITY_SPAWN_BLUE) - spawn_points[2][num_spawn_points[2]++] = pos; - else if(index == ENTITY_ARMOR_1) - type = POWERUP_ARMOR; - else if(index == ENTITY_HEALTH_1) - type = POWERUP_HEALTH; - else if(index == ENTITY_WEAPON_SHOTGUN) - { - type = POWERUP_WEAPON; - subtype = WEAPON_SHOTGUN; - } - else if(index == ENTITY_WEAPON_GRENADE) - { - type = POWERUP_WEAPON; - subtype = WEAPON_GRENADE; - } - else if(index == ENTITY_WEAPON_RIFLE) - { - type = POWERUP_WEAPON; - subtype = WEAPON_RIFLE; - } - else if(index == ENTITY_POWERUP_NINJA && config.sv_powerups) - { - type = POWERUP_NINJA; - subtype = WEAPON_NINJA; - } - - if(type != -1) - { - PICKUP *pickup = new PICKUP(type, subtype); - pickup->pos = pos; - return true; - } - - return false; -} - -void GAMECONTROLLER::endround() -{ - if(warmup) // game can't end when we are running warmup - return; - - game.world.paused = true; - game_over_tick = server_tick(); - sudden_death = 0; -} - -void GAMECONTROLLER::resetgame() -{ - game.world.reset_requested = true; -} - -const char *GAMECONTROLLER::get_team_name(int team) -{ - if(is_teamplay()) - { - if(team == 0) - return "red team"; - else if(team == 1) - return "blue team"; - } - else - { - if(team == 0) - return "game"; - } - - return "spectators"; -} - -static bool is_separator(char c) { return c == ';' || c == ' ' || c == ',' || c == '\t'; } - -void GAMECONTROLLER::startround() -{ - resetgame(); - - round_start_tick = server_tick(); - sudden_death = 0; - game_over_tick = -1; - game.world.paused = false; - teamscore[0] = 0; - teamscore[1] = 0; - unbalanced_tick = -1; - force_balanced = false; - dbg_msg("game","start round type='%s' teamplay='%d'", gametype, game_flags&GAMEFLAG_TEAMS); -} - -void GAMECONTROLLER::change_map(const char *to_map) -{ - str_copy(map_wish, to_map, sizeof(map_wish)); - endround(); -} - -void GAMECONTROLLER::cyclemap() -{ - if(map_wish[0] != 0) - { - dbg_msg("game", "rotating map to %s", map_wish); - str_copy(config.sv_map, map_wish, sizeof(config.sv_map)); - map_wish[0] = 0; - round_count = 0; - return; - } - if(!strlen(config.sv_maprotation)) - return; - - if(round_count < config.sv_rounds_per_map-1) - return; - - // handle maprotation - const char *map_rotation = config.sv_maprotation; - const char *current_map = config.sv_map; - - int current_map_len = strlen(current_map); - const char *next_map = map_rotation; - while(*next_map) - { - int wordlen = 0; - while(next_map[wordlen] && !is_separator(next_map[wordlen])) - wordlen++; - - if(wordlen == current_map_len && strncmp(next_map, current_map, current_map_len) == 0) - { - // map found - next_map += current_map_len; - while(*next_map && is_separator(*next_map)) - next_map++; - - break; - } - - next_map++; - } - - // restart rotation - if(next_map[0] == 0) - next_map = map_rotation; - - // cut out the next map - char buf[512]; - for(int i = 0; i < 512; i++) - { - buf[i] = next_map[i]; - if(is_separator(next_map[i]) || next_map[i] == 0) - { - buf[i] = 0; - break; - } - } - - // skip spaces - int i = 0; - while(is_separator(buf[i])) - i++; - - round_count = 0; - - dbg_msg("game", "rotating map to %s", &buf[i]); - str_copy(config.sv_map, &buf[i], sizeof(config.sv_map)); -} - -void GAMECONTROLLER::post_reset() -{ - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i]) - { - game.players[i]->respawn(); - game.players[i]->score = 0; - } - } -} - -void GAMECONTROLLER::on_player_info_change(class PLAYER *p) -{ - const int team_colors[2] = {65387, 10223467}; - if(is_teamplay()) - { - if(p->team >= 0 || p->team <= 1) - { - p->use_custom_color = 1; - p->color_body = team_colors[p->team]; - p->color_feet = team_colors[p->team]; - } - } -} - - -int GAMECONTROLLER::on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon) -{ - // do scoreing - if(!killer) - return 0; - if(killer == victim->player) - victim->player->score--; // suicide - else - { - if(is_teamplay() && victim->team == killer->team) - killer->score--; // teamkill - else - killer->score++; // normal kill - } - return 0; -} - -void GAMECONTROLLER::on_character_spawn(class CHARACTER *chr) -{ - // default health - chr->health = 10; - - // give default weapons - chr->weapons[WEAPON_HAMMER].got = 1; - chr->weapons[WEAPON_HAMMER].ammo = -1; - chr->weapons[WEAPON_GUN].got = 1; - chr->weapons[WEAPON_GUN].ammo = 10; -} - -void GAMECONTROLLER::do_warmup(int seconds) -{ - warmup = seconds*server_tickspeed(); -} - -bool GAMECONTROLLER::is_friendly_fire(int cid1, int cid2) -{ - if(cid1 == cid2) - return false; - - if(is_teamplay()) - { - if(!game.players[cid1] || !game.players[cid2]) - return false; - - if(game.players[cid1]->team == game.players[cid2]->team) - return true; - } - - return false; -} - -bool GAMECONTROLLER::is_force_balanced() -{ - if(force_balanced) - { - force_balanced = false; - return true; - } - else - return false; -} - -void GAMECONTROLLER::tick() -{ - // do warmup - if(warmup) - { - warmup--; - if(!warmup) - startround(); - } - - if(game_over_tick != -1) - { - // game over.. wait for restart - if(server_tick() > game_over_tick+server_tickspeed()*10) - { - cyclemap(); - startround(); - round_count++; - } - } - - // do team-balancing - if (is_teamplay() && unbalanced_tick != -1 && server_tick() > unbalanced_tick+config.sv_teambalance_time*server_tickspeed()*60) - { - dbg_msg("game", "Balancing teams"); - - int t[2] = {0,0}; - int tscore[2] = {0,0}; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i] && game.players[i]->team != -1) - { - t[game.players[i]->team]++; - tscore[game.players[i]->team]+=game.players[i]->score; - } - } - - // are teams unbalanced? - if(abs(t[0]-t[1]) >= 2) - { - int m = (t[0] > t[1]) ? 0 : 1; - int num_balance = abs(t[0]-t[1]) / 2; - - do - { - PLAYER *p = 0; - int pd = tscore[m]; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(!game.players[i]) - continue; - - // remember the player who would cause lowest score-difference - if(game.players[i]->team == m && (!p || abs((tscore[m^1]+game.players[i]->score) - (tscore[m]-game.players[i]->score)) < pd)) - { - p = game.players[i]; - pd = abs((tscore[m^1]+p->score) - (tscore[m]-p->score)); - } - } - - // move the player to other team without losing his score - // TODO: change in player::set_team needed: player won't lose score on team-change - int score_before = p->score; - p->set_team(m^1); - p->score = score_before; - - p->respawn(); - p->force_balanced = true; - } while (--num_balance); - - force_balanced = true; - } - unbalanced_tick = -1; - } - - // update browse info - int prog = -1; - if(config.sv_timelimit > 0) - prog = max(prog, (server_tick()-round_start_tick) * 100 / (config.sv_timelimit*server_tickspeed()*60)); - - if(config.sv_scorelimit) - { - if(is_teamplay()) - { - prog = max(prog, (teamscore[0]*100)/config.sv_scorelimit); - prog = max(prog, (teamscore[1]*100)/config.sv_scorelimit); - } - else - { - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i]) - prog = max(prog, (game.players[i]->score*100)/config.sv_scorelimit); - } - } - } - - if(warmup) - prog = -1; - - server_setbrowseinfo(gametype, prog); -} - - -bool GAMECONTROLLER::is_teamplay() const -{ - return game_flags&GAMEFLAG_TEAMS; -} - -void GAMECONTROLLER::snap(int snapping_client) -{ - NETOBJ_GAME *gameobj = (NETOBJ_GAME *)snap_new_item(NETOBJTYPE_GAME, 0, sizeof(NETOBJ_GAME)); - gameobj->paused = game.world.paused; - gameobj->game_over = game_over_tick==-1?0:1; - gameobj->sudden_death = sudden_death; - - gameobj->score_limit = config.sv_scorelimit; - gameobj->time_limit = config.sv_timelimit; - gameobj->round_start_tick = round_start_tick; - gameobj->flags = game_flags; - - gameobj->warmup = warmup; - - gameobj->round_num = (strlen(config.sv_maprotation) && config.sv_rounds_per_map) ? config.sv_rounds_per_map : 0; - gameobj->round_current = round_count+1; - - - if(snapping_client == -1) - { - // we are recording a demo, just set the scores - gameobj->teamscore_red = teamscore[0]; - gameobj->teamscore_blue = teamscore[1]; - } - else - { - // TODO: this little hack should be removed - gameobj->teamscore_red = is_teamplay() ? teamscore[0] : game.players[snapping_client]->score; - gameobj->teamscore_blue = teamscore[1]; - } -} - -int GAMECONTROLLER::get_auto_team(int notthisid) -{ - // this will force the auto balancer to work overtime aswell - if(config.dbg_stress) - return 0; - - int numplayers[2] = {0,0}; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i] && i != notthisid) - { - if(game.players[i]->team == 0 || game.players[i]->team == 1) - numplayers[game.players[i]->team]++; - } - } - - int team = 0; - if(is_teamplay()) - team = numplayers[0] > numplayers[1] ? 1 : 0; - - if(can_join_team(team, notthisid)) - return team; - return -1; -} - -bool GAMECONTROLLER::can_join_team(int team, int notthisid) -{ - (void)team; - int numplayers[2] = {0,0}; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i] && i != notthisid) - { - if(game.players[i]->team >= 0 || game.players[i]->team == 1) - numplayers[game.players[i]->team]++; - } - } - - return (numplayers[0] + numplayers[1]) < config.sv_max_clients-config.sv_spectator_slots; -} - -bool GAMECONTROLLER::check_team_balance() -{ - if(!is_teamplay() || !config.sv_teambalance_time) - return true; - - int t[2] = {0, 0}; - for(int i = 0; i < MAX_CLIENTS; i++) - { - PLAYER *p = game.players[i]; - if(p && p->team != -1) - t[p->team]++; - } - - if(abs(t[0]-t[1]) >= 2) - { - dbg_msg("game", "Team is NOT balanced (red=%d blue=%d)", t[0], t[1]); - if (game.controller->unbalanced_tick == -1) - game.controller->unbalanced_tick = server_tick(); - return false; - } - else - { - dbg_msg("game", "Team is balanced (red=%d blue=%d)", t[0], t[1]); - game.controller->unbalanced_tick = -1; - return true; - } -} - -bool GAMECONTROLLER::can_change_team(PLAYER *pplayer, int jointeam) -{ - int t[2] = {0, 0}; - - if (!is_teamplay() || jointeam == -1 || !config.sv_teambalance_time) - return true; - - for(int i = 0; i < MAX_CLIENTS; i++) - { - PLAYER *p = game.players[i]; - if(p && p->team != -1) - t[p->team]++; - } - - // simulate what would happen if changed team - t[jointeam]++; - if (pplayer->team != -1) - t[jointeam^1]--; - - // there is a player-difference of at least 2 - if(abs(t[0]-t[1]) >= 2) - { - // player wants to join team with less players - if ((t[0] < t[1] && jointeam == 0) || (t[0] > t[1] && jointeam == 1)) - return true; - else - return false; - } - else - return true; -} - -void GAMECONTROLLER::do_player_score_wincheck() -{ - if(game_over_tick == -1 && !warmup) - { - // gather some stats - int topscore = 0; - int topscore_count = 0; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(game.players[i]) - { - if(game.players[i]->score > topscore) - { - topscore = game.players[i]->score; - topscore_count = 1; - } - else if(game.players[i]->score == topscore) - topscore_count++; - } - } - - // check score win condition - if((config.sv_scorelimit > 0 && topscore >= config.sv_scorelimit) || - (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60)) - { - if(topscore_count == 1) - endround(); - else - sudden_death = 1; - } - } -} - -void GAMECONTROLLER::do_team_score_wincheck() -{ - if(game_over_tick == -1 && !warmup) - { - // check score win condition - if((config.sv_scorelimit > 0 && (teamscore[0] >= config.sv_scorelimit || teamscore[1] >= config.sv_scorelimit)) || - (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60)) - { - if(teamscore[0] != teamscore[1]) - endround(); - else - sudden_death = 1; - } - } -} - -int GAMECONTROLLER::clampteam(int team) -{ - if(team < 0) // spectator - return -1; - if(is_teamplay()) - return team&1; - return 0; -} - -GAMECONTROLLER *gamecontroller = 0; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontroller.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontroller.hpp deleted file mode 100644 index 26b8a81f5..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamecontroller.hpp +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef GAME_SERVER_GAMECONTROLLER_H -#define GAME_SERVER_GAMECONTROLLER_H - -#include - -/* - Class: Game Controller - Controls the main game logic. Keeping track of team and player score, - winning conditions and specific game logic. -*/ -class GAMECONTROLLER -{ - vec2 spawn_points[3][64]; - int num_spawn_points[3]; -protected: - struct SPAWNEVAL - { - SPAWNEVAL() - { - got = false; - friendly_team = -1; - pos = vec2(100,100); - } - - vec2 pos; - bool got; - int friendly_team; - float score; - }; - - float evaluate_spawn_pos(SPAWNEVAL *eval, vec2 pos); - void evaluate_spawn_type(SPAWNEVAL *eval, int type); - bool evaluate_spawn(class PLAYER *p, vec2 *pos); - - void cyclemap(); - void resetgame(); - - char map_wish[128]; - - - int round_start_tick; - int game_over_tick; - int sudden_death; - - int teamscore[2]; - - int warmup; - int round_count; - - int game_flags; - int unbalanced_tick; - bool force_balanced; - -public: - const char *gametype; - - bool is_teamplay() const; - - GAMECONTROLLER(); - virtual ~GAMECONTROLLER(); - - void do_team_score_wincheck(); - void do_player_score_wincheck(); - - void do_warmup(int seconds); - - void startround(); - void endround(); - void change_map(const char *to_map); - - bool is_friendly_fire(int cid1, int cid2); - - bool is_force_balanced(); - - /* - - */ - virtual void tick(); - - virtual void snap(int snapping_client); - - /* - Function: on_entity - Called when the map is loaded to process an entity - in the map. - - Arguments: - index - Entity index. - pos - Where the entity is located in the world. - - Returns: - bool? - */ - virtual bool on_entity(int index, vec2 pos); - - /* - Function: on_character_spawn - Called when a character spawns into the game world. - - Arguments: - chr - The character that was spawned. - */ - virtual void on_character_spawn(class CHARACTER *chr); - - /* - Function: on_character_death - Called when a character in the world dies. - - Arguments: - victim - The character that died. - killer - The player that killed it. - weapon - What weapon that killed it. Can be -1 for undefined - weapon when switching team or player suicides. - */ - virtual int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon); - - - virtual void on_player_info_change(class PLAYER *p); - - // - virtual bool can_spawn(class PLAYER *p, vec2 *pos); - - /* - - */ - virtual const char *get_team_name(int team); - virtual int get_auto_team(int notthisid); - virtual bool can_join_team(int team, int notthisid); - bool check_team_balance(); - bool can_change_team(PLAYER *pplayer, int jointeam); - int clampteam(int team); - - virtual void post_reset(); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.cpp deleted file mode 100644 index b2146b511..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include -#include -#include "ctf.hpp" - -GAMECONTROLLER_CTF::GAMECONTROLLER_CTF() -{ - flags[0] = 0; - flags[1] = 0; - gametype = "CTF"; - game_flags = GAMEFLAG_TEAMS|GAMEFLAG_FLAGS; -} - -bool GAMECONTROLLER_CTF::on_entity(int index, vec2 pos) -{ - if(GAMECONTROLLER::on_entity(index, pos)) - return true; - - int team = -1; - if(index == ENTITY_FLAGSTAND_RED) team = 0; - if(index == ENTITY_FLAGSTAND_BLUE) team = 1; - if(team == -1) - return false; - - FLAG *f = new FLAG(team); - f->stand_pos = pos; - f->pos = pos; - flags[team] = f; - return true; -} - -int GAMECONTROLLER_CTF::on_character_death(class CHARACTER *victim, class PLAYER *killer, int weaponid) -{ - GAMECONTROLLER::on_character_death(victim, killer, weaponid); - int had_flag = 0; - - // drop flags - for(int fi = 0; fi < 2; fi++) - { - FLAG *f = flags[fi]; - if(f && killer && f->carrying_character == killer->get_character()) - had_flag |= 2; - if(f && f->carrying_character == victim) - { - game.create_sound_global(SOUND_CTF_DROP); - f->drop_tick = server_tick(); - f->carrying_character = 0; - f->vel = vec2(0,0); - - if(killer && killer->team != victim->team) - killer->score++; - - had_flag |= 1; - } - } - - return had_flag; -} - -void GAMECONTROLLER_CTF::tick() -{ - GAMECONTROLLER::tick(); - - do_team_score_wincheck(); - - for(int fi = 0; fi < 2; fi++) - { - FLAG *f = flags[fi]; - - if(!f) - continue; - - // flag hits death-tile, reset it - if(col_get((int)f->pos.x, (int)f->pos.y)&COLFLAG_DEATH) - { - game.create_sound_global(SOUND_CTF_RETURN); - f->reset(); - continue; - } - - // - if(f->carrying_character) - { - // update flag position - f->pos = f->carrying_character->pos; - - if(flags[fi^1] && flags[fi^1]->at_stand) - { - if(distance(f->pos, flags[fi^1]->pos) < 32) - { - // CAPTURE! \o/ - teamscore[fi^1] += 100; - f->carrying_character->player->score += 5; - - dbg_msg("game", "flag_capture player='%d:%s'", - f->carrying_character->player->client_id, - server_clientname(f->carrying_character->player->client_id)); - - char buf[512]; - float capture_time = (server_tick() - f->grab_tick)/(float)server_tickspeed(); - if(capture_time <= 60) - { - str_format(buf, sizeof(buf), "the %s flag was captured by %s (%d.%s%d seconds)", fi ? "blue" : "red", server_clientname(f->carrying_character->player->client_id), (int)capture_time%60, ((int)(capture_time*100)%100)<10?"0":"", (int)(capture_time*100)%100); - } - else - { - str_format(buf, sizeof(buf), "the %s flag was captured by %s", fi ? "blue" : "red", server_clientname(f->carrying_character->player->client_id)); - } - game.send_chat(-1, -2, buf); - for(int i = 0; i < 2; i++) - flags[i]->reset(); - - game.create_sound_global(SOUND_CTF_CAPTURE); - } - } - } - else - { - CHARACTER *close_characters[MAX_CLIENTS]; - int num = game.world.find_entities(f->pos, 32.0f, (ENTITY**)close_characters, MAX_CLIENTS, NETOBJTYPE_CHARACTER); - for(int i = 0; i < num; i++) - { - if(!close_characters[i]->alive || close_characters[i]->player->team == -1 || col_intersect_line(f->pos, close_characters[i]->pos, NULL, NULL)) - continue; - - if(close_characters[i]->team == f->team) - { - // return the flag - if(!f->at_stand) - { - CHARACTER *chr = close_characters[i]; - chr->player->score += 1; - - dbg_msg("game", "flag_return player='%d:%s'", - chr->player->client_id, - server_clientname(chr->player->client_id)); - - game.create_sound_global(SOUND_CTF_RETURN); - f->reset(); - } - } - else - { - // take the flag - if(f->at_stand) - { - teamscore[fi^1]++; - f->grab_tick = server_tick(); - } - f->at_stand = 0; - f->carrying_character = close_characters[i]; - f->carrying_character->player->score += 1; - - dbg_msg("game", "flag_grab player='%d:%s'", - f->carrying_character->player->client_id, - server_clientname(f->carrying_character->player->client_id)); - - for(int c = 0; c < MAX_CLIENTS; c++) - { - if(!game.players[c]) - continue; - - if(game.players[c]->team == fi) - game.create_sound_global(SOUND_CTF_GRAB_EN, game.players[c]->client_id); - else - game.create_sound_global(SOUND_CTF_GRAB_PL, game.players[c]->client_id); - } - break; - } - } - - if(!f->carrying_character && !f->at_stand) - { - if(server_tick() > f->drop_tick + server_tickspeed()*30) - { - game.create_sound_global(SOUND_CTF_RETURN); - f->reset(); - } - else - { - f->vel.y += game.world.core.tuning.gravity; - move_box(&f->pos, &f->vel, vec2(f->phys_size, f->phys_size), 0.5f); - } - } - } - } -} - -// Flag -FLAG::FLAG(int _team) -: ENTITY(NETOBJTYPE_FLAG) -{ - team = _team; - proximity_radius = phys_size; - carrying_character = 0x0; - grab_tick = 0; - - reset(); - - // TODO: should this be done here? - game.world.insert_entity(this); -} - -void FLAG::reset() -{ - carrying_character = 0x0; - at_stand = 1; - pos = stand_pos; - vel = vec2(0,0); - grab_tick = 0; -} - -void FLAG::snap(int snapping_client) -{ - NETOBJ_FLAG *flag = (NETOBJ_FLAG *)snap_new_item(NETOBJTYPE_FLAG, team, sizeof(NETOBJ_FLAG)); - flag->x = (int)pos.x; - flag->y = (int)pos.y; - flag->team = team; - flag->carried_by = -1; - - if(at_stand) - flag->carried_by = -2; - else if(carrying_character && carrying_character->player) - flag->carried_by = carrying_character->player->client_id; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.hpp deleted file mode 100644 index 67a098a48..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/ctf.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include -#include - -class GAMECONTROLLER_CTF : public GAMECONTROLLER -{ -public: - class FLAG *flags[2]; - - GAMECONTROLLER_CTF(); - virtual void tick(); - - virtual bool on_entity(int index, vec2 pos); - virtual int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon); -}; - -// TODO: move to seperate file -class FLAG : public ENTITY -{ -public: - static const int phys_size = 14; - CHARACTER *carrying_character; - vec2 vel; - vec2 stand_pos; - - int team; - int at_stand; - int drop_tick; - int grab_tick; - - FLAG(int _team); - - virtual void reset(); - virtual void snap(int snapping_client); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.cpp deleted file mode 100644 index 15c0b987c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "dm.hpp" - - -GAMECONTROLLER_DM::GAMECONTROLLER_DM() -{ - gametype = "DM"; -} - -void GAMECONTROLLER_DM::tick() -{ - do_player_score_wincheck(); - GAMECONTROLLER::tick(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.hpp deleted file mode 100644 index 6fb25f61f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/dm.hpp +++ /dev/null @@ -1,10 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include - -class GAMECONTROLLER_DM : public GAMECONTROLLER -{ -public: - GAMECONTROLLER_DM(); - virtual void tick(); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.cpp deleted file mode 100644 index 87b37411c..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "mod.hpp" - -GAMECONTROLLER_MOD::GAMECONTROLLER_MOD() -{ - // Exchange this to a string that identifies your game mode. - // DM, TDM and CTF are reserved for teeworlds original modes. - gametype = "MOD"; - - //game_flags = GAMEFLAG_TEAMS; // GAMEFLAG_TEAMS makes it a two-team gamemode -} - -void GAMECONTROLLER_MOD::tick() -{ - // this is the main part of the gamemode, this function is run every tick - do_player_score_wincheck(); // checks for winners, no teams version - //do_team_score_wincheck(); // checks for winners, two teams version - - GAMECONTROLLER::tick(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.hpp deleted file mode 100644 index 9915a615f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/mod.hpp +++ /dev/null @@ -1,13 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include - -// you can subclass GAMECONTROLLER_CTF, GAMECONTROLLER_TDM etc if you want -// todo a modification with their base as well. -class GAMECONTROLLER_MOD : public GAMECONTROLLER -{ -public: - GAMECONTROLLER_MOD(); - virtual void tick(); - // add more virtual functions here if you wish -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.cpp deleted file mode 100644 index 72605000e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include -#include "tdm.hpp" - -GAMECONTROLLER_TDM::GAMECONTROLLER_TDM() -{ - gametype = "TDM"; - game_flags = GAMEFLAG_TEAMS; -} - -int GAMECONTROLLER_TDM::on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon) -{ - GAMECONTROLLER::on_character_death(victim, killer, weapon); - - - if(weapon != WEAPON_GAME) - { - // do team scoring - if(killer == victim->player || killer->team == victim->player->team) - teamscore[killer->team&1]--; // klant arschel - else - teamscore[killer->team&1]++; // good shit - } - - return 0; -} - -void GAMECONTROLLER_TDM::tick() -{ - do_team_score_wincheck(); - GAMECONTROLLER::tick(); -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.hpp deleted file mode 100644 index 51c47ca5e..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gamemodes/tdm.hpp +++ /dev/null @@ -1,12 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - -#include - -class GAMECONTROLLER_TDM : public GAMECONTROLLER -{ -public: - GAMECONTROLLER_TDM(); - - int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon); - virtual void tick(); -}; diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.cpp deleted file mode 100644 index 9e76f14ba..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.cpp +++ /dev/null @@ -1,217 +0,0 @@ - -#include "gameworld.hpp" -#include "entity.hpp" -#include "gamecontext.hpp" - -////////////////////////////////////////////////// -// game world -////////////////////////////////////////////////// -GAMEWORLD::GAMEWORLD() -{ - paused = false; - reset_requested = false; - first_entity = 0x0; - for(int i = 0; i < NUM_ENT_TYPES; i++) - first_entity_types[i] = 0; -} - -GAMEWORLD::~GAMEWORLD() -{ - // delete all entities - while(first_entity) - delete first_entity; -} - -ENTITY *GAMEWORLD::find_first(int type) -{ - return first_entity_types[type]; -} - - -int GAMEWORLD::find_entities(vec2 pos, float radius, ENTITY **ents, int max, int type) -{ - int num = 0; - for(ENTITY *ent = (type<0) ? first_entity : first_entity_types[type]; - ent; ent = (type<0) ? ent->next_entity : ent->next_type_entity) - { - if(distance(ent->pos, pos) < radius+ent->proximity_radius) - { - ents[num] = ent; - num++; - if(num == max) - break; - } - } - - return num; -} - -void GAMEWORLD::insert_entity(ENTITY *ent) -{ - ENTITY *cur = first_entity; - while(cur) - { - dbg_assert(cur != ent, "err"); - cur = cur->next_entity; - } - - // insert it - if(first_entity) - first_entity->prev_entity = ent; - ent->next_entity = first_entity; - ent->prev_entity = 0x0; - first_entity = ent; - - // into typelist aswell - if(first_entity_types[ent->objtype]) - first_entity_types[ent->objtype]->prev_type_entity = ent; - ent->next_type_entity = first_entity_types[ent->objtype]; - ent->prev_type_entity = 0x0; - first_entity_types[ent->objtype] = ent; -} - -void GAMEWORLD::destroy_entity(ENTITY *ent) -{ - ent->marked_for_destroy = true; -} - -void GAMEWORLD::remove_entity(ENTITY *ent) -{ - // not in the list - if(!ent->next_entity && !ent->prev_entity && first_entity != ent) - return; - - // remove - if(ent->prev_entity) - ent->prev_entity->next_entity = ent->next_entity; - else - first_entity = ent->next_entity; - if(ent->next_entity) - ent->next_entity->prev_entity = ent->prev_entity; - - if(ent->prev_type_entity) - ent->prev_type_entity->next_type_entity = ent->next_type_entity; - else - first_entity_types[ent->objtype] = ent->next_type_entity; - if(ent->next_type_entity) - ent->next_type_entity->prev_type_entity = ent->prev_type_entity; - - ent->next_entity = 0; - ent->prev_entity = 0; - ent->next_type_entity = 0; - ent->prev_type_entity = 0; -} - -// -void GAMEWORLD::snap(int snapping_client) -{ - for(ENTITY *ent = first_entity; ent; ent = ent->next_entity) - ent->snap(snapping_client); -} - -void GAMEWORLD::reset() -{ - // reset all entities - for(ENTITY *ent = first_entity; ent; ent = ent->next_entity) - ent->reset(); - remove_entities(); - - game.controller->post_reset(); - remove_entities(); - - reset_requested = false; -} - -void GAMEWORLD::remove_entities() -{ - // destroy objects marked for destruction - ENTITY *ent = first_entity; - while(ent) - { - ENTITY *next = ent->next_entity; - if(ent->marked_for_destroy) - { - remove_entity(ent); - ent->destroy(); - } - ent = next; - } -} - -void GAMEWORLD::tick() -{ - if(reset_requested) - reset(); - - if(!paused) - { - if(game.controller->is_force_balanced()) - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, "Teams have been balanced"); - // update all objects - for(ENTITY *ent = first_entity; ent; ent = ent->next_entity) - ent->tick(); - - for(ENTITY *ent = first_entity; ent; ent = ent->next_entity) - ent->tick_defered(); - } - - remove_entities(); -} - - -// TODO: should be more general -CHARACTER *GAMEWORLD::intersect_character(vec2 pos0, vec2 pos1, float radius, vec2& new_pos, ENTITY *notthis) -{ - // Find other players - float closest_len = distance(pos0, pos1) * 100.0f; - vec2 line_dir = normalize(pos1-pos0); - CHARACTER *closest = 0; - - CHARACTER *p = (CHARACTER *)game.world.find_first(NETOBJTYPE_CHARACTER); - for(; p; p = (CHARACTER *)p->typenext()) - { - if(p == notthis) - continue; - - vec2 intersect_pos = closest_point_on_line(pos0, pos1, p->pos); - float len = distance(p->pos, intersect_pos); - if(len < CHARACTER::phys_size+radius) - { - if(len < closest_len) - { - new_pos = intersect_pos; - closest_len = len; - closest = p; - } - } - } - - return closest; -} - - -CHARACTER *GAMEWORLD::closest_character(vec2 pos, float radius, ENTITY *notthis) -{ - // Find other players - float closest_range = radius*2; - CHARACTER *closest = 0; - - CHARACTER *p = (CHARACTER *)game.world.find_first(NETOBJTYPE_CHARACTER); - for(; p; p = (CHARACTER *)p->typenext()) - { - if(p == notthis) - continue; - - float len = distance(pos, p->pos); - if(len < CHARACTER::phys_size+radius) - { - if(len < closest_range) - { - closest_range = len; - closest = p; - } - } - } - - return closest; -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.hpp deleted file mode 100644 index 4757ad679..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/gameworld.hpp +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GAME_SERVER_GAMEWORLD_H -#define GAME_SERVER_GAMEWORLD_H - -#include - -class ENTITY; -class CHARACTER; - -/* - Class: Game World - Tracks all entities in the game. Propagates tick and - snap calls to all entities. -*/ -class GAMEWORLD -{ - void reset(); - void remove_entities(); - - enum - { - NUM_ENT_TYPES=10, // TODO: are more exact value perhaps? :) - }; - - // TODO: two lists seams kinda not good, shouldn't be needed - ENTITY *first_entity; - ENTITY *first_entity_types[NUM_ENT_TYPES]; - -public: - bool reset_requested; - bool paused; - WORLD_CORE core; - - GAMEWORLD(); - ~GAMEWORLD(); - - ENTITY *find_first() { return first_entity; } - ENTITY *find_first(int type); - - /* - Function: find_entities - Finds entities close to a position and returns them in a list. - - Arguments: - pos - Position. - radius - How close the entities have to be. - ents - Pointer to a list that should be filled with the pointers - to the entities. - max - Number of entities that fits into the ents array. - type - Type of the entities to find. -1 for all types. - - Returns: - Number of entities found and added to the ents array. - */ - int find_entities(vec2 pos, float radius, ENTITY **ents, int max, int type = -1); - - /* - Function: interserct_character - Finds the closest character that intersects the line. - - Arguments: - pos0 - Start position - pos2 - End position - radius - How for from the line the character is allowed to be. - new_pos - Intersection position - notthis - Entity to ignore intersecting with - - Returns: - Returns a pointer to the closest hit or NULL of there is no intersection. - */ - class CHARACTER *intersect_character(vec2 pos0, vec2 pos1, float radius, vec2 &new_pos, class ENTITY *notthis = 0); - - /* - Function: closest_character - Finds the closest character to a specific point. - - Arguments: - pos - The center position. - radius - How far off the character is allowed to be - notthis - Entity to ignore - - Returns: - Returns a pointer to the closest character or NULL if no character is close enough. - */ - class CHARACTER *closest_character(vec2 pos, float radius, ENTITY *notthis); - - /* - Function: insert_entity - Adds an entity to the world. - - Arguments: - entity - Entity to add - */ - void insert_entity(ENTITY *entity); - - /* - Function: remove_entity - Removes an entity from the world. - - Arguments: - entity - Entity to remove - */ - void remove_entity(ENTITY *entity); - - /* - Function: destroy_entity - Destroys an entity in the world. - - Arguments: - entity - Entity to destroy - */ - void destroy_entity(ENTITY *entity); - - /* - Function: snap - Calls snap on all the entities in the world to create - the snapshot. - - Arguments: - snapping_client - ID of the client which snapshot - is being created. - */ - void snap(int snapping_client); - - /* - Function: tick - Calls tick on all the entities in the world to progress - the world to the next tick. - - */ - void tick(); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/hooks.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/hooks.cpp deleted file mode 100644 index 73c03fd62..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/hooks.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include -#include -#include - -#include - -#include -#include -extern "C" -{ - #include -} -#include -#include -#include - -#include - -#include "gamecontext.hpp" -#include "gamemodes/dm.hpp" -#include "gamemodes/tdm.hpp" -#include "gamemodes/ctf.hpp" -#include "gamemodes/mod.hpp" - -TUNING_PARAMS tuning; - -static void check_pure_tuning() -{ - // might not be created yet during start up - if(!game.controller) - return; - - if( strcmp(game.controller->gametype, "DM")==0 || - strcmp(game.controller->gametype, "TDM")==0 || - strcmp(game.controller->gametype, "CTF")==0) - { - TUNING_PARAMS p; - if(memcmp(&p, &tuning, sizeof(TUNING_PARAMS)) != 0) - { - dbg_msg("server", "resetting tuning due to pure server"); - tuning = p; - } - } -} - -struct VOTEOPTION -{ - VOTEOPTION *next; - VOTEOPTION *prev; - char command[1]; -}; - -static HEAP *voteoption_heap = 0; -static VOTEOPTION *voteoption_first = 0; -static VOTEOPTION *voteoption_last = 0; - -void send_tuning_params(int cid) -{ - check_pure_tuning(); - - msg_pack_start(NETMSGTYPE_SV_TUNEPARAMS, MSGFLAG_VITAL); - int *params = (int *)&tuning; - for(unsigned i = 0; i < sizeof(tuning)/sizeof(int); i++) - msg_pack_int(params[i]); - msg_pack_end(); - server_send_msg(cid); -} - -// Server hooks -void mods_client_direct_input(int client_id, void *input) -{ - if(!game.world.paused) - game.players[client_id]->on_direct_input((NETOBJ_PLAYER_INPUT *)input); -} - -void mods_client_predicted_input(int client_id, void *input) -{ - if(!game.world.paused) - game.players[client_id]->on_predicted_input((NETOBJ_PLAYER_INPUT *)input); -} - -// Server hooks -void mods_tick() -{ - check_pure_tuning(); - - game.tick(); - -#ifdef CONF_DEBUG - if(config.dbg_dummies) - { - for(int i = 0; i < config.dbg_dummies ; i++) - { - NETOBJ_PLAYER_INPUT input = {0}; - input.direction = (i&1)?-1:1; - game.players[MAX_CLIENTS-i-1]->on_predicted_input(&input); - } - } -#endif -} - -void mods_snap(int client_id) -{ - game.snap(client_id); -} - -void mods_client_enter(int client_id) -{ - //game.world.insert_entity(&game.players[client_id]); - game.players[client_id]->respawn(); - dbg_msg("game", "join player='%d:%s'", client_id, server_clientname(client_id)); - - - char buf[512]; - str_format(buf, sizeof(buf), "%s entered and joined the %s", server_clientname(client_id), game.controller->get_team_name(game.players[client_id]->team)); - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf); - - dbg_msg("game", "team_join player='%d:%s' team=%d", client_id, server_clientname(client_id), game.players[client_id]->team); -} - -void mods_connected(int client_id) -{ - game.players[client_id] = new(client_id) PLAYER(client_id); - //game.players[client_id].init(client_id); - //game.players[client_id].client_id = client_id; - - // Check which team the player should be on - if(config.sv_tournament_mode) - game.players[client_id]->team = -1; - else - game.players[client_id]->team = game.controller->get_auto_team(client_id); - - (void) game.controller->check_team_balance(); - - // send motd - NETMSG_SV_MOTD msg; - msg.message = config.sv_motd; - msg.pack(MSGFLAG_VITAL); - server_send_msg(client_id); -} - -void mods_client_drop(int client_id) -{ - game.abort_vote_kick_on_disconnect(client_id); - game.players[client_id]->on_disconnect(); - delete game.players[client_id]; - game.players[client_id] = 0; - - (void) game.controller->check_team_balance(); -} - -/*static bool is_separator(char c) { return c == ';' || c == ' ' || c == ',' || c == '\t'; } - -static const char *liststr_find(const char *str, const char *needle) -{ - int needle_len = strlen(needle); - while(*str) - { - int wordlen = 0; - while(str[wordlen] && !is_separator(str[wordlen])) - wordlen++; - - if(wordlen == needle_len && strncmp(str, needle, needle_len) == 0) - return str; - - str += wordlen+1; - } - - return 0; -}*/ - -void mods_message(int msgtype, int client_id) -{ - void *rawmsg = netmsg_secure_unpack(msgtype); - PLAYER *p = game.players[client_id]; - - if(!rawmsg) - { - dbg_msg("server", "dropped weird message '%s' (%d), failed on '%s'", netmsg_get_name(msgtype), msgtype, netmsg_failed_on()); - return; - } - - if(msgtype == NETMSGTYPE_CL_SAY) - { - NETMSG_CL_SAY *msg = (NETMSG_CL_SAY *)rawmsg; - int team = msg->team; - if(team) - team = p->team; - else - team = GAMECONTEXT::CHAT_ALL; - - if(config.sv_spamprotection && p->last_chat+time_freq() > time_get()) - return; - - p->last_chat = time_get(); - - game.send_chat(client_id, team, msg->message); - } - else if(msgtype == NETMSGTYPE_CL_CALLVOTE) - { - int64 now = time_get(); - if(game.vote_closetime) - { - game.send_chat_target(client_id, "Wait for current vote to end before calling a new one."); - return; - } - - int64 timeleft = p->last_votecall + time_freq()*60 - now; - if(timeleft > 0) - { - char chatmsg[512] = {0}; - str_format(chatmsg, sizeof(chatmsg), "You must wait %d seconds before making another vote", (timeleft/time_freq())+1); - game.send_chat_target(client_id, chatmsg); - return; - } - - char chatmsg[512] = {0}; - char desc[512] = {0}; - char cmd[512] = {0}; - NETMSG_CL_CALLVOTE *msg = (NETMSG_CL_CALLVOTE *)rawmsg; - if(str_comp_nocase(msg->type, "option") == 0) - { - VOTEOPTION *option = voteoption_first; - while(option) - { - if(str_comp_nocase(msg->value, option->command) == 0) - { - str_format(chatmsg, sizeof(chatmsg), "%s called vote to change server option '%s'", server_clientname(client_id), option->command); - str_format(desc, sizeof(desc), "%s", option->command); - str_format(cmd, sizeof(cmd), "%s", option->command); - break; - } - - option = option->next; - } - - if(!option) - { - str_format(chatmsg, sizeof(chatmsg), "'%s' isn't an option on this server", msg->value); - game.send_chat_target(client_id, chatmsg); - return; - } - } - else if(str_comp_nocase(msg->type, "kick") == 0) - { - if(!config.sv_vote_kick) - { - game.send_chat_target(client_id, "Server does not allow voting to kick players"); - return; - } - - int kick_id = atoi(msg->value); - if(kick_id < 0 || kick_id >= MAX_CLIENTS || !game.players[kick_id]) - { - game.send_chat_target(client_id, "Invalid client id to kick"); - return; - } - - str_format(chatmsg, sizeof(chatmsg), "Vote called to kick '%s'", server_clientname(kick_id)); - str_format(desc, sizeof(desc), "Kick '%s'", server_clientname(kick_id)); - str_format(cmd, sizeof(cmd), "kick %d", kick_id); - if (!config.sv_vote_kick_bantime) - str_format(cmd, sizeof(cmd), "kick %d", kick_id); - else - str_format(cmd, sizeof(cmd), "ban %d %d", kick_id, config.sv_vote_kick_bantime); - } - - if(cmd[0]) - { - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, chatmsg); - game.start_vote(desc, cmd); - p->vote = 1; - game.vote_creator = client_id; - p->last_votecall = now; - game.send_vote_status(-1); - } - } - else if(msgtype == NETMSGTYPE_CL_VOTE) - { - if(!game.vote_closetime) - return; - - if(p->vote == 0) - { - NETMSG_CL_VOTE *msg = (NETMSG_CL_VOTE *)rawmsg; - p->vote = msg->vote; - game.send_vote_status(-1); - } - } - else if (msgtype == NETMSGTYPE_CL_SETTEAM && !game.world.paused) - { - NETMSG_CL_SETTEAM *msg = (NETMSG_CL_SETTEAM *)rawmsg; - - if(p->team == msg->team || (config.sv_spamprotection && p->last_setteam+time_freq()*3 > time_get())) - return; - - // Switch team on given client and kill/respawn him - if(game.controller->can_join_team(msg->team, client_id)) - { - if(game.controller->can_change_team(p, msg->team)) - { - p->last_setteam = time_get(); - p->set_team(msg->team); - (void) game.controller->check_team_balance(); - } - else - game.send_broadcast("Teams must be balanced, please join other team", client_id); - } - else - { - char buf[128]; - str_format(buf, sizeof(buf), "Only %d active players are allowed", config.sv_max_clients-config.sv_spectator_slots); - game.send_broadcast(buf, client_id); - } - } - else if (msgtype == NETMSGTYPE_CL_CHANGEINFO || msgtype == NETMSGTYPE_CL_STARTINFO) - { - NETMSG_CL_CHANGEINFO *msg = (NETMSG_CL_CHANGEINFO *)rawmsg; - - if(config.sv_spamprotection && p->last_changeinfo+time_freq()*5 > time_get()) - return; - - p->last_changeinfo = time_get(); - - p->use_custom_color = msg->use_custom_color; - p->color_body = msg->color_body; - p->color_feet = msg->color_feet; - - // check for invalid chars - unsigned char *name = (unsigned char *)msg->name; - while (*name) - { - if(*name < 32) - *name = ' '; - name++; - } - - // copy old name - char oldname[MAX_NAME_LENGTH]; - str_copy(oldname, server_clientname(client_id), MAX_NAME_LENGTH); - - server_setclientname(client_id, msg->name); - if(msgtype == NETMSGTYPE_CL_CHANGEINFO && strcmp(oldname, server_clientname(client_id)) != 0) - { - char chattext[256]; - str_format(chattext, sizeof(chattext), "%s changed name to %s", oldname, server_clientname(client_id)); - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, chattext); - } - - // set skin - str_copy(p->skin_name, msg->skin, sizeof(p->skin_name)); - - game.controller->on_player_info_change(p); - - if(msgtype == NETMSGTYPE_CL_STARTINFO) - { - // send vote options - NETMSG_SV_VOTE_CLEAROPTIONS clearmsg; - clearmsg.pack(MSGFLAG_VITAL); - server_send_msg(client_id); - VOTEOPTION *current = voteoption_first; - while(current) - { - NETMSG_SV_VOTE_OPTION optionmsg; - optionmsg.command = current->command; - optionmsg.pack(MSGFLAG_VITAL); - server_send_msg(client_id); - current = current->next; - } - - // send tuning parameters to client - send_tuning_params(client_id); - - // - NETMSG_SV_READYTOENTER m; - m.pack(MSGFLAG_VITAL|MSGFLAG_FLUSH); - server_send_msg(client_id); - } - } - else if (msgtype == NETMSGTYPE_CL_EMOTICON && !game.world.paused) - { - NETMSG_CL_EMOTICON *msg = (NETMSG_CL_EMOTICON *)rawmsg; - - if(config.sv_spamprotection && p->last_emote+time_freq()*3 > time_get()) - return; - - p->last_emote = time_get(); - - game.send_emoticon(client_id, msg->emoticon); - } - else if (msgtype == NETMSGTYPE_CL_KILL && !game.world.paused) - { - if(p->last_kill+time_freq()*3 > time_get()) - return; - - p->last_kill = time_get(); - p->kill_character(WEAPON_SELF); - p->respawn_tick = server_tick()+server_tickspeed()*3; - } -} - -static void con_tune_param(void *result, void *user_data) -{ - const char *param_name = console_arg_string(result, 0); - float new_value = console_arg_float(result, 1); - - if(tuning.set(param_name, new_value)) - { - dbg_msg("tuning", "%s changed to %.2f", param_name, new_value); - send_tuning_params(-1); - } - else - console_print("No such tuning parameter"); -} - -static void con_tune_reset(void *result, void *user_data) -{ - TUNING_PARAMS p; - tuning = p; - send_tuning_params(-1); - console_print("tuning reset"); -} - -static void con_tune_dump(void *result, void *user_data) -{ - for(int i = 0; i < tuning.num(); i++) - { - float v; - tuning.get(i, &v); - dbg_msg("tuning", "%s %.2f", tuning.names[i], v); - } -} - - -static void con_change_map(void *result, void *user_data) -{ - game.controller->change_map(console_arg_string(result, 0)); -} - -static void con_restart(void *result, void *user_data) -{ - if(console_arg_num(result)) - game.controller->do_warmup(console_arg_int(result, 0)); - else - game.controller->startround(); -} - -static void con_broadcast(void *result, void *user_data) -{ - game.send_broadcast(console_arg_string(result, 0), -1); -} - -static void con_say(void *result, void *user_data) -{ - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, console_arg_string(result, 0)); -} - -static void con_set_team(void *result, void *user_data) -{ - int client_id = clamp(console_arg_int(result, 0), 0, (int)MAX_CLIENTS - 1); - int team = clamp(console_arg_int(result, 1), -1, 1); - - dbg_msg("", "%d %d", client_id, team); - - if(!game.players[client_id]) - return; - - game.players[client_id]->set_team(team); - (void) game.controller->check_team_balance(); -} - -static void con_addvote(void *result, void *user_data) -{ - int len = strlen(console_arg_string(result, 0)); - - if(!voteoption_heap) - voteoption_heap = memheap_create(); - - VOTEOPTION *option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len); - option->next = 0; - option->prev = voteoption_last; - if(option->prev) - option->prev->next = option; - voteoption_last = option; - if(!voteoption_first) - voteoption_first = option; - - mem_copy(option->command, console_arg_string(result, 0), len+1); - dbg_msg("server", "added option '%s'", option->command); -} - -static void con_vote(void *result, void *user_data) -{ - if(str_comp_nocase(console_arg_string(result, 0), "yes") == 0) - game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_YES; - else if(str_comp_nocase(console_arg_string(result, 0), "no") == 0) - game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_NO; - dbg_msg("server", "forcing vote %s", console_arg_string(result, 0)); -} - -void mods_console_init() -{ - MACRO_REGISTER_COMMAND("tune", "si", CFGFLAG_SERVER, con_tune_param, 0, ""); - MACRO_REGISTER_COMMAND("tune_reset", "", CFGFLAG_SERVER, con_tune_reset, 0, ""); - MACRO_REGISTER_COMMAND("tune_dump", "", CFGFLAG_SERVER, con_tune_dump, 0, ""); - - MACRO_REGISTER_COMMAND("change_map", "r", CFGFLAG_SERVER, con_change_map, 0, ""); - MACRO_REGISTER_COMMAND("restart", "?i", CFGFLAG_SERVER, con_restart, 0, ""); - MACRO_REGISTER_COMMAND("broadcast", "r", CFGFLAG_SERVER, con_broadcast, 0, ""); - MACRO_REGISTER_COMMAND("say", "r", CFGFLAG_SERVER, con_say, 0, ""); - MACRO_REGISTER_COMMAND("set_team", "ii", CFGFLAG_SERVER, con_set_team, 0, ""); - - MACRO_REGISTER_COMMAND("addvote", "r", CFGFLAG_SERVER, con_addvote, 0, ""); - MACRO_REGISTER_COMMAND("vote", "r", CFGFLAG_SERVER, con_vote, 0, ""); -} - -void mods_init() -{ - //if(!data) /* only load once */ - //data = load_data_from_memory(internal_data); - - for(int i = 0; i < NUM_NETOBJTYPES; i++) - snap_set_staticsize(i, netobj_get_size(i)); - - layers_init(); - col_init(); - - // reset everything here - //world = new GAMEWORLD; - //players = new PLAYER[MAX_CLIENTS]; - - // select gametype - if(strcmp(config.sv_gametype, "mod") == 0) - game.controller = new GAMECONTROLLER_MOD; - else if(strcmp(config.sv_gametype, "ctf") == 0) - game.controller = new GAMECONTROLLER_CTF; - else if(strcmp(config.sv_gametype, "tdm") == 0) - game.controller = new GAMECONTROLLER_TDM; - else - game.controller = new GAMECONTROLLER_DM; - - // setup core world - //for(int i = 0; i < MAX_CLIENTS; i++) - // game.players[i].core.world = &game.world.core; - - // create all entities from the game layer - MAPITEM_LAYER_TILEMAP *tmap = layers_game_layer(); - TILE *tiles = (TILE *)map_get_data(tmap->data); - - /* - num_spawn_points[0] = 0; - num_spawn_points[1] = 0; - num_spawn_points[2] = 0; - */ - - for(int y = 0; y < tmap->height; y++) - { - for(int x = 0; x < tmap->width; x++) - { - int index = tiles[y*tmap->width+x].index; - - if(index >= ENTITY_OFFSET) - { - vec2 pos(x*32.0f+16.0f, y*32.0f+16.0f); - game.controller->on_entity(index-ENTITY_OFFSET, pos); - } - } - } - - //game.world.insert_entity(game.controller); - -#ifdef CONF_DEBUG - if(config.dbg_dummies) - { - for(int i = 0; i < config.dbg_dummies ; i++) - { - mods_connected(MAX_CLIENTS-i-1); - mods_client_enter(MAX_CLIENTS-i-1); - if(game.controller->is_teamplay()) - game.players[MAX_CLIENTS-i-1]->team = i&1; - } - } -#endif -} - -void mods_shutdown() -{ - delete game.controller; - game.controller = 0; - game.clear(); -} - -void mods_presnap() {} -void mods_postsnap() -{ - game.events.clear(); -} - -extern "C" const char *mods_net_version() { return GAME_NETVERSION; } -extern "C" const char *mods_version() { return GAME_VERSION; } diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/player.cpp b/project/jni/application/teeworlds-0.5.2/src/game/server/player.cpp deleted file mode 100644 index a0a2b051f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/player.cpp +++ /dev/null @@ -1,183 +0,0 @@ -#include - -#include - -#include "player.hpp" -#include "gamecontext.hpp" - -MACRO_ALLOC_POOL_ID_IMPL(PLAYER, MAX_CLIENTS) - -PLAYER::PLAYER(int client_id) -{ - respawn_tick = server_tick(); - character = 0; - this->client_id = client_id; -} - -PLAYER::~PLAYER() -{ - delete character; - character = 0; -} - -void PLAYER::tick() -{ - server_setclientscore(client_id, score); - - // do latency stuff - { - CLIENT_INFO info; - if(server_getclientinfo(client_id, &info)) - { - latency.accum += info.latency; - latency.accum_max = max(latency.accum_max, info.latency); - latency.accum_min = min(latency.accum_min, info.latency); - } - - if(server_tick()%server_tickspeed() == 0) - { - latency.avg = latency.accum/server_tickspeed(); - latency.max = latency.accum_max; - latency.min = latency.accum_min; - latency.accum = 0; - latency.accum_min = 1000; - latency.accum_max = 0; - } - } - - if(!character && die_tick+server_tickspeed()*3 <= server_tick()) - spawning = true; - - if(character) - { - if(character->alive) - { - view_pos = character->pos; - } - else - { - delete character; - character = 0; - } - } - else if(spawning && respawn_tick <= server_tick()) - try_respawn(); -} - -void PLAYER::snap(int snapping_client) -{ - NETOBJ_CLIENT_INFO *client_info = (NETOBJ_CLIENT_INFO *)snap_new_item(NETOBJTYPE_CLIENT_INFO, client_id, sizeof(NETOBJ_CLIENT_INFO)); - str_to_ints(&client_info->name0, 6, server_clientname(client_id)); - str_to_ints(&client_info->skin0, 6, skin_name); - client_info->use_custom_color = use_custom_color; - client_info->color_body = color_body; - client_info->color_feet = color_feet; - - NETOBJ_PLAYER_INFO *info = (NETOBJ_PLAYER_INFO *)snap_new_item(NETOBJTYPE_PLAYER_INFO, client_id, sizeof(NETOBJ_PLAYER_INFO)); - - info->latency = latency.min; - info->latency_flux = latency.max-latency.min; - info->local = 0; - info->cid = client_id; - info->score = score; - info->team = team; - - if(client_id == snapping_client) - info->local = 1; -} - -void PLAYER::on_disconnect() -{ - kill_character(WEAPON_GAME); - - //game.controller->on_player_death(&game.players[client_id], 0, -1); - - char buf[512]; - str_format(buf, sizeof(buf), "%s has left the game", server_clientname(client_id)); - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf); - - dbg_msg("game", "leave player='%d:%s'", client_id, server_clientname(client_id)); -} - -void PLAYER::on_predicted_input(NETOBJ_PLAYER_INPUT *new_input) -{ - CHARACTER *chr = get_character(); - if(chr) - chr->on_predicted_input(new_input); -} - -void PLAYER::on_direct_input(NETOBJ_PLAYER_INPUT *new_input) -{ - CHARACTER *chr = get_character(); - if(chr) - chr->on_direct_input(new_input); - - if(!chr && team >= 0 && (new_input->fire&1)) - spawning = true; - - if(!chr && team == -1) - view_pos = vec2(new_input->target_x, new_input->target_y); -} - -CHARACTER *PLAYER::get_character() -{ - if(character && character->alive) - return character; - return 0; -} - -void PLAYER::kill_character(int weapon) -{ - //CHARACTER *chr = get_character(); - if(character) - { - character->die(client_id, weapon); - delete character; - character = 0; - } -} - -void PLAYER::respawn() -{ - if(team > -1) - spawning = true; -} - -void PLAYER::set_team(int new_team) -{ - // clamp the team - new_team = game.controller->clampteam(new_team); - if(team == new_team) - return; - - char buf[512]; - str_format(buf, sizeof(buf), "%s joined the %s", server_clientname(client_id), game.controller->get_team_name(new_team)); - game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf); - - kill_character(WEAPON_GAME); - team = new_team; - score = 0; - dbg_msg("game", "team_join player='%d:%s' team=%d", client_id, server_clientname(client_id), team); - - game.controller->on_player_info_change(game.players[client_id]); -} - -void PLAYER::try_respawn() -{ - vec2 spawnpos = vec2(100.0f, -60.0f); - - if(!game.controller->can_spawn(this, &spawnpos)) - return; - - // check if the position is occupado - ENTITY *ents[2] = {0}; - int num_ents = game.world.find_entities(spawnpos, 64, ents, 2, NETOBJTYPE_CHARACTER); - - if(num_ents == 0) - { - spawning = false; - character = new(client_id) CHARACTER(); - character->spawn(this, spawnpos, team); - game.create_playerspawn(spawnpos); - } -} diff --git a/project/jni/application/teeworlds-0.5.2/src/game/server/player.hpp b/project/jni/application/teeworlds-0.5.2/src/game/server/player.hpp deleted file mode 100644 index e93aee01f..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/server/player.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef GAME_SERVER_PLAYER_H -#define GAME_SERVER_PLAYER_H - -// this include should perhaps be removed -#include "entities/character.hpp" - -// player object -class PLAYER -{ - MACRO_ALLOC_POOL_ID() -private: - CHARACTER *character; -public: - PLAYER(int client_id); - ~PLAYER(); - - // TODO: clean this up - char skin_name[64]; - int use_custom_color; - int color_body; - int color_feet; - - int respawn_tick; - int die_tick; - // - bool spawning; - int client_id; - int team; - int score; - bool force_balanced; - - // - int vote; - int64 last_votecall; - - // - int64 last_chat; - int64 last_setteam; - int64 last_changeinfo; - int64 last_emote; - int64 last_kill; - - // network latency calculations - struct - { - int accum; - int accum_min; - int accum_max; - int avg; - int min; - int max; - } latency; - - // this is used for snapping so we know how we can clip the view for the player - vec2 view_pos; - - void init(int client_id); - - CHARACTER *get_character(); - - void kill_character(int weapon); - - void try_respawn(); - void respawn(); - void set_team(int team); - - void tick(); - void snap(int snapping_client); - - void on_direct_input(NETOBJ_PLAYER_INPUT *new_input); - void on_predicted_input(NETOBJ_PLAYER_INPUT *new_input); - void on_disconnect(); -}; - -#endif diff --git a/project/jni/application/teeworlds-0.5.2/src/game/tuning.hpp b/project/jni/application/teeworlds-0.5.2/src/game/tuning.hpp deleted file mode 100644 index 4554a8eb5..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/tuning.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* physics tuning */ -MACRO_TUNING_PARAM(ground_control_speed, 10.0f) -MACRO_TUNING_PARAM(ground_control_accel, 100.0f / ticks_per_second) -MACRO_TUNING_PARAM(ground_friction, 0.5f) -MACRO_TUNING_PARAM(ground_jump_impulse, 13.2f) -MACRO_TUNING_PARAM(air_jump_impulse, 12.0f) -MACRO_TUNING_PARAM(air_control_speed, 250.0f / ticks_per_second) -MACRO_TUNING_PARAM(air_control_accel, 1.5f) -MACRO_TUNING_PARAM(air_friction, 0.95f) -MACRO_TUNING_PARAM(hook_length, 380.0f) -MACRO_TUNING_PARAM(hook_fire_speed, 80.0f) -MACRO_TUNING_PARAM(hook_drag_accel, 3.0f) -MACRO_TUNING_PARAM(hook_drag_speed, 15.0f) -MACRO_TUNING_PARAM(gravity, 0.5f) - -MACRO_TUNING_PARAM(velramp_start, 550) -MACRO_TUNING_PARAM(velramp_range, 2000) -MACRO_TUNING_PARAM(velramp_curvature, 1.4f) - -/* weapon tuning */ -MACRO_TUNING_PARAM(gun_curvature, 1.25f) -MACRO_TUNING_PARAM(gun_speed, 2200.0f) -MACRO_TUNING_PARAM(gun_lifetime, 2.0f) - -MACRO_TUNING_PARAM(shotgun_curvature, 1.25f) -MACRO_TUNING_PARAM(shotgun_speed, 2750.0f) -MACRO_TUNING_PARAM(shotgun_speeddiff, 0.8f) -MACRO_TUNING_PARAM(shotgun_lifetime, 0.20f) - -MACRO_TUNING_PARAM(grenade_curvature, 7.0f) -MACRO_TUNING_PARAM(grenade_speed, 1000.0f) -MACRO_TUNING_PARAM(grenade_lifetime, 2.0f) - -MACRO_TUNING_PARAM(laser_reach, 800.0f) -MACRO_TUNING_PARAM(laser_bounce_delay, 150) -MACRO_TUNING_PARAM(laser_bounce_num, 1) -MACRO_TUNING_PARAM(laser_bounce_cost, 0) -MACRO_TUNING_PARAM(laser_damage, 5) - -MACRO_TUNING_PARAM(player_collision, 1) -MACRO_TUNING_PARAM(player_hooking, 1) diff --git a/project/jni/application/teeworlds-0.5.2/src/game/variables.hpp b/project/jni/application/teeworlds-0.5.2/src/game/variables.hpp deleted file mode 100644 index f78b168d4..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/variables.hpp +++ /dev/null @@ -1,74 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - - -/* client */ -MACRO_CONFIG_INT(cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements") -MACRO_CONFIG_INT(cl_nameplates, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates") -MACRO_CONFIG_INT(cl_nameplates_always, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance") -MACRO_CONFIG_INT(cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup") - -MACRO_CONFIG_INT(cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter") - -MACRO_CONFIG_INT(cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") -MACRO_CONFIG_INT(cl_threadsoundloading, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") - -MACRO_CONFIG_INT(cl_warning_teambalance, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Warn about team balance") - -MACRO_CONFIG_INT(cl_mouse_deadzone, 300, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") -MACRO_CONFIG_INT(cl_mouse_followfactor, 60, 0, 200, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") -MACRO_CONFIG_INT(cl_mouse_max_distance, 800, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") - -MACRO_CONFIG_INT(ed_showkeys, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") - -MACRO_CONFIG_INT(cl_flow, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") - -MACRO_CONFIG_INT(cl_show_welcome, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "") -MACRO_CONFIG_INT(cl_motd_time, 10, 0, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "How long to show the server message of the day") - -MACRO_CONFIG_STR(cl_version_server, 100, "version.teeworlds.com", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Server to use to check for new versions") - -MACRO_CONFIG_INT(player_use_custom_color, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toggles usage of custom colors") -MACRO_CONFIG_INT(player_color_body, 65408, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player body color") -MACRO_CONFIG_INT(player_color_feet, 65408, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player feet color") -MACRO_CONFIG_STR(player_skin, 64, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Player skin") - -MACRO_CONFIG_INT(ui_page, 5, 0, 9, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page") -MACRO_CONFIG_INT(ui_toolbox_page, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page") -MACRO_CONFIG_STR(ui_server_address, 128, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address") -MACRO_CONFIG_INT(ui_scale, 100, 1, 100000, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale") - -MACRO_CONFIG_INT(ui_color_hue, 160, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color hue") -MACRO_CONFIG_INT(ui_color_sat, 70, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color saturation") -MACRO_CONFIG_INT(ui_color_lht, 175, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color lightness") -MACRO_CONFIG_INT(ui_color_alpha, 228, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface alpha") - -MACRO_CONFIG_INT(gfx_noclip, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Disable clipping") - -/* server */ -MACRO_CONFIG_INT(sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of seconds to do warpup before round starts") -MACRO_CONFIG_STR(sv_motd, 900, "", CFGFLAG_SERVER, "Message of the day to display for the clients") -MACRO_CONFIG_INT(sv_teamdamage, 0, 0, 1, CFGFLAG_SERVER, "Team damage") -MACRO_CONFIG_STR(sv_maprotation, 768, "", CFGFLAG_SERVER, "Maps to rotate between") -MACRO_CONFIG_INT(sv_rounds_per_map, 1, 1, 100, CFGFLAG_SERVER, "Number of rounds on each map before rotating") -MACRO_CONFIG_INT(sv_powerups, 1, 0, 1, CFGFLAG_SERVER, "Allow powerups like ninja") -MACRO_CONFIG_INT(sv_scorelimit, 20, 0, 1000, CFGFLAG_SERVER, "Score limit (0 disables)") -MACRO_CONFIG_INT(sv_timelimit, 0, 0, 1000, CFGFLAG_SERVER, "Time limit in minutes (0 disables)") -MACRO_CONFIG_STR(sv_gametype, 32, "dm", CFGFLAG_SERVER, "Game type (dm, tdm, ctf)") -MACRO_CONFIG_INT(sv_tournament_mode, 0, 0, 1, CFGFLAG_SERVER, "Tournament mode. When enabled, players joins the server as spectator") -MACRO_CONFIG_INT(sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection") - -MACRO_CONFIG_INT(sv_spectator_slots, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Number of slots to reserve for spectators") -MACRO_CONFIG_INT(sv_teambalance_time, 1, 0, 1000, CFGFLAG_SERVER, "How many minutes to wait before autobalancing teams") - -MACRO_CONFIG_INT(sv_vote_kick, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to kick players") -MACRO_CONFIG_INT(sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time to ban a player if kicked by vote. 0 makes it just use kick") -MACRO_CONFIG_INT(sv_vote_scorelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change score limit") -MACRO_CONFIG_INT(sv_vote_timelimit, 0, 0, 1, CFGFLAG_SERVER, "Allow voting to change time limit") - -/* debug */ -#ifdef CONF_DEBUG /* this one can crash the server if not used correctly */ - MACRO_CONFIG_INT(dbg_dummies, 0, 0, 15, CFGFLAG_SERVER, "") -#endif - -MACRO_CONFIG_INT(dbg_focus, 0, 0, 1, CFGFLAG_CLIENT, "") -MACRO_CONFIG_INT(dbg_tuning, 0, 0, 1, CFGFLAG_CLIENT, "") diff --git a/project/jni/application/teeworlds-0.5.2/src/game/version.hpp b/project/jni/application/teeworlds-0.5.2/src/game/version.hpp deleted file mode 100644 index 99628b856..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/game/version.hpp +++ /dev/null @@ -1,4 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "generated/nethash.c" -#define GAME_VERSION "0.5.2" -#define GAME_NETVERSION "0.5 " GAME_NETVERSION_HASH diff --git a/project/jni/application/teeworlds-0.5.2/src/mastersrv/mastersrv.h b/project/jni/application/teeworlds-0.5.2/src/mastersrv/mastersrv.h deleted file mode 100644 index cfac2e715..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/mastersrv/mastersrv.h +++ /dev/null @@ -1,27 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -static const int MASTERSERVER_PORT = 8300; - -typedef struct MASTERSRV_ADDR -{ - unsigned char ip[4]; - unsigned char port[2]; -} MASTERSRV_ADDR; - -static const unsigned char SERVERBROWSE_HEARTBEAT[] = {255, 255, 255, 255, 'b', 'e', 'a', 't'}; - -static const unsigned char SERVERBROWSE_GETLIST[] = {255, 255, 255, 255, 'r', 'e', 'q', 't'}; -static const unsigned char SERVERBROWSE_LIST[] = {255, 255, 255, 255, 'l', 'i', 's', 't'}; - -static const unsigned char SERVERBROWSE_GETCOUNT[] = {255, 255, 255, 255, 'c', 'o', 'u', 'n'}; -static const unsigned char SERVERBROWSE_COUNT[] = {255, 255, 255, 255, 's', 'i', 'z', 'e'}; - -static const unsigned char SERVERBROWSE_GETINFO[] = {255, 255, 255, 255, 'g', 'i', 'e', '2'}; -static const unsigned char SERVERBROWSE_INFO[] = {255, 255, 255, 255, 'i', 'n', 'f', '2'}; - -static const unsigned char SERVERBROWSE_OLD_GETINFO[] = {255, 255, 255, 255, 'g', 'i', 'e', 'f'}; -static const unsigned char SERVERBROWSE_OLD_INFO[] = {255, 255, 255, 255, 'i', 'n', 'f', 'o'}; - -static const unsigned char SERVERBROWSE_FWCHECK[] = {255, 255, 255, 255, 'f', 'w', '?', '?'}; -static const unsigned char SERVERBROWSE_FWRESPONSE[] = {255, 255, 255, 255, 'f', 'w', '!', '!'}; -static const unsigned char SERVERBROWSE_FWOK[] = {255, 255, 255, 255, 'f', 'w', 'o', 'k'}; -static const unsigned char SERVERBROWSE_FWERROR[] = {255, 255, 255, 255, 'f', 'w', 'e', 'r'}; diff --git a/project/jni/application/teeworlds-0.5.2/src/versionsrv/versionsrv.h b/project/jni/application/teeworlds-0.5.2/src/versionsrv/versionsrv.h deleted file mode 100644 index 298f6c275..000000000 --- a/project/jni/application/teeworlds-0.5.2/src/versionsrv/versionsrv.h +++ /dev/null @@ -1,7 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -static const int VERSIONSRV_PORT = 8302; - -static const unsigned char VERSION_DATA[] = {0x00, 0, 5, 1}; - -static const unsigned char VERSIONSRV_GETVERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 'g'}; -static const unsigned char VERSIONSRV_VERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 's'}; diff --git a/project/jni/application/teeworlds/AndroidAppSettings.cfg b/project/jni/application/teeworlds/AndroidAppSettings.cfg index b9c7d075b..d885c858b 100644 --- a/project/jni/application/teeworlds/AndroidAppSettings.cfg +++ b/project/jni/application/teeworlds/AndroidAppSettings.cfg @@ -1,54 +1,215 @@ # The application settings for Android libSDL port -AppSettingVersion=17 + +AppSettingVersion=19 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) AppName="TeeWorlds" + +# Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=com.teeworlds + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h -InhibitSuspend=n + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=y + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS AppDataDownloadUrl="Game data|data.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=24 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) SwVideoMode=n + +# Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=n + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) ForceRelativeMouseMode=n -AppNeedsArrowKeys=y + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) +AppNeedsArrowKeys=n + +# Application needs text input (y) or (n), enables button for text input on screen AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=y + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP" + +# Number of virtual keyboard keys (currently 6 is maximum) AppTouchscreenKeyboardKeysAmount=4 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) AppTouchscreenKeyboardKeysAmountAutoFire=0 -RedefinedKeysScreenKb="SPACE RETURN LEFT RIGHT RSHIFT LSHIFT" + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) +RedefinedKeysScreenKb="SPACE PAGEDOWN PAGEUP TAB RCTRL RETURN" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="Jump Next_weapon Previous_weapon Show_scores Fire Hook" + +# How long to show startup menu button, in msec, 0 to disable startup menu StartupMenuButtonTimeout=3000 -HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig' + +# Menu items to hide from startup menu, available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout +HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default +# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() +# Available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout FirstStartMenuOptions='' -MultiABI=n + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 -AppVersionCode=06108 -AppVersionName="0.6.1.08" + +# Application version code (integer) +AppVersionCode=06212 + +# Application user-visible version name (string) +AppVersionName="0.6.2.12" + +# Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=y + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) DeleteFilesOnUpgrade="data .teeworlds" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 CompiledLibraries="sdl_image freetype glu" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=n + +# Aditional CFLAGS for application AppCflags='-O3' + +# Additional LDFLAGS for application AppLdflags='-lEGL' -AppSubdirsBuild='src/src src/src/base src/src/engine src/src/engine/client src/src/engine/shared src/src/engine/external/pnglite src/src/engine/external/wavpack src/src/game src/src/game/client/* src/src/game/editor src/src/game/generated/protocol.cpp src/src/game/generated/client_data.cpp' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders=n + +# Build only following subdirs (empty will build all dirs, ignored with custom script) +AppSubdirsBuild='src/src src/src/base/system.c src/src/engine src/src/engine/client src/src/engine/shared src/src/engine/external/pnglite src/src/engine/external/wavpack src/src/game src/src/game/client/* src/src/game/editor src/src/game/generated/protocol.cpp src/src/game/generated/client_data.cpp' + +# Exclude these files from build +AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param AppCmdline='' -ReadmeText='^You may press "Home" now - the data will be downloaded in background' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) +ReadmeText='Tap left joystick to launch hook\\\\nSwipe left joystick up or down to jump' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge MinimumScreenSize=n + +# Your AdMob Publisher ID, (n) if you don't want advertisements AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize= + diff --git a/project/jni/application/teeworlds/AndroidPreBuild.sh b/project/jni/application/teeworlds/AndroidPreBuild.sh index 0c08e27af..d91642994 100755 --- a/project/jni/application/teeworlds/AndroidPreBuild.sh +++ b/project/jni/application/teeworlds/AndroidPreBuild.sh @@ -3,10 +3,12 @@ LOCAL_PATH=`dirname $0` LOCAL_PATH=`cd $LOCAL_PATH && pwd` +cd $LOCAL_PATH/src + +[ -n "`find datasrc/*.py -cnewer src/game/generated/protocol.cpp 2>&1`" ] && { echo "Building autogenerated files" python --version > /dev/null 2>&1 || { echo "Error: no Python installed" ; exit 1 ; } -cd $LOCAL_PATH/src python datasrc/compile.py network_source > src/game/generated/protocol.cpp python datasrc/compile.py network_header > src/game/generated/protocol.h python datasrc/compile.py client_content_source > src/game/generated/client_data.cpp @@ -15,10 +17,12 @@ python datasrc/compile.py server_content_source > src/game/generated/server_data python datasrc/compile.py server_content_header > src/game/generated/server_data.h python scripts/cmd5.py src/engine/shared/protocol.h src/game/generated/protocol.h src/game/tuning.h src/game/gamecore.cpp src/game/generated/protocol.h > src/game/generated/nethash.cpp +} +[ -n "`find data *.txt *.cfg -cnewer ../AndroidData/data.zip 2>&1`" ] && { echo "Archiving data" mkdir -p ../AndroidData -zip -r data.zip data *.txt *.cfg >/dev/null -mv -f data.zip ../AndroidData/ +zip -r ../AndroidData/data.zip data *.txt *.cfg >/dev/null +} exit 0 diff --git a/project/jni/application/teeworlds/src b/project/jni/application/teeworlds/src index 0ae7fb766..d15ccc8e9 160000 --- a/project/jni/application/teeworlds/src +++ b/project/jni/application/teeworlds/src @@ -1 +1 @@ -Subproject commit 0ae7fb766949f5d760330b8a252f2d77a7f3c86d +Subproject commit d15ccc8e96d4f0c82d8d85d5e6a053df16ad94eb diff --git a/project/jni/application/test-sndfile/AndroidAppSettings.cfg b/project/jni/application/test-sndfile/AndroidAppSettings.cfg new file mode 100644 index 000000000..7f86d2825 --- /dev/null +++ b/project/jni/application/test-sndfile/AndroidAppSettings.cfg @@ -0,0 +1,215 @@ +# The application settings for Android libSDL port + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) +LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) +AppName="libsndfile test" + +# Specify reversed site name of application (e.x. com.mysite.myapp) +AppFullName=net.olofson.ballfield.sndfile + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape +ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=n + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!Game data is 1 Mb|ballfield3.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) +VideoDepthBpp=16 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) +NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) +SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) +SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) +SdlVideoResizeKeepAspect=y + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) +CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) +CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) +CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) +CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) +CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user +AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) +AppNeedsTwoButtonMouse=y + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) +ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) +ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) +AppNeedsArrowKeys=y + +# Application needs text input (y) or (n), enables button for text input on screen +AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 +AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=y + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 +AppUsesAccelerometer=y + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=y + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 +AppUsesMultitouch=y + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state +NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA +RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" + +# Number of virtual keyboard keys (currently 6 is maximum) +AppTouchscreenKeyboardKeysAmount=6 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) +AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) +RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9" + +# How long to show startup menu button, in msec, 0 to disable startup menu +StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig +HiddenMenuOptions='OptionalDownloadConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), +FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI=n + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower +AppMinimumRAM=0 + +# Application version code (integer) +AppVersionCode=101 + +# Application user-visible version name (string) +AppVersionName="1.01" + +# Reset SDL config when updating application to the new version (y) / (n) +ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) +DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 +CompiledLibraries="sdl_image sndfile" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) +CustomBuildScript=n + +# Aditional CFLAGS for application +AppCflags='-O2 -finline-functions' + +# Additional LDFLAGS for application +AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) +AppSubdirsBuild='' + +# Exclude these files from build +AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param +AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on +ReadmeText='^Readme text' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge +MinimumScreenSize=s + +# Your AdMob Publisher ID, (n) if you don't want advertisements +AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad +AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) +AdmobBannerSize= + diff --git a/project/jni/application/test-sndfile/AndroidData/ballfield3.zip b/project/jni/application/test-sndfile/AndroidData/ballfield3.zip new file mode 100644 index 000000000..0e54321a7 Binary files /dev/null and b/project/jni/application/test-sndfile/AndroidData/ballfield3.zip differ diff --git a/project/jni/application/test-sndfile/ballfield.cpp b/project/jni/application/test-sndfile/ballfield.cpp new file mode 100644 index 000000000..178884734 --- /dev/null +++ b/project/jni/application/test-sndfile/ballfield.cpp @@ -0,0 +1,764 @@ +/* + * "Ballfield" + * + * (C) David Olofson , 2002, 2003 + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__) +#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__) + +/*---------------------------------------------------------- + Definitions... +----------------------------------------------------------*/ + +#define SCREEN_W 640 +#define SCREEN_H 480 + + +#define BALLS 300 + +#define COLORS 2 + +typedef struct +{ + Sint32 x, y, z; /* Position */ + Uint32 c; /* Color */ +} point_t; + + +/* + * Ballfield + */ +typedef struct +{ + point_t points[BALLS]; + SDL_Rect *frames; + SDL_Surface *gfx[COLORS]; + int use_alpha; +} ballfield_t; + + +/* + * Size of the biggest ball image in pixels + * + * Balls are scaled down and *packed*, one pixel + * smaller for each frame down to 1x1. The actual + * image width is (obviously...) the same as the + * width of the first frame. + */ +#define BALL_W 32 +#define BALL_H 32 + + + + +/*---------------------------------------------------------- + General tool functions +----------------------------------------------------------*/ + +/* + * Bump areas of low and high alpha to 0% or 100% + * respectively, just in case the graphics contains + * "alpha noise". + */ +SDL_Surface *clean_alpha(SDL_Surface *s) +{ + SDL_Surface *work; + SDL_Rect r; + Uint32 *pixels; + int pp; + int x, y; + + work = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, + 32, 0xff000000, 0x00ff0000, 0x0000ff00, + 0x000000ff); + if(!work) + return NULL; + + r.x = r.y = 0; + r.w = s->w; + r.h = s->h; + if(SDL_BlitSurface(s, &r, work, NULL) < 0) + { + SDL_FreeSurface(work); + return NULL; + } + + SDL_LockSurface(work); + pixels = (Uint32 *)work->pixels; + pp = work->pitch / sizeof(Uint32); + for(y = 0; y < work->h; ++y) + for(x = 0; x < work->w; ++x) + { + Uint32 pix = pixels[y*pp + x]; + switch((pix & 0xff) >> 4) + { + case 0: + pix = 0x00000000; + break; + default: + break; + case 15: + pix |= 0xff; + break; + } + pixels[y*pp + x] = pix; + } + SDL_UnlockSurface(work); + + return work; +} + + +/* + * Load and convert an antialiazed, zoomed set of sprites. + */ +SDL_Surface *load_zoomed(char *name, int alpha) +{ + SDL_Surface *sprites; + SDL_Surface *temp = IMG_Load(name); + if(!temp) + return NULL; + + /* + sprites = temp; + SDL_SetAlpha(sprites, 0, 255); + temp = clean_alpha(sprites); + SDL_FreeSurface(sprites); + */ + if(!temp) + { + fprintf(stderr, "Could not clean alpha!\n"); + return NULL; + } + + if(alpha) + { + SDL_SetAlpha(temp, 0, SDL_ALPHA_OPAQUE); + sprites = SDL_DisplayFormatAlpha(temp); + } + else + { + SDL_SetColorKey(temp, SDL_SRCCOLORKEY, + SDL_MapRGB(temp->format, 0, 0, 0)); + sprites = SDL_DisplayFormat(temp); + } + SDL_FreeSurface(temp); + + return sprites; +} + + +void print_num(SDL_Surface *dst, SDL_Surface *font, int x, int y, float value) +{ + char buf[16]; + int val = (int)(value * 10.0); + int pos, p = 0; + SDL_Rect from; + + /* Sign */ + if(val < 0) + { + buf[p++] = 10; + val = -val; + } + + /* Integer part */ + pos = 10000000; + while(pos > 1) + { + int num = val / pos; + val -= num * pos; + pos /= 10; + if(p || num) + buf[p++] = num; + } + + /* Decimals */ + if(val / pos) + { + buf[p++] = 11; + while(pos > 0) + { + int num = val / pos; + val -= num * pos; + pos /= 10; + buf[p++] = num; + } + } + + /* Render! */ + from.y = 0; + from.w = 7; + from.h = 10; + for(pos = 0; pos < p; ++pos) + { + SDL_Rect to; + to.x = x + pos * 7; + to.y = y; + from.x = buf[pos] * 7; + SDL_BlitSurface(font, &from, dst, &to); + } +} + +void print_num_hex(SDL_Surface *dst, SDL_Surface *font, int x, int y, unsigned val) +{ + char buf[8]; + int pos, p = 0; + SDL_Rect from; + + //val = htonl(val); // Big-endian + + /* Render! */ + from.y = 0; + from.w = 7; + from.h = 10; + for(pos = 0; pos < 8; ++pos) + { + SDL_Rect to; + to.x = 8 * 7 - (x + pos * 7); // Little-endian number wrapped backwards + to.y = y; + from.x = ( ( val >> (pos * 4) ) & 0xf ) * 7; + SDL_BlitSurface(font, &from, dst, &to); + } +} + +/*---------------------------------------------------------- + ballfield_t functions +----------------------------------------------------------*/ + +ballfield_t *ballfield_init(void) +{ + int i; + ballfield_t *bf = (ballfield_t *)calloc(sizeof(ballfield_t), 1); + if(!bf) + return NULL; + for(i = 0; i < BALLS; ++i) + { + bf->points[i].x = rand() % 0x20000; + bf->points[i].y = rand() % 0x20000; + bf->points[i].z = 0x20000 * i / BALLS; + if(rand() % 100 > 80) + bf->points[i].c = 1; + else + bf->points[i].c = 0; + } + return bf; +} + + +void ballfield_free(ballfield_t *bf) +{ + int i; + for(i = 0; i < COLORS; ++i) + SDL_FreeSurface(bf->gfx[i]); +} + + +static int ballfield_init_frames(ballfield_t *bf) +{ + int i, j; + /* + * Set up source rects for all frames + */ + bf->frames = (SDL_Rect *)calloc(sizeof(SDL_Rect), bf->gfx[0]->w); + if(!bf->frames) + { + fprintf(stderr, "No memory for frame rects!\n"); + return -1; + } + for(j = 0, i = 0; i < bf->gfx[0]->w; ++i) + { + bf->frames[i].x = 0; + bf->frames[i].y = j; + bf->frames[i].w = bf->gfx[0]->w - i; + bf->frames[i].h = bf->gfx[0]->w - i; + j += bf->gfx[0]->w - i; + } + return 0; +} + + +int ballfield_load_gfx(ballfield_t *bf, char *name, unsigned int color) +{ + if(color >= COLORS) + return -1; + + bf->gfx[color] = load_zoomed(name, bf->use_alpha); + if(!bf->gfx[color]) + return -2; + + if(!bf->frames) + return ballfield_init_frames(bf); + + return 0; +} + + +void ballfield_move(ballfield_t *bf, Sint32 dx, Sint32 dy, Sint32 dz) +{ + int i; + for(i = 0; i < BALLS; ++i) + { + bf->points[i].x += dx; + bf->points[i].x &= 0x1ffff; + bf->points[i].y += dy; + bf->points[i].y &= 0x1ffff; + bf->points[i].z += dz; + bf->points[i].z &= 0x1ffff; + } +} + + +void ballfield_render(ballfield_t *bf, SDL_Surface *screen) +{ + int i, j, z; + + /* + * Find the ball with the highest Z. + */ + z = 0; + j = 0; + for(i = 0; i < BALLS; ++i) + { + if(bf->points[i].z > z) + { + j = i; + z = bf->points[i].z; + } + } + + /* + * Render all balls in back->front order. + */ + for(i = 0; i < BALLS; ++i) + { + SDL_Rect r; + int f; + z = bf->points[j].z; + z += 50; + f = ((bf->frames[0].w << 12) + 100000) / z; + f = bf->frames[0].w - f; + if(f < 0) + f = 0; + else if(f > bf->frames[0].w - 1) + f = bf->frames[0].w - 1; + z >>= 7; + z += 1; + r.x = (bf->points[j].x - 0x10000) / z; + r.y = (bf->points[j].y - 0x10000) / z; + r.x += (screen->w - bf->frames[f].w) >> 1; + r.y += (screen->h - bf->frames[f].h) >> 1; + SDL_BlitSurface(bf->gfx[bf->points[j].c], + &bf->frames[f], screen, &r); + if(--j < 0) + j = BALLS - 1; + } +} + + + +/*---------------------------------------------------------- + Other rendering functions +----------------------------------------------------------*/ + +/* + * Draw tiled background image with offset. + */ +void tiled_back(SDL_Surface *back, SDL_Surface *screen, int xo, int yo) +{ + /* + int x, y; + SDL_Rect r; + if(xo < 0) + xo += back->w*(-xo/back->w + 1); + if(yo < 0) + yo += back->h*(-yo/back->h + 1); + xo %= back->w; + yo %= back->h; + for(y = -yo; y < screen->h; y += back->h) + for(x = -xo; x < screen->w; x += back->w) + { + r.x = x; + r.y = y; + SDL_BlitSurface(back, NULL, screen, &r); + } + */ + SDL_Rect r; + xo %= back->w/8; + yo %= back->h/8; + r.x = xo - back->w/2 + screen->w/2; + r.y = yo - back->h/2 + screen->h/2; + r.w = back->w; + r.h = back->h; + SDL_BlitSurface(back, NULL, screen, &r); +} + +void musicPlay(void *userdata, Uint8 *stream, int len) +{ + SNDFILE *music = (SNDFILE *)userdata; + int ret = sf_read_short(music, (short *)stream, len / 2); +} + +/*---------------------------------------------------------- + main() +----------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + ballfield_t *balls; + SDL_Surface *screen; + SDL_Surface *temp_image; + SDL_Surface *back, *logo, *font, *font_hex; + SDL_Event event; + int bpp = 16, + flags = SDL_HWSURFACE, + alpha = 1; + int x_offs = 0, y_offs = 0; + long tick, + last_tick, + last_avg_tick; + double t = 0; + float dt; + int i; + float fps = 0.0; + int fps_count = 0; + int fps_start = 0; + float x_speed, y_speed, z_speed; + enum { MAX_POINTERS = 16 }; + // some random colors + int colors[MAX_POINTERS] = { 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee, 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee }; + struct TouchPointer_t { int x; int y; int pressure; int pressed; } touchPointers[MAX_POINTERS]; + int accel[5], screenjoy[4], gamepads[4][8]; + SDL_Surface *mouse[4]; + int screenKeyboardShown = 0; + + + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); + SDL_EnableUNICODE(1); + SDL_Joystick * joysticks[6]; + for( i = 0; i < 6; i++ ) + joysticks[i] = SDL_JoystickOpen(i); + + atexit(SDL_Quit); + + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, bpp, flags); + if(!screen) + { + fprintf(stderr, "Failed to open screen!\n"); + exit(-1); + } + + SDL_WM_SetCaption("Ballfield", "Ballfield"); + if(flags & SDL_FULLSCREEN) + SDL_ShowCursor(0); + + balls = ballfield_init(); + if(!balls) + { + fprintf(stderr, "Failed to create ballfield!\n"); + exit(-1); + } + + /* + * Load and prepare balls... + */ + balls->use_alpha = alpha; + if( ballfield_load_gfx(balls, "blueball.png", 0) + || + ballfield_load_gfx(balls, "redball.png", 1) ) + { + fprintf(stderr, "Could not load balls!\n"); + exit(-1); + } + + /* + * Load background image + */ + temp_image = IMG_Load("sun.gif"); + if(!temp_image) + { + fprintf(stderr, "Could not load background!\n"); + exit(-1); + } + back = SDL_DisplayFormat(temp_image); + SDL_FreeSurface(temp_image); + + /* + * Load logo + */ + temp_image = SDL_LoadBMP("logo.bmp"); + if(!temp_image) + { + fprintf(stderr, "Could not load logo!\n"); + exit(-1); + } + SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY, + SDL_MapRGB(temp_image->format, 255, 0, 255)); + logo = SDL_DisplayFormat(temp_image); + SDL_FreeSurface(temp_image); + + /* + * Load font + */ + temp_image = SDL_LoadBMP("font7x10.bmp"); + if(!temp_image) + { + fprintf(stderr, "Could not load font!\n"); + exit(-1); + } + SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY, + SDL_MapRGB(temp_image->format, 255, 0, 255)); + font = SDL_DisplayFormat(temp_image); + SDL_FreeSurface(temp_image); + + temp_image = SDL_LoadBMP("font7x10-hex.bmp"); + if(!temp_image) + { + fprintf(stderr, "Could not load hex font!\n"); + exit(-1); + } + SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY, + SDL_MapRGB(temp_image->format, 255, 0, 255)); + font_hex = SDL_DisplayFormat(temp_image); + SDL_FreeSurface(temp_image); + + for(i = 0; i < 4; i++) + { + char name[32]; + sprintf(name, "mouse%d.png", i); + temp_image = IMG_Load(name); + if(!temp_image) + { + fprintf(stderr, "Could not load %s!\n", name); + exit(-1); + } + //mouse[i] = SDL_DisplayFormat(temp_image); + //SDL_FreeSurface(temp_image); + mouse[i] = temp_image; // Keep alpha + } + + last_avg_tick = last_tick = SDL_GetTicks(); + + memset(touchPointers, 0, sizeof(touchPointers)); + memset(accel, 0, sizeof(accel)); + memset(screenjoy, 0, sizeof(screenjoy)); + memset(gamepads, 0, sizeof(gamepads)); + + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t)); + + __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "On-screen buttons:"); + for(i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++) + { + SDL_Rect r; + SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r); + __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w); + } + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1); + //SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1); + + //__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "Waiting 5 sec for debugger"); + //SDL_Delay(5000); + __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "Calling sf_open"); + SF_INFO sfinfo; + SNDFILE *music = sf_open ("first_run_jingle.ogg", SFM_READ, &sfinfo); + __android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "Calling sf_open result: %p %s", music, sf_strerror(NULL)); + SDL_AudioSpec spec, spec2; + memset(&spec, 0, sizeof(spec)); + spec.freq = 44100; + spec.format = AUDIO_S16; + spec.channels = 2; + spec.samples = 16384; + spec.callback = musicPlay; + spec.userdata = music; + SDL_OpenAudio(&spec, &spec2); + SDL_PauseAudio(0); + + while(1) + { + SDL_Rect r; + + /* Timing */ + tick = SDL_GetTicks(); + dt = (tick - last_tick) * 0.001f; + last_tick = tick; + + if( bpp == 32 ) + SDL_FillRect(screen, NULL, 0); // Clear alpha channel + + /* Background image */ + tiled_back(back, screen, x_offs>>11, y_offs>>11); + + /* Ballfield */ + ballfield_render(balls, screen); + + /* Logo */ + r.x = 2; + r.y = 2; + SDL_BlitSurface(logo, NULL, screen, &r); + + /* FPS counter */ + if(tick > fps_start + 1000) + { + fps = (float)fps_count * 1000.0 / (tick - fps_start); + fps_count = 0; + fps_start = tick; + } + + print_num(screen, font, screen->w-37, screen->h-12, fps); + ++fps_count; + + for(i=0; iw; + r.h = mouse[cursorIdx]->h; + r.x -= r.w/2; + r.y -= r.h/2; + SDL_BlitSurface(mouse[cursorIdx], NULL, screen, &r); + + SDL_Flip(SDL_GetVideoSurface()); + SDL_Event evt; + while( SDL_PollEvent(&evt) ) + { + if(evt.type == SDL_KEYUP || evt.type == SDL_KEYDOWN) + { + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL key event: evt %s state %s key %4d %12s scancode %4d mod %2d unicode %d", evt.type == SDL_KEYUP ? "UP " : "DOWN" , evt.key.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.key.keysym.sym, SDL_GetKeyName(evt.key.keysym.sym), (int)evt.key.keysym.scancode, (int)evt.key.keysym.mod, (int)evt.key.keysym.unicode); + if(evt.key.keysym.sym == SDLK_ESCAPE) + return 0; + } + if(evt.type == SDL_MOUSEBUTTONUP || evt.type == SDL_MOUSEBUTTONDOWN) + { + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL mouse button event: evt %s state %s button %d coords %d:%d", evt.type == SDL_MOUSEBUTTONUP ? "UP " : "DOWN" , evt.button.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.button.button, (int)evt.button.x, (int)evt.button.y); + if(evt.key.keysym.sym == SDLK_ESCAPE) + return 0; + } + if(evt.type == SDL_VIDEORESIZE) + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL resize event: %d x %d", evt.resize.w, evt.resize.h); + if(evt.type == SDL_ACTIVEEVENT) + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "======= SDL active event: gain %d state %d", evt.active.gain, evt.active.state); + // Android-specific events - accelerometer, multitoush, and on-screen joystick + if( evt.type == SDL_JOYAXISMOTION ) + { + if(evt.jaxis.which == 0) // Multitouch and on-screen joysticks + { + if(evt.jaxis.axis < 4) + screenjoy[evt.jaxis.axis] = evt.jaxis.value; + else + touchPointers[evt.jaxis.axis - 4].pressure = evt.jaxis.value; + } + if(evt.jaxis.which == 1) + { + accel[evt.jaxis.axis] = evt.jaxis.value; // accelerometer and gyroscope + } + if(evt.jaxis.which >= 2) + { + // Each gamepad has 8 axes - two joystick hats, two triggers, and Ouya touchpad + gamepads[evt.jaxis.which - 2][evt.jaxis.axis] = evt.jaxis.value; + } + } + if( evt.type == SDL_JOYBUTTONDOWN || evt.type == SDL_JOYBUTTONUP ) + { + if(evt.jbutton.which == 0) // Multitouch and on-screen joystick + touchPointers[evt.jbutton.button].pressed = (evt.jbutton.state == SDL_PRESSED); + } + if( evt.type == SDL_JOYBALLMOTION ) + { + if(evt.jball.which == 0) // Multitouch and on-screen joystick + { + touchPointers[evt.jball.ball].x = evt.jball.xrel; + touchPointers[evt.jball.ball].y = evt.jball.yrel; + } + } + } + if( screenKeyboardShown != SDL_IsScreenKeyboardShown(NULL)) + { + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "Screen keyboard shown: %d -> %d", screenKeyboardShown, SDL_IsScreenKeyboardShown(NULL)); + screenKeyboardShown = SDL_IsScreenKeyboardShown(NULL); + } + + /* Animate */ + x_speed = 500.0 * sin(t * 0.37); + y_speed = 500.0 * sin(t * 0.53); + z_speed = 400.0 * sin(t * 0.21); + + ballfield_move(balls, x_speed, y_speed, z_speed); + x_offs -= x_speed; + y_offs -= y_speed; + + t += dt; + } + + SDL_CloseAudio(); + sf_close (music); + ballfield_free(balls); + SDL_FreeSurface(back); + SDL_FreeSurface(logo); + SDL_FreeSurface(font); + SDL_VideoQuit(); + return 0; +} diff --git a/project/jni/application/test-sndfile/icon.png b/project/jni/application/test-sndfile/icon.png new file mode 100644 index 000000000..b3614e149 Binary files /dev/null and b/project/jni/application/test-sndfile/icon.png differ diff --git a/project/jni/application/sc2/.gitignore b/project/jni/application/uqm-hd/.gitignore similarity index 100% rename from project/jni/application/sc2/.gitignore rename to project/jni/application/uqm-hd/.gitignore diff --git a/project/jni/application/uqm-hd/AndroidAppSettings.cfg b/project/jni/application/uqm-hd/AndroidAppSettings.cfg new file mode 100644 index 000000000..3b6c7d158 --- /dev/null +++ b/project/jni/application/uqm-hd/AndroidAppSettings.cfg @@ -0,0 +1,215 @@ +# The application settings for Android libSDL port + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) +LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) +AppName="Ur-Quan Masters HD" + +# Specify reversed site name of application (e.x. com.mysite.myapp) +AppFullName=com.googlecode.uqm.hd + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape +ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=n + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!640x480 graphics (160 Mb)|:packages/uqm-content.uqm:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/uqm-hd-content-640-1.uqm/download^1280x960 graphics (360 Mb)|:packages/hires4x.uqm:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/uqm-hd-content-1280-1.uqm/download^!UQM music remix pack (240 Mb)|:addons/uqm-remix.uqm:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/uqm-remix.uqm/download^!Voice pack (120 Mb)|:addons/uqm-0.7.0-voice.uqm:http://sourceforge.net/projects/sc2/files/UQM/0.7/uqm-0.7.0-voice.uqm/download^3DO music (20 Mb)|:addons/uqm-0.7.0-3domusic.uqm:http://sourceforge.net/projects/sc2/files/UQM/0.7/uqm-0.7.0-3domusic.uqm/download^Russian translation|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/uqm-hd-russian-1.uqm/download^Deutsch translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/deutsch.zip/download^Spanish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/spanish.zip/download^Slovak translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/slovak.zip/download^Finnish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/finnish.zip/download^!!Game data|data.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) +VideoDepthBpp=24 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) +NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) +SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) +SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) +SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) +CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) +CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) +CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) +CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) +CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user +AppUsesMouse=n + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) +AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) +ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) +ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) +AppNeedsArrowKeys=n + +# Application needs text input (y) or (n), enables button for text input on screen +AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 +AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=y + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 +AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 +AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state +NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA +RedefinedKeys="RETURN RSHIFT NO_REMAP NO_REMAP RCTRL F10" + +# Number of virtual keyboard keys (currently 6 is maximum) +AppTouchscreenKeyboardKeysAmount=6 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) +AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) +RedefinedKeysScreenKb="RCTRL RSHIFT END PAGEUP PAGEDOWN W UNKNOWN UNKNOWN UNKNOWN UNKNOWN" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="Fire Secondary_weapon Thrust Player_2_fire Player_2_secondary_weapon Player_2_thrust" + +# How long to show startup menu button, in msec, 0 to disable startup menu +StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig +HiddenMenuOptions='' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), +FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower +AppMinimumRAM=0 + +# Application version code (integer) +AppVersionCode=07001 + +# Application user-visible version name (string) +AppVersionName="0.7.0.01" + +# Reset SDL config when updating application to the new version (y) / (n) +ResetSdlConfigForThisVersion=n + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) +DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 +CompiledLibraries="sdl_image tremor ogg" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) +CustomBuildScript=n + +# Aditional CFLAGS for application +AppCflags='-O3 -DGFXMODULE_SDL -DOVCODEC_TREMOR -DNETPLAY=NETPLAY_FULL -DHAVE_JOYSTICK -DHAVE_ZIP=1 -DTHREADLIB_SDL -DUSE_INTERNAL_MIKMOD' + +# Additional LDFLAGS for application +AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders=y + +# Build only following subdirs (empty will build all dirs, ignored with custom script) +AppSubdirsBuild='src src/libs/* src/uqm/*' + +# Exclude these files from build +AppBuildExclude='src/libs/uio/hashtable.c src/libs/uio/memdebug.c src/libs/network/socket/socket_win.c src/libs/network/network_win.c src/libs/network/netmanager/netmanager_win.c src/libs/cdp/cdpapi.c src/libs/cdp/cdp.c src/libs/cdp/windl.c' + +# Application command line parameters, including app name as 0-th param +AppCmdline='uqm -x -f --addon lang' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) +ReadmeText='Tap joystick to turn off engines and rotate ship, tap once more to enable engines.\\\\nSecond screen joystick is available for two-player melee.\\\\nDo not select multiple translations, only one will work.\\\\nIf the game runs slowly - set 640x480 video mode from Setup menu.' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge +MinimumScreenSize=m + +# Your AdMob Publisher ID, (n) if you don't want advertisements +AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad +AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) +AdmobBannerSize= + diff --git a/project/jni/application/uqm-hd/AndroidData/data.zip b/project/jni/application/uqm-hd/AndroidData/data.zip new file mode 100644 index 000000000..0db1c1186 Binary files /dev/null and b/project/jni/application/uqm-hd/AndroidData/data.zip differ diff --git a/project/jni/application/uqm-hd/AndroidData/logo.png b/project/jni/application/uqm-hd/AndroidData/logo.png new file mode 100644 index 000000000..569a60f9f Binary files /dev/null and b/project/jni/application/uqm-hd/AndroidData/logo.png differ diff --git a/project/jni/application/uqm-hd/AndroidPreBuild.sh b/project/jni/application/uqm-hd/AndroidPreBuild.sh new file mode 100755 index 000000000..d5d682c6f --- /dev/null +++ b/project/jni/application/uqm-hd/AndroidPreBuild.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +LOCAL_PATH=`dirname $0` +LOCAL_PATH=`cd $LOCAL_PATH && pwd` + +if [ -e src/patched.successfully ]; then + exit 0 +else + svn co http://uqm-hd.googlecode.com/svn/trunk/src && patch -p0 < android.diff && svn add src/config_unix.h && touch src/patched.successfully || exit 1 +fi diff --git a/project/jni/application/uqm-hd/android.diff b/project/jni/application/uqm-hd/android.diff new file mode 100644 index 000000000..b11436e00 --- /dev/null +++ b/project/jni/application/uqm-hd/android.diff @@ -0,0 +1,2133 @@ +Index: src/libs/md5/md5.c +=================================================================== +--- src/libs/md5/md5.c (revision 1330) ++++ src/libs/md5/md5.c (working copy) +@@ -21,7 +21,7 @@ + + /* Written by Ulrich Drepper , 1995. */ + +-#include ++#include "config.h" + + #include "md5.h" + +Index: src/libs/input/sdl/input.c +=================================================================== +--- src/libs/input/sdl/input.c (revision 1330) ++++ src/libs/input/sdl/input.c (working copy) +@@ -88,6 +88,7 @@ + "weapon", + "special", + "escape", ++ "thrust", + NULL + }; + +@@ -188,7 +189,7 @@ + directory. */ + LoadResourceIndex (contentDir, "uqm.key", "keys."); + } +- ++ + register_flight_controls (); + + return; +Index: src/libs/input/sdl/vcontrol.c +=================================================================== +--- src/libs/input/sdl/vcontrol.c (revision 1330) ++++ src/libs/input/sdl/vcontrol.c (working copy) +@@ -46,6 +46,7 @@ + typedef struct vcontrol_joystick_axis { + keybinding *neg, *pos; + int polarity; ++ int value; + } axis_type; + + typedef struct vcontrol_joystick_hat { +@@ -66,7 +67,7 @@ + + #endif /* HAVE_JOYSTICK */ + +-static unsigned int joycount; ++static unsigned int joycount = 0; + static unsigned int num_sdl_keys = 0; + static keybinding **bindings = NULL; + +@@ -141,6 +142,7 @@ + for (j = 0; j < axes; j++) + { + x->axes[j].neg = x->axes[j].pos = NULL; ++ x->axes[j].polarity = x->axes[j].value = 0; + } + for (j = 0; j < hats; j++) + { +@@ -818,6 +820,7 @@ + int t; + if (!joysticks[port].stick) + return; ++ joysticks[port].axes[axis].value = value; + t = joysticks[port].threshold; + if (value > t) + { +@@ -894,6 +897,25 @@ + #endif /* HAVE_JOYSTICK */ + } + ++int ++VControl_GetJoyAxis(int port, int axis) ++{ ++#ifdef HAVE_JOYSTICK ++ if( joycount <= port ) ++ return 0; ++ if (!joysticks[port].stick || joysticks[port].numaxes <= axis ) ++ return 0; ++ return joysticks[port].axes[axis].value; ++#else ++ return 0; ++#endif /* HAVE_JOYSTICK */ ++}; ++ ++int VControl_GetJoysticksAmount() ++{ ++ return joycount; ++}; ++ + void + VControl_ResetInput (void) + { +Index: src/libs/input/sdl/vcontrol.h +=================================================================== +--- src/libs/input/sdl/vcontrol.h (revision 1330) ++++ src/libs/input/sdl/vcontrol.h (working copy) +@@ -76,6 +76,9 @@ + void VControl_ProcessJoyAxis (int port, int axis, int value); + void VControl_ProcessJoyHat (int port, int which, Uint8 value); + ++int VControl_GetJoyAxis(int port, int axis); ++int VControl_GetJoysticksAmount(); ++ + /* Force the input into the blank state. For preventing "sticky" keys. */ + void VControl_ResetInput (void); + +Index: src/libs/input/input_common.h +=================================================================== +--- src/libs/input/input_common.h (revision 1330) ++++ src/libs/input/input_common.h (working copy) +@@ -31,7 +31,7 @@ + extern int TFB_InitInput (int driver, int flags); + extern void TFB_UninitInput (void); + +-#define MAX_FLIGHT_ALTERNATES 2 ++#define MAX_FLIGHT_ALTERNATES 3 + + extern void TFB_SetInputVectors (volatile int menu[], int num_menu, + volatile int flight[], int num_templ, int num_flight); +Index: src/libs/resource/filecntl.c +=================================================================== +--- src/libs/resource/filecntl.c (revision 1330) ++++ src/libs/resource/filecntl.c (working copy) +@@ -26,6 +26,7 @@ + #include "port.h" + #include "resintrn.h" + #include "libs/uio.h" ++#include "libs/log.h" + + uio_Stream * + res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) +@@ -34,7 +35,10 @@ + struct stat sb; + + if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) ++ { ++ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); + return ((uio_Stream *) ~0); ++ } + + fp = uio_fopen (dir, filename, mode); + +Index: src/libs/sound/decoders/oggaud.c +=================================================================== +--- src/libs/sound/decoders/oggaud.c (revision 1330) ++++ src/libs/sound/decoders/oggaud.c (working copy) +@@ -270,7 +270,7 @@ + // this is the closest to a frame there is in ogg vorbis stream + // doesn't seem to be a func to retrive it + #ifdef OVCODEC_TREMOR +- return ova->vf.os->pageno; ++ return ova->vf.os.pageno; + #else + return ova->vf.os.pageno; + #endif /* OVCODEC_TREMOR */ +Index: src/libs/graphics/gfx_common.h +=================================================================== +--- src/libs/graphics/gfx_common.h (revision 1330) ++++ src/libs/graphics/gfx_common.h (working copy) +@@ -119,4 +119,10 @@ + extern int ScreenColorDepth; + extern int GraphicsDriver; + ++void TFB_SetOnScreenKeyboard_Hidden (void); ++void TFB_SetOnScreenKeyboard_Menu (void); ++void TFB_SetOnScreenKeyboard_Starmap (void); ++void TFB_SetOnScreenKeyboard_Melee (void); ++void TFB_SetOnScreenKeyboard_TwoPlayersMelee (void); ++ + #endif +Index: src/libs/graphics/sdl/pure.c +=================================================================== +--- src/libs/graphics/sdl/pure.c (revision 1330) ++++ src/libs/graphics/sdl/pure.c (working copy) +@@ -128,6 +128,7 @@ + { + int i, videomode_flags; + SDL_PixelFormat conv_fmt; ++ int BPP = 32; + + GraphicsDriver = driver; + +@@ -169,6 +170,14 @@ + } + } + ++#ifdef ANDROID ++ videomode_flags = SDL_SWSURFACE; ++ //ScreenWidthActual = 1280; ++ //ScreenHeightActual = 960; ++ graphics_backend = &pure_unscaled_backend; ++ BPP = 24; ++#endif ++ + videomode_flags |= SDL_ANYFORMAT; + if (flags & TFB_GFXFLAGS_FULLSCREEN) + videomode_flags |= SDL_FULLSCREEN; +@@ -176,7 +185,7 @@ + /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set + SDL_ANYFORMAT */ + SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, +- 32, videomode_flags); ++ BPP, videomode_flags); + + if (SDL_Video == NULL) + { +Index: src/libs/graphics/sdl/sdl_common.c +=================================================================== +--- src/libs/graphics/sdl/sdl_common.c (revision 1330) ++++ src/libs/graphics/sdl/sdl_common.c (working copy) +@@ -34,7 +34,11 @@ + #include "libs/memlib.h" + #include "libs/vidlib.h" + #include SDL_INCLUDE(SDL_thread.h) ++#ifdef ANDROID ++#include ++#endif + ++ + SDL_Surface *SDL_Video; + SDL_Surface *SDL_Screen; + SDL_Surface *TransitionScreen; +@@ -199,6 +203,8 @@ + + atexit (TFB_UninitGraphics); + ++ TFB_InitOnScreenKeyboard (); ++ + return 0; + } + +@@ -635,3 +641,155 @@ + } + } + ++ ++#ifdef ANDROID ++ ++static SDL_Rect SDL_LeftJoystickRect, SDL_RightJoystickRect, SDL_TextInputRect; ++ ++void ++TFB_InitOnScreenKeyboard (void) ++{ ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &SDL_RightJoystickRect); ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &SDL_TextInputRect); ++ ++ /* TFB_SetOnScreenKeyboard_Hidden (); */ ++ TFB_SetOnScreenKeyboard_Menu (); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Hidden (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ SDL_Rect b; ++ b.w = b.h = b.x = b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Menu (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ TFB_SetOnScreenKeyboard_Hidden(); ++ SDL_Rect b; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &SDL_TextInputRect); ++ b.w = SDL_RightJoystickRect.w / 2; ++ b.h = SDL_RightJoystickRect.h / 2; ++ b.x = SDL_RightJoystickRect.x + b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ b.x = SDL_RightJoystickRect.x; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Starmap (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ TFB_SetOnScreenKeyboard_Menu(); ++ SDL_Rect b; ++ b.h = SDL_RightJoystickRect.h / 2; ++ b.w = SDL_RightJoystickRect.w / 2; ++ b.x = SDL_RightJoystickRect.x - b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ b.x -= b.w; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Melee (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ /* Make the on-screen buttons slightly overlap, so we can hit them with one finger */ ++ TFB_SetOnScreenKeyboard_Hidden(); ++ SDL_Rect b; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ b.w = SDL_RightJoystickRect.w * 3 / 5; ++ b.h = SDL_RightJoystickRect.h * 3 / 5; ++ b.x = SDL_RightJoystickRect.x + SDL_RightJoystickRect.w - b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; //SDL_RightJoystickRect.y; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ b.x = SDL_RightJoystickRect.x; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++ // Throttle button is replaced by tapping joystick ++ /* ++ b.w = SDL_RightJoystickRect.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &b); ++ */ ++} ++ ++void ++TFB_SetOnScreenKeyboard_TwoPlayersMelee (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ /* Mirror the buttons */ ++ TFB_SetOnScreenKeyboard_Melee(); ++ SDL_Rect b = SDL_RightJoystickRect; ++ b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &b); ++ b.w = SDL_RightJoystickRect.w * 3 / 5; ++ b.h = SDL_RightJoystickRect.h * 3 / 5; ++ b.x = 0; ++ b.y = 0; // SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ b.x = SDL_RightJoystickRect.w - b.w; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++ // Throttle button is replaced by tapping joystick ++ /* ++ b.w = SDL_RightJoystickRect.w; ++ b.x = 0; ++ b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &b); ++ */ ++} ++ ++#else ++ ++/* Stubs */ ++void ++TFB_InitOnScreenKeyboard (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Hidden (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Menu (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Starmap (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Melee (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_TwoPlayersMelee (void) ++{ ++} ++ ++#endif +Index: src/libs/graphics/sdl/sdl_common.h +=================================================================== +--- src/libs/graphics/sdl/sdl_common.h (revision 1330) ++++ src/libs/graphics/sdl/sdl_common.h (working copy) +@@ -50,4 +50,6 @@ + + SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface); + ++void TFB_InitOnScreenKeyboard (void); ++ + #endif +Index: src/libs/log/msgbox_stub.c +=================================================================== +--- src/libs/log/msgbox_stub.c (revision 1330) ++++ src/libs/log/msgbox_stub.c (working copy) +@@ -16,6 +16,9 @@ + + #include "msgbox.h" + #include "loginternal.h" ++#ifdef ANDROID ++#include ++#endif + + void + log_displayBox (const /*UTF-8*/char *title, int isError, +@@ -26,6 +29,9 @@ + // So just inform the user of our predicament + fprintf (streamOut, "Do not know how to display %s box\n", + isError ? "an error" : "a"); ++#ifdef ANDROID ++ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); ++#endif + + // Suppress the compiler warnings in any case. + (void)title; +Index: src/libs/log/uqmlog.c +=================================================================== +--- src/libs/log/uqmlog.c (revision 1330) ++++ src/libs/log/uqmlog.c (working copy) +@@ -23,6 +23,9 @@ + #include + #include + #include ++#ifdef ANDROID ++#include ++#endif + #include "libs/threadlib.h" + + #ifndef MAX_LOG_ENTRY_SIZE +@@ -190,6 +193,9 @@ + if ((int)level <= maxStreamLevel) + { + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif + } + + if ((int)level <= maxLevel) +@@ -226,6 +232,9 @@ + if ((int)level <= maxStreamLevel) + { + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif + } + + if ((int)level <= maxLevel) +Index: src/libs/log/msgbox_win.c +=================================================================== +--- src/libs/log/msgbox_win.c (revision 1330) ++++ src/libs/log/msgbox_win.c (working copy) +@@ -14,6 +14,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifndef ANDROID + #include "msgbox.h" + #define WIN32_LEAN_AND_MEAN + #include +@@ -64,4 +65,4 @@ + free (swTitle); + free (swMsg); + } +- ++#endif +Index: src/libs/uio/io.c +=================================================================== +--- src/libs/uio/io.c (revision 1330) ++++ src/libs/uio/io.c (working copy) +@@ -35,6 +35,7 @@ + #include "mem.h" + #include "uioutils.h" + #include "uioport.h" ++#include "../log.h" + #ifdef uio_MEM_DEBUG + # include "memdebug.h" + #endif +@@ -193,6 +194,7 @@ + errno = EINVAL; + return NULL; + } ++ log_add (log_Info, "uio_open %s", sourcePath); + handle = uio_open(sourceDir, sourcePath, + ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? + O_RDONLY : O_RDWR) +@@ -201,12 +203,14 @@ + #endif + , 0); + if (handle == NULL) { ++ log_add (log_Info, "uio_open failed for %s", sourcePath); + // errno is set + return NULL; + } + } + + handler = uio_getFileSystemHandler(fsType); ++ log_add (log_Info, "uio_getFileSystemHandler %p", handler); + if (handler == NULL) { + if (handle) + uio_close(handle); +@@ -703,6 +707,7 @@ + &readMountInfo, &readPDirHandle, NULL, + &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { + // errno is set ++ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); + return NULL; + } + +@@ -729,6 +734,7 @@ + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = EEXIST; ++ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); + return NULL; + } + if ((flags & O_TRUNC) == O_TRUNC) { +@@ -745,6 +751,7 @@ + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = savedErrno; ++ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); + return NULL; + } + } +@@ -766,6 +773,7 @@ + handle = (pDirHandle->pRoot->handler->open)(pDirHandle, name, flags, mode); + // Also adds a new entry to the physical dir if appropriate. + if (handle == NULL) { ++ log_add (log_Info, "uio_open: open file failed '%s'", name); + int savedErrno = errno; + uio_free(name); + uio_PDirHandle_unref(pDirHandle); +Index: src/libs/uio/zip/zip.c +=================================================================== +--- src/libs/uio/zip/zip.c (revision 1330) ++++ src/libs/uio/zip/zip.c (working copy) +@@ -1366,6 +1366,10 @@ + gPFileData->gid = (uid_t) makeUInt16(buf[12], buf[13]); + break; + } ++ case 0x7875: // 'Unix string UID/GID' ++ // Just skip it ++ break; ++ + default: + #ifdef DEBUG + fprintf(stderr, "Debug: Extra field 0x%04x unsupported, " +Index: src/config_unix.h +=================================================================== +--- src/config_unix.h (revision 0) ++++ src/config_unix.h (working copy) +@@ -0,0 +1,63 @@ ++/* This file contains some compile-time configuration options for *nix ++ * systems. ++ * config_unix.h is generated from config_unix.h.in by build.sh ++ * When building on MS Windows using build.sh (MinGW, Cygwin), ++ * config_win.h is generated from src/config_win.h.in. ++ * When using MSVC on MS Windows, you'll have to edit src/config_vc6.h ++ * manually if you want anything else than the defaults. ++ */ ++ ++#ifndef _CONFIG_UNIX_H ++#define _CONFIG_UNIX_H ++ ++/* Directory where the UQM game data is located */ ++#define CONTENTDIR "" ++ ++/* Directory where game data will be stored */ ++#define USERDIR "config/" ++ ++/* Directory where config files will be stored */ ++#define CONFIGDIR USERDIR ++ ++/* Directory where supermelee teams will be stored */ ++#define MELEEDIR "teams/" ++ ++/* Directory where save games will be stored */ ++#define SAVEDIR "save/" ++ ++/* Defined if words are stored with the most significant byte first */ ++#undef WORDS_BIGENDIAN ++ ++/* Defined if your system has readdir_r of its own */ ++#define HAVE_READDIR_R ++ ++/* Defined if your system has setenv of its own */ ++#define HAVE_SETENV ++ ++/* Defined if your system has strupr of its own */ ++#undef HAVE_STRUPR ++ ++/* Defined if your system has strcasecmp of its own */ ++#define HAVE_STRCASECMP_UQM ++ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. ++ ++/* Defined if your system has stricmp of its own */ ++#undef HAVE_STRICMP ++ ++/* Defined if your system has getopt_long */ ++#define HAVE_GETOPT_LONG ++ ++/* Defined if your system has iswgraph of its own*/ ++#define HAVE_ISWGRAPH ++ ++/* Defined if your system has wchar_t of its own */ ++#define HAVE_WCHAR_T ++ ++/* Defined if your system has wint_t of its own */ ++#define HAVE_WINT_T ++ ++/* Defined if your system has _Bool of its own */ ++#define HAVE__BOOL ++ ++#endif /* _CONFIG_UNIX_H */ ++ +Index: src/uqm/setupmenu.c +=================================================================== +--- src/uqm/setupmenu.c (revision 1330) ++++ src/uqm/setupmenu.c (working copy) +@@ -83,7 +83,7 @@ + #endif + + #define MENU_COUNT 8 +-#define CHOICE_COUNT 29 // JMS: New options added. ++#define CHOICE_COUNT 30 // JMS: New options added. + #define SLIDER_COUNT 3 + #define BUTTON_COUNT 10 + #define LABEL_COUNT 4 +@@ -106,7 +106,7 @@ + static int choice_widths[CHOICE_COUNT] = { + 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, +- 3, 2, 3, 2, 2, 2, 2, 2, 2 }; ++ 3, 2, 3, 2, 2, 2, 2, 2, 2, 2 }; + + static HANDLER button_handlers[BUTTON_COUNT] = { + quit_main_menu, quit_sub_menu, do_graphics, do_engine, +@@ -117,7 +117,7 @@ + // JMS: The first 8 was 7 (sound options.) Added mainmenumusic on/off. + // JMS: The HAVE_OPENGL options were 5 and 4. Added cheatMode, mineralSubmenu, nebulae and planet options. + static int menu_sizes[MENU_COUNT] = { +- 7, 6, 8, 8, 2, 5, ++ 7, 6, 8, 8, 2, 6, + #ifdef HAVE_OPENGL + 10, + #else +@@ -185,6 +185,7 @@ + static WIDGET *keyconfig_widgets[] = { + (WIDGET *)(&choices[18]), + (WIDGET *)(&choices[19]), ++ (WIDGET *)(&choices[29]), // Directional joystick + (WIDGET *)(&labels[1]), + (WIDGET *)(&buttons[8]), + (WIDGET *)(&buttons[1]) }; +@@ -414,6 +415,7 @@ + choices[26].selected = opts.rotatingIpPlanets; // JMS + choices[27].selected = opts.texturedIpPlanets || opts.rotatingIpPlanets; // JMS + choices[28].selected = opts.cheatMode; // JMS ++ choices[29].selected = opts.directionalJoystick; + + sliders[0].value = opts.musicvol; + sliders[1].value = opts.sfxvol; +@@ -452,6 +454,7 @@ + opts.rotatingIpPlanets = choices[26].selected; // JMS + opts.texturedIpPlanets = choices[27].selected || opts.rotatingIpPlanets; // JMS + opts.cheatMode = choices[28].selected; // JMS ++ opts.directionalJoystick = choices[29].selected; + + opts.musicvol = sliders[0].value; + opts.sfxvol = sliders[1].value; +@@ -1164,6 +1167,7 @@ + opts->rotatingIpPlanets = optRotatingIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED; + opts->texturedIpPlanets = (optTexturedIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED) || opts->rotatingIpPlanets; + opts->cheatMode = optCheatMode ? OPTVAL_ENABLED : OPTVAL_DISABLED; ++ opts->directionalJoystick = optDirectionalJoystick ? OPTVAL_ENABLED : OPTVAL_DISABLED; + + /* Work out resolution. On the way, try to guess a good default + * for config.alwaysgl, then overwrite it if it was set previously. */ +@@ -1376,6 +1380,9 @@ + res_PutBoolean ("config.cheatMode", opts->cheatMode == OPTVAL_ENABLED); + optCheatMode = opts->cheatMode == OPTVAL_ENABLED; + ++ res_PutBoolean ("config.directionaljoystick", opts->directionalJoystick == OPTVAL_ENABLED); ++ optDirectionalJoystick = (opts->directionalJoystick == OPTVAL_ENABLED) ? TRUE : FALSE; ++ + if (NewWidth == 320 && NewHeight == 240) + { + switch (opts->scaler) +Index: src/uqm/setupmenu.h +=================================================================== +--- src/uqm/setupmenu.h (revision 1330) ++++ src/uqm/setupmenu.h (working copy) +@@ -86,7 +86,7 @@ + OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; + CONTROL_TEMPLATE player1, player2; + int speechvol, musicvol, sfxvol; +- BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode; // JMS ++ BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode, directionalJoystick; // JMS + } GLOBALOPTS; + + void SetupMenu (void); +Index: src/uqm/shipstat.c +=================================================================== +--- src/uqm/shipstat.c (revision 1330) ++++ src/uqm/shipstat.c (working copy) +@@ -144,6 +144,45 @@ + DrawFilledRectangle (&r); + } + ++static void ++DrawCrewEnergyBoxOutline (RECT *box) ++{ ++ RECT r; ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y + box->extent.height - 1; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x + box->extent.width - 1; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor (BLACK_COLOR); ++ r.corner.x = box->corner.x + 1; ++ r.corner.y = box->corner.y + 1; ++ r.extent.width = box->extent.width - 2; ++ r.extent.height = box->extent.height - 2; ++ DrawFilledRectangle (&r); ++} ++ + void + InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEAN inMeleeMenu) + { +@@ -256,6 +295,28 @@ + r.extent.height = energy_height; + r.corner.y = y - r.extent.height + GAUGE_YOFFS + 1; + DrawFilledRectangle (&r); ++ ++ // TODO: replace the above ugly code with DrawCrewEnergyBoxOutline(), but I don't want to touch that as long as it works ++ r.corner.x = RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.corner.y = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_CREW_YOFFS; ++ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.extent.width = 1000; ++ r.extent.height = STAT_WIDTH + (2 << RESOLUTION_FACTOR); ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = crew_height + (2 << RESOLUTION_FACTOR); ++ DrawCrewEnergyBoxOutline (&r); ++ r.corner.y = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.extent.width = 1000; ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = energy_height + (2 << RESOLUTION_FACTOR); ++ DrawCrewEnergyBoxOutline (&r); + } + + if (!StarShipPtr || StarShipPtr->captains_name_index) +@@ -315,7 +376,7 @@ + // DeltaStatistics() below will add specified values to these + SIPtr->crew_level = 0; + SIPtr->energy_level = 0; +- DeltaStatistics (SIPtr, y, crew_delta, energy_delta); ++ DeltaStatistics (SIPtr, y, crew_delta, energy_delta, StarShipPtr ? StarShipPtr->playerNr : NPC_PLAYER_NUM); + } + + UnbatchGraphics (); +@@ -333,10 +394,11 @@ + // crew_delta <= ShipInfoPtr->max_crew - ShipInfoPtr->crew_level + void + DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, +- SIZE crew_delta, SIZE energy_delta) ++ SIZE crew_delta, SIZE energy_delta, SIZE player_num) + { +- COORD x, y; +- RECT r; ++ COORD x, y, y2; ++ RECT r, r2; ++ SIZE max_crew_size, max_energy_size; + + if (crew_delta == 0 && energy_delta == 0) + return; +@@ -346,13 +408,15 @@ + + r.extent.width = UNIT_WIDTH; + r.extent.height = UNIT_HEIGHT; ++#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) ++ max_crew_size = MIN(ShipInfoPtr->max_crew, MAX_CREW_SIZE); ++ max_energy_size = ShipInfoPtr->max_energy; + + if (crew_delta != 0) + { + COUNT oldNumBlocks, newNumBlocks, blockI; + COUNT newCrewLevel; + +-#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) + oldNumBlocks = MIN(ShipInfoPtr->crew_level, MAX_CREW_SIZE); + newCrewLevel = ShipInfoPtr->crew_level + crew_delta; + newNumBlocks = MIN(newCrewLevel, MAX_CREW_SIZE); +@@ -419,10 +483,33 @@ + // Always print a number for the SIS in the full game. + DrawBattleCrewAmount (ShipInfoPtr, y_offs); + } ++ ++ y2 = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_CREW_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_crew_size; blockI++) ++ { ++ SetContextForeGroundColor ( ++ (ShipInfoPtr->ship_flags & CREW_IMMUNE) ? ++ ROBOT_UNIT_COLOR : CREW_UNIT_COLOR); ++ if (blockI >= newNumBlocks) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + + if (energy_delta != 0) + { ++ COUNT blockI; + if (energy_delta > 0) + { + #define FUEL_UNIT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +@@ -458,6 +545,26 @@ + --ShipInfoPtr->energy_level; + } while (++energy_delta); + } ++ ++ y2 = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_energy_size; blockI++) ++ { ++ SetContextForeGroundColor (FUEL_UNIT_COLOR); ++ if (blockI >= ShipInfoPtr->energy_level) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + } + +Index: src/uqm/units.h +=================================================================== +--- src/uqm/units.h (revision 1330) ++++ src/uqm/units.h (working copy) +@@ -67,6 +67,7 @@ + #define RADAR_WIDTH (STATUS_WIDTH - RES_STAT_SCALE(8)) // JMS_GFX + #define RADAR_HEIGHT RES_STAT_SCALE(53) // JMS_GFX + #define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - (53 << RESOLUTION_FACTOR)) // JMS_GFX ++#define RADAR_Y_LIFTED_UP (RADAR_Y - (40 << RESOLUTION_FACTOR)) + + /* Blue boxes which display messages and the green date box. */ + #define SIS_TITLE_BOX_WIDTH (57 << RESOLUTION_FACTOR) // JMS_GFX +Index: src/uqm/gameinp.c +=================================================================== +--- src/uqm/gameinp.c (revision 1330) ++++ src/uqm/gameinp.c (working copy) +@@ -16,6 +16,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#include + #include "controls.h" + #include "battlecontrols.h" + #include "init.h" +@@ -32,11 +33,14 @@ + #include "libs/timelib.h" + #include "libs/threadlib.h" + +- ++#ifdef ANDROID ++#define ACCELERATION_INCREMENT (ONE_SECOND) ++#define MENU_REPEAT_DELAY (ONE_SECOND) ++#else + #define ACCELERATION_INCREMENT (ONE_SECOND / 12) + #define MENU_REPEAT_DELAY (ONE_SECOND / 2) ++#endif + +- + typedef struct + { + BOOLEAN (*InputFunc) (void *pInputState); +@@ -66,6 +70,7 @@ + + volatile BOOLEAN ExitRequested; + volatile BOOLEAN GamePaused; ++volatile BOOLEAN OnScreenKeyboardLocked; + + static InputFrameCallback *inputCallback; + +@@ -422,16 +427,10 @@ + } + + static BATTLE_INPUT_STATE +-ControlInputToBattleInput (const int *keyState) ++ControlInputToBattleInput (const int *keyState, COUNT player, int direction) + { + BATTLE_INPUT_STATE InputState = 0; + +- if (keyState[KEY_UP]) +- InputState |= BATTLE_THRUST; +- if (keyState[KEY_LEFT]) +- InputState |= BATTLE_LEFT; +- if (keyState[KEY_RIGHT]) +- InputState |= BATTLE_RIGHT; + if (keyState[KEY_WEAPON]) + InputState |= BATTLE_WEAPON; + if (keyState[KEY_SPECIAL]) +@@ -441,21 +440,35 @@ + if (keyState[KEY_DOWN]) + InputState |= BATTLE_DOWN; + ++ if(direction < 0) ++ { ++ if (keyState[KEY_LEFT]) ++ InputState |= BATTLE_LEFT; ++ if (keyState[KEY_RIGHT]) ++ InputState |= BATTLE_RIGHT; ++ if (keyState[KEY_UP]) ++ InputState |= BATTLE_THRUST; ++ } ++ else ++ { ++ InputState |= GetDirectionalJoystickInput(direction, player); ++ } ++ + return InputState; + } + + BATTLE_INPUT_STATE +-CurrentInputToBattleInput (COUNT player) ++CurrentInputToBattleInput (COUNT player, int direction) + { + return ControlInputToBattleInput( +- CurrentInputState.key[PlayerControls[player]]); ++ CurrentInputState.key[PlayerControls[player]], player, direction); + } + + BATTLE_INPUT_STATE + PulsedInputToBattleInput (COUNT player) + { + return ControlInputToBattleInput( +- PulsedInputState.key[PlayerControls[player]]); ++ PulsedInputState.key[PlayerControls[player]], player, -1); + } + + BOOLEAN +@@ -500,3 +513,130 @@ + return result; + } + ++// Fast arctan2, returns angle in radians as integer, with fractional part in lower 16 bits ++// Stolen from http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization , precision is said to be 0.07 rads ++ ++#ifndef M_PI ++#define M_PI 3.14159265358979323846 ++#endif ++enum { atan2i_coeff_1 = ((int)(M_PI*65536.0/4)), atan2i_coeff_2 = (3*atan2i_coeff_1), atan2i_PI = (int)(M_PI * 65536.0), SHIP_DIRECTIONS = 16 }; ++ ++static inline int atan2i(int y, int x) ++{ ++ int angle; ++ int abs_y = abs(y); ++ if( abs_y == 0 ) ++ abs_y = 1; ++ if (x>=0) ++ { ++ angle = atan2i_coeff_1 - atan2i_coeff_1 * (x - abs_y) / (x + abs_y); ++ } ++ else ++ { ++ angle = atan2i_coeff_2 - atan2i_coeff_1 * (x + abs_y) / (abs_y - x); ++ } ++ if (y < 0) ++ return(-angle); // negate if in quad III or IV ++ else ++ return(angle); ++} ++ ++BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player) ++{ ++ BATTLE_INPUT_STATE InputState = 0; ++ static BOOLEAN JoystickThrust[NUM_PLAYERS] = { FALSE, FALSE }; ++ static BOOLEAN JoystickTapFlag[NUM_PLAYERS] = { FALSE, FALSE }; ++ static TimeCount JoystickTapTime[NUM_PLAYERS] = { 0, 0 }; ++ ++ if (CurrentInputState.key[PlayerControls[player]][KEY_THRUST]) ++ InputState |= BATTLE_THRUST; ++ ++ if( VControl_GetJoysticksAmount() <= 0 ) ++ { ++ if (CurrentInputState.key[PlayerControls[player]][KEY_LEFT]) ++ InputState |= BATTLE_LEFT; ++ if (CurrentInputState.key[PlayerControls[player]][KEY_RIGHT]) ++ InputState |= BATTLE_RIGHT; ++ if (CurrentInputState.key[PlayerControls[player]][KEY_UP]) ++ InputState |= BATTLE_THRUST; ++ return InputState; ++ } ++ ++ int axisX = VControl_GetJoyAxis(0, player * 2), axisY = VControl_GetJoyAxis(0, player * 2 + 1); ++ ++ if( axisX == 0 && axisY == 0 ) ++ { ++ // Some basic gamepad input support ++ axisX = VControl_GetJoyAxis(2, player * 2); ++ axisY = VControl_GetJoyAxis(2, player * 2 + 1); ++ if( abs( axisX ) > 5000 || abs( axisY ) > 5000 ) // Deadspot at the center ++ { ++ if( !JoystickTapFlag[player] ) ++ TFB_SetOnScreenKeyboard_Hidden (); // Gamepad used - hide on-screen keys ++ JoystickTapFlag[player] = TRUE; ++ JoystickThrust[player] = FALSE; ++ // Turning thrust with joystick is uncomfortable ++ //if( abs( axisX ) > 25000 || abs( axisY ) > 25000 ) ++ // JoystickThrust[player] = TRUE; ++ } ++ else ++ { ++ axisX = 0; ++ axisY = 0; ++ } ++ } ++ ++ if( !optDirectionalJoystick ) ++ { ++ if( axisX < -10000 ) ++ InputState |= BATTLE_LEFT; ++ if( axisX > 10000 ) ++ InputState |= BATTLE_RIGHT; ++ if( axisY < 0 ) ++ InputState |= BATTLE_THRUST; ++ return InputState; ++ } ++ ++ if( axisX != 0 || axisY != 0 ) ++ { ++ int angle = atan2i(axisY, axisX), diff; ++ // Convert it to 16 directions used by Melee ++ angle += atan2i_PI / SHIP_DIRECTIONS; ++ if( angle < 0 ) ++ angle += atan2i_PI * 2; ++ if( angle > atan2i_PI * 2 ) ++ angle -= atan2i_PI * 2; ++ angle = angle * SHIP_DIRECTIONS / atan2i_PI / 2; ++ ++ diff = angle - direction - SHIP_DIRECTIONS / 4; ++ while( diff >= SHIP_DIRECTIONS ) ++ diff -= SHIP_DIRECTIONS; ++ while( diff < 0 ) ++ diff += SHIP_DIRECTIONS; ++ ++ if( diff < SHIP_DIRECTIONS / 2 ) ++ InputState |= BATTLE_LEFT; ++ if( diff > SHIP_DIRECTIONS / 2 ) ++ InputState |= BATTLE_RIGHT; ++ ++ if( !JoystickTapFlag[player] ) ++ { ++ JoystickTapFlag[player] = TRUE; ++ if( GetTimeCounter() < JoystickTapTime[player] + ONE_SECOND ) ++ JoystickThrust[player] = !JoystickThrust[player]; ++ else ++ JoystickThrust[player] = TRUE; ++ } ++ if( JoystickThrust[player] ) ++ InputState |= BATTLE_THRUST; ++ } ++ else ++ { ++ if( JoystickTapFlag[player] ) ++ { ++ JoystickTapFlag[player] = FALSE; ++ JoystickTapTime[player] = GetTimeCounter(); ++ } ++ } ++ return InputState; ++} +Index: src/uqm/planets/lander.c +=================================================================== +--- src/uqm/planets/lander.c (revision 1330) ++++ src/uqm/planets/lander.c (working copy) +@@ -1852,15 +1852,15 @@ + if (crew_left) + { + SIZE index = GetFrameIndex (LanderFrame[0]); ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + if (turn_wait) + --turn_wait; +- else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] || +- CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ else if ((InputState & BATTLE_LEFT) || (InputState & BATTLE_RIGHT)) + { + COUNT landerSpeedNumer; + COUNT angle; + +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + --index; + else + ++index; +@@ -1884,7 +1884,7 @@ + turn_wait = SHUTTLE_TURN_WAIT; + } + +- if (!CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (!(InputState & BATTLE_THRUST)) + { + dx = 0; + dy = 0; +@@ -2212,7 +2212,9 @@ + landerInputState.Initialized = FALSE; + landerInputState.InputFunc = DoPlanetSide; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&landerInputState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + + if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) + { +Index: src/uqm/planets/solarsys.c +=================================================================== +--- src/uqm/planets/solarsys.c (revision 1330) ++++ src/uqm/planets/solarsys.c (working copy) +@@ -1245,18 +1245,19 @@ + static void + ProcessShipControls (void) + { +- COUNT index; ++ COUNT index = GetFrameIndex (GLOBAL (ShipStamp.frame));; + SIZE delta_x, delta_y; ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + +- if (CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (InputState & BATTLE_THRUST) + delta_y = -1; + else + delta_y = 0; + + delta_x = 0; +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + delta_x -= 1; +- if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ if (InputState & BATTLE_RIGHT) + delta_x += 1; + + if (delta_x || delta_y < 0) +@@ -1269,7 +1270,6 @@ + else + delta_y = 0; + +- index = GetFrameIndex (GLOBAL (ShipStamp.frame)); + if (pSolarSysState->turn_counter) + --pSolarSysState->turn_counter; + else if (delta_x) +@@ -2473,7 +2473,9 @@ + InitSolarSys (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SolarSysState.InputFunc = DoIpFlight; ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&SolarSysState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + UninitSolarSys (); + pSolarSysState = 0; + } +@@ -2751,13 +2753,17 @@ + + if (pSS->InOrbit) + { // CheckShipLocation() or InitSolarSys() sent us to orbital ++ TFB_SetOnScreenKeyboard_Menu (); + EnterPlanetOrbit (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + pSS->InOrbit = FALSE; + } + else if (cancel || LastActivity == CHECK_LOAD) + { ++ TFB_SetOnScreenKeyboard_Menu (); + SolarSysMenu (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + } + else +Index: src/uqm/planets/pstarmap.c +=================================================================== +--- src/uqm/planets/pstarmap.c (revision 1330) ++++ src/uqm/planets/pstarmap.c (working copy) +@@ -2005,7 +2005,9 @@ + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY, + TRUE); ++ TFB_SetOnScreenKeyboard_Starmap (); + DoInput (&MenuState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + SetDefaultMenuRepeatDelay (); + +Index: src/uqm/menu.c +=================================================================== +--- src/uqm/menu.c (revision 1330) ++++ src/uqm/menu.c (working copy) +@@ -508,7 +508,7 @@ + s.origin.x = RADAR_X - r.corner.x; + s.origin.y = RADAR_Y - r.corner.y; + r.corner.x = s.origin.x - 1; +- r.corner.y = s.origin.y - (11 << RESOLUTION_FACTOR); // JMS_GFX ++ r.corner.y = s.origin.y - (40 << RESOLUTION_FACTOR); // JMS_GFX + r.extent.width = RADAR_WIDTH + 2; + BatchGraphics (); + SetContextForeGroundColor ( +Index: src/uqm/globdata.c +=================================================================== +--- src/uqm/globdata.c (revision 1330) ++++ src/uqm/globdata.c (working copy) +@@ -130,7 +130,7 @@ + OldContext = SetContext (RadarContext); + SetContextFGFrame (Screen); + r.corner.x = RADAR_X; +- r.corner.y = RADAR_Y; ++ r.corner.y = RADAR_Y_LIFTED_UP; + r.extent.width = RADAR_WIDTH; + r.extent.height = RADAR_HEIGHT; + SetContextClipRect (&r); +Index: src/uqm/shipyard.c +=================================================================== +--- src/uqm/shipyard.c (revision 1330) ++++ src/uqm/shipyard.c (working copy) +@@ -212,9 +212,9 @@ + OldContext = SetContext (StatusContext); + GetContextClipRect (&r); + s.origin.x = RADAR_X - r.corner.x; +- s.origin.y = RADAR_Y - r.corner.y; ++ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y; + r.corner.x = s.origin.x - 1; +- r.corner.y = s.origin.y - RES_CASE(11,24,33); // JMS_GFX ++ r.corner.y = s.origin.y - RES_CASE(1,2,3); // JMS_GFX + r.extent.width = RADAR_WIDTH + 2; + r.extent.height = RES_CASE(11,24,33); // JMS_GFX + BatchGraphics (); +@@ -242,8 +242,6 @@ + hStarShip = GetAvailableRaceFromIndex (NewRaceItem); + NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q), + hStarShip); +- s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 3 + NewRaceItem); +- DrawStamp (&s); + FleetPtr = LockFleetInfo (&GLOBAL (avail_race_q), hStarShip); + s.frame = FleetPtr->melee_icon; + UnlockFleetInfo (&GLOBAL (avail_race_q), hStarShip); +@@ -253,6 +251,12 @@ + s.origin.x += (RADAR_WIDTH >> 1); + s.origin.y += (RADAR_HEIGHT >> 1); + DrawStamp (&s); ++ // Draw the ship name, above the ship image. ++ s.origin.x -= (RADAR_WIDTH >> 1); ++ s.origin.y -= (RADAR_HEIGHT >> 2); ++ s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 3 + NewRaceItem); ++ DrawStamp (&s); ++ + t.align = ALIGN_RIGHT; + t.CharCount = (COUNT)~0; + t.pStr = buf; +Index: src/uqm/confirm.c +=================================================================== +--- src/uqm/confirm.c (revision 1330) ++++ src/uqm/confirm.c (working copy) +@@ -34,9 +34,11 @@ + #include + + +-#define CONFIRM_WIN_WIDTH (80 << RESOLUTION_FACTOR) // JMS_GFX ++#define CONFIRM_WIN_WIDTH (160 << RESOLUTION_FACTOR) // JMS_GFX + #define CONFIRM_WIN_HEIGHT (22 << RESOLUTION_FACTOR) // JMS_GFX + ++BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; ++ + static void + DrawConfirmationWindow (BOOLEAN answer) + { +@@ -67,6 +69,8 @@ + font_DrawText (&t); + t.baseline.x += (r.extent.width >> 1); + t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt + SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); + font_DrawText (&t); + +@@ -111,8 +115,16 @@ + + FlushInput (); + done = FALSE; ++ ++ #ifdef ANDROID ++ if ( !(GLOBAL (CurrentActivity) & IN_BATTLE) ) { ++ /* Abort immediately */ ++ response = TRUE; ++ done = TRUE; ++ } ++ #endif + +- do { ++ while (!done) { + // Forbid recursive calls or pausing here! + ExitRequested = FALSE; + GamePaused = FALSE; +@@ -139,7 +151,7 @@ + PlayMenuSound (MENU_SOUND_MOVE); + } + SleepThread (ONE_SECOND / 30); +- } while (!done); ++ } + + // Restore the screen under the confirmation window + DrawStamp (&s); +@@ -152,6 +164,8 @@ + } + else + { ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ EmergencyEscapeWarpUnitActivatedFromMenu = TRUE; + result = FALSE; + } + ExitRequested = FALSE; +Index: src/uqm/hyper.c +=================================================================== +--- src/uqm/hyper.c (revision 1330) ++++ src/uqm/hyper.c (working copy) +@@ -1930,7 +1930,6 @@ + Color OldColor; + CONTEXT OldContext; + MENU_STATE MenuState; +- + UnbatchGraphics (); + + OldContext = SetContext (SpaceContext); +Index: src/uqm/intro.c +=================================================================== +--- src/uqm/intro.c (revision 1330) ++++ src/uqm/intro.c (working copy) +@@ -909,7 +909,9 @@ + pis.MovieFrame = -1; + pis.StartTime = GetTimeCounter (); + pis.LastSyncTime = pis.StartTime; ++ TFB_SetOnScreenKeyboard_Hidden (); + DoInput (&pis, TRUE); ++ TFB_SetOnScreenKeyboard_Menu(); + + SleepThreadUntil (FadeMusic (0, ONE_SECOND)); + StopMusic (); +@@ -1001,7 +1003,9 @@ + vis.InputFunc = DoVideoInput; + vis.CurVideo = ref; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); ++ TFB_SetOnScreenKeyboard_Hidden (); + DoInput (&vis, TRUE); ++ TFB_SetOnScreenKeyboard_Menu (); + + StopLegacyVideo (ref); + FadeClearScreen (); +@@ -1017,6 +1021,7 @@ + { + return FALSE; + } ++ + if (!strcmp (resType, "STRTAB")) + { + STRING pres = CaptureStringTable (LoadStringTable (res)); +Index: src/uqm/starcon.c +=================================================================== +--- src/uqm/starcon.c (revision 1330) ++++ src/uqm/starcon.c (working copy) +@@ -240,6 +240,7 @@ + if (LastActivity == (CHECK_LOAD | CHECK_RESTART)) + AskNameForCaptainAndShip(); + ++ TFB_SetOnScreenKeyboard_Melee (); + do + { + #ifdef DEBUG +Index: src/uqm/battle.c +=================================================================== +--- src/uqm/battle.c (revision 1330) ++++ src/uqm/battle.c (working copy) +@@ -16,6 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifdef ANDROID ++#include ++#endif ++ + #include "battle.h" + + #include "battlecontrols.h" +@@ -43,6 +47,8 @@ + #include "libs/graphics/gfx_common.h" + #include "libs/log.h" + #include "libs/mathlib.h" ++#include "globdata.h" ++#include "libs/input/sdl/vcontrol.h" + + + BYTE battle_counter[NUM_SIDES]; +@@ -137,7 +143,8 @@ + frameInputHuman (HumanInputContext *context, STARSHIP *StarShipPtr) + { + (void) StarShipPtr; +- return CurrentInputToBattleInput (context->playerNr); ++ ++ return CurrentInputToBattleInput (context->playerNr, StarShipPtr ? StarShipPtr->ShipFacing : -1); + } + + static void +@@ -207,8 +214,11 @@ + StarShipPtr->ship_input_state |= SPECIAL; + + if (CanRunAway && cur_player == 0 && +- (InputState & BATTLE_ESCAPE)) ++ ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu)) ++ { ++ EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; + DoRunAway (StarShipPtr); ++ } + } + } + +@@ -399,6 +409,11 @@ + + LockMutex (GraphicsLock); + ++ TFB_SetOnScreenKeyboard_Melee (); ++ if (PlayerControl[1] & HUMAN_CONTROL) { ++ TFB_SetOnScreenKeyboard_TwoPlayersMelee (); ++ } ++ + #if !(DEMO_MODE || CREATE_JOURNAL) + if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) { + // In Supermelee, the RNG is already initialised. +@@ -512,6 +527,8 @@ + UninitShips (); + FreeBattleSong (); + ++ TFB_SetOnScreenKeyboard_Menu (); ++ + UnlockMutex (GraphicsLock); + + return (BOOLEAN) (num_ships < 0); +Index: src/uqm/controls.h +=================================================================== +--- src/uqm/controls.h (revision 1330) ++++ src/uqm/controls.h (working copy) +@@ -32,6 +32,7 @@ + KEY_WEAPON, + KEY_SPECIAL, + KEY_ESCAPE, ++ KEY_THRUST, + NUM_KEYS + }; + enum { +@@ -90,13 +91,14 @@ + #define BATTLE_ESCAPE ((BATTLE_INPUT_STATE)(1 << 5)) + #define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6)) + +-BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player); ++BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player, int direction /* = -1 for no directional input */); + BATTLE_INPUT_STATE PulsedInputToBattleInput (COUNT player); + + extern CONTROLLER_INPUT_STATE CurrentInputState; + extern CONTROLLER_INPUT_STATE PulsedInputState; + extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; + extern CONTROL_TEMPLATE PlayerControls[]; ++extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu; + + void UpdateInputState (void); + extern void FlushInput (void); +@@ -116,6 +118,8 @@ + BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput); + BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput); + ++extern BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player); ++ + void DoPopupWindow(const char *msg); + + typedef void (InputFrameCallback) (void); +Index: src/uqm/outfit.c +=================================================================== +--- src/uqm/outfit.c (revision 1330) ++++ src/uqm/outfit.c (working copy) +@@ -59,7 +59,7 @@ + OldContext = SetContext (StatusContext); + GetContextClipRect (&r); + s.origin.x = RADAR_X - r.corner.x; +- s.origin.y = RADAR_Y - r.corner.y - 19 * RESOLUTION_FACTOR; // JMS_GFX; ++ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y + RES_CASE(10,6,12); // JMS_GFX; + r.corner.x = s.origin.x - 1; + r.corner.y = s.origin.y - 11; + r.extent.width = RADAR_WIDTH + 2; +Index: src/uqm/comm/vux/vuxc.c +=================================================================== +--- src/uqm/comm/vux/vuxc.c (revision 1330) ++++ src/uqm/comm/vux/vuxc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../vux/strings.h" + + static LOCDATA vux_desc_1x = + { +Index: src/uqm/comm/shofixt/shofixt.c +=================================================================== +--- src/uqm/comm/shofixt/shofixt.c (revision 1330) ++++ src/uqm/comm/shofixt/shofixt.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../shofixt/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/pkunk/pkunkc.c +=================================================================== +--- src/uqm/comm/pkunk/pkunkc.c (revision 1330) ++++ src/uqm/comm/pkunk/pkunkc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../pkunk/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/spathi/spathic.c +=================================================================== +--- src/uqm/comm/spathi/spathic.c (revision 1330) ++++ src/uqm/comm/spathi/spathic.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../spathi/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/rebel/rebel.c +=================================================================== +--- src/uqm/comm/rebel/rebel.c (revision 1330) ++++ src/uqm/comm/rebel/rebel.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../yehat/resinst.h" +-#include "strings.h" ++#include "../rebel/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/druuge/druugec.c +=================================================================== +--- src/uqm/comm/druuge/druugec.c (revision 1330) ++++ src/uqm/comm/druuge/druugec.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../druuge/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +Index: src/uqm/comm/spahome/spahome.c +=================================================================== +--- src/uqm/comm/spahome/spahome.c (revision 1330) ++++ src/uqm/comm/spahome/spahome.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../spathi/resinst.h" +-#include "strings.h" ++#include "../spahome/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/starbas/starbas.c +=================================================================== +--- src/uqm/comm/starbas/starbas.c (revision 1330) ++++ src/uqm/comm/starbas/starbas.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../comandr/resinst.h" +-#include "strings.h" ++#include "../starbas/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +Index: src/uqm/comm/utwig/utwigc.c +=================================================================== +--- src/uqm/comm/utwig/utwigc.c (revision 1330) ++++ src/uqm/comm/utwig/utwigc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../utwig/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/umgah/umgahc.c +=================================================================== +--- src/uqm/comm/umgah/umgahc.c (revision 1330) ++++ src/uqm/comm/umgah/umgahc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../umgah/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/talkpet/talkpet.c +=================================================================== +--- src/uqm/comm/talkpet/talkpet.c (revision 1330) ++++ src/uqm/comm/talkpet/talkpet.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../talkpet/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/syreen/syreenc.c +=================================================================== +--- src/uqm/comm/syreen/syreenc.c (revision 1330) ++++ src/uqm/comm/syreen/syreenc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../syreen/strings.h" + + #include "libs/sound/sound.h" + #include "uqm/build.h" +Index: src/uqm/comm/melnorm/melnorm.c +=================================================================== +--- src/uqm/comm/melnorm/melnorm.c (revision 1330) ++++ src/uqm/comm/melnorm/melnorm.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../melnorm/strings.h" + + #include "uqm/gameev.h" + #include "uqm/setup.h" +Index: src/uqm/comm/yehat/yehatc.c +=================================================================== +--- src/uqm/comm/yehat/yehatc.c (revision 1330) ++++ src/uqm/comm/yehat/yehatc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../yehat/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/orz/orzc.c +=================================================================== +--- src/uqm/comm/orz/orzc.c (revision 1330) ++++ src/uqm/comm/orz/orzc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../orz/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/slyhome/slyhome.c +=================================================================== +--- src/uqm/comm/slyhome/slyhome.c (revision 1330) ++++ src/uqm/comm/slyhome/slyhome.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../slyhome/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/zoqfot/zoqfotc.c +=================================================================== +--- src/uqm/comm/zoqfot/zoqfotc.c (revision 1330) ++++ src/uqm/comm/zoqfot/zoqfotc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../zoqfot/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/comandr/comandr.c +=================================================================== +--- src/uqm/comm/comandr/comandr.c (revision 1330) ++++ src/uqm/comm/comandr/comandr.c (working copy) +@@ -20,7 +20,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../comandr/strings.h" + + #include "uqm/setup.h" + #include "uqm/sis.h" +Index: src/uqm/comm/blackur/blackurc.c +=================================================================== +--- src/uqm/comm/blackur/blackurc.c (revision 1330) ++++ src/uqm/comm/blackur/blackurc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../blackur/strings.h" + + static LOCDATA blackurq_desc = + { +Index: src/uqm/comm/mycon/myconc.c +=================================================================== +--- src/uqm/comm/mycon/myconc.c (revision 1330) ++++ src/uqm/comm/mycon/myconc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../mycon/strings.h" + + #include "uqm/gameev.h" + #include "libs/mathlib.h" +Index: src/uqm/comm/arilou/arilouc.c +=================================================================== +--- src/uqm/comm/arilou/arilouc.c (revision 1330) ++++ src/uqm/comm/arilou/arilouc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../arilou/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/chmmr/chmmrc.c +=================================================================== +--- src/uqm/comm/chmmr/chmmrc.c (revision 1330) ++++ src/uqm/comm/chmmr/chmmrc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../chmmr/strings.h" + + #include "uqm/build.h" + #include "uqm/hyper.h" +Index: src/uqm/comm/thradd/thraddc.c +=================================================================== +--- src/uqm/comm/thradd/thraddc.c (revision 1330) ++++ src/uqm/comm/thradd/thraddc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../thradd/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/slyland/slyland.c +=================================================================== +--- src/uqm/comm/slyland/slyland.c (revision 1330) ++++ src/uqm/comm/slyland/slyland.c (working copy) +@@ -16,10 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#include "../slyland/strings.h" ++#include + #include "../commall.h" +-#include + #include "resinst.h" +-#include "strings.h" + + #include "options.h" + #include "uqm/battle.h" +Index: src/uqm/comm/ilwrath/ilwrathc.c +=================================================================== +--- src/uqm/comm/ilwrath/ilwrathc.c (revision 1330) ++++ src/uqm/comm/ilwrath/ilwrathc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../ilwrath/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/urquan/urquanc.c +=================================================================== +--- src/uqm/comm/urquan/urquanc.c (revision 1330) ++++ src/uqm/comm/urquan/urquanc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../urquan/strings.h" + + static LOCDATA urquan_desc = + { +Index: src/uqm/comm/supox/supoxc.c +=================================================================== +--- src/uqm/comm/supox/supoxc.c (revision 1330) ++++ src/uqm/comm/supox/supoxc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../supox/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/intel.c +=================================================================== +--- src/uqm/intel.c (revision 1330) ++++ src/uqm/intel.c (working copy) +@@ -45,10 +45,10 @@ + // Allow a player to warp-escape in cyborg mode + if (StarShipPtr->playerNr == RPG_PLAYER_NUM) + InputState |= CurrentInputToBattleInput ( +- context->playerNr) & BATTLE_ESCAPE; ++ context->playerNr, -1) & BATTLE_ESCAPE; + } + else +- InputState = CurrentInputToBattleInput (context->playerNr); ++ InputState = CurrentInputToBattleInput (context->playerNr, -1); + } + else if (!(PlayerControl[context->playerNr] & PSYTRON_CONTROL)) + InputState = 0; +Index: src/uqm/status.c +=================================================================== +--- src/uqm/status.c (revision 1330) ++++ src/uqm/status.c (working copy) +@@ -328,7 +328,7 @@ + StarShipPtr->RaceDescPtr->characteristics.energy_wait; + + DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], +- 0, energy_delta); ++ 0, energy_delta, StarShipPtr->playerNr); + } + + return (retval); +@@ -370,7 +370,7 @@ + } + + DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], +- crew_delta, 0); ++ crew_delta, 0, StarShipPtr->playerNr); + + return (retval); + } +Index: src/uqm/supermelee/melee.c +=================================================================== +--- src/uqm/supermelee/melee.c (revision 1330) ++++ src/uqm/supermelee/melee.c (working copy) +@@ -2124,7 +2124,7 @@ + PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 0, + MenuState.load.preBuiltList[0]); +- PlayerControl[1] = COMPUTER_CONTROL | STANDARD_RATING; ++ PlayerControl[1] = HUMAN_CONTROL | STANDARD_RATING; // COMPUTER_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 1, + MenuState.load.preBuiltList[1]); + } +Index: src/uqm/status.h +=================================================================== +--- src/uqm/status.h (revision 1330) ++++ src/uqm/status.h (working copy) +@@ -36,9 +36,15 @@ + #define CAPTAIN_HEIGHT RES_STAT_SCALE(30) // JMS_GFX + #define CAPTAIN_XOFFS ((STATUS_WIDTH - CAPTAIN_WIDTH) >> 1) // JMS_GFX + #define CAPTAIN_YOFFS (SHIP_INFO_HEIGHT + (4 << RESOLUTION_FACTOR)) // JMS_GFX +-#define SHIP_STATUS_HEIGHT (STATUS_HEIGHT >> 1) +-#define BAD_GUY_YOFFS 0 +-#define GOOD_GUY_YOFFS SHIP_STATUS_HEIGHT ++#define SHIP_STATUS_HEIGHT ((STATUS_HEIGHT >> 1) - (17 << RESOLUTION_FACTOR)) ++#define BAD_GUY_YOFFS (-1 << RESOLUTION_FACTOR) ++#define GOOD_GUY_YOFFS (STATUS_HEIGHT - SHIP_STATUS_HEIGHT) ++#define HORIZ_CREW_ENERGY_SIZE (18 << RESOLUTION_FACTOR) ++#define HORIZ_CREW_XOFFS (2 << RESOLUTION_FACTOR) ++#define BAD_GUY_HORIZ_CREW_YOFFS (BAD_GUY_YOFFS + SHIP_STATUS_HEIGHT + (HORIZ_CREW_ENERGY_SIZE >> 1)) ++#define GOOD_GUY_HORIZ_CREW_YOFFS (GOOD_GUY_YOFFS - HORIZ_CREW_ENERGY_SIZE + (1 << RESOLUTION_FACTOR)) ++#define BAD_GUY_HORIZ_ENERGY_YOFFS (BAD_GUY_YOFFS + SHIP_STATUS_HEIGHT) ++#define GOOD_GUY_HORIZ_ENERGY_YOFFS (GOOD_GUY_YOFFS - (HORIZ_CREW_ENERGY_SIZE >> 1) + (1 << RESOLUTION_FACTOR)) + #define STARCON_TEXT_HEIGHT (7 << RESOLUTION_FACTOR) // JMS_GFX + #define TINY_TEXT_HEIGHT (9 << RESOLUTION_FACTOR) // JMS_GFX + #define BATTLE_CREW_X RES_STAT_SCALE(10) // JMS_GFX +@@ -54,7 +60,7 @@ + extern void InitShipStatus (SHIP_INFO *ShipInfoPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEAN inMeleeMenu); + // StarShipPtr or pClipRect can be NULL + extern void DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, +- SIZE crew_delta, SIZE energy_delta); ++ SIZE crew_delta, SIZE energy_delta, SIZE player_num); + extern void DrawBattleCrewAmount (SHIP_INFO *ShipInfoPtr, COORD y_offs); + + extern void DrawCaptainsWindow (STARSHIP *StarShipPtr); +Index: src/uqm/sis.c +=================================================================== +--- src/uqm/sis.c (revision 1330) ++++ src/uqm/sis.c (working copy) +@@ -1810,7 +1810,7 @@ + GetContextClipRect (&clip_r); + pRect = &temp_r; + temp_r.corner.x = RADAR_X - clip_r.corner.x; +- temp_r.corner.y = RADAR_Y - clip_r.corner.y; ++ temp_r.corner.y = RADAR_Y_LIFTED_UP - clip_r.corner.y; + temp_r.extent.width = RADAR_WIDTH; + temp_r.extent.height = RADAR_HEIGHT; + SetContext (ScreenContext); +Index: src/options.c +=================================================================== +--- src/options.c (revision 1330) ++++ src/options.c (working copy) +@@ -67,6 +67,7 @@ + BOOLEAN optRotatingIpPlanets; + BOOLEAN optTexturedIpPlanets; + BOOLEAN optCheatMode; ++BOOLEAN optDirectionalJoystick; + + BOOLEAN opt3doMusic; + BOOLEAN optRemixMusic; +@@ -480,6 +481,7 @@ + + for (i = 0; i < dirList->numNames; i++) + { ++ log_add (log_Info, "Mounting ZIP '%s'", dirList->names[i]); + if (uio_mountDir (repository, mountPoint, uio_FSTYPE_ZIP, + dirHandle, dirList->names[i], "/", autoMount, + relativeFlags | uio_MOUNT_RDONLY, +Index: src/options.h +=================================================================== +--- src/options.h (revision 1330) ++++ src/options.h (working copy) +@@ -54,6 +54,7 @@ + extern BOOLEAN optRotatingIpPlanets; + extern BOOLEAN optTexturedIpPlanets; + extern BOOLEAN optCheatMode; ++extern BOOLEAN optDirectionalJoystick; + + extern BOOLEAN opt3doMusic; + extern BOOLEAN optRemixMusic; +Index: src/uqm.c +=================================================================== +--- src/uqm.c (revision 1330) ++++ src/uqm.c (working copy) +@@ -63,6 +63,22 @@ + // Including this is actually necessary on OSX. + #endif + ++#if defined (ANDROID) ++# include ++static void AndroidAppPutToBackgroundCallback (void) ++{ ++ SDL_ANDROID_PauseAudioPlayback (); ++ GameActive = FALSE; ++ //GamePaused = TRUE; ++} ++static void SDLCALL AndroidAppRestoredCallback (void) ++{ ++ SDL_ANDROID_ResumeAudioPlayback (); ++ GameActive = TRUE; ++ //GamePaused = FALSE; ++} ++#endif ++ + struct bool_option + { + bool value; +@@ -138,6 +154,7 @@ + DECL_CONFIG_OPTION(bool, rotatingIpPlanets); // JMS + DECL_CONFIG_OPTION(bool, texturedIpPlanets); // JMS + DECL_CONFIG_OPTION(bool, cheatMode); // JMS ++ DECL_CONFIG_OPTION(bool, directionalJoystick); + + #define INIT_CONFIG_OPTION(name, val) \ + { val, false } +@@ -256,8 +273,8 @@ + INIT_CONFIG_OPTION( gamma, 0.0f ), + INIT_CONFIG_OPTION( soundDriver, audio_DRIVER_MIXSDL ), + INIT_CONFIG_OPTION( soundQuality, audio_QUALITY_MEDIUM ), +- INIT_CONFIG_OPTION( use3doMusic, true ), +- INIT_CONFIG_OPTION( useRemixMusic, false ), ++ INIT_CONFIG_OPTION( use3doMusic, false ), ++ INIT_CONFIG_OPTION( useRemixMusic, true ), + INIT_CONFIG_OPTION( whichCoarseScan, OPT_PC ), + INIT_CONFIG_OPTION( whichMenu, OPT_PC ), + INIT_CONFIG_OPTION( whichFonts, OPT_PC ), +@@ -271,15 +288,16 @@ + INIT_CONFIG_OPTION( sfxVolumeScale, 1.0f ), + INIT_CONFIG_OPTION( speechVolumeScale, 0.3f ), + INIT_CONFIG_OPTION( safeMode, false ), +- INIT_CONFIG_OPTION( resolutionFactor, 2 ), ++ INIT_CONFIG_OPTION( resolutionFactor, 1 ), + INIT_CONFIG_OPTION( forceAspectRatio, false ), + INIT_CONFIG_OPTION( loresBlowupScale, 0 ), + INIT_CONFIG_OPTION( mainmenuMusic, true ), +- INIT_CONFIG_OPTION( mineralSubmenu, true ), ++ INIT_CONFIG_OPTION( mineralSubmenu, false ), + INIT_CONFIG_OPTION( nebulae, true ), + INIT_CONFIG_OPTION( rotatingIpPlanets, true), + INIT_CONFIG_OPTION( texturedIpPlanets, true), + INIT_CONFIG_OPTION( cheatMode, false ), ++ INIT_CONFIG_OPTION( directionalJoystick, true ), + }; + struct options_struct defaults = options; + int optionsResult; +@@ -346,6 +364,14 @@ + return optionsResult; + } + ++#if defined (ANDROID) ++ SDL_ANDROID_SetApplicationPutToBackgroundCallback (AndroidAppPutToBackgroundCallback, AndroidAppRestoredCallback); ++ if( !fileExists("config/save") ) { ++ // Copy savegames from UQM non-HD, I'm too lazy to do that properly. ++ system("SAVEDIR=`pwd`/config/save ; mkdir -p $SAVEDIR ; cd ../../../../app-data/com.sourceforge.sc2/config/save || exit 1 ; for f in * ; do cat $f > $SAVEDIR/$f ; done"); ++ } ++#endif ++ + TFB_PreInit (); + mem_init (); + InitThreadSystem (); +@@ -413,6 +439,7 @@ + optRotatingIpPlanets = options.rotatingIpPlanets.value; // JMS + optTexturedIpPlanets = options.texturedIpPlanets.value || optRotatingIpPlanets; // JMS + optCheatMode = options.cheatMode.value; // JMS ++ optDirectionalJoystick = options.directionalJoystick.value; + + prepareContentDir (options.contentDir, options.addonDir, argv[0]); + prepareMeleeDir (); +@@ -696,6 +723,7 @@ + getBoolConfigValue (&options->rotatingIpPlanets, "config.rotatingIpPlanets"); + getBoolConfigValue (&options->texturedIpPlanets, "config.texturedIpPlanets"); + getBoolConfigValue (&options->cheatMode, "config.cheatMode"); ++ getBoolConfigValue (&options->directionalJoystick, "config.directionaljoystick"); + + if (res_IsInteger ("config.player1control")) + { diff --git a/project/jni/application/uqm-hd/icon.png b/project/jni/application/uqm-hd/icon.png new file mode 100644 index 000000000..cfc975a2e Binary files /dev/null and b/project/jni/application/uqm-hd/icon.png differ diff --git a/project/jni/application/uqm/.gitignore b/project/jni/application/uqm/.gitignore new file mode 100644 index 000000000..85de9cf93 --- /dev/null +++ b/project/jni/application/uqm/.gitignore @@ -0,0 +1 @@ +src diff --git a/project/jni/application/uqm/AndroidAppSettings.cfg b/project/jni/application/uqm/AndroidAppSettings.cfg new file mode 100644 index 000000000..f4a0bd6b0 --- /dev/null +++ b/project/jni/application/uqm/AndroidAppSettings.cfg @@ -0,0 +1,215 @@ +# The application settings for Android libSDL port + +AppSettingVersion=18 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) +LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) +AppName="Ur-Quan Masters" + +# Specify reversed site name of application (e.x. com.mysite.myapp) +AppFullName=com.sourceforge.sc2 + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape +ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=n + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!Game data (15 Mb)|http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/sc2-data-6.zip/download^!UQM music remix pack (240 Mb)|:addons/uqm-remix.uqm:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/uqm-remix.uqm/download^!Voice pack (120 Mb)|:addons/uqm-0.7.0-voice.uqm:http://sourceforge.net/projects/sc2/files/UQM/0.7/uqm-0.7.0-voice.uqm/download^3DO music (20 Mb)|:addons/uqm-0.7.0-3domusic.uqm:http://sourceforge.net/projects/sc2/files/UQM/0.7/uqm-0.7.0-3domusic.uqm/download^Russian translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/russian.zip/download^Deutsch translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/deutsch.zip/download^Spanish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/spanish.zip/download^Slovak translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/slovak.zip/download^Finnish translation|:addons/lang/shadow-content/lang.zip:http://sourceforge.net/projects/libsdl-android/files/Ur-Quan%20Masters/translations/2/finnish.zip/download" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) +VideoDepthBpp=16 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedDepthBuffer=n + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedStencilBuffer=n + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) +NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) +SwVideoMode=y + +# Application video output will be resized to fit into native device screen (y)/(n) +SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) +SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) +CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) +CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) +CompatibilityHacksTextInputEmulatesHwKeyboard=n + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) +CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) +CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user +AppUsesMouse=n + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) +AppNeedsTwoButtonMouse=n + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) +ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) +ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) +AppNeedsArrowKeys=n + +# Application needs text input (y) or (n), enables button for text input on screen +AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 +AppUsesJoystick=y + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=y + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 +AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 +AppUsesMultitouch=n + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state +NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA +RedefinedKeys="RETURN RSHIFT NO_REMAP NO_REMAP RCTRL F10" + +# Number of virtual keyboard keys (currently 6 is maximum) +AppTouchscreenKeyboardKeysAmount=6 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) +AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) +RedefinedKeysScreenKb="RCTRL RSHIFT END PAGEUP PAGEDOWN W UNKNOWN UNKNOWN UNKNOWN UNKNOWN" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="Fire Secondary_weapon Thrust Player_2_fire Player_2_secondary_weapon Player_2_thrust" + +# How long to show startup menu button, in msec, 0 to disable startup menu +StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# OkButton DummyMenu MainMenu MouseConfigMainMenu KeyboardConfigMainMenu DownloadConfig OptionalDownloadConfig ScreenKeyboardSizeConfig ScreenKeyboardDrawSizeConfig ScreenKeyboardThemeConfig ScreenKeyboardTransparencyConfig AudioConfig DisplaySizeConfig LeftClickConfig RightClickConfig AdditionalMouseConfig JoystickMouseConfig TouchPressureMeasurementTool RemapHwKeysConfig RemapScreenKbConfig ScreenGesturesConfig CalibrateTouchscreenMenu CustomizeScreenKbLayout VideoSettingsConfig ShowReadme GyroscopeCalibration ResetToDefaultsConfig +HiddenMenuOptions='' + +# Menu items to show at startup - this is Java code snippet, leave empty for default: +# new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration() +# Available menu items: +# new Settings.OkButton(), new Settings.DummyMenu(), new Settings.MainMenu(), new Settings.MouseConfigMainMenu(), new Settings.KeyboardConfigMainMenu(), new Settings.DownloadConfig(), new Settings.OptionalDownloadConfig(), new Settings.ScreenKeyboardSizeConfig(), new Settings.ScreenKeyboardDrawSizeConfig(), new Settings.ScreenKeyboardThemeConfig(), new Settings.ScreenKeyboardTransparencyConfig(), new Settings.AudioConfig(), new Settings.DisplaySizeConfig(), new Settings.LeftClickConfig(), new Settings.RightClickConfig(), new Settings.AdditionalMouseConfig(), new Settings.JoystickMouseConfig(), new Settings.TouchPressureMeasurementTool(), new Settings.RemapHwKeysConfig(), new Settings.RemapScreenKbConfig(), new Settings.ScreenGesturesConfig(), new Settings.CalibrateTouchscreenMenu(), new Settings.CustomizeScreenKbLayout(), new Settings.VideoSettingsConfig(), new Settings.ShowReadme(), new Settings.GyroscopeCalibration(), new Settings.ResetToDefaultsConfig(), +FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI=y + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower +AppMinimumRAM=0 + +# Application version code (integer) +AppVersionCode=07023 + +# Application user-visible version name (string) +AppVersionName="0.7.0.23" + +# Reset SDL config when updating application to the new version (y) / (n) +ResetSdlConfigForThisVersion=y + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) +DeleteFilesOnUpgrade="addons packages menu.key uqm.key uqm.rmp version config/uqm.cfg config/flight.cfg libsdl-DownloadFinished-4.flag libsdl-DownloadFinished-5.flag libsdl-DownloadFinished-6.flag libsdl-DownloadFinished-7.flag libsdl-DownloadFinished-8.flag" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 +CompiledLibraries="sdl_image tremor ogg" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) +CustomBuildScript=n + +# Aditional CFLAGS for application +AppCflags='-O3 -DGFXMODULE_SDL -DOVCODEC_TREMOR -DNETPLAY=NETPLAY_FULL -DHAVE_JOYSTICK -DHAVE_ZIP=1 -DTHREADLIB_SDL -DUSE_INTERNAL_MIKMOD' + +# Additional LDFLAGS for application +AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders=y + +# Build only following subdirs (empty will build all dirs, ignored with custom script) +AppSubdirsBuild='src src/libs/* src/uqm/*' + +# Exclude these files from build +AppBuildExclude='src/libs/uio/hashtable.c src/libs/uio/memdebug.c src/libs/network/socket/socket_win.c src/libs/network/network_win.c src/libs/network/netmanager/netmanager_win.c src/libs/cdp/cdpapi.c src/libs/cdp/cdp.c src/libs/cdp/windl.c' + +# Application command line parameters, including app name as 0-th param +AppCmdline='uqm --addon lang' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) +ReadmeText='Change in controls! Tap joystick to turn off engines and rotate ship, tap once more to enable engines.\\\\nSecond screen joystick added for two-player melee.\\\\nUQM HD mod now available, with delicious 720p graphics.\\\\nDo not select multiple translations, only one will work.^button:UQM HD mod:https://play.google.com/store/apps/details?id=com.googlecode.uqm.hd' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge +MinimumScreenSize=m + +# Your AdMob Publisher ID, (n) if you don't want advertisements +AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad +AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) +AdmobBannerSize= + diff --git a/project/jni/application/sc2/AndroidData/logo.png b/project/jni/application/uqm/AndroidData/logo.png similarity index 100% rename from project/jni/application/sc2/AndroidData/logo.png rename to project/jni/application/uqm/AndroidData/logo.png diff --git a/project/jni/application/sc2/AndroidPreBuild.sh b/project/jni/application/uqm/AndroidPreBuild.sh similarity index 65% rename from project/jni/application/sc2/AndroidPreBuild.sh rename to project/jni/application/uqm/AndroidPreBuild.sh index 1be1c3e2e..21360cb81 100755 --- a/project/jni/application/sc2/AndroidPreBuild.sh +++ b/project/jni/application/uqm/AndroidPreBuild.sh @@ -6,5 +6,5 @@ LOCAL_PATH=`cd $LOCAL_PATH && pwd` if [ -e src/patched.successfully ]; then exit 0 else - svn co https://sc2.svn.sourceforge.net/svnroot/sc2/trunk/sc2/src && patch -p0 -d src < android.diff && touch src/patched.successfully || exit 1 + svn co https://sc2.svn.sourceforge.net/svnroot/sc2/trunk/sc2/src && patch -p0 < android.diff && svn add src/config_unix.h && touch src/patched.successfully || exit 1 fi diff --git a/project/jni/application/uqm/BUGS b/project/jni/application/uqm/BUGS new file mode 100644 index 000000000..2a6cb8bd7 --- /dev/null +++ b/project/jni/application/uqm/BUGS @@ -0,0 +1,2 @@ +PS3 gamepad support +Minor bug: mirror ship selection menu for second player diff --git a/project/jni/application/uqm/android.diff b/project/jni/application/uqm/android.diff new file mode 100644 index 000000000..d8b665807 --- /dev/null +++ b/project/jni/application/uqm/android.diff @@ -0,0 +1,2126 @@ +Index: src/options.h +=================================================================== +--- src/options.h (revision 3779) ++++ src/options.h (working copy) +@@ -41,6 +41,7 @@ + extern int optWhichShield; + extern int optSmoothScroll; + extern int optMeleeScale; ++extern int optDirectionalJoystick; + + extern BOOLEAN opt3doMusic; + extern BOOLEAN optRemixMusic; +Index: src/uqm.c +=================================================================== +--- src/uqm.c (revision 3779) ++++ src/uqm.c (working copy) +@@ -62,6 +62,22 @@ + // Including this is actually necessary on OSX. + #endif + ++#if defined (ANDROID) ++# include ++static void AndroidAppPutToBackgroundCallback (void) ++{ ++ SDL_ANDROID_PauseAudioPlayback (); ++ GameActive = FALSE; ++ //GamePaused = TRUE; ++} ++static void SDLCALL AndroidAppRestoredCallback (void) ++{ ++ SDL_ANDROID_ResumeAudioPlayback (); ++ GameActive = TRUE; ++ //GamePaused = FALSE; ++} ++#endif ++ + struct bool_option + { + bool value; +@@ -129,6 +145,7 @@ + DECL_CONFIG_OPTION(float, sfxVolumeScale); + DECL_CONFIG_OPTION(float, speechVolumeScale); + DECL_CONFIG_OPTION(bool, safeMode); ++ DECL_CONFIG_OPTION(bool, directionalJoystick); + + #define INIT_CONFIG_OPTION(name, val) \ + { val, false } +@@ -247,8 +264,8 @@ + INIT_CONFIG_OPTION( gamma, 1.0f ), + INIT_CONFIG_OPTION( soundDriver, audio_DRIVER_MIXSDL ), + INIT_CONFIG_OPTION( soundQuality, audio_QUALITY_MEDIUM ), +- INIT_CONFIG_OPTION( use3doMusic, true ), +- INIT_CONFIG_OPTION( useRemixMusic, false ), ++ INIT_CONFIG_OPTION( use3doMusic, false ), ++ INIT_CONFIG_OPTION( useRemixMusic, true ), + INIT_CONFIG_OPTION( useSpeech, true ), + INIT_CONFIG_OPTION( whichCoarseScan, OPT_PC ), + INIT_CONFIG_OPTION( whichMenu, OPT_PC ), +@@ -263,6 +280,7 @@ + INIT_CONFIG_OPTION( sfxVolumeScale, 1.0f ), + INIT_CONFIG_OPTION( speechVolumeScale, 1.0f ), + INIT_CONFIG_OPTION( safeMode, false ), ++ INIT_CONFIG_OPTION( directionalJoystick, true ), + }; + struct options_struct defaults = options; + int optionsResult; +@@ -390,6 +408,7 @@ + sfxVolumeScale = options.sfxVolumeScale.value; + speechVolumeScale = options.speechVolumeScale.value; + optAddons = options.addons; ++ optDirectionalJoystick = options.directionalJoystick.value; + + prepareContentDir (options.contentDir, options.addonDir, argv[0]); + prepareMeleeDir (); +@@ -439,6 +458,10 @@ + (volatile int *)ImmediateInputState.key, NUM_TEMPLATES, NUM_KEYS); + TFB_InitInput (TFB_INPUTDRIVER_SDL, 0); + ++#if defined (ANDROID) ++ SDL_ANDROID_SetApplicationPutToBackgroundCallback (AndroidAppPutToBackgroundCallback, AndroidAppRestoredCallback); ++#endif ++ + StartThread (Starcon2Main, NULL, 1024, "Starcon2Main"); + + for (i = 0; i < 2000 && !MainExited; ) +@@ -637,6 +660,7 @@ + getBoolConfigValue (&options->fullscreen, "config.fullscreen"); + getBoolConfigValue (&options->scanlines, "config.scanlines"); + getBoolConfigValue (&options->showFps, "config.showfps"); ++ getBoolConfigValue (&options->directionalJoystick, "config.directionaljoystick"); + getBoolConfigValue (&options->keepAspectRatio, "config.keepaspectratio"); + getGammaConfigValue (&options->gamma, "config.gamma"); + +Index: src/libs/graphics/gfx_common.h +=================================================================== +--- src/libs/graphics/gfx_common.h (revision 3779) ++++ src/libs/graphics/gfx_common.h (working copy) +@@ -107,4 +107,10 @@ + extern int ScreenColorDepth; + extern int GraphicsDriver; + ++void TFB_SetOnScreenKeyboard_Hidden (void); ++void TFB_SetOnScreenKeyboard_Menu (void); ++void TFB_SetOnScreenKeyboard_Starmap (void); ++void TFB_SetOnScreenKeyboard_Melee (void); ++void TFB_SetOnScreenKeyboard_TwoPlayersMelee (void); ++ + #endif +Index: src/libs/graphics/sdl/pure.c +=================================================================== +--- src/libs/graphics/sdl/pure.c (revision 3779) ++++ src/libs/graphics/sdl/pure.c (working copy) +@@ -104,6 +104,7 @@ + { + int i, videomode_flags; + SDL_PixelFormat conv_fmt; ++ int BPP = 32; + + GraphicsDriver = driver; + +@@ -128,6 +129,14 @@ + "under pure SDL, using 640x480", width, height); + } + ++#ifdef ANDROID ++ videomode_flags = SDL_SWSURFACE; ++ ScreenWidthActual = 320; ++ ScreenHeightActual = 240; ++ graphics_backend = &pure_unscaled_backend; ++ BPP = 16; ++#endif ++ + videomode_flags |= SDL_ANYFORMAT; + if (flags & TFB_GFXFLAGS_FULLSCREEN) + videomode_flags |= SDL_FULLSCREEN; +@@ -135,7 +144,7 @@ + /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set + SDL_ANYFORMAT */ + SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, +- 32, videomode_flags); ++ BPP, videomode_flags); + + if (SDL_Video == NULL) + { +Index: src/libs/graphics/sdl/sdl_common.c +=================================================================== +--- src/libs/graphics/sdl/sdl_common.c (revision 3779) ++++ src/libs/graphics/sdl/sdl_common.c (working copy) +@@ -34,7 +34,11 @@ + #include "libs/memlib.h" + #include "libs/vidlib.h" + #include SDL_INCLUDE(SDL_thread.h) ++#ifdef ANDROID ++#include ++#endif + ++ + SDL_Surface *SDL_Video; + SDL_Surface *SDL_Screen; + SDL_Surface *TransitionScreen; +@@ -172,6 +176,8 @@ + + TFB_DrawCanvas_Initialize (); + ++ TFB_InitOnScreenKeyboard (); ++ + return 0; + } + +@@ -397,3 +403,155 @@ + SDL_FreeSurface (*screen); + *screen = NULL; + } ++ ++#ifdef ANDROID ++ ++static SDL_Rect SDL_LeftJoystickRect, SDL_RightJoystickRect, SDL_TextInputRect; ++ ++void ++TFB_InitOnScreenKeyboard (void) ++{ ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &SDL_RightJoystickRect); ++ SDL_ANDROID_GetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &SDL_TextInputRect); ++ ++ /* TFB_SetOnScreenKeyboard_Hidden (); */ ++ TFB_SetOnScreenKeyboard_Menu (); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Hidden (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ SDL_Rect b; ++ b.w = b.h = b.x = b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &b); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Menu (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ TFB_SetOnScreenKeyboard_Hidden(); ++ SDL_Rect b; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &SDL_TextInputRect); ++ b.w = SDL_RightJoystickRect.w / 2; ++ b.h = SDL_RightJoystickRect.h / 2; ++ b.x = SDL_RightJoystickRect.x + b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ b.x = SDL_RightJoystickRect.x; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Starmap (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ TFB_SetOnScreenKeyboard_Menu(); ++ SDL_Rect b; ++ b.h = SDL_RightJoystickRect.h / 2; ++ b.w = SDL_RightJoystickRect.w / 2; ++ b.x = SDL_RightJoystickRect.x - b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ b.x -= b.w; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++} ++ ++void ++TFB_SetOnScreenKeyboard_Melee (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ /* Make the on-screen buttons slightly overlap, so we can hit them with one finger */ ++ TFB_SetOnScreenKeyboard_Hidden(); ++ SDL_Rect b; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &SDL_LeftJoystickRect); ++ b.w = SDL_RightJoystickRect.w * 3 / 5; ++ b.h = SDL_RightJoystickRect.h * 3 / 5; ++ b.x = SDL_RightJoystickRect.x + SDL_RightJoystickRect.w - b.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; //SDL_RightJoystickRect.y; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &b); ++ b.x = SDL_RightJoystickRect.x; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &b); ++ // Throttle button is replaced by tapping joystick ++ /* ++ b.w = SDL_RightJoystickRect.w; ++ b.y = SDL_RightJoystickRect.y + SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &b); ++ */ ++} ++ ++void ++TFB_SetOnScreenKeyboard_TwoPlayersMelee (void) ++{ ++ if (SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ return; ++ /* Mirror the buttons */ ++ TFB_SetOnScreenKeyboard_Melee(); ++ SDL_Rect b = SDL_RightJoystickRect; ++ b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2, &b); ++ b.w = SDL_RightJoystickRect.w * 3 / 5; ++ b.h = SDL_RightJoystickRect.h * 3 / 5; ++ b.x = 0; ++ b.y = 0; // SDL_RightJoystickRect.h - b.h; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &b); ++ b.x = SDL_RightJoystickRect.w - b.w; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &b); ++ // Throttle button is replaced by tapping joystick ++ /* ++ b.w = SDL_RightJoystickRect.w; ++ b.x = 0; ++ b.y = 0; ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &b); ++ */ ++} ++ ++#else ++ ++/* Stubs */ ++void ++TFB_InitOnScreenKeyboard (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Hidden (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Menu (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Starmap (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_Melee (void) ++{ ++} ++ ++void ++TFB_SetOnScreenKeyboard_TwoPlayersMelee (void) ++{ ++} ++ ++#endif +Index: src/libs/graphics/sdl/sdl_common.h +=================================================================== +--- src/libs/graphics/sdl/sdl_common.h (revision 3779) ++++ src/libs/graphics/sdl/sdl_common.h (working copy) +@@ -52,4 +52,6 @@ + int ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h); + void UnInit_Screen (SDL_Surface **screen); + ++void TFB_InitOnScreenKeyboard (void); ++ + #endif +Index: src/libs/strings/getstr.c +=================================================================== +--- src/libs/strings/getstr.c (revision 3779) ++++ src/libs/strings/getstr.c (working copy) +@@ -72,7 +72,7 @@ + // returns FALSE if and only if the buffer needs to be enlarged but + // memory allocation failed. + static BOOLEAN +-ensureBufSize (char **buf, size_t *curSize, size_t minSize, size_t increment) ++ensureBufSize (char **buf, DWORD *curSize, DWORD minSize, DWORD increment) + { + char *newBuf; + size_t newSize; +Index: src/libs/input/input_common.h +=================================================================== +--- src/libs/input/input_common.h (revision 3779) ++++ src/libs/input/input_common.h (working copy) +@@ -31,7 +31,7 @@ + extern int TFB_InitInput (int driver, int flags); + extern void TFB_UninitInput (void); + +-#define MAX_FLIGHT_ALTERNATES 2 ++#define MAX_FLIGHT_ALTERNATES 3 + + extern void TFB_SetInputVectors (volatile int menu[], int num_menu, + volatile int flight[], int num_templ, int num_flight); +Index: src/libs/input/sdl/vcontrol.h +=================================================================== +--- src/libs/input/sdl/vcontrol.h (revision 3779) ++++ src/libs/input/sdl/vcontrol.h (working copy) +@@ -76,6 +76,9 @@ + void VControl_ProcessJoyAxis (int port, int axis, int value); + void VControl_ProcessJoyHat (int port, int which, Uint8 value); + ++int VControl_GetJoyAxis(int port, int axis); ++int VControl_GetJoysticksAmount(); ++ + /* Force the input into the blank state. For preventing "sticky" keys. */ + void VControl_ResetInput (void); + +Index: src/libs/input/sdl/input.c +=================================================================== +--- src/libs/input/sdl/input.c (revision 3779) ++++ src/libs/input/sdl/input.c (working copy) +@@ -86,6 +86,7 @@ + "weapon", + "special", + "escape", ++ "thrust", + NULL + }; + +@@ -186,7 +187,7 @@ + directory. */ + LoadResourceIndex (contentDir, "uqm.key", "keys."); + } +- ++ + register_flight_controls (); + + return; +Index: src/libs/input/sdl/vcontrol.c +=================================================================== +--- src/libs/input/sdl/vcontrol.c (revision 3779) ++++ src/libs/input/sdl/vcontrol.c (working copy) +@@ -46,6 +46,7 @@ + typedef struct vcontrol_joystick_axis { + keybinding *neg, *pos; + int polarity; ++ int value; + } axis_type; + + typedef struct vcontrol_joystick_hat { +@@ -66,7 +67,7 @@ + + #endif /* HAVE_JOYSTICK */ + +-static unsigned int joycount; ++static unsigned int joycount = 0; + static unsigned int num_sdl_keys = 0; + static keybinding **bindings = NULL; + +@@ -141,6 +142,7 @@ + for (j = 0; j < axes; j++) + { + x->axes[j].neg = x->axes[j].pos = NULL; ++ x->axes[j].polarity = x->axes[j].value = 0; + } + for (j = 0; j < hats; j++) + { +@@ -818,6 +820,7 @@ + int t; + if (!joysticks[port].stick) + return; ++ joysticks[port].axes[axis].value = value; + t = joysticks[port].threshold; + if (value > t) + { +@@ -894,6 +897,25 @@ + #endif /* HAVE_JOYSTICK */ + } + ++int ++VControl_GetJoyAxis(int port, int axis) ++{ ++#ifdef HAVE_JOYSTICK ++ if( joycount <= port ) ++ return 0; ++ if (!joysticks[port].stick || joysticks[port].numaxes <= axis ) ++ return 0; ++ return joysticks[port].axes[axis].value; ++#else ++ return 0; ++#endif /* HAVE_JOYSTICK */ ++}; ++ ++int VControl_GetJoysticksAmount() ++{ ++ return joycount; ++}; ++ + void + VControl_ResetInput (void) + { +Index: src/libs/log/msgbox_stub.c +=================================================================== +--- src/libs/log/msgbox_stub.c (revision 3779) ++++ src/libs/log/msgbox_stub.c (working copy) +@@ -16,6 +16,9 @@ + + #include "msgbox.h" + #include "loginternal.h" ++#ifdef ANDROID ++#include ++#endif + + void + log_displayBox (const /*UTF-8*/char *title, int isError, +@@ -26,6 +29,9 @@ + // So just inform the user of our predicament + fprintf (streamOut, "Do not know how to display %s box\n", + isError ? "an error" : "a"); ++#ifdef ANDROID ++ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); ++#endif + + // Suppress the compiler warnings in any case. + (void)title; +Index: src/libs/log/uqmlog.c +=================================================================== +--- src/libs/log/uqmlog.c (revision 3779) ++++ src/libs/log/uqmlog.c (working copy) +@@ -23,6 +23,9 @@ + #include + #include + #include ++#ifdef ANDROID ++#include ++#endif + #include "libs/threadlib.h" + + #ifndef MAX_LOG_ENTRY_SIZE +@@ -191,6 +194,9 @@ + if ((int)level <= maxStreamLevel) + { + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif + } + + if ((int)level <= maxLevel) +@@ -227,6 +233,9 @@ + if ((int)level <= maxStreamLevel) + { + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif + } + + if ((int)level <= maxLevel) +Index: src/libs/log/msgbox_win.c +=================================================================== +--- src/libs/log/msgbox_win.c (revision 3779) ++++ src/libs/log/msgbox_win.c (working copy) +@@ -14,6 +14,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifndef ANDROID + #include "msgbox.h" + #define WIN32_LEAN_AND_MEAN + #include +@@ -64,4 +65,4 @@ + free (swTitle); + free (swMsg); + } +- ++#endif +Index: src/libs/uio/io.c +=================================================================== +--- src/libs/uio/io.c (revision 3779) ++++ src/libs/uio/io.c (working copy) +@@ -35,6 +35,7 @@ + #include "mem.h" + #include "uioutils.h" + #include "uioport.h" ++#include "../log.h" + #ifdef uio_MEM_DEBUG + # include "memdebug.h" + #endif +@@ -193,6 +194,7 @@ + errno = EINVAL; + return NULL; + } ++ log_add (log_Info, "uio_open %s", sourcePath); + handle = uio_open(sourceDir, sourcePath, + ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? + O_RDONLY : O_RDWR) +@@ -201,12 +203,14 @@ + #endif + , 0); + if (handle == NULL) { ++ log_add (log_Info, "uio_open failed for %s", sourcePath); + // errno is set + return NULL; + } + } + + handler = uio_getFileSystemHandler(fsType); ++ log_add (log_Info, "uio_getFileSystemHandler %p", handler); + if (handler == NULL) { + if (handle) + uio_close(handle); +@@ -800,6 +804,7 @@ + &readMountInfo, &readPDirHandle, NULL, + &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { + // errno is set ++ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); + return NULL; + } + +@@ -826,6 +831,7 @@ + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = EEXIST; ++ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); + return NULL; + } + if ((flags & O_TRUNC) == O_TRUNC) { +@@ -842,6 +848,7 @@ + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = savedErrno; ++ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); + return NULL; + } + } +@@ -863,6 +870,7 @@ + handle = (pDirHandle->pRoot->handler->open)(pDirHandle, name, flags, mode); + // Also adds a new entry to the physical dir if appropriate. + if (handle == NULL) { ++ log_add (log_Info, "uio_open: open file failed '%s'", name); + int savedErrno = errno; + uio_free(name); + uio_PDirHandle_unref(pDirHandle); +Index: src/libs/uio/zip/zip.c +=================================================================== +--- src/libs/uio/zip/zip.c (revision 3779) ++++ src/libs/uio/zip/zip.c (working copy) +@@ -1366,6 +1366,10 @@ + gPFileData->gid = (uid_t) makeUInt16(buf[12], buf[13]); + break; + } ++ case 0x7875: // 'Unix string UID/GID' ++ // Just skip it ++ break; ++ + default: + #ifdef DEBUG + fprintf(stderr, "Debug: Extra field 0x%04x unsupported, " +Index: src/libs/md5/md5.c +=================================================================== +--- src/libs/md5/md5.c (revision 3779) ++++ src/libs/md5/md5.c (working copy) +@@ -21,7 +21,7 @@ + + /* Written by Ulrich Drepper , 1995. */ + +-#include ++#include "config.h" + + #include "md5.h" + +Index: src/libs/resource/filecntl.c +=================================================================== +--- src/libs/resource/filecntl.c (revision 3779) ++++ src/libs/resource/filecntl.c (working copy) +@@ -26,6 +26,7 @@ + #include "port.h" + #include "resintrn.h" + #include "libs/uio.h" ++#include "libs/log.h" + + uio_Stream * + res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) +@@ -34,7 +35,10 @@ + struct stat sb; + + if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) ++ { ++ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); + return ((uio_Stream *) ~0); ++ } + + fp = uio_fopen (dir, filename, mode); + +Index: src/libs/sound/decoders/oggaud.c +=================================================================== +--- src/libs/sound/decoders/oggaud.c (revision 3779) ++++ src/libs/sound/decoders/oggaud.c (working copy) +@@ -270,7 +270,7 @@ + // this is the closest to a frame there is in ogg vorbis stream + // doesn't seem to be a func to retrive it + #ifdef OVCODEC_TREMOR +- return ova->vf.os->pageno; ++ return ova->vf.os.pageno; + #else + return ova->vf.os.pageno; + #endif /* OVCODEC_TREMOR */ +Index: src/config_unix.h +=================================================================== +--- src/config_unix.h (revision 0) ++++ src/config_unix.h (working copy) +@@ -0,0 +1,63 @@ ++/* This file contains some compile-time configuration options for *nix ++ * systems. ++ * config_unix.h is generated from config_unix.h.in by build.sh ++ * When building on MS Windows using build.sh (MinGW, Cygwin), ++ * config_win.h is generated from src/config_win.h.in. ++ * When using MSVC on MS Windows, you'll have to edit src/config_vc6.h ++ * manually if you want anything else than the defaults. ++ */ ++ ++#ifndef _CONFIG_UNIX_H ++#define _CONFIG_UNIX_H ++ ++/* Directory where the UQM game data is located */ ++#define CONTENTDIR "" ++ ++/* Directory where game data will be stored */ ++#define USERDIR "config/" ++ ++/* Directory where config files will be stored */ ++#define CONFIGDIR USERDIR ++ ++/* Directory where supermelee teams will be stored */ ++#define MELEEDIR "teams/" ++ ++/* Directory where save games will be stored */ ++#define SAVEDIR "save/" ++ ++/* Defined if words are stored with the most significant byte first */ ++#undef WORDS_BIGENDIAN ++ ++/* Defined if your system has readdir_r of its own */ ++#define HAVE_READDIR_R ++ ++/* Defined if your system has setenv of its own */ ++#define HAVE_SETENV ++ ++/* Defined if your system has strupr of its own */ ++#undef HAVE_STRUPR ++ ++/* Defined if your system has strcasecmp of its own */ ++#define HAVE_STRCASECMP_UQM ++ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. ++ ++/* Defined if your system has stricmp of its own */ ++#undef HAVE_STRICMP ++ ++/* Defined if your system has getopt_long */ ++#define HAVE_GETOPT_LONG ++ ++/* Defined if your system has iswgraph of its own*/ ++#define HAVE_ISWGRAPH ++ ++/* Defined if your system has wchar_t of its own */ ++#define HAVE_WCHAR_T ++ ++/* Defined if your system has wint_t of its own */ ++#define HAVE_WINT_T ++ ++/* Defined if your system has _Bool of its own */ ++#define HAVE__BOOL ++ ++#endif /* _CONFIG_UNIX_H */ ++ +Index: src/uqm/units.h +=================================================================== +--- src/uqm/units.h (revision 3779) ++++ src/uqm/units.h (working copy) +@@ -52,6 +52,7 @@ + #define RADAR_WIDTH (STATUS_WIDTH - 8) + #define RADAR_HEIGHT 53 + #define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - RADAR_HEIGHT) ++#define RADAR_Y_LIFTED_UP (RADAR_Y - 40) + + #define SIS_TITLE_BOX_WIDTH 57 + #define SIS_TITLE_WIDTH (SIS_TITLE_BOX_WIDTH - 2) +Index: src/uqm/planets/solarsys.c +=================================================================== +--- src/uqm/planets/solarsys.c (revision 3779) ++++ src/uqm/planets/solarsys.c (working copy) +@@ -837,18 +837,19 @@ + static void + ProcessShipControls (void) + { +- COUNT index; ++ COUNT index = GetFrameIndex (GLOBAL (ShipStamp.frame));; + SIZE delta_x, delta_y; ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + +- if (CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (InputState & BATTLE_THRUST) + delta_y = -1; + else + delta_y = 0; + + delta_x = 0; +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + delta_x -= 1; +- if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ if (InputState & BATTLE_RIGHT) + delta_x += 1; + + if (delta_x || delta_y < 0) +@@ -861,7 +862,6 @@ + else + delta_y = 0; + +- index = GetFrameIndex (GLOBAL (ShipStamp.frame)); + if (pSolarSysState->turn_counter) + --pSolarSysState->turn_counter; + else if (delta_x) +@@ -1739,7 +1739,9 @@ + InitSolarSys (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SolarSysState.InputFunc = DoIpFlight; ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&SolarSysState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + UninitSolarSys (); + pSolarSysState = 0; + } +@@ -1997,13 +1999,17 @@ + + if (pSS->InOrbit) + { // CheckShipLocation() or InitSolarSys() sent us to orbital ++ TFB_SetOnScreenKeyboard_Menu (); + EnterPlanetOrbit (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + pSS->InOrbit = FALSE; + } + else if (cancel || LastActivity == CHECK_LOAD) + { ++ TFB_SetOnScreenKeyboard_Menu (); + SolarSysMenu (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + } + else +Index: src/uqm/planets/pstarmap.c +=================================================================== +--- src/uqm/planets/pstarmap.c (revision 3779) ++++ src/uqm/planets/pstarmap.c (working copy) +@@ -1613,7 +1613,9 @@ + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY, + TRUE); ++ TFB_SetOnScreenKeyboard_Starmap (); + DoInput (&MenuState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + SetDefaultMenuRepeatDelay (); + +Index: src/uqm/planets/lander.c +=================================================================== +--- src/uqm/planets/lander.c (revision 3779) ++++ src/uqm/planets/lander.c (working copy) +@@ -1591,15 +1591,15 @@ + if (crew_left) + { + SIZE index = GetFrameIndex (LanderFrame[0]); ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + if (turn_wait) + --turn_wait; +- else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] || +- CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ else if ((InputState & BATTLE_LEFT) || (InputState & BATTLE_RIGHT)) + { + COUNT landerSpeedNumer; + COUNT angle; + +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + --index; + else + ++index; +@@ -1623,7 +1623,7 @@ + turn_wait = SHUTTLE_TURN_WAIT; + } + +- if (!CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (!(InputState & BATTLE_THRUST)) + { + dx = 0; + dy = 0; +@@ -1938,7 +1938,9 @@ + landerInputState.Initialized = FALSE; + landerInputState.InputFunc = DoPlanetSide; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&landerInputState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + + if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) + { +Index: src/uqm/sis.c +=================================================================== +--- src/uqm/sis.c (revision 3779) ++++ src/uqm/sis.c (working copy) +@@ -1640,7 +1640,7 @@ + GetContextClipRect (&clip_r); + pRect = &temp_r; + temp_r.corner.x = RADAR_X - clip_r.corner.x; +- temp_r.corner.y = RADAR_Y - clip_r.corner.y; ++ temp_r.corner.y = RADAR_Y_LIFTED_UP - clip_r.corner.y; + temp_r.extent.width = RADAR_WIDTH; + temp_r.extent.height = RADAR_HEIGHT; + SetContext (OldContext); +Index: src/uqm/controls.h +=================================================================== +--- src/uqm/controls.h (revision 3779) ++++ src/uqm/controls.h (working copy) +@@ -36,6 +36,7 @@ + KEY_WEAPON, + KEY_SPECIAL, + KEY_ESCAPE, ++ KEY_THRUST, + NUM_KEYS + }; + enum { +@@ -90,13 +91,14 @@ + #define BATTLE_ESCAPE ((BATTLE_INPUT_STATE)(1 << 5)) + #define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6)) + +-BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player); ++BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player, int direction /* = -1 for no directional input */); + BATTLE_INPUT_STATE PulsedInputToBattleInput (COUNT player); + + extern CONTROLLER_INPUT_STATE CurrentInputState; + extern CONTROLLER_INPUT_STATE PulsedInputState; + extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; + extern CONTROL_TEMPLATE PlayerControls[]; ++extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu; + + void UpdateInputState (void); + extern void FlushInput (void); +@@ -116,6 +118,8 @@ + BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput); + BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput); + ++extern BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player); ++ + void DoPopupWindow(const char *msg); + + typedef void (InputFrameCallback) (void); +Index: src/uqm/supermelee/melee.c +=================================================================== +--- src/uqm/supermelee/melee.c (revision 3779) ++++ src/uqm/supermelee/melee.c (working copy) +@@ -2074,7 +2074,7 @@ + PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 0, + MenuState.load.preBuiltList[0]); +- PlayerControl[1] = COMPUTER_CONTROL | STANDARD_RATING; ++ PlayerControl[1] = HUMAN_CONTROL | STANDARD_RATING; // COMPUTER_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 1, + MenuState.load.preBuiltList[1]); + } +Index: src/uqm/hyper.c +=================================================================== +--- src/uqm/hyper.c (revision 3779) ++++ src/uqm/hyper.c (working copy) +@@ -1685,7 +1685,6 @@ + Color OldColor; + CONTEXT OldContext; + MENU_STATE MenuState; +- + UnbatchGraphics (); + + OldContext = SetContext (SpaceContext); +Index: src/uqm/intro.c +=================================================================== +--- src/uqm/intro.c (revision 3779) ++++ src/uqm/intro.c (working copy) +@@ -751,7 +751,9 @@ + pis.MovieFrame = -1; + pis.StartTime = GetTimeCounter (); + pis.LastSyncTime = pis.StartTime; ++ TFB_SetOnScreenKeyboard_Hidden (); + DoInput (&pis, TRUE); ++ TFB_SetOnScreenKeyboard_Menu(); + + SleepThreadUntil (FadeMusic (0, ONE_SECOND)); + StopMusic (); +@@ -839,7 +841,9 @@ + vis.InputFunc = DoVideoInput; + vis.CurVideo = ref; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); ++ TFB_SetOnScreenKeyboard_Hidden (); + DoInput (&vis, TRUE); ++ TFB_SetOnScreenKeyboard_Menu (); + + StopLegacyVideo (ref); + FadeClearScreen (); +@@ -855,6 +859,7 @@ + { + return FALSE; + } ++ + if (!strcmp (resType, "STRTAB")) + { + STRING pres = CaptureStringTable (LoadStringTable (res)); +Index: src/uqm/intel.c +=================================================================== +--- src/uqm/intel.c (revision 3779) ++++ src/uqm/intel.c (working copy) +@@ -45,10 +45,10 @@ + // Allow a player to warp-escape in cyborg mode + if (StarShipPtr->playerNr == RPG_PLAYER_NUM) + InputState |= CurrentInputToBattleInput ( +- context->playerNr) & BATTLE_ESCAPE; ++ context->playerNr, -1) & BATTLE_ESCAPE; + } + else +- InputState = CurrentInputToBattleInput (context->playerNr); ++ InputState = CurrentInputToBattleInput (context->playerNr, -1); + } + else if (!(PlayerControl[context->playerNr] & PSYTRON_CONTROL)) + InputState = 0; +Index: src/uqm/gameinp.c +=================================================================== +--- src/uqm/gameinp.c (revision 3779) ++++ src/uqm/gameinp.c (working copy) +@@ -16,6 +16,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#include + #include "controls.h" + #include "battlecontrols.h" + #include "init.h" +@@ -33,11 +34,14 @@ + #include "libs/timelib.h" + #include "libs/threadlib.h" + +- ++#ifdef ANDROID ++#define ACCELERATION_INCREMENT (ONE_SECOND) ++#define MENU_REPEAT_DELAY (ONE_SECOND) ++#else + #define ACCELERATION_INCREMENT (ONE_SECOND / 12) + #define MENU_REPEAT_DELAY (ONE_SECOND / 2) ++#endif + +- + typedef struct + { + BOOLEAN (*InputFunc) (void *pInputState); +@@ -67,6 +71,7 @@ + + volatile BOOLEAN ExitRequested; + volatile BOOLEAN GamePaused; ++volatile BOOLEAN OnScreenKeyboardLocked; + + static InputFrameCallback *inputCallback; + +@@ -416,16 +421,10 @@ + } + + static BATTLE_INPUT_STATE +-ControlInputToBattleInput (const int *keyState) ++ControlInputToBattleInput (const int *keyState, COUNT player, int direction) + { + BATTLE_INPUT_STATE InputState = 0; + +- if (keyState[KEY_UP]) +- InputState |= BATTLE_THRUST; +- if (keyState[KEY_LEFT]) +- InputState |= BATTLE_LEFT; +- if (keyState[KEY_RIGHT]) +- InputState |= BATTLE_RIGHT; + if (keyState[KEY_WEAPON]) + InputState |= BATTLE_WEAPON; + if (keyState[KEY_SPECIAL]) +@@ -435,21 +434,35 @@ + if (keyState[KEY_DOWN]) + InputState |= BATTLE_DOWN; + ++ if(direction < 0) ++ { ++ if (keyState[KEY_LEFT]) ++ InputState |= BATTLE_LEFT; ++ if (keyState[KEY_RIGHT]) ++ InputState |= BATTLE_RIGHT; ++ if (keyState[KEY_UP]) ++ InputState |= BATTLE_THRUST; ++ } ++ else ++ { ++ InputState |= GetDirectionalJoystickInput(direction, player); ++ } ++ + return InputState; + } + + BATTLE_INPUT_STATE +-CurrentInputToBattleInput (COUNT player) ++CurrentInputToBattleInput (COUNT player, int direction) + { + return ControlInputToBattleInput( +- CurrentInputState.key[PlayerControls[player]]); ++ CurrentInputState.key[PlayerControls[player]], player, direction); + } + + BATTLE_INPUT_STATE + PulsedInputToBattleInput (COUNT player) + { + return ControlInputToBattleInput( +- PulsedInputState.key[PlayerControls[player]]); ++ PulsedInputState.key[PlayerControls[player]], player, -1); + } + + BOOLEAN +@@ -494,3 +507,130 @@ + return result; + } + ++// Fast arctan2, returns angle in radians as integer, with fractional part in lower 16 bits ++// Stolen from http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization , precision is said to be 0.07 rads ++ ++#ifndef M_PI ++#define M_PI 3.14159265358979323846 ++#endif ++enum { atan2i_coeff_1 = ((int)(M_PI*65536.0/4)), atan2i_coeff_2 = (3*atan2i_coeff_1), atan2i_PI = (int)(M_PI * 65536.0), SHIP_DIRECTIONS = 16 }; ++ ++static inline int atan2i(int y, int x) ++{ ++ int angle; ++ int abs_y = abs(y); ++ if( abs_y == 0 ) ++ abs_y = 1; ++ if (x>=0) ++ { ++ angle = atan2i_coeff_1 - atan2i_coeff_1 * (x - abs_y) / (x + abs_y); ++ } ++ else ++ { ++ angle = atan2i_coeff_2 - atan2i_coeff_1 * (x + abs_y) / (abs_y - x); ++ } ++ if (y < 0) ++ return(-angle); // negate if in quad III or IV ++ else ++ return(angle); ++} ++ ++BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player) ++{ ++ BATTLE_INPUT_STATE InputState = 0; ++ static BOOLEAN JoystickThrust[NUM_PLAYERS] = { FALSE, FALSE }; ++ static BOOLEAN JoystickTapFlag[NUM_PLAYERS] = { FALSE, FALSE }; ++ static TimeCount JoystickTapTime[NUM_PLAYERS] = { 0, 0 }; ++ ++ if (CurrentInputState.key[PlayerControls[player]][KEY_THRUST]) ++ InputState |= BATTLE_THRUST; ++ ++ if( VControl_GetJoysticksAmount() <= 0 ) ++ { ++ if (CurrentInputState.key[PlayerControls[player]][KEY_LEFT]) ++ InputState |= BATTLE_LEFT; ++ if (CurrentInputState.key[PlayerControls[player]][KEY_RIGHT]) ++ InputState |= BATTLE_RIGHT; ++ if (CurrentInputState.key[PlayerControls[player]][KEY_UP]) ++ InputState |= BATTLE_THRUST; ++ return InputState; ++ } ++ ++ int axisX = VControl_GetJoyAxis(0, player * 2), axisY = VControl_GetJoyAxis(0, player * 2 + 1); ++ ++ if( axisX == 0 && axisY == 0 ) ++ { ++ // Some basic gamepad input support ++ axisX = VControl_GetJoyAxis(2, player * 2); ++ axisY = VControl_GetJoyAxis(2, player * 2 + 1); ++ if( abs( axisX ) > 5000 || abs( axisY ) > 5000 ) // Deadspot at the center ++ { ++ if( !JoystickTapFlag[player] ) ++ TFB_SetOnScreenKeyboard_Hidden (); // Gamepad used - hide on-screen keys ++ JoystickTapFlag[player] = TRUE; ++ JoystickThrust[player] = FALSE; ++ // Turning thrust with joystick is uncomfortable ++ //if( abs( axisX ) > 25000 || abs( axisY ) > 25000 ) ++ // JoystickThrust[player] = TRUE; ++ } ++ else ++ { ++ axisX = 0; ++ axisY = 0; ++ } ++ } ++ ++ if( !optDirectionalJoystick ) ++ { ++ if( axisX < -10000 ) ++ InputState |= BATTLE_LEFT; ++ if( axisX > 10000 ) ++ InputState |= BATTLE_RIGHT; ++ if( axisY < 0 ) ++ InputState |= BATTLE_THRUST; ++ return InputState; ++ } ++ ++ if( axisX != 0 || axisY != 0 ) ++ { ++ int angle = atan2i(axisY, axisX), diff; ++ // Convert it to 16 directions used by Melee ++ angle += atan2i_PI / SHIP_DIRECTIONS; ++ if( angle < 0 ) ++ angle += atan2i_PI * 2; ++ if( angle > atan2i_PI * 2 ) ++ angle -= atan2i_PI * 2; ++ angle = angle * SHIP_DIRECTIONS / atan2i_PI / 2; ++ ++ diff = angle - direction - SHIP_DIRECTIONS / 4; ++ while( diff >= SHIP_DIRECTIONS ) ++ diff -= SHIP_DIRECTIONS; ++ while( diff < 0 ) ++ diff += SHIP_DIRECTIONS; ++ ++ if( diff < SHIP_DIRECTIONS / 2 ) ++ InputState |= BATTLE_LEFT; ++ if( diff > SHIP_DIRECTIONS / 2 ) ++ InputState |= BATTLE_RIGHT; ++ ++ if( !JoystickTapFlag[player] ) ++ { ++ JoystickTapFlag[player] = TRUE; ++ if( GetTimeCounter() < JoystickTapTime[player] + ONE_SECOND ) ++ JoystickThrust[player] = !JoystickThrust[player]; ++ else ++ JoystickThrust[player] = TRUE; ++ } ++ if( JoystickThrust[player] ) ++ InputState |= BATTLE_THRUST; ++ } ++ else ++ { ++ if( JoystickTapFlag[player] ) ++ { ++ JoystickTapFlag[player] = FALSE; ++ JoystickTapTime[player] = GetTimeCounter(); ++ } ++ } ++ return InputState; ++} +Index: src/uqm/shipstat.c +=================================================================== +--- src/uqm/shipstat.c (revision 3779) ++++ src/uqm/shipstat.c (working copy) +@@ -132,6 +132,45 @@ + DrawFilledRectangle (&r); + } + ++static void ++DrawCrewEnergyBoxOutline (RECT *box) ++{ ++ RECT r; ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y + box->extent.height - 1; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x + box->extent.width - 1; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor (BLACK_COLOR); ++ r.corner.x = box->corner.x + 1; ++ r.corner.y = box->corner.y + 1; ++ r.extent.width = box->extent.width - 2; ++ r.extent.height = box->extent.height - 2; ++ DrawFilledRectangle (&r); ++} ++ + void + InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect) + { +@@ -229,6 +268,26 @@ + r.extent.height = energy_height; + r.corner.y = y - r.extent.height + GAUGE_YOFFS + 1; + DrawFilledRectangle (&r); ++ ++ // TODO: replace the above ugly code with DrawCrewEnergyBoxOutline(), but I don't want to touch that as long as it works ++ r.corner.x = 0; ++ r.corner.y = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_CREW_YOFFS; ++ r.extent.height = STAT_WIDTH + 2; ++ r.extent.width = 1000; ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = crew_height + 2; ++ DrawCrewEnergyBoxOutline (&r); ++ r.corner.y = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ r.extent.width = 1000; ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = energy_height + 2; ++ DrawCrewEnergyBoxOutline (&r); + } + + if (!StarShipPtr || StarShipPtr->captains_name_index) +@@ -288,7 +347,7 @@ + // DeltaStatistics() below will add specified values to these + SIPtr->crew_level = 0; + SIPtr->energy_level = 0; +- DeltaStatistics (SIPtr, y, crew_delta, energy_delta); ++ DeltaStatistics (SIPtr, y, crew_delta, energy_delta, StarShipPtr ? StarShipPtr->playerNr : NPC_PLAYER_NUM); + } + + UnbatchGraphics (); +@@ -306,10 +365,11 @@ + // crew_delta <= ShipInfoPtr->max_crew - ShipInfoPtr->crew_level + void + DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, +- SIZE crew_delta, SIZE energy_delta) ++ SIZE crew_delta, SIZE energy_delta, SIZE player_num) + { +- COORD x, y; +- RECT r; ++ COORD x, y, y2; ++ RECT r, r2; ++ SIZE max_crew_size, max_energy_size; + + if (crew_delta == 0 && energy_delta == 0) + return; +@@ -319,13 +379,15 @@ + + r.extent.width = UNIT_WIDTH; + r.extent.height = UNIT_HEIGHT; ++#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) ++ max_crew_size = MIN(ShipInfoPtr->max_crew, MAX_CREW_SIZE); ++ max_energy_size = ShipInfoPtr->max_energy; + + if (crew_delta != 0) + { + COUNT oldNumBlocks, newNumBlocks, blockI; + COUNT newCrewLevel; + +-#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) + oldNumBlocks = MIN(ShipInfoPtr->crew_level, MAX_CREW_SIZE); + newCrewLevel = ShipInfoPtr->crew_level + crew_delta; + newNumBlocks = MIN(newCrewLevel, MAX_CREW_SIZE); +@@ -392,10 +454,33 @@ + // Always print a number for the SIS in the full game. + DrawBattleCrewAmount (ShipInfoPtr, y_offs); + } ++ ++ y2 = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_CREW_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_crew_size; blockI++) ++ { ++ SetContextForeGroundColor ( ++ (ShipInfoPtr->ship_flags & CREW_IMMUNE) ? ++ ROBOT_UNIT_COLOR : CREW_UNIT_COLOR); ++ if (blockI >= newNumBlocks) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + + if (energy_delta != 0) + { ++ COUNT blockI; + if (energy_delta > 0) + { + #define FUEL_UNIT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +@@ -431,6 +516,26 @@ + --ShipInfoPtr->energy_level; + } while (++energy_delta); + } ++ ++ y2 = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_energy_size; blockI++) ++ { ++ SetContextForeGroundColor (FUEL_UNIT_COLOR); ++ if (blockI >= ShipInfoPtr->energy_level) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + } + +Index: src/uqm/battle.c +=================================================================== +--- src/uqm/battle.c (revision 3779) ++++ src/uqm/battle.c (working copy) +@@ -16,6 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifdef ANDROID ++#include ++#endif ++ + #include "battle.h" + + #include "battlecontrols.h" +@@ -44,6 +48,8 @@ + #include "libs/graphics/gfx_common.h" + #include "libs/log.h" + #include "libs/mathlib.h" ++#include "globdata.h" ++#include "libs/input/sdl/vcontrol.h" + + + BYTE battle_counter[NUM_SIDES]; +@@ -138,7 +144,8 @@ + frameInputHuman (HumanInputContext *context, STARSHIP *StarShipPtr) + { + (void) StarShipPtr; +- return CurrentInputToBattleInput (context->playerNr); ++ ++ return CurrentInputToBattleInput (context->playerNr, StarShipPtr ? StarShipPtr->ShipFacing : -1); + } + + static void +@@ -208,8 +215,11 @@ + StarShipPtr->ship_input_state |= SPECIAL; + + if (CanRunAway && cur_player == 0 && +- (InputState & BATTLE_ESCAPE)) ++ ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu)) ++ { ++ EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; + DoRunAway (StarShipPtr); ++ } + } + } + +@@ -397,6 +407,10 @@ + { + SIZE num_ships; + ++ TFB_SetOnScreenKeyboard_Melee (); ++ if (PlayerControl[1] & HUMAN_CONTROL) { ++ TFB_SetOnScreenKeyboard_TwoPlayersMelee (); ++ } + + #if !(DEMO_MODE || CREATE_JOURNAL) + if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) { +@@ -506,7 +520,7 @@ + UninitShips (); + FreeBattleSong (); + +- ++ TFB_SetOnScreenKeyboard_Menu (); + return (BOOLEAN) (num_ships < 0); + } + +Index: src/uqm/outfit.c +=================================================================== +--- src/uqm/outfit.c (revision 3779) ++++ src/uqm/outfit.c (working copy) +@@ -55,7 +55,7 @@ + OldContext = SetContext (StatusContext); + GetContextClipRect (&r); + s.origin.x = RADAR_X - r.corner.x; +- s.origin.y = RADAR_Y - r.corner.y; ++ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y + 10; + r.corner.x = s.origin.x - 1; + r.corner.y = s.origin.y - 11; + r.extent.width = RADAR_WIDTH + 2; +Index: src/uqm/comm/yehat/yehatc.c +=================================================================== +--- src/uqm/comm/yehat/yehatc.c (revision 3779) ++++ src/uqm/comm/yehat/yehatc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../yehat/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/orz/orzc.c +=================================================================== +--- src/uqm/comm/orz/orzc.c (revision 3779) ++++ src/uqm/comm/orz/orzc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../orz/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/urquan/urquanc.c +=================================================================== +--- src/uqm/comm/urquan/urquanc.c (revision 3779) ++++ src/uqm/comm/urquan/urquanc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../urquan/strings.h" + + static LOCDATA urquan_desc = + { +Index: src/uqm/comm/slyhome/slyhome.c +=================================================================== +--- src/uqm/comm/slyhome/slyhome.c (revision 3779) ++++ src/uqm/comm/slyhome/slyhome.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../slyhome/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/comandr/comandr.c +=================================================================== +--- src/uqm/comm/comandr/comandr.c (revision 3779) ++++ src/uqm/comm/comandr/comandr.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../comandr/strings.h" + + #include "uqm/setup.h" + #include "uqm/sis.h" +Index: src/uqm/comm/blackur/blackurc.c +=================================================================== +--- src/uqm/comm/blackur/blackurc.c (revision 3779) ++++ src/uqm/comm/blackur/blackurc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../blackur/strings.h" + + static LOCDATA blackurq_desc = + { +Index: src/uqm/comm/mycon/myconc.c +=================================================================== +--- src/uqm/comm/mycon/myconc.c (revision 3779) ++++ src/uqm/comm/mycon/myconc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../mycon/strings.h" + + #include "uqm/gameev.h" + #include "libs/mathlib.h" +Index: src/uqm/comm/spathi/spathic.c +=================================================================== +--- src/uqm/comm/spathi/spathic.c (revision 3779) ++++ src/uqm/comm/spathi/spathic.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../spathi/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/druuge/druugec.c +=================================================================== +--- src/uqm/comm/druuge/druugec.c (revision 3779) ++++ src/uqm/comm/druuge/druugec.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../druuge/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +Index: src/uqm/comm/syreen/syreenc.c +=================================================================== +--- src/uqm/comm/syreen/syreenc.c (revision 3779) ++++ src/uqm/comm/syreen/syreenc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../syreen/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +Index: src/uqm/comm/chmmr/chmmrc.c +=================================================================== +--- src/uqm/comm/chmmr/chmmrc.c (revision 3779) ++++ src/uqm/comm/chmmr/chmmrc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../chmmr/strings.h" + + #include "uqm/build.h" + #include "uqm/hyper.h" +Index: src/uqm/comm/slyland/slyland.c +=================================================================== +--- src/uqm/comm/slyland/slyland.c (revision 3779) ++++ src/uqm/comm/slyland/slyland.c (working copy) +@@ -16,10 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#include "../slyland/strings.h" ++#include + #include "../commall.h" +-#include + #include "resinst.h" +-#include "strings.h" + + #include "options.h" + #include "uqm/battle.h" +Index: src/uqm/comm/ilwrath/ilwrathc.c +=================================================================== +--- src/uqm/comm/ilwrath/ilwrathc.c (revision 3779) ++++ src/uqm/comm/ilwrath/ilwrathc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../ilwrath/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/supox/supoxc.c +=================================================================== +--- src/uqm/comm/supox/supoxc.c (revision 3779) ++++ src/uqm/comm/supox/supoxc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../supox/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/vux/vuxc.c +=================================================================== +--- src/uqm/comm/vux/vuxc.c (revision 3779) ++++ src/uqm/comm/vux/vuxc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../vux/strings.h" + + static LOCDATA vux_desc = + { +Index: src/uqm/comm/zoqfot/zoqfotc.c +=================================================================== +--- src/uqm/comm/zoqfot/zoqfotc.c (revision 3779) ++++ src/uqm/comm/zoqfot/zoqfotc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../zoqfot/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/shofixt/shofixt.c +=================================================================== +--- src/uqm/comm/shofixt/shofixt.c (revision 3779) ++++ src/uqm/comm/shofixt/shofixt.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../shofixt/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/pkunk/pkunkc.c +=================================================================== +--- src/uqm/comm/pkunk/pkunkc.c (revision 3779) ++++ src/uqm/comm/pkunk/pkunkc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../pkunk/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/rebel/rebel.c +=================================================================== +--- src/uqm/comm/rebel/rebel.c (revision 3779) ++++ src/uqm/comm/rebel/rebel.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../yehat/resinst.h" +-#include "strings.h" ++#include "../rebel/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/arilou/arilouc.c +=================================================================== +--- src/uqm/comm/arilou/arilouc.c (revision 3779) ++++ src/uqm/comm/arilou/arilouc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../arilou/strings.h" + + #include "uqm/gameev.h" + +Index: src/uqm/comm/spahome/spahome.c +=================================================================== +--- src/uqm/comm/spahome/spahome.c (revision 3779) ++++ src/uqm/comm/spahome/spahome.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../spathi/resinst.h" +-#include "strings.h" ++#include "../spahome/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/starbas/starbas.c +=================================================================== +--- src/uqm/comm/starbas/starbas.c (revision 3779) ++++ src/uqm/comm/starbas/starbas.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../comandr/resinst.h" +-#include "strings.h" ++#include "../starbas/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +Index: src/uqm/comm/utwig/utwigc.c +=================================================================== +--- src/uqm/comm/utwig/utwigc.c (revision 3779) ++++ src/uqm/comm/utwig/utwigc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../utwig/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/umgah/umgahc.c +=================================================================== +--- src/uqm/comm/umgah/umgahc.c (revision 3779) ++++ src/uqm/comm/umgah/umgahc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../umgah/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/talkpet/talkpet.c +=================================================================== +--- src/uqm/comm/talkpet/talkpet.c (revision 3779) ++++ src/uqm/comm/talkpet/talkpet.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../talkpet/strings.h" + + #include "uqm/build.h" + +Index: src/uqm/comm/thradd/thraddc.c +=================================================================== +--- src/uqm/comm/thradd/thraddc.c (revision 3779) ++++ src/uqm/comm/thradd/thraddc.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../thradd/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +Index: src/uqm/comm/melnorm/melnorm.c +=================================================================== +--- src/uqm/comm/melnorm/melnorm.c (revision 3779) ++++ src/uqm/comm/melnorm/melnorm.c (working copy) +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../melnorm/strings.h" + + #include "uqm/gameev.h" + #include "uqm/shipcont.h" +Index: src/uqm/confirm.c +=================================================================== +--- src/uqm/confirm.c (revision 3779) ++++ src/uqm/confirm.c (working copy) +@@ -32,9 +32,11 @@ + #include + + +-#define CONFIRM_WIN_WIDTH 80 ++#define CONFIRM_WIN_WIDTH 160 + #define CONFIRM_WIN_HEIGHT 22 + ++BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; ++ + static void + DrawConfirmationWindow (BOOLEAN answer) + { +@@ -65,6 +67,8 @@ + font_DrawText (&t); + t.baseline.x += (r.extent.width >> 1); + t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt + SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); + font_DrawText (&t); + +@@ -110,8 +114,16 @@ + + FlushInput (); + done = FALSE; ++ ++ #ifdef ANDROID ++ if ( !(GLOBAL (CurrentActivity) & IN_BATTLE) ) { ++ /* Abort immediately */ ++ response = TRUE; ++ done = TRUE; ++ } ++ #endif + +- do { ++ while (!done) { + // Forbid recursive calls or pausing here! + ExitRequested = FALSE; + GamePaused = FALSE; +@@ -138,7 +150,7 @@ + PlayMenuSound (MENU_SOUND_MOVE); + } + SleepThread (ONE_SECOND / 30); +- } while (!done); ++ } + + // Restore the screen under the confirmation window + DrawStamp (&s); +@@ -151,6 +163,8 @@ + } + else + { ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ EmergencyEscapeWarpUnitActivatedFromMenu = TRUE; + result = FALSE; + } + ExitRequested = FALSE; +Index: src/uqm/status.c +=================================================================== +--- src/uqm/status.c (revision 3779) ++++ src/uqm/status.c (working copy) +@@ -323,7 +323,7 @@ + StarShipPtr->RaceDescPtr->characteristics.energy_wait; + + DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], +- 0, energy_delta); ++ 0, energy_delta, StarShipPtr->playerNr); + } + + return (retval); +@@ -365,7 +365,7 @@ + } + + DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], +- crew_delta, 0); ++ crew_delta, 0, StarShipPtr->playerNr); + + return (retval); + } +Index: src/uqm/status.h +=================================================================== +--- src/uqm/status.h (revision 3779) ++++ src/uqm/status.h (working copy) +@@ -38,9 +38,15 @@ + #define CAPTAIN_YOFFS (SHIP_INFO_HEIGHT + 4) + #define CAPTAIN_WIDTH 55 + #define CAPTAIN_HEIGHT 30 +-#define SHIP_STATUS_HEIGHT (STATUS_HEIGHT >> 1) +-#define BAD_GUY_YOFFS 0 +-#define GOOD_GUY_YOFFS SHIP_STATUS_HEIGHT ++#define SHIP_STATUS_HEIGHT ((STATUS_HEIGHT >> 1) - 17) ++#define BAD_GUY_YOFFS (-1) ++#define GOOD_GUY_YOFFS (STATUS_HEIGHT - SHIP_STATUS_HEIGHT) ++#define HORIZ_CREW_ENERGY_SIZE 18 ++#define HORIZ_CREW_XOFFS 2 ++#define BAD_GUY_HORIZ_CREW_YOFFS (BAD_GUY_YOFFS + SHIP_STATUS_HEIGHT + (HORIZ_CREW_ENERGY_SIZE >> 1)) ++#define GOOD_GUY_HORIZ_CREW_YOFFS (GOOD_GUY_YOFFS - HORIZ_CREW_ENERGY_SIZE + 1) ++#define BAD_GUY_HORIZ_ENERGY_YOFFS (BAD_GUY_YOFFS + SHIP_STATUS_HEIGHT) ++#define GOOD_GUY_HORIZ_ENERGY_YOFFS (GOOD_GUY_YOFFS - (HORIZ_CREW_ENERGY_SIZE >> 1) + 1) + #define STARCON_TEXT_HEIGHT 7 + #define TINY_TEXT_HEIGHT 9 + +@@ -58,7 +64,7 @@ + RECT *pClipRect); + // StarShipPtr or pClipRect can be NULL + extern void DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, +- SIZE crew_delta, SIZE energy_delta); ++ SIZE crew_delta, SIZE energy_delta, SIZE player_num); + extern void DrawBattleCrewAmount (SHIP_INFO *ShipInfoPtr, COORD y_offs); + + extern void DrawCaptainsWindow (STARSHIP *StarShipPtr); +Index: src/uqm/menu.c +=================================================================== +--- src/uqm/menu.c (revision 3779) ++++ src/uqm/menu.c (working copy) +@@ -503,7 +503,7 @@ + s.origin.x = RADAR_X - r.corner.x; + s.origin.y = RADAR_Y - r.corner.y; + r.corner.x = s.origin.x - 1; +- r.corner.y = s.origin.y - 11; ++ r.corner.y = s.origin.y - 40; + r.extent.width = RADAR_WIDTH + 2; + BatchGraphics (); + SetContextForeGroundColor ( +Index: src/uqm/setupmenu.c +=================================================================== +--- src/uqm/setupmenu.c (revision 3779) ++++ src/uqm/setupmenu.c (working copy) +@@ -75,7 +75,7 @@ + #endif + + #define MENU_COUNT 8 +-#define CHOICE_COUNT 24 ++#define CHOICE_COUNT 25 + #define SLIDER_COUNT 4 + #define BUTTON_COUNT 10 + #define LABEL_COUNT 4 +@@ -98,7 +98,7 @@ + static int choice_widths[CHOICE_COUNT] = { + 3, 2, 3, 3, 2, 2, 2, 2, 2, 2, + 2, 2, 3, 2, 2, 3, 3, 2, 3, 3, +- 3, 2, 2, 2 }; ++ 3, 2, 2, 2, 2 }; + + static HANDLER button_handlers[BUTTON_COUNT] = { + quit_main_menu, quit_sub_menu, do_graphics, do_engine, +@@ -157,6 +157,7 @@ + (WIDGET *)(&choices[12]), + (WIDGET *)(&choices[15]), + (WIDGET *)(&choices[16]), ++ (WIDGET *)(&choices[24]), + (WIDGET *)(&buttons[1]), + NULL }; + +@@ -416,6 +417,7 @@ + choices[21].selected = opts.musicremix; + choices[22].selected = opts.speech; + choices[23].selected = opts.keepaspect; ++ choices[24].selected = opts.directionaljoystick; + + sliders[0].value = opts.musicvol; + sliders[1].value = opts.sfxvol; +@@ -450,6 +452,7 @@ + opts.musicremix = choices[21].selected; + opts.speech = choices[22].selected; + opts.keepaspect = choices[23].selected; ++ opts.directionaljoystick = choices[24].selected; + + opts.musicvol = sliders[0].value; + opts.sfxvol = sliders[1].value; +@@ -1277,6 +1280,7 @@ + opts->musicremix = optRemixMusic ? OPTVAL_ENABLED : OPTVAL_DISABLED; + opts->speech = optSpeech ? OPTVAL_ENABLED : OPTVAL_DISABLED; + opts->keepaspect = optKeepAspectRatio ? OPTVAL_ENABLED : OPTVAL_DISABLED; ++ opts->directionaljoystick = optDirectionalJoystick ? OPTVAL_ENABLED : OPTVAL_DISABLED; + switch (snddriver) { + case audio_DRIVER_OPENAL: + opts->adriver = OPTVAL_OPENAL; +@@ -1518,6 +1522,7 @@ + optWhichIntro = (opts->intro == OPTVAL_3DO) ? OPT_3DO : OPT_PC; + optStereoSFX = (opts->stereo == OPTVAL_ENABLED); + optKeepAspectRatio = (opts->keepaspect == OPTVAL_ENABLED); ++ optDirectionalJoystick = (opts->directionaljoystick == OPTVAL_ENABLED) ? TRUE : FALSE; + PlayerControls[0] = opts->player1; + PlayerControls[1] = opts->player2; + +@@ -1532,6 +1537,7 @@ + res_PutBoolean ("config.speech", opts->speech == OPTVAL_ENABLED); + res_PutBoolean ("config.3domovies", opts->intro == OPTVAL_3DO); + res_PutBoolean ("config.showfps", opts->fps == OPTVAL_ENABLED); ++ res_PutBoolean ("config.directionaljoystick", opts->directionaljoystick == OPTVAL_ENABLED); + res_PutBoolean ("config.smoothmelee", opts->meleezoom == OPTVAL_3DO); + res_PutBoolean ("config.positionalsfx", opts->stereo == OPTVAL_ENABLED); + res_PutBoolean ("config.pulseshield", opts->shield == OPTVAL_3DO); +Index: src/uqm/setupmenu.h +=================================================================== +--- src/uqm/setupmenu.h (revision 3779) ++++ src/uqm/setupmenu.h (working copy) +@@ -81,6 +81,7 @@ + OPT_ENABLABLE fullscreen, subtitles, scanlines, fps, stereo; + OPT_ENABLABLE music3do, musicremix, speech; + OPT_ENABLABLE keepaspect; ++ OPT_ENABLABLE directionaljoystick; + OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; + CONTROL_TEMPLATE player1, player2; + int speechvol, musicvol, sfxvol; +Index: src/uqm/starcon.c +=================================================================== +--- src/uqm/starcon.c (revision 3779) ++++ src/uqm/starcon.c (working copy) +@@ -218,6 +218,7 @@ + InitGameClock (); + AddInitialGameEvents(); + ++ TFB_SetOnScreenKeyboard_Melee (); + do + { + #ifdef DEBUG +Index: src/uqm/globdata.c +=================================================================== +--- src/uqm/globdata.c (revision 3779) ++++ src/uqm/globdata.c (working copy) +@@ -131,7 +131,7 @@ + OldContext = SetContext (RadarContext); + SetContextFGFrame (Screen); + r.corner.x = RADAR_X; +- r.corner.y = RADAR_Y; ++ r.corner.y = RADAR_Y_LIFTED_UP; + r.extent.width = RADAR_WIDTH; + r.extent.height = RADAR_HEIGHT; + SetContextClipRect (&r); +Index: src/uqm/shipyard.c +=================================================================== +--- src/uqm/shipyard.c (revision 3779) ++++ src/uqm/shipyard.c (working copy) +@@ -201,9 +201,9 @@ + OldContext = SetContext (StatusContext); + GetContextClipRect (&r); + s.origin.x = RADAR_X - r.corner.x; +- s.origin.y = RADAR_Y - r.corner.y; ++ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y; + r.corner.x = s.origin.x - 1; +- r.corner.y = s.origin.y - 11; ++ r.corner.y = s.origin.y - 1; + r.extent.width = RADAR_WIDTH + 2; + r.extent.height = 11; + BatchGraphics (); +@@ -227,10 +227,6 @@ + NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q), + hStarShip); + +- // Draw the ship name, above the ship image. +- s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 3 + NewRaceItem); +- DrawStamp (&s); +- + // Draw the ship image. + FleetPtr = LockFleetInfo (&GLOBAL (avail_race_q), hStarShip); + s.frame = FleetPtr->melee_icon; +@@ -241,6 +237,12 @@ + s.origin.y += (RADAR_HEIGHT >> 1); + DrawStamp (&s); + ++ // Draw the ship name, above the ship image. ++ s.origin.x -= (RADAR_WIDTH >> 1); ++ s.origin.y -= (RADAR_HEIGHT >> 2); ++ s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 3 + NewRaceItem); ++ DrawStamp (&s); ++ + // Print the ship cost. + t.align = ALIGN_RIGHT; + t.CharCount = (COUNT)~0; +Index: src/options.c +=================================================================== +--- src/options.c (revision 3779) ++++ src/options.c (working copy) +@@ -50,6 +50,7 @@ + int optWhichShield; + int optSmoothScroll; + int optMeleeScale; ++int optDirectionalJoystick; + const char **optAddons; + + BOOLEAN opt3doMusic; +@@ -467,6 +468,7 @@ + + for (i = 0; i < dirList->numNames; i++) + { ++ log_add (log_Info, "Mounting ZIP '%s'", dirList->names[i]); + if (uio_mountDir (repository, mountPoint, uio_FSTYPE_ZIP, + dirHandle, dirList->names[i], "/", autoMount, + relativeFlags | uio_MOUNT_RDONLY, diff --git a/project/jni/application/sc2/icon.png b/project/jni/application/uqm/icon.png similarity index 100% rename from project/jni/application/sc2/icon.png rename to project/jni/application/uqm/icon.png diff --git a/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp b/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp index c0f512ffd..1beed664a 100644 --- a/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp +++ b/project/jni/boost/include/boost/accumulators/framework/accumulators/droppable_accumulator.hpp @@ -115,6 +115,12 @@ namespace boost { namespace accumulators { } + droppable_accumulator_base(droppable_accumulator_base const &that) + : Accumulator(*static_cast(&that)) + , ref_count_(that.ref_count_) + { + } + template void operator ()(Args const &args) { @@ -162,6 +168,11 @@ namespace boost { namespace accumulators : droppable_accumulator::base(args) { } + + droppable_accumulator(droppable_accumulator const &that) + : droppable_accumulator::base(*static_cast(&that)) + { + } }; ////////////////////////////////////////////////////////////////////////// diff --git a/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp b/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp index 76087b091..c32897294 100644 --- a/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp +++ b/project/jni/boost/include/boost/accumulators/framework/depends_on.hpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -26,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -94,15 +97,49 @@ namespace boost { namespace accumulators template struct is_dependent_on : is_base_and_derived< - typename undroppable::type + typename feature_of::type>::type , typename undroppable::type > {}; + template + struct dependencies_of + { + typedef typename Feature::dependencies type; + }; + + // Should use mpl::insert_range, but doesn't seem to work with mpl sets + template + struct set_insert_range + : mpl::fold< + Range + , Set + , mpl::insert + > + {}; + + template + struct collect_abstract_features + : mpl::fold< + Features + , mpl::set0<> + , set_insert_range< + mpl::insert > + , collect_abstract_features > + > + > + {}; + template struct depends_on_base : mpl::inherit_linearly< - typename mpl::sort >::type + typename mpl::sort< + typename mpl::copy< + typename collect_abstract_features::type + , mpl::back_inserter > + >::type + , is_dependent_on + >::type // Don't inherit multiply from a feature , mpl::if_< is_dependent_on @@ -319,7 +356,7 @@ namespace boost { namespace accumulators type; }; - // BUGBUG work around a MPL bug wrt map insertion + // BUGBUG work around an MPL bug wrt map insertion template struct insert_feature : mpl::eval_if< diff --git a/project/jni/boost/include/boost/accumulators/statistics.hpp b/project/jni/boost/include/boost/accumulators/statistics.hpp index 1d136e58e..01786079a 100644 --- a/project/jni/boost/include/boost/accumulators/statistics.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/accumulators/statistics/density.hpp b/project/jni/boost/include/boost/accumulators/statistics/density.hpp index 8835f47b6..63ce6d6dd 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/density.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/density.hpp @@ -95,7 +95,7 @@ namespace impl } // Once cache_size samples have been accumulated, create num_bins bins of same size between - // the minimum and maximum of the cached samples as well as an under- and and an overflow bin. + // the minimum and maximum of the cached samples as well as under and overflow bins. // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). if (cnt == this->cache_size) { diff --git a/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp b/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp index b6c008d71..09ffef296 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/extended_p_square_quantile.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/accumulators/statistics/median.hpp b/project/jni/boost/include/boost/accumulators/statistics/median.hpp index 13ebb2862..919cf69e4 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/median.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/median.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace boost { namespace accumulators { diff --git a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp new file mode 100644 index 000000000..b9e24f676 --- /dev/null +++ b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumul_dist.hpp @@ -0,0 +1,260 @@ +/////////////////////////////////////////////////////////////////////////////// +// p_square_cumulative_distribution.hpp +// +// Copyright 2005 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 +#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace accumulators +{ +/////////////////////////////////////////////////////////////////////////////// +// num_cells named parameter +// +BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) + +namespace impl +{ + /////////////////////////////////////////////////////////////////////////////// + // p_square_cumulative_distribution_impl + // cumulative_distribution calculation (as histogram) + /** + @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm + + A histogram of the sample cumulative distribution is computed dynamically without storing samples + based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells) + equiprobable (and not equal-sized) cells. + + For further details, see + + R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + histograms without storing observations, Communications of the ACM, + Volume 28 (October), Number 10, 1985, p. 1076-1085. + + @param p_square_cumulative_distribution_num_cells. + */ + template + struct p_square_cumulative_distribution_impl + : accumulator_base + { + typedef typename numeric::functional::average::result_type float_type; + typedef std::vector array_type; + typedef std::vector > histogram_type; + // for boost::result_of + typedef iterator_range result_type; + + template + p_square_cumulative_distribution_impl(Args const &args) + : num_cells(args[p_square_cumulative_distribution_num_cells]) + , heights(num_cells + 1) + , actual_positions(num_cells + 1) + , desired_positions(num_cells + 1) + , positions_increments(num_cells + 1) + , histogram(num_cells + 1) + , is_dirty(true) + { + std::size_t b = this->num_cells; + + for (std::size_t i = 0; i < b + 1; ++i) + { + this->actual_positions[i] = i + 1.; + this->desired_positions[i] = i + 1.; + this->positions_increments[i] = numeric::average(i, b); + } + } + + template + void operator ()(Args const &args) + { + this->is_dirty = true; + + std::size_t cnt = count(args); + std::size_t sample_cell = 1; // k + std::size_t b = this->num_cells; + + // accumulate num_cells + 1 first samples + if (cnt <= b + 1) + { + this->heights[cnt - 1] = args[sample]; + + // complete the initialization of heights by sorting + if (cnt == b + 1) + { + std::sort(this->heights.begin(), this->heights.end()); + } + } + else + { + // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values + if (args[sample] < this->heights[0]) + { + this->heights[0] = args[sample]; + sample_cell = 1; + } + else if (this->heights[b] <= args[sample]) + { + this->heights[b] = args[sample]; + sample_cell = b; + } + else + { + typename array_type::iterator it; + it = std::upper_bound( + this->heights.begin() + , this->heights.end() + , args[sample] + ); + + sample_cell = std::distance(this->heights.begin(), it); + } + + // increment positions of markers above sample_cell + for (std::size_t i = sample_cell; i < b + 1; ++i) + { + ++this->actual_positions[i]; + } + + // update desired position of markers 2 to num_cells + 1 + // (desired position of first marker is always 1) + for (std::size_t i = 1; i < b + 1; ++i) + { + this->desired_positions[i] += this->positions_increments[i]; + } + + // adjust heights of markers 2 to num_cells if necessary + for (std::size_t i = 1; i < b; ++i) + { + // offset to desire position + float_type d = this->desired_positions[i] - this->actual_positions[i]; + + // offset to next position + float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; + + // offset to previous position + float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; + + // height ds + float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; + float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; + + if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) + { + short sign_d = static_cast(d / std::abs(d)); + + // try adjusting heights[i] using p-squared formula + float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); + + if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) + { + this->heights[i] = h; + } + else + { + // use linear formula + if (d>0) + { + this->heights[i] += hp; + } + if (d<0) + { + this->heights[i] -= hm; + } + } + this->actual_positions[i] += sign_d; + } + } + } + } + + template + result_type result(Args const &args) const + { + if (this->is_dirty) + { + this->is_dirty = false; + + // creates a vector of std::pair where each pair i holds + // the values heights[i] (x-axis of histogram) and + // actual_positions[i] / cnt (y-axis of histogram) + + std::size_t cnt = count(args); + + for (std::size_t i = 0; i < this->histogram.size(); ++i) + { + this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], cnt)); + } + } + //return histogram; + return make_iterator_range(this->histogram); + } + + private: + std::size_t num_cells; // number of cells b + array_type heights; // q_i + array_type actual_positions; // n_i + array_type desired_positions; // n'_i + array_type positions_increments; // dn'_i + mutable histogram_type histogram; // histogram + mutable bool is_dirty; + }; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// tag::p_square_cumulative_distribution +// +namespace tag +{ + struct p_square_cumulative_distribution + : depends_on + , p_square_cumulative_distribution_num_cells + { + /// INTERNAL ONLY + /// + typedef accumulators::impl::p_square_cumulative_distribution_impl impl; + }; +} + +/////////////////////////////////////////////////////////////////////////////// +// extract::p_square_cumulative_distribution +// +namespace extract +{ + extractor const p_square_cumulative_distribution = {}; + + BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution) +} + +using extract::p_square_cumulative_distribution; + +// So that p_square_cumulative_distribution can be automatically substituted with +// weighted_p_square_cumulative_distribution when the weight parameter is non-void +template<> +struct as_weighted_feature +{ + typedef tag::weighted_p_square_cumulative_distribution type; +}; + +template<> +struct feature_of + : feature_of +{ +}; + +}} // namespace boost::accumulators + +#endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp index 437469c65..5e08b5129 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/p_square_cumulative_distribution.hpp @@ -1,260 +1,19 @@ /////////////////////////////////////////////////////////////////////////////// // p_square_cumulative_distribution.hpp // -// Copyright 2005 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Copyright 2012 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 +#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 +#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp" +#endif -namespace boost { namespace accumulators -{ -/////////////////////////////////////////////////////////////////////////////// -// num_cells named parameter -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // p_square_cumulative_distribution_impl - // cumulative_distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells) - equiprobable (and not equal-sized) cells. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells. - */ - template - struct p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::average::result_type float_type; - typedef std::vector array_type; - typedef std::vector > histogram_type; - // for boost::result_of - typedef iterator_range result_type; - - template - p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , positions_increments(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - std::size_t b = this->num_cells; - - for (std::size_t i = 0; i < b + 1; ++i) - { - this->actual_positions[i] = i + 1.; - this->desired_positions[i] = i + 1.; - this->positions_increments[i] = numeric::average(i, b); - } - } - - template - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - std::sort(this->heights.begin(), this->heights.end()); - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - ++this->actual_positions[i]; - } - - // update desired position of markers 2 to num_cells + 1 - // (desired position of first marker is always 1) - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] += this->positions_increments[i]; - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / cnt (y-axis of histogram) - - std::size_t cnt = count(args); - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], cnt)); - } - } - //return histogram; - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - array_type positions_increments; // dn'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::p_square_cumulative_distribution -// -namespace tag -{ - struct p_square_cumulative_distribution - : depends_on - , p_square_cumulative_distribution_num_cells - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::p_square_cumulative_distribution_impl impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::p_square_cumulative_distribution -// -namespace extract -{ - extractor const p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution) -} - -using extract::p_square_cumulative_distribution; - -// So that p_square_cumulative_distribution can be automatically substituted with -// weighted_p_square_cumulative_distribution when the weight parameter is non-void -template<> -struct as_weighted_feature -{ - typedef tag::weighted_p_square_cumulative_distribution type; -}; - -template<> -struct feature_of - : feature_of -{ -}; - -}} // namespace boost::accumulators +#include #endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp index 46880c88d..b8b94f9f9 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_median.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace boost { namespace accumulators { diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp new file mode 100644 index 000000000..832e23141 --- /dev/null +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp @@ -0,0 +1,262 @@ +/////////////////////////////////////////////////////////////////////////////// +// weighted_p_square_cumul_dist.hpp +// +// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 +#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for named parameter p_square_cumulative_distribution_num_cells + +namespace boost { namespace accumulators +{ + +namespace impl +{ + /////////////////////////////////////////////////////////////////////////////// + // weighted_p_square_cumulative_distribution_impl + // cumulative distribution calculation (as histogram) + /** + @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm for weighted samples + + A histogram of the sample cumulative distribution is computed dynamically without storing samples + based on the \f$ P^2 \f$ algorithm for weighted samples. The returned histogram has a specifiable + amount (num_cells) equiprobable (and not equal-sized) cells. + + Note that applying importance sampling results in regions to be more and other regions to be less + accurately estimated than without importance sampling, i.e., with unweighted samples. + + For further details, see + + R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and + histograms without storing observations, Communications of the ACM, + Volume 28 (October), Number 10, 1985, p. 1076-1085. + + @param p_square_cumulative_distribution_num_cells + */ + template + struct weighted_p_square_cumulative_distribution_impl + : accumulator_base + { + typedef typename numeric::functional::multiplies::result_type weighted_sample; + typedef typename numeric::functional::average::result_type float_type; + typedef std::vector > histogram_type; + typedef std::vector array_type; + // for boost::result_of + typedef iterator_range result_type; + + template + weighted_p_square_cumulative_distribution_impl(Args const &args) + : num_cells(args[p_square_cumulative_distribution_num_cells]) + , heights(num_cells + 1) + , actual_positions(num_cells + 1) + , desired_positions(num_cells + 1) + , histogram(num_cells + 1) + , is_dirty(true) + { + } + + template + void operator ()(Args const &args) + { + this->is_dirty = true; + + std::size_t cnt = count(args); + std::size_t sample_cell = 1; // k + std::size_t b = this->num_cells; + + // accumulate num_cells + 1 first samples + if (cnt <= b + 1) + { + this->heights[cnt - 1] = args[sample]; + this->actual_positions[cnt - 1] = args[weight]; + + // complete the initialization of heights by sorting + if (cnt == b + 1) + { + //std::sort(this->heights.begin(), this->heights.end()); + + // TODO: we need to sort the initial samples (in heights) in ascending order and + // sort their weights (in actual_positions) the same way. The following lines do + // it, but there must be a better and more efficient way of doing this. + typename array_type::iterator it_begin, it_end, it_min; + + it_begin = this->heights.begin(); + it_end = this->heights.end(); + + std::size_t pos = 0; + + while (it_begin != it_end) + { + it_min = std::min_element(it_begin, it_end); + std::size_t d = std::distance(it_begin, it_min); + std::swap(*it_begin, *it_min); + std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); + ++it_begin; + ++pos; + } + + // calculate correct initial actual positions + for (std::size_t i = 1; i < b; ++i) + { + this->actual_positions[i] += this->actual_positions[i - 1]; + } + } + } + else + { + // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values + if (args[sample] < this->heights[0]) + { + this->heights[0] = args[sample]; + this->actual_positions[0] = args[weight]; + sample_cell = 1; + } + else if (this->heights[b] <= args[sample]) + { + this->heights[b] = args[sample]; + sample_cell = b; + } + else + { + typename array_type::iterator it; + it = std::upper_bound( + this->heights.begin() + , this->heights.end() + , args[sample] + ); + + sample_cell = std::distance(this->heights.begin(), it); + } + + // increment positions of markers above sample_cell + for (std::size_t i = sample_cell; i < b + 1; ++i) + { + this->actual_positions[i] += args[weight]; + } + + // determine desired marker positions + for (std::size_t i = 1; i < b + 1; ++i) + { + this->desired_positions[i] = this->actual_positions[0] + + numeric::average((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); + } + + // adjust heights of markers 2 to num_cells if necessary + for (std::size_t i = 1; i < b; ++i) + { + // offset to desire position + float_type d = this->desired_positions[i] - this->actual_positions[i]; + + // offset to next position + float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; + + // offset to previous position + float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; + + // height ds + float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; + float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; + + if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) + { + short sign_d = static_cast(d / std::abs(d)); + + // try adjusting heights[i] using p-squared formula + float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); + + if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) + { + this->heights[i] = h; + } + else + { + // use linear formula + if (d>0) + { + this->heights[i] += hp; + } + if (d<0) + { + this->heights[i] -= hm; + } + } + this->actual_positions[i] += sign_d; + } + } + } + } + + template + result_type result(Args const &args) const + { + if (this->is_dirty) + { + this->is_dirty = false; + + // creates a vector of std::pair where each pair i holds + // the values heights[i] (x-axis of histogram) and + // actual_positions[i] / sum_of_weights (y-axis of histogram) + + for (std::size_t i = 0; i < this->histogram.size(); ++i) + { + this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], sum_of_weights(args))); + } + } + + return make_iterator_range(this->histogram); + } + + private: + std::size_t num_cells; // number of cells b + array_type heights; // q_i + array_type actual_positions; // n_i + array_type desired_positions; // n'_i + mutable histogram_type histogram; // histogram + mutable bool is_dirty; + }; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// tag::weighted_p_square_cumulative_distribution +// +namespace tag +{ + struct weighted_p_square_cumulative_distribution + : depends_on + , p_square_cumulative_distribution_num_cells + { + typedef accumulators::impl::weighted_p_square_cumulative_distribution_impl impl; + }; +} + +/////////////////////////////////////////////////////////////////////////////// +// extract::weighted_p_square_cumulative_distribution +// +namespace extract +{ + extractor const weighted_p_square_cumulative_distribution = {}; + + BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_cumulative_distribution) +} + +using extract::weighted_p_square_cumulative_distribution; + +}} // namespace boost::accumulators + +#endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp index 290f090fe..918970e8d 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp @@ -1,262 +1,19 @@ /////////////////////////////////////////////////////////////////////////////// // weighted_p_square_cumulative_distribution.hpp // -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the Boost +// Copyright 2012 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_DE_01_01_2006 +#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 +#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for named parameter p_square_cumulative_distribution_num_cells +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp" +#endif -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_p_square_cumulative_distribution_impl - // cumulative distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm for weighted samples - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm for weighted samples. The returned histogram has a specifiable - amount (num_cells) equiprobable (and not equal-sized) cells. - - Note that applying importance sampling results in regions to be more and other regions to be less - accurately estimated than without importance sampling, i.e., with unweighted samples. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithmus for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells - */ - template - struct weighted_p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies::result_type weighted_sample; - typedef typename numeric::functional::average::result_type float_type; - typedef std::vector > histogram_type; - typedef std::vector array_type; - // for boost::result_of - typedef iterator_range result_type; - - template - weighted_p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - } - - template - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - this->actual_positions[cnt - 1] = args[weight]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - //std::sort(this->heights.begin(), this->heights.end()); - - // TODO: we need to sort the initial samples (in heights) in ascending order and - // sort their weights (in actual_positions) the same way. The following lines do - // it, but there must be a better and more efficient way of doing this. - typename array_type::iterator it_begin, it_end, it_min; - - it_begin = this->heights.begin(); - it_end = this->heights.end(); - - std::size_t pos = 0; - - while (it_begin != it_end) - { - it_min = std::min_element(it_begin, it_end); - std::size_t d = std::distance(it_begin, it_min); - std::swap(*it_begin, *it_min); - std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); - ++it_begin; - ++pos; - } - - // calculate correct initial actual positions - for (std::size_t i = 1; i < b; ++i) - { - this->actual_positions[i] += this->actual_positions[i - 1]; - } - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - this->actual_positions[0] = args[weight]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - this->actual_positions[i] += args[weight]; - } - - // determine desired marker positions - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] = this->actual_positions[0] - + numeric::average((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / sum_of_weights (y-axis of histogram) - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::average(this->actual_positions[i], sum_of_weights(args))); - } - } - - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_p_square_cumulative_distribution -// -namespace tag -{ - struct weighted_p_square_cumulative_distribution - : depends_on - , p_square_cumulative_distribution_num_cells - { - typedef accumulators::impl::weighted_p_square_cumulative_distribution_impl impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_p_square_cumulative_distribution -// -namespace extract -{ - extractor const weighted_p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_cumulative_distribution) -} - -using extract::weighted_p_square_cumulative_distribution; - -}} // namespace boost::accumulators +#include #endif diff --git a/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp b/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp index 6d3017b3e..8ee2c5600 100644 --- a/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp +++ b/project/jni/boost/include/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/algorithm/clamp.hpp b/project/jni/boost/include/boost/algorithm/clamp.hpp new file mode 100644 index 000000000..ae98d15d2 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/clamp.hpp @@ -0,0 +1,175 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + Revision history: + 27 June 2009 mtc First version + 23 Oct 2010 mtc Added predicate version + +*/ + +/// \file clamp.hpp +/// \brief Clamp algorithm +/// \author Marshall Clow +/// +/// Suggested by olafvdspek in https://svn.boost.org/trac/boost/ticket/3215 + +#ifndef BOOST_ALGORITHM_CLAMP_HPP +#define BOOST_ALGORITHM_CLAMP_HPP + +#include // For std::less +#include // For std::iterator_traits +#include + +#include +#include +#include // for identity +#include // for boost::disable_if + +namespace boost { namespace algorithm { + +/// \fn clamp ( T const& val, +/// typename boost::mpl::identity::type const& lo, +/// typename boost::mpl::identity::type const& hi, Pred p ) +/// \return the value "val" brought into the range [ lo, hi ] +/// using the comparison predicate p. +/// If p ( val, lo ) return lo. +/// If p ( hi, val ) return hi. +/// Otherwise, return the original value. +/// +/// \param val The value to be clamped +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +/// + template + T const & clamp ( T const& val, + typename boost::mpl::identity::type const & lo, + typename boost::mpl::identity::type const & hi, Pred p ) + { +// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal + return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val; + } + + +/// \fn clamp ( T const& val, +/// typename boost::mpl::identity::type const& lo, +/// typename boost::mpl::identity::type const& hi ) +/// \return the value "val" brought into the range [ lo, hi ]. +/// If the value is less than lo, return lo. +/// If the value is greater than "hi", return hi. +/// Otherwise, return the original value. +/// +/// \param val The value to be clamped +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + T const& clamp ( const T& val, + typename boost::mpl::identity::type const & lo, + typename boost::mpl::identity::type const & hi ) + { + return (clamp) ( val, lo, hi, std::less()); + } + +/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out, +/// std::iterator_traits::value_type lo, +/// std::iterator_traits::value_type hi ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// +/// \param first The start of the range of values +/// \param last One past the end of the range of input values +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi ) + { + // this could also be written with bind and std::transform + while ( first != last ) + *out++ = clamp ( *first++, lo, hi ); + return out; + } + +/// \fn clamp_range ( const Range &r, OutputIterator out, +/// typename std::iterator_traits::type>::value_type lo, +/// typename std::iterator_traits::type>::value_type hi ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// +/// \param r The range of values to be clamped +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// + template + typename boost::disable_if_c::value, OutputIterator>::type + clamp_range ( const Range &r, OutputIterator out, + typename std::iterator_traits::type>::value_type lo, + typename std::iterator_traits::type>::value_type hi ) + { + return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi ); + } + + +/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out, +/// std::iterator_traits::value_type lo, +/// std::iterator_traits::value_type hi, Pred p ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// using the comparison predicate p. +/// +/// \param first The start of the range of values +/// \param last One past the end of the range of input values +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. + +/// + template + OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi, Pred p ) + { + // this could also be written with bind and std::transform + while ( first != last ) + *out++ = clamp ( *first++, lo, hi, p ); + return out; + } + +/// \fn clamp_range ( const Range &r, OutputIterator out, +/// typename std::iterator_traits::type>::value_type lo, +/// typename std::iterator_traits::type>::value_type hi, +/// Pred p ) +/// \return clamp the sequence of values [first, last) into [ lo, hi ] +/// using the comparison predicate p. +/// +/// \param r The range of values to be clamped +/// \param out An output iterator to write the clamped values into +/// \param lo The lower bound of the range to be clamped to +/// \param hi The upper bound of the range to be clamped to +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +// +// Disable this template if the first two parameters are the same type; +// In that case, the user will get the two iterator version. + template + typename boost::disable_if_c::value, OutputIterator>::type + clamp_range ( const Range &r, OutputIterator out, + typename std::iterator_traits::type>::value_type lo, + typename std::iterator_traits::type>::value_type hi, + Pred p ) + { + return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi, p ); + } + + +}} + +#endif // BOOST_ALGORITHM_CLAMP_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp new file mode 100644 index 000000000..b76cb3f01 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/all_of.hpp @@ -0,0 +1,91 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file all_of.hpp +/// \brief Test ranges to see if all elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ALL_OF_HPP +#define BOOST_ALGORITHM_ALL_OF_HPP + +#include // for std::all_of, if available +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of all_of if it is available +using std::all_of; // Section 25.2.1 +#else +/// \fn all_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if all elements in [first, last) satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +bool all_of ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( !p(*first)) + return false; + return true; +} +#endif + +/// \fn all_of ( const Range &r, Predicate p ) +/// \return true if all elements in the range satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool all_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); +} + +/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val ) +/// \return true if all elements in [first, last) are equal to 'val' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) +{ + for ( ; first != last; ++first ) + if ( val != *first ) + return false; + return true; +} + +/// \fn all_of_equal ( const Range &r, const T &val ) +/// \return true if all elements in the range are equal to 'val' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool all_of_equal ( const Range &r, const T &val ) +{ + return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ALL_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp new file mode 100644 index 000000000..c3ab3ce59 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/any_of.hpp @@ -0,0 +1,90 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +/// \file +/// \brief Test ranges to see if any elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ANY_OF_HPP +#define BOOST_ALGORITHM_ANY_OF_HPP + +#include // for std::any_of, if available +#include +#include + +namespace boost { namespace algorithm { + +// Use the C++11 versions of any_of if it is available +#if __cplusplus >= 201103L +using std::any_of; // Section 25.2.2 +#else +/// \fn any_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if any of the elements in [first, last) satisfy the predicate +/// \note returns false on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool any_of ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( p(*first)) + return true; + return false; +} +#endif + +/// \fn any_of ( const Range &r, Predicate p ) +/// \return true if any elements in the range satisfy the predicate 'p' +/// \note returns false on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool any_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::any_of (boost::begin (r), boost::end (r), p); +} + +/// \fn any_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if any of the elements in [first, last) are equal to 'val' +/// \note returns false on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + for ( ; first != last; ++first ) + if ( val == *first ) + return true; + return false; +} + +/// \fn any_of_equal ( const Range &r, const V &val ) +/// \return true if any of the elements in the range are equal to 'val' +/// \note returns false on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool any_of_equal ( const Range &r, const V &val ) +{ + return boost::algorithm::any_of_equal (boost::begin (r), boost::end (r), val); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ANY_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp b/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp new file mode 100644 index 000000000..8591cb54d --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/copy_if.hpp @@ -0,0 +1,133 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file copy_if.hpp +/// \brief Copy a subset of a sequence to a new sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_COPY_IF_HPP +#define BOOST_ALGORITHM_COPY_IF_HPP + +#include // for std::copy_if, if available +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of copy_if if it is available +using std::copy_if; // Section 25.3.1 +#else +/// \fn copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements from the input range that satisfy the +/// predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +{ + for ( ; first != last; ++first ) + if (p(*first)) + *result++ = *first; + return result; +} +#endif + +/// \fn copy_if ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements from the input range that satisfy the +/// predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_if (boost::begin (r), boost::end(r), result, p); +} + + +/// \fn copy_while ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_while ( InputIterator first, InputIterator last, + OutputIterator result, Predicate p ) +{ + for ( ; first != last && p(*first); ++first ) + *result++ = *first; + return result; +} + +/// \fn copy_while ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_while ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_while (boost::begin (r), boost::end(r), result, p); +} + + +/// \fn copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that do not +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +{ + for ( ; first != last && !p(*first); ++first ) + *result++ = *first; + return result; +} + +/// \fn copy_until ( const Range &r, OutputIterator result, Predicate p ) +/// \brief Copies all the elements at the start of the input range that do not +/// satisfy the predicate to the output range. +/// \return The updated output iterator +/// +/// \param r The input range +/// \param result An output iterator to write the results into +/// \param p A predicate for testing the elements of the range +/// +template +OutputIterator copy_until ( const Range &r, OutputIterator result, Predicate p ) +{ + return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_COPY_IF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp b/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp new file mode 100644 index 000000000..0ea53bd23 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/copy_n.hpp @@ -0,0 +1,44 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file copy_n.hpp +/// \brief Copy n items from one sequence to another +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_COPY_N_HPP +#define BOOST_ALGORITHM_COPY_N_HPP + +#include // for std::copy_n, if available + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of copy_n if it is available +using std::copy_n; // Section 25.3.1 +#else +/// \fn copy_n ( InputIterator first, Size n, OutputIterator result ) +/// \brief Copies exactly n (n > 0) elements from the range starting at first to +/// the range starting at result. +/// \return The updated output iterator +/// +/// \param first The start of the input sequence +/// \param n The number of elements to copy +/// \param result An output iterator to write the results into +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result ) +{ + for ( ; n > 0; --n, ++first, ++result ) + *result = *first; + return result; +} +#endif +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_COPY_IF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp b/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp new file mode 100644 index 000000000..4beed0008 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/find_if_not.hpp @@ -0,0 +1,60 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file find_if_not.hpp +/// \brief Find the first element in a sequence that does not satisfy a predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP +#define BOOST_ALGORITHM_FIND_IF_NOT_HPP + +#include // for std::find_if_not, if it exists + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of find_if_not if it is available +using std::find_if_not; // Section 25.2.5 +#else +/// \fn find_if_not(InputIterator first, InputIterator last, Predicate p) +/// \brief Finds the first element in the sequence that does not satisfy the predicate. +/// \return The iterator pointing to the desired element. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the range +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( !p(*first)) + break; + return first; +} +#endif + +/// \fn find_if_not ( const Range &r, Predicate p ) +/// \brief Finds the first element in the sequence that does not satisfy the predicate. +/// \return The iterator pointing to the desired element. +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +typename boost::range_iterator::type find_if_not ( const Range &r, Predicate p ) +{ + return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p); +} + +}} +#endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp b/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp new file mode 100644 index 000000000..b4f0dafa6 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/iota.hpp @@ -0,0 +1,74 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file iota.hpp +/// \brief Generate an increasing series +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IOTA_HPP +#define BOOST_ALGORITHM_IOTA_HPP + +#include + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of iota if it is available +using std::iota; // Section 26.7.6 +#else +/// \fn iota ( ForwardIterator first, ForwardIterator last, T value ) +/// \brief Generates an increasing sequence of values, and stores them in [first, last) +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param value The initial value of the sequence to be generated +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +void iota ( ForwardIterator first, ForwardIterator last, T value ) +{ + for ( ; first != last; ++first, ++value ) + *first = value; +} +#endif + +/// \fn iota ( Range &r, T value ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param r The input range +/// \param value The initial value of the sequence to be generated +/// +template +void iota ( Range &r, T value ) +{ + boost::algorithm::iota (boost::begin(r), boost::end(r), value); +} + + +/// \fn iota_n ( OutputIterator out, T value, std::size_t n ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param out An output iterator to write the results into +/// \param value The initial value of the sequence to be generated +/// \param n The number of items to write +/// +template +OutputIterator iota_n ( OutputIterator out, T value, std::size_t n ) +{ + while ( n-- > 0 ) + *out++ = value++; + + return out; +} + +}} + +#endif // BOOST_ALGORITHM_IOTA_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp new file mode 100644 index 000000000..e939e0560 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_partitioned.hpp @@ -0,0 +1,65 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file is_partitioned.hpp +/// \brief Tell if a sequence is partitioned +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP +#define BOOST_ALGORITHM_IS_PARTITIONED_HPP + +#include // for std::is_partitioned, if available + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_partitioned if it is available +using std::is_partitioned; // Section 25.3.13 +#else +/// \fn is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) +/// \brief Tests to see if a sequence is partitioned according to a predicate +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p The predicate to test the values with +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) +{ +// Run through the part that satisfy the predicate + for ( ; first != last; ++first ) + if ( !p (*first)) + break; +// Now the part that does not satisfy the predicate + for ( ; first != last; ++first ) + if ( p (*first)) + return false; + return true; +} +#endif + +/// \fn is_partitioned ( const Range &r, UnaryPredicate p ) +/// \brief Generates an increasing sequence of values, and stores them in the input Range. +/// +/// \param r The input range +/// \param p The predicate to test the values with +/// +template +bool is_partitioned ( const Range &r, UnaryPredicate p ) +{ + return boost::algorithm::is_partitioned (boost::begin(r), boost::end(r), p); +} + + +}} + +#endif // BOOST_ALGORITHM_IS_PARTITIONED_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp new file mode 100644 index 000000000..526ca2e47 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_permutation.hpp @@ -0,0 +1,139 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file is_permutation.hpp +/// \brief Is a sequence a permutation of another sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_IS_PERMUTATION_HPP +#define BOOST_ALGORITHM_IS_PERMUTATION_HPP + +#include // for std::less, tie, mismatch and is_permutation (if available) +#include // for std::make_pair +#include // for std::equal_to +#include + +#include +#include +#include +#include +#include // for tie + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_permutation if it is available +using std::is_permutation; // Section 25.2.12 +#else +/// \cond DOXYGEN_HIDE +namespace detail { + template + struct value_predicate { + value_predicate ( Predicate p, Iterator it ) : p_ ( p ), it_ ( it ) {} + + template + bool operator () ( const T1 &t1 ) const { return p_ ( *it_, t1 ); } + private: + Predicate &p_; + Iterator it_; + }; +} +/// \endcond + + +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2, BinaryPredicate p ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \param p The predicate to compare elements with +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate > +bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, BinaryPredicate p ) +{ +// Skip the common prefix (if any) +// std::tie (first1, first2) = std::mismatch (first1, last1, first2, p); + std::pair eq = std::mismatch (first1, last1, first2, p); + first1 = eq.first; + first2 = eq.second; + if ( first1 != last1 ) { + // Create last2 + ForwardIterator2 last2 = first2; + std::advance ( last2, std::distance (first1, last1)); + + // for each unique value in the sequence [first1,last1), count how many times + // it occurs, and make sure it occurs the same number of times in [first2, last2) + for ( ForwardIterator1 iter = first1; iter != last1; ++iter ) { + detail::value_predicate pred ( p, iter ); + + /* For each value we haven't seen yet... */ + if ( std::find_if ( first1, iter, pred ) == iter ) { + std::size_t dest_count = std::count_if ( first2, last2, pred ); + if ( dest_count == 0 || dest_count != (std::size_t) std::count_if ( iter, last1, pred )) + return false; + } + } + } + + return true; +} + +/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param first2 The start of the second sequence +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template< class ForwardIterator1, class ForwardIterator2 > +bool is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 ) +{ +// How should I deal with the idea that ForwardIterator1::value_type +// and ForwardIterator2::value_type could be different? Define my own comparison predicate? + return boost::algorithm::is_permutation ( first, last, first2, + std::equal_to::value_type> ()); +} + +#endif + +/// \fn is_permutation ( const Range &r, ForwardIterator first2 ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param r The input range +/// \param first2 The start of the second sequence +template +bool is_permutation ( const Range &r, ForwardIterator first2 ) +{ + return boost::algorithm::is_permutation (boost::begin (r), boost::end (r), first2 ); +} + +/// \fn is_permutation ( const Range &r, ForwardIterator first2, BinaryPredicate pred ) +/// \brief Tests to see if the sequence [first,last) is a permutation of the sequence starting at first2 +/// +/// \param r The input range +/// \param first2 The start of the second sequence +/// \param pred The predicate to compare elements with +/// +// Disable this template when the first two parameters are the same type +// That way the non-range version will be chosen. +template +typename boost::disable_if_c::value, bool>::type +is_permutation ( const Range &r, ForwardIterator first2, BinaryPredicate pred ) +{ + return boost::algorithm::is_permutation (boost::begin (r), boost::end (r), first2, pred ); +} + +}} + +#endif // BOOST_ALGORITHM_IS_PERMUTATION_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp b/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp new file mode 100644 index 000000000..c9bc65fbe --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/is_sorted.hpp @@ -0,0 +1,287 @@ +// Copyright (c) 2010 Nuovation System Designs, LLC +// Grant Erickson +// +// Reworked somewhat by Marshall Clow; August 2010 +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/ for latest version. +// + +#ifndef BOOST_ALGORITHM_ORDERED_HPP +#define BOOST_ALGORITHM_ORDERED_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of is_sorted/is_sorted_until if they are available +using std::is_sorted_until; // Section 25.4.1.5 +using std::is_sorted; // Section 25.4.1.5 +#else +/// \fn is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) +/// \return the point in the sequence [first, last) where the elements are unordered +/// (according to the comparison predicate 'p'). +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) + { + if ( first == last ) return last; // the empty sequence is ordered + ForwardIterator next = first; + while ( ++next != last ) + { + if ( p ( *next, *first )) + return next; + first = next; + } + return last; + } + +/// \fn is_sorted_until ( ForwardIterator first, ForwardIterator last ) +/// \return the point in the sequence [first, last) where the elements are unordered +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// + template + ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted_until ( first, last, std::less()); + } + + +/// \fn is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) +/// \return whether or not the entire sequence is sorted +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) + { + return boost::algorithm::is_sorted_until (first, last, p) == last; + } + +/// \fn is_sorted ( ForwardIterator first, ForwardIterator last ) +/// \return whether or not the entire sequence is sorted +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// + template + bool is_sorted ( ForwardIterator first, ForwardIterator last ) + { + return boost::algorithm::is_sorted_until (first, last) == last; + } +#endif + +/// +/// -- Range based versions of the C++11 functions +/// + +/// \fn is_sorted_until ( const R &range, Pred p ) +/// \return the point in the range R where the elements are unordered +/// (according to the comparison predicate 'p'). +/// +/// \param range The range to be tested. +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + typename boost::lazy_disable_if_c< + boost::is_same::value, + typename boost::range_iterator + >::type is_sorted_until ( const R &range, Pred p ) + { + return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range ), p ); + } + + +/// \fn is_sorted_until ( const R &range ) +/// \return the point in the range R where the elements are unordered +/// +/// \param range The range to be tested. +/// + template + typename boost::range_iterator::type is_sorted_until ( const R &range ) + { + return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range )); + } + +/// \fn is_sorted ( const R &range, Pred p ) +/// \return whether or not the entire range R is sorted +/// (according to the comparison predicate 'p'). +/// +/// \param range The range to be tested. +/// \param p A binary predicate that returns true if two elements are ordered. +/// + template + typename boost::lazy_disable_if_c< boost::is_same::value, boost::mpl::identity >::type + is_sorted ( const R &range, Pred p ) + { + return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p ); + } + + +/// \fn is_sorted ( const R &range ) +/// \return whether or not the entire range R is sorted +/// +/// \param range The range to be tested. +/// + template + bool is_sorted ( const R &range ) + { + return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range )); + } + + +/// +/// -- Range based versions of the C++11 functions +/// + +/// \fn is_increasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is increasing; i.e, each item is greater than or +/// equal to the previous one. +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_increasing instead. + template + bool is_increasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::less()); + } + + +/// \fn is_increasing ( const R &range ) +/// \return true if the entire sequence is increasing; i.e, each item is greater than or +/// equal to the previous one. +/// +/// \param range The range to be tested. +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_increasing instead. + template + bool is_increasing ( const R &range ) + { + return is_increasing ( boost::begin ( range ), boost::end ( range )); + } + + + +/// \fn is_decreasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is decreasing; i.e, each item is less than +/// or equal to the previous one. +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_decreasing instead. + template + bool is_decreasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::greater()); + } + +/// \fn is_decreasing ( const R &range ) +/// \return true if the entire sequence is decreasing; i.e, each item is less than +/// or equal to the previous one. +/// +/// \param range The range to be tested. +/// +/// \note This function will return true for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_strictly_decreasing instead. + template + bool is_decreasing ( const R &range ) + { + return is_decreasing ( boost::begin ( range ), boost::end ( range )); + } + + + +/// \fn is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is strictly increasing; i.e, each item is greater +/// than the previous one +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_increasing instead. + template + bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::less_equal()); + } + +/// \fn is_strictly_increasing ( const R &range ) +/// \return true if the entire sequence is strictly increasing; i.e, each item is greater +/// than the previous one +/// +/// \param range The range to be tested. +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_increasing instead. + template + bool is_strictly_increasing ( const R &range ) + { + return is_strictly_increasing ( boost::begin ( range ), boost::end ( range )); + } + + +/// \fn is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) +/// \return true if the entire sequence is strictly decreasing; i.e, each item is less than +/// the previous one +/// +/// \param first The start of the sequence to be tested. +/// \param last One past the end of the sequence +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_decreasing instead. + template + bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) + { + typedef typename std::iterator_traits::value_type value_type; + return boost::algorithm::is_sorted (first, last, std::greater_equal()); + } + +/// \fn is_strictly_decreasing ( const R &range ) +/// \return true if the entire sequence is strictly decreasing; i.e, each item is less than +/// the previous one +/// +/// \param range The range to be tested. +/// +/// \note This function will return false for sequences that contain items that compare +/// equal. If that is not what you intended, you should use is_decreasing instead. + template + bool is_strictly_decreasing ( const R &range ) + { + return is_strictly_decreasing ( boost::begin ( range ), boost::end ( range )); + } + +}} // namespace boost + +#endif // BOOST_ALGORITHM_ORDERED_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp new file mode 100644 index 000000000..feae9919f --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/none_of.hpp @@ -0,0 +1,88 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file none_of.hpp +/// \brief Test ranges to see if no elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_NONE_OF_HPP +#define BOOST_ALGORITHM_NONE_OF_HPP + +#include // for std::none_of, if available +#include +#include + +namespace boost { namespace algorithm { + +// Use the C++11 versions of the none_of if it is available +#if __cplusplus >= 201103L +using std::none_of; // Section 25.2.3 +#else +/// \fn none_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if none of the elements in [first, last) satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool none_of ( InputIterator first, InputIterator last, Predicate p ) +{ +for ( ; first != last; ++first ) + if ( p(*first)) + return false; + return true; +} +#endif + +/// \fn none_of ( const Range &r, Predicate p ) +/// \return true if none of the elements in the range satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool none_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::none_of (boost::begin (r), boost::end (r), p ); +} + +/// \fn none_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if none of the elements in [first, last) are equal to 'val' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + for ( ; first != last; ++first ) + if ( val == *first ) + return false; + return true; +} + +/// \fn none_of_equal ( const Range &r, const V &val ) +/// \return true if none of the elements in the range are equal to 'val' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool none_of_equal ( const Range &r, const V & val ) +{ + return boost::algorithm::none_of_equal (boost::begin (r), boost::end (r), val); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_NONE_OF_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp b/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp new file mode 100644 index 000000000..b6e8c7719 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/one_of.hpp @@ -0,0 +1,82 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file one_of.hpp +/// \brief Test ranges to see if only one element matches a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ONE_OF_HPP +#define BOOST_ALGORITHM_ONE_OF_HPP + +#include // for std::find and std::find_if +#include + +#include +#include + +namespace boost { namespace algorithm { + +/// \fn one_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if the predicate 'p' is true for exactly one item in [first, last). +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +template +bool one_of ( InputIterator first, InputIterator last, Predicate p ) +{ + InputIterator i = std::find_if (first, last, p); + if (i == last) + return false; // Didn't occur at all + return boost::algorithm::none_of (++i, last, p); +} + +/// \fn one_of ( const Range &r, Predicate p ) +/// \return true if the predicate 'p' is true for exactly one item in the range. +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool one_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::one_of ( boost::begin (r), boost::end (r), p ); +} + + +/// \fn one_of_equal ( InputIterator first, InputIterator last, const V &val ) +/// \return true if the value 'val' exists only once in [first, last). +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool one_of_equal ( InputIterator first, InputIterator last, const V &val ) +{ + InputIterator i = std::find (first, last, val); // find first occurrence of 'val' + if (i == last) + return false; // Didn't occur at all + return boost::algorithm::none_of_equal (++i, last, val); +} + +/// \fn one_of_equal ( const Range &r, const V &val ) +/// \return true if the value 'val' exists only once in the range. +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool one_of_equal ( const Range &r, const V &val ) +{ + return boost::algorithm::one_of_equal ( boost::begin (r), boost::end (r), val ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ALL_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp b/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp new file mode 100644 index 000000000..15c4dd68a --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/partition_copy.hpp @@ -0,0 +1,78 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file partition_copy.hpp +/// \brief Copy a subset of a sequence to a new sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP +#define BOOST_ALGORITHM_PARTITION_COPY_HPP + +#include // for std::partition_copy, if available +#include // for make_pair + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of partition_copy if it is available +using std::partition_copy; // Section 25.3.13 +#else +/// \fn partition_copy ( InputIterator first, InputIterator last, +/// OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +/// \brief Copies the elements that satisfy the predicate p from the range [first, last) +/// to the range beginning at d_first_true, and +/// copies the elements that do not satisfy p to the range beginning at d_first_false. +/// +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out_true An output iterator to write the elements that satisfy the predicate into +/// \param out_false An output iterator to write the elements that do not satisfy the predicate into +/// \param p A predicate for dividing the elements of the input sequence. +/// +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +std::pair +partition_copy ( InputIterator first, InputIterator last, + OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +{ + for ( ; first != last; ++first ) + if ( p (*first)) + *out_true++ = *first; + else + *out_false++ = *first; + return std::pair ( out_true, out_false ); +} +#endif + +/// \fn partition_copy ( const Range &r, +/// OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) +/// +/// \param r The input range +/// \param out_true An output iterator to write the elements that satisfy the predicate into +/// \param out_false An output iterator to write the elements that do not satisfy the predicate into +/// \param p A predicate for dividing the elements of the input sequence. +/// +template +std::pair +partition_copy ( const Range &r, OutputIterator1 out_true, OutputIterator2 out_false, + UnaryPredicate p ) +{ + return boost::algorithm::partition_copy + (boost::begin(r), boost::end(r), out_true, out_false, p ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_PARTITION_COPY_HPP diff --git a/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp b/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp new file mode 100644 index 000000000..36d8384b5 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/cxx11/partition_point.hpp @@ -0,0 +1,72 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file partition_point.hpp +/// \brief Find the partition point in a sequence +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_PARTITION_POINT_HPP +#define BOOST_ALGORITHM_PARTITION_POINT_HPP + +#include // for std::partition_point, if available + +#include +#include + +namespace boost { namespace algorithm { + +#if __cplusplus >= 201103L +// Use the C++11 versions of partition_point if it is available +using std::partition_point; // Section 25.3.13 +#else +/// \fn partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) +/// \brief Given a partitioned range, returns the partition point, i.e, the first element +/// that does not satisfy p +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p The predicate to test the values with +/// \note This function is part of the C++2011 standard library. +/// We will use the standard one if it is available, +/// otherwise we have our own implementation. +template +ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) +{ + std::size_t dist = std::distance ( first, last ); + while ( first != last ) { + std::size_t d2 = dist / 2; + ForwardIterator ret_val = first; + std::advance (ret_val, d2); + if (p (*ret_val)) { + first = ++ret_val; + dist -= d2 + 1; + } + else { + last = ret_val; + dist = d2; + } + } + return first; +} +#endif + +/// \fn partition_point ( Range &r, Predicate p ) +/// \brief Given a partitioned range, returns the partition point +/// +/// \param r The input range +/// \param p The predicate to test the values with +/// +template +typename boost::range_iterator partition_point ( Range &r, Predicate p ) +{ + return boost::algorithm::partition_point (boost::begin(r), boost::end(r), p); +} + + +}} + +#endif // BOOST_ALGORITHM_PARTITION_POINT_HPP diff --git a/project/jni/boost/include/boost/algorithm/hex.hpp b/project/jni/boost/include/boost/algorithm/hex.hpp new file mode 100644 index 000000000..439ec46b9 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/hex.hpp @@ -0,0 +1,269 @@ +/* + Copyright (c) Marshall Clow 2011-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + Thanks to Nevin for his comments/help. +*/ + +/* + General problem - turn a sequence of integral types into a sequence of hexadecimal characters. + - and back. + +TO DO: + 1. these should really only work on integral types. (see the >> and << operations) + -- this is done, I think. + 2. The 'value_type_or_char' struct is really a hack. + -- but it's a better hack now that it works with back_insert_iterators +*/ + +/// \file hex.hpp +/// \brief Convert sequence of integral types into a sequence of hexadecimal +/// characters and back. Based on the MySQL functions HEX and UNHEX +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_HEXHPP +#define BOOST_ALGORITHM_HEXHPP + +#include // for std::iterator_traits +#include + +#include +#include +#include + +#include +#include + + +namespace boost { namespace algorithm { + +/*! + \struct hex_decode_error + \brief Base exception class for all hex decoding errors + + \struct non_hex_input + \brief Thrown when a non-hex value (0-9, A-F) encountered when decoding. + Contains the offending character + + \struct not_enough_input + \brief Thrown when the input sequence unexpectedly ends + +*/ +struct hex_decode_error : virtual boost::exception, virtual std::exception {}; +struct not_enough_input : virtual hex_decode_error {}; +struct non_hex_input : virtual hex_decode_error {}; +typedef boost::error_info bad_char; + +namespace detail { +/// \cond DOXYGEN_HIDE + + template + OutputIterator encode_one ( T val, OutputIterator out ) { + const std::size_t num_hex_digits = 2 * sizeof ( T ); + char res [ num_hex_digits ]; + char *p = res + num_hex_digits; + for ( std::size_t i = 0; i < num_hex_digits; ++i, val >>= 4 ) + *--p = "0123456789ABCDEF" [ val & 0x0F ]; + return std::copy ( res, res + num_hex_digits, out ); + } + +// this needs to be in an un-named namespace because it is not a template +// and might get included in several compilation units. This could cause +// multiple definition errors at link time. + namespace { + unsigned hex_char_to_int ( char c ) { + if ( c >= '0' && c <= '9' ) return c - '0'; + if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10; + if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10; + BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c)); + return 0; // keep dumb compilers happy + } + } + +// My own iterator_traits class. +// It is here so that I can "reach inside" some kinds of output iterators +// and get the type to write. + template + struct hex_iterator_traits { + typedef typename std::iterator_traits::value_type value_type; + }; + + template + struct hex_iterator_traits< std::back_insert_iterator > { + typedef typename Container::value_type value_type; + }; + + template + struct hex_iterator_traits< std::front_insert_iterator > { + typedef typename Container::value_type value_type; + }; + + template + struct hex_iterator_traits< std::insert_iterator > { + typedef typename Container::value_type value_type; + }; + +// ostream_iterators have three template parameters. +// The first one is the output type, the second one is the character type of +// the underlying stream, the third is the character traits. +// We only care about the first one. + template + struct hex_iterator_traits< std::ostream_iterator > { + typedef T value_type; + }; + + template + bool iter_end ( Iterator current, Iterator last ) { return current == last; } + + template + bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; } + +// What can we assume here about the inputs? +// is std::iterator_traits::value_type always 'char' ? +// Could it be wchar_t, say? Does it matter? +// We are assuming ASCII for the values - but what about the storage? + template + typename boost::enable_if::value_type>, OutputIterator>::type + decode_one ( InputIterator &first, InputIterator last, OutputIterator out, EndPred pred ) { + typedef typename hex_iterator_traits::value_type T; + T res (0); + + // Need to make sure that we get can read that many chars here. + for ( std::size_t i = 0; i < 2 * sizeof ( T ); ++i, ++first ) { + if ( pred ( first, last )) + BOOST_THROW_EXCEPTION (not_enough_input ()); + res = ( 16 * res ) + hex_char_to_int (static_cast (*first)); + } + + *out = res; + return ++out; + } +/// \endcond + } + + +/// \fn hex ( InputIterator first, InputIterator last, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex ( InputIterator first, InputIterator last, OutputIterator out ) { + for ( ; first != last; ++first ) + out = detail::encode_one ( *first, out ); + return out; + } + + +/// \fn hex ( const T *ptr, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param ptr A pointer to a 0-terminated sequence of data. +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if, OutputIterator>::type +hex ( const T *ptr, OutputIterator out ) { + while ( *ptr ) + out = detail::encode_one ( *ptr++, out ); + return out; + } + +/// \fn hex ( const Range &r, OutputIterator out ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param r The input range +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex ( const Range &r, OutputIterator out ) { + return hex (boost::begin(r), boost::end(r), out); +} + + +/// \fn unhex ( InputIterator first, InputIterator last, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( InputIterator first, InputIterator last, OutputIterator out ) { + while ( first != last ) + out = detail::decode_one ( first, last, out, detail::iter_end ); + return out; + } + + +/// \fn unhex ( const T *ptr, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param ptr A pointer to a null-terminated input sequence. +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( const T *ptr, OutputIterator out ) { + typedef typename detail::hex_iterator_traits::value_type OutputType; +// If we run into the terminator while decoding, we will throw a +// malformed input exception. It would be nicer to throw a 'Not enough input' +// exception - but how much extra work would that require? + while ( *ptr ) + out = detail::decode_one ( ptr, (const T *) NULL, out, detail::ptr_end ); + return out; + } + + +/// \fn OutputIterator unhex ( const Range &r, OutputIterator out ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of integers. +/// +/// \param r The input range +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +OutputIterator unhex ( const Range &r, OutputIterator out ) { + return unhex (boost::begin(r), boost::end(r), out); + } + + +/// \fn String hex ( const String &input ) +/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. +/// +/// \param input A container to be converted +/// \return A container with the encoded text +template +String hex ( const String &input ) { + String output; + output.reserve (input.size () * (2 * sizeof (typename String::value_type))); + (void) hex (input, std::back_inserter (output)); + return output; + } + +/// \fn String unhex ( const String &input ) +/// \brief Converts a sequence of hexadecimal characters into a sequence of characters. +/// +/// \param input A container to be converted +/// \return A container with the decoded text +template +String unhex ( const String &input ) { + String output; + output.reserve (input.size () / (2 * sizeof (typename String::value_type))); + (void) unhex (input, std::back_inserter (output)); + return output; + } + +}} + +#endif // BOOST_ALGORITHM_HEXHPP diff --git a/project/jni/boost/include/boost/algorithm/minmax_element.hpp b/project/jni/boost/include/boost/algorithm/minmax_element.hpp index 0d2efd8cd..752f6cbdb 100644 --- a/project/jni/boost/include/boost/algorithm/minmax_element.hpp +++ b/project/jni/boost/include/boost/algorithm/minmax_element.hpp @@ -99,8 +99,10 @@ namespace boost { // if odd number of elements, treat last element if (first != last) { // odd number of elements - if (comp(first, min_result)) - min_result = first, potential_min_result = last; + if (comp(first, min_result)) { + min_result = first; + potential_min_result = last; + } else if (comp(max_result, first)) max_result = first; } diff --git a/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp b/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp new file mode 100644 index 000000000..c5fe9fa25 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/boyer_moore.hpp @@ -0,0 +1,268 @@ +/* + Copyright (c) Marshall Clow 2010-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP +#define BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP + +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +namespace boost { namespace algorithm { + +/* + A templated version of the boyer-moore searching algorithm. + +References: + http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/ + http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf + +Explanations: + http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm + http://www.movsd.com/bm.htm + http://www.cs.ucdavis.edu/~gusfield/cs224f09/bnotes.pdf + +The Boyer-Moore search algorithm uses two tables, a "bad character" table +to tell how far to skip ahead when it hits a character that is not in the pattern, +and a "good character" table to tell how far to skip ahead when it hits a +mismatch on a character that _is_ in the pattern. + +Requirements: + * Random access iterators + * The two iterator types (patIter and corpusIter) must + "point to" the same underlying type and be comparable. + * Additional requirements may be imposed but the skip table, such as: + ** Numeric type (array-based skip table) + ** Hashable type (map-based skip table) +*/ + + template > + class boyer_moore { + typedef typename std::iterator_traits::difference_type difference_type; + public: + boyer_moore ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length, -1 ), + suffix_ ( k_pattern_length + 1 ) + { + this->build_skip_table ( first, last ); + this->build_suffix_table ( first, last ); + } + + ~boyer_moore () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + // Do the search + return this->do_search ( corpus_first, corpus_last ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + typename traits::skip_table_t skip_; + std::vector suffix_; + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + /* ---- Do the matching ---- */ + corpusIter curPos = corpus_first; + const corpusIter lastPos = corpus_last - k_pattern_length; + difference_type j, k, m; + + while ( curPos <= lastPos ) { + /* while ( std::distance ( curPos, corpus_last ) >= k_pattern_length ) { */ + // Do we match right where we are? + j = k_pattern_length; + while ( pat_first [j-1] == curPos [j-1] ) { + j--; + // We matched - we're done! + if ( j == 0 ) + return curPos; + } + + // Since we didn't match, figure out how far to skip forward + k = skip_ [ curPos [ j - 1 ]]; + m = j - k - 1; + if ( k < j && m > suffix_ [ j ] ) + curPos += m; + else + curPos += suffix_ [ j ]; + } + + return corpus_last; // We didn't find anything + } + + + void build_skip_table ( patIter first, patIter last ) { + for ( std::size_t i = 0; first != last; ++first, ++i ) + skip_.insert ( *first, i ); + } + + + template + void compute_bm_prefix ( Iter pat_first, Iter pat_last, Container &prefix ) { + const std::size_t count = std::distance ( pat_first, pat_last ); + BOOST_ASSERT ( count > 0 ); + BOOST_ASSERT ( prefix.size () == count ); + + prefix[0] = 0; + std::size_t k = 0; + for ( std::size_t i = 1; i < count; ++i ) { + BOOST_ASSERT ( k < count ); + while ( k > 0 && ( pat_first[k] != pat_first[i] )) { + BOOST_ASSERT ( k < count ); + k = prefix [ k - 1 ]; + } + + if ( pat_first[k] == pat_first[i] ) + k++; + prefix [ i ] = k; + } + } + + void build_suffix_table ( patIter pat_first, patIter pat_last ) { + const std::size_t count = (std::size_t) std::distance ( pat_first, pat_last ); + + if ( count > 0 ) { // empty pattern + std::vector::value_type> reversed(count); + (void) std::reverse_copy ( pat_first, pat_last, reversed.begin ()); + + std::vector prefix (count); + compute_bm_prefix ( pat_first, pat_last, prefix ); + + std::vector prefix_reversed (count); + compute_bm_prefix ( reversed.begin (), reversed.end (), prefix_reversed ); + + for ( std::size_t i = 0; i <= count; i++ ) + suffix_[i] = count - prefix [count-1]; + + for ( std::size_t i = 0; i < count; i++ ) { + const std::size_t j = count - prefix_reversed[i]; + const difference_type k = i - prefix_reversed[i] + 1; + + if (suffix_[j] > k) + suffix_[j] = k; + } + } + } +/// \endcond + }; + + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn boyer_moore_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter boyer_moore_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + boyer_moore bm ( pat_first, pat_last ); + return bm ( corpus_first, corpus_last ); + } + + template + corpusIter boyer_moore_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore bm ( boost::begin(pattern), boost::end (pattern)); + return bm ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + boyer_moore_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + boyer_moore bm ( pat_first, pat_last ); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + boyer_moore_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore bm ( boost::begin(pattern), boost::end (pattern)); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::boyer_moore::type> + make_boyer_moore ( const Range &r ) { + return boost::algorithm::boyer_moore + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::boyer_moore::type> + make_boyer_moore ( Range &r ) { + return boost::algorithm::boyer_moore + ::type> (boost::begin(r), boost::end(r)); + } + +}} + +#endif // BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp b/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp new file mode 100644 index 000000000..758ded206 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/boyer_moore_horspool.hpp @@ -0,0 +1,199 @@ +/* + Copyright (c) Marshall Clow 2010-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP +#define BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP + +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +// #define BOOST_ALGORITHM_BOYER_MOORE_HORSPOOL_DEBUG_HPP + +namespace boost { namespace algorithm { + +/* + A templated version of the boyer-moore-horspool searching algorithm. + + Requirements: + * Random access iterators + * The two iterator types (patIter and corpusIter) must + "point to" the same underlying type. + * Additional requirements may be imposed buy the skip table, such as: + ** Numeric type (array-based skip table) + ** Hashable type (map-based skip table) + +http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html + +*/ + + template > + class boyer_moore_horspool { + typedef typename std::iterator_traits::difference_type difference_type; + public: + boyer_moore_horspool ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length, k_pattern_length ) { + + // Build the skip table + std::size_t i = 0; + if ( first != last ) // empty pattern? + for ( patIter iter = first; iter != last-1; ++iter, ++i ) + skip_.insert ( *iter, k_pattern_length - 1 - i ); +#ifdef BOOST_ALGORITHM_BOYER_MOORE_HORSPOOL_DEBUG_HPP + skip_.PrintSkipTable (); +#endif + } + + ~boyer_moore_horspool () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + // Do the search + return this->do_search ( corpus_first, corpus_last ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + typename traits::skip_table_t skip_; + + /// \fn do_search ( corpusIter corpus_first, corpusIter corpus_last ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param k_corpus_length The length of the corpus to search + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + corpusIter curPos = corpus_first; + const corpusIter lastPos = corpus_last - k_pattern_length; + while ( curPos <= lastPos ) { + // Do we match right where we are? + std::size_t j = k_pattern_length - 1; + while ( pat_first [j] == curPos [j] ) { + // We matched - we're done! + if ( j == 0 ) + return curPos; + j--; + } + + curPos += skip_ [ curPos [ k_pattern_length - 1 ]]; + } + + return corpus_last; + } +// \endcond + }; + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn boyer_moore_horspool_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter boyer_moore_horspool_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + boyer_moore_horspool bmh ( pat_first, pat_last ); + return bmh ( corpus_first, corpus_last ); + } + + template + corpusIter boyer_moore_horspool_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore_horspool bmh ( boost::begin(pattern), boost::end (pattern)); + return bmh ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + boyer_moore_horspool_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + boyer_moore_horspool bmh ( pat_first, pat_last ); + return bm (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + boyer_moore_horspool_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + boyer_moore_horspool bmh ( boost::begin(pattern), boost::end (pattern)); + return bmh (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::boyer_moore_horspool::type> + make_boyer_moore_horspool ( const Range &r ) { + return boost::algorithm::boyer_moore_horspool + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::boyer_moore_horspool::type> + make_boyer_moore_horspool ( Range &r ) { + return boost::algorithm::boyer_moore_horspool + ::type> (boost::begin(r), boost::end(r)); + } + +}} + +#endif // BOOST_ALGORITHM_BOYER_MOORE_HORSPOOOL_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp b/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp new file mode 100644 index 000000000..ea150c302 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/detail/bm_traits.hpp @@ -0,0 +1,105 @@ +/* + Copyright (c) Marshall Clow 2010-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP +#define BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP + +#include // for CHAR_BIT +#include +#include // for std::iterator_traits + +#include +#include +#include +#include + +#include +#include + +#include + +namespace boost { namespace algorithm { namespace detail { + +// +// Default implementations of the skip tables for B-M and B-M-H +// + template class skip_table; + +// General case for data searching other than bytes; use a map + template + class skip_table { + private: + typedef std::tr1::unordered_map skip_map; + const value_type k_default_value; + skip_map skip_; + + public: + skip_table ( std::size_t patSize, value_type default_value ) + : k_default_value ( default_value ), skip_ ( patSize ) {} + + void insert ( key_type key, value_type val ) { + skip_ [ key ] = val; // Would skip_.insert (val) be better here? + } + + value_type operator [] ( key_type key ) const { + typename skip_map::const_iterator it = skip_.find ( key ); + return it == skip_.end () ? k_default_value : it->second; + } + + void PrintSkipTable () const { + std::cout << "BM(H) Skip Table :" << std::endl; + for ( typename skip_map::const_iterator it = skip_.begin (); it != skip_.end (); ++it ) + if ( it->second != k_default_value ) + std::cout << " " << it->first << ": " << it->second << std::endl; + std::cout << std::endl; + } + }; + + +// Special case small numeric values; use an array + template + class skip_table { + private: + typedef typename boost::make_unsigned::type unsigned_key_type; + typedef boost::array skip_map; + skip_map skip_; + const value_type k_default_value; + public: + skip_table ( std::size_t patSize, value_type default_value ) : k_default_value ( default_value ) { + std::fill_n ( skip_.begin(), skip_.size(), default_value ); + } + + void insert ( key_type key, value_type val ) { + skip_ [ static_cast ( key ) ] = val; + } + + value_type operator [] ( key_type key ) const { + return skip_ [ static_cast ( key ) ]; + } + + void PrintSkipTable () const { + std::cout << "BM(H) Skip Table :" << std::endl; + for ( typename skip_map::const_iterator it = skip_.begin (); it != skip_.end (); ++it ) + if ( *it != k_default_value ) + std::cout << " " << std::distance (skip_.begin (), it) << ": " << *it << std::endl; + std::cout << std::endl; + } + }; + + template + struct BM_traits { + typedef typename std::iterator_traits::difference_type value_type; + typedef typename std::iterator_traits::value_type key_type; + typedef boost::algorithm::detail::skip_table::value && (sizeof(key_type)==1)> skip_table_t; + }; + +}}} // namespaces + +#endif // BOOST_ALGORITHM_SEARCH_DETAIL_BM_TRAITS_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp b/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp new file mode 100644 index 000000000..3996e0f50 --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/detail/debugging.hpp @@ -0,0 +1,30 @@ +/* + Copyright (c) Marshall Clow 2010-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP +#define BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP + +#include +/// \cond DOXYGEN_HIDE + +namespace boost { namespace algorithm { namespace detail { + +// Debugging support + template + void PrintTable ( Iter first, Iter last ) { + std::cout << std::distance ( first, last ) << ": { "; + for ( Iter iter = first; iter != last; ++iter ) + std::cout << *iter << " "; + std::cout << "}" << std::endl; + } + +}}} +/// \endcond + +#endif // BOOST_ALGORITHM_SEARCH_DETAIL_DEBUG_HPP diff --git a/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp b/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp new file mode 100644 index 000000000..aaeeb51cc --- /dev/null +++ b/project/jni/boost/include/boost/algorithm/searching/knuth_morris_pratt.hpp @@ -0,0 +1,258 @@ +/* + Copyright (c) Marshall Clow 2010-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + +#ifndef BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP +#define BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP + +#include +#include // for std::iterator_traits + +#include +#include + +#include +#include + +#include +#include + +#include + +// #define BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_DEBUG + +namespace boost { namespace algorithm { + +// #define NEW_KMP + +/* + A templated version of the Knuth-Morris-Pratt searching algorithm. + + Requirements: + * Random-access iterators + * The two iterator types (I1 and I2) must "point to" the same underlying type. + + http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm + http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm +*/ + + template + class knuth_morris_pratt { + typedef typename std::iterator_traits::difference_type difference_type; + public: + knuth_morris_pratt ( patIter first, patIter last ) + : pat_first ( first ), pat_last ( last ), + k_pattern_length ( std::distance ( pat_first, pat_last )), + skip_ ( k_pattern_length + 1 ) { +#ifdef NEW_KMP + preKmp ( pat_first, pat_last ); +#else + init_skip_table ( pat_first, pat_last ); +#endif +#ifdef BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_DEBUG + detail::PrintTable ( skip_.begin (), skip_.end ()); +#endif + } + + ~knuth_morris_pratt () {} + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + BOOST_STATIC_ASSERT (( boost::is_same< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type>::value )); + if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); + // If the pattern is larger than the corpus, we can't find it! + if ( k_corpus_length < k_pattern_length ) + return corpus_last; + + return do_search ( corpus_first, corpus_last, k_corpus_length ); + } + + template + typename boost::range_iterator::type operator () ( Range &r ) const { + return (*this) (boost::begin(r), boost::end(r)); + } + + private: +/// \cond DOXYGEN_HIDE + patIter pat_first, pat_last; + const difference_type k_pattern_length; + std::vector skip_; + + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \brief Searches the corpus for the pattern that was passed into the constructor + /// + /// \param corpus_first The start of the data to search (Random Access Iterator) + /// \param corpus_last One past the end of the data to search + /// \param p A predicate used for the search comparisons. + /// + template + corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last, + difference_type k_corpus_length ) const { + difference_type match_start = 0; // position in the corpus that we're matching + +#ifdef NEW_KMP + int patternIdx = 0; + while ( match_start < k_corpus_length ) { + while ( patternIdx > -1 && pat_first[patternIdx] != corpus_first [match_start] ) + patternIdx = skip_ [patternIdx]; //<--- Shifting the pattern on mismatch + + patternIdx++; + match_start++; //<--- corpus is always increased by 1 + + if ( patternIdx >= (int) k_pattern_length ) + return corpus_first + match_start - patternIdx; + } + +#else +// At this point, we know: +// k_pattern_length <= k_corpus_length +// for all elements of skip, it holds -1 .. k_pattern_length +// +// In the loop, we have the following invariants +// idx is in the range 0 .. k_pattern_length +// match_start is in the range 0 .. k_corpus_length - k_pattern_length + 1 + + const difference_type last_match = k_corpus_length - k_pattern_length; + difference_type idx = 0; // position in the pattern we're comparing + + while ( match_start <= last_match ) { + while ( pat_first [ idx ] == corpus_first [ match_start + idx ] ) { + if ( ++idx == k_pattern_length ) + return corpus_first + match_start; + } + // Figure out where to start searching again + // assert ( idx - skip_ [ idx ] > 0 ); // we're always moving forward + match_start += idx - skip_ [ idx ]; + idx = skip_ [ idx ] >= 0 ? skip_ [ idx ] : 0; + // assert ( idx >= 0 && idx < k_pattern_length ); + } +#endif + + // We didn't find anything + return corpus_last; + } + + + void preKmp ( patIter first, patIter last ) { + const /*std::size_t*/ int count = std::distance ( first, last ); + + int i, j; + + i = 0; + j = skip_[0] = -1; + while (i < count) { + while (j > -1 && first[i] != first[j]) + j = skip_[j]; + i++; + j++; + if (first[i] == first[j]) + skip_[i] = skip_[j]; + else + skip_[i] = j; + } + } + + + void init_skip_table ( patIter first, patIter last ) { + const difference_type count = std::distance ( first, last ); + + int j; + skip_ [ 0 ] = -1; + for ( int i = 1; i <= count; ++i ) { + j = skip_ [ i - 1 ]; + while ( j >= 0 ) { + if ( first [ j ] == first [ i - 1 ] ) + break; + j = skip_ [ j ]; + } + skip_ [ i ] = j + 1; + } + } +// \endcond + }; + + +/* Two ranges as inputs gives us four possibilities; with 2,3,3,4 parameters + Use a bit of TMP to disambiguate the 3-argument templates */ + +/// \fn knuth_morris_pratt_search ( corpusIter corpus_first, corpusIter corpus_last, +/// patIter pat_first, patIter pat_last ) +/// \brief Searches the corpus for the pattern. +/// +/// \param corpus_first The start of the data to search (Random Access Iterator) +/// \param corpus_last One past the end of the data to search +/// \param pat_first The start of the pattern to search for (Random Access Iterator) +/// \param pat_last One past the end of the data to search for +/// + template + corpusIter knuth_morris_pratt_search ( + corpusIter corpus_first, corpusIter corpus_last, + patIter pat_first, patIter pat_last ) + { + knuth_morris_pratt kmp ( pat_first, pat_last ); + return kmp ( corpus_first, corpus_last ); + } + + template + corpusIter knuth_morris_pratt_search ( + corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + knuth_morris_pratt kmp ( boost::begin(pattern), boost::end (pattern)); + return kmp ( corpus_first, corpus_last ); + } + + template + typename boost::lazy_disable_if_c< + boost::is_same::value, typename boost::range_iterator > + ::type + knuth_morris_pratt_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) + { + knuth_morris_pratt kmp ( pat_first, pat_last ); + return kmp (boost::begin (corpus), boost::end (corpus)); + } + + template + typename boost::range_iterator::type + knuth_morris_pratt_search ( CorpusRange &corpus, const PatternRange &pattern ) + { + typedef typename boost::range_iterator::type pattern_iterator; + knuth_morris_pratt kmp ( boost::begin(pattern), boost::end (pattern)); + return kmp (boost::begin (corpus), boost::end (corpus)); + } + + + // Creator functions -- take a pattern range, return an object + template + boost::algorithm::knuth_morris_pratt::type> + make_knuth_morris_pratt ( const Range &r ) { + return boost::algorithm::knuth_morris_pratt + ::type> (boost::begin(r), boost::end(r)); + } + + template + boost::algorithm::knuth_morris_pratt::type> + make_knuth_morris_pratt ( Range &r ) { + return boost::algorithm::knuth_morris_pratt + ::type> (boost::begin(r), boost::end(r)); + } +}} + +#endif // BOOST_ALGORITHM_KNUTH_MORRIS_PRATT_SEARCH_HPP diff --git a/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp b/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp index 8b9ad4276..1612b9378 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/find_format.hpp @@ -56,7 +56,7 @@ namespace boost { // Copy the beginning of the sequence Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output ); // Format find result - // Copy formated result + // Copy formatted result Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output ); // Copy the rest of the sequence Output = std::copy( M.end(), ::boost::end(Input), Output ); @@ -118,11 +118,11 @@ namespace boost { InputT Output; // Copy the beginning of the sequence - insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() ); - // Copy formated result - insert( Output, ::boost::end(Output), M.format_result() ); + boost::algorithm::detail::insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() ); + // Copy formatted result + boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() ); // Copy the rest of the sequence - insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) ); + boost::algorithm::detail::insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) ); return Output; } diff --git a/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp b/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp index 978710c95..51ad56678 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/find_format_all.hpp @@ -58,7 +58,7 @@ namespace boost { { // Copy the beginning of the sequence Output = std::copy( LastMatch, M.begin(), Output ); - // Copy formated result + // Copy formatted result Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output ); // Proceed to the next match @@ -134,9 +134,9 @@ namespace boost { while( M ) { // Copy the beginning of the sequence - insert( Output, ::boost::end(Output), LastMatch, M.begin() ); - // Copy formated result - insert( Output, ::boost::end(Output), M.format_result() ); + boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, M.begin() ); + // Copy formatted result + boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() ); // Proceed to the next match LastMatch=M.end(); @@ -218,7 +218,7 @@ namespace boost { // Adjust search iterator SearchIt=M.end(); - // Copy formated replace to the storage + // Copy formatted replace to the storage ::boost::algorithm::detail::copy_to_storage( Storage, M.format_result() ); // Find range for a next match diff --git a/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp b/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp index 45bcb7d3d..93310d053 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/finder.hpp @@ -92,7 +92,7 @@ namespace boost { // find last functor -----------------------------------------------// - // find the last match a subseqeunce in the sequence ( functor ) + // find the last match a subsequence in the sequence ( functor ) /* Returns a pair marking the subsequence in the sequence. If the find fails, returns diff --git a/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp b/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp index 673d93a53..01bf5a082 100644 --- a/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp +++ b/project/jni/boost/include/boost/algorithm/string/detail/finder_regex.hpp @@ -60,14 +60,14 @@ namespace boost { return *this; } - // Match result retrival + // Match result retrieval const match_results_type& match_results() const { return m_MatchResults; } private: - // Saved matchresult + // Saved match result match_results_type m_MatchResults; }; diff --git a/project/jni/boost/include/boost/algorithm/string/find.hpp b/project/jni/boost/include/boost/algorithm/string/find.hpp index 304646d09..da1cb616b 100644 --- a/project/jni/boost/include/boost/algorithm/string/find.hpp +++ b/project/jni/boost/include/boost/algorithm/string/find.hpp @@ -86,7 +86,7 @@ namespace boost { //! Find first algorithm ( case insensitive ) /*! - Search for the first occurence of the substring in the input. + Search for the first occurrence of the substring in the input. Searching is case insensitive. \param Input A string which will be searched. @@ -228,13 +228,13 @@ namespace boost { //! Find head algorithm /*! Get the head of the input. Head is a prefix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the head. \param Input An input string \param N Length of the head For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -258,13 +258,13 @@ namespace boost { //! Find tail algorithm /*! Get the tail of the input. Tail is a suffix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the tail. \param Input An input string \param N Length of the tail. For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c RangeT::iterator or @@ -293,7 +293,7 @@ namespace boost { If the "token compress mode" is enabled, adjacent tokens are considered to be one match. \param Input A input string. - \param Pred An unary predicate to identify a token + \param Pred A unary predicate to identify a token \param eCompress Enable/Disable compressing of adjacent tokens \return An \c iterator_range delimiting the match. diff --git a/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp b/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp index b72ba7c78..07a909e16 100644 --- a/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp +++ b/project/jni/boost/include/boost/algorithm/string/find_iterator.hpp @@ -132,7 +132,10 @@ namespace boost { // increment void increment() { - m_Match=this->do_find(m_Match.end(),m_End); + if(m_Match.begin() == m_Match.end()) + m_Match=this->do_find(m_Match.end(),m_End); + else + m_Match=this->do_find(m_Match.begin()+1,m_End); } // comparison diff --git a/project/jni/boost/include/boost/algorithm/string/formatter.hpp b/project/jni/boost/include/boost/algorithm/string/formatter.hpp index ab5921e73..c2c13eb2e 100644 --- a/project/jni/boost/include/boost/algorithm/string/formatter.hpp +++ b/project/jni/boost/include/boost/algorithm/string/formatter.hpp @@ -39,7 +39,7 @@ namespace boost { Constructs a \c const_formatter. Const formatter always returns the same value, regardless of the parameter. - \param Format A predefined value used as a result for formating + \param Format A predefined value used as a result for formatting \return An instance of the \c const_formatter object. */ template @@ -95,7 +95,7 @@ namespace boost { to extract a portion of the formatted sequence. The first finder's match is returned as a result - \param Finder a finder used to select a portion of the formated sequence + \param Finder a finder used to select a portion of the formatted sequence \return An instance of the \c dissect_formatter object. */ template diff --git a/project/jni/boost/include/boost/algorithm/string/iter_find.hpp b/project/jni/boost/include/boost/algorithm/string/iter_find.hpp index 9e0245f1a..e10652834 100644 --- a/project/jni/boost/include/boost/algorithm/string/iter_find.hpp +++ b/project/jni/boost/include/boost/algorithm/string/iter_find.hpp @@ -60,7 +60,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A Finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ @@ -122,7 +122,7 @@ namespace boost { Each match is used as a separator of segments. These segments are then returned in the result. - \param Result A 'container container' to container the result of search. + \param Result A 'container container' to contain the result of search. Both outer and inner container must have constructor taking a pair of iterators as an argument. Typical type of the result is @@ -131,7 +131,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ diff --git a/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp b/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp index c8319f7ee..a9753fc2a 100644 --- a/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp +++ b/project/jni/boost/include/boost/algorithm/string/predicate_facade.hpp @@ -15,7 +15,7 @@ /* \file boost/algorith/string/predicate_facade.hpp - This file containes predicate_facade definition. This template class is used + This file contains predicate_facade definition. This template class is used to identify classification predicates, so they can be combined using composition operators. */ diff --git a/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp b/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp index f698004a3..409afc2ba 100644 --- a/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp +++ b/project/jni/boost/include/boost/algorithm/string/regex_find_format.hpp @@ -32,7 +32,7 @@ namespace boost { Construct the \c regex_finder. Finder uses the regex engine to search for a match. Result is given in \c regex_search_result. This is an extension - of the iterator_range. In addition it containes match results + of the iterator_range. In addition it contains match results from the \c regex_search algorithm. \param Rx A regular expression diff --git a/project/jni/boost/include/boost/algorithm/string/trim.hpp b/project/jni/boost/include/boost/algorithm/string/trim.hpp index eb408a35e..be57cd92f 100644 --- a/project/jni/boost/include/boost/algorithm/string/trim.hpp +++ b/project/jni/boost/include/boost/algorithm/string/trim.hpp @@ -50,7 +50,7 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -118,7 +118,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_left_if(SequenceT& Input, PredicateT IsSpace) @@ -158,7 +158,7 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -228,7 +228,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_right_if(SequenceT& Input, PredicateT IsSpace) @@ -270,7 +270,7 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input range - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input @@ -352,7 +352,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_if(SequenceT& Input, PredicateT IsSpace) diff --git a/project/jni/boost/include/boost/algorithm/string/trim_all.hpp b/project/jni/boost/include/boost/algorithm/string/trim_all.hpp index 70fd0412e..a616f7f33 100644 --- a/project/jni/boost/include/boost/algorithm/string/trim_all.hpp +++ b/project/jni/boost/include/boost/algorithm/string/trim_all.hpp @@ -49,7 +49,7 @@ namespace boost { The result is a trimmed copy of the input \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return A trimmed copy of the input */ template @@ -70,7 +70,7 @@ namespace boost { The input sequence is modified in-place. \param Input An input sequence - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_all_if(SequenceT& Input, PredicateT IsSpace) @@ -126,7 +126,7 @@ namespace boost { \param Input An input sequence \param Fill A string used to fill the inner spaces - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces \return A trimmed copy of the input */ template @@ -149,7 +149,7 @@ namespace boost { \param Input An input sequence \param Fill A string used to fill the inner spaces - \param IsSpace An unary predicate identifying spaces + \param IsSpace A unary predicate identifying spaces */ template inline void trim_fill_if(SequenceT& Input, const RangeT& Fill, PredicateT IsSpace) diff --git a/project/jni/boost/include/boost/algorithm/string_regex.hpp b/project/jni/boost/include/boost/algorithm/string_regex.hpp index 6fd8ad9fa..791aa1848 100644 --- a/project/jni/boost/include/boost/algorithm/string_regex.hpp +++ b/project/jni/boost/include/boost/algorithm/string_regex.hpp @@ -13,7 +13,7 @@ /*! \file Cumulative include for string_algo library. - In addtion to string.hpp contains also regex-related stuff. + In addition to string.hpp contains also regex-related stuff. */ #include diff --git a/project/jni/boost/include/boost/archive/archive_exception.hpp b/project/jni/boost/include/boost/archive/archive_exception.hpp index b5f33f685..e27807bc2 100644 --- a/project/jni/boost/include/boost/archive/archive_exception.hpp +++ b/project/jni/boost/include/boost/archive/archive_exception.hpp @@ -43,6 +43,8 @@ namespace archive { class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : public virtual std::exception { +protected: + char m_buffer[128]; public: typedef enum { no_exception, // initialized without code @@ -74,8 +76,6 @@ public: // type has been instantiated in more than one module. output_stream_error // error on input stream } exception_code; -protected: - std::string m_msg; public: exception_code code; archive_exception( @@ -83,9 +83,11 @@ public: const char * e1 = NULL, const char * e2 = NULL ); - ~archive_exception() throw (); - virtual const char *what( ) const throw(); + virtual ~archive_exception() throw(); + virtual const char *what() const throw(); protected: + unsigned int + append(unsigned int l, const char * a); archive_exception(); }; diff --git a/project/jni/boost/include/boost/archive/basic_archive.hpp b/project/jni/boost/include/boost/archive/basic_archive.hpp index d40848520..c5ac8808e 100644 --- a/project/jni/boost/include/boost/archive/basic_archive.hpp +++ b/project/jni/boost/include/boost/archive/basic_archive.hpp @@ -150,7 +150,8 @@ private: base_type t; public: object_id_type(): t(0) {}; - explicit object_id_type(const unsigned int & t_) : t(t_){ + // note: presumes that size_t >= unsigned int. + explicit object_id_type(const std::size_t & t_) : t(t_){ BOOST_ASSERT(t_ <= boost::integer_traits::const_max); } object_id_type(const object_id_type & t_) : diff --git a/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp b/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp index 19defcb5b..a991ea1dc 100644 --- a/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp +++ b/project/jni/boost/include/boost/archive/detail/basic_serializer_map.hpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include // must be the last header diff --git a/project/jni/boost/include/boost/archive/detail/iserializer.hpp b/project/jni/boost/include/boost/archive/detail/iserializer.hpp index 46033fddf..53765af31 100644 --- a/project/jni/boost/include/boost/archive/detail/iserializer.hpp +++ b/project/jni/boost/include/boost/archive/detail/iserializer.hpp @@ -61,7 +61,7 @@ namespace std{ #define DONT_USE_HAS_NEW_OPERATOR ( \ defined(__BORLANDC__) \ - || defined(__IBMCPP__) \ + || BOOST_WORKAROUND(__IBMCPP__, < 1210) \ || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \ || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ ) diff --git a/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp b/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp index ad6a6d58d..16378b843 100644 --- a/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp +++ b/project/jni/boost/include/boost/archive/impl/basic_text_iprimitive.ipp @@ -86,23 +86,21 @@ basic_text_iprimitive::load_binary( ,CharType > binary; - - binary ti_begin = binary( + + binary i = binary( BOOST_MAKE_PFTO_WRAPPER( iterators::istream_iterator(is) ) ); - + char * caddr = static_cast(address); // take care that we don't increment anymore than necessary - while(--count > 0){ - *caddr++ = static_cast(*ti_begin); - ++ti_begin; + while(count-- > 0){ + *caddr++ = static_cast(*i++); } - *caddr++ = static_cast(*ti_begin); - - iterators::istream_iterator i; + + // skip over any excess input for(;;){ BOOST_DEDUCED_TYPENAME IStream::int_type r; r = is.get(); @@ -112,7 +110,7 @@ basic_text_iprimitive::load_binary( break; } } - + template BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_iprimitive::basic_text_iprimitive( diff --git a/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp b/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp index cacab617c..7e4315c0d 100644 --- a/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp +++ b/project/jni/boost/include/boost/archive/impl/basic_text_oprimitive.ipp @@ -51,7 +51,7 @@ basic_text_oprimitive::save_binary( 8 > > - ,72 + ,76 ,const char // cwpro8 needs this > base64_text; diff --git a/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp b/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp index 60f23f397..2fe8292f1 100644 --- a/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp +++ b/project/jni/boost/include/boost/archive/iterators/binary_from_base64.hpp @@ -43,7 +43,7 @@ struct to_6_bit { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, - 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1, 0,-1,-1, // render '=' as 0 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, diff --git a/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp b/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp index 7d39a35da..2fdd475e1 100644 --- a/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp +++ b/project/jni/boost/include/boost/archive/iterators/head_iterator.hpp @@ -42,8 +42,8 @@ private: > super_t; typedef head_iterator this_t; - typedef BOOST_DEDUCED_TYPENAME super_t::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + typedef super_t::value_type value_type; + typedef super_t::reference reference_type; reference_type dereference_impl(){ if(! m_end){ diff --git a/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp b/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp index 1df612dc8..478f112ff 100644 --- a/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp +++ b/project/jni/boost/include/boost/archive/iterators/istream_iterator.hpp @@ -49,16 +49,17 @@ class istream_iterator : > super_t; typedef BOOST_DEDUCED_TYPENAME std::basic_istream istream_type; - //Access the value referred to - Elem dereference() const { - return m_current_value; - } - bool equal(const this_t & rhs) const { // note: only works for comparison against end of stream return m_istream == rhs.m_istream; } +/* + //Access the value referred to + Elem dereference() const { + return m_current_value; + } + void increment(){ if(NULL != m_istream){ m_current_value = static_cast(m_istream->get()); @@ -67,6 +68,17 @@ class istream_iterator : } } } +*/ + //Access the value referred to + Elem dereference() const { + return m_istream->peek(); + } + + void increment(){ + if(NULL != m_istream){ + m_istream->ignore(1); + } + } istream_type *m_istream; Elem m_current_value; @@ -74,7 +86,7 @@ public: istream_iterator(istream_type & is) : m_istream(& is) { - increment(); + //increment(); } istream_iterator() : diff --git a/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp b/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp index a8e109298..a01049faf 100644 --- a/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp +++ b/project/jni/boost/include/boost/archive/iterators/remove_whitespace.hpp @@ -24,6 +24,7 @@ #include #include +#include //#include //#if ! BOOST_WORKAROUND(BOOST_MSVC, <=1300) @@ -140,13 +141,19 @@ public: template class remove_whitespace : public filter_iterator< - remove_whitespace_predicate, + remove_whitespace_predicate< + BOOST_DEDUCED_TYPENAME boost::iterator_value::type + //BOOST_DEDUCED_TYPENAME Base::value_type + >, Base > { friend class boost::iterator_core_access; typedef filter_iterator< - remove_whitespace_predicate, + remove_whitespace_predicate< + BOOST_DEDUCED_TYPENAME boost::iterator_value::type + //BOOST_DEDUCED_TYPENAME Base::value_type + >, Base > super_t; public: diff --git a/project/jni/boost/include/boost/archive/iterators/transform_width.hpp b/project/jni/boost/include/boost/archive/iterators/transform_width.hpp index 6e2c52663..5a5c7b757 100644 --- a/project/jni/boost/include/boost/archive/iterators/transform_width.hpp +++ b/project/jni/boost/include/boost/archive/iterators/transform_width.hpp @@ -24,8 +24,6 @@ // character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters // or 3 8 bit characters -#include - #include // for BOOST_DEDUCED_TYPENAME & PTFO #include @@ -66,101 +64,105 @@ class transform_width : typedef transform_width this_t; typedef BOOST_DEDUCED_TYPENAME iterator_value::type base_value_type; - CharType fill(); - - CharType dereference_impl(){ - if(! m_full){ - m_current_value = fill(); - m_full = true; - } - return m_current_value; - } + void fill(); CharType dereference() const { - return const_cast(this)->dereference_impl(); + if(!m_buffer_out_full) + const_cast(this)->fill(); + return m_buffer_out; } - // test for iterator equality + bool equal_impl(const this_t & rhs){ + if(BitsIn < BitsOut) // discard any left over bits + return this->base_reference() == rhs.base_reference(); + else{ + // BitsIn > BitsOut // zero fill + if(this->base_reference() == rhs.base_reference()){ + m_end_of_sequence = true; + return 0 == m_remaining_bits; + } + return false; + } + } + + // standard iterator interface bool equal(const this_t & rhs) const { - return - this->base_reference() == rhs.base_reference(); - ; + return const_cast(this)->equal_impl(rhs); } void increment(){ - m_displacement += BitsOut; - - while(m_displacement >= BitsIn){ - m_displacement -= BitsIn; - if(0 == m_displacement) - m_bufferfull = false; - if(! m_bufferfull){ - // note: suspect that this is not invoked for borland - ++(this->base_reference()); - } - } - m_full = false; + m_buffer_out_full = false; } - CharType m_current_value; - // number of bits left in current input character buffer - unsigned int m_displacement; - base_value_type m_buffer; - // flag to current output character is ready - just used to save time - bool m_full; - // flag to indicate that m_buffer has data - bool m_bufferfull; + bool m_buffer_out_full; + CharType m_buffer_out; + + // last read element from input + base_value_type m_buffer_in; + + // number of bits to left in the input buffer. + unsigned int m_remaining_bits; + + // flag to indicate we've reached end of data. + bool m_end_of_sequence; public: // make composible buy using templated constructor template transform_width(BOOST_PFTO_WRAPPER(T) start) : super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), - m_displacement(0), - m_full(false), - m_bufferfull(false) + m_buffer_out_full(false), + m_remaining_bits(0), + m_end_of_sequence(false) {} // intel 7.1 doesn't like default copy constructor transform_width(const transform_width & rhs) : super_t(rhs.base_reference()), - m_current_value(rhs.m_current_value), - m_displacement(rhs.m_displacement), - m_buffer(rhs.m_buffer), - m_full(rhs.m_full), - m_bufferfull(rhs.m_bufferfull) + m_buffer_out_full(rhs.m_buffer_out_full), + m_remaining_bits(rhs.m_remaining_bits), + m_buffer_in(rhs.m_buffer_in), + m_end_of_sequence(false) {} }; -template -CharType transform_width::fill(){ - CharType retval = 0; +template< + class Base, + int BitsOut, + int BitsIn, + class CharType +> +void transform_width::fill() { unsigned int missing_bits = BitsOut; - for(;;){ - unsigned int bcount; - if(! m_bufferfull){ - m_buffer = * this->base_reference(); - m_bufferfull = true; - bcount = BitsIn; + m_buffer_out = 0; + do{ + if(0 == m_remaining_bits){ + if(m_end_of_sequence){ + m_buffer_in = 0; + m_remaining_bits = missing_bits; + } + else{ + m_buffer_in = * this->base_reference()++; + m_remaining_bits = BitsIn; + } } - else - bcount = BitsIn - m_displacement; - unsigned int i = (std::min)(bcount, missing_bits); + + // append these bits to the next output + // up to the size of the output + unsigned int i = std::min(missing_bits, m_remaining_bits); // shift interesting bits to least significant position - unsigned int j = m_buffer >> (bcount - i); - // strip off uninteresting bits - // (note presumption of two's complement arithmetic) - j &= ~(-(1 << i)); + base_value_type j = m_buffer_in >> (m_remaining_bits - i); + // and mask off the un interesting higher bits + // note presumption of twos complement notation + j &= (1 << i) - 1; // append then interesting bits to the output value - retval <<= i; - retval |= j; + m_buffer_out <<= i; + m_buffer_out |= j; + + // and update counters missing_bits -= i; - if(0 == missing_bits) - break; - // note: suspect that this is not invoked for borland 5.51 - ++(this->base_reference()); - m_bufferfull = false; - } - return retval; + m_remaining_bits -= i; + }while(0 < missing_bits); + m_buffer_out_full = true; } } // namespace iterators diff --git a/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp b/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp index 0e5f4f26b..39e6eb82c 100644 --- a/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp +++ b/project/jni/boost/include/boost/archive/shared_ptr_helper.hpp @@ -127,7 +127,7 @@ public: template struct non_polymorphic { static const boost::serialization::extended_type_info * - get_object_identifier(T & t){ + get_object_identifier(T &){ return & boost::serialization::singleton< BOOST_DEDUCED_TYPENAME boost::serialization::type_info_implementation< T >::type diff --git a/project/jni/boost/include/boost/array.hpp b/project/jni/boost/include/boost/array.hpp index ffb504bdb..fa06fa9a5 100644 --- a/project/jni/boost/include/boost/array.hpp +++ b/project/jni/boost/include/boost/array.hpp @@ -13,6 +13,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * + * 14 Apr 2012 - (mtc) Added support for boost::hash * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. * See or Trac issue #3168 @@ -46,6 +47,7 @@ // Handles broken standard libraries better than #include #include +#include #include // FIXES for broken compilers @@ -118,13 +120,13 @@ namespace boost { // operator[] reference operator[](size_type i) { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } const_reference operator[](size_type i) const { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } @@ -427,6 +429,13 @@ namespace boost { } #endif + + template + std::size_t hash_value(const array& arr) + { + return boost::hash_range(arr.begin(), arr.end()); + } + } /* namespace boost */ diff --git a/project/jni/boost/include/boost/asio/basic_socket.hpp b/project/jni/boost/include/boost/asio/basic_socket.hpp index c9e2045bf..d4c3476b0 100644 --- a/project/jni/boost/include/boost/asio/basic_socket.hpp +++ b/project/jni/boost/include/boost/asio/basic_socket.hpp @@ -843,7 +843,7 @@ public: * ... * boost::asio::ip::tcp::socket::keep_alive option; * socket.get_option(option); - * bool is_set = option.get(); + * bool is_set = option.value(); * @endcode */ template @@ -891,7 +891,7 @@ public: * { * // An error occurred. * } - * bool is_set = option.get(); + * bool is_set = option.value(); * @endcode */ template diff --git a/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp b/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp index 93d1fcd17..6fae0854b 100644 --- a/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp +++ b/project/jni/boost/include/boost/asio/basic_socket_iostream.hpp @@ -53,7 +53,7 @@ basic_socket_streambuf >::member) \ { \ - tie(this); \ + this->setf(std::ios_base::unitbuf); \ if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ @@ -112,7 +112,7 @@ public: basic_socket_streambuf >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); } #if defined(GENERATING_DOCUMENTATION) @@ -131,7 +131,7 @@ public: basic_socket_streambuf >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } diff --git a/project/jni/boost/include/boost/asio/buffered_write_stream.hpp b/project/jni/boost/include/boost/asio/buffered_write_stream.hpp index 9159c237f..11cb87255 100644 --- a/project/jni/boost/include/boost/asio/buffered_write_stream.hpp +++ b/project/jni/boost/include/boost/asio/buffered_write_stream.hpp @@ -232,7 +232,7 @@ public: ? bytes_avail : space_avail; storage_.resize(orig_size + length); std::size_t bytes_copied = boost::asio::buffer_copy( - storage_.data(), buffers_, length); + storage_.data() + orig_size, buffers_, length); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } diff --git a/project/jni/boost/include/boost/asio/buffers_iterator.hpp b/project/jni/boost/include/boost/asio/buffers_iterator.hpp index 66b8cf604..c11e1469d 100644 --- a/project/jni/boost/include/boost/asio/buffers_iterator.hpp +++ b/project/jni/boost/include/boost/asio/buffers_iterator.hpp @@ -128,7 +128,7 @@ public: /// Construct an iterator representing the beginning of the buffers' data. static buffers_iterator begin(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -148,7 +148,7 @@ public: /// Construct an iterator representing the end of the buffers' data. static buffers_iterator end(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; diff --git a/project/jni/boost/include/boost/asio/detail/atomic_count.hpp b/project/jni/boost/include/boost/asio/detail/atomic_count.hpp index 9324fffa6..5e0051a22 100644 --- a/project/jni/boost/include/boost/asio/detail/atomic_count.hpp +++ b/project/jni/boost/include/boost/asio/detail/atomic_count.hpp @@ -31,10 +31,13 @@ namespace detail { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) typedef long atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } #elif defined(BOOST_ASIO_HAS_STD_ATOMIC) typedef std::atomic atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } #else // defined(BOOST_ASIO_HAS_STD_ATOMIC) typedef boost::detail::atomic_count atomic_count; +inline void increment(atomic_count& a, long b) { while (b > 0) ++a, --b; } #endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) } // namespace detail diff --git a/project/jni/boost/include/boost/asio/detail/call_stack.hpp b/project/jni/boost/include/boost/asio/detail/call_stack.hpp index db4cd1ed6..ac5322923 100644 --- a/project/jni/boost/include/boost/asio/detail/call_stack.hpp +++ b/project/jni/boost/include/boost/asio/detail/call_stack.hpp @@ -102,6 +102,13 @@ public: return 0; } + // Obtain the value at the top of the stack. + static Value* top() + { + context* elem = top_; + return elem ? elem->value_ : 0; + } + private: // The top of the stack of calls for the current thread. static tss_ptr top_; diff --git a/project/jni/boost/include/boost/asio/detail/config.hpp b/project/jni/boost/include/boost/asio/detail/config.hpp index 3f2314db9..40f770caf 100644 --- a/project/jni/boost/include/boost/asio/detail/config.hpp +++ b/project/jni/boost/include/boost/asio/detail/config.hpp @@ -112,6 +112,22 @@ # endif // defined(__GNUC__) #endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) +// Compliant C++11 compilers put noexcept specifiers on error_category members. +#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# if (BOOST_VERSION >= 105300) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT +# endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +#endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) + // Standard library support for arrays. #if !defined(BOOST_ASIO_DISABLE_STD_ARRAY) # if defined(__GNUC__) @@ -163,7 +179,9 @@ # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) # if defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_ASIO_HAS_STD_CHRONO -# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) # endif // defined(__GXX_EXPERIMENTAL_CXX0X__) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) # endif // defined(__GNUC__) @@ -355,4 +373,28 @@ # endif // !defined(UNDER_CE) #endif // !defined(BOOST_ASIO_DISABLE_SIGNAL) +// Support for the __thread keyword extension. +#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +# if defined(__linux__) +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# if !defined(__INTEL_COMPILER) && !defined(__ICL) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# endif // defined(__linux__) +#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) + +// Support for POSIX ssize_t typedef. +#if !defined(BOOST_ASIO_DISABLE_SSIZE_T) +# if defined(__linux__) \ + || (defined(__MACH__) && defined(__APPLE__)) +# define BOOST_ASIO_HAS_SSIZE_T 1 +# endif // defined(__linux__) + // || (defined(__MACH__) && defined(__APPLE__)) +#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T) + #endif // BOOST_ASIO_DETAIL_CONFIG_HPP diff --git a/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp b/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp index 72ea6e2f2..425cfc4f3 100644 --- a/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp +++ b/project/jni/boost/include/boost/asio/detail/descriptor_ops.hpp @@ -88,9 +88,9 @@ BOOST_ASIO_DECL bool non_blocking_write(int d, BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd, ioctl_arg_type* arg, boost::system::error_code& ec); -BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec); +BOOST_ASIO_DECL int fcntl(int d, int cmd, boost::system::error_code& ec); -BOOST_ASIO_DECL int fcntl(int d, long cmd, +BOOST_ASIO_DECL int fcntl(int d, int cmd, long arg, boost::system::error_code& ec); BOOST_ASIO_DECL int poll_read(int d, diff --git a/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp b/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp index 2d26644ca..8f66f74b1 100644 --- a/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp +++ b/project/jni/boost/include/boost/asio/detail/epoll_reactor.hpp @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_EPOLL) +#include #include #include #include @@ -59,6 +60,7 @@ public: mutex mutex_; epoll_reactor* reactor_; int descriptor_; + boost::uint32_t registered_events_; op_queue op_queue_[max_ops]; bool shutdown_; diff --git a/project/jni/boost/include/boost/asio/detail/fenced_block.hpp b/project/jni/boost/include/boost/asio/detail/fenced_block.hpp index 36e288481..d9e8a04e8 100644 --- a/project/jni/boost/include/boost/asio/detail/fenced_block.hpp +++ b/project/jni/boost/include/boost/asio/detail/fenced_block.hpp @@ -25,7 +25,8 @@ # include #elif defined(__sun) # include -#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) # include #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) # include @@ -34,8 +35,7 @@ #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ - && !defined(ANDROID) && !defined(__ANDROID__) + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) # include #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) # include @@ -55,7 +55,8 @@ typedef null_fenced_block fenced_block; typedef macos_fenced_block fenced_block; #elif defined(__sun) typedef solaris_fenced_block fenced_block; -#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) typedef gcc_arm_fenced_block fenced_block; #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) typedef gcc_hppa_fenced_block fenced_block; @@ -64,8 +65,7 @@ typedef gcc_x86_fenced_block fenced_block; #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ - && !defined(ANDROID) && !defined(__ANDROID__) + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) typedef gcc_sync_fenced_block fenced_block; #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) typedef win_fenced_block fenced_block; diff --git a/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp b/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp index b416b50d5..973165ab1 100644 --- a/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/project/jni/boost/include/boost/asio/detail/gcc_x86_fenced_block.hpp @@ -40,17 +40,17 @@ public: // Constructor for a full fenced block. explicit gcc_x86_fenced_block(full_t) { - barrier1(); + lbarrier(); } // Destructor. ~gcc_x86_fenced_block() { - barrier2(); + sbarrier(); } private: - static int barrier1() + static int barrier() { int r = 0, m = 1; __asm__ __volatile__ ( @@ -61,12 +61,21 @@ private: return r; } - static void barrier2() + static void lbarrier() { #if defined(__SSE2__) - __asm__ __volatile__ ("mfence" ::: "memory"); + __asm__ __volatile__ ("lfence" ::: "memory"); #else // defined(__SSE2__) - barrier1(); + barrier(); +#endif // defined(__SSE2__) + } + + static void sbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("sfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); #endif // defined(__SSE2__) } }; diff --git a/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp b/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp index 6c3528f30..9d41cde38 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/descriptor_ops.ipp @@ -183,7 +183,8 @@ std::size_t sync_read(int d, state_type state, buf* bufs, { // Try to complete the operation without blocking. errno = 0; - int bytes = error_wrapper(::readv(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::readv( + d, bufs, static_cast(count)), ec); // Check if operation succeeded. if (bytes > 0) @@ -215,7 +216,8 @@ bool non_blocking_read(int d, buf* bufs, std::size_t count, { // Read some data. errno = 0; - int bytes = error_wrapper(::readv(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::readv( + d, bufs, static_cast(count)), ec); // Check for end of stream. if (bytes == 0) @@ -267,7 +269,8 @@ std::size_t sync_write(int d, state_type state, const buf* bufs, { // Try to complete the operation without blocking. errno = 0; - int bytes = error_wrapper(::writev(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::writev( + d, bufs, static_cast(count)), ec); // Check if operation succeeded. if (bytes > 0) @@ -292,7 +295,8 @@ bool non_blocking_write(int d, const buf* bufs, std::size_t count, { // Write some data. errno = 0; - int bytes = error_wrapper(::writev(d, bufs, static_cast(count)), ec); + signed_size_type bytes = error_wrapper(::writev( + d, bufs, static_cast(count)), ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -357,7 +361,7 @@ int ioctl(int d, state_type& state, long cmd, return result; } -int fcntl(int d, long cmd, boost::system::error_code& ec) +int fcntl(int d, int cmd, boost::system::error_code& ec) { if (d == -1) { @@ -372,7 +376,7 @@ int fcntl(int d, long cmd, boost::system::error_code& ec) return result; } -int fcntl(int d, long cmd, long arg, boost::system::error_code& ec) +int fcntl(int d, int cmd, long arg, boost::system::error_code& ec) { if (d == -1) { diff --git a/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp b/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp index 771edea67..073bd0882 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/epoll_reactor.ipp @@ -127,7 +127,7 @@ void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) for (descriptor_state* state = registered_descriptors_.first(); state != 0; state = state->next_) { - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = state->registered_events_; ev.data.ptr = state; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); if (result != 0) @@ -159,7 +159,8 @@ int epoll_reactor::register_descriptor(socket_type descriptor, } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -184,7 +185,8 @@ int epoll_reactor::register_internal_descriptor( } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -222,23 +224,47 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, if (descriptor_data->op_queue_[op_type].empty()) { - if (allow_speculative) + if (allow_speculative + && (op_type != read_op + || descriptor_data->op_queue_[except_op].empty())) { - if (op_type != read_op || descriptor_data->op_queue_[except_op].empty()) + if (op->perform()) { - if (op->perform()) + descriptor_lock.unlock(); + io_service_.post_immediate_completion(op); + return; + } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) { - descriptor_lock.unlock(); - io_service_.post_immediate_completion(op); - return; + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op); + return; + } } } } else { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP - | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = descriptor_data->registered_events_; ev.data.ptr = descriptor_data; epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); } @@ -440,7 +466,7 @@ int epoll_reactor::do_epoll_create() errno = EINVAL; #endif // defined(EPOLL_CLOEXEC) - if (fd == -1 && errno == EINVAL) + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) { fd = epoll_create(epoll_size); if (fd != -1) diff --git a/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp b/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp index a819eb9b7..30dd0aa7a 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/kqueue_reactor.ipp @@ -367,7 +367,7 @@ void kqueue_reactor::run(bool block, op_queue& ops) // Dispatch the waiting events. for (int i = 0; i < num_events; ++i) { - int descriptor = events[i].ident; + int descriptor = static_cast(events[i].ident); void* ptr = reinterpret_cast(events[i].udata); if (ptr == &interrupter_) { @@ -397,7 +397,8 @@ void kqueue_reactor::run(bool block, op_queue& ops) { if (events[i].flags & EV_ERROR) { - op->ec_ = boost::system::error_code(events[i].data, + op->ec_ = boost::system::error_code( + static_cast(events[i].data), boost::asio::error::get_system_category()); descriptor_data->op_queue_[j].pop(); ops.push(op); diff --git a/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp b/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp index 75a8d16a4..7b02236e0 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/pipe_select_interrupter.ipp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -90,7 +91,7 @@ void pipe_select_interrupter::recreate() void pipe_select_interrupter::interrupt() { char byte = 0; - int result = ::write(write_descriptor_, &byte, 1); + signed_size_type result = ::write(write_descriptor_, &byte, 1); (void)result; } @@ -99,7 +100,7 @@ bool pipe_select_interrupter::reset() for (;;) { char data[1024]; - int bytes_read = ::read(read_descriptor_, data, sizeof(data)); + signed_size_type bytes_read = ::read(read_descriptor_, data, sizeof(data)); if (bytes_read < 0 && errno == EINTR) continue; bool was_interrupted = (bytes_read > 0); diff --git a/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp b/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp index 08eae05c8..6500b85a7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/posix_event.ipp @@ -21,6 +21,7 @@ #include #include +#include #include diff --git a/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp index 0b57007a9..b317b862b 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/signal_set_service.ipp @@ -64,7 +64,7 @@ void asio_signal_handler(int signal_number) #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) int saved_errno = errno; signal_state* state = get_signal_state(); - int result = ::write(state->write_descriptor_, + signed_size_type result = ::write(state->write_descriptor_, &signal_number, sizeof(signal_number)); (void)result; errno = saved_errno; diff --git a/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp b/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp index 24d2d66ad..cda0bf0b6 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/socket_ops.ipp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -669,8 +670,8 @@ inline void init_msghdr_msg_name(T& name, const socket_addr_type* addr) name = reinterpret_cast(const_cast(addr)); } -int recv(socket_type s, buf* bufs, size_t count, int flags, - boost::system::error_code& ec) +signed_size_type recv(socket_type s, buf* bufs, size_t count, + int flags, boost::system::error_code& ec) { clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) @@ -691,8 +692,8 @@ int recv(socket_type s, buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -719,7 +720,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recv(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec); // Check if operation succeeded. if (bytes > 0) @@ -781,7 +782,7 @@ bool non_blocking_recv(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recv(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::recv(s, bufs, count, flags, ec); // Check for end of stream. if (is_stream && bytes == 0) @@ -814,8 +815,8 @@ bool non_blocking_recv(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int recvfrom(socket_type s, buf* bufs, size_t count, int flags, - socket_addr_type* addr, std::size_t* addrlen, +signed_size_type recvfrom(socket_type s, buf* bufs, size_t count, + int flags, socket_addr_type* addr, std::size_t* addrlen, boost::system::error_code& ec) { clear_last_error(); @@ -839,10 +840,10 @@ int recvfrom(socket_type s, buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); init_msghdr_msg_name(msg.msg_name, addr); - msg.msg_namelen = *addrlen; + msg.msg_namelen = static_cast(*addrlen); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec); *addrlen = msg.msg_namelen; if (result >= 0) ec = boost::system::error_code(); @@ -864,7 +865,8 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recvfrom(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::recvfrom( + s, bufs, count, flags, addr, addrlen, ec); // Check if operation succeeded. if (bytes >= 0) @@ -912,7 +914,8 @@ bool non_blocking_recvfrom(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recvfrom(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::recvfrom( + s, bufs, count, flags, addr, addrlen, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -938,7 +941,7 @@ bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int recvmsg(socket_type s, buf* bufs, size_t count, +signed_size_type recvmsg(socket_type s, buf* bufs, size_t count, int in_flags, int& out_flags, boost::system::error_code& ec) { clear_last_error(); @@ -948,8 +951,8 @@ int recvmsg(socket_type s, buf* bufs, size_t count, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = bufs; - msg.msg_iovlen = count; - int result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); + msg.msg_iovlen = static_cast(count); + signed_size_type result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); if (result >= 0) { ec = boost::system::error_code(); @@ -975,7 +978,8 @@ size_t sync_recvmsg(socket_type s, state_type state, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + signed_size_type bytes = socket_ops::recvmsg( + s, bufs, count, in_flags, out_flags, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1022,7 +1026,8 @@ bool non_blocking_recvmsg(socket_type s, for (;;) { // Read some data. - int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + signed_size_type bytes = socket_ops::recvmsg( + s, bufs, count, in_flags, out_flags, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1048,8 +1053,8 @@ bool non_blocking_recvmsg(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int send(socket_type s, const buf* bufs, size_t count, int flags, - boost::system::error_code& ec) +signed_size_type send(socket_type s, const buf* bufs, size_t count, + int flags, boost::system::error_code& ec) { clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) @@ -1070,11 +1075,11 @@ int send(socket_type s, const buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); msg.msg_iov = const_cast(bufs); - msg.msg_iovlen = count; + msg.msg_iovlen = static_cast(count); #if defined(__linux__) flags |= MSG_NOSIGNAL; #endif // defined(__linux__) - int result = error_wrapper(::sendmsg(s, &msg, flags), ec); + signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -1101,7 +1106,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::send(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::send(s, bufs, count, flags, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1148,7 +1153,7 @@ bool non_blocking_send(socket_type s, for (;;) { // Write some data. - int bytes = socket_ops::send(s, bufs, count, flags, ec); + signed_size_type bytes = socket_ops::send(s, bufs, count, flags, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1174,8 +1179,8 @@ bool non_blocking_send(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -int sendto(socket_type s, const buf* bufs, size_t count, int flags, - const socket_addr_type* addr, std::size_t addrlen, +signed_size_type sendto(socket_type s, const buf* bufs, size_t count, + int flags, const socket_addr_type* addr, std::size_t addrlen, boost::system::error_code& ec) { clear_last_error(); @@ -1197,13 +1202,13 @@ int sendto(socket_type s, const buf* bufs, size_t count, int flags, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) msghdr msg = msghdr(); init_msghdr_msg_name(msg.msg_name, addr); - msg.msg_namelen = addrlen; + msg.msg_namelen = static_cast(addrlen); msg.msg_iov = const_cast(bufs); - msg.msg_iovlen = count; + msg.msg_iovlen = static_cast(count); #if defined(__linux__) flags |= MSG_NOSIGNAL; #endif // defined(__linux__) - int result = error_wrapper(::sendmsg(s, &msg, flags), ec); + signed_size_type result = error_wrapper(::sendmsg(s, &msg, flags), ec); if (result >= 0) ec = boost::system::error_code(); return result; @@ -1224,7 +1229,8 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs, for (;;) { // Try to complete the operation without blocking. - int bytes = socket_ops::sendto(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::sendto( + s, bufs, count, flags, addr, addrlen, ec); // Check if operation succeeded. if (bytes >= 0) @@ -1252,7 +1258,8 @@ bool non_blocking_sendto(socket_type s, for (;;) { // Write some data. - int bytes = socket_ops::sendto(s, bufs, count, flags, addr, addrlen, ec); + signed_size_type bytes = socket_ops::sendto( + s, bufs, count, flags, addr, addrlen, ec); // Retry operation if interrupted by signal. if (ec == boost::asio::error::interrupted) @@ -1867,7 +1874,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, return result == socket_error_retval ? 0 : dest; #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - const char* result = error_wrapper(::inet_ntop(af, src, dest, length), ec); + const char* result = error_wrapper(::inet_ntop( + af, src, dest, static_cast(length)), ec); if (result == 0 && !ec) ec = boost::asio::error::invalid_argument; if (result != 0 && af == AF_INET6 && scope_id != 0) @@ -1877,7 +1885,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, const in6_addr_type* ipv6_address = static_cast(src); bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); - if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) + if (!is_link_local + || if_indextoname(static_cast(scope_id), if_name + 1) == 0) sprintf(if_name + 1, "%lu", scope_id); strcat(dest, if_name); } diff --git a/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp index 1d98d9905..7581852ff 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/strand_service.hpp @@ -50,11 +50,6 @@ struct strand_service::on_dispatch_exit } }; -inline void strand_service::destroy(strand_service::implementation_type& impl) -{ - impl = 0; -} - template void strand_service::dispatch(strand_service::implementation_type& impl, Handler handler) diff --git a/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp index 64e4cc00c..1912d80f7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/strand_service.ipp @@ -38,7 +38,7 @@ struct strand_service::on_do_complete_exit impl_->mutex_.unlock(); if (more_handlers) - owner_->post_immediate_completion(impl_); + owner_->post_private_immediate_completion(impl_); } }; diff --git a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp index 7cd7449e6..2cc7b7eea 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.hpp @@ -45,7 +45,7 @@ void task_io_service::dispatch(Handler handler) BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); - post_immediate_completion(p.p); + post_non_private_immediate_completion(p.p); p.v = p.p = 0; } } diff --git a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp index 3d679c2dc..cb7311634 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/task_io_service.ipp @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -34,44 +35,55 @@ struct task_io_service::task_cleanup { ~task_cleanup() { + if (this_thread_->private_outstanding_work > 0) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work); + } + this_thread_->private_outstanding_work = 0; + // Enqueue the completed operations and reinsert the task at the end of // the operation queue. lock_->lock(); task_io_service_->task_interrupted_ = true; - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); task_io_service_->op_queue_.push(&task_io_service_->task_operation_); } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue* ops_; + thread_info* this_thread_; }; struct task_io_service::work_cleanup { ~work_cleanup() { - task_io_service_->work_finished(); + if (this_thread_->private_outstanding_work > 1) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work - 1); + } + else if (this_thread_->private_outstanding_work < 1) + { + task_io_service_->work_finished(); + } + this_thread_->private_outstanding_work = 0; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - if (!ops_->empty()) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (!this_thread_->private_op_queue.empty()) { lock_->lock(); - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue* ops_; -}; - -struct task_io_service::thread_info -{ - event* wakeup_event; - op_queue* private_op_queue; - thread_info* next; + thread_info* this_thread_; }; task_io_service::task_io_service( @@ -131,19 +143,14 @@ std::size_t task_io_service::run(boost::system::error_code& ec) thread_info this_thread; event wakeup_event; this_thread.wakeup_event = &wakeup_event; - op_queue private_op_queue; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = one_thread_ == 1 ? &private_op_queue : 0; -#else // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = 0; -#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); std::size_t n = 0; - for (; do_run_one(lock, this_thread, private_op_queue, ec); lock.lock()) + for (; do_run_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits::max)()) ++n; return n; @@ -161,14 +168,13 @@ std::size_t task_io_service::run_one(boost::system::error_code& ec) thread_info this_thread; event wakeup_event; this_thread.wakeup_event = &wakeup_event; - op_queue private_op_queue; - this_thread.private_op_queue = 0; + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_run_one(lock, this_thread, private_op_queue, ec); + return do_run_one(lock, this_thread, ec); } std::size_t task_io_service::poll(boost::system::error_code& ec) @@ -182,29 +188,23 @@ std::size_t task_io_service::poll(boost::system::error_code& ec) thread_info this_thread; this_thread.wakeup_event = 0; - op_queue private_op_queue; -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = one_thread_ == 1 ? &private_op_queue : 0; -#else // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - this_thread.private_op_queue = 0; -#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) // We want to support nested calls to poll() and poll_one(), so any handlers // that are already on a thread-private queue need to be put on to the main // queue now. if (one_thread_) if (thread_info* outer_thread_info = ctx.next_by_key()) - if (outer_thread_info->private_op_queue) - op_queue_.push(*outer_thread_info->private_op_queue); + op_queue_.push(outer_thread_info->private_op_queue); #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) std::size_t n = 0; - for (; do_poll_one(lock, private_op_queue, ec); lock.lock()) + for (; do_poll_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits::max)()) ++n; return n; @@ -221,24 +221,22 @@ std::size_t task_io_service::poll_one(boost::system::error_code& ec) thread_info this_thread; this_thread.wakeup_event = 0; - op_queue private_op_queue; - this_thread.private_op_queue = 0; + this_thread.private_outstanding_work = 0; this_thread.next = 0; thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) // We want to support nested calls to poll() and poll_one(), so any handlers // that are already on a thread-private queue need to be put on to the main // queue now. if (one_thread_) if (thread_info* outer_thread_info = ctx.next_by_key()) - if (outer_thread_info->private_op_queue) - op_queue_.push(*outer_thread_info->private_op_queue); + op_queue_.push(outer_thread_info->private_op_queue); #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) - return do_poll_one(lock, private_op_queue, ec); + return do_poll_one(lock, this_thread, ec); } void task_io_service::stop() @@ -261,22 +259,33 @@ void task_io_service::reset() void task_io_service::post_immediate_completion(task_io_service::operation* op) { - work_started(); - post_deferred_completion(op); -} - -void task_io_service::post_deferred_completion(task_io_service::operation* op) -{ -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) if (one_thread_) { if (thread_info* this_thread = thread_call_stack::contains(this)) { - if (this_thread->private_op_queue) - { - this_thread->private_op_queue->push(op); - return; - } + ++this_thread->private_outstanding_work; + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + work_started(); + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_deferred_completion(task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; } } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) @@ -291,16 +300,13 @@ void task_io_service::post_deferred_completions( { if (!ops.empty()) { -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) if (one_thread_) { if (thread_info* this_thread = thread_call_stack::contains(this)) { - if (this_thread->private_op_queue) - { - this_thread->private_op_queue->push(ops); - return; - } + this_thread->private_op_queue.push(ops); + return; } } #endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) @@ -311,6 +317,44 @@ void task_io_service::post_deferred_completions( } } +void task_io_service::post_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_private_deferred_completion(op); +} + +void task_io_service::post_private_deferred_completion( + task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_non_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_non_private_deferred_completion(op); +} + +void task_io_service::post_non_private_deferred_completion( + task_io_service::operation* op) +{ + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + void task_io_service::abandon_operations( op_queue& ops) { @@ -320,7 +364,7 @@ void task_io_service::abandon_operations( std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, task_io_service::thread_info& this_thread, - op_queue& private_op_queue, const boost::system::error_code& ec) + const boost::system::error_code& ec) { while (!stopped_) { @@ -343,14 +387,13 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, else lock.unlock(); - op_queue completed_ops; - task_cleanup on_exit = { this, &lock, &completed_ops }; + task_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(!more_handlers, completed_ops); + task_->run(!more_handlers, this_thread.private_op_queue); } else { @@ -362,7 +405,7 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_cleanup on_exit = { this, &lock, &private_op_queue }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Complete the operation. May throw an exception. Deletes the object. @@ -385,7 +428,8 @@ std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, } std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, - op_queue& private_op_queue, const boost::system::error_code& ec) + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) { if (stopped_) return 0; @@ -397,14 +441,13 @@ std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, lock.unlock(); { - op_queue completed_ops; - task_cleanup c = { this, &lock, &completed_ops }; + task_cleanup c = { this, &lock, &this_thread }; (void)c; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(false, completed_ops); + task_->run(false, this_thread.private_op_queue); } o = op_queue_.front(); @@ -426,7 +469,7 @@ std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_cleanup on_exit = { this, &lock, &private_op_queue }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; // Complete the operation. May throw an exception. Deletes the object. diff --git a/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp b/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp deleted file mode 100644 index c4d9ea34a..000000000 --- a/project/jni/boost/include/boost/asio/detail/impl/timer_queue.ipp +++ /dev/null @@ -1,87 +0,0 @@ -// -// detail/impl/timer_queue.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP -#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include - -#if !defined(BOOST_ASIO_HEADER_ONLY) - -#include - -#include - -namespace boost { -namespace asio { -namespace detail { - -timer_queue >::timer_queue() -{ -} - -timer_queue >::~timer_queue() -{ -} - -bool timer_queue >::enqueue_timer( - const time_type& time, per_timer_data& timer, timer_op* op) -{ - return impl_.enqueue_timer(time, timer, op); -} - -bool timer_queue >::empty() const -{ - return impl_.empty(); -} - -long timer_queue >::wait_duration_msec( - long max_duration) const -{ - return impl_.wait_duration_msec(max_duration); -} - -long timer_queue >::wait_duration_usec( - long max_duration) const -{ - return impl_.wait_duration_usec(max_duration); -} - -void timer_queue >::get_ready_timers( - op_queue& ops) -{ - impl_.get_ready_timers(ops); -} - -void timer_queue >::get_all_timers( - op_queue& ops) -{ - impl_.get_all_timers(ops); -} - -std::size_t timer_queue >::cancel_timer( - per_timer_data& timer, op_queue& ops, std::size_t max_cancelled) -{ - return impl_.cancel_timer(timer, ops, max_cancelled); -} - -} // namespace detail -} // namespace asio -} // namespace boost - -#include - -#endif // !defined(BOOST_ASIO_HEADER_ONLY) - -#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp index 871f6fa2e..5a522356a 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.hpp @@ -33,7 +33,7 @@ namespace detail { template void win_iocp_io_service::dispatch(Handler handler) { - if (call_stack::contains(this)) + if (thread_call_stack::contains(this)) { fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp index 72f4af752..72adb40e1 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -68,6 +68,7 @@ win_iocp_io_service::win_iocp_io_service( iocp_(), outstanding_work_(0), stopped_(0), + stop_event_posted_(0), shutdown_(0), dispatch_required_(0) { @@ -148,12 +149,13 @@ size_t win_iocp_io_service::run(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); size_t n = 0; while (do_one(true, ec)) @@ -166,12 +168,13 @@ size_t win_iocp_io_service::run_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); return do_one(true, ec); } @@ -180,12 +183,13 @@ size_t win_iocp_io_service::poll(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); size_t n = 0; while (do_one(false, ec)) @@ -198,12 +202,13 @@ size_t win_iocp_io_service::poll_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - InterlockedExchange(&stopped_, 1); + stop(); ec = boost::system::error_code(); return 0; } - call_stack::context ctx(this); + win_iocp_thread_info this_thread; + thread_call_stack::context ctx(this, this_thread); return do_one(false, ec); } @@ -212,12 +217,15 @@ void win_iocp_io_service::stop() { if (::InterlockedExchange(&stopped_, 1) == 0) { - if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + if (::InterlockedExchange(&stop_event_posted_, 1) == 0) { - DWORD last_error = ::GetLastError(); - boost::system::error_code ec(last_error, - boost::asio::error::get_system_category()); - boost::asio::detail::throw_error(ec, "pqcs"); + if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "pqcs"); + } } } } @@ -421,17 +429,23 @@ size_t win_iocp_io_service::do_one(bool block, boost::system::error_code& ec) } else { + // Indicate that there is no longer an in-flight stop event. + ::InterlockedExchange(&stop_event_posted_, 0); + // The stopped_ flag is always checked to ensure that any leftover - // interrupts from a previous run invocation are ignored. + // stop events from a previous run invocation are ignored. if (::InterlockedExchangeAdd(&stopped_, 0) != 0) { // Wake up next thread that is blocked on GetQueuedCompletionStatus. - if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + if (::InterlockedExchange(&stop_event_posted_, 1) == 0) { - last_error = ::GetLastError(); - ec = boost::system::error_code(last_error, - boost::asio::error::get_system_category()); - return 0; + if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0)) + { + last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + return 0; + } } ec = boost::system::error_code(); diff --git a/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp b/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp index 3ec104da2..dcd61a0d7 100644 --- a/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp +++ b/project/jni/boost/include/boost/asio/detail/impl/win_static_mutex.ipp @@ -43,11 +43,11 @@ int win_static_mutex::do_init() using namespace std; // For sprintf. wchar_t mutex_name[128]; #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - swprintf_s(mutex_name, 128, + swprintf_s( #else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - swprintf(mutex_name, + _snwprintf( #endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) - L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", + mutex_name, 128, L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", static_cast(::GetCurrentProcessId()), this); HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); diff --git a/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp b/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp new file mode 100644 index 000000000..10dd01a1f --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/keyword_tss_ptr.hpp @@ -0,0 +1,72 @@ +// +// detail/keyword_tss_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP +#define BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +template +class keyword_tss_ptr + : private noncopyable +{ +public: + // Constructor. + keyword_tss_ptr() + { + } + + // Destructor. + ~keyword_tss_ptr() + { + } + + // Get the value. + operator T*() const + { + return value_; + } + + // Set the value. + void operator=(T* value) + { + value_ = value; + } + +private: + static __thread T* value_; +}; + +template +__thread T* keyword_tss_ptr::value_; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#endif // BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP diff --git a/project/jni/boost/include/boost/asio/detail/socket_ops.hpp b/project/jni/boost/include/boost/asio/detail/socket_ops.hpp index b353316fe..92af9fbe2 100644 --- a/project/jni/boost/include/boost/asio/detail/socket_ops.hpp +++ b/project/jni/boost/include/boost/asio/detail/socket_ops.hpp @@ -129,8 +129,8 @@ BOOST_ASIO_DECL void init_buf(buf& b, void* data, size_t size); BOOST_ASIO_DECL void init_buf(buf& b, const void* data, size_t size); -BOOST_ASIO_DECL int recv(socket_type s, buf* bufs, size_t count, int flags, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recv(socket_type s, buf* bufs, + size_t count, int flags, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recv(socket_type s, state_type state, buf* bufs, size_t count, int flags, bool all_empty, boost::system::error_code& ec); @@ -149,9 +149,9 @@ BOOST_ASIO_DECL bool non_blocking_recv(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int recvfrom(socket_type s, buf* bufs, size_t count, int flags, - socket_addr_type* addr, std::size_t* addrlen, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recvfrom(socket_type s, buf* bufs, + size_t count, int flags, socket_addr_type* addr, + std::size_t* addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, size_t count, int flags, socket_addr_type* addr, @@ -172,8 +172,9 @@ BOOST_ASIO_DECL bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int recvmsg(socket_type s, buf* bufs, size_t count, - int in_flags, int& out_flags, boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type recvmsg(socket_type s, buf* bufs, + size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_recvmsg(socket_type s, state_type state, buf* bufs, size_t count, int in_flags, int& out_flags, @@ -193,7 +194,7 @@ BOOST_ASIO_DECL bool non_blocking_recvmsg(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int send(socket_type s, const buf* bufs, +BOOST_ASIO_DECL signed_size_type send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_send(socket_type s, state_type state, @@ -214,9 +215,9 @@ BOOST_ASIO_DECL bool non_blocking_send(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) -BOOST_ASIO_DECL int sendto(socket_type s, const buf* bufs, size_t count, - int flags, const socket_addr_type* addr, std::size_t addrlen, - boost::system::error_code& ec); +BOOST_ASIO_DECL signed_size_type sendto(socket_type s, const buf* bufs, + size_t count, int flags, const socket_addr_type* addr, + std::size_t addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL size_t sync_sendto(socket_type s, state_type state, const buf* bufs, size_t count, int flags, const socket_addr_type* addr, diff --git a/project/jni/boost/include/boost/asio/detail/socket_types.hpp b/project/jni/boost/include/boost/asio/detail/socket_types.hpp index af758f512..7285daa7b 100644 --- a/project/jni/boost/include/boost/asio/detail/socket_types.hpp +++ b/project/jni/boost/include/boost/asio/detail/socket_types.hpp @@ -107,6 +107,7 @@ typedef addrinfo addrinfo_type; typedef unsigned long ioctl_arg_type; typedef u_long u_long_type; typedef u_short u_short_type; +typedef int signed_size_type; const int shutdown_receive = SD_RECEIVE; const int shutdown_send = SD_SEND; const int shutdown_both = SD_BOTH; @@ -156,6 +157,11 @@ typedef addrinfo addrinfo_type; typedef int ioctl_arg_type; typedef uint32_t u_long_type; typedef uint16_t u_short_type; +#if defined(BOOST_ASIO_HAS_SSIZE_T) +typedef ssize_t signed_size_type; +#else // defined(BOOST_ASIO_HAS_SSIZE_T) +typedef int signed_size_type; +#endif // defined(BOOST_ASIO_HAS_SSIZE_T) const int shutdown_receive = SHUT_RD; const int shutdown_send = SHUT_WR; const int shutdown_both = SHUT_RDWR; diff --git a/project/jni/boost/include/boost/asio/detail/strand_service.hpp b/project/jni/boost/include/boost/asio/detail/strand_service.hpp index 420634658..3a271b50d 100644 --- a/project/jni/boost/include/boost/asio/detail/strand_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/strand_service.hpp @@ -84,9 +84,6 @@ public: // Construct a new strand implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); - // Destroy a strand implementation. - void destroy(implementation_type& impl); - // Request the io_service to invoke the given handler. template void dispatch(implementation_type& impl, Handler handler); diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service.hpp index 7a0bcc570..72abc9428 100644 --- a/project/jni/boost/include/boost/asio/detail/task_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/task_io_service.hpp @@ -112,23 +112,41 @@ public: // that work_started() was previously called for each operation. BOOST_ASIO_DECL void post_deferred_completions(op_queue& ops); + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // has not yet been called for the operation. + BOOST_ASIO_DECL void post_private_immediate_completion(operation* op); + + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // was previously called for the operation. + BOOST_ASIO_DECL void post_private_deferred_completion(operation* op); + // Process unfinished operations as part of a shutdown_service operation. // Assumes that work_started() was previously called for the operations. BOOST_ASIO_DECL void abandon_operations(op_queue& ops); private: // Structure containing information about an idle thread. - struct thread_info; + typedef task_io_service_thread_info thread_info; - // Run at most one operation. Blocks only if this_idle_thread is non-null. + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() has not yet + // been called for the operation. + BOOST_ASIO_DECL void post_non_private_immediate_completion(operation* op); + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() was previously + // called for the operation. + BOOST_ASIO_DECL void post_non_private_deferred_completion(operation* op); + + // Run at most one operation. May block. BOOST_ASIO_DECL std::size_t do_run_one(mutex::scoped_lock& lock, - thread_info& this_thread, op_queue& private_op_queue, - const boost::system::error_code& ec); + thread_info& this_thread, const boost::system::error_code& ec); // Poll for at most one operation. BOOST_ASIO_DECL std::size_t do_poll_one(mutex::scoped_lock& lock, - op_queue& private_op_queue, - const boost::system::error_code& ec); + thread_info& this_thread, const boost::system::error_code& ec); // Stop the task and all idle threads. BOOST_ASIO_DECL void stop_all_threads(mutex::scoped_lock& lock); diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp index 4aa0ec364..dbc5f2cb7 100644 --- a/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp +++ b/project/jni/boost/include/boost/asio/detail/task_io_service_fwd.hpp @@ -20,6 +20,8 @@ namespace asio { namespace detail { class task_io_service; +class task_io_service_operation; +struct task_io_service_thread_info; } // namespace detail } // namespace asio diff --git a/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp b/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp new file mode 100644 index 000000000..12775f194 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/task_io_service_thread_info.hpp @@ -0,0 +1,43 @@ +// +// detail/task_io_service_thread_info.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP +#define BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +struct task_io_service_thread_info : public thread_info_base +{ + event* wakeup_event; + op_queue private_op_queue; + long private_outstanding_work; + task_io_service_thread_info* next; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_TASK_IO_SERVICE_THREAD_INFO_HPP diff --git a/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp b/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp new file mode 100644 index 000000000..c93bce3b5 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/thread_info_base.hpp @@ -0,0 +1,93 @@ +// +// detail/thread_info_base.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP +#define BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +class thread_info_base + : private noncopyable +{ +public: + thread_info_base() + : reusable_memory_(0) + { + } + + ~thread_info_base() + { + if (reusable_memory_) + ::operator delete(reusable_memory_); + } + + static void* allocate(thread_info_base* this_thread, std::size_t size) + { + if (this_thread && this_thread->reusable_memory_) + { + void* const pointer = this_thread->reusable_memory_; + this_thread->reusable_memory_ = 0; + + unsigned char* const mem = static_cast(pointer); + if (static_cast(mem[0]) >= size) + { + mem[size] = mem[0]; + return pointer; + } + + ::operator delete(pointer); + } + + void* const pointer = ::operator new(size + 1); + unsigned char* const mem = static_cast(pointer); + mem[size] = (size <= UCHAR_MAX) ? static_cast(size) : 0; + return pointer; + } + + static void deallocate(thread_info_base* this_thread, + void* pointer, std::size_t size) + { + if (size <= UCHAR_MAX) + { + if (this_thread && this_thread->reusable_memory_ == 0) + { + unsigned char* const mem = static_cast(pointer); + mem[0] = mem[size]; + this_thread->reusable_memory_ = pointer; + return; + } + } + + ::operator delete(pointer); + } + +private: + void* reusable_memory_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_THREAD_INFO_BASE_HPP diff --git a/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp b/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp index cdb09e71b..d14a95944 100644 --- a/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp +++ b/project/jni/boost/include/boost/asio/detail/tss_ptr.hpp @@ -19,6 +19,8 @@ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) # include +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) +# include #elif defined(BOOST_WINDOWS) # include #elif defined(BOOST_HAS_PTHREADS) @@ -37,6 +39,8 @@ template class tss_ptr #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) : public null_tss_ptr +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + : public keyword_tss_ptr #elif defined(BOOST_WINDOWS) : public win_tss_ptr #elif defined(BOOST_HAS_PTHREADS) @@ -48,6 +52,8 @@ public: { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) null_tss_ptr::operator=(value); +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + keyword_tss_ptr::operator=(value); #elif defined(BOOST_WINDOWS) win_tss_ptr::operator=(value); #elif defined(BOOST_HAS_PTHREADS) diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp index c6ebf63e9..924b37806 100644 --- a/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_io_service.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -107,7 +108,7 @@ public: // Return whether a handler can be dispatched immediately. bool can_dispatch() { - return call_stack::contains(this) != 0; + return thread_call_stack::contains(this) != 0; } // Request invocation of the given handler. @@ -135,6 +136,22 @@ public: BOOST_ASIO_DECL void post_deferred_completions( op_queue& ops); + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() has not yet been + // called for the operation. + void post_private_immediate_completion(win_iocp_operation* op) + { + post_immediate_completion(op); + } + + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() was previously called + // for the operation. + void post_private_deferred_completion(win_iocp_operation* op) + { + post_deferred_completion(op); + } + // Process unfinished operations as part of a shutdown_service operation. // Assumes that work_started() was previously called for the operations. BOOST_ASIO_DECL void abandon_operations(op_queue& ops); @@ -221,6 +238,11 @@ private: // Flag to indicate whether the event loop has been stopped. mutable long stopped_; + // Flag to indicate whether there is an in-flight stop event. Every event + // posted using PostQueuedCompletionStatus consumes non-paged pool, so to + // avoid exhausting this resouce we limit the number of outstanding events. + long stop_event_posted_; + // Flag to indicate whether the service has been shut down. long shutdown_; @@ -269,6 +291,10 @@ private: // The operations that are ready to dispatch. op_queue completed_ops_; + + // Per-thread call stack to track the state of each thread in the io_service. + typedef call_stack thread_call_stack; }; } // namespace detail diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp index 79580def1..4c1683fa3 100644 --- a/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_socket_service_base.hpp @@ -446,7 +446,7 @@ protected: bool peer_is_open, socket_holder& new_socket, int family, int type, int protocol, void* output_buffer, DWORD address_length, operation* op); - // Start an asynchronous read or write operation using the the reactor. + // Start an asynchronous read or write operation using the reactor. BOOST_ASIO_DECL void start_reactor_op(base_implementation_type& impl, int op_type, reactor_op* op); diff --git a/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp b/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp new file mode 100644 index 000000000..e9af13330 --- /dev/null +++ b/project/jni/boost/include/boost/asio/detail/win_iocp_thread_info.hpp @@ -0,0 +1,36 @@ +// +// detail/win_iocp_thread_info.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP +#define BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +struct win_iocp_thread_info : public thread_info_base +{ +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP diff --git a/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp b/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp index 6bef15188..bef5f61b4 100644 --- a/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp +++ b/project/jni/boost/include/boost/asio/handler_alloc_hook.hpp @@ -32,10 +32,8 @@ namespace asio { * Implement asio_handler_allocate and asio_handler_deallocate for your own * handlers to provide custom allocation for these temporary objects. * - * This default implementation is simply: - * @code - * return ::operator new(size); - * @endcode + * The default implementation of these allocation hooks uses ::operator + * new and ::operator delete. * * @note All temporary objects associated with a handler will be deallocated * before the upcall to the handler is performed. This allows the same memory to @@ -57,32 +55,29 @@ namespace asio { * } * @endcode */ -inline void* asio_handler_allocate(std::size_t size, ...) -{ - return ::operator new(size); -} +BOOST_ASIO_DECL void* asio_handler_allocate( + std::size_t size, ...); /// Default deallocation function for handlers. /** * Implement asio_handler_allocate and asio_handler_deallocate for your own * handlers to provide custom allocation for the associated temporary objects. * - * This default implementation is simply: - * @code - * ::operator delete(pointer); - * @endcode + * The default implementation of these allocation hooks uses ::operator + * new and ::operator delete. * * @sa asio_handler_allocate. */ -inline void asio_handler_deallocate(void* pointer, std::size_t size, ...) -{ - (void)(size); - ::operator delete(pointer); -} +BOOST_ASIO_DECL void asio_handler_deallocate( + void* pointer, std::size_t size, ...); } // namespace asio } // namespace boost #include +#if defined(BOOST_ASIO_HEADER_ONLY) +# include +#endif // defined(BOOST_ASIO_HEADER_ONLY) + #endif // BOOST_ASIO_HANDLER_ALLOC_HOOK_HPP diff --git a/project/jni/boost/include/boost/asio/impl/error.ipp b/project/jni/boost/include/boost/asio/impl/error.ipp index cfb7a997e..e96ee9878 100644 --- a/project/jni/boost/include/boost/asio/impl/error.ipp +++ b/project/jni/boost/include/boost/asio/impl/error.ipp @@ -31,7 +31,7 @@ namespace detail { class netdb_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.netdb"; } @@ -63,7 +63,7 @@ namespace detail { class addrinfo_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.addrinfo"; } @@ -93,7 +93,7 @@ namespace detail { class misc_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.misc"; } diff --git a/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp b/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp new file mode 100644 index 000000000..d30e0f17a --- /dev/null +++ b/project/jni/boost/include/boost/asio/impl/handler_alloc_hook.ipp @@ -0,0 +1,76 @@ +// +// impl/handler_alloc_hook.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP +#define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include + +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) +# include +# include +# else // defined(BOOST_ASIO_HAS_IOCP) +# include +# endif // defined(BOOST_ASIO_HAS_IOCP) +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + +#include + +namespace boost { +namespace asio { + +void* asio_handler_allocate(std::size_t size, ...) +{ +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_io_service io_service_impl; + typedef detail::win_iocp_thread_info thread_info; +# else // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::task_io_service io_service_impl; + typedef detail::task_io_service_thread_info thread_info; +# endif // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::call_stack call_stack; + return thread_info::allocate(call_stack::top(), size); +#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + return ::operator new(size); +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +} + +void asio_handler_deallocate(void* pointer, std::size_t size, ...) +{ +#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +# if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_io_service io_service_impl; + typedef detail::win_iocp_thread_info thread_info; +# else // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::task_io_service io_service_impl; + typedef detail::task_io_service_thread_info thread_info; +# endif // defined(BOOST_ASIO_HAS_IOCP) + typedef detail::call_stack call_stack; + thread_info::deallocate(call_stack::top(), pointer, size); +#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) + (void)size; + ::operator delete(pointer); +#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) +} + +} // namespace asio +} // namespace boost + +#include + +#endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP diff --git a/project/jni/boost/include/boost/asio/impl/src.hpp b/project/jni/boost/include/boost/asio/impl/src.hpp index e5a0fafde..c44e070f2 100644 --- a/project/jni/boost/include/boost/asio/impl/src.hpp +++ b/project/jni/boost/include/boost/asio/impl/src.hpp @@ -20,6 +20,7 @@ #endif #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp b/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp index 24bfce293..857591102 100644 --- a/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp +++ b/project/jni/boost/include/boost/asio/ip/detail/impl/endpoint.ipp @@ -81,7 +81,8 @@ endpoint::endpoint(const boost::asio::ip::address& addr, boost::asio::detail::socket_ops::host_to_network_short(port_num); data_.v4.sin_addr.s_addr = boost::asio::detail::socket_ops::host_to_network_long( - addr.to_v4().to_ulong()); + static_cast( + addr.to_v4().to_ulong())); } else { @@ -92,7 +93,9 @@ endpoint::endpoint(const boost::asio::ip::address& addr, boost::asio::ip::address_v6 v6_addr = addr.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = v6_addr.to_bytes(); memcpy(data_.v6.sin6_addr.s6_addr, bytes.data(), 16); - data_.v6.sin6_scope_id = v6_addr.scope_id(); + data_.v6.sin6_scope_id = + static_cast( + v6_addr.scope_id()); } } diff --git a/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp b/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp index 31f6e27d5..369d32467 100644 --- a/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp +++ b/project/jni/boost/include/boost/asio/ip/impl/address_v4.ipp @@ -55,7 +55,8 @@ address_v4::address_v4(unsigned long addr) } #endif // ULONG_MAX > 0xFFFFFFFF - addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long(addr); + addr_.s_addr = boost::asio::detail::socket_ops::host_to_network_long( + static_cast(addr)); } address_v4::bytes_type address_v4::to_bytes() const diff --git a/project/jni/boost/include/boost/asio/ssl/context_base.hpp b/project/jni/boost/include/boost/asio/ssl/context_base.hpp index 3c0b59d65..3d39053d0 100644 --- a/project/jni/boost/include/boost/asio/ssl/context_base.hpp +++ b/project/jni/boost/include/boost/asio/ssl/context_base.hpp @@ -71,29 +71,29 @@ public: }; /// Bitmask type for SSL options. - typedef int options; + typedef long options; #if defined(GENERATING_DOCUMENTATION) /// Implement various bug workarounds. - static const int default_workarounds = implementation_defined; + static const long default_workarounds = implementation_defined; /// Always create a new key when using tmp_dh parameters. - static const int single_dh_use = implementation_defined; + static const long single_dh_use = implementation_defined; /// Disable SSL v2. - static const int no_sslv2 = implementation_defined; + static const long no_sslv2 = implementation_defined; /// Disable SSL v3. - static const int no_sslv3 = implementation_defined; + static const long no_sslv3 = implementation_defined; /// Disable TLS v1. - static const int no_tlsv1 = implementation_defined; + static const long no_tlsv1 = implementation_defined; #else - BOOST_STATIC_CONSTANT(int, default_workarounds = SSL_OP_ALL); - BOOST_STATIC_CONSTANT(int, single_dh_use = SSL_OP_SINGLE_DH_USE); - BOOST_STATIC_CONSTANT(int, no_sslv2 = SSL_OP_NO_SSLv2); - BOOST_STATIC_CONSTANT(int, no_sslv3 = SSL_OP_NO_SSLv3); - BOOST_STATIC_CONSTANT(int, no_tlsv1 = SSL_OP_NO_TLSv1); + BOOST_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL); + BOOST_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE); + BOOST_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2); + BOOST_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3); + BOOST_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1); #endif /// File format types. diff --git a/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp b/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp index 72f1c3568..39d412a5d 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp +++ b/project/jni/boost/include/boost/asio/ssl/detail/impl/engine.ipp @@ -18,7 +18,10 @@ #include #if !defined(BOOST_ASIO_ENABLE_OLD_SSL) +# include +# include # include +# include # include #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) @@ -34,6 +37,14 @@ namespace detail { engine::engine(SSL_CTX* context) : ssl_(::SSL_new(context)) { + if (!ssl_) + { + boost::system::error_code ec( + static_cast(::ERR_get_error()), + boost::asio::error::get_ssl_category()); + boost::asio::detail::throw_error(ec, "engine"); + } + accept_mutex().init(); ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE); @@ -156,7 +167,7 @@ boost::asio::mutable_buffers_1 engine::get_output( { int length = ::BIO_read(ext_bio_, boost::asio::buffer_cast(data), - boost::asio::buffer_size(data)); + static_cast(boost::asio::buffer_size(data))); return boost::asio::buffer(data, length > 0 ? static_cast(length) : 0); @@ -167,7 +178,7 @@ boost::asio::const_buffer engine::put_input( { int length = ::BIO_write(ext_bio_, boost::asio::buffer_cast(data), - boost::asio::buffer_size(data)); + static_cast(boost::asio::buffer_size(data))); return boost::asio::buffer(data + (length > 0 ? static_cast(length) : 0)); @@ -218,7 +229,7 @@ engine::want engine::perform(int (engine::* op)(void*, std::size_t), std::size_t pending_output_before = ::BIO_ctrl_pending(ext_bio_); int result = (this->*op)(data, length); int ssl_error = ::SSL_get_error(ssl_, result); - int sys_error = ::ERR_get_error(); + int sys_error = static_cast(::ERR_get_error()); std::size_t pending_output_after = ::BIO_ctrl_pending(ext_bio_); if (ssl_error == SSL_ERROR_SSL) @@ -286,12 +297,14 @@ int engine::do_shutdown(void*, std::size_t) int engine::do_read(void* data, std::size_t length) { - return ::SSL_read(ssl_, data, length < INT_MAX ? length : INT_MAX); + return ::SSL_read(ssl_, data, + length < INT_MAX ? static_cast(length) : INT_MAX); } int engine::do_write(void* data, std::size_t length) { - return ::SSL_write(ssl_, data, length < INT_MAX ? length : INT_MAX); + return ::SSL_write(ssl_, data, + length < INT_MAX ? static_cast(length) : INT_MAX); } #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) diff --git a/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp b/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp index af33f6e03..fe62e6eab 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp +++ b/project/jni/boost/include/boost/asio/ssl/detail/impl/openssl_init.ipp @@ -56,7 +56,9 @@ public: ::EVP_cleanup(); ::CRYPTO_cleanup_all_ex_data(); ::CONF_modules_unload(1); +#if !defined(OPENSSL_NO_ENGINE) ::ENGINE_cleanup(); +#endif // !defined(OPENSSL_NO_ENGINE) } private: diff --git a/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp b/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp index 752fe587d..a3c372933 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp +++ b/project/jni/boost/include/boost/asio/ssl/detail/openssl_types.hpp @@ -18,7 +18,9 @@ #include #include #include -#include +#if !defined(OPENSSL_NO_ENGINE) +# include +#endif // !defined(OPENSSL_NO_ENGINE) #include #include #include diff --git a/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp b/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp index b8f0afa4a..666069130 100644 --- a/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp +++ b/project/jni/boost/include/boost/asio/ssl/detail/stream_core.hpp @@ -34,7 +34,7 @@ namespace detail { struct stream_core { - // According to the OpenSSL documentation, this is the buffer size that is is + // According to the OpenSSL documentation, this is the buffer size that is // sufficient to hold the largest possible TLS record. enum { max_tls_record_size = 17 * 1024 }; diff --git a/project/jni/boost/include/boost/asio/ssl/impl/context.ipp b/project/jni/boost/include/boost/asio/ssl/impl/context.ipp index 54f4fd15d..f730e830d 100644 --- a/project/jni/boost/include/boost/asio/ssl/impl/context.ipp +++ b/project/jni/boost/include/boost/asio/ssl/impl/context.ipp @@ -91,7 +91,8 @@ context::context(context::method m) if (handle_ == 0) { - boost::system::error_code ec(::ERR_get_error(), + boost::system::error_code ec( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); boost::asio::detail::throw_error(ec, "context"); } @@ -201,7 +202,8 @@ boost::system::error_code context::load_verify_file( { if (::SSL_CTX_load_verify_locations(handle_, filename.c_str(), 0) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -222,7 +224,8 @@ boost::system::error_code context::set_default_verify_paths( { if (::SSL_CTX_set_default_verify_paths(handle_) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -243,7 +246,8 @@ boost::system::error_code context::add_verify_path( { if (::SSL_CTX_load_verify_locations(handle_, 0, path.c_str()) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -282,7 +286,8 @@ boost::system::error_code context::use_certificate_file( if (::SSL_CTX_use_certificate_file(handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -303,7 +308,8 @@ boost::system::error_code context::use_certificate_chain_file( { if (::SSL_CTX_use_certificate_chain_file(handle_, filename.c_str()) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -342,7 +348,8 @@ boost::system::error_code context::use_private_key_file( if (::SSL_CTX_use_PrivateKey_file(handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -382,7 +389,8 @@ boost::system::error_code context::use_rsa_private_key_file( if (::SSL_CTX_use_RSAPrivateKey_file( handle_, filename.c_str(), file_type) != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -417,11 +425,12 @@ boost::system::error_code context::use_tmp_dh_file( } ::BIO_free(bio); - int result = ::SSL_CTX_set_tmp_dh(handle_, dh); + long result = ::SSL_CTX_set_tmp_dh(handle_, dh); ::DH_free(dh); if (result != 1) { - ec = boost::system::error_code(::ERR_get_error(), + ec = boost::system::error_code( + static_cast(::ERR_get_error()), boost::asio::error::get_ssl_category()); return ec; } @@ -510,7 +519,7 @@ int context::password_callback_function( strncat(buf, passwd.c_str(), size); #endif - return strlen(buf); + return static_cast(strlen(buf)); } return 0; diff --git a/project/jni/boost/include/boost/asio/ssl/impl/error.ipp b/project/jni/boost/include/boost/asio/ssl/impl/error.ipp index 6d462352a..cef57f725 100644 --- a/project/jni/boost/include/boost/asio/ssl/impl/error.ipp +++ b/project/jni/boost/include/boost/asio/ssl/impl/error.ipp @@ -30,7 +30,7 @@ namespace detail { class ssl_category : public boost::system::error_category { public: - const char* name() const + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT { return "asio.ssl"; } diff --git a/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp b/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp index c4a8feea6..4d2ab131d 100644 --- a/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp +++ b/project/jni/boost/include/boost/asio/ssl/old/detail/openssl_operation.hpp @@ -154,7 +154,7 @@ public: // For connect/accept/shutdown, the operation // is done, when return code is 1 // for write, it is done, when is retcode > 0 - // for read, is is done when retcode > 0 + // for read, it is done when retcode > 0 int error_code = !is_operation_done ? ::SSL_get_error( session_, rc ) : diff --git a/project/jni/boost/include/boost/asio/strand.hpp b/project/jni/boost/include/boost/asio/strand.hpp index ba82e602a..6a1033f37 100644 --- a/project/jni/boost/include/boost/asio/strand.hpp +++ b/project/jni/boost/include/boost/asio/strand.hpp @@ -105,7 +105,6 @@ public: */ ~strand() { - service_.destroy(impl_); } /// Get the io_service associated with the strand. diff --git a/project/jni/boost/include/boost/asio/version.hpp b/project/jni/boost/include/boost/asio/version.hpp index 21eeb5124..612887957 100644 --- a/project/jni/boost/include/boost/asio/version.hpp +++ b/project/jni/boost/include/boost/asio/version.hpp @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 100800 // 1.8.0 +#define BOOST_ASIO_VERSION 100803 // 1.8.3 #endif // BOOST_ASIO_VERSION_HPP diff --git a/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp b/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp index 161bb512f..a94bb57e2 100644 --- a/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp +++ b/project/jni/boost/include/boost/asio/windows/basic_object_handle.hpp @@ -125,7 +125,7 @@ public: void wait() { boost::system::error_code ec; - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); boost::asio::detail::throw_error(ec, "wait"); } @@ -139,7 +139,7 @@ public: */ void wait(boost::system::error_code& ec) { - this->service.wait(this->implementation, ec); + this->get_service().wait(this->get_implementation(), ec); } /// Start an asynchronous wait on the object handle. @@ -161,7 +161,7 @@ public: template void async_wait(WaitHandler handler) { - this->service.async_wait(this->implementation, handler); + this->get_service().async_wait(this->get_implementation(), handler); } }; diff --git a/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp b/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp index 0d5714188..3529c9c3f 100644 --- a/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp +++ b/project/jni/boost/include/boost/asio/windows/basic_random_access_handle.hpp @@ -58,7 +58,7 @@ public: /// Construct a basic_random_access_handle without opening it. /** * This constructor creates a random-access handle without opening it. The - * handle needs to be opened before data can be written to or or read from it. + * handle needs to be opened before data can be written to or read from it. * * @param io_service The io_service object that the random-access handle will * use to dispatch handlers for any asynchronous operations performed on the diff --git a/project/jni/boost/include/boost/atomic.hpp b/project/jni/boost/include/boost/atomic.hpp new file mode 100644 index 000000000..0f5883c38 --- /dev/null +++ b/project/jni/boost/include/boost/atomic.hpp @@ -0,0 +1,18 @@ +#ifndef BOOST_ATOMIC_HPP +#define BOOST_ATOMIC_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This header includes all Boost.Atomic public headers + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#endif diff --git a/project/jni/boost/include/boost/atomic/atomic.hpp b/project/jni/boost/include/boost/atomic/atomic.hpp new file mode 100644 index 000000000..f47bdb16d --- /dev/null +++ b/project/jni/boost/include/boost/atomic/atomic.hpp @@ -0,0 +1,205 @@ +#ifndef BOOST_ATOMIC_ATOMIC_HPP +#define BOOST_ATOMIC_ATOMIC_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#include + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { + +#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE +#define BOOST_ATOMIC_CHAR_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE +#define BOOST_ATOMIC_SHORT_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_INT_LOCK_FREE +#define BOOST_ATOMIC_INT_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_LONG_LOCK_FREE +#define BOOST_ATOMIC_LONG_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE +#define BOOST_ATOMIC_POINTER_LOCK_FREE 0 +#endif + +#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE + +#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE +#define BOOST_ATOMIC_BOOL_LOCK_FREE 0 +#endif + +#ifndef BOOST_ATOMIC_THREAD_FENCE +#define BOOST_ATOMIC_THREAD_FENCE 0 +inline void atomic_thread_fence(memory_order) +{ +} +#endif + +#ifndef BOOST_ATOMIC_SIGNAL_FENCE +#define BOOST_ATOMIC_SIGNAL_FENCE 0 +inline void atomic_signal_fence(memory_order order) +{ + atomic_thread_fence(order); +} +#endif + +template +class atomic : + public atomics::detail::base_atomic::type, atomics::detail::storage_size_of::value, boost::is_signed::value > +{ +private: + typedef T value_type; + typedef atomics::detail::base_atomic::type, atomics::detail::storage_size_of::value, boost::is_signed::value > super; +public: + atomic(void) : super() {} + explicit atomic(const value_type & v) : super(v) {} + + atomic & operator=(value_type v) volatile + { + super::operator=(v); + return *const_cast(this); + } +private: + atomic(const atomic &) /* =delete */ ; + atomic & operator=(const atomic &) /* =delete */ ; +}; + +typedef atomic atomic_char; +typedef atomic atomic_uchar; +typedef atomic atomic_schar; +typedef atomic atomic_uint8_t; +typedef atomic atomic_int8_t; +typedef atomic atomic_ushort; +typedef atomic atomic_short; +typedef atomic atomic_uint16_t; +typedef atomic atomic_int16_t; +typedef atomic atomic_uint; +typedef atomic atomic_int; +typedef atomic atomic_uint32_t; +typedef atomic atomic_int32_t; +typedef atomic atomic_ulong; +typedef atomic atomic_long; +typedef atomic atomic_uint64_t; +typedef atomic atomic_int64_t; +#ifdef BOOST_HAS_LONG_LONG +typedef atomic atomic_ullong; +typedef atomic atomic_llong; +#endif +typedef atomic atomic_address; +typedef atomic atomic_bool; +typedef atomic atomic_wchar_t; +#if !defined(BOOST_NO_CXX11_CHAR16_T) +typedef atomic atomic_char16_t; +#endif +#if !defined(BOOST_NO_CXX11_CHAR32_T) +typedef atomic atomic_char32_t; +#endif + +typedef atomic atomic_int_least8_t; +typedef atomic atomic_uint_least8_t; +typedef atomic atomic_int_least16_t; +typedef atomic atomic_uint_least16_t; +typedef atomic atomic_int_least32_t; +typedef atomic atomic_uint_least32_t; +typedef atomic atomic_int_least64_t; +typedef atomic atomic_uint_least64_t; +typedef atomic atomic_int_fast8_t; +typedef atomic atomic_uint_fast8_t; +typedef atomic atomic_int_fast16_t; +typedef atomic atomic_uint_fast16_t; +typedef atomic atomic_int_fast32_t; +typedef atomic atomic_uint_fast32_t; +typedef atomic atomic_int_fast64_t; +typedef atomic atomic_uint_fast64_t; +typedef atomic atomic_intmax_t; +typedef atomic atomic_uintmax_t; + +typedef atomic atomic_size_t; +typedef atomic atomic_ptrdiff_t; + +// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config. +#if !defined(__PGIC__) + +#if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \ + || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0)) \ + || defined(__CYGWIN__) \ + || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \ + || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +typedef atomic atomic_intptr_t; +typedef atomic atomic_uintptr_t; +#elif defined(__GNUC__) || defined(__clang__) +#if defined(__INTPTR_TYPE__) +typedef atomic< __INTPTR_TYPE__ > atomic_intptr_t; +#endif +#if defined(__UINTPTR_TYPE__) +typedef atomic< __UINTPTR_TYPE__ > atomic_uintptr_t; +#endif +#endif + +#endif + +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE +#define BOOST_ATOMIC_FLAG_LOCK_FREE 0 +class atomic_flag +{ +public: + atomic_flag(void) : v_(false) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) + { + return v_.exchange(true, order); + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + v_.store(false, order); + } +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + atomic v_; +}; +#endif + +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/base.hpp b/project/jni/boost/include/boost/atomic/detail/base.hpp new file mode 100644 index 000000000..b03545435 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/base.hpp @@ -0,0 +1,519 @@ +#ifndef BOOST_ATOMIC_DETAIL_BASE_HPP +#define BOOST_ATOMIC_DETAIL_BASE_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Base class definition and fallback implementation. +// To be overridden (through partial specialization) by +// platform implementations. + +#include + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + operator value_type(void) volatile const \ + { \ + return load(memory_order_seq_cst); \ + } \ + \ + this_type & \ + operator=(value_type v) volatile \ + { \ + store(v, memory_order_seq_cst); \ + return *const_cast(this); \ + } \ + \ + bool \ + compare_exchange_strong( \ + value_type & expected, \ + value_type desired, \ + memory_order order = memory_order_seq_cst) volatile \ + { \ + return compare_exchange_strong(expected, desired, order, calculate_failure_order(order)); \ + } \ + \ + bool \ + compare_exchange_weak( \ + value_type & expected, \ + value_type desired, \ + memory_order order = memory_order_seq_cst) volatile \ + { \ + return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \ + } \ + \ + +#define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + value_type \ + operator++(int) volatile \ + { \ + return fetch_add(1); \ + } \ + \ + value_type \ + operator++(void) volatile \ + { \ + return fetch_add(1) + 1; \ + } \ + \ + value_type \ + operator--(int) volatile \ + { \ + return fetch_sub(1); \ + } \ + \ + value_type \ + operator--(void) volatile \ + { \ + return fetch_sub(1) - 1; \ + } \ + \ + value_type \ + operator+=(difference_type v) volatile \ + { \ + return fetch_add(v) + v; \ + } \ + \ + value_type \ + operator-=(difference_type v) volatile \ + { \ + return fetch_sub(v) - v; \ + } \ + +#define BOOST_ATOMIC_DECLARE_BIT_OPERATORS \ + value_type \ + operator&=(difference_type v) volatile \ + { \ + return fetch_and(v) & v; \ + } \ + \ + value_type \ + operator|=(difference_type v) volatile \ + { \ + return fetch_or(v) | v; \ + } \ + \ + value_type \ + operator^=(difference_type v) volatile \ + { \ + return fetch_xor(v) ^ v; \ + } \ + +#define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS \ + BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + +#define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS \ + BOOST_ATOMIC_DECLARE_BASE_OPERATORS \ + BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \ + BOOST_ATOMIC_DECLARE_BIT_OPERATORS \ + +namespace boost { +namespace atomics { +namespace detail { + +inline memory_order +calculate_failure_order(memory_order order) +{ + switch(order) { + case memory_order_acq_rel: + return memory_order_acquire; + case memory_order_release: + return memory_order_relaxed; + default: + return order; + } +} + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T value_type; + typedef lockpool::scoped_lock guard_type; +public: + base_atomic(void) {} + + explicit base_atomic(const value_type & v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + + void + store(value_type const& v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(v_)); + + memcpy(const_cast(v_), &v, sizeof(value_type)); + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) volatile const + { + guard_type guard(const_cast(v_)); + + value_type v; + memcpy(&v, const_cast(v_), sizeof(value_type)); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(v_)); + + if (memcmp(const_cast(v_), &expected, sizeof(value_type)) == 0) { + memcpy(const_cast(v_), &desired, sizeof(value_type)); + return true; + } else { + memcpy(&expected, const_cast(v_), sizeof(value_type)); + return false; + } + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + exchange(value_type const& v, memory_order /*order*/=memory_order_seq_cst) volatile + { + guard_type guard(const_cast(v_)); + + value_type tmp; + memcpy(&tmp, const_cast(v_), sizeof(value_type)); + + memcpy(const_cast(v_), &v, sizeof(value_type)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + + char v_[sizeof(value_type)]; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ += v; + return old; + } + + value_type + fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ -= v; + return old; + } + + value_type + fetch_and(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ &= v; + return old; + } + + value_type + fetch_or(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ |= v; + return old; + } + + value_type + fetch_xor(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ ^= v; + return old; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ += v; + return old; + } + + value_type fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ -= v; + return old; + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { +private: + typedef base_atomic this_type; + typedef void * value_type; + typedef lockpool::scoped_lock guard_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + v_ = v; + } + + value_type + load(memory_order /*order*/ = memory_order_seq_cst) const volatile + { + guard_type guard(const_cast(&v_)); + + value_type v = const_cast(v_); + return v; + } + + value_type + exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile + { + guard_type guard(const_cast(&v_)); + + value_type old = v_; + v_ = v; + return old; + } + + bool + compare_exchange_strong(value_type & expected, value_type desired, + memory_order /*success_order*/, + memory_order /*failure_order*/) volatile + { + guard_type guard(const_cast(&v_)); + + if (v_ == expected) { + v_ = desired; + return true; + } else { + expected = v_; + return false; + } + } + + bool + compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return false; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp b/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp new file mode 100644 index 000000000..2cbfaab85 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas32strong.hpp @@ -0,0 +1,872 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP +#define BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +// Build 8-, 16- and 32-bit atomic operations from +// a platform_cmpxchg32_strong primitive. + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp b/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp new file mode 100644 index 000000000..f4d9f7f24 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas32weak.hpp @@ -0,0 +1,916 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS32WEAK_HPP +#define BOOST_ATOMIC_DETAIL_CAS32WEAK_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + storage_type expected_s = (storage_type) expected; + storage_type desired_s = (storage_type) desired; + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + expected = (value_type) expected_s; + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before_store(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + + bool success = platform_cmpxchg32(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + for(;;) { + value_type tmp = expected; + if (compare_exchange_weak(tmp, desired, success_order, failure_order)) + return true; + if (tmp != expected) { + expected = tmp; + return false; + } + } + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp b/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp new file mode 100644 index 000000000..ca7f41f3f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/cas64strong.hpp @@ -0,0 +1,438 @@ +#ifndef BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP +#define BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2011 Helge Bahmann + +// Build 64-bit atomic operation from platform_cmpxchg64_strong +// primitive. It is assumed that 64-bit loads/stores are not +// atomic, so they are funnelled through cmpxchg as well. + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before_store(order); + platform_store64(v, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = platform_load64(&v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + + bool success = platform_cmpxchg64_strong(expected, desired, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + } + + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed)); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed)); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& value, memory_order order = memory_order_seq_cst) volatile + { + storage_type value_s = 0; + memcpy(&value_s, &value, sizeof(value_s)); + platform_fence_before_store(order); + platform_store64(value_s, &v_); + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type value_s = platform_load64(&v_); + platform_fence_after_load(order); + value_type value; + memcpy(&value, &value_s, sizeof(value_s)); + return value; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type original = load(memory_order_relaxed); + do { + } while (!compare_exchange_weak(original, v, order, memory_order_relaxed)); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + platform_fence_before(success_order); + bool success = platform_cmpxchg64_strong(expected_s, desired_s, &v_); + + if (success) { + platform_fence_after(success_order); + } else { + platform_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + } + + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/config.hpp b/project/jni/boost/include/boost/atomic/detail/config.hpp new file mode 100644 index 000000000..979bdd8f9 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/config.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP +#define BOOST_ATOMIC_DETAIL_CONFIG_HPP + +// Copyright (c) 2012 Hartmut Kaiser +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__GNUC__) || defined(BOOST_CLANG) || defined(BOOST_INTEL) || defined(__COMO__) || defined(__DMC__) +#define BOOST_ATOMIC_HAS_PRAGMA_ONCE +#endif + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Set up dll import/export options +#if (defined(BOOST_ATOMIC_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \ + !defined(BOOST_ATOMIC_STATIC_LINK) + +#if defined(BOOST_ATOMIC_SOURCE) +#define BOOST_ATOMIC_DECL BOOST_SYMBOL_EXPORT +#define BOOST_ATOMIC_BUILD_DLL +#else +#define BOOST_ATOMIC_DECL BOOST_SYMBOL_IMPORT +#endif + +#endif // building a shared library + +#ifndef BOOST_ATOMIC_DECL +#define BOOST_ATOMIC_DECL +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Auto library naming +#if !defined(BOOST_ATOMIC_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_ATOMIC_NO_LIB) + +#define BOOST_LIB_NAME boost_atomic + +// tell the auto-link code to select a dll when required: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ATOMIC_DYN_LINK) +#define BOOST_DYN_LINK +#endif + +#include + +#endif // auto-linking disabled + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp new file mode 100644 index 000000000..0748fc381 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-alpha.hpp @@ -0,0 +1,359 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP +#define BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* + Refer to http://h71000.www7.hp.com/doc/82final/5601/5601pro_004.html + (HP OpenVMS systems documentation) and the alpha reference manual. + */ + +/* + NB: The most natural thing would be to write the increment/decrement + operators along the following lines: + + __asm__ __volatile__( + "1: ldl_l %0,%1 \n" + "addl %0,1,%0 \n" + "stl_c %0,%1 \n" + "beq %0,1b\n" + : "=&b" (tmp) + : "m" (value) + : "cc" + ); + + However according to the comments on the HP website and matching + comments in the Linux kernel sources this defies branch prediction, + as the cpu assumes that backward branches are always taken; so + instead copy the trick from the Linux kernel, introduce a forward + branch and back again. + + I have, however, had a hard time measuring the difference between + the two versions in microbenchmarks -- I am leaving it in nevertheless + as it apparently does not hurt either. +*/ + +namespace boost { +namespace atomics { +namespace detail { + +inline void fence_before(memory_order order) +{ + switch(order) { + case memory_order_consume: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +inline void fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +template<> +inline void platform_atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_consume: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("mb" ::: "memory"); + default:; + } +} + +template +class atomic_alpha_32 { +public: + typedef T integral_type; + explicit atomic_alpha_32(T v) : i(v) {} + atomic_alpha_32() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T v=*reinterpret_cast(&i); + fence_after(order); + return v; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + fence_before(order); + *reinterpret_cast(&i)=(int)v; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + fence_before(success_order); + int current, success; + __asm__ __volatile__( + "1: ldl_l %2, %4\n" + "cmpeq %2, %0, %3\n" + "mov %2, %0\n" + "beq %3, 3f\n" + "stl_c %1, %4\n" + "2:\n" + + ".subsection 2\n" + "3: mov %3, %1\n" + "br 2b\n" + ".previous\n" + + : "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success) + : "m" (i) + : + ); + if (desired) fence_after(success_order); + else fence_after(failure_order); + return desired; + } + + bool is_lock_free(void) const volatile {return true;} +protected: + inline T fetch_add_var(T c, memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "addl %0, %3, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i), "r" (c) + : + ); + fence_after(order); + return original; + } + inline T fetch_inc(memory_order order) volatile + { + fence_before(order); + int original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "addl %0, 1, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } + inline T fetch_dec(memory_order order) volatile + { + fence_before(order); + int original, modified; + __asm__ __volatile__( + "1: ldl_l %0, %2\n" + "subl %0, 1, %1\n" + "stl_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } +private: + T i; +}; + +template +class atomic_alpha_64 { +public: + typedef T integral_type; + explicit atomic_alpha_64(T v) : i(v) {} + atomic_alpha_64() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T v=*reinterpret_cast(&i); + fence_after(order); + return v; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + fence_before(order); + *reinterpret_cast(&i)=v; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + fence_before(success_order); + int current, success; + __asm__ __volatile__( + "1: ldq_l %2, %4\n" + "cmpeq %2, %0, %3\n" + "mov %2, %0\n" + "beq %3, 3f\n" + "stq_c %1, %4\n" + "2:\n" + + ".subsection 2\n" + "3: mov %3, %1\n" + "br 2b\n" + ".previous\n" + + : "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success) + : "m" (i) + : + ); + if (desired) fence_after(success_order); + else fence_after(failure_order); + return desired; + } + + bool is_lock_free(void) const volatile {return true;} +protected: + inline T fetch_add_var(T c, memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "addq %0, %3, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i), "r" (c) + : + ); + fence_after(order); + return original; + } + inline T fetch_inc(memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "addq %0, 1, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } + inline T fetch_dec(memory_order order) volatile + { + fence_before(order); + T original, modified; + __asm__ __volatile__( + "1: ldq_l %0, %2\n" + "subq %0, 1, %1\n" + "stq_c %1, %2\n" + "beq %1, 2f\n" + + ".subsection 2\n" + "2: br 1b\n" + ".previous\n" + + : "=&r" (original), "=&r" (modified) + : "m" (i) + : + ); + fence_after(order); + return original; + } +private: + T i; +}; + +template +class platform_atomic_integral : public build_atomic_from_typical > > { +public: + typedef build_atomic_from_typical > > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral : public build_atomic_from_typical > > { +public: + typedef build_atomic_from_typical > > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp new file mode 100644 index 000000000..5d02cde88 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-armv6plus.hpp @@ -0,0 +1,250 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP +#define BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2009 Phil Endecott +// ARM Code by Phil Endecott, based on other architectures. + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +// From the ARM Architecture Reference Manual for architecture v6: +// +// LDREX{} , [] +// Specifies the destination register for the memory word addressed by +// Specifies the register containing the address. +// +// STREX{} , , [] +// Specifies the destination register for the returned status value. +// 0 if the operation updates memory +// 1 if the operation fails to update memory +// Specifies the register containing the word to be stored to memory. +// Specifies the register containing the address. +// Rd must not be the same register as Rm or Rn. +// +// ARM v7 is like ARM v6 plus: +// There are half-word and byte versions of the LDREX and STREX instructions, +// LDREXH, LDREXB, STREXH and STREXB. +// There are also double-word versions, LDREXD and STREXD. +// (Actually it looks like these are available from version 6k onwards.) +// FIXME these are not yet used; should be mostly a matter of copy-and-paste. +// I think you can supply an immediate offset to the address. +// +// A memory barrier is effected using a "co-processor 15" instruction, +// though a separate assembler mnemonic is available for it in v7. + +namespace boost { +namespace atomics { +namespace detail { + +// "Thumb 1" is a subset of the ARM instruction set that uses a 16-bit encoding. It +// doesn't include all instructions and in particular it doesn't include the co-processor +// instruction used for the memory barrier or the load-locked/store-conditional +// instructions. So, if we're compiling in "Thumb 1" mode, we need to wrap all of our +// asm blocks with code to temporarily change to ARM mode. +// +// You can only change between ARM and Thumb modes when branching using the bx instruction. +// bx takes an address specified in a register. The least significant bit of the address +// indicates the mode, so 1 is added to indicate that the destination code is Thumb. +// A temporary register is needed for the address and is passed as an argument to these +// macros. It must be one of the "low" registers accessible to Thumb code, specified +// using the "l" attribute in the asm statement. +// +// Architecture v7 introduces "Thumb 2", which does include (almost?) all of the ARM +// instruction set. So in v7 we don't need to change to ARM mode; we can write "universal +// assembler" which will assemble to Thumb 2 or ARM code as appropriate. The only thing +// we need to do to make this "universal" assembler mode work is to insert "IT" instructions +// to annotate the conditional instructions. These are ignored in other modes (e.g. v6), +// so they can always be present. + +#if defined(__thumb__) && !defined(__ARM_ARCH_7A__) +// FIXME also other v7 variants. +#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) "adr " #TMPREG ", 1f\n" "bx " #TMPREG "\n" ".arm\n" ".align 4\n" "1: " +#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) "adr " #TMPREG ", 1f + 1\n" "bx " #TMPREG "\n" ".thumb\n" ".align 2\n" "1: " + +#else +// The tmpreg is wasted in this case, which is non-optimal. +#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) +#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) +#endif + +#if defined(__ARM_ARCH_7A__) +// FIXME ditto. +#define BOOST_ATOMIC_ARM_DMB "dmb\n" +#else +#define BOOST_ATOMIC_ARM_DMB "mcr\tp15, 0, r0, c7, c10, 5\n" +#endif + +inline void +arm_barrier(void) +{ + int brtmp; + __asm__ __volatile__ ( + BOOST_ATOMIC_ARM_ASM_START(%0) + BOOST_ATOMIC_ARM_DMB + BOOST_ATOMIC_ARM_ASM_END(%0) + : "=&l" (brtmp) :: "memory" + ); +} + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + case memory_order_consume: + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + platform_fence_before(order); +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + arm_barrier(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +template +inline bool +platform_cmpxchg32(T & expected, T desired, volatile T * ptr) +{ + int success; + int tmp; + __asm__ ( + BOOST_ATOMIC_ARM_ASM_START(%2) + "mov %1, #0\n" // success = 0 + "ldrex %0, %3\n" // expected' = *(&i) + "teq %0, %4\n" // flags = expected'==expected + "ittt eq\n" + "strexeq %2, %5, %3\n" // if (flags.equal) *(&i) = desired, tmp = !OK + "teqeq %2, #0\n" // if (flags.equal) flags = tmp==0 + "moveq %1, #1\n" // if (flags.equal) success = 1 + BOOST_ATOMIC_ARM_ASM_END(%2) + : "=&r" (expected), // %0 + "=&r" (success), // %1 + "=&l" (tmp), // %2 + "+Q" (*ptr) // %3 + : "r" (expected), // %4 + "r" (desired) // %5 + : "cc" + ); + return success; +} + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + atomics::detail::arm_barrier(); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} + +#undef BOOST_ATOMIC_ARM_ASM_START +#undef BOOST_ATOMIC_ARM_ASM_END + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif + diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp new file mode 100644 index 000000000..781e935f1 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-cas.hpp @@ -0,0 +1,155 @@ +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Use the gnu builtin __sync_val_compare_and_swap to build +// atomic operations for 32 bit and smaller. + +#ifndef BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP +#define BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + break; + case memory_order_release: + case memory_order_consume: + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +namespace atomics { +namespace detail { + +inline void +platform_fence_before(memory_order) +{ + /* empty, as compare_and_swap is synchronizing already */ +} + +inline void +platform_fence_after(memory_order) +{ + /* empty, as compare_and_swap is synchronizing already */ +} + +inline void +platform_fence_before_store(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + __sync_synchronize(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_consume: + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __sync_synchronize(); + break; + } +} + +template +inline bool +platform_cmpxchg32_strong(T & expected, T desired, volatile T * ptr) +{ + T found = __sync_val_compare_and_swap(ptr, expected, desired); + bool success = (found == expected); + expected = found; + return success; +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} +} +} + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE (sizeof(long) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_LLONG_LOCK_FREE (sizeof(long long) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_POINTER_LOCK_FREE (sizeof(void *) <= 4 ? 2 : 0) +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp new file mode 100644 index 000000000..dd58aaf31 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-ppc.hpp @@ -0,0 +1,2757 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_PPC_HPP +#define BOOST_ATOMIC_DETAIL_GCC_PPC_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* + Refer to: Motorola: "Programming Environments Manual for 32-Bit + Implementations of the PowerPC Architecture", Appendix E: + "Synchronization Programming Examples" for an explanation of what is + going on here (can be found on the web at various places by the + name "MPCFPE32B.pdf", Google is your friend...) + + Most of the atomic operations map to instructions in a relatively + straight-forward fashion, but "load"s may at first glance appear + a bit strange as they map to: + + lwz %rX, addr + cmpw %rX, %rX + bne- 1f + 1: + + That is, the CPU is forced to perform a branch that "formally" depends + on the value retrieved from memory. This scheme has an overhead of + about 1-2 clock cycles per load, but it allows to map "acquire" to + the "isync" instruction instead of "sync" uniformly and for all type + of atomic operations. Since "isync" has a cost of about 15 clock + cycles, while "sync" hast a cost of about 50 clock cycles, the small + penalty to atomic loads more than compensates for this. + + Byte- and halfword-sized atomic values are realized by encoding the + value to be represented into a word, performing sign/zero extension + as appropriate. This means that after add/sub operations the value + needs fixing up to accurately preserve the wrap-around semantic of + the smaller type. (Nothing special needs to be done for the bit-wise + and the "exchange type" operators as the compiler already sees to + it that values carried in registers are extended appropriately and + everything falls into place naturally). + + The register constraint "b" instructs gcc to use any register + except r0; this is sometimes required because the encoding for + r0 is used to signify "constant zero" in a number of instructions, + making r0 unusable in this place. For simplicity this constraint + is used everywhere since I am to lazy to look this up on a + per-instruction basis, and ppc has enough registers for this not + to pose a problem. +*/ + +namespace boost { +namespace atomics { +namespace detail { + +inline void +ppc_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: +#if defined(__powerpc64__) + __asm__ __volatile__ ("lwsync" ::: "memory"); + break; +#endif + case memory_order_seq_cst: + __asm__ __volatile__ ("sync" ::: "memory"); + default:; + } +} + +inline void +ppc_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("isync"); + case memory_order_consume: + __asm__ __volatile__ ("" ::: "memory"); + default:; + } +} + +inline void +ppc_fence_after_store(memory_order order) +{ + switch(order) { + case memory_order_seq_cst: + __asm__ __volatile__ ("sync"); + default:; + } +} + +} +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::ppc_fence_before(order); + const_cast(v_) = 0; + atomics::detail::ppc_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + uint32_t original; + atomics::detail::ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (1) + : "cr0" + ); + atomics::detail::ppc_fence_after(order); + return original; + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#if defined(__powerpc64__) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +/* Would like to move the slow-path of failed compare_exchange +(that clears the "success" bit) out-of-line. gcc can in +principle do that using ".subsection"/".previous", but Apple's +binutils seemingly does not understand that. Therefore wrap +the "clear" of the flag in a macro and let it remain +in-line for Apple +*/ + +#if !defined(__APPLE__) + +#define BOOST_ATOMIC_ASM_SLOWPATH_CLEAR \ + "9:\n" \ + ".subsection 2\n" \ + "2: addi %1,0,0\n" \ + "b 9b\n" \ + ".previous\n" \ + +#else + +#define BOOST_ATOMIC_ASM_SLOWPATH_CLEAR \ + "b 9f\n" \ + "2: addi %1,0,0\n" \ + "9:\n" \ + +#endif + +namespace boost { +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef int32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "extsb %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "extsb %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef int32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "extsh %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "extsh %1, %1\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m"(v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=&r" (v) + : "m" (v_) + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xffff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "rlwinm %1, %1, 0, 0xffff\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + const_cast(v_) = v; + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + __asm__ __volatile__ ( + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "+b"(v) + : + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "and %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "or %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "xor %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#if defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + const_cast(v_) = v; + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + __asm__ __volatile__ ( + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "+b"(v) + : + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "add %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "sub %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "and %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "or %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "xor %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* pointer types */ + +#if !defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "add %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y2\n" + "sub %1,%0,%3\n" + "stwcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#else + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (v) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v; + __asm__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(v) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type original; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (v) + : "cr0" + ); + ppc_fence_after(order); + return original; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected), "=&b" (success), "+Z"(v_) + : "b" (expected), "b" (desired) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + return success; + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "add %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + value_type original, tmp; + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y2\n" + "sub %1,%0,%3\n" + "stdcx. %1,%y2\n" + "bne- 1b\n" + : "=&b" (original), "=&b" (tmp), "+Z"(v_) + : "b" (v) + : "cc"); + ppc_fence_after(order); + return original; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* generic */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "stw %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "lwz %0, %1\n" + "cmpw %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "lwarx %0,%y1\n" + "stwcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: lwarx %0,%y2\n" + "cmpw %0, %3\n" + "bne- 2f\n" + "stwcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(__powerpc64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "std %1, %0\n" + : "+m" (v_) + : "r" (tmp) + ); + ppc_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp; + __asm__ __volatile__ ( + "ld %0, %1\n" + "cmpd %0, %0\n" + "bne- 1f\n" + "1:\n" + : "=r"(tmp) + : "m"(v_) + : "cr0" + ); + ppc_fence_after(order); + + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0, original; + memcpy(&tmp, &v, sizeof(value_type)); + ppc_fence_before(order); + __asm__ ( + "1:\n" + "ldarx %0,%y1\n" + "stdcx. %2,%y1\n" + "bne- 1b\n" + : "=&b" (original), "+Z"(v_) + : "b" (tmp) + : "cr0" + ); + ppc_fence_after(order); + value_type res; + memcpy(&res, &original, sizeof(value_type)); + return res; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 2f\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + + int success; + ppc_fence_before(success_order); + __asm__( + "0: ldarx %0,%y2\n" + "cmpd %0, %3\n" + "bne- 2f\n" + "stdcx. %4,%y2\n" + "bne- 0b\n" + "addi %1,0,1\n" + "1:" + + BOOST_ATOMIC_ASM_SLOWPATH_CLEAR + : "=&b" (expected_s), "=&b" (success), "+Z"(v_) + : "b" (expected_s), "b" (desired_s) + : "cr0" + ); + if (success) + ppc_fence_after(success_order); + else + ppc_fence_after(failure_order); + memcpy(&expected, &expected_s, sizeof(value_type)); + return success; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; +#endif + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + __asm__ __volatile__ ("isync" ::: "memory"); + break; + case memory_order_release: +#if defined(__powerpc64__) + __asm__ __volatile__ ("lwsync" ::: "memory"); + break; +#endif + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("sync" ::: "memory"); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + break; + default:; + } +} + +} + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp new file mode 100644 index 000000000..ae256d133 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-sparcv9.hpp @@ -0,0 +1,1229 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_SPARC_HPP +#define BOOST_ATOMIC_DETAIL_GCC_SPARC_HPP + +// Copyright (c) 2010 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + /* seq */ + break; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + switch(order) { + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + default:; + } +} + + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +} +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t tmp = 1; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (tmp) + : "r" (&v_), "r" (0) + : "memory" + ); + atomics::detail::platform_fence_after(order); + return tmp; + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_relaxed: + break; + case memory_order_release: + __asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory"); + break; + case memory_order_acquire: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory"); + break; + case memory_order_acq_rel: + __asm__ __volatile__ ("membar #LoadLoad | #LoadStore | #StoreStore" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("membar #Sync" ::: "memory"); + break; + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +namespace atomics { +namespace detail { + +/* integral types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef int32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef int32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + storage_type desired_s = desired; + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" ((storage_type)expected) + : "memory" + ); + desired = desired_s; + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* pointer types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + const_cast(v_) = v; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired) + : "r" (&v_), "r" (expected) + : "memory" + ); + bool success = (desired == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = desired; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp + v, order, memory_order_relaxed)); + return tmp; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, tmp - v, order, memory_order_relaxed)); + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +/* generic types */ + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + platform_fence_after_store(order); + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + do {} while(!compare_exchange_weak(tmp, v, order, memory_order_relaxed)); + return tmp; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + __asm__ ( + "cas [%1], %2, %0" + : "+r" (desired_s) + : "r" (&v_), "r" (expected_s) + : "memory" + ); + bool success = (desired_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &desired_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp b/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp new file mode 100644 index 000000000..0b06e47b6 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/gcc-x86.hpp @@ -0,0 +1,1651 @@ +#ifndef BOOST_ATOMIC_DETAIL_GCC_X86_HPP +#define BOOST_ATOMIC_DETAIL_GCC_X86_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Tim Blechmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(__x86_64__) || defined(__SSE2__) +# define BOOST_ATOMIC_X86_FENCE_INSTR "mfence\n" +#else +# define BOOST_ATOMIC_X86_FENCE_INSTR "lock ; addl $0, (%%esp)\n" +#endif + +#define BOOST_ATOMIC_X86_PAUSE() __asm__ __volatile__ ("pause\n") + +inline void +platform_fence_before(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_load(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + break; + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_acquire: + case memory_order_consume: + break; + case memory_order_release: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* release */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +inline void +platform_fence_after_store(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + case memory_order_release: + break; + case memory_order_acquire: + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + /* acquire */ + break; + case memory_order_consume: + /* consume */ + break; + case memory_order_seq_cst: + __asm__ __volatile__ ("" ::: "memory"); + /* seq */ + break; + default:; + } +} + +} +} + +class atomic_flag +{ +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(0) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + uint32_t v = 1; + atomics::detail::platform_fence_before(order); + __asm__ __volatile__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + atomics::detail::platform_fence_after(order); + return v; + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + if (order == memory_order_seq_cst) { + uint32_t v = 0; + __asm__ __volatile__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + } else { + atomics::detail::platform_fence_before(order); + v_ = 0; + } + } +}; + +} /* namespace boost */ + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 + +#if defined(__x86_64__) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 1 +#endif + +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) + { + case memory_order_relaxed: + break; + case memory_order_release: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_acquire: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_acq_rel: + __asm__ __volatile__ ("" ::: "memory"); + break; + case memory_order_consume: + break; + case memory_order_seq_cst: + __asm__ __volatile__ (BOOST_ATOMIC_X86_FENCE_INSTR ::: "memory"); + break; + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +namespace atomics { +namespace detail { + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddb %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgb %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgb %2, %1" + : "+a" (previous), "+m" (v_) + : "q" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for(; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddw %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgw %0, %1" + : "+q" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgw %2, %1" + : "+a" (previous), "+m" (v_) + : "q" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#if defined(__x86_64__) +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "lock ; xaddq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +/* pointers */ + +#if !defined(__x86_64__) + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + __asm__ ( + "lock ; xaddl %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return reinterpret_cast(v); + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#else + +template +class base_atomic { + typedef base_atomic this_type; + typedef void * value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T * value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous), "+m" (v_) + : "r" (desired) + ); + bool success = (previous == expected); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = previous; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + __asm__ ( + "lock ; xaddq %0, %1" + : "+r" (v), "+m" (v_) + ); + platform_fence_after(order); + return reinterpret_cast(v); + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +#endif + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint8_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgb %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgb %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint16_t storage_type; +public: + explicit base_atomic(value_type const& v) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgw %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s, desired_s; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgw %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgl %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgl %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(__x86_64__) +template +class base_atomic { + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + __asm__ ( + "xchgq %0, %1" + : "+q" (tmp), "+m" (v_) + ); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + storage_type previous_s = expected_s; + platform_fence_before(success_order); + __asm__ ( + "lock ; cmpxchgq %2, %1" + : "+a" (previous_s), "+m" (v_) + : "q" (desired_s) + ); + bool success = (previous_s == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &previous_s, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; +#endif + +#if !defined(__x86_64__) && (defined(__i686__) || defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) + +template +inline bool +platform_cmpxchg64_strong(T & expected, T desired, volatile T * ptr) +{ +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 + const T oldval = __sync_val_compare_and_swap(ptr, expected, desired); + const bool result = (oldval == expected); + expected = oldval; + return result; +#else + int scratch; + T prev = expected; + /* Make sure ebx is saved and restored properly in case + this object is compiled as "position independent". Since + programmers on x86 tend to forget specifying -DPIC or + similar, always assume PIC. + + To make this work uniformly even in the non-PIC case, + setup register constraints such that ebx can not be + used by accident e.g. as base address for the variable + to be modified. Accessing "scratch" should always be okay, + as it can only be placed on the stack (and therefore + accessed through ebp or esp only). + + In theory, could push/pop ebx onto/off the stack, but movs + to a prepared stack slot turn out to be faster. */ + __asm__ __volatile__ ( + "movl %%ebx, %1\n" + "movl %2, %%ebx\n" + "lock; cmpxchg8b 0(%4)\n" + "movl %1, %%ebx\n" + : "=A" (prev), "=m" (scratch) + : "D" ((int)desired), "c" ((int)(desired >> 32)), "S" (ptr), "0" (prev) + : "memory"); + bool success = (prev == expected); + expected = prev; + return success; +#endif +} + +template +inline void +platform_store64(T value, volatile T * ptr) +{ + T expected = *ptr; + for (; !platform_cmpxchg64_strong(expected, value, ptr);) + { + BOOST_ATOMIC_X86_PAUSE(); + } +} + +template +inline T +platform_load64(const volatile T * ptr) +{ + T expected = *ptr; + for (; !platform_cmpxchg64_strong(expected, expected, const_cast(ptr));) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return expected; +} + +#endif + +} +} +} + +/* pull in 64-bit atomic type using cmpxchg8b above */ +#if !defined(__x86_64__) && (defined(__i686__) || defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) +#include +#endif + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp b/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp new file mode 100644 index 000000000..d87c87d71 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/generic-cas.hpp @@ -0,0 +1,199 @@ +#ifndef BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP +#define BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +/* fallback implementation for various compilation targets; +this is *not* efficient, particularly because all operations +are fully fenced (full memory barriers before and after +each operation) */ + +#if defined(__GNUC__) + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(volatile int32_t *ptr, int32_t expected, int32_t desired) + { + return __sync_val_compare_and_swap_4(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + + #if defined(__amd64__) || defined(__i686__) + inline int64_t + fenced_compare_exchange_strong_64(int64_t *ptr, int64_t expected, int64_t desired) + { + return __sync_val_compare_and_swap_8(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif defined(__ICL) || defined(_MSC_VER) + + #if defined(_MSC_VER) + #include + #include + #endif + + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong(int32_t *ptr, int32_t expected, int32_t desired) + { + return _InterlockedCompareExchange(reinterpret_cast(ptr), desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + #if defined(_WIN64) + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return _InterlockedCompareExchange64(ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif (defined(__ICC) || defined(__ECC)) + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(int32_t *ptr, int32_t expected, int32_t desired) + { + return _InterlockedCompareExchange((void*)ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + #if defined(__x86_64) + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return cas64(ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #elif defined(__ECC) //IA-64 version + inline int64_t + fenced_compare_exchange_strong(int64_t *ptr, int64_t expected, int64_t desired) + { + return _InterlockedCompareExchange64((void*)ptr, desired, expected); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + #endif + }}} + +#elif (defined(__SUNPRO_CC) && defined(__sparc)) + #include + namespace boost { namespace atomics { namespace detail { + inline int32_t + fenced_compare_exchange_strong_32(int32_t *ptr, int32_t expected, int32_t desired) + { + return atomic_cas_32((volatile unsigned int*)ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS32 1 + + /* FIXME: check for 64 bit mode */ + inline int64_t + fenced_compare_exchange_strong_64(int64_t *ptr, int64_t expected, int64_t desired) + { + return atomic_cas_64((volatile unsigned long long*)ptr, expected, desired); + } + #define BOOST_ATOMIC_HAVE_CAS64 1 + }}} +#endif + + +namespace boost { +namespace atomics { +namespace detail { + +#ifdef BOOST_ATOMIC_HAVE_CAS32 +template +class atomic_generic_cas32 { +private: + typedef atomic_generic_cas32 this_type; +public: + explicit atomic_generic_cas32(T v) : i((int32_t)v) {} + atomic_generic_cas32() {} + T load(memory_order order=memory_order_seq_cst) const volatile + { + T expected=(T)i; + do { } while(!const_cast(this)->compare_exchange_weak(expected, expected, order, memory_order_relaxed)); + return expected; + } + void store(T v, memory_order order=memory_order_seq_cst) volatile + { + exchange(v); + } + bool compare_exchange_strong( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + T found; + found=(T)fenced_compare_exchange_strong_32(&i, (int32_t)expected, (int32_t)desired); + bool success=(found==expected); + expected=found; + return success; + } + bool compare_exchange_weak( + T &expected, + T desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + T exchange(T r, memory_order order=memory_order_seq_cst) volatile + { + T expected=(T)i; + do { } while(!compare_exchange_weak(expected, r, order, memory_order_relaxed)); + return expected; + } + + bool is_lock_free(void) const volatile {return true;} + typedef T integral_type; +private: + mutable int32_t i; +}; + +template +class platform_atomic_integral : public build_atomic_from_exchange > { +public: + typedef build_atomic_from_exchange > super; + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; + +template +class platform_atomic_integral: public build_atomic_from_larger_type, T> { +public: + typedef build_atomic_from_larger_type, T> super; + + explicit platform_atomic_integral(T v) : super(v) {} + platform_atomic_integral(void) {} +}; +#endif + +} } } + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/interlocked.hpp b/project/jni/boost/include/boost/atomic/detail/interlocked.hpp new file mode 100644 index 000000000..84a71316f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/interlocked.hpp @@ -0,0 +1,206 @@ +#ifndef BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP +#define BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(_WIN32_WCE) + +#include + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest), exchange, compare) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) BOOST_INTERLOCKED_EXCHANGE((long*)(dest), newval) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) BOOST_INTERLOCKED_EXCHANGE_ADD((long*)(dest), addend) +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) BOOST_INTERLOCKED_EXCHANGE_POINTER(dest, newval) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset)) + +#elif defined(_MSC_VER) + +#include + +#pragma intrinsic(_InterlockedCompareExchange) +#pragma intrinsic(_InterlockedExchangeAdd) +#pragma intrinsic(_InterlockedExchange) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval)) + +#if _MSC_VER >= 1400 + +#pragma intrinsic(_InterlockedAnd) +#pragma intrinsic(_InterlockedOr) +#pragma intrinsic(_InterlockedXor) + +#define BOOST_ATOMIC_INTERLOCKED_AND(dest, arg) _InterlockedAnd((long*)(dest), (long)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR(dest, arg) _InterlockedOr((long*)(dest), (long)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR(dest, arg) _InterlockedXor((long*)(dest), (long)(arg)) + +#endif // _MSC_VER >= 1400 + +#if _MSC_VER >= 1600 + +// MSVC 2010 and later provide intrinsics for 8 and 16 bit integers. +// Note that for each bit count these macros must be either all defined or all not defined. +// Otherwise atomic<> operations will be implemented inconsistently. + +#pragma intrinsic(_InterlockedCompareExchange8) +#pragma intrinsic(_InterlockedExchangeAdd8) +#pragma intrinsic(_InterlockedExchange8) +#pragma intrinsic(_InterlockedAnd8) +#pragma intrinsic(_InterlockedOr8) +#pragma intrinsic(_InterlockedXor8) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(dest, exchange, compare) _InterlockedCompareExchange8((char*)(dest), (char)(exchange), (char)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(dest, addend) _InterlockedExchangeAdd8((char*)(dest), (char)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(dest, newval) _InterlockedExchange8((char*)(dest), (char)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND8(dest, arg) _InterlockedAnd8((char*)(dest), (char)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR8(dest, arg) _InterlockedOr8((char*)(dest), (char)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR8(dest, arg) _InterlockedXor8((char*)(dest), (char)(arg)) + +#pragma intrinsic(_InterlockedCompareExchange16) +#pragma intrinsic(_InterlockedExchangeAdd16) +#pragma intrinsic(_InterlockedExchange16) +#pragma intrinsic(_InterlockedAnd16) +#pragma intrinsic(_InterlockedOr16) +#pragma intrinsic(_InterlockedXor16) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(dest, exchange, compare) _InterlockedCompareExchange16((short*)(dest), (short)(exchange), (short)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(dest, addend) _InterlockedExchangeAdd16((short*)(dest), (short)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(dest, newval) _InterlockedExchange16((short*)(dest), (short)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND16(dest, arg) _InterlockedAnd16((short*)(dest), (short)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR16(dest, arg) _InterlockedOr16((short*)(dest), (short)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR16(dest, arg) _InterlockedXor16((short*)(dest), (short)(arg)) + +#endif // _MSC_VER >= 1600 + +#if defined(_M_AMD64) || defined(_M_IA64) + +#pragma intrinsic(_InterlockedCompareExchange64) +#pragma intrinsic(_InterlockedExchangeAdd64) +#pragma intrinsic(_InterlockedExchange64) +#pragma intrinsic(_InterlockedAnd64) +#pragma intrinsic(_InterlockedOr64) +#pragma intrinsic(_InterlockedXor64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) _InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) _InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) _InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_AND64(dest, arg) _InterlockedAnd64((__int64*)(dest), (__int64)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_OR64(dest, arg) _InterlockedOr64((__int64*)(dest), (__int64)(arg)) +#define BOOST_ATOMIC_INTERLOCKED_XOR64(dest, arg) _InterlockedXor64((__int64*)(dest), (__int64)(arg)) + +#pragma intrinsic(_InterlockedCompareExchangePointer) +#pragma intrinsic(_InterlockedExchangePointer) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) _InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) _InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64((long*)(dest), byte_offset)) + +#else // defined(_M_AMD64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)_InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)_InterlockedExchange((long*)(dest), (long)(newval))) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset)) + +#endif // defined(_M_AMD64) + +#else // defined(_MSC_VER) + +#if defined(BOOST_USE_WINDOWS_H) + +#include + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) InterlockedExchange((long*)(dest), (long)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) InterlockedExchangeAdd((long*)(dest), (long)(addend)) + +#if defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset)) + +#else // defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset)) + +#endif // defined(_WIN64) + +#else // defined(BOOST_USE_WINDOWS_H) + +#if defined(__MINGW64__) +#define BOOST_ATOMIC_INTERLOCKED_IMPORT +#else +#define BOOST_ATOMIC_INTERLOCKED_IMPORT __declspec(dllimport) +#endif + +namespace boost { +namespace atomics { +namespace detail { + +extern "C" { + +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange(long volatile*, long, long); +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchange(long volatile*, long); +BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd(long volatile*, long); + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) boost::atomics::detail::InterlockedExchange((long*)(dest), (long)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) boost::atomics::detail::InterlockedExchangeAdd((long*)(dest), (long)(addend)) + +#if defined(_WIN64) + +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedCompareExchange64(__int64 volatile*, __int64, __int64); +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchange64(__int64 volatile*, __int64); +BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchangeAdd64(__int64 volatile*, __int64); + +BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer(void* volatile *, void*, void*); +BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer(void* volatile *, void*); + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) boost::atomics::detail::InterlockedExchange64((__int64*)(dest), (__int64)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) boost::atomics::detail::InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend)) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) boost::atomics::detail::InterlockedExchangePointer((void**)(dest), (void*)(newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset)) + +#else // defined(_WIN64) + +#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset)) + +#endif // defined(_WIN64) + +} // extern "C" + +} // namespace detail +} // namespace atomics +} // namespace boost + +#undef BOOST_ATOMIC_INTERLOCKED_IMPORT + +#endif // defined(BOOST_USE_WINDOWS_H) + +#endif // defined(_MSC_VER) + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp b/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp new file mode 100644 index 000000000..9831d81e8 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/linux-arm.hpp @@ -0,0 +1,187 @@ +#ifndef BOOST_ATOMIC_DETAIL_LINUX_ARM_HPP +#define BOOST_ATOMIC_DETAIL_LINUX_ARM_HPP + +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Copyright (c) 2009, 2011 Helge Bahmann +// Copyright (c) 2009 Phil Endecott +// Linux-specific code by Phil Endecott + +// Different ARM processors have different atomic instructions. In particular, +// architecture versions before v6 (which are still in widespread use, e.g. the +// Intel/Marvell XScale chips like the one in the NSLU2) have only atomic swap. +// On Linux the kernel provides some support that lets us abstract away from +// these differences: it provides emulated CAS and barrier functions at special +// addresses that are guaranteed not to be interrupted by the kernel. Using +// this facility is slightly slower than inline assembler would be, but much +// faster than a system call. +// +// While this emulated CAS is "strong" in the sense that it does not fail +// "spuriously" (i.e.: it never fails to perform the exchange when the value +// found equals the value expected), it does not return the found value on +// failure. To satisfy the atomic API, compare_exchange_{weak|strong} must +// return the found value on failure, and we have to manually load this value +// after the emulated CAS reports failure. This in turn introduces a race +// between the CAS failing (due to the "wrong" value being found) and subsequently +// loading (which might turn up the "right" value). From an application's +// point of view this looks like "spurious failure", and therefore the +// emulated CAS is only good enough to provide compare_exchange_weak +// semantics. + +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +inline void +arm_barrier(void) +{ + void (*kernel_dmb)(void) = (void (*)(void)) 0xffff0fa0; + kernel_dmb(); +} + +inline void +platform_fence_before(memory_order order) +{ + switch(order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + case memory_order_consume: + default:; + } +} + +inline void +platform_fence_after(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + arm_barrier(); + default:; + } +} + +inline void +platform_fence_before_store(memory_order order) +{ + platform_fence_before(order); +} + +inline void +platform_fence_after_store(memory_order order) +{ + if (order == memory_order_seq_cst) + arm_barrier(); +} + +inline void +platform_fence_after_load(memory_order order) +{ + platform_fence_after(order); +} + +template +inline bool +platform_cmpxchg32(T & expected, T desired, volatile T * ptr) +{ + typedef T (*kernel_cmpxchg32_t)(T oldval, T newval, volatile T * ptr); + + if (((kernel_cmpxchg32_t) 0xffff0fc0)(expected, desired, ptr) == 0) { + return true; + } else { + expected = *ptr; + return false; + } +} + +} +} + +#define BOOST_ATOMIC_THREAD_FENCE 2 +inline void +atomic_thread_fence(memory_order order) +{ + switch(order) { + case memory_order_acquire: + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + atomics::detail::arm_barrier(); + default:; + } +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +inline void +atomic_signal_fence(memory_order) +{ + __asm__ __volatile__ ("" ::: "memory"); +} + +class atomic_flag { +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(false) {} + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + const_cast(v_) = 0; + atomics::detail::platform_fence_after_store(order); + } + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + uint32_t expected = v_; + do { + if (expected == 1) + break; + } while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_)); + atomics::detail::platform_fence_after(order); + return expected; + } +}; +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +} + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +#include + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/lockpool.hpp b/project/jni/boost/include/boost/atomic/detail/lockpool.hpp new file mode 100644 index 000000000..ea96cd299 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/lockpool.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP +#define BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE +#include +#endif + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE + +class lockpool +{ +public: + typedef mutex lock_type; + class scoped_lock + { + private: + lock_type& mtx_; + + scoped_lock(scoped_lock const&) /* = delete */; + scoped_lock& operator=(scoped_lock const&) /* = delete */; + + public: + explicit + scoped_lock(const volatile void * addr) : mtx_(get_lock_for(addr)) + { + mtx_.lock(); + } + ~scoped_lock() + { + mtx_.unlock(); + } + }; + +private: + static BOOST_ATOMIC_DECL lock_type& get_lock_for(const volatile void * addr); +}; + +#else + +class lockpool +{ +public: + typedef atomic_flag lock_type; + + class scoped_lock + { + private: + atomic_flag& flag_; + + scoped_lock(const scoped_lock &) /* = delete */; + scoped_lock& operator=(const scoped_lock &) /* = delete */; + + public: + explicit + scoped_lock(const volatile void * addr) : flag_(get_lock_for(addr)) + { + for (; flag_.test_and_set(memory_order_acquire);) + { +#if defined(BOOST_ATOMIC_X86_PAUSE) + BOOST_ATOMIC_X86_PAUSE(); +#endif + } + } + + ~scoped_lock(void) + { + flag_.clear(memory_order_release); + } + }; + +private: + static BOOST_ATOMIC_DECL lock_type& get_lock_for(const volatile void * addr); +}; + +#endif + +} +} +} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/platform.hpp b/project/jni/boost/include/boost/atomic/detail/platform.hpp new file mode 100644 index 000000000..a31ececad --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/platform.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_ATOMIC_DETAIL_PLATFORM_HPP +#define BOOST_ATOMIC_DETAIL_PLATFORM_HPP + +// Copyright (c) 2009 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Platform selection file + +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + + #include + +#elif 0 && defined(__GNUC__) && defined(__alpha__) /* currently does not work correctly */ + + #include + #include + +#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__)) + + #include + +// This list of ARM architecture versions comes from Apple's arm/arch.h header. +// I don't know how complete it is. +#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_7A__)) + + #include + +#elif defined(__linux__) && defined(__arm__) + + #include + +#elif defined(__GNUC__) && defined(__sparc_v9__) + + #include + +#elif defined(BOOST_WINDOWS) || defined(_WIN32_CE) + + #include + +#elif 0 && defined(__GNUC__) /* currently does not work correctly */ + + #include + #include + +#else + +#include + +#endif + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/type-classification.hpp b/project/jni/boost/include/boost/atomic/detail/type-classification.hpp new file mode 100644 index 000000000..f7c2f8bf8 --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/type-classification.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ATOMIC_DETAIL_TYPE_CLASSIFICATION_HPP +#define BOOST_ATOMIC_DETAIL_TYPE_CLASSIFICATION_HPP + +// Copyright (c) 2011 Helge Bahmann +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +template::value> +struct classify +{ + typedef void type; +}; + +template +struct classify {typedef int type;}; + +template +struct classify {typedef void* type;}; + +template +struct storage_size_of +{ + enum _ + { + size = sizeof(T), + value = (size == 3 ? 4 : (size == 5 || size == 6 || size == 7 ? 8 : size)) + }; +}; + +}}} + +#endif diff --git a/project/jni/boost/include/boost/atomic/detail/windows.hpp b/project/jni/boost/include/boost/atomic/detail/windows.hpp new file mode 100644 index 000000000..4c401ae6f --- /dev/null +++ b/project/jni/boost/include/boost/atomic/detail/windows.hpp @@ -0,0 +1,1441 @@ +#ifndef BOOST_ATOMIC_DETAIL_WINDOWS_HPP +#define BOOST_ATOMIC_DETAIL_WINDOWS_HPP + +// Copyright (c) 2009 Helge Bahmann +// Copyright (c) 2012 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include + +#ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE +#pragma once +#endif + +#ifdef _MSC_VER +#pragma warning(push) +// 'order' : unreferenced formal parameter +#pragma warning(disable: 4100) +#endif + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) +extern "C" void _mm_pause(void); +#pragma intrinsic(_mm_pause) +#define BOOST_ATOMIC_X86_PAUSE() _mm_pause() +#else +#define BOOST_ATOMIC_X86_PAUSE() +#endif + +// Define hardware barriers +#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +extern "C" void _mm_mfence(void); +#pragma intrinsic(_mm_mfence) +#endif + +BOOST_FORCEINLINE void hardware_full_fence(void) +{ +#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) + // Use mfence only if SSE2 is available + _mm_mfence(); +#else + long tmp; + BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&tmp, 0); +#endif +} + +// Define compiler barriers +#if defined(_MSC_VER) && _MSC_VER >= 1310 && !defined(_WIN32_WCE) +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic(_ReadWriteBarrier) +#define BOOST_ATOMIC_READ_WRITE_BARRIER() _ReadWriteBarrier() +#endif + +#ifndef BOOST_ATOMIC_READ_WRITE_BARRIER +#define BOOST_ATOMIC_READ_WRITE_BARRIER() +#endif + +BOOST_FORCEINLINE void +platform_fence_before(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_before_store(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after_store(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +BOOST_FORCEINLINE void +platform_fence_after_load(memory_order order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); + + // On x86 and x86_64 there is no need for a hardware barrier, + // even if seq_cst memory order is requested, because all + // seq_cst writes are implemented with lock-prefixed operations + // or xchg which has implied lock prefix. Therefore normal loads + // are already ordered with seq_cst stores on these architectures. + +#if !(defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))) + if (order == memory_order_seq_cst) + hardware_full_fence(); +#endif +} + +} // namespace detail +} // namespace atomics + +#define BOOST_ATOMIC_THREAD_FENCE 2 +BOOST_FORCEINLINE void +atomic_thread_fence(memory_order order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); + if (order == memory_order_seq_cst) + atomics::detail::hardware_full_fence(); +} + +#define BOOST_ATOMIC_SIGNAL_FENCE 2 +BOOST_FORCEINLINE void +atomic_signal_fence(memory_order) +{ + BOOST_ATOMIC_READ_WRITE_BARRIER(); +} + +#undef BOOST_ATOMIC_READ_WRITE_BARRIER + +class atomic_flag +{ +private: + atomic_flag(const atomic_flag &) /* = delete */ ; + atomic_flag & operator=(const atomic_flag &) /* = delete */ ; + uint32_t v_; +public: + atomic_flag(void) : v_(0) {} + + bool + test_and_set(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before(order); + const uint32_t old = (uint32_t)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, 1); + atomics::detail::platform_fence_after(order); + return old != 0; + } + + void + clear(memory_order order = memory_order_seq_cst) volatile + { + atomics::detail::platform_fence_before_store(order); + BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, 0); + atomics::detail::platform_fence_after_store(order); + } +}; + +} // namespace boost + +#define BOOST_ATOMIC_FLAG_LOCK_FREE 2 + +#include + +#if !defined(BOOST_ATOMIC_FORCE_FALLBACK) + +#define BOOST_ATOMIC_CHAR_LOCK_FREE 2 +#define BOOST_ATOMIC_SHORT_LOCK_FREE 2 +#define BOOST_ATOMIC_INT_LOCK_FREE 2 +#define BOOST_ATOMIC_LONG_LOCK_FREE 2 +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) +#define BOOST_ATOMIC_LLONG_LOCK_FREE 2 +#else +#define BOOST_ATOMIC_LLONG_LOCK_FREE 0 +#endif +#define BOOST_ATOMIC_POINTER_LOCK_FREE 2 +#define BOOST_ATOMIC_BOOL_LOCK_FREE 2 + +namespace boost { +namespace atomics { +namespace detail { + +#if defined(_MSC_VER) +#pragma warning(push) +// 'char' : forcing value to bool 'true' or 'false' (performance warning) +#pragma warning(disable: 4800) +#endif + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + typedef value_type storage_type; +#else + typedef uint32_t storage_type; +#endif + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE8 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&v_, desired, previous)); +#else + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); +#endif + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_AND8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_OR8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_XOR8 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR8(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + typedef value_type storage_type; +#else + typedef uint32_t storage_type; +#endif + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE16 + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&v_, v)); +#else + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); +#endif + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&v_, desired, previous)); +#else + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); +#endif + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_AND16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_OR16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#ifdef BOOST_ATOMIC_INTERLOCKED_XOR16 + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR16(&v_, v)); + platform_fence_after(order); + return v; +#elif defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef value_type storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&v_, v)); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, v)); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired, previous)); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_AND) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_OR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for(; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_XOR) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef value_type storage_type; + typedef T difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + v_ = static_cast< storage_type >(v); + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = static_cast< value_type >(v_); + platform_fence_after_load(order); + return v; + } + + value_type + fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(&v_, v)); + platform_fence_after(order); + return v; + } + + value_type + fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile + { + typedef typename make_signed< value_type >::type signed_value_type; + return fetch_add(static_cast< value_type >(-static_cast< signed_value_type >(v)), order); + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&v_, v)); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&v_, desired, previous)); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_AND64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_AND64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp & v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_OR64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_OR64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp | v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + value_type + fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile + { +#if defined(BOOST_ATOMIC_INTERLOCKED_XOR64) + platform_fence_before(order); + v = static_cast< value_type >(BOOST_ATOMIC_INTERLOCKED_XOR64(&v_, v)); + platform_fence_after(order); + return v; +#else + value_type tmp = load(memory_order_relaxed); + for (; !compare_exchange_weak(tmp, tmp ^ v, order, memory_order_relaxed);) + { + BOOST_ATOMIC_X86_PAUSE(); + } + return tmp; +#endif + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif // defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +// MSVC 2012 fails to recognize sizeof(T) as a constant expression in template specializations +enum msvc_sizeof_pointer_workaround { sizeof_pointer = sizeof(void*) }; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef void* value_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(&v_, v); + platform_fence_after(order); + return v; + } + + bool compare_exchange_strong(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = (value_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&v_, desired, previous); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool compare_exchange_weak(value_type & expected, value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T* value_type; + typedef ptrdiff_t difference_type; +public: + explicit base_atomic(value_type v) : v_(v) {} + base_atomic(void) {} + + void + store(value_type v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + platform_fence_before(order); + const_cast(v_) = v; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + value_type v = const_cast(v_); + platform_fence_after_load(order); + return v; + } + + value_type + exchange(value_type v, memory_order order = memory_order_seq_cst) volatile + { + platform_fence_before(order); + v = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(&v_, v); + platform_fence_after(order); + return v; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + value_type previous = expected; + platform_fence_before(success_order); + value_type oldval = (value_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&v_, desired, previous); + bool success = (previous == oldval); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + expected = oldval; + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + value_type + fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + v = v * sizeof(*v_); + platform_fence_before(order); + value_type res = (value_type)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(&v_, v); + platform_fence_after(order); + return res; + } + + value_type + fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile + { + return fetch_add(-v, order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_POINTER_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + value_type v_; +}; + + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + typedef uint8_t storage_type; +#else + typedef uint32_t storage_type; +#endif +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE8 + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&v_, tmp)); +#else + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); +#endif + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8 + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&v_, desired_s, expected_s)); +#else + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); +#endif + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + typedef uint16_t storage_type; +#else + typedef uint32_t storage_type; +#endif +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); +#ifdef BOOST_ATOMIC_INTERLOCKED_EXCHANGE16 + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&v_, tmp)); +#else + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); +#endif + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); +#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16 + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&v_, desired_s, expected_s)); +#else + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); +#endif + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef uint32_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&v_, tmp)); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&v_, desired_s, expected_s)); + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +template +class base_atomic +{ + typedef base_atomic this_type; + typedef T value_type; + typedef uint64_t storage_type; +public: + explicit base_atomic(value_type const& v) : v_(0) + { + memcpy(&v_, &v, sizeof(value_type)); + } + base_atomic(void) {} + + void + store(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + if (order != memory_order_seq_cst) { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + const_cast(v_) = tmp; + } else { + exchange(v, order); + } + } + + value_type + load(memory_order order = memory_order_seq_cst) const volatile + { + storage_type tmp = const_cast(v_); + platform_fence_after_load(order); + value_type v; + memcpy(&v, &tmp, sizeof(value_type)); + return v; + } + + value_type + exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile + { + storage_type tmp = 0; + memcpy(&tmp, &v, sizeof(value_type)); + platform_fence_before(order); + tmp = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&v_, tmp)); + platform_fence_after(order); + value_type res; + memcpy(&res, &tmp, sizeof(value_type)); + return res; + } + + bool + compare_exchange_strong( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + storage_type expected_s = 0, desired_s = 0; + memcpy(&expected_s, &expected, sizeof(value_type)); + memcpy(&desired_s, &desired, sizeof(value_type)); + platform_fence_before(success_order); + storage_type oldval = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&v_, desired_s, expected_s)); + bool success = (oldval == expected_s); + if (success) + platform_fence_after(success_order); + else + platform_fence_after(failure_order); + memcpy(&expected, &oldval, sizeof(value_type)); + return success; + } + + bool + compare_exchange_weak( + value_type & expected, + value_type const& desired, + memory_order success_order, + memory_order failure_order) volatile + { + return compare_exchange_strong(expected, desired, success_order, failure_order); + } + + bool + is_lock_free(void) const volatile + { + return true; + } + + BOOST_ATOMIC_DECLARE_BASE_OPERATORS +private: + base_atomic(const base_atomic &) /* = delete */ ; + void operator=(const base_atomic &) /* = delete */ ; + storage_type v_; +}; + +#endif // defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) + +} // namespace detail +} // namespace atomics +} // namespace boost + +#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */ + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif diff --git a/project/jni/boost/include/boost/bimap/bimap.hpp b/project/jni/boost/include/boost/bimap/bimap.hpp index 3021b04ff..2929ce58e 100644 --- a/project/jni/boost/include/boost/bimap/bimap.hpp +++ b/project/jni/boost/include/boost/bimap/bimap.hpp @@ -166,28 +166,37 @@ class bimap /* // The rest is computed in the core, because it is quite difficult to // expose a nice interface with so many metaprogramming stuff. - // Here it is the complete metadat list. - + // Map by {side} metadata typedef -unspecified- {side}_tag; typedef -unspecified- {side}_data_type; typedef -unspecified- {side}_value_type; typedef -unspecified- {side}_key_type; - typedef -unspecified- {side}_iterator; - typedef -unspecified- {side}_const_iterator; - + + // There are other typedefs for definitions of different map views + ------------------------------------------------------------------*/ typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail:: left_map_view_type::type left_map; typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail:: right_map_view_type::type right_map; + + typedef BOOST_DEDUCED_TYPENAME + left_map::iterator left_iterator; + typedef BOOST_DEDUCED_TYPENAME + left_map::const_iterator left_const_iterator; typedef BOOST_DEDUCED_TYPENAME - left_map::reference left_reference; + right_map::iterator right_iterator; typedef BOOST_DEDUCED_TYPENAME - left_map::const_reference left_const_reference; + right_map::const_iterator right_const_iterator; + + typedef BOOST_DEDUCED_TYPENAME + left_map::reference left_reference; + typedef BOOST_DEDUCED_TYPENAME + left_map::const_reference left_const_reference; typedef BOOST_DEDUCED_TYPENAME right_map::reference right_reference; @@ -239,16 +248,19 @@ class bimap const allocator_type& al = allocator_type()) : base_::relation_set( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core) ), core(first,last,ctor_args_list(),al), left ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core) ), right ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core) ) {} @@ -256,16 +268,19 @@ class bimap bimap(const bimap& x) : base_::relation_set( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core) ), core(x.core), left ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core) ), right ( - ::boost::multi_index::get(core) + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core) ) {} @@ -279,32 +294,28 @@ class bimap // Projection of iterators template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::left_iterator - project_left(IteratorType iter) + left_iterator project_left(IteratorType iter) { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::left_const_iterator - project_left(IteratorType iter) const + left_const_iterator project_left(IteratorType iter) const { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::right_iterator - project_right(IteratorType iter) + right_iterator project_right(IteratorType iter) { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base()); } template< class IteratorType > - BOOST_DEDUCED_TYPENAME base_::right_const_iterator - project_right(IteratorType iter) const + right_const_iterator project_right(IteratorType iter) const { return core.template project< BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base()); @@ -382,7 +393,7 @@ class bimap friend class boost::serialization::access; template - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & serialization::make_nvp("mi_core",core); } diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp index ff7a5407a..e4fd52df7 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/list_map_adaptor.hpp @@ -134,6 +134,7 @@ class list_map_adaptor : typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type key_type; typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; protected: diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp index f1a6f64d2..3df1a03cb 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/map_adaptor.hpp @@ -82,6 +82,7 @@ class map_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp index ad5edf2bb..f39899ea0 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/multimap_adaptor.hpp @@ -81,6 +81,7 @@ class multimap_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp index 762a643c2..fd233e8e2 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_map_adaptor.hpp @@ -82,6 +82,7 @@ class unordered_map_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp index be28b3adf..104d19796 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp @@ -81,6 +81,7 @@ class unordered_multimap_adaptor : public: typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp index de6e391c9..87d41726e 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/vector_adaptor.hpp @@ -109,25 +109,33 @@ class vector_adaptor : BOOST_DEDUCED_TYPENAME base_::const_reference operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const { - return this->base().operator[](n); + return this->template functor()( + this->base().operator[](n) + ); } BOOST_DEDUCED_TYPENAME base_::const_reference at(BOOST_DEDUCED_TYPENAME base_::size_type n) const { - return this->base().at(n); + return this->template functor()( + this->base().at(n) + ); } BOOST_DEDUCED_TYPENAME base_::reference operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) { - return this->base().operator[](n); + return this->template functor()( + this->base().operator[](n) + ); } BOOST_DEDUCED_TYPENAME base_::reference at(BOOST_DEDUCED_TYPENAME base_::size_type n) { - return this->base().at(n); + return this->template functor()( + this->base().at(n) + ); } }; diff --git a/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp b/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp index 9b0b9d3df..1d49ac7c6 100644 --- a/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp +++ b/project/jni/boost/include/boost/bimap/container_adaptor/vector_map_adaptor.hpp @@ -77,6 +77,7 @@ class vector_map_adaptor : typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type key_type; typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; + typedef data_type mapped_type; // Access ----------------------------------------------------------------- diff --git a/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp b/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp index f37d96810..28a91a463 100644 --- a/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp +++ b/project/jni/boost/include/boost/bimap/detail/bimap_core.hpp @@ -425,50 +425,6 @@ class bimap_core typedef BOOST_DEDUCED_TYPENAME right_index::iterator right_core_iterator; typedef BOOST_DEDUCED_TYPENAME right_index::const_iterator right_core_const_iterator; - // Map by {side} iterator metadata - // -------------------------------------------------------------------- - public: - - //@{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - left_tag, - relation, - left_core_iterator - - > left_iterator; - - typedef ::boost::bimaps::detail::map_view_iterator - < - right_tag, - relation, - right_core_iterator - - > right_iterator; - - //@} - - //@{ - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - left_tag, - relation, - left_core_const_iterator - - > left_const_iterator; - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - right_tag, - relation, - right_core_const_iterator - - > right_const_iterator; - - //@} - // Relation set view typedef BOOST_DEDUCED_TYPENAME ::boost::multi_index::index @@ -513,6 +469,7 @@ struct right_map_view_type >::type type; }; + } // namespace detail } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp b/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp index 7900901bf..51059c38c 100644 --- a/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp +++ b/project/jni/boost/include/boost/bimap/detail/map_view_base.hpp @@ -31,12 +31,13 @@ #include #include #include -#include +//#include #include #include #include #include #include +#include namespace boost { namespace bimaps { @@ -47,27 +48,20 @@ namespace detail { // The next macro can be converted in a metafunctor to gain code robustness. /*===========================================================================*/ #define BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( \ - CONTAINER_ADAPTOR, TAG,BIMAP, OTHER_ITER, CONST_OTHER_ITER \ + CONTAINER_ADAPTOR, TAG, BIMAP, OTHER_ITER, CONST_OTHER_ITER \ ) \ ::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \ < \ BOOST_DEDUCED_TYPENAME BIMAP::core_type:: \ BOOST_NESTED_TEMPLATE index::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - OTHER_ITER::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - CONST_OTHER_ITER::type, \ + ::boost::bimaps::detail:: map_view_iterator, \ + ::boost::bimaps::detail::const_map_view_iterator, \ + ::boost::bimaps::detail:: OTHER_ITER, \ + ::boost::bimaps::detail::CONST_OTHER_ITER, \ ::boost::bimaps::container_adaptor::support::iterator_facade_to_base \ < \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by::type \ - \ + ::boost::bimaps::detail:: map_view_iterator, \ + ::boost::bimaps::detail::const_map_view_iterator \ >, \ ::boost::mpl::na, \ ::boost::mpl::na, \ @@ -102,13 +96,8 @@ class map_view_base { typedef ::boost::bimaps::container_adaptor::support:: iterator_facade_to_base< - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type - + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail::const_map_view_iterator > iterator_to_base_; typedef ::boost::bimaps::relation::detail:: @@ -125,8 +114,8 @@ class map_view_base pair_type_by::type value_type_; - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator_; + typedef + ::boost::bimaps::detail::map_view_iterator iterator_; public: @@ -144,7 +133,8 @@ class map_view_base return derived().base().replace( derived().template functor()(position), derived().template functor()( - value_type_(k,position->second) + ::boost::bimaps::relation::detail:: + copy_with_first_replaced(*position,k) ) ); } @@ -155,7 +145,8 @@ class map_view_base return derived().base().replace( derived().template functor()(position), derived().template functor()( - value_type_(position->first,d) + ::boost::bimaps::relation::detail:: + copy_with_second_replaced(*position,d) ) ); } @@ -263,8 +254,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & at(const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator iterator; iterator iter = derived().find(k); if( iter == derived().end() ) @@ -279,8 +270,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -295,8 +286,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & operator[](const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator iterator; typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: value_type_by::type value_type; @@ -341,8 +332,8 @@ class non_mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -355,7 +346,7 @@ class non_mutable_data_unique_map_view_access } template< class CompatibleKey > - data_type_ & operator[](const CompatibleKey& k) + data_type_ & operator[](const CompatibleKey&) { BOOST_BIMAP_STATIC_ERROR( OPERATOR_BRACKET_IS_NOT_SUPPORTED, (Derived)); } @@ -493,7 +484,7 @@ void assign(BOOST_DEDUCED_TYPENAME BASE::size_type n, \ const BOOST_DEDUCED_TYPENAME BASE::value_type& v) \ { \ this->clear(); \ - for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++n) \ + for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++i) \ { \ this->push_back(v); \ } \ diff --git a/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp b/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp index adc8d7c86..c796a7015 100644 --- a/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp +++ b/project/jni/boost/include/boost/bimap/detail/map_view_iterator.hpp @@ -19,55 +19,110 @@ #include // Boost -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION + #include #include #include +// check +#include +#include + namespace boost { namespace bimaps { namespace detail { +/** \brief Map View Iterator adaptors from multi index to bimap. + +These classes are based on transform iterators from Boost.Iterator. + **/ + +template< class Tag, class BimapCore > struct map_view_iterator ; +template< class Tag, class BimapCore > struct const_map_view_iterator ; + +template< class Tag, class BimapCore > struct reverse_map_view_iterator ; +template< class Tag, class BimapCore > struct const_reverse_map_view_iterator ; + +template< class Tag, class BimapCore > struct local_map_view_iterator ; +template< class Tag, class BimapCore > struct const_local_map_view_iterator ; + + #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES -template< class Tag, class Relation, class CoreIterator > struct map_view_iterator; +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION +/*===========================================================================*/ +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT \ + BOOST_SERIALIZATION_SPLIT_MEMBER() \ + \ + friend class ::boost::serialization::access; \ + \ + template< class Archive > \ + void save(Archive & ar, const unsigned int) const \ + { \ + ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); \ + } \ + \ + template< class Archive > \ + void load(Archive & ar, const unsigned int) \ + { \ + BOOST_DEDUCED_TYPENAME base_::base_type iter; \ + ar >> ::boost::serialization::make_nvp("mi_iterator",iter); \ + this->base_reference() = iter; \ + } +/*===========================================================================*/ +#else +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT // None +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator_base -{ - typedef iterator_adaptor - < - map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by::type +/*===========================================================================*/ +#define BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( METANAME, ITERATOR ) \ +BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( METANAME, BimapCore, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index \ + ::type::ITERATOR type, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index \ + ::type::ITERATOR type \ +) +/*===========================================================================*/ + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( core_iterator_type_by + , iterator ) + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( reverse_core_iterator_type_by + , reverse_iterator ) + +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( local_core_iterator_type_by + , local_iterator ) + + +// map_view_iterator + +template< class Tag, class BimapCore > +struct map_view_iterator_adaptor { + typedef iterator_adaptor< + map_view_iterator, + BOOST_DEDUCED_TYPENAME core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type > type; }; - -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - -/** \brief Map View Iterator adaptor from multi index to bimap. - -This is class is based on transform iterator from Boost.Iterator that is -modified to allow serialization. It has been specialized for this -library, and EBO optimization was applied to the functor. - - **/ - -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator : public map_view_iterator_base::type +template< class Tag, class BimapCore > +struct map_view_iterator : + public map_view_iterator_adaptor::type { - typedef BOOST_DEDUCED_TYPENAME - map_view_iterator_base::type base_; - + typedef BOOST_DEDUCED_TYPENAME + map_view_iterator_adaptor::type base_; public: map_view_iterator() {} - - map_view_iterator(CoreIterator const& iter) + map_view_iterator(BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - map_view_iterator(map_view_iterator const & iter) : base_(iter.base()) {} @@ -79,118 +134,204 @@ struct map_view_iterator : public map_view_iterator_base - void save(Archive & ar, const unsigned int version) const - { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); - } - - template< class Archive > - void load(Archive & ar, const unsigned int version) - { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; - } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; -#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - -template< class Tag, class Relation, class CoreIterator > struct const_map_view_iterator; - -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator_base -{ - typedef iterator_adaptor - < - const_map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by::type - +template< class Tag, class BimapCore > +struct const_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_map_view_iterator, + BOOST_DEDUCED_TYPENAME core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type > type; }; - -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - - -/** \brief Const Map View Iterator adaptor from multi index to bimap. - -See also map_view_iterator. - **/ - -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator : - - public const_map_view_iterator_base::type +template< class Tag, class BimapCore > +struct const_map_view_iterator : + public const_map_view_iterator_adaptor::type { - typedef BOOST_DEDUCED_TYPENAME - const_map_view_iterator_base::type base_; - + typedef BOOST_DEDUCED_TYPENAME + const_map_view_iterator_adaptor::type base_; public: const_map_view_iterator() {} - - const_map_view_iterator(CoreIterator const& iter) + const_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - const_map_view_iterator(const_map_view_iterator const & iter) : base_(iter.base()) {} - - const_map_view_iterator(map_view_iterator i) + const_map_view_iterator(map_view_iterator i) : base_(i.base()) {} BOOST_DEDUCED_TYPENAME base_::reference dereference() const { return ::boost::bimaps::relation::support::pair_by(*this->base()); } - private: - friend class iterator_core_access; - - #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION - - // Serialization support - - BOOST_SERIALIZATION_SPLIT_MEMBER() - - friend class ::boost::serialization::access; - - template< class Archive > - void save(Archive & ar, const unsigned int version) const - { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); - } - - template< class Archive > - void load(Archive & ar, const unsigned int version) - { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; - } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; +// reverse_map_view_iterator + +template< class Tag, class BimapCore > +struct reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + reverse_map_view_iterator, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct reverse_map_view_iterator : + public reverse_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + reverse_map_view_iterator_adaptor::type base_; + public: + + reverse_map_view_iterator() {} + reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + reverse_map_view_iterator(reverse_map_view_iterator const & iter) + : base_(iter.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by( + *const_cast( + &(*this->base()) + ) + ); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_reverse_map_view_iterator, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator : + public const_reverse_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_reverse_map_view_iterator_adaptor::type base_; + + public: + + const_reverse_map_view_iterator() {} + const_reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_reverse_map_view_iterator(const_reverse_map_view_iterator const & iter) + : base_(iter.base()) {} + const_reverse_map_view_iterator(reverse_map_view_iterator i) + : base_(i.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by(*this->base()); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + + +// local_map_view_iterator + +template< class Tag, class BimapCore > +struct local_map_view_iterator_adaptor { + typedef iterator_adaptor< + local_map_view_iterator, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct local_map_view_iterator : + public local_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + local_map_view_iterator_adaptor::type base_; + public: + + local_map_view_iterator() {} + local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + local_map_view_iterator(local_map_view_iterator const & iter) + : base_(iter.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by( + *const_cast( + &(*this->base()) + ) + ); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +template< class Tag, class BimapCore > +struct const_local_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_local_map_view_iterator, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by::type + > type; +}; +template< class Tag, class BimapCore > +struct const_local_map_view_iterator : + public const_local_map_view_iterator_adaptor::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_local_map_view_iterator_adaptor::type base_; + public: + + const_local_map_view_iterator() {} + const_local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_local_map_view_iterator(const_local_map_view_iterator const & iter) + : base_(iter.base()) {} + const_local_map_view_iterator(local_map_view_iterator i) + : base_(i.base()) {} + + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by(*this->base()); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES + } // namespace detail } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp b/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp index 7c7f0d0a6..45305f039 100644 --- a/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp +++ b/project/jni/boost/include/boost/bimap/detail/set_view_base.hpp @@ -199,7 +199,7 @@ class set_view_base { return derived().base().replace( derived().template functor()(position), - value_type_(l,position->right) + ::boost::bimaps::relation::detail::copy_with_left_replaced(*position,l) ); } @@ -209,7 +209,7 @@ class set_view_base { return derived().base().replace( derived().template functor()(position), - value_type_(position->left,r) + ::boost::bimaps::relation::detail::copy_with_right_replaced(*position,r) ); } diff --git a/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp b/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp index 57e6ae3c8..08d7a42b7 100644 --- a/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp +++ b/project/jni/boost/include/boost/bimap/detail/set_view_iterator.hpp @@ -19,7 +19,11 @@ #include // Boost -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION + #include #include #include @@ -91,13 +95,13 @@ struct set_view_iterator : public set_view_iterator_base::type friend class ::boost::serialization::access; template< class Archive > - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); @@ -167,13 +171,13 @@ struct const_set_view_iterator : public const_set_view_iterator_base - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); diff --git a/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp b/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp index 62b3843bb..8a2ffdeba 100644 --- a/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp +++ b/project/jni/boost/include/boost/bimap/relation/detail/mutant.hpp @@ -21,9 +21,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp b/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp index c46ab790a..60294a3b6 100644 --- a/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp +++ b/project/jni/boost/include/boost/bimap/relation/mutant_relation.hpp @@ -21,7 +21,10 @@ #include #include #include -#include + +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION + #include +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION #include @@ -139,7 +142,7 @@ class relation_info_hook : public #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION template< class Archive > - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & ::boost::serialization::make_nvp("left" , base_::left ); ar & ::boost::serialization::make_nvp("right", base_::right); @@ -185,7 +188,7 @@ class relation_info_hook : #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION template< class Archive > - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int) { ar & ::boost::serialization::make_nvp("left" , base_::left ); ar & ::boost::serialization::make_nvp("right", base_::right); @@ -343,7 +346,7 @@ class mutant_relation : public { return ::boost::bimaps::relation::support::get(*this); } - + #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION private: @@ -419,6 +422,50 @@ bool operator>=(const detail::relation_storage & a, (( a.left == b.left ) && ( a.right >= b.right ))); } +namespace detail { + +template< class TA, class TB, class Info, bool force_mutable> +mutant_relation + copy_with_left_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::left_value_type> + ::param_type l) +{ + return mutant_relation(l,rel.right,rel.info); +} + +template< class TA, class TB, bool force_mutable> +mutant_relation + copy_with_left_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::left_value_type> + ::param_type l) +{ + return mutant_relation(l,rel.right); +} + +template< class TA, class TB, class Info, bool force_mutable> +mutant_relation + copy_with_right_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::right_value_type> + ::param_type r) +{ + return mutant_relation(rel.left,r,rel.info); +} + +template< class TA, class TB, bool force_mutable> +mutant_relation + copy_with_right_replaced(mutant_relation const& rel, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + mutant_relation::right_value_type> + ::param_type r) +{ + return mutant_relation(rel.left,r); +} + +} // namespace detail + } // namespace relation } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp b/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp index 2325b3d32..53a0b300b 100644 --- a/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp +++ b/project/jni/boost/include/boost/bimap/relation/structured_pair.hpp @@ -499,6 +499,50 @@ bool operator>=(const std::pair & a, } +namespace detail { + +template< class FirstType, class SecondType, class Info, class Layout> +structured_pair + copy_with_first_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::first_type> + ::param_type f) +{ + return structured_pair(f,p.second,p.info); +} + +template< class FirstType, class SecondType, class Layout> +structured_pair + copy_with_first_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::first_type> + ::param_type f) +{ + return structured_pair(f,p.second); +} + +template< class FirstType, class SecondType, class Info, class Layout> +structured_pair + copy_with_second_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::second_type> + ::param_type s) +{ + return structured_pair(p.first,s,p.info); +} + +template< class FirstType, class SecondType, class Layout> +structured_pair + copy_with_second_replaced(structured_pair const& p, + BOOST_DEDUCED_TYPENAME ::boost::call_traits< BOOST_DEDUCED_TYPENAME + structured_pair::second_type> + ::param_type s) +{ + return structured_pair(p.first,s); +} + +} // namespace detail + } // namespace relation } // namespace bimaps diff --git a/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp b/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp index 6d1cff3ff..714183504 100644 --- a/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp +++ b/project/jni/boost/include/boost/bimap/support/iterator_type_by.hpp @@ -21,14 +21,11 @@ #include #include -#include - -#include - /** \struct boost::bimaps::support::iterator_type_by \brief Metafunction to obtain the iterator type of the map view by one of the sides. - +These metafunctions can be used outside the bimap framework for other bimap +signature compatible classes. \code template< class Tag, class Bimap > @@ -79,7 +76,6 @@ namespace boost { namespace bimaps { namespace support { - // Implementation of iterator type by metafunction BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER @@ -101,123 +97,41 @@ BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER // Implementation of reverse iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_reverse_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::reverse_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::reverse_iterator type + reverse_iterator_type_by, + left_reverse_iterator, + right_reverse_iterator ) -template< class Tag, class BimapCore > -struct reverse_iterator_type_by -{ - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_reverse_iterator_type_by::type - - > type; -}; - // Implementation of const reverse iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_const_reverse_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_reverse_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_reverse_iterator type + const_reverse_iterator_type_by, + left_const_reverse_iterator, + right_const_reverse_iterator ) -template< class Tag, class BimapCore > -struct const_reverse_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_const_reverse_iterator_type_by::type - - > type; -}; - // Implementation of local iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_local_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::local_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::local_iterator type + local_iterator_type_by, + left_local_iterator, + right_local_iterator ) - -template< class Tag, class BimapCore > -struct local_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_local_iterator_type_by::type - - > type; -}; - - // Implementation of const local iterator type by metafunction -BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER +BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER ( - core_const_local_iterator_type_by, - BimapCore, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_local_iterator type, - - typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE - index - ::type::const_local_iterator type + const_local_iterator_type_by, + left_const_local_iterator, + right_const_local_iterator ) -template< class Tag, class BimapCore > -struct const_local_iterator_type_by -{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - Tag, - BOOST_DEDUCED_TYPENAME BimapCore::relation, - BOOST_DEDUCED_TYPENAME core_const_local_iterator_type_by::type - - > type; -}; - - } // namespace support } // namespace bimaps } // namespace boost diff --git a/project/jni/boost/include/boost/bimap/views/list_map_view.hpp b/project/jni/boost/include/boost/bimap/views/list_map_view.hpp index 2a7d2b1f6..1014fed84 100644 --- a/project/jni/boost/include/boost/bimap/views/list_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/list_map_view.hpp @@ -36,22 +36,17 @@ struct list_map_view_base { typedef ::boost::bimaps::container_adaptor::list_map_adaptor < - BOOST_DEDUCED_TYPENAME BimapType::core_type::BOOST_NESTED_TEMPLATE index::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - reverse_iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_reverse_iterator_type_by::type, + BOOST_DEDUCED_TYPENAME BimapType::core_type:: + BOOST_NESTED_TEMPLATE index::type, + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail:: const_map_view_iterator, + ::boost::bimaps::detail:: reverse_map_view_iterator, + ::boost::bimaps::detail::const_reverse_map_view_iterator, ::boost::bimaps::container_adaptor::support::iterator_facade_to_base < - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by::type, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by::type - + ::boost::bimaps::detail:: map_view_iterator, + ::boost::bimaps::detail::const_map_view_iterator + >, ::boost::mpl::na, ::boost::mpl::na, @@ -64,7 +59,7 @@ struct list_map_view_base < Tag, BOOST_DEDUCED_TYPENAME BimapType::relation - + >::type > type; diff --git a/project/jni/boost/include/boost/bimap/views/map_view.hpp b/project/jni/boost/include/boost/bimap/views/map_view.hpp index 245b5d6fe..b8c2e01af 100644 --- a/project/jni/boost/include/boost/bimap/views/map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/map_view.hpp @@ -40,7 +40,7 @@ class map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( map_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: map_view_base< map_view,Tag,BimapType >, @@ -50,7 +50,7 @@ class map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( map_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/multimap_view.hpp b/project/jni/boost/include/boost/bimap/views/multimap_view.hpp index 41769496c..08022e7c3 100644 --- a/project/jni/boost/include/boost/bimap/views/multimap_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/multimap_view.hpp @@ -42,7 +42,7 @@ class multimap_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( multimap_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: map_view_base< multimap_view,Tag,BimapType > @@ -51,7 +51,7 @@ class multimap_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( multimap_adaptor, Tag,BimapType, - reverse_iterator_type_by,const_reverse_iterator_type_by + reverse_map_view_iterator,const_reverse_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp b/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp index da9b4b47a..b78a80ef1 100644 --- a/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unconstrained_map_view.hpp @@ -29,8 +29,10 @@ class unconstrained_map_view { public: template< class T > - unconstrained_map_view(const T & t) {} + unconstrained_map_view(const T &) {} + typedef void iterator; + typedef void const_iterator; typedef void reference; typedef void const_reference; typedef void info_type; diff --git a/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp b/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp index 6b4a6e220..e4ada9d08 100644 --- a/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unconstrained_set_view.hpp @@ -29,7 +29,7 @@ class unconstrained_set_view { public: template< class T > - unconstrained_set_view(const T & t) {} + unconstrained_set_view(const T &) {} typedef void iterator; typedef void const_iterator; diff --git a/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp b/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp index 14813e2fc..90eeb1e71 100644 --- a/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unordered_map_view.hpp @@ -43,7 +43,7 @@ class unordered_map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_map_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ), public ::boost::bimaps::detail::map_view_base< @@ -56,7 +56,7 @@ class unordered_map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_map_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp b/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp index db222056e..ac4579cf9 100644 --- a/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/unordered_multimap_view.hpp @@ -44,7 +44,7 @@ class unordered_multimap_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_multimap_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ), public ::boost::bimaps::detail::map_view_base< @@ -54,7 +54,7 @@ class unordered_multimap_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( unordered_multimap_adaptor, Tag,BimapType, - local_iterator_type_by,const_local_iterator_type_by + local_map_view_iterator,const_local_map_view_iterator ) base_; diff --git a/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp b/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp index 1837c2797..d8fdd8d82 100644 --- a/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/vector_map_view.hpp @@ -41,7 +41,7 @@ class vector_map_view public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( vector_map_adaptor, Tag,BimapType, - reverse_iterator_type_by, const_reverse_iterator_type_by + reverse_map_view_iterator, const_reverse_map_view_iterator ), public ::boost::bimaps::detail:: @@ -50,7 +50,7 @@ class vector_map_view typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( vector_map_adaptor, Tag,BimapType, - reverse_iterator_type_by, const_reverse_iterator_type_by + reverse_map_view_iterator, const_reverse_map_view_iterator ) base_; @@ -75,7 +75,41 @@ class vector_map_view this->base() = v.base(); return *this; } + + BOOST_DEDUCED_TYPENAME base_::const_reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().operator[](n) + ); + } + BOOST_DEDUCED_TYPENAME base_::const_reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().at(n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().operator[](n) + )); + } + + BOOST_DEDUCED_TYPENAME base_::reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().at(n) + )); + } + BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_) BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_) @@ -273,7 +307,7 @@ typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \ /*===========================================================================*/ #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \ BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \ - BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \ + BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) /*===========================================================================*/ namespace detail { diff --git a/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp b/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp index 58e347af2..890ffd02a 100644 --- a/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp +++ b/project/jni/boost/include/boost/bimap/views/vector_set_view.hpp @@ -68,6 +68,40 @@ class vector_set_view return *this; } + BOOST_DEDUCED_TYPENAME base_::const_reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().operator[](n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::const_reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) const + { + return this->template functor()( + this->base().at(n) + ); + } + + BOOST_DEDUCED_TYPENAME base_::reference + operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().operator[](n) + )); + } + + BOOST_DEDUCED_TYPENAME base_::reference + at(BOOST_DEDUCED_TYPENAME base_::size_type n) + { + return this->template functor()( + const_cast( + this->base().at(n) + )); + } + BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_) BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_) diff --git a/project/jni/boost/include/boost/chrono/chrono_io.hpp b/project/jni/boost/include/boost/chrono/chrono_io.hpp index 29a8d3493..ebd18a3da 100644 --- a/project/jni/boost/include/boost/chrono/chrono_io.hpp +++ b/project/jni/boost/include/boost/chrono/chrono_io.hpp @@ -14,6 +14,21 @@ #define BOOST_CHRONO_CHRONO_IO_HPP #include + +//#if BOOST_CHRONO_VERSION == 2 +//#include +//#include +//#elif BOOST_CHRONO_VERSION == 1 +//#include +//#endif + +#if defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#include +#include +#else #include +#endif + +#include #endif // BOOST_CHRONO_CHRONO_IO_HPP diff --git a/project/jni/boost/include/boost/chrono/config.hpp b/project/jni/boost/include/boost/chrono/config.hpp index a852b103a..d892ec834 100644 --- a/project/jni/boost/include/boost/chrono/config.hpp +++ b/project/jni/boost/include/boost/chrono/config.hpp @@ -13,10 +13,25 @@ #include +#if !defined BOOST_CHRONO_VERSION +#define BOOST_CHRONO_VERSION 1 +#else +#if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 +#error "BOOST_CHRONO_VERSION must be 1 or 2" +#endif +#endif + #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) #define BOOST_USE_WINDOWS_H #endif +#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +# define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +#endif + // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API // can be defined by the user to specify which API should be used @@ -62,12 +77,8 @@ # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME -# if defined(CLOCK_REALTIME) -# if defined(CLOCK_MONOTONIC) -# define BOOST_CHRONO_HAS_CLOCK_STEADY -# endif -# else -# error does not supply CLOCK_REALTIME +# if defined(CLOCK_MONOTONIC) +# define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK @@ -81,6 +92,13 @@ # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif +# if defined(__HP_aCC) && defined(__hpux) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# if defined(__VXWORKS__) +# undef BOOST_CHRONO_HAS_PROCESS_CLOCKS +# endif # endif #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) @@ -88,23 +106,63 @@ #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY #endif +//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS // unicode support ------------------------------// -#if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T) +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT #else #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 #endif #if ! defined BOOST_NOEXCEPT -#if defined(BOOST_NO_NOEXCEPT) +#if defined(BOOST_NO_CXX11_NOEXCEPT) #define BOOST_NOEXCEPT #else #define BOOST_NOEXCEPT noexcept #endif #endif +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +#define BOOST_CHRONO_LIB_CONSTEXPR +#else +#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +#ifdef BOOST_NO_CXX11_NOEXCEPT +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept +#endif +#endif + + +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" +#endif + +#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" +#endif + +#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING +#endif + +#if (BOOST_CHRONO_VERSION == 2) +#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#endif +#endif + #ifdef BOOST_CHRONO_HEADER_ONLY #define BOOST_CHRONO_INLINE inline #define BOOST_CHRONO_STATIC inline @@ -135,7 +193,6 @@ #endif -//#define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING // enable automatic library variant selection ------------------------------// diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp index d76d9356c..5d5c4f480 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp @@ -32,8 +32,8 @@ namespace chrono_detail factor = -1; else { - BOOST_ASSERT( factor <= 1000000l ); // doesn't handle large ticks - factor = 1000000l / factor; // compute factor + BOOST_ASSERT( factor <= 1000000000l ); // doesn't handle large ticks + factor = 1000000000l / factor; // compute factor if ( !factor ) factor = -1; } } @@ -54,7 +54,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { @@ -66,9 +66,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING process_real_cpu_clock::time_point process_real_cpu_clock::now( - system::error_code & ec) + system::error_code & ec) { - + tms tm; clock_t c = ::times( &tm ); if ( c == clock_t(-1) ) // error @@ -76,9 +76,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -91,21 +91,21 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -131,7 +131,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { @@ -152,9 +152,9 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -167,21 +167,21 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -208,11 +208,12 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXC if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return time_point(); } } } @@ -248,7 +249,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now( ec.clear(); } return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { @@ -297,8 +298,8 @@ process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -process_cpu_clock::time_point process_cpu_clock::now( - system::error_code & ec ) +process_cpu_clock::time_point process_cpu_clock::now( + system::error_code & ec ) { tms tm; clock_t c = ::times( &tm ); @@ -307,9 +308,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -333,9 +334,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -345,7 +346,7 @@ process_cpu_clock::time_point process_cpu_clock::now( } } } - + } #endif diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp index 5ad41f84e..42a544a0d 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/posix/thread_clock.hpp @@ -15,6 +15,7 @@ #include # include +# include # include namespace boost { namespace chrono { @@ -45,7 +46,7 @@ namespace boost { namespace chrono { } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING - thread_clock::time_point thread_clock::now( system::error_code & ec ) + thread_clock::time_point thread_clock::now( system::error_code & ec ) { struct timespec ts; #if defined CLOCK_THREAD_CPUTIME_ID @@ -64,9 +65,9 @@ namespace boost { namespace chrono { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::thread_clock" )); } else @@ -75,7 +76,7 @@ namespace boost { namespace chrono { return time_point(); } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp index d953fe4bb..17dae964c 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/win/chrono.hpp @@ -42,6 +42,7 @@ namespace chrono_detail (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return steady_clock::time_point(); } return steady_clock::time_point(steady_clock::duration( @@ -97,8 +98,12 @@ namespace chrono_detail #else boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails #endif - return system_clock::time_point(system_clock::duration( - (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + return system_clock::time_point( + system_clock::duration( + ((static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime) + -116444736000000000LL + ) + ); } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING @@ -128,12 +133,6 @@ namespace chrono_detail { __int64 temp = t.time_since_epoch().count(); - # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 - temp -= 116444736000000000LL; // delta from epoch in microseconds - # else - temp -= 116444736000000000; - # endif - temp /= 10000000; return static_cast( temp ); } @@ -144,12 +143,6 @@ namespace chrono_detail __int64 temp = t; temp *= 10000000; - # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 - temp += 116444736000000000LL; - # else - temp += 116444736000000000; - # endif - return time_point(duration(temp)); } diff --git a/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp index 6453aa600..1b7e67a12 100644 --- a/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp @@ -34,8 +34,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); } + typedef ratio_divide >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast(c)*R::num/R::den) ); } @@ -56,8 +57,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { ec.clear(); } + typedef ratio_divide >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast(c)*R::num/R::den) ); } #endif diff --git a/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp b/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp index 78a0ce13e..94936c8ba 100644 --- a/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp +++ b/project/jni/boost/include/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp @@ -19,6 +19,10 @@ #if defined(__GNUC__) && (__GNUC__ >= 4) #pragma GCC system_header +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) #endif namespace boost { @@ -41,4 +45,10 @@ namespace detail { } // namespace detail } // namespace chrono -#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP +#if defined __SUNPRO_CC +#pragma enable_warn +#elif defined _MSC_VER +#pragma warning(pop) +#endif + +#endif // BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP diff --git a/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp b/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp index 13ad0ca8c..7c3ba6e2a 100644 --- a/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp +++ b/project/jni/boost/include/boost/chrono/detail/scan_keyword.hpp @@ -23,10 +23,11 @@ #include #include #include +#include namespace boost { using interprocess::unique_ptr; - + namespace chrono { namespace chrono_detail { @@ -65,13 +66,13 @@ scan_keyword(InputIterator& b, InputIterator e, unsigned char statbuf[100]; unsigned char* status = statbuf; // Change free by free_aux to avoid - // Error: Could not find a match for boost::interprocess::unique_ptr::unique_ptr(int, extern "C" void(void*)) + // Error: Could not find a match for boost::interprocess::unique_ptr::unique_ptr(int, extern "C" void(void*)) unique_ptr stat_hold(0, free_aux); if (nkw > sizeof(statbuf)) { status = (unsigned char*)malloc(nkw); if (status == 0) - throw std::bad_alloc(); + throw_exception(std::bad_alloc()); stat_hold.reset(status); } size_t n_might_match = nkw; // At this point, any keyword might match diff --git a/project/jni/boost/include/boost/chrono/detail/static_assert.hpp b/project/jni/boost/include/boost/chrono/detail/static_assert.hpp index 1ad21a56b..861519475 100644 --- a/project/jni/boost/include/boost/chrono/detail/static_assert.hpp +++ b/project/jni/boost/include/boost/chrono/detail/static_assert.hpp @@ -11,7 +11,7 @@ #include -#ifndef BOOST_NO_STATIC_ASSERT +#ifndef BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) #elif defined(BOOST_CHRONO_USES_STATIC_ASSERT) #include diff --git a/project/jni/boost/include/boost/chrono/detail/system.hpp b/project/jni/boost/include/boost/chrono/detail/system.hpp index f8a40f12a..0dcffe852 100644 --- a/project/jni/boost/include/boost/chrono/detail/system.hpp +++ b/project/jni/boost/include/boost/chrono/detail/system.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHRONO_DETAIL_SYSTEM_HPP #define BOOST_CHRONO_DETAIL_SYSTEM_HPP +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + #include #include @@ -15,7 +17,7 @@ #define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category() #endif -#ifdef BOOST_SYSTEM_NO_DEPRECATED +#ifdef BOOST_SYSTEM_NO_DEPRECATED #define BOOST_CHRONO_THROWS boost::throws() #define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::throws()) #else @@ -24,3 +26,4 @@ #endif #endif +#endif diff --git a/project/jni/boost/include/boost/chrono/duration.hpp b/project/jni/boost/include/boost/chrono/duration.hpp index 323474014..f39346c06 100644 --- a/project/jni/boost/include/boost/chrono/duration.hpp +++ b/project/jni/boost/include/boost/chrono/duration.hpp @@ -51,13 +51,17 @@ time2_demo contained this comment: #include #include -#if !defined(BOOST_NO_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) #define BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION "A duration representation can not be a duration" #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO "Second template parameter of duration must be a boost::ratio" #define BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE "duration period must be positive" #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION "Second template parameter of time_point must be a boost::chrono::duration" #endif +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -336,17 +340,17 @@ namespace detail namespace detail { template ::value> struct chrono_numeric_limits { - static T lowest() throw() {return (std::numeric_limits::min) ();} + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits::min) ();} }; template struct chrono_numeric_limits { - static T lowest() throw() {return (std::numeric_limits::min) ();} + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits::min) ();} }; template <> struct chrono_numeric_limits { - static float lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max) (); } @@ -354,7 +358,7 @@ namespace detail { template <> struct chrono_numeric_limits { - static double lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max) (); } @@ -362,7 +366,7 @@ namespace detail { template <> struct chrono_numeric_limits { - static long double lowest() throw() + static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW { return -(std::numeric_limits::max)(); } @@ -377,12 +381,12 @@ template struct duration_values { static BOOST_CONSTEXPR Rep zero() {return Rep(0);} - static BOOST_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () { return (std::numeric_limits::max)(); } - static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () { return detail::numeric_limits::lowest(); } @@ -413,7 +417,7 @@ struct common_type, namespace chrono { template - class duration + class BOOST_SYMBOL_VISIBLE duration { //BOOST_CHRONO_STATIC_ASSERT(boost::is_integral::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ()); BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration::value, @@ -432,7 +436,7 @@ namespace chrono { BOOST_CONSTEXPR duration() : rep_(duration_values::zero()) { } template - BOOST_CONSTEXPR + BOOST_SYMBOL_VISIBLE inline BOOST_CONSTEXPR explicit duration(const Rep2& r , typename boost::enable_if < mpl::and_ < @@ -447,9 +451,8 @@ namespace chrono { > >::type* = 0 ) : rep_(r) { } - ~duration() {} //= default; - BOOST_CONSTEXPR - duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; + //~duration() {} //= default; +// BOOST_CONSTEXPR duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; duration& operator=(const duration& rhs) // = default; { if (&rhs != this) rep_= rhs.rep_; @@ -480,7 +483,7 @@ namespace chrono { // arithmetic BOOST_CONSTEXPR - duration operator+() const {return *this;} + duration operator+() const {return duration(rep_);;} BOOST_CONSTEXPR duration operator-() const {return duration(-rep_);} duration& operator++() {++rep_; return *this;} @@ -510,11 +513,11 @@ namespace chrono { { return duration(duration_values::zero()); } - static BOOST_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () { return duration((duration_values::min)()); } - static BOOST_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () + static BOOST_CHRONO_LIB_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () { return duration((duration_values::max)()); } @@ -660,7 +663,7 @@ namespace detail template struct duration_eq { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type::type CD; return CD(lhs).count() == CD(rhs).count(); @@ -670,7 +673,7 @@ namespace detail template struct duration_eq { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() == rhs.count(); } @@ -679,7 +682,7 @@ namespace detail template struct duration_lt { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type::type CD; return CD(lhs).count() < CD(rhs).count(); @@ -689,7 +692,7 @@ namespace detail template struct duration_lt { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() < rhs.count(); } @@ -757,7 +760,7 @@ namespace detail // Duration >= template - inline + inline BOOST_CONSTEXPR bool operator>=(const duration& lhs, const duration& rhs) @@ -783,4 +786,9 @@ namespace detail } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_DURATION_HPP diff --git a/project/jni/boost/include/boost/chrono/io/duration_get.hpp b/project/jni/boost/include/boost/chrono/io/duration_get.hpp new file mode 100644 index 000000000..601460334 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_get.hpp @@ -0,0 +1,542 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_DURATION_GET_HPP +#define BOOST_CHRONO_IO_DURATION_GET_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/** + * Duration formatting facet for input. + */ +namespace boost +{ + namespace chrono + { + + namespace detail + { + template ::value> + struct duration_io_intermediate + { + typedef Rep type; + }; + + template + struct duration_io_intermediate + { + typedef typename mpl::if_c::value, long double, typename mpl::if_c< + is_signed::value, long long, unsigned long long>::type>::type type; + }; + + template + typename enable_if , bool>::type reduce(intermediate_type& r, + unsigned long long& den, std::ios_base::iostate& err) + { + typedef typename common_type::type common_type_t; + + // Reduce r * num / den + common_type_t t = math::gcd(common_type_t(r), common_type_t(den)); + r /= t; + den /= t; + if (den != 1) + { + // Conversion to Period is integral and not exact + err |= std::ios_base::failbit; + return false; + } + return true; + } + template + typename disable_if , bool>::type reduce(intermediate_type&, unsigned long long&, + std::ios_base::iostate&) + { + return true; + } + + } + + /** + * @c duration_get is used to parse a character sequence, extracting + * components of a duration into a class duration. + * Each get member parses a format as produced by a corresponding format specifier to time_put<>::put. + * If the sequence being parsed matches the correct format, the + * corresponding member of the class duration argument are set to the + * value used to produce the sequence; + * otherwise either an error is reported or unspecified values are assigned. + * In other words, user confirmation is required for reliable parsing of + * user-entered durations, but machine-generated formats can be parsed + * reliably. This allows parsers to be aggressive about interpreting user + * variations on standard formats. + * + * If the end iterator is reached during parsing of the get() member + * function, the member sets std::ios_base::eofbit in err. + */ + template > + class duration_get: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to scan the character buffer. + */ + typedef InputIterator iter_type; + + /** + * Construct a @c duration_get facet. + * @param refs + * @Effects Construct a @c duration_get facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + + explicit duration_get(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * Requires: [pattern,pat_end) shall be a valid range. + * + * Effects: The function starts by evaluating err = std::ios_base::goodbit. + * It then enters a loop, reading zero or more characters from s at + * each iteration. Unless otherwise specified below, the loop + * terminates when the first of the following conditions holds: + * - The expression pattern == pat_end evaluates to true. + * - The expression err == std::ios_base::goodbit evaluates to false. + * - The expression s == end evaluates to true, in which case the + * function evaluates err = std::ios_base::eofbit | std::ios_base::failbit. + * - The next element of pattern is equal to '%', followed by a conversion + * specifier character, format. + * If the number of elements in the range [pattern,pat_end) is not + * sufficient to unambiguously determine whether the conversion + * specification is complete and valid, the function evaluates + * err = std::ios_base::failbit. Otherwise, the function evaluates + * s = get_value(s, end, ios, err, r) when the conversion specification is 'v' and + * s = get_value(s, end, ios, err, rt) when the conversion specification is 'u'. + * If err == std::ios_base::goodbit holds after + * the evaluation of the expression, the function increments pattern to + * point just past the end of the conversion specification and continues + * looping. + * - The expression isspace(*pattern, ios.getloc()) evaluates to true, in + * which case the function first increments pattern until + * pattern == pat_end || !isspace(*pattern, ios.getloc()) evaluates to true, + * then advances s until s == end || !isspace(*s, ios.getloc()) is true, + * and finally resumes looping. + * - The next character read from s matches the element pointed to by + * pattern in a case-insensitive comparison, in which case the function + * evaluates ++pattern, ++s and continues looping. Otherwise, the function + * evaluates err = std::ios_base::failbit. + * + * Once r and rt are retrieved, + * Returns: s + */ + template + iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, + duration &d, const char_type *pattern, const char_type *pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >(ios.getloc()); + return get(facet, s, end, ios, err, d, pattern, pat_end); + } + else + { + duration_units_default facet; + return get(facet, s, end, ios, err, d, pattern, pat_end); + } + } + + template + iter_type get(duration_units const&facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, duration &d, const char_type *pattern, const char_type *pat_end) const + { + + typedef typename detail::duration_io_intermediate::type intermediate_type; + intermediate_type r; + rt_ratio rt; + bool value_found = false, unit_found = false; + + const std::ctype& ct = std::use_facet >(ios.getloc()); + while (pattern != pat_end && err == std::ios_base::goodbit) + { + if (s == end) + { + err |= std::ios_base::eofbit; + break; + } + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + err |= std::ios_base::failbit; + return s; + } + char cmd = ct.narrow(*pattern, 0); + switch (cmd) + { + case 'v': + { + if (value_found) + { + err |= std::ios_base::failbit; + return s; + } + value_found = true; + s = get_value(s, end, ios, err, r); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + case 'u': + { + if (unit_found) + { + err |= std::ios_base::failbit; + return s; + } + unit_found = true; + s = get_unit(facet, s, end, ios, err, rt); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + + ++pattern; + } + else if (ct.is(std::ctype_base::space, *pattern)) + { + for (++pattern; pattern != pat_end && ct.is(std::ctype_base::space, *pattern); ++pattern) + ; + for (; s != end && ct.is(std::ctype_base::space, *s); ++s) + ; + } + else if (ct.toupper(*s) == ct.toupper(*pattern)) + { + ++s; + ++pattern; + } + else + { + err |= std::ios_base::failbit; + return s; + } + + } + + unsigned long long num = rt.num; + unsigned long long den = rt.den; + + // r should be multiplied by (num/den) / Period + // Reduce (num/den) / Period to lowest terms + unsigned long long gcd_n1_n2 = math::gcd(num, Period::num); + unsigned long long gcd_d1_d2 = math::gcd(den, Period::den); + num /= gcd_n1_n2; + den /= gcd_d1_d2; + unsigned long long n2 = Period::num / gcd_n1_n2; + unsigned long long d2 = Period::den / gcd_d1_d2; + if (num > (std::numeric_limits::max)() / d2 || den + > (std::numeric_limits::max)() / n2) + { + // (num/den) / Period overflows + err |= std::ios_base::failbit; + return s; + } + num *= d2; + den *= n2; + + typedef typename common_type::type common_type_t; + + // num / den is now factor to multiply by r + if (!detail::reduce(r, den, err)) return s; + + if (chrono::detail::gt(r, ( (duration_values::max)() / num))) + { + // Conversion to Period overflowed + err |= std::ios_base::failbit; + return s; + } + common_type_t t = r * num; + t /= den; + if (t > 0) + { + Rep pt = t; + if ( (duration_values::max)() < pt) + { + // Conversion to Period overflowed + err |= std::ios_base::failbit; + return s; + } + } + // Success! Store it. + r = Rep(t); + d = duration (r); + + return s; + } + + /** + * + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return get(s, end, ios, err, ios, d, str.data(), str.data() + str.size()); + * @codeend + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, + duration & d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >(ios.getloc()); + std::basic_string str = facet.get_pattern(); + return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size()); + } + else + { + duration_units_default facet; + std::basic_string str = facet.get_pattern(); + return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size()); + } + } + + /** + * + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param r a reference to the duration representation. + * @Effects As if + * @code + * return std::use_facet >(ios.getloc()).get(s, end, ios, err, r); + * @endcode + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get_value(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, Rep& r) const + { + return std::use_facet >(ios.getloc()).get(s, end, ios, err, r); + } + + /** + * + * @param s start input stream iterator + * @param e end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param rt a reference to the duration run-time ratio. + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + iter_type get_unit(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, rt_ratio &rt) const + { + if (std::has_facet >(is.getloc())) + { + return get_unit(std::use_facet >(is.getloc()), i, e, is, err, rt); + } + else + { + duration_units_default facet; + return get_unit(facet, i, e, is, err, rt); + } + } + + + iter_type get_unit(duration_units const &facet, iter_type i, iter_type e, std::ios_base& is, + std::ios_base::iostate& err, rt_ratio &rt) const + { + + if (*i == '[') + { + // parse [N/D]s or [N/D]second or [N/D]seconds format + ++i; + i = std::use_facet >(is.getloc()).get(i, e, is, err, rt.num); + if ( (err & std::ios_base::failbit) != 0) + { + return i; + } + + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + CharT x = *i++; + if (x != '/') + { + err |= std::ios_base::failbit; + return i; + } + i = std::use_facet >(is.getloc()).get(i, e, is, err, rt.den); + if ( (err & std::ios_base::failbit) != 0) + { + return i; + } + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + if (*i != ']') + { + err |= std::ios_base::failbit; + return i; + } + ++i; + if (i == e) + { + err |= std::ios_base::failbit; + return i; + } + // parse s or second or seconds + return do_get_n_d_valid_unit(facet, i, e, is, err); + } + else + { + return do_get_valid_unit(facet, i, e, is, err, rt); + } + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~duration_get() + { + } + + protected: + + /** + * Extracts the run-time ratio associated to the duration when it is given in prefix form. + * + * This is an extension point of this facet so that we can take in account other periods that can have a useful + * translation in other contexts, as e.g. days and weeks. + * + * @param facet the duration_units facet + * @param s start input stream iterator. + * @param e end input stream iterator. + * @param ios a reference to a ios_base. + * @param err the ios_base state. + * @return @c s + */ + iter_type do_get_n_d_valid_unit(duration_units const &facet, iter_type i, iter_type e, + std::ios_base&, std::ios_base::iostate& err) const + { + // parse SI name, short or long + + const string_type* units = facet.get_n_d_valid_units_start(); + const string_type* units_end = facet.get_n_d_valid_units_end(); + + const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end, + //~ std::use_facet >(loc), + err); + if (!facet.match_n_d_valid_unit(k)) + { + err |= std::ios_base::failbit; + } + + return i; + } + + /** + * Extracts the run-time ratio associated to the duration when it is given in prefix form. + * + * This is an extension point of this facet so that we can take in account other periods that can have a useful + * translation in other contexts, as e.g. days and weeks. + * + * @param facet the duration_units facet + * @param s start input stream iterator. + * @param e end input stream iterator. + * @param ios a reference to a ios_base. + * @param err the ios_base state. + * @param rt a reference to the duration run-time ratio. + * @Effects + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name. + */ + iter_type do_get_valid_unit(duration_units const &facet, iter_type i, iter_type e, + std::ios_base&, std::ios_base::iostate& err, rt_ratio &rt) const + { + // parse SI name, short or long + + const string_type* units = facet.get_valid_units_start(); + const string_type* units_end = facet.get_valid_units_end(); + + err = std::ios_base::goodbit; + const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end, + //~ std::use_facet >(loc), + err); + + if (!facet.match_valid_unit(k, rt)) + { + err |= std::ios_base::failbit; + } + return i; + + } + }; + + /** + * Unique identifier for this type of facet. + */ + template + std::locale::id duration_get::id; + + } // chrono +} +// boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_io.hpp b/project/jni/boost/include/boost/chrono/io/duration_io.hpp new file mode 100644 index 000000000..438f7696d --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_io.hpp @@ -0,0 +1,225 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_DURATION_IO_HPP +#define BOOST_CHRONO_IO_DURATION_IO_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * duration parameterized manipulator. + */ + + class duration_fmt: public manip + { + duration_style style_; + public: + + /** + * explicit manipulator constructor from a @c duration_style + */ + explicit duration_fmt(duration_style style)BOOST_NOEXCEPT + : style_(style) + {} + + /** + * Change the duration_style ios state; + */ + void operator()(std::ios_base &ios) const + + { + set_duration_style(ios, style_); + } + }; + + /** + * duration_style i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + struct duration_style_io_saver + { + + //! the type of the state to restore + typedef std::ios_base state_type; + //! the type of aspect to save + typedef duration_style aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c duration_style. + */ + explicit duration_style_io_saver(state_type &s) : + s_save_(s) + { + a_save_ = get_duration_style(s_save_); + } + + /** + * Construction from an i/o stream and a @c duration_style to restore. + * + * Stores a reference to the i/o stream and the value @c duration_style to restore given as parameter. + */ + duration_style_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the duration_style to be restored. + */ + ~duration_style_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the duration_style to be restored. + */ + void restore() + { + set_duration_style(s_save_, a_save_); + } + + private: + duration_style_io_saver& operator=(duration_style_io_saver const& rhs) ; + + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * duration stream inserter + * @param os the output stream + * @param d to value to insert + * @return @c os + */ + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const duration& d) + { + bool failed = false; + BOOST_TRY + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + typename std::basic_ostream::sentry opfx(os); + if (bool(opfx)) + { + if (!std::has_facet >(os.getloc())) + { + if (duration_put ().put(os, os, os.fill(), d) .failed()) + { + err = std::ios_base::badbit; + } + } + else if (std::use_facet >(os.getloc()) .put(os, os, os.fill(), d) .failed()) + { + err = std::ios_base::badbit; + } + os.width(0); + } + } + BOOST_CATCH(...) + { + bool flag = false; + BOOST_TRY + { + os.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) os.setstate(err); + return os; + } + BOOST_CATCH(...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) os.setstate(std::ios_base::failbit | std::ios_base::badbit); + return os; + } + + /** + * + * @param is the input stream + * @param d the duration + * @return @c is + */ + template + std::basic_istream& + operator>>(std::basic_istream& is, duration& d) + { + std::ios_base::iostate err = std::ios_base::goodbit; + + BOOST_TRY + { + typename std::basic_istream::sentry ipfx(is); + if (bool(ipfx)) + { + if (!std::has_facet >(is.getloc())) + { + duration_get ().get(is, std::istreambuf_iterator(), is, err, d); + } + else + { + std::use_facet >(is.getloc()) .get(is, std::istreambuf_iterator(), is, + err, d); + } + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + is.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) { BOOST_RETHROW } + } + BOOST_CATCH_END + if (err) is.setstate(err); + return is; + } + + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_put.hpp b/project/jni/boost/include/boost/chrono/io/duration_put.hpp new file mode 100644 index 000000000..7bd0cd7db --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_put.hpp @@ -0,0 +1,264 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +/** + * Duration formatting facet for output. + */ +#ifndef BOOST_CHRONO_IO_DURATION_PUT_HPP +#define BOOST_CHRONO_IO_DURATION_PUT_HPP + +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @tparam ChatT a character type + * @tparam OutputIterator a model of @c OutputIterator + * + * The @c duration_put facet provides facilities for formatted output of duration values. + * The member function of @c duration_put take a duration and format it into character string representation. + * + */ + template > + class duration_put: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to write in the character buffer. + */ + typedef OutputIterator iter_type; + + /** + * Construct a duration_put facet. + * @param refs + * @Effects Construct a duration_put facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_put(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Steps through the sequence from @c pattern to @c pat_end, + * identifying characters that are part of a pattern sequence. Each character + * that is not part of a pattern sequence is written to @c s immediately, and + * each pattern sequence, as it is identified, results in a call to + * @c put_value or @c put_unit; + * thus, pattern elements and other characters are interleaved in the output + * in the order in which they appear in the pattern. Pattern sequences are + * identified by converting each character @c c to a @c char value as if by + * @c ct.narrow(c,0), where @c ct is a reference to @c ctype obtained from + * @c ios.getloc(). The first character of each sequence is equal to @c '%', + * followed by a pattern specifier character @c spec, which can be @c 'v' for + * the duration value or @c 'u' for the duration unit. . + * For each valid pattern sequence identified, calls + * put_value(s, ios, fill, d) or put_unit(s, ios, fill, d). + * + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration const& d, const CharT* pattern, + const CharT* pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + return put(facet, s, ios, fill, d, pattern, pat_end); + } + else + { + duration_units_default facet; + return put(facet, s, ios, fill, d, pattern, pat_end); + } + } + + template + iter_type put(duration_units const& units_facet, iter_type s, std::ios_base& ios, char_type fill, + duration const& d, const CharT* pattern, const CharT* pat_end) const + { + + const std::ctype& ct = std::use_facet >(ios.getloc()); + for (; pattern != pat_end; ++pattern) + { + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + *s++ = pattern[-1]; + break; + } + char fmt = ct.narrow(*pattern, 0); + switch (fmt) + { + case 'v': + { + s = put_value(s, ios, fill, d); + break; + } + case 'u': + { + s = put_unit(units_facet, s, ios, fill, d); + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + } + else + *s++ = *pattern; + } + return s; + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects imbue in @c ios the @c duration_units_default facet if not already present. + * Retrieves Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return put(s, ios, d, str.data(), str.data() + str.size()); + * @endcode + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + std::basic_string str = facet.get_pattern(); + return put(facet, s, ios, fill, d, str.data(), str.data() + str.size()); + } + else + { + duration_units_default facet; + std::basic_string str = facet.get_pattern(); + return put(facet, s, ios, fill, d, str.data(), str.data() + str.size()); + } + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects As if s=std::use_facet >(ios.getloc()).put(s, ios, fill, static_cast (d.count())). + * @Returns s, iterator pointing immediately after the last character produced. + */ + template + iter_type put_value(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + return std::use_facet >(ios.getloc()).put(s, ios, fill, + static_cast (d.count())); + } + + /** + * + * @param s an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the duration + * @Effects Let facet be the duration_units facet associated to ios. If the associated unit is named, + * as if + * @code + string_type str = facet.get_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + * @endcode + * Otherwise, format the unit as "[Period::num/Period::den]" followed by the unit associated to [N/D] obtained using facet.get_n_d_unit(get_duration_style(ios), d) + * @Returns s, iterator pointing immediately after the last character produced. + */ + template + iter_type put_unit(iter_type s, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_units const&facet = std::use_facet >( + ios.getloc()); + return put_unit(facet, s, ios, fill, d); + } + else + { + duration_units_default facet; + return put_unit(facet, s, ios, fill, d); + } + } + + template + iter_type put_unit(duration_units const& facet, iter_type s, std::ios_base& ios, char_type fill, + duration const& d) const + { + if (facet.template is_named_unit()) { + string_type str = facet.get_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + } else { + *s++ = CharT('['); + std::use_facet >(ios.getloc()).put(s, ios, fill, Period::num); + *s++ = CharT('/'); + std::use_facet >(ios.getloc()).put(s, ios, fill, Period::den); + *s++ = CharT(']'); + string_type str = facet.get_n_d_unit(get_duration_style(ios), d); + s=std::copy(str.begin(), str.end(), s); + } + return s; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~duration_put() + { + } + + }; + + template + std::locale::id duration_put::id; + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_style.hpp b/project/jni/boost/include/boost/chrono/io/duration_style.hpp new file mode 100644 index 000000000..65b76a902 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_style.hpp @@ -0,0 +1,35 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_DURATION_STYLE_HPP +#define BOOST_CHRONO_IO_DURATION_STYLE_HPP + +#include + +namespace boost +{ + namespace chrono + { + /** + * Scoped enumeration emulation stating whether the duration I/O style is long or short. + * prefix means duration::rep with whatever stream/locale settings are set for it followed by a long name representing the unit + * symbol means duration::rep with whatever stream/locale settings are set for it followed by a SI unit abbreviation + */ + BOOST_SCOPED_ENUM_DECLARE_BEGIN(duration_style) + { + prefix, symbol + } + BOOST_SCOPED_ENUM_DECLARE_END(duration_style) + + + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/duration_units.hpp b/project/jni/boost/include/boost/chrono/io/duration_units.hpp new file mode 100644 index 000000000..e2f1ba090 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/duration_units.hpp @@ -0,0 +1,992 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_DURATION_UNITS_HPP +#define BOOST_CHRONO_IO_DURATION_UNITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + class rt_ratio + { + public: + template + rt_ratio(Period const&) : + num(Period::type::num), den(Period::type::den) + { + } + + rt_ratio(intmax_t n = 0, intmax_t d = 0) : + num(n), den(d) + { + } + + intmax_t num; + intmax_t den; + }; + + /** + * @c duration_units facet gives useful information about the duration units, + * as the number of plural forms, the plural form associated to a duration, + * the text associated to a plural form and a duration's period, + */ + template + class duration_units: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * Construct a @c duration_units facet. + * @param refs + * @Effects Construct a @c duration_units facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_units(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @return pointer to the start of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_start() const =0; + /** + * @effect calls the do_... + * @return pointer to the end of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_end() const=0; + + /** + * @return pointer to the start of valid units, symbol or prefix with its different plural forms. + */ + virtual const string_type* get_valid_units_start() const=0; + /** + * @return pointer to the end of valid units. + */ + virtual const string_type* get_valid_units_end() const=0; + + /** + * @param k the found pointer to the [N/D] unit. + * @return true if @c k matches a valid unit. + */ + virtual bool match_n_d_valid_unit(const string_type* k) const = 0; + /** + * @param k the found pointer to the unit. + * @Effects @c rt is set to the valid Period when the @c k matches a valid unit. + * @return true if @c k matches a valid unit. + */ + virtual bool match_valid_unit(const string_type* k, rt_ratio& rt) const = 0; + + /** + * @effect calls the do_... + * @return the pattern to be used by default. + */ + virtual string_type get_pattern() const=0; + + /** + * @effect calls the do_... + * @return the unit associated to this duration. + */ + template + string_type get_unit(duration_style style, duration const& d) const + { + return do_get_unit(style, rt_ratio(Period()), static_cast(d.count())); + } + /** + * @effect calls the do_... + * @return the [N/D] suffix unit associated to this duration. + */ + template + string_type get_n_d_unit(duration_style style, duration const& d) const + { + return do_get_n_d_unit(style, rt_ratio(Period()), static_cast(d.count())); + } + + /** + * @effect calls the do_... + * @return true if the unit associated to the given Period is named, false otherwise. + */ + template + bool is_named_unit() const + { + return do_is_named_unit(rt_ratio(Period())); + } + + + protected: + + /** + * @Effects Destroys the facet + */ + virtual ~duration_units() + { + } + /** + * @return the [N/D] suffix unit associated to this duration. + */ + virtual string_type do_get_n_d_unit(duration_style style, rt_ratio rt, intmax_t v) const = 0; + /** + * @return the unit associated to this duration. + */ + virtual string_type do_get_unit(duration_style style,rt_ratio rt, intmax_t v) const = 0; + /** + * @return true if the unit associated to the given Period is named, false otherwise. + */ + virtual bool do_is_named_unit(rt_ratio rt) const =0; + + }; + + template + std::locale::id duration_units::id; + + namespace detail + { + template + struct duration_units_default_holder + { + typedef std::basic_string string_type; + static string_type* n_d_valid_units_; + static string_type* valid_units_; + static bool initialized_; + }; + template + typename duration_units_default_holder::string_type* duration_units_default_holder::n_d_valid_units_=0; + template + typename duration_units_default_holder::string_type* duration_units_default_holder::valid_units_=0; + template + bool duration_units_default_holder::initialized_ = false; + } + + /** + * This class is used to define the strings for the default English + */ + template + class duration_units_default: public duration_units + { + protected: + static const std::size_t pfs_ = 2; + + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + + /** + * Construct a @c duration_units_default facet. + * @param refs + * @Effects Construct a @c duration_units_default facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit duration_units_default(size_t refs = 0) : + duration_units (refs) + { + } + + /** + * Destroys the facet. + */ + ~duration_units_default() + { + } + + public: + + /** + * @param k the found pointer to the [N/D] unit. + * @return true if @c k matches a valid unit. + */ + bool match_n_d_valid_unit(const string_type* k) const + { + std::size_t index = (k - get_n_d_valid_units_start()) / (pfs_ + 1); + switch (index) + { + case 0: + break; + default: + return false; + } + return true; + } + /** + * @param k the found pointer to the unit. + * @Effects @c rt is set to the valid Period when the @c k matches a valid unit. + * @return true if @c k matches a valid unit. + */ + bool match_valid_unit(const string_type* k, rt_ratio& rt) const + { + std::size_t index = (k - get_valid_units_start()) / (pfs_ + 1); + switch (index) + { + case 0: + rt = rt_ratio(atto()); + break; + case 1: + rt = rt_ratio(femto()); + break; + case 2: + rt = rt_ratio(pico()); + break; + case 3: + rt = rt_ratio(nano()); + break; + case 4: + rt = rt_ratio(micro()); + break; + case 5: + rt = rt_ratio(milli()); + break; + case 6: + rt = rt_ratio(centi()); + break; + case 7: + rt = rt_ratio(deci()); + break; + case 8: + rt = rt_ratio(deca()); + break; + case 9: + rt = rt_ratio(hecto()); + break; + case 10: + rt = rt_ratio(kilo()); + break; + case 11: + rt = rt_ratio(mega()); + break; + case 12: + rt = rt_ratio(giga()); + break; + case 13: + rt = rt_ratio(tera()); + break; + case 14: + rt = rt_ratio(peta()); + break; + case 15: + rt = rt_ratio(exa()); + break; + case 16: + rt = rt_ratio(ratio<1> ()); + break; + case 17: + rt = rt_ratio(ratio<60> ()); + break; + case 18: + rt = rt_ratio(ratio<3600> ()); + break; + default: + return false; + } + return true; + } + + /** + * @return pointer to the start of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_start()const + { + return detail::duration_units_default_holder::n_d_valid_units_; + } + /** + * @return pointer to the end of valid [N/D] units. + */ + virtual const string_type* get_n_d_valid_units_end()const + { + return detail::duration_units_default_holder::n_d_valid_units_ + (pfs_ + 1); + } + + /** + * @return pointer to the start of valid units. + */ + virtual string_type* get_valid_units_start() const + { + return detail::duration_units_default_holder::valid_units_; + } + /** + * @return pointer to the end of valid units. + */ + virtual string_type* get_valid_units_end() const + { + return detail::duration_units_default_holder::valid_units_ + 19 * (pfs_ + 1); + } + + string_type get_pattern() const + { + static const CharT t[] = + { '%', 'v', ' ', '%', 'u' }; + static const string_type pattern(t, t + sizeof (t) / sizeof (t[0])); + + return pattern; + } + + protected: + /** + * + * This facet names the units associated to the following periods: + * atto,femto,pico,nano,micro,milli,centi,deci,ratio<1>,deca,hecto,kilo,mega,giga,tera,peta,exa,ratio<60> and ratio<3600>. + * @return true if the unit associated to the given Period is named, false otherwise. + */ + bool do_is_named_unit(rt_ratio rt) const + { + if (rt.num==1) { + switch (rt.den) + { + case BOOST_RATIO_INTMAX_C(1): + case BOOST_RATIO_INTMAX_C(10): + case BOOST_RATIO_INTMAX_C(100): + case BOOST_RATIO_INTMAX_C(1000): + case BOOST_RATIO_INTMAX_C(1000000): + case BOOST_RATIO_INTMAX_C(1000000000): + case BOOST_RATIO_INTMAX_C(1000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return true; + default: + return false; + } + } else if (rt.den==1) { + switch (rt.num) + { + case BOOST_RATIO_INTMAX_C(10): + case BOOST_RATIO_INTMAX_C(60): + case BOOST_RATIO_INTMAX_C(100): + case BOOST_RATIO_INTMAX_C(1000): + case BOOST_RATIO_INTMAX_C(3600): + case BOOST_RATIO_INTMAX_C(1000000): + case BOOST_RATIO_INTMAX_C(1000000000): + case BOOST_RATIO_INTMAX_C(1000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000): + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return true; + default: + return false; + } + } + return false; + + } + + /** + * In English the suffix used after [N/D] is the one associated to the period ratio<1>. + * @return the [N/D] suffix unit associated to this duration. + */ + string_type do_get_n_d_unit(duration_style style, rt_ratio, intmax_t v) const + { + return do_get_unit(style, ratio<1>(), do_get_plural_form(v)); + } + + /** + * @return the unit associated to this duration if it is named, "" otherwise. + */ + string_type do_get_unit(duration_style style, rt_ratio rt, intmax_t v) const + { + if (rt.num==1) { + switch (rt.den) + { + case BOOST_RATIO_INTMAX_C(1): + return do_get_unit(style, ratio<1>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(10): + return do_get_unit(style, deci(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(100): + return do_get_unit(style, centi(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000): + return do_get_unit(style, milli(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000): + return do_get_unit(style, micro(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000): + return do_get_unit(style, nano(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000): + return do_get_unit(style, pico(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000): + return do_get_unit(style, femto(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return do_get_unit(style, atto(), do_get_plural_form(v)); + default: + ; + } + } else if (rt.den==1) { + switch (rt.num) + { + case BOOST_RATIO_INTMAX_C(10): + return do_get_unit(style, deca(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(60): + return do_get_unit(style, ratio<60>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(100): + return do_get_unit(style, hecto(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000): + return do_get_unit(style, kilo(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(3600): + return do_get_unit(style, ratio<3600>(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000): + return do_get_unit(style, mega(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000): + return do_get_unit(style, giga(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000): + return do_get_unit(style, tera(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000): + return do_get_unit(style, peta(), do_get_plural_form(v)); + case BOOST_RATIO_INTMAX_C(1000000000000000000): + return do_get_unit(style, exa(), do_get_plural_form(v)); + default: + ; + } + } + BOOST_ASSERT(false&&"ratio parameter can not be translated"); + //throw "exception"; + return string_type(); + } + + protected: + /** + * @return the number of associated plural forms this facet manages. + */ + virtual std::size_t do_get_plural_forms() const + { + return static_get_plural_forms(); + } + static std::size_t static_get_plural_forms() + { + return pfs_; + } + /** + * Gets the associated plural form. + * @param value the duration representation + * @return the plural form associated to the @c value parameter. In English there are 2 plural forms + * 0 singular (-1 or 1) + * 1 plural for all others + */ + virtual std::size_t do_get_plural_form(int_least64_t value) const + { + return static_get_plural_form(value); + } + static std::size_t static_get_plural_form(int_least64_t value) + { + return (value == -1 || value == 1) ? 0 : 1; + } + + /** + * @param style the duration style. + * @param period the period associated to the duration seconds. + * @param pf the requested plural form. + * @return if style is symbol returns "s", otherwise if pf is 0 return "second", if pf is 1 "seconds" + */ + virtual string_type do_get_unit(duration_style style, ratio<1> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<1> , std::size_t pf) + { + static const CharT t[] = + { 's' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + static const CharT u[] = + { 's', 'e', 'c', 'o', 'n', 'd' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 's', 'e', 'c', 'o', 'n', 'd', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) + { + return symbol; + } + if (pf == 0) + { + return singular; + } + if (pf == 1) + { + return plural; + } + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + } + + /** + * @param style the duration style. + * @param period the period associated to the duration minutes. + * @param pf the requested plural form. + * @return if style is symbol returns "min", otherwise if pf is 0 return "minute", if pf is 1 "minutes" + */ + virtual string_type do_get_unit(duration_style style, ratio<60> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<60> , std::size_t pf) + { + static const CharT t[] = + { 'm', 'i', 'n' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + + static const CharT u[] = + { 'm', 'i', 'n', 'u', 't', 'e' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 'm', 'i', 'n', 'u', 't', 'e', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) return symbol; + if (pf == 0) return singular; + if (pf == 1) return plural; + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + + } + + /** + * @param style the duration style. + * @param period the period associated to the duration hours. + * @param pf the requested plural form. + * @return if style is symbol returns "h", otherwise if pf is 0 return "hour", if pf is 1 "hours" + */ + virtual string_type do_get_unit(duration_style style, ratio<3600> u, std::size_t pf) const + { + return static_get_unit(style,u,pf); + } + static string_type static_get_unit(duration_style style, ratio<3600> , std::size_t pf) + { + static const CharT t[] = + { 'h' }; + static const string_type symbol(t, t + sizeof (t) / sizeof (t[0])); + static const CharT u[] = + { 'h', 'o', 'u', 'r' }; + static const string_type singular(u, u + sizeof (u) / sizeof (u[0])); + static const CharT v[] = + { 'h', 'o', 'u', 'r', 's' }; + static const string_type plural(v, v + sizeof (v) / sizeof (v[0])); + + if (style == duration_style::symbol) return symbol; + if (pf == 0) return singular; + if (pf == 1) return plural; + BOOST_ASSERT(false&&"style/pf parameters not valid"); + //throw "exception"; + return string_type(); + + } + /** + * @param style the duration style. + * @param u the period tag atto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to @c period + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, atto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, atto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + /** + * @param style the duration style. + * @param u the period tag femto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to period @c u + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, femto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, femto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + /** + * @param style the duration style. + * @param u the period tag femto. + * @param pf the requested plural form. + * @return the concatenation of the prefix associated to period @c u + the one associated to seconds. + */ + virtual string_type do_get_unit(duration_style style, pico u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, pico u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, nano u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, nano u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, micro u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, micro u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, milli u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, milli u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, centi u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, centi u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, deci u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, deci u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, deca u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, deca u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, hecto u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, hecto u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, kilo u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, kilo u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, mega u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, mega u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, giga u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, giga u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, tera u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, tera u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, peta u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, peta u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + virtual string_type do_get_unit(duration_style style, exa u, std::size_t pf) const + { + return do_get_ratio_prefix(style, u) + do_get_unit(style, ratio<1> (), pf); + } + static string_type static_get_unit(duration_style style, exa u, std::size_t pf) + { + return static_get_ratio_prefix(style, u) + static_get_unit(style, ratio<1> (), pf); + } + + protected: + + /** + * @param style the duration style. + * @param u the period tag atto. + * @return depending on the value of @c style return the ratio_string symbol or prefix. + */ + virtual string_type do_get_ratio_prefix(duration_style style, atto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, atto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, femto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, femto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, pico u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, pico) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, nano u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, nano) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, micro u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, micro) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, milli u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, milli) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, centi u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, centi) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, deci u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, deci) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, deca u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, deca) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, hecto u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, hecto) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, kilo u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, kilo) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, mega u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, mega) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, giga u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, giga) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, tera u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, tera) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, peta u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, peta) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + virtual string_type do_get_ratio_prefix(duration_style style, exa u) const + { + return static_get_ratio_prefix(style, u); + } + static string_type static_get_ratio_prefix(duration_style style, exa) + { + if (style == duration_style::symbol) return ratio_string::symbol(); + return ratio_string::prefix(); + } + + protected: + template + string_type* fill_units(string_type* it, Period) const + { + std::size_t pfs = do_get_plural_forms(); + for (std::size_t pf = 0; pf < pfs; ++pf) + { + *it++ = do_get_unit(duration_style::prefix, Period(), pf); + } + *it++ = do_get_unit(duration_style::symbol, Period(), 0); + return it; + } + public: + template + static string_type* static_fill_units(string_type* it, Period) + { + std::size_t pfs = static_get_plural_forms(); + for (std::size_t pf = 0; pf < pfs; ++pf) + { + *it++ = static_get_unit(duration_style::prefix, Period(), pf); + } + *it++ = static_get_unit(duration_style::symbol, Period(), 0); + return it; + } + static string_type* static_init_valid_units(string_type* it) + { + it = static_fill_units(it, atto()); + it = static_fill_units(it, femto()); + it = static_fill_units(it, pico()); + it = static_fill_units(it, nano()); + it = static_fill_units(it, micro()); + it = static_fill_units(it, milli()); + it = static_fill_units(it, centi()); + it = static_fill_units(it, deci()); + it = static_fill_units(it, deca()); + it = static_fill_units(it, hecto()); + it = static_fill_units(it, kilo()); + it = static_fill_units(it, mega()); + it = static_fill_units(it, giga()); + it = static_fill_units(it, tera()); + it = static_fill_units(it, peta()); + it = static_fill_units(it, exa()); + it = static_fill_units(it, ratio<1> ()); + it = static_fill_units(it, ratio<60> ()); + it = static_fill_units(it, ratio<3600> ()); + return it; + } + }; + + namespace detail + { + + template + struct duration_units_default_initializer_t + { + duration_units_default_initializer_t() + { + if (!duration_units_default_holder::initialized_) + { + typedef typename duration_units_default_holder::string_type string_type; + duration_units_default_holder::n_d_valid_units_ = new string_type[3]; + duration_units_default_holder::valid_units_ = new string_type[19 * 3]; + + string_type* it = duration_units_default_holder::n_d_valid_units_; + it = duration_units_default::static_fill_units(it, ratio<1> ()); + it = duration_units_default::static_init_valid_units(duration_units_default_holder::valid_units_); + + duration_units_default_holder::initialized_ = true; + } + } + }; + namespace /**/ + { + duration_units_default_initializer_t duration_units_default_initializer; + duration_units_default_initializer_t wduration_units_default_initializer; + } // namespace + } + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp b/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp new file mode 100644 index 000000000..6e320a567 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/ios_base_state.hpp @@ -0,0 +1,151 @@ +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_IOS_BASE_STATE_HPP +#define BOOST_CHRONO_IO_IOS_BASE_STATE_HPP + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + class fmt_masks : public ios_flags + { + typedef ios_flags base_type; + fmt_masks& operator=(fmt_masks const& rhs) ; + + public: + fmt_masks(std::ios_base& ios): base_type(ios) {} + enum type + { + uses_symbol = 1 << 0, + uses_local = 1 << 1 + }; + + inline duration_style get_duration_style() + { + return (flags() & uses_symbol) ? duration_style::symbol : duration_style::prefix; + } + inline void set_duration_style(duration_style style) + { + if (style == duration_style::symbol) + setf(uses_symbol); + else + unsetf(uses_symbol); + } + + inline timezone get_timezone() + { + return (flags() & uses_local) ? timezone::local : timezone::utc; + } + inline void set_timezone(timezone tz) + { + if (tz == timezone::local) + setf(uses_local); + else + unsetf(uses_local); + } + }; + namespace detail + { + namespace /**/ { + xalloc_key_initializer fmt_masks_xalloc_key_initializer; + } // namespace + } // namespace detail + + inline duration_style get_duration_style(std::ios_base & ios) + { + return fmt_masks(ios).get_duration_style(); + } + inline void set_duration_style(std::ios_base& ios, duration_style style) + { + fmt_masks(ios).set_duration_style(style); + } + inline std::ios_base& symbol_format(std::ios_base& ios) + { + fmt_masks(ios).setf(fmt_masks::uses_symbol); + return ios; + } + inline std::ios_base& name_format(std::ios_base& ios) + { + fmt_masks(ios).unsetf(fmt_masks::uses_symbol); + return ios; + } + + inline timezone get_timezone(std::ios_base & ios) + { + return fmt_masks(ios).get_timezone(); + } + inline void set_timezone(std::ios_base& ios, timezone tz) + { + fmt_masks(ios).set_timezone(tz); + } + inline std::ios_base& local_timezone(std::ios_base& ios) + { + fmt_masks(ios).setf(fmt_masks::uses_local); + return ios; + } + + inline std::ios_base& utc_timezone(std::ios_base& ios) + { + fmt_masks(ios).unsetf(fmt_masks::uses_local); + return ios; + } + + namespace detail + { + + template + struct ios_base_data_aux + { + std::basic_string time_fmt; + std::basic_string duration_fmt; + public: + + ios_base_data_aux() : + time_fmt(""), + duration_fmt("") + { + } + }; + template + struct ios_base_data {}; + namespace /**/ { + xalloc_key_initializer > ios_base_data_aux_xalloc_key_initializer; + xalloc_key_initializer > wios_base_data_aux_xalloc_key_initializer; +#if BOOST_CHRONO_HAS_UNICODE_SUPPORT + xalloc_key_initializer > u16ios_base_data_aux_xalloc_key_initializer; + xalloc_key_initializer > u32ios_base_data_aux_xalloc_key_initializer; +#endif + } // namespace + } // namespace detail + + template + inline std::basic_string get_time_fmt(std::ios_base & ios) + { + ios_state_not_null_ptr, detail::ios_base_data_aux > ptr(ios); + return ptr->time_fmt; + } + template + inline void set_time_fmt(std::ios_base& ios, std::basic_string< + CharT> const& fmt) + { + ios_state_not_null_ptr, detail::ios_base_data_aux > ptr(ios); + ptr->time_fmt = fmt; + } + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_get.hpp b/project/jni/boost/include/boost/chrono/io/time_point_get.hpp new file mode 100644 index 000000000..5e4acd39c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_get.hpp @@ -0,0 +1,330 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_TIME_POINT_GET_HPP +#define BOOST_CHRONO_IO_TIME_POINT_GET_HPP + +#include +#include +#include +#include +#include +#include +#include + +/** + * Duration formatting facet for input. + */ +namespace boost +{ + namespace chrono + { + + template > + class time_point_get: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of iterator used to scan the character buffer. + */ + typedef InputIterator iter_type; + + /** + * Construct a @c time_point_get facet. + * @param refs + * @Effects Construct a @c time_point_get facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + + explicit time_point_get(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param s start input stream iterator + * @param end end input stream iterator + * @param ios a reference to a ios_base + * @param err the ios_base state + * @param d the duration + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * Requires: [pattern,pat_end) shall be a valid range. + * + * Effects: The function starts by evaluating err = std::ios_base::goodbit. + * It then enters a loop, reading zero or more characters from s at + * each iteration. Unless otherwise specified below, the loop + * terminates when the first of the following conditions holds: + * - The expression pattern == pat_end evaluates to true. + * - The expression err == std::ios_base::goodbit evaluates to false. + * - The expression s == end evaluates to true, in which case the + * function evaluates err = std::ios_base::eofbit | std::ios_base::failbit. + * - The next element of pattern is equal to '%', followed by a conversion + * specifier character, the functions @c get_duration or @c get_epoch are called depending on + * whether the format is @c 'd' or @c 'e'. + * If the number of elements in the range [pattern,pat_end) is not + * sufficient to unambiguously determine whether the conversion + * specification is complete and valid, the function evaluates + * err = std::ios_base::failbit. Otherwise, the function evaluates + * s = do_get(s, end, ios, err, d). If err == std::ios_base::goodbit holds after + * the evaluation of the expression, the function increments pattern to + * point just past the end of the conversion specification and continues + * looping. + * - The expression isspace(*pattern, ios.getloc()) evaluates to true, in + * which case the function first increments pattern until + * pattern == pat_end || !isspace(*pattern, ios.getloc()) evaluates to true, + * then advances s until s == end || !isspace(*s, ios.getloc()) is true, + * and finally resumes looping. + * - The next character read from s matches the element pointed to by + * pattern in a case-insensitive comparison, in which case the function + * evaluates ++pattern, ++s and continues looping. Otherwise, the function + * evaluates err = std::ios_base::failbit. + * + * Returns: s + */ + + template + iter_type get(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + time_point &tp, const char_type *pattern, const char_type *pat_end) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + return get(facet, i, e, is, err, tp, pattern, pat_end); + } + else + { + time_point_units_default facet; + return get(facet, i, e, is, err, tp, pattern, pat_end); + } + } + + template + iter_type get(time_point_units const &facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, time_point &tp, const char_type *pattern, + const char_type *pat_end) const + { + + Duration d; + bool duration_found = false, epoch_found = false; + + const std::ctype& ct = std::use_facet >(ios.getloc()); + err = std::ios_base::goodbit; + while (pattern != pat_end && err == std::ios_base::goodbit) + { + if (s == end) + { + err |= std::ios_base::eofbit; + break; + } + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + err |= std::ios_base::failbit; + return s; + } + char cmd = ct.narrow(*pattern, 0); + switch (cmd) + { + case 'd': + { + if (duration_found) + { + err |= std::ios_base::failbit; + return s; + } + duration_found = true; + s = get_duration(s, end, ios, err, d); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + case 'e': + { + if (epoch_found) + { + err |= std::ios_base::failbit; + return s; + } + epoch_found = true; + s = get_epoch (facet, s, end, ios, err); + if (err & (std::ios_base::badbit | std::ios_base::failbit)) + { + return s; + } + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + + ++pattern; + } + else if (ct.is(std::ctype_base::space, *pattern)) + { + for (++pattern; pattern != pat_end && ct.is(std::ctype_base::space, *pattern); ++pattern) + ; + for (; s != end && ct.is(std::ctype_base::space, *s); ++s) + ; + } + else if (ct.toupper(*s) == ct.toupper(*pattern)) + { + ++s; + ++pattern; + } + else + { + err |= std::ios_base::failbit; + } + } + + // Success! Store it. + tp = time_point (d); + return s; + } + + /** + * + * @param s an input stream iterator + * @param ios a reference to a ios_base + * @param d the duration + * Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if + * @code + * return get(s, end, ios, err, ios, d, str.data(), str.data() + str.size()); + * @codeend + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name + */ + template + iter_type get(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + time_point &tp) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + std::basic_string str = facet.get_pattern(); + return get(facet, i, e, is, err, tp, str.data(), str.data() + str.size()); + } + else + { + time_point_units_default facet; + std::basic_string str = facet.get_pattern(); + return get(facet, i, e, is, err, tp, str.data(), str.data() + str.size()); + } + } + + /** + * As if + * @code + * return facet.get(s, end, ios, err, d); + * @endcode + * where @c facet is either the @c duration_get facet associated to the @c ios or an instance of the default @c duration_get facet. + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid duration. + */ + template + iter_type get_duration(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, + duration& d) const + { + if (std::has_facet >(is.getloc())) + { + duration_get const &facet = std::use_facet >(is.getloc()); + return get_duration(facet, i, e, is, err, d); + } + else + { + duration_get facet; + return get_duration(facet, i, e, is, err, d); + } + } + + template + iter_type get_duration(duration_get const& facet, iter_type s, iter_type end, std::ios_base& ios, + std::ios_base::iostate& err, duration& d) const + { + return facet.get(s, end, ios, err, d); + } + + /** + * + * @Effects Let @c facet be the @c time_point_units facet associated to @c is or a new instance of the default @c time_point_units_default facet. + * Let @c epoch be the epoch string associated to the Clock using this facet. + * Scans @c i to match @c epoch or @c e is reached. + * + * If not match before the @c e is reached @c std::ios_base::failbit is set in @c err. + * If @c e is reached @c std::ios_base::failbit is set in @c err. + * + * @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid epoch. + */ + template + iter_type get_epoch(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err) const + { + if (std::has_facet >(is.getloc())) + { + time_point_units const &facet = std::use_facet >(is.getloc()); + return get_epoch(facet, i, e, is, err); + } + else + { + time_point_units_default facet; + return get_epoch(facet, i, e, is, err); + } + } + + template + iter_type get_epoch(time_point_units const &facet, iter_type i, iter_type e, std::ios_base&, + std::ios_base::iostate& err) const + { + const std::basic_string epoch = facet.template get_epoch (); + std::ptrdiff_t k = chrono_detail::scan_keyword(i, e, &epoch, &epoch + 1, + //~ std::use_facet >(ios.getloc()), + err) - &epoch; + if (k == 1) + { + err |= std::ios_base::failbit; + return i; + } + return i; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~time_point_get() + { + } + }; + + /** + * Unique identifier for this type of facet. + */ + template + std::locale::id time_point_get::id; + + } // chrono +} +// boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_io.hpp b/project/jni/boost/include/boost/chrono/io/time_point_io.hpp new file mode 100644 index 000000000..c10b8364c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_io.hpp @@ -0,0 +1,1082 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). + +//===-------------------------- locale ------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost and some functions from libc++/locale to emulate the missing time_get::get() + +#ifndef BOOST_CHRONO_IO_TIME_POINT_IO_HPP +#define BOOST_CHRONO_IO_TIME_POINT_IO_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_CHRONO_INTERNAL_TIMEGM defined BOOST_WINDOWS && ! defined(__CYGWIN__) +#define BOOST_CHRONO_INTERNAL_GMTIME defined BOOST_WINDOWS && ! defined(__CYGWIN__) + +#define BOOST_CHRONO_USES_INTERNAL_TIME_GET + + +namespace boost +{ + namespace chrono + { + namespace detail + { + + template > + struct time_get + { + std::time_get const &that_; + time_get(std::time_get const& that) : that_(that) {} + + typedef std::time_get facet; + typedef typename facet::iter_type iter_type; + typedef typename facet::char_type char_type; + typedef std::basic_string string_type; + + static int + get_up_to_n_digits( + InputIterator& b, InputIterator e, + std::ios_base::iostate& err, + const std::ctype& ct, + int n) + { + // Precondition: n >= 1 + if (b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return 0; + } + // get first digit + CharT c = *b; + if (!ct.is(std::ctype_base::digit, c)) + { + err |= std::ios_base::failbit; + return 0; + } + int r = ct.narrow(c, 0) - '0'; + for (++b, --n; b != e && n > 0; ++b, --n) + { + // get next digit + c = *b; + if (!ct.is(std::ctype_base::digit, c)) + return r; + r = r * 10 + ct.narrow(c, 0) - '0'; + } + if (b == e) + err |= std::ios_base::eofbit; + return r; + } + + + void get_day( + int& d, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && 1 <= t && t <= 31) + d = t; + else + err |= std::ios_base::failbit; + } + + void get_month( + int& m, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2) - 1; + if (!(err & std::ios_base::failbit) && t <= 11) + m = t; + else + err |= std::ios_base::failbit; + } + + + void get_year4(int& y, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 4); + if (!(err & std::ios_base::failbit)) + y = t - 1900; + } + + void + get_hour(int& h, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 23) + h = t; + else + err |= std::ios_base::failbit; + } + + void + get_minute(int& m, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 59) + m = t; + else + err |= std::ios_base::failbit; + } + + void + get_second(int& s, + iter_type& b, iter_type e, + std::ios_base::iostate& err, + const std::ctype& ct) const + { + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && t <= 60) + s = t; + else + err |= std::ios_base::failbit; + } + + + + InputIterator get( + iter_type b, iter_type e, + std::ios_base& iob, + std::ios_base::iostate& err, + std::tm* tm, + char fmt, char) const + { + err = std::ios_base::goodbit; + const std::ctype& ct = std::use_facet >(iob.getloc()); + + switch (fmt) + { +// case 'a': +// case 'A': +// that_.get_weekdayname(tm->tm_wday, b, e, err, ct); +// break; +// case 'b': +// case 'B': +// case 'h': +// that_.get_monthname(tm->tm_mon, b, e, err, ct); +// break; +// case 'c': +// { +// const string_type& fm = this->c(); +// b = that_.get(b, e, iob, err, tm, fm.data(), fm.data() + fm.size()); +// } +// break; + case 'd': + case 'e': + get_day(tm->tm_mday, b, e, err, ct); + + break; +// case 'D': +// { +// const char_type fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'F': +// { +// const char_type fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; + case 'H': + get_hour(tm->tm_hour, b, e, err, ct); + break; +// case 'I': +// that_.get_12_hour(tm->tm_hour, b, e, err, ct); +// break; +// case 'j': +// that_.get_day_year_num(tm->tm_yday, b, e, err, ct); +// break; + case 'm': + get_month(tm->tm_mon, b, e, err, ct); + break; + case 'M': + get_minute(tm->tm_min, b, e, err, ct); + break; +// case 'n': +// case 't': +// that_.get_white_space(b, e, err, ct); +// break; +// case 'p': +// that_.get_am_pm(tm->tm_hour, b, e, err, ct); +// break; +// case 'r': +// { +// const char_type fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'R': +// { +// const char_type fm[] = {'%', 'H', ':', '%', 'M'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'S': +// that_.get_second(tm->tm_sec, b, e, err, ct); +// break; +// case 'T': +// { +// const char_type fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; +// b = that_.get(b, e, iob, err, tm, fm, fm + sizeof(fm)/sizeof(fm[0])); +// } +// break; +// case 'w': +// that_.get_weekday(tm->tm_wday, b, e, err, ct); +// break; +// case 'x': +// return that_.get_date(b, e, iob, err, tm); +// case 'X': +// { +// const string_type& fm = this->X(); +// b = that_.get(b, e, iob, err, tm, fm.data(), fm.data() + fm.size()); +// } +// break; +// case 'y': +// that_.get_year(tm->tm_year, b, e, err, ct); + break; + case 'Y': + get_year4(tm->tm_year, b, e, err, ct); + break; +// case '%': +// that_.get_percent(b, e, err, ct); +// break; + default: + err |= std::ios_base::failbit; + } + return b; + } + + + InputIterator get( + iter_type b, iter_type e, + std::ios_base& iob, + std::ios_base::iostate& err, std::tm* tm, + const char_type* fmtb, const char_type* fmte) const + { + const std::ctype& ct = std::use_facet >(iob.getloc()); + err = std::ios_base::goodbit; + while (fmtb != fmte && err == std::ios_base::goodbit) + { + if (b == e) + { + err = std::ios_base::failbit; + break; + } + if (ct.narrow(*fmtb, 0) == '%') + { + if (++fmtb == fmte) + { + err = std::ios_base::failbit; + break; + } + char cmd = ct.narrow(*fmtb, 0); + char opt = '\0'; + if (cmd == 'E' || cmd == '0') + { + if (++fmtb == fmte) + { + err = std::ios_base::failbit; + break; + } + opt = cmd; + cmd = ct.narrow(*fmtb, 0); + } + b = get(b, e, iob, err, tm, cmd, opt); + ++fmtb; + } + else if (ct.is(std::ctype_base::space, *fmtb)) + { + for (++fmtb; fmtb != fmte && ct.is(std::ctype_base::space, *fmtb); ++fmtb) + ; + for ( ; b != e && ct.is(std::ctype_base::space, *b); ++b) + ; + } + else if (ct.toupper(*b) == ct.toupper(*fmtb)) + { + ++b; + ++fmtb; + } + else + err = std::ios_base::failbit; + } + if (b == e) + err |= std::ios_base::eofbit; + return b; + } + + }; + + + template + class time_manip: public manip > + { + std::basic_string fmt_; + timezone tz_; + public: + + time_manip(timezone tz, std::basic_string fmt) + // todo move semantics + : + fmt_(fmt), tz_(tz) + { + } + + /** + * Change the timezone and time format ios state; + */ + void operator()(std::ios_base &ios) const + { + set_time_fmt (ios, fmt_); + set_timezone(ios, tz_); + } + }; + + class time_man: public manip + { + timezone tz_; + public: + + time_man(timezone tz) + // todo move semantics + : + tz_(tz) + { + } + + /** + * Change the timezone and time format ios state; + */ + void operator()(std::ios_base &ios) const + { + //set_time_fmt(ios, ""); + set_timezone(ios, tz_); + } + }; + + } + + template + inline detail::time_manip time_fmt(timezone tz, const CharT* fmt) + { + return detail::time_manip(tz, fmt); + } + + template + inline detail::time_manip time_fmt(timezone tz, std::basic_string fmt) + { + // todo move semantics + return detail::time_manip(tz, fmt); + } + + inline detail::time_man time_fmt(timezone f) + { + return detail::time_man(f); + } + + /** + * time_fmt_io_saver i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + template > + struct time_fmt_io_saver + { + + //! the type of the state to restore + typedef std::basic_ostream state_type; + //! the type of aspect to save + typedef std::basic_string aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c time format . + */ + explicit time_fmt_io_saver(state_type &s) : + s_save_(s), a_save_(get_time_fmt(s_save_)) + { + } + + /** + * Construction from an i/o stream and a @c time format to restore. + * + * Stores a reference to the i/o stream and the value @c new_value to restore given as parameter. + */ + time_fmt_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the format to be restored. + */ + ~time_fmt_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the time format to be restored. + */ + void restore() + { + set_time_fmt(a_save_, a_save_); + } + private: + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * timezone_io_saver i/o saver. + * + * See Boost.IO i/o state savers for a motivating compression. + */ + struct timezone_io_saver + { + + //! the type of the state to restore + typedef std::ios_base state_type; + //! the type of aspect to save + typedef timezone aspect_type; + + /** + * Explicit construction from an i/o stream. + * + * Store a reference to the i/o stream and the value of the associated @c timezone. + */ + explicit timezone_io_saver(state_type &s) : + s_save_(s), a_save_(get_timezone(s_save_)) + { + } + + /** + * Construction from an i/o stream and a @c timezone to restore. + * + * Stores a reference to the i/o stream and the value @c new_value to restore given as parameter. + */ + timezone_io_saver(state_type &s, aspect_type new_value) : + s_save_(s), a_save_(new_value) + { + } + + /** + * Destructor. + * + * Restores the i/o stream with the format to be restored. + */ + ~timezone_io_saver() + { + this->restore(); + } + + /** + * Restores the i/o stream with the timezone to be restored. + */ + void restore() + { + set_timezone(s_save_, a_save_); + } + private: + timezone_io_saver& operator=(timezone_io_saver const& rhs) ; + + state_type& s_save_; + aspect_type a_save_; + }; + + /** + * + * @param os + * @param tp + * @Effects Behaves as a formatted output function. After constructing a @c sentry object, if the @ sentry + * converts to true, calls to @c facet.put(os,os,os.fill(),tp) where @c facet is the @c time_point_put + * facet associated to @c os or a new created instance of the default @c time_point_put facet. + * @return @c os. + */ + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_point& tp) + { + + bool failed = false; + BOOST_TRY + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + typename std::basic_ostream::sentry opfx(os); + if (bool(opfx)) + { + if (!std::has_facet >(os.getloc())) + { + if (time_point_put ().put(os, os, os.fill(), tp) .failed()) + { + err = std::ios_base::badbit; + } + } + else + { + if (std::use_facet >(os.getloc()) .put(os, os, os.fill(), tp).failed()) + { + err = std::ios_base::badbit; + } + } + os.width(0); + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + os.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) os.setstate(err); + return os; + } + BOOST_CATCH (...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) os.setstate(std::ios_base::failbit | std::ios_base::badbit); + return os; + } + + template + std::basic_istream& + operator>>(std::basic_istream& is, time_point& tp) + { + std::ios_base::iostate err = std::ios_base::goodbit; + + BOOST_TRY + { + typename std::basic_istream::sentry ipfx(is); + if (bool(ipfx)) + { + if (!std::has_facet >(is.getloc())) + { + time_point_get ().get(is, std::istreambuf_iterator(), is, err, tp); + } + else + { + std::use_facet >(is.getloc()).get(is, std::istreambuf_iterator(), is, + err, tp); + } + } + } + BOOST_CATCH (...) + { + bool flag = false; + BOOST_TRY + { + is.setstate(std::ios_base::failbit); + } + BOOST_CATCH (std::ios_base::failure ) + { + flag = true; + } + BOOST_CATCH_END + if (flag) throw; + } + BOOST_CATCH_END + if (err) is.setstate(err); + return is; + } + + + namespace detail + { + + inline int32_t is_leap(int32_t year) + { + if(year % 400 == 0) + return 1; + if(year % 100 == 0) + return 0; + if(year % 4 == 0) + return 1; + return 0; + } + inline int32_t days_from_0(int32_t year) + { + year--; + return 365 * year + (year / 400) - (year/100) + (year / 4); + } + inline int32_t days_from_1970(int32_t year) + { + static const int days_from_0_to_1970 = days_from_0(1970); + return days_from_0(year) - days_from_0_to_1970; + } + inline int32_t days_from_1jan(int32_t year,int32_t month,int32_t day) + { + static const int32_t days[2][12] = + { + { 0,31,59,90,120,151,181,212,243,273,304,334}, + { 0,31,60,91,121,152,182,213,244,274,305,335} + }; + return days[is_leap(year)][month-1] + day - 1; + } + + inline time_t internal_timegm(std::tm const *t) + { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if(month > 11) + { + year += month/12; + month %= 12; + } + else if(month < 0) + { + int years_diff = (-month + 11)/12; + year -= years_diff; + month+=12 * years_diff; + } + month++; + int day = t->tm_mday; + int day_of_year = days_from_1jan(year,month,day); + int days_since_epoch = days_from_1970(year) + day_of_year; + + time_t seconds_in_day = 3600 * 24; + time_t result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec; + + return result; + } + + /** + * from_ymd could be made more efficient by using a table + * day_count_table indexed by the y%400. + * This table could contain the day_count + * by*365 + by/4 - by/100 + by/400 + * + * from_ymd = (by/400)*days_by_400_years+day_count_table[by%400] + + * days_in_year_before[is_leap_table[by%400]][m-1] + d; + */ + inline unsigned days_before_years(int32_t y) + { + return y * 365 + y / 4 - y / 100 + y / 400; + } + + inline std::tm * internal_gmtime(std::time_t const* t, std::tm *tm) + { + if (t==0) return 0; + if (tm==0) return 0; + + static const unsigned char + day_of_year_month[2][366] = + { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 }, + + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 + + } }; + + static const int32_t days_in_year_before[2][13] = + { + { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }, + { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 } + }; + + const time_t seconds_in_day = 3600 * 24; + int32_t days_since_epoch = static_cast(*t / seconds_in_day); + int32_t hms = static_cast(*t - seconds_in_day*days_since_epoch); + if (hms < 0) { + days_since_epoch-=1; + hms = seconds_in_day+hms; + } + + int32_t x = days_since_epoch; + int32_t y = static_cast (static_cast (x + 2) * 400 + / 146097); + const int32_t ym1 = y - 1; + int32_t doy = x - days_before_years(y); + const int32_t doy1 = x - days_before_years(ym1); + const int32_t N = std::numeric_limits::digits - 1; + const int32_t mask1 = doy >> N; // arithmetic rshift - not portable - but nearly universal + const int32_t mask0 = ~mask1; + doy = (doy & mask0) | (doy1 & mask1); + y = (y & mask0) | (ym1 & mask1); + //y -= 32767 + 2; + y += 70; + tm->tm_year=y; + const bool leap = is_leap(y); + tm->tm_mon = day_of_year_month[leap][doy]-1; + tm->tm_mday = doy - days_in_year_before[leap][day_of_year_month[leap][doy] - 1]; + + + tm->tm_hour = hms / 3600; + const int ms = hms % 3600; + tm->tm_min = ms / 60; + tm->tm_sec = ms % 60; + + return tm; + } + + } // detail +#ifndef BOOST_CHRONO_NO_UTC_TIMEPOINT + +#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + + template + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_point& tp) + { + typename std::basic_ostream::sentry ok(os); + if (bool(ok)) + { + bool failed = false; + BOOST_TRY + { + const CharT* pb = 0; //nullptr; + const CharT* pe = pb; + std::basic_string fmt = get_time_fmt (os); + pb = fmt.data(); + pe = pb + fmt.size(); + + timezone tz = get_timezone(os); + std::locale loc = os.getloc(); + time_t t = system_clock::to_time_t(time_point_cast(tp)); + std::tm tm; + if (tz == timezone::local) + { +#if defined BOOST_WINDOWS && ! defined(__CYGWIN__) + std::tm *tmp = 0; + if ((tmp=localtime(&t)) == 0) + failed = true; + else + tm =*tmp; +#else + if (localtime_r(&t, &tm) == 0) failed = true; +#endif + } + else + { +#if BOOST_CHRONO_INTERNAL_GMTIME + if (detail::internal_gmtime(&t, &tm) == 0) failed = true; + +#elif defined BOOST_WINDOWS && ! defined(__CYGWIN__) + std::tm *tmp = 0; + if((tmp = gmtime(&t)) == 0) + failed = true; + else + tm = *tmp; +#else + if (gmtime_r(&t, &tm) == 0) failed = true; +#endif + + } + if (!failed) + { + const std::time_put& tpf = std::use_facet >(loc); + if (pb == pe) + { + CharT pattern[] = + { '%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', '%', 'H', ':', '%', 'M', ':' }; + pb = pattern; + pe = pb + sizeof (pattern) / sizeof(CharT); + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + if (!failed) + { + duration d = tp - system_clock::from_time_t(t) + seconds(tm.tm_sec); + if (d.count() < 10) os << CharT('0'); + //if (! os.good()) { + // throw "exception"; + //} + std::ios::fmtflags flgs = os.flags(); + os.setf(std::ios::fixed, std::ios::floatfield); + //if (! os.good()) { + //throw "exception"; + //} + os << d.count(); + //if (! os.good()) { + //throw "exception"; + //} + os.flags(flgs); + if (tz == timezone::local) + { + CharT sub_pattern[] = + { ' ', '%', 'z' }; + pb = sub_pattern; + pe = pb + +sizeof (sub_pattern) / sizeof(CharT); + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + } + else + { + CharT sub_pattern[] = + { ' ', '+', '0', '0', '0', '0', 0 }; + os << sub_pattern; + } + } + } + else + { + failed = tpf.put(os, os, os.fill(), &tm, pb, pe).failed(); + } + } + } + BOOST_CATCH (...) + { + failed = true; + } + BOOST_CATCH_END + if (failed) + { + os.setstate(std::ios_base::failbit | std::ios_base::badbit); + } + } + return os; + } +#endif + + namespace detail + { + + template + minutes extract_z(InputIterator& b, InputIterator e, std::ios_base::iostate& err, const std::ctype& ct) + { + int min = 0; + if (b != e) + { + char cn = ct.narrow(*b, 0); + if (cn != '+' && cn != '-') + { + err |= std::ios_base::failbit; + return minutes(0); + } + int sn = cn == '-' ? -1 : 1; + int hr = 0; + for (int i = 0; i < 2; ++i) + { + if (++b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return minutes(0); + } + cn = ct.narrow(*b, 0); + if (! ('0' <= cn && cn <= '9')) + { + err |= std::ios_base::failbit; + return minutes(0); + } + hr = hr * 10 + cn - '0'; + } + for (int i = 0; i < 2; ++i) + { + if (++b == e) + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + return minutes(0); + } + cn = ct.narrow(*b, 0); + if (! ('0' <= cn && cn <= '9')) + { + err |= std::ios_base::failbit; + return minutes(0); + } + min = min * 10 + cn - '0'; + } + if (++b == e) { + err |= std::ios_base::eofbit; + } + min += hr * 60; + min *= sn; + } + else + { + err |= std::ios_base::eofbit | std::ios_base::failbit; + } + return minutes(min); + } + + } // detail + +#if defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + + template + std::basic_istream& + operator>>(std::basic_istream& is, time_point& tp) + { + typename std::basic_istream::sentry ok(is); + if (bool(ok)) + { + std::ios_base::iostate err = std::ios_base::goodbit; + BOOST_TRY + { + const CharT* pb = 0; //nullptr; + const CharT* pe = pb; + std::basic_string fmt = get_time_fmt (is); + pb = fmt.data(); + pe = pb + fmt.size(); + + timezone tz = get_timezone(is); + std::locale loc = is.getloc(); + const std::time_get& tg = std::use_facet >(loc); + const std::ctype& ct = std::use_facet >(loc); + tm tm; // {0} + typedef std::istreambuf_iterator It; + if (pb == pe) + { + CharT pattern[] = + { '%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', '%', 'H', ':', '%', 'M', ':' }; + pb = pattern; + pe = pb + sizeof (pattern) / sizeof(CharT); + tm.tm_sec=0; +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, pb, pe); +#else + tg.get(is, 0, is, err, &tm, pb, pe); +#endif + if (err & std::ios_base::failbit) goto exit; + double sec; + CharT c = CharT(); + is >> sec; + if (is.fail()) + { + err |= std::ios_base::failbit; + goto exit; + } + It i(is); + It eof; + c = *i; + if (++i == eof || c != ' ') + { + err |= std::ios_base::failbit; + goto exit; + } + minutes min = detail::extract_z(i, eof, err, ct); + + if (err & std::ios_base::failbit) goto exit; + time_t t; +#if BOOST_CHRONO_INTERNAL_TIMEGM + t = detail::internal_timegm(&tm); +#else + t = timegm(&tm); +#endif + tp = time_point_cast( + system_clock::from_time_t(t) - min + round (duration (sec)) + ); + } + else + { + const CharT z[2] = + { '%', 'z' }; + const CharT* fz = std::search(pb, pe, z, z + 2); +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, pb, fz); +#else + tg.get(is, 0, is, err, &tm, pb, fz); +#endif + minutes minu(0); + if (fz != pe) + { + if (err != std::ios_base::goodbit) + { + err |= std::ios_base::failbit; + goto exit; + } + It i(is); + It eof; + minu = detail::extract_z(i, eof, err, ct); + if (err & std::ios_base::failbit) goto exit; + if (fz + 2 != pe) + { + if (err != std::ios_base::goodbit) + { + err |= std::ios_base::failbit; + goto exit; + } +#if defined BOOST_CHRONO_USES_INTERNAL_TIME_GET + const detail::time_get& dtg(tg); + dtg.get(is, 0, is, err, &tm, fz + 2, pe); +#else + tg.get(is, 0, is, err, &tm, fz + 2, pe); +#endif + if (err & std::ios_base::failbit) goto exit; + } + } + tm.tm_isdst = -1; + time_t t; + if (tz == timezone::utc || fz != pe) + { +#if BOOST_CHRONO_INTERNAL_TIMEGM + t = detail::internal_timegm(&tm); +#else + t = timegm(&tm); +#endif + } + else + { + t = mktime(&tm); + } + tp = time_point_cast( + system_clock::from_time_t(t) - minu + ); + } + } + BOOST_CATCH (...) + { + err |= std::ios_base::badbit | std::ios_base::failbit; + } + BOOST_CATCH_END + exit: is.setstate(err); + } + return is; + } + +#endif +#endif //UTC + } // chrono + +} + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_put.hpp b/project/jni/boost/include/boost/chrono/io/time_point_put.hpp new file mode 100644 index 000000000..9c8c7cadd --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_put.hpp @@ -0,0 +1,261 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +/** + * Duration formatting facet for output. + */ +#ifndef BOOST_CHRONO_IO_TIME_POINT_PUT_HPP +#define BOOST_CHRONO_IO_TIME_POINT_PUT_HPP + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @tparam ChatT a character type + * @tparam OutputIterator a model of @c OutputIterator + * + * The @c time_point_put facet provides facilities for formatted output of @c time_point values. + * The member function of @c time_point_put take a @c time_point and format it into character string representation. + * + */ + template > + class time_point_put: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string passed to member functions. + */ + typedef std::basic_string string_type; + /** + * Type of iterator used to write in the character buffer. + */ + typedef OutputIterator iter_type; + + /** + * Construct a time_point_put facet. + * @param refs + * @Effects Construct a time_point_put facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit time_point_put(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param tp the @c time_point + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Steps through the sequence from @c pattern to @c pat_end, + * identifying characters that are part of a pattern sequence. Each character + * that is not part of a pattern sequence is written to @c s immediately, and + * each pattern sequence, as it is identified, results in a call to + * @c put_duration or @c put_epoch; + * thus, pattern elements and other characters are interleaved in the output + * in the order in which they appear in the pattern. Pattern sequences are + * identified by converting each character @c c to a @c char value as if by + * @c ct.narrow(c,0), where @c ct is a reference to @c ctype obtained from + * @c ios.getloc(). The first character of each sequence is equal to @c '%', + * followed by a pattern specifier character @c spec, which can be @c 'd' for + * the duration value or @c 'e' for the epoch. + * For each valid pattern sequence identified, calls + * put_duration(s, ios, fill, tp.time_since_epoch()) or put_epoch(s, ios). + * + * @Returns An iterator pointing immediately after the last character produced. + */ + + template + iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point const& tp, const CharT* pattern, + const CharT* pat_end) const + { + if (std::has_facet >(ios.getloc())) + { + time_point_units const &facet = + std::use_facet >(ios.getloc()); + return put(facet, i, ios, fill, tp, pattern, pat_end); + } + else + { + time_point_units_default facet; + return put(facet, i, ios, fill, tp, pattern, pat_end); + } + } + + template + iter_type put(time_point_units const& units_facet, iter_type s, std::ios_base& ios, char_type fill, + time_point const& tp, const CharT* pattern, const CharT* pat_end) const + { + + const std::ctype& ct = std::use_facet >(ios.getloc()); + for (; pattern != pat_end; ++pattern) + { + if (ct.narrow(*pattern, 0) == '%') + { + if (++pattern == pat_end) + { + *s++ = pattern[-1]; + break; + } + char fmt = ct.narrow(*pattern, 0); + switch (fmt) + { + case 'd': + { + s = put_duration(s, ios, fill, tp.time_since_epoch()); + break; + } + case 'e': + { + s = put_epoch (units_facet, s, ios); + break; + } + default: + BOOST_ASSERT(false && "Boost::Chrono internal error."); + break; + } + } + else + *s++ = *pattern; + } + return s; + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param tp the @c time_point + * @param pattern begin of the formatting pattern + * @param pat_end end of the formatting pattern + * + * @Effects Stores the time_point pattern from the @c time_point_unit facet in let say @c str. Last as if + * @code + * return put(s, ios, dill, tp, str.data(), str.data() + str.size()); + * @endcode + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point const& tp) const + { + if (std::has_facet >(ios.getloc())) + { + time_point_units const &facet = + std::use_facet >(ios.getloc()); + std::basic_string str = facet.get_pattern(); + return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size()); + } + else + { + time_point_units_default facet; + std::basic_string str = facet.get_pattern(); + return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size()); + } + } + + /** + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @param fill the character used as filler + * @param d the @c duration + * @Effects As if facet.put(s, ios, fill, d) where facet is the @c duration_put facet associated + * to the @c ios or a new instance of @c duration_put. + * @Returns An iterator pointing immediately after the last character produced. + */ + template + iter_type put_duration(iter_type i, std::ios_base& ios, char_type fill, duration const& d) const + { + if (std::has_facet >(ios.getloc())) + { + duration_put const &facet = std::use_facet >(ios.getloc()); + return facet.put(i, ios, fill, d); + } + else + { + duration_put facet; + return facet.put(i, ios, fill, d); + } + } + + /** + * + * @param i an output stream iterator + * @param ios a reference to a ios_base + * @Effects As if + * @code + * string_type str = facet.template get_epoch(); + * s=std::copy(str.begin(), str.end(), s); + * @endcode + * where facet is the @c time_point_units facet associated + * to the @c ios or a new instance of @c time_point_units_default. + * @Returns s, iterator pointing immediately after the last character produced. + */ + + template + iter_type put_epoch(iter_type i, std::ios_base& os) const + { + if (std::has_facet >(os.getloc())) + { + time_point_units const &facet = std::use_facet >(os.getloc()); + return put_epoch (facet, i, os); + } + else + { + time_point_units_default facet; + return put_epoch (facet, i, os); + } + } + + template + iter_type put_epoch(time_point_units const& facet, iter_type s, std::ios_base&) const + { + string_type str = facet.template get_epoch(); + s= std::copy(str.begin(), str.end(), s); + return s; + } + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * @Effects Destroy the facet + */ + ~time_point_put() + { + } + + }; + + template + std::locale::id time_point_put::id; + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/time_point_units.hpp b/project/jni/boost/include/boost/chrono/io/time_point_units.hpp new file mode 100644 index 000000000..24284a76d --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/time_point_units.hpp @@ -0,0 +1,244 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// + +#ifndef BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP +#define BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace chrono + { + + /** + * @c time_point_units facet gives useful information about the time_point pattern, + * the text associated to a time_point's epoch, + */ + template + class time_point_units: public std::locale::facet + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string used by member functions. + */ + typedef std::basic_string string_type; + + /** + * Unique identifier for this type of facet. + */ + static std::locale::id id; + + /** + * Construct a @c time_point_units facet. + * @param refs + * @Effects Construct a @c time_point_units facet. + * If the @c refs argument is @c 0 then destruction of the object is + * delegated to the @c locale, or locales, containing it. This allows + * the user to ignore lifetime management issues. On the other had, + * if @c refs is @c 1 then the object must be explicitly deleted; + * the @c locale will not do so. In this case, the object can be + * maintained across the lifetime of multiple locales. + */ + explicit time_point_units(size_t refs = 0) : + std::locale::facet(refs) + { + } + + /** + * @return the pattern to be used by default. + */ + virtual string_type get_pattern() const =0; + + /** + * @return the epoch associated to the clock @c Clock calling @c do_get_epoch(Clock()) + */ + template + string_type get_epoch() const + { + return do_get_epoch(Clock()); + } + + protected: + /** + * Destroy the facet. + */ + virtual ~time_point_units() {} + + + /** + * + * @param c a dummy instance of @c system_clock. + * @return The epoch string associated to the @c system_clock. + */ + virtual string_type do_get_epoch(system_clock) const=0; + + /** + * + * @param c a dummy instance of @c steady_clock. + * @return The epoch string associated to the @c steady_clock. + */ + virtual string_type do_get_epoch(steady_clock) const=0; + +#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS) + /** + * + * @param c a dummy instance of @c process_real_cpu_clock. + * @return The epoch string associated to the @c process_real_cpu_clock. + */ + virtual string_type do_get_epoch(process_real_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_user_cpu_clock. + * @return The epoch string associated to the @c process_user_cpu_clock. + */ + virtual string_type do_get_epoch(process_user_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_system_cpu_clock. + * @return The epoch string associated to the @c process_system_cpu_clock. + */ + virtual string_type do_get_epoch(process_system_cpu_clock) const=0; + /** + * + * @param c a dummy instance of @c process_cpu_clock. + * @return The epoch string associated to the @c process_cpu_clock. + */ + virtual string_type do_get_epoch(process_cpu_clock) const=0; +#endif +#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK) + /** + * + * @param c a dummy instance of @c thread_clock. + * @return The epoch string associated to the @c thread_clock. + */ + virtual string_type do_get_epoch(thread_clock) const=0; +#endif + + }; + + template + std::locale::id time_point_units::id; + + + // This class is used to define the strings for the default English + template + class time_point_units_default: public time_point_units + { + public: + /** + * Type of character the facet is instantiated on. + */ + typedef CharT char_type; + /** + * Type of character string returned by member functions. + */ + typedef std::basic_string string_type; + + explicit time_point_units_default(size_t refs = 0) : + time_point_units (refs) + { + } + ~time_point_units_default() {} + + /** + * @return the default pattern "%d%e". + */ + string_type get_pattern() const + { + static const CharT t[] = + { '%', 'd', '%', 'e' }; + static const string_type pattern(t, t + sizeof (t) / sizeof (t[0])); + + return pattern; + } + + protected: + /** + * @param c a dummy instance of @c system_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(system_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c steady_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(steady_clock ) const + { + return clock_string::since(); + } + +#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS) + /** + * @param c a dummy instance of @c process_real_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_real_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_user_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_user_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_system_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_system_cpu_clock ) const + { + return clock_string::since(); + } + /** + * @param c a dummy instance of @c process_cpu_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(process_cpu_clock ) const + { + return clock_string::since(); + } + +#endif +#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK) + /** + * @param c a dummy instance of @c thread_clock. + * @return The epoch string returned by @c clock_string::since(). + */ + string_type do_get_epoch(thread_clock ) const + { + return clock_string::since(); + } +#endif + + }; + + + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/timezone.hpp b/project/jni/boost/include/boost/chrono/io/timezone.hpp new file mode 100644 index 000000000..67975da96 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/timezone.hpp @@ -0,0 +1,30 @@ +// (C) Copyright Howard Hinnant +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// This code was adapted by Vicente from Howard Hinnant's experimental work +// on chrono i/o to Boost + +#ifndef BOOST_CHRONO_IO_TIMEZONE_HPP +#define BOOST_CHRONO_IO_TIMEZONE_HPP +#include + +namespace boost +{ + namespace chrono + { + /** + * Scoped enumeration emulation stating whether the time_point for system_clock I/O is UTC or local. + */ + BOOST_SCOPED_ENUM_DECLARE_BEGIN(timezone) + { + utc, local + } + BOOST_SCOPED_ENUM_DECLARE_END(timezone) + + } // chrono +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp b/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp new file mode 100644 index 000000000..865b98724 --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/ios_base_state_ptr.hpp @@ -0,0 +1,435 @@ +// boost/chrono/utility/ios_base_pword_ptr.hpp ------------------------------------------------------------// + +// Copyright 2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_UTILITY_IOS_BASE_STATE_PTR_HPP +#define BOOST_CHRONO_UTILITY_IOS_BASE_STATE_PTR_HPP + +#include +#include + +/** + * + + + */ +namespace boost +{ + namespace chrono + { + namespace detail + { + + /** + * xalloc key holder. + */ + template + struct xalloc_key_holder + { + static int value; //< the xalloc value associated to T. + static bool initialized; //< whether the value has been initialized or not. + }; + + template + int xalloc_key_holder::value = 0; + + template + bool xalloc_key_holder::initialized = false; + + } + + /** + * xalloc key initialiazer. + * + * Declare a static variable of this type to ensure that the xalloc_key_holder is initialized correctly. + */ + template + struct xalloc_key_initializer + { + xalloc_key_initializer() + { + if (!detail::xalloc_key_holder::initialized) + { + detail::xalloc_key_holder::value = std::ios_base::xalloc(); + detail::xalloc_key_holder::initialized = true; + } + } + }; + /** + * @c ios_state_ptr is a smart pointer to a ios_base specific state. + */ + template + class ios_state_ptr + { + ios_state_ptr& operator=(ios_state_ptr const& rhs) ; + + public: + /** + * The pointee type + */ + typedef T element_type; + /** + * Explicit constructor. + * @param ios the ios + * @Effects Constructs a @c ios_state_ptr by storing the associated @c ios. + */ + explicit ios_state_ptr(std::ios_base& ios) : + ios_(ios) + { + } + /** + * Nothing to do as xalloc index can not be removed. + */ + ~ios_state_ptr() + { + } + + /** + * @Effects Allocates the index if not already done. + * Registers the callback responsible of maintaining the state pointer coherency, if not already done. + * Retrieves the associated ios pointer + * @return the retrieved pointer statically casted to const. + */ + T const* get() const BOOST_NOEXCEPT + { + register_once(index(), ios_); + void* &pw = ios_.pword(index()); + if (pw == 0) + { + return 0; + } + return static_cast (pw); + } + /** + * @Effects Allocates the index if not already done. + * Registers the callback responsible of maintaining the state pointer coherency, if not already done. + * Retrieves the associated ios pointer + * @return the retrieved pointer. + */ + T * get() BOOST_NOEXCEPT + { + register_once(index(), ios_); + void* &pw = ios_.pword(index()); + if (pw == 0) + { + return 0; + } + return static_cast (pw); + } + /** + * @Effects as if @c return get(); + * @return the retrieved pointer. + */ + T * operator->()BOOST_NOEXCEPT + { + return get(); + } + /** + * @Effects as if @c return get(); + * @return the retrieved pointer. + */ + T const * operator->() const BOOST_NOEXCEPT + { + return get(); + } + + /** + * @Effects as if @c return *get(); + * @return a reference to the retrieved state. + * @Remark The behavior is undefined if @c get()==0. + */ + T & operator*() BOOST_NOEXCEPT + { + return *get(); + } + /** + * @Effects as if @c return *get(); + * @return a reference to the retrieved state. + * @Remark The behavior is undefined if @c get()==0. + */ + T const & operator *() const BOOST_NOEXCEPT + { + return *get(); + } + + /** + * @Effects reset the current pointer after storing in a temporary variable the pointer to the current state. + * @return the stored state pointer. + */ + T * release() BOOST_NOEXCEPT + { + T const* f = get(); + reset(); + return f; + } + + /** + * + * @param new_ptr the new pointer. + * @Effects deletes the current state and replace it with the new one. + */ + void reset(T* new_ptr = 0)BOOST_NOEXCEPT + { + register_once(index(), ios_); + void*& pw = ios_.pword(index()); + delete static_cast (pw); + pw = new_ptr; + } + +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + typedef T* (ios_state_ptr::*bool_type)(); + operator bool_type() const BOOST_NOEXCEPT + { + return (get()!=0)?&ios_state_ptr::release:0; + } + bool operator!() const BOOST_NOEXCEPT + { + return (get()==0)?&ios_state_ptr::release:0; + } +#else + /** + * Explicit conversion to bool. + */ + explicit operator bool() const BOOST_NOEXCEPT + { + return get()!=0; + } +#endif + + std::ios_base& getios()BOOST_NOEXCEPT + { + return ios_; + } + std::ios_base& getios() const BOOST_NOEXCEPT + { + return ios_; + } + /** + * Implicit conversion to the ios_base + */ + operator std::ios_base&() BOOST_NOEXCEPT + { + return ios_; + } + /** + * Implicit conversion to the ios_base const + */ + operator std::ios_base&() const BOOST_NOEXCEPT + { + return ios_; + } + private: + static inline bool is_registerd(std::ios_base& ios) + { + long iw = ios.iword(index()); + return (iw == 1); + } + static inline void set_registered(std::ios_base& ios) + { + long& iw = ios.iword(index()); + iw = 1; + } + static inline void callback(std::ios_base::event evt, std::ios_base& ios, int index) + { + switch (evt) + { + case std::ios_base::erase_event: + { + void*& pw = ios.pword(index); + if (pw != 0) + { + T* ptr = static_cast (pw); + delete ptr; + pw = 0; + } + break; + } + case std::ios_base::copyfmt_event: + { + void*& pw = ios.pword(index); + if (pw != 0) + { + pw = new T(*static_cast (pw)); + } + break; + } + default: + break; + } + } + + static inline int index() + { + return detail::xalloc_key_holder::value; + } + + static inline void register_once(int indx, std::ios_base& ios) + { + // needs a mask registered + if (!is_registerd(ios)) + { + set_registered(ios); + ios.register_callback(callback, indx); + } + } + + + protected: + std::ios_base& ios_; + //static detail::xalloc_key_initializer xalloc_key_initializer_; + + }; + //template + //detail::xalloc_key_initializer ios_state_ptr::xalloc_key_initializer_; + + + /** + * @c ios_state_not_null_ptr is a non null variant of @c ios_state_ptr. + * @tparm T + * @Requires @c T must be @c DefaultConstructible and @c HeapAllocatable + */ + template + class ios_state_not_null_ptr: public ios_state_ptr + { + typedef ios_state_ptr base_type; + public: + explicit ios_state_not_null_ptr(std::ios_base& ios) : + base_type(ios) + { + if (this->get() == 0) + { + this->base_type::reset(new T()); + } + } + ~ios_state_not_null_ptr() + { + } + + void reset(T* new_value) BOOST_NOEXCEPT + { + BOOST_ASSERT(new_value!=0); + this->base_type::reset(new_value); + } + + }; + + /** + * This class is useful to associate some flags to an std::ios_base. + */ + template + class ios_flags + { + public: + /** + * + * @param ios the associated std::ios_base. + * @Postcondition flags()==0 + */ + explicit ios_flags(std::ios_base& ios) : + ios_(ios) + { + } + ~ios_flags() + { + } + /** + * @Returns The format control information. + */ + long flags() const BOOST_NOEXCEPT + { + return value(); + } + + /** + * @param v the new bit mask. + * @Postcondition v == flags(). + * @Returns The previous value of @c flags(). + */ + long flags(long v)BOOST_NOEXCEPT + { + long tmp = flags(); + ref() = v; + return tmp; + } + + /** + * @param v the new value + * @Effects: Sets @c v in @c flags(). + * @Returns: The previous value of @c flags(). + */ + long setf(long v) + { + long tmp = value(); + ref() |= v; + return tmp; + } + + /** + * @param mask the bit mask to clear. + * @Effects: Clears @c mask in @c flags(). + */ + void unsetf(long mask) + { + ref() &= ~mask; + } + + /** + * + * @param v + * @param mask + * @Effects: Clears @c mask in @c flags(), sets v & mask in @c flags(). + * @Returns: The previous value of flags(). + */ + long setf(long v, long mask) + { + long tmp = value(); + unsetf(mask); + ref() |= v & mask; + return tmp; + } + + /** + * implicit conversion to the @c ios_base + */ + operator std::ios_base&()BOOST_NOEXCEPT + { + return ios_; + } + /** + * implicit conversion to the @c ios_base const + */ + operator std::ios_base const&() const BOOST_NOEXCEPT + { + return ios_; + } + private: + long value() const BOOST_NOEXCEPT + { + return ios_.iword(index()); + } + long& ref()BOOST_NOEXCEPT + { + return ios_.iword(index()); + } + static inline int index() + { + return detail::xalloc_key_holder::value; + } + ios_flags& operator=(ios_flags const& rhs) ; + + std::ios_base& ios_; + //static detail::xalloc_key_initializer xalloc_key_initializer_; + + }; + //template + //detail::xalloc_key_initializer ios_flags::xalloc_key_initializer_; + + } // namespace chrono +} // namespace boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp b/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp new file mode 100644 index 000000000..f4a5f562c --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/manip_base.hpp @@ -0,0 +1,101 @@ +// boost/chrono/utility/manip_base.hpp ------------------------------------------------------------// + +// Copyright 2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_UTILITY_MANIP_BASE_PTR_HPP +#define BOOST_CHRONO_UTILITY_MANIP_BASE_PTR_HPP + +#include + +/** + * + + */ + +namespace boost +{ + namespace chrono + { + + /** + * manip is a manipulator mixin class following the CRTP. + * @tparam Final the derived from manip and final type + * + * @Example + * @code + + class mendl: public manip + { + public: + explicit mendl(size_t how_many) : + count(how_many) {} + template + void operator()(out_stream &out) const + { + for (size_t line = 0; line < count; ++line) + { + out.put(out.widen('\n')); + } + out.flush(); + } + private: + size_t count; + }; + + * @codeend + */ + template + class manip + { + public: + /** + * + * @param ios the io stream or ios_base. + * @Effects calls to the manipulator final functor. + */ + //template + void operator()(std::ios_base &ios) const + { + (*static_cast (this))(ios); + } + }; + + /** + * @c manip stream inserter + * @param out the io stream or ios_base. + * @param op the manipulator instance. + * @Effects if @c out is good calls to the manipulator functor @op. + * @return @c out + */ + template + out_stream &operator<<(out_stream &out, const manip &op) + { + if (out.good()) + op(out); + return out; + } + + /** + * @c manip stream extractor + * @param in the io stream or ios_base. + * @param op the manipulator instance. + * @Effects if @c in is good calls to the manipulator functor @op. + * @return @c in + */ + template + in_stream &operator>>(in_stream &in, const manip &op) + { + if (in.good()) + op(in); + return in; + } + + } // namespace chrono +} // namespace boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp b/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp new file mode 100644 index 000000000..4717ba6ad --- /dev/null +++ b/project/jni/boost/include/boost/chrono/io/utility/to_string.hpp @@ -0,0 +1,50 @@ +// boost/chrono/utility/to_string.hpp +// +// Copyright 2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). + +#ifndef BOOST_CHRONO_UTILITY_TO_STRING_HPP +#define BOOST_CHRONO_UTILITY_TO_STRING_HPP + +#include +#include +#include + +namespace boost +{ + namespace chrono + { + template + std::basic_string to_basic_string(T const&v) { + std::basic_stringstream sstr; + sstr << v; + return sstr.str(); + } + + template + std::string to_string(T const&v) { + return to_basic_string(v); + } +#ifndef BOOST_NO_STD_WSTRING + template + std::wstring to_wstring(T const&v) { + return to_basic_string(v); + } +#endif +#if BOOST_CHRONO_HAS_UNICODE_SUPPORT + template + std::basic_string to_u16string(T const&v) { + return to_basic_string(v); + } + template + std::basic_string to_u32string(T const&v) { + return to_basic_string(v); + } +#endif + } // chrono + +} // boost + +#endif // header diff --git a/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp b/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp index 6ca1ca2d6..daabd4922 100644 --- a/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp +++ b/project/jni/boost/include/boost/chrono/io_v1/chrono_io.hpp @@ -265,59 +265,59 @@ template std::basic_istream& operator>>(std::basic_istream& is, duration& d) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; typedef duration_punct Facet; std::locale loc = is.getloc(); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (!std::has_facet(loc)) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.imbue(std::locale(loc, new Facet)); } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; loc = is.getloc(); const Facet& f = std::use_facet(loc); typedef typename chrono_detail::duration_io_intermediate::type intermediate_type; intermediate_type r; std::ios_base::iostate err = std::ios_base::goodbit; // read value into r - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is >> r; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (is.good()) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // now determine unit typedef std::istreambuf_iterator in_iterator; in_iterator i(is); in_iterator e; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (i != e && *i == ' ') // mandatory ' ' after value { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; ++i; if (i != e) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // unit is num / den (yet to be determined) unsigned long long num = 0; unsigned long long den = 0; if (*i == '[') { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // parse [N/D]s or [N/D]seconds format ++i; CharT x; is >> num >> x >> den; if (!is.good() || (x != '/')) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit); return is; } i = in_iterator(is); if (*i != ']') { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit); return is; } @@ -328,27 +328,27 @@ operator>>(std::basic_istream& is, duration& d) f.template plural >(), f.template short_name >() }; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; const std::basic_string* k = chrono_detail::scan_keyword(i, e, units, units + sizeof(units)/sizeof(units[0]), //~ std::use_facet >(loc), err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err); switch ((k - units) / 3) { case 0: - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; break; default: is.setstate(err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // parse SI name, short or long const std::basic_string units[] = { @@ -410,12 +410,12 @@ operator>>(std::basic_istream& is, duration& d) f.template plural >(), f.template short_name >() }; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; const std::basic_string* k = chrono_detail::scan_keyword(i, e, units, units + sizeof(units)/sizeof(units[0]), //~ std::use_facet >(loc), err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; switch ((k - units) / 3) { case 0: @@ -495,12 +495,12 @@ operator>>(std::basic_istream& is, duration& d) den = 1; break; default: - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // unit is num/den // r should be multiplied by (num/den) / Period // Reduce (num/den) / Period to lowest terms @@ -513,7 +513,7 @@ operator>>(std::basic_istream& is, duration& d) if (num > (std::numeric_limits::max)() / d2 || den > (std::numeric_limits::max)() / n2) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // (num/den) / Period overflows is.setstate(err|is.failbit); return is; @@ -523,68 +523,68 @@ operator>>(std::basic_istream& is, duration& d) typedef typename common_type::type common_type_t; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // num / den is now factor to multiply by r if (!chrono_detail::reduce(r, den, err)) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } //if (r > ((duration_values::max)() / num)) - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (chrono::detail::gt(r,((duration_values::max)() / num))) { // Conversion to Period overflowed - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(err|is.failbit); return is; } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; common_type_t t = r * num; t /= den; - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (t > 0) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; Rep pt = t; if ( (duration_values::max)() < pt) { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // Conversion to Period overflowed is.setstate(err|is.failbit); return is; } } - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; // Success! Store it. r = Rep(t); d = duration(r); is.setstate(err); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; is.setstate(is.failbit | is.eofbit); return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; if (i == e) is.setstate(is.failbit|is.eofbit); else is.setstate(is.failbit); - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; return is; } } else { - std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; + //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl; //is.setstate(is.failbit); return is; } diff --git a/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp b/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp index 12ec2e39b..486950da4 100644 --- a/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/process_cpu_clocks.hpp @@ -18,15 +18,11 @@ #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include #include -#endif #include #include #include - #ifndef BOOST_CHRONO_HEADER_ONLY #include // must be the last #include #endif diff --git a/project/jni/boost/include/boost/chrono/system_clocks.hpp b/project/jni/boost/include/boost/chrono/system_clocks.hpp index bb62610c7..df8b79e20 100644 --- a/project/jni/boost/include/boost/chrono/system_clocks.hpp +++ b/project/jni/boost/include/boost/chrono/system_clocks.hpp @@ -31,7 +31,6 @@ time2_demo contained this comment: TODO: * Fully implement error handling, with test cases. - * Use boost::throw_exception. (Currently not used because of an issue with Intel 11.0.) * Consider issues raised by Michael Marcin: > In the past I've seen QueryPerformanceCounter give incorrect results, @@ -62,14 +61,17 @@ TODO: #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #include -#include -#endif #include #include +# if defined( BOOST_CHRONO_POSIX_API ) +# if ! defined(CLOCK_REALTIME) +# error does not supply CLOCK_REALTIME +# endif +# endif + #ifdef BOOST_CHRONO_WINDOWS_API // The system_clock tick is 100 nanoseconds # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration > @@ -77,6 +79,7 @@ TODO: # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds #endif +// this must occur after all of the includes and before any code appears: #ifndef BOOST_CHRONO_HEADER_ONLY #include // must be the last #include #endif @@ -221,6 +224,7 @@ namespace chrono { } // namespace boost #ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: #include // pops abi_prefix.hpp pragmas #else #include diff --git a/project/jni/boost/include/boost/chrono/thread_clock.hpp b/project/jni/boost/include/boost/chrono/thread_clock.hpp index 7022c61dc..207697b4c 100644 --- a/project/jni/boost/include/boost/chrono/thread_clock.hpp +++ b/project/jni/boost/include/boost/chrono/thread_clock.hpp @@ -17,10 +17,7 @@ #include #include #include -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include #include -#endif #include #ifndef BOOST_CHRONO_HEADER_ONLY @@ -49,7 +46,7 @@ struct clock_string static std::basic_string name() { static const CharT u[] = - { 't', 'h', 'r', 'e', 'd', '_', + { 't', 'h', 'r', 'e', 'a', 'd', '_', 'c', 'l','o', 'c', 'k'}; static const std::basic_string str(u, u + sizeof(u)/sizeof(u[0])); return str; @@ -57,7 +54,7 @@ struct clock_string static std::basic_string since() { const CharT u[] = - { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'h', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; const std::basic_string str(u, u + sizeof(u)/sizeof(u[0])); return str; } diff --git a/project/jni/boost/include/boost/chrono/time_point.hpp b/project/jni/boost/include/boost/chrono/time_point.hpp index bef49cb40..7e80b59d1 100644 --- a/project/jni/boost/include/boost/chrono/time_point.hpp +++ b/project/jni/boost/include/boost/chrono/time_point.hpp @@ -2,7 +2,7 @@ // Copyright 2008 Howard Hinnant // Copyright 2008 Beman Dawes -// Copyright 2009-2011 Vicente J. Botet Escriba +// Copyright 2009-2012 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -32,8 +32,11 @@ time2_demo contained this comment: #include #include -#include +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -160,7 +163,7 @@ namespace chrono { typedef typename duration::rep rep; typedef typename duration::period period; typedef Duration difference_type; - + private: duration d_; @@ -194,7 +197,7 @@ namespace chrono { // arithmetic -#ifdef BOOST_CHRONO_EXTENSIONS +#ifdef BOOST_CHRONO_EXTENSIONS BOOST_CONSTEXPR time_point operator+() const {return *this;} BOOST_CONSTEXPR @@ -202,24 +205,24 @@ namespace chrono { time_point& operator++() {++d_; return *this;} time_point operator++(int) {return time_point(d_++);} time_point& operator--() {--d_; return *this;} - time_point operator--(int) {return time_point(d_--);} + time_point operator--(int) {return time_point(d_--);} time_point& operator+=(const rep& r) {d_ += duration(r); return *this;} time_point& operator-=(const rep& r) {d_ -= duration(r); return *this;} #endif - + time_point& operator+=(const duration& d) {d_ += d; return *this;} time_point& operator-=(const duration& d) {d_ -= d; return *this;} // special values - static BOOST_CONSTEXPR time_point + static BOOST_CHRONO_LIB_CONSTEXPR time_point min BOOST_PREVENT_MACRO_SUBSTITUTION () { return time_point((duration::min)()); } - static BOOST_CONSTEXPR time_point + static BOOST_CHRONO_LIB_CONSTEXPR time_point max BOOST_PREVENT_MACRO_SUBSTITUTION () { return time_point((duration::max)()); @@ -368,4 +371,9 @@ namespace chrono { } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_TIME_POINT_HPP diff --git a/project/jni/boost/include/boost/concept_check.hpp b/project/jni/boost/include/boost/concept_check.hpp index 01b2f4ec2..bf5a2af78 100644 --- a/project/jni/boost/include/boost/concept_check.hpp +++ b/project/jni/boost/include/boost/concept_check.hpp @@ -1052,11 +1052,11 @@ namespace boost c.swap(c); } - void const_constraints(const C& c) { - ci = c.begin(); - ci = c.end(); - n = c.size(); - b = c.empty(); + void const_constraints(const C& cc) { + ci = cc.begin(); + ci = cc.end(); + n = cc.size(); + b = cc.empty(); } private: diff --git a/project/jni/boost/include/boost/config/auto_link.hpp b/project/jni/boost/include/boost/config/auto_link.hpp index ad021f407..e36d06a05 100644 --- a/project/jni/boost/include/boost/config/auto_link.hpp +++ b/project/jni/boost/include/boost/config/auto_link.hpp @@ -60,14 +60,14 @@ BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, contains one or more of the following letters after - a hiphen: + a hyphen: s static runtime (dynamic if not present). g debug/diagnostic runtime (release if not present). y Python debug/diagnostic runtime (release if not present). d debug build (release if not present). - g debug/diagnostic runtime (release if not present). - p STLPort Build. + p STLport build. + n STLport build without its IOStreams. BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. @@ -114,68 +114,69 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // select toolset if not defined already: // #ifndef BOOST_LIB_TOOLSET -// Note: no compilers before 1200 are supported -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) +# if defined(BOOST_MSVC) && (BOOST_MSVC < 1200) + // Note: no compilers before 1200 are supported +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1300) + +# ifdef UNDER_CE + // eVC4: +# define BOOST_LIB_TOOLSET "evc4" +# else + // vc6: +# define BOOST_LIB_TOOLSET "vc6" +# endif + +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1310) + + // vc7: +# define BOOST_LIB_TOOLSET "vc7" + +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1400) + + // vc71: +# define BOOST_LIB_TOOLSET "vc71" + +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1500) + + // vc80: +# define BOOST_LIB_TOOLSET "vc80" + +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1600) + + // vc90: +# define BOOST_LIB_TOOLSET "vc90" + +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1700) + + // vc10: +# define BOOST_LIB_TOOLSET "vc100" + +# elif defined(BOOST_MSVC) + + // vc11: +# define BOOST_LIB_TOOLSET "vc110" + +# elif defined(__BORLANDC__) + + // CBuilder 6: +# define BOOST_LIB_TOOLSET "bcb" + +# elif defined(__ICL) + + // Intel C++, no version number: +# define BOOST_LIB_TOOLSET "iw" + +# elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) + + // Metrowerks CodeWarrior 8.x +# define BOOST_LIB_TOOLSET "cw8" + +# elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) + + // Metrowerks CodeWarrior 9.x +# define BOOST_LIB_TOOLSET "cw9" -# ifdef UNDER_CE - // vc6: -# define BOOST_LIB_TOOLSET "evc4" -# else - // vc6: -# define BOOST_LIB_TOOLSET "vc6" # endif - -#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) - - // vc7: -# define BOOST_LIB_TOOLSET "vc7" - -#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310) - - // vc71: -# define BOOST_LIB_TOOLSET "vc71" - -#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400) - - // vc80: -# define BOOST_LIB_TOOLSET "vc80" - -#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500) - - // vc90: -# define BOOST_LIB_TOOLSET "vc90" - -#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600) - - // vc10: -# define BOOST_LIB_TOOLSET "vc100" - -#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700) - - // vc11: -# define BOOST_LIB_TOOLSET "vc110" - -#elif defined(__BORLANDC__) - - // CBuilder 6: -# define BOOST_LIB_TOOLSET "bcb" - -#elif defined(__ICL) - - // Intel C++, no version number: -# define BOOST_LIB_TOOLSET "iw" - -#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) - - // Metrowerks CodeWarrior 8.x -# define BOOST_LIB_TOOLSET "cw8" - -#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) - - // Metrowerks CodeWarrior 9.x -# define BOOST_LIB_TOOLSET "cw9" - -#endif #endif // BOOST_LIB_TOOLSET // @@ -201,11 +202,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(_DEBUG)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # define BOOST_LIB_RT_OPT "-gydp" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdp" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-p" @@ -221,11 +222,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(_DEBUG)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # define BOOST_LIB_RT_OPT "-gydpn" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdpn" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-pn" @@ -255,11 +256,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(_DEBUG)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # define BOOST_LIB_RT_OPT "-sgydp" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdp" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-sp" @@ -275,11 +276,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(_DEBUG)\ && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) # define BOOST_LIB_RT_OPT "-sgydpn" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdpn" -# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1") # error "Build options aren't compatible with pre-built libraries" # else # define BOOST_LIB_RT_OPT "-spn" @@ -312,7 +313,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // sanity check: // #if defined(__STL_DEBUG) || defined(_STLP_DEBUG) -#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" +#error "Pre-built versions of the Boost libraries are not provided in STLport-debug form" #endif # ifdef _RTLDLL diff --git a/project/jni/boost/include/boost/config/compiler/borland.hpp b/project/jni/boost/include/boost/config/compiler/borland.hpp index 680e87bde..cffa8ea0e 100644 --- a/project/jni/boost/include/boost/config/compiler/borland.hpp +++ b/project/jni/boost/include/boost/config/compiler/borland.hpp @@ -47,7 +47,7 @@ # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif // Variadic macros do not exist for C++ Builder versions 5 and below -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS # endif // Version 5.51 and below: @@ -150,14 +150,14 @@ // C++0x Macros: // #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DECLTYPE -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_STATIC_ASSERT #else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T @@ -169,25 +169,27 @@ # define BOOST_HAS_STATIC_ASSERT #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/project/jni/boost/include/boost/config/compiler/clang.hpp b/project/jni/boost/include/boost/config/compiler/clang.hpp index a183f34be..18d6e5462 100644 --- a/project/jni/boost/include/boost/config/compiler/clang.hpp +++ b/project/jni/boost/include/boost/config/compiler/clang.hpp @@ -8,15 +8,18 @@ // Clang compiler setup. -#if __has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) -#else +#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif -#if !__has_feature(cxx_rtti) +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID) +# define BOOST_NO_TYPEID +#endif + #if defined(__int64) # define BOOST_HAS_MS_INT64 #endif @@ -24,89 +27,109 @@ #define BOOST_HAS_NRVO // Clang supports "long long" in all compilation modes. +#define BOOST_HAS_LONG_LONG + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32) +# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default"))) +# define BOOST_SYMBOL_IMPORT +# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) +#endif #if !__has_feature(cxx_auto_type) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T #endif #if !__has_feature(cxx_constexpr) -# define BOOST_NO_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif #if !__has_feature(cxx_decltype) -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #endif -#define BOOST_NO_DECLTYPE_N3276 +#if !__has_feature(cxx_decltype_incomplete_return_types) +# define BOOST_NO_CXX11_DECLTYPE_N3276 +#endif #if !__has_feature(cxx_defaulted_functions) -# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS #endif #if !__has_feature(cxx_deleted_functions) -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif #if !__has_feature(cxx_explicit_conversions) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS #endif #if !__has_feature(cxx_default_function_template_args) -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #endif #if !__has_feature(cxx_generalized_initializers) -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if !__has_feature(cxx_lambdas) -# define BOOST_NO_LAMBDAS +# define BOOST_NO_CXX11_LAMBDAS +#endif + +#if !__has_feature(cxx_local_type_template_args) +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS #endif #if !__has_feature(cxx_noexcept) -# define BOOST_NO_NOEXCEPT +# define BOOST_NO_CXX11_NOEXCEPT #endif #if !__has_feature(cxx_nullptr) -# define BOOST_NO_NULLPTR +# define BOOST_NO_CXX11_NULLPTR +#endif + +#if !__has_feature(cxx_range_for) +# define BOOST_NO_CXX11_RANGE_BASED_FOR #endif #if !__has_feature(cxx_raw_string_literals) -# define BOOST_NO_RAW_LITERALS +# define BOOST_NO_CXX11_RAW_LITERALS #endif #if !__has_feature(cxx_generalized_initializers) -# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #endif #if !__has_feature(cxx_rvalue_references) -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif #if !__has_feature(cxx_strong_enums) -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif #if !__has_feature(cxx_static_assert) -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif #if !__has_feature(cxx_alias_templates) -# define BOOST_NO_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_TEMPLATE_ALIASES #endif #if !__has_feature(cxx_unicode_literals) -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif #if !__has_feature(cxx_variadic_templates) -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif // Clang always supports variadic macros diff --git a/project/jni/boost/include/boost/config/compiler/codegear.hpp b/project/jni/boost/include/boost/config/compiler/codegear.hpp index f1887a0c0..1a6df3352 100644 --- a/project/jni/boost/include/boost/config/compiler/codegear.hpp +++ b/project/jni/boost/include/boost/config/compiler/codegear.hpp @@ -76,7 +76,7 @@ // C++0x macros: // #if (__CODEGEARC__ <= 0x620) -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_STATIC_ASSERT #else #define BOOST_HAS_STATIC_ASSERT #endif @@ -91,24 +91,25 @@ // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // TR1 macros: @@ -120,7 +121,7 @@ #define BOOST_HAS_MACRO_USE_FACET -#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 diff --git a/project/jni/boost/include/boost/config/compiler/common_edg.hpp b/project/jni/boost/include/boost/config/compiler/common_edg.hpp index 10333ad2d..441a055fa 100644 --- a/project/jni/boost/include/boost/config/compiler/common_edg.hpp +++ b/project/jni/boost/include/boost/config/compiler/common_edg.hpp @@ -60,39 +60,41 @@ // See above for BOOST_NO_LONG_LONG // #if (__EDG_VERSION__ < 310) -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if (__EDG_VERSION__ <= 310) // No support for initializer lists -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if (__EDG_VERSION__ < 400) -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #ifdef c_plusplus // EDG has "long long" in non-strict mode diff --git a/project/jni/boost/include/boost/config/compiler/cray.hpp b/project/jni/boost/include/boost/config/compiler/cray.hpp index ad2eeaf55..5463ea08c 100644 --- a/project/jni/boost/include/boost/config/compiler/cray.hpp +++ b/project/jni/boost/include/boost/config/compiler/cray.hpp @@ -25,33 +25,35 @@ // // Cray peculiarities, probably version 7 specific: // -#undef BOOST_NO_AUTO_DECLARATIONS -#undef BOOST_NO_AUTO_MULTIDECLARATIONS +#undef BOOST_NO_CXX11_AUTO_DECLARATIONS +#undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #define BOOST_HAS_NRVO -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNICODE_LITERALS #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_HAS_NRVO -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_NULLPTR -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_LAMBDAS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DECLTYPE -#define BOOST_NO_CONSTEXPR +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CHAR16_T //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG #define BOOST_MATH_DISABLE_STD_FPCLASSIFY //#define BOOST_HAS_FPCLASSIFY diff --git a/project/jni/boost/include/boost/config/compiler/digitalmars.hpp b/project/jni/boost/include/boost/config/compiler/digitalmars.hpp index ed92306fb..15cc209d0 100644 --- a/project/jni/boost/include/boost/config/compiler/digitalmars.hpp +++ b/project/jni/boost/include/boost/config/compiler/digitalmars.hpp @@ -60,33 +60,35 @@ // // C++0x features // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if (__DMC__ < 0x812) -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if __DMC__ < 0x800 diff --git a/project/jni/boost/include/boost/config/compiler/gcc.hpp b/project/jni/boost/include/boost/config/compiler/gcc.hpp index 5a69cb493..c0ac30af2 100644 --- a/project/jni/boost/include/boost/config/compiler/gcc.hpp +++ b/project/jni/boost/include/boost/config/compiler/gcc.hpp @@ -42,9 +42,9 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for gcc versions before 3.0 -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -61,7 +61,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -146,9 +146,12 @@ # endif #endif -// C++0x features not implemented in any GCC version // -#define BOOST_NO_TEMPLATE_ALIASES +// Recent GCC versions have __int128 when in 64-bit mode: +// +#if defined(__SIZEOF_INT128__) +# define BOOST_HAS_INT128 +#endif // C++0x features in 4.3.n and later // @@ -161,65 +164,70 @@ # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html # if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define BOOST_HAS_VARIADIC_TMPL # else -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES # endif #endif // C++0x features in 4.4.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) # define BOOST_NO_SFINAE_EXPR #endif // C++0x features in 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif // C++0x features in 4.5.1 and later // #if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.5.1 +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif // C++0x features in 4.6.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #endif +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif // C++0x features not supported at all yet // -#define BOOST_NO_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE_N3276 #ifndef BOOST_COMPILER # define BOOST_COMPILER "GNU C++ version " __VERSION__ diff --git a/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp b/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp index 61dcedcc6..eaed4b5af 100644 --- a/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp +++ b/project/jni/boost/include/boost/config/compiler/gcc_xml.hpp @@ -27,32 +27,33 @@ // C++0x features: // -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_NULLPTR -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_DECLTYPE -# define BOOST_NO_DECLTYPE_N3276 -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_NOEXCEPT -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/project/jni/boost/include/boost/config/compiler/hp_acc.hpp b/project/jni/boost/include/boost/config/compiler/hp_acc.hpp index 0d73b2875..4f5f81b3c 100644 --- a/project/jni/boost/include/boost/config/compiler/hp_acc.hpp +++ b/project/jni/boost/include/boost/config/compiler/hp_acc.hpp @@ -92,30 +92,32 @@ // #if !defined(__EDG__) -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and @@ -123,7 +125,7 @@ */ #if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE) - #define BOOST_NO_VARIADIC_MACROS + #define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif diff --git a/project/jni/boost/include/boost/config/compiler/intel.hpp b/project/jni/boost/include/boost/config/compiler/intel.hpp index a1704a488..8c746c187 100644 --- a/project/jni/boost/include/boost/config/compiler/intel.hpp +++ b/project/jni/boost/include/boost/config/compiler/intel.hpp @@ -199,52 +199,54 @@ template<> struct assert_intrinsic_wchar_t {}; // - ICC added static_assert in 11.0 (first version with C++0x support) // #if defined(BOOST_INTEL_STDCXX0X) -# undef BOOST_NO_STATIC_ASSERT +# undef BOOST_NO_CXX11_STATIC_ASSERT // // These pass our test cases, but aren't officially supported according to: // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // -//# undef BOOST_NO_LAMBDAS -//# undef BOOST_NO_DECLTYPE -//# undef BOOST_NO_AUTO_DECLARATIONS -//# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_LAMBDAS +//# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +//# undef BOOST_NO_CXX11_DECLTYPE +//# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +//# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION >= 1200) -//# undef BOOST_NO_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries -//# undef BOOST_NO_SCOPED_ENUMS // doesn't really work!! -# undef BOOST_NO_DELETED_FUNCTIONS -# undef BOOST_NO_DEFAULTED_FUNCTIONS -# undef BOOST_NO_LAMBDAS -# undef BOOST_NO_DECLTYPE -# undef BOOST_NO_AUTO_DECLARATIONS -# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries +//# undef BOOST_NO_CXX11_SCOPED_ENUMS // doesn't really work!! +# undef BOOST_NO_CXX11_DELETED_FUNCTIONS +# undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# undef BOOST_NO_CXX11_LAMBDAS +# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# undef BOOST_NO_CXX11_DECLTYPE +# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif // icl Version 12.1.0.233 Build 20110811 and possibly some other builds // had an incorrect __INTEL_COMPILER value of 9999. Intel say this has been fixed. #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION > 1200) -# undef BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# undef BOOST_NO_NULLPTR -# undef BOOST_NO_RVALUE_REFERENCES +# undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# undef BOOST_NO_CXX11_NULLPTR +# undef BOOST_NO_CXX11_RVALUE_REFERENCES # undef BOOST_NO_SFINAE_EXPR -# undef BOOST_NO_TEMPLATE_ALIASES -# undef BOOST_NO_VARIADIC_TEMPLATES +# undef BOOST_NO_CXX11_TEMPLATE_ALIASES +# undef BOOST_NO_CXX11_VARIADIC_TEMPLATES // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // continues to list scoped enum support as "Partial" -//# undef BOOST_NO_SCOPED_ENUMS +//# undef BOOST_NO_CXX11_SCOPED_ENUMS #endif #if defined(_MSC_VER) && (_MSC_VER <= 1700) // // Although the Intel compiler is capable of supporting these, it appears not to in MSVC compatibility mode: // -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES #endif #if (BOOST_INTEL_CXX_VERSION < 1200) diff --git a/project/jni/boost/include/boost/config/compiler/metrowerks.hpp b/project/jni/boost/include/boost/config/compiler/metrowerks.hpp index 02baecdde..184cb71c1 100644 --- a/project/jni/boost/include/boost/config/compiler/metrowerks.hpp +++ b/project/jni/boost/include/boost/config/compiler/metrowerks.hpp @@ -90,33 +90,35 @@ #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/project/jni/boost/include/boost/config/compiler/mpw.hpp b/project/jni/boost/include/boost/config/compiler/mpw.hpp index 45e1aa45c..14adee0cc 100644 --- a/project/jni/boost/include/boost/config/compiler/mpw.hpp +++ b/project/jni/boost/include/boost/config/compiler/mpw.hpp @@ -40,32 +40,34 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // versions check: diff --git a/project/jni/boost/include/boost/config/compiler/pathscale.hpp b/project/jni/boost/include/boost/config/compiler/pathscale.hpp index 94e44726f..304112635 100644 --- a/project/jni/boost/include/boost/config/compiler/pathscale.hpp +++ b/project/jni/boost/include/boost/config/compiler/pathscale.hpp @@ -32,49 +32,49 @@ # define BOOST_HAS_EXPM1 # define BOOST_HAS_DIRENT_H # define BOOST_HAS_CLOCK_GETTIME -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_STD_UNORDERED -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_NULLPTR -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_NOEXCEPT -# define BOOST_NO_LAMBDAS -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DECLTYPE -# define BOOST_NO_DECLTYPE_N3276 -# define BOOST_NO_CONSTEXPR +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_CONSTEXPR # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# define BOOST_NO_CHAR32_T -# define BOOST_NO_CHAR16_T -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CHRONO #endif diff --git a/project/jni/boost/include/boost/config/compiler/pgi.hpp b/project/jni/boost/include/boost/config/compiler/pgi.hpp index 0ae8af58e..fa32fefb4 100644 --- a/project/jni/boost/include/boost/config/compiler/pgi.hpp +++ b/project/jni/boost/include/boost/config/compiler/pgi.hpp @@ -1,6 +1,6 @@ // (C) Copyright Noel Belcourt 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. @@ -16,10 +16,29 @@ // if no threading API is detected. // -#if __PGIC__ >= 10 +#if __PGIC__ >= 11 // options requested by configure --enable-test #define BOOST_HAS_PTHREADS +#define BOOST_HAS_THREADS +#define BOOST_HAS_PTHREAD_YIELD +#define BOOST_HAS_NRVO +#define BOOST_HAS_LONG_LONG + +// options --enable-test wants undefined +#undef BOOST_NO_STDC_NAMESPACE +#undef BOOST_NO_EXCEPTION_STD_NAMESPACE +#undef BOOST_DEDUCED_TYPENAME + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS + +#elif __PGIC__ >= 10 + +// options requested by configure --enable-test +#define BOOST_HAS_THREADS #define BOOST_HAS_NRVO #define BOOST_HAS_LONG_LONG @@ -30,11 +49,11 @@ #elif __PGIC__ >= 7 -#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS #else @@ -46,30 +65,52 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NUMERIC_LIMITS +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SWPRINTF +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#define BOOST_NO_CXX11_HDR_UNORDERED_SET +#define BOOST_NO_CXX11_HDR_UNORDERED_MAP +#define BOOST_NO_CXX11_HDR_TYPEINDEX +#define BOOST_NO_CXX11_HDR_TYPE_TRAITS +#define BOOST_NO_CXX11_HDR_TUPLE +#define BOOST_NO_CXX11_HDR_THREAD +#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +#define BOOST_NO_CXX11_HDR_REGEX +#define BOOST_NO_CXX11_HDR_RATIO +#define BOOST_NO_CXX11_HDR_RANDOM +#define BOOST_NO_CXX11_HDR_MUTEX +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_HDR_FUTURE +#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_HDR_CHRONO +#define BOOST_NO_CXX11_HDR_ARRAY // // version check: diff --git a/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp b/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp index eaf6c741c..65beb5019 100644 --- a/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp +++ b/project/jni/boost/include/boost/config/compiler/sunpro_cc.hpp @@ -99,32 +99,34 @@ // # define BOOST_HAS_LONG_LONG -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // Version diff --git a/project/jni/boost/include/boost/config/compiler/vacpp.hpp b/project/jni/boost/include/boost/config/compiler/vacpp.hpp index b0407aab7..2410d5a3a 100644 --- a/project/jni/boost/include/boost/config/compiler/vacpp.hpp +++ b/project/jni/boost/include/boost/config/compiler/vacpp.hpp @@ -71,49 +71,59 @@ // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if ! __IBMCPP_AUTO_TYPEDEDUCTION -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if ! __IBMCPP_UTF_LITERAL__ -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif +#if ! __IBMCPP_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif -#define BOOST_NO_CONSTEXPR #if ! __IBMCPP_DECLTYPE -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #else # define BOOST_HAS_DECLTYPE #endif -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if ! __IBMCPP_EXTERN_TEMPLATE -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if ! __IBMCPP_VARIADIC_TEMPLATES // not enabled separately at this time -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#if ! __IBMCPP_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES +#endif +#if ! __IBMCPP_SCOPED_ENUM +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS #if ! __IBMCPP_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif #if ! __C99_MACRO_WITH_VA_ARGS -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif diff --git a/project/jni/boost/include/boost/config/compiler/visualc.hpp b/project/jni/boost/include/boost/config/compiler/visualc.hpp index 1a13f0dbd..aa4584df8 100644 --- a/project/jni/boost/include/boost/config/compiler/visualc.hpp +++ b/project/jni/boost/include/boost/config/compiler/visualc.hpp @@ -9,38 +9,54 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. - +// // Microsoft Visual C++ compiler setup: +// +// We need to be careful with the checks in this file, as contrary +// to popular belief there are versions with _MSC_VER with the final +// digit non-zero (mainly the MIPS cross compiler). +// +// So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX. +// No other comparisons (==, >, or <=) are safe. +// #define BOOST_MSVC _MSC_VER +// +// Helper macro BOOST_MSVC_FULL_VER for use in Boost code: +// #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif -// turn off the warnings before we #include anything +// Attempt to suppress VC6 warnings about the length of decorated names (obsolete): #pragma warning( disable : 4503 ) // warning: decorated name length exceeded +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +# error "Compiler not supported or configured - please reconfigure" +#endif + #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE -# if BOOST_MSVC == 1202 +# if _MSC_VER == 1202 # define BOOST_NO_STD_TYPEINFO # endif - // disable min/max macro defines on vc6: - // #endif /// Visual Studio has no fenv.h #define BOOST_NO_FENV_H -#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 +#if (_MSC_VER < 1310) // 130X == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS @@ -72,7 +88,7 @@ # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? -# if (_MSC_VER > 1200) +# if (_MSC_VER >= 1300) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -83,9 +99,9 @@ // it appears not to actually work: # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if defined(UNDER_CE) @@ -93,17 +109,16 @@ # define BOOST_NO_SWPRINTF #endif -#if _MSC_VER <= 1400 // 1400 == VC++ 8.0 +#if _MSC_VER < 1500 // 140X == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif -#if _MSC_VER == 1500 // 1500 == VC++ 9.0 +#if _MSC_VER < 1600 // 150X == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif -#if (_MSC_VER <= 1600) // MSVC (including the latest checked version) has not yet completely // implemented value-initialization, as is reported: // "VC++ does not value-initialize members of derived classes without @@ -117,11 +132,10 @@ // https://connect.microsoft.com/VisualStudio/feedback/details/100744 // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) -#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#endif +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 -# define BOOST_NO_INITIALIZER_LISTS +#if _MSC_VER < 1600 || !defined(BOOST_STRICT_CONFIG) // 150X == VC++ 9.0 +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #ifndef _NATIVE_WCHAR_T_DEFINED @@ -169,6 +183,16 @@ # define BOOST_NO_RTTI #endif +// +// TR1 features: +// +#if _MSC_VER >= 1700 +// # define BOOST_HAS_TR1_HASH // don't know if this is true yet. +// # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet. +# define BOOST_HAS_TR1_UNORDERED_MAP +# define BOOST_HAS_TR1_UNORDERED_SET +#endif + // // C++0x features // @@ -177,38 +201,44 @@ // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_NULLPTR -#define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_DECLTYPE #endif // _MSC_VER < 1600 #if _MSC_VER >= 1600 -#define BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H #endif +// C++ features supported by VC++ 11 (aka 2012) +// +#if _MSC_VER < 1700 +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif // _MSC_VER < 1700 + // C++0x features not supported by any versions -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE_N3276 -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_NOEXCEPT -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP -#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // prefix and suffix headers: // @@ -219,6 +249,7 @@ # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif +#ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE @@ -230,13 +261,20 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1400 + // Note: I'm not aware of any CE compiler with version 13xx +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION evc8 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION evc9 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION evc10 -# elif _MSC_VER == 1700 +# elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION evc11 # else # if defined(BOOST_ASSERT_CONFIG) @@ -251,31 +289,26 @@ # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 -# elif _MSC_VER == 1300 +# elif _MSC_VER < 1310 # define BOOST_COMPILER_VERSION 7.0 -# elif _MSC_VER == 1310 +# elif _MSC_VER < 1400 # define BOOST_COMPILER_VERSION 7.1 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION 8.0 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION 9.0 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION 10.0 -# elif _MSC_VER == 1700 +# elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION 11.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif -#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) - -// -// versions check: -// we don't support Visual C++ prior to version 6: -#if _MSC_VER < 1200 -#error "Compiler not supported or configured - please reconfigure" +# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif + // // last known and checked version is 1700 (VC11, aka 2011): #if (_MSC_VER > 1700) diff --git a/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp b/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp index 1814bee2c..305885177 100644 --- a/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp +++ b/project/jni/boost/include/boost/config/stdlib/dinkumware.hpp @@ -94,34 +94,44 @@ // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_FUNCTIONAL +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_SMART_PTR #endif -#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_0X_HDR_TUPLE) -# define BOOST_NO_0X_HDR_TUPLE +#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE) +# define BOOST_NO_CXX11_HDR_TUPLE #endif + +// C++0x headers implemented in 540 (as shipped by Microsoft) +// +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 540 +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +#endif + // // C++0x headers not yet (fully) implemented: // -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/project/jni/boost/include/boost/config/stdlib/libcomo.hpp b/project/jni/boost/include/boost/config/stdlib/libcomo.hpp index 341cf9708..29490f1b1 100644 --- a/project/jni/boost/include/boost/config/stdlib/libcomo.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libcomo.hpp @@ -35,26 +35,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL // // Intrinsic type_traits support. diff --git a/project/jni/boost/include/boost/config/stdlib/libcpp.hpp b/project/jni/boost/include/boost/config/stdlib/libcpp.hpp index 07c704333..3d574407e 100644 --- a/project/jni/boost/include/boost/config/stdlib/libcpp.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libcpp.hpp @@ -20,15 +20,16 @@ #define BOOST_HAS_THREADS #ifdef _LIBCPP_HAS_NO_VARIADICS -# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TUPLE #endif // // These appear to be unusable/incomplete so far: // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES diff --git a/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp b/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp index 03cea5c0f..c56dff225 100644 --- a/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp +++ b/project/jni/boost/include/boost/config/stdlib/libstdcpp3.hpp @@ -105,51 +105,61 @@ // C++0x headers in GCC 4.3.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #endif // C++0x headers in GCC 4.4.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_SMART_PTR #else # define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG # define BOOST_HAS_TR1_COMPLEX_OVERLOADS #endif -#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_0X_HDR_MUTEX)) -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_MUTEX +#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_CXX11_HDR_MUTEX)) +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_MUTEX #endif // C++0x features in GCC 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_RANDOM #endif -// C++0x features in GCC 4.5.0 and later +// C++0x features in GCC 4.6.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TYPEINDEX +#endif + +// C++0x features in GCC 4.7.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// Note that although existed prior to 4.7, "stead_clock" is spelled "monotonic_clock" +// so 4.7.0 is the first truely conforming one. +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_ALLOCATOR #endif // C++0x headers not yet (fully!) implemented // -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // --- end --- diff --git a/project/jni/boost/include/boost/config/stdlib/modena.hpp b/project/jni/boost/include/boost/config/stdlib/modena.hpp index 626e712b5..b483b6e02 100644 --- a/project/jni/boost/include/boost/config/stdlib/modena.hpp +++ b/project/jni/boost/include/boost/config/stdlib/modena.hpp @@ -24,26 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Modena C++ standard library" diff --git a/project/jni/boost/include/boost/config/stdlib/msl.hpp b/project/jni/boost/include/boost/config/stdlib/msl.hpp index adb3d4787..4f9a2da6e 100644 --- a/project/jni/boost/include/boost/config/stdlib/msl.hpp +++ b/project/jni/boost/include/boost/config/stdlib/msl.hpp @@ -48,26 +48,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/project/jni/boost/include/boost/config/stdlib/roguewave.hpp b/project/jni/boost/include/boost/config/stdlib/roguewave.hpp index 95ac36c6b..cb80f5708 100644 --- a/project/jni/boost/include/boost/config/stdlib/roguewave.hpp +++ b/project/jni/boost/include/boost/config/stdlib/roguewave.hpp @@ -155,29 +155,32 @@ #endif #if _RWSTD_VER < 0x05000000 -# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_ARRAY #endif // type_traits header is incomplete: -# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS // // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/project/jni/boost/include/boost/config/stdlib/sgi.hpp b/project/jni/boost/include/boost/config/stdlib/sgi.hpp index c8d77d55d..ae9b6ad90 100644 --- a/project/jni/boost/include/boost/config/stdlib/sgi.hpp +++ b/project/jni/boost/include/boost/config/stdlib/sgi.hpp @@ -118,26 +118,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "SGI standard library" diff --git a/project/jni/boost/include/boost/config/stdlib/stlport.hpp b/project/jni/boost/include/boost/config/stdlib/stlport.hpp index d30699922..bcc30b99e 100644 --- a/project/jni/boost/include/boost/config/stdlib/stlport.hpp +++ b/project/jni/boost/include/boost/config/stdlib/stlport.hpp @@ -71,10 +71,6 @@ # endif #endif -#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) -# define BOOST_NO_STD_UNORDERED -#endif - #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) # define BOOST_HAS_TR1_UNORDERED_SET # define BOOST_HAS_TR1_UNORDERED_MAP @@ -212,26 +208,29 @@ namespace boost { using std::min; using std::max; } // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/project/jni/boost/include/boost/config/stdlib/vacpp.hpp b/project/jni/boost/include/boost/config/stdlib/vacpp.hpp index 32a1fc08b..9d1694655 100644 --- a/project/jni/boost/include/boost/config/stdlib/vacpp.hpp +++ b/project/jni/boost/include/boost/config/stdlib/vacpp.hpp @@ -24,26 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Visual Age default standard library" diff --git a/project/jni/boost/include/boost/config/suffix.hpp b/project/jni/boost/include/boost/config/suffix.hpp index 72a0dc957..8ee88d90f 100644 --- a/project/jni/boost/include/boost/config/suffix.hpp +++ b/project/jni/boost/include/boost/config/suffix.hpp @@ -1,4 +1,5 @@ // Boost config.hpp configuration header file ------------------------------// +// boostinspect:ndprecated_macros -- tell the inspect tool to ignore this file // Copyright (c) 2001-2003 John Maddock // Copyright (c) 2001 Darin Adler @@ -103,13 +104,6 @@ # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #endif -// -// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: -// -#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) -# define BOOST_HAS_STATIC_ASSERT -#endif - // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: @@ -334,38 +328,6 @@ # define BOOST_HASH_MAP_HEADER #endif -// -// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. -// - -#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) -# define BOOST_NO_INITIALIZER_LISTS -#endif -#if defined(BOOST_NO_INITIALIZER_LISTS) && !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -#endif - -// -// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined -// -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) -#define BOOST_HAS_RVALUE_REFS -#endif - -// -// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined -// -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) -#define BOOST_HAS_VARIADIC_TMPL -#endif - -// -// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined -// -#if !defined(BOOST_NO_DECLTYPE_N3276) && defined(BOOST_NO_DECLTYPE) -#define BOOST_NO_DECLTYPE_N3276 -#endif - // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -527,6 +489,18 @@ namespace boost{ # endif } #endif +// same again for __int128: +#if defined(BOOST_HAS_INT128) && defined(__cplusplus) +namespace boost{ +# ifdef __GNUC__ + __extension__ typedef __int128 int128_type; + __extension__ typedef unsigned __int128 uint128_type; +# else + typedef __int128 int128_type; + typedef unsigned __int128 uint128_type; +# endif +} +#endif // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// // @@ -635,20 +609,6 @@ namespace std{ using ::type_info; } #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) #define BOOST_DO_JOIN2( X, Y ) X##Y -// -// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR -// These aid the transition to C++11 while still supporting C++03 compilers -// -#ifdef BOOST_NO_NOEXCEPT -# define BOOST_NOEXCEPT -# define BOOST_NOEXCEPT_IF(Predicate) -# define BOOST_NOEXCEPT_EXPR(Expression) false -#else -# define BOOST_NOEXCEPT noexcept -# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) -# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) -#endif - // // Set some default values for compiler/library/platform names. // These are for debugging config setup only: @@ -675,19 +635,6 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif -// -// constexpr workarounds -// -#if defined(BOOST_NO_CONSTEXPR) -#define BOOST_CONSTEXPR -#define BOOST_CONSTEXPR_OR_CONST const -#else -#define BOOST_CONSTEXPR constexpr -#define BOOST_CONSTEXPR_OR_CONST constexpr -#endif - -#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST - // BOOST_FORCEINLINE ---------------------------------------------// // Macro to use in place of 'inline' to force a function to be inline #if !defined(BOOST_FORCEINLINE) @@ -700,5 +647,274 @@ namespace std{ using ::type_info; } # endif #endif +// +// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined +// +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) +#define BOOST_NO_CXX11_DECLTYPE_N3276 BOOST_NO_CXX11_DECLTYPE #endif +// -------------------- Deprecated macros for 1.50 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP +// instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) +# ifndef BOOST_NO_CXX11_STD_UNORDERED +# define BOOST_NO_CXX11_STD_UNORDERED +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST instead of BOOST_NO_INITIALIZER_LISTS +#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + +// Use BOOST_NO_CXX11_HDR_ARRAY instead of BOOST_NO_0X_HDR_ARRAY +#if defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_BOOST_NO_0X_HDR_ARRAY) +# define BOOST_NO_0X_HDR_ARRAY +#endif +// Use BOOST_NO_CXX11_HDR_CHRONO instead of BOOST_NO_0X_HDR_CHRONO +#if defined(BOOST_NO_CXX11_HDR_CHRONO) && !defined(BOOST_NO_0X_HDR_CHRONO) +# define BOOST_NO_0X_HDR_CHRONO +#endif +// Use BOOST_NO_CXX11_HDR_CODECVT instead of BOOST_NO_0X_HDR_CODECVT +#if defined(BOOST_NO_CXX11_HDR_CODECVT) && !defined(BOOST_NO_0X_HDR_CODECVT) +# define BOOST_NO_0X_HDR_CODECVT +#endif +// Use BOOST_NO_CXX11_HDR_CONDITION_VARIABLE instead of BOOST_NO_0X_HDR_CONDITION_VARIABLE +#if defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) && !defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +#endif +// Use BOOST_NO_CXX11_HDR_FORWARD_LIST instead of BOOST_NO_0X_HDR_FORWARD_LIST +#if defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) && !defined(BOOST_NO_0X_HDR_FORWARD_LIST) +# define BOOST_NO_0X_HDR_FORWARD_LIST +#endif +// Use BOOST_NO_CXX11_HDR_FUTURE instead of BOOST_NO_0X_HDR_FUTURE +#if defined(BOOST_NO_CXX11_HDR_FUTURE) && !defined(BOOST_NO_0X_HDR_FUTURE) +# define BOOST_NO_0X_HDR_FUTURE +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST +// instead of BOOST_NO_0X_HDR_INITIALIZER_LIST or BOOST_NO_INITIALIZER_LISTS +#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# ifndef BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# endif +# ifndef BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_INITIALIZER_LISTS +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_MUTEX instead of BOOST_NO_0X_HDR_MUTEX +#if defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) +# define BOOST_NO_0X_HDR_MUTEX +#endif +// Use BOOST_NO_CXX11_HDR_RANDOM instead of BOOST_NO_0X_HDR_RANDOM +#if defined(BOOST_NO_CXX11_HDR_RANDOM) && !defined(BOOST_NO_0X_HDR_RANDOM) +# define BOOST_NO_0X_HDR_RANDOM +#endif +// Use BOOST_NO_CXX11_HDR_RATIO instead of BOOST_NO_0X_HDR_RATIO +#if defined(BOOST_NO_CXX11_HDR_RATIO) && !defined(BOOST_NO_0X_HDR_RATIO) +# define BOOST_NO_0X_HDR_RATIO +#endif +// Use BOOST_NO_CXX11_HDR_REGEX instead of BOOST_NO_0X_HDR_REGEX +#if defined(BOOST_NO_CXX11_HDR_REGEX) && !defined(BOOST_NO_0X_HDR_REGEX) +# define BOOST_NO_0X_HDR_REGEX +#endif +// Use BOOST_NO_CXX11_HDR_SYSTEM_ERROR instead of BOOST_NO_0X_HDR_SYSTEM_ERROR +#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_0X_HDR_SYSTEM_ERROR) +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +#endif +// Use BOOST_NO_CXX11_HDR_THREAD instead of BOOST_NO_0X_HDR_THREAD +#if defined(BOOST_NO_CXX11_HDR_THREAD) && !defined(BOOST_NO_0X_HDR_THREAD) +# define BOOST_NO_0X_HDR_THREAD +#endif +// Use BOOST_NO_CXX11_HDR_TUPLE instead of BOOST_NO_0X_HDR_TUPLE +#if defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE +#endif +// Use BOOST_NO_CXX11_HDR_TYPE_TRAITS instead of BOOST_NO_0X_HDR_TYPE_TRAITS +#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) +# define BOOST_NO_0X_HDR_TYPE_TRAITS +#endif +// Use BOOST_NO_CXX11_HDR_TYPEINDEX instead of BOOST_NO_0X_HDR_TYPEINDEX +#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) && !defined(BOOST_NO_0X_HDR_TYPEINDEX) +# define BOOST_NO_0X_HDR_TYPEINDEX +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_MAP instead of BOOST_NO_0X_HDR_UNORDERED_MAP +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) && !defined(BOOST_NO_0X_HDR_UNORDERED_MAP) +# define BOOST_NO_0X_HDR_UNORDERED_MAP +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET instead of BOOST_NO_0X_HDR_UNORDERED_SET +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_0X_HDR_UNORDERED_SET) +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// ------------------ End of deprecated macros for 1.50 --------------------------- + +// -------------------- Deprecated macros for 1.51 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_AUTO_DECLARATIONS instead of BOOST_NO_AUTO_DECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_AUTO_DECLARATIONS) +# define BOOST_NO_AUTO_DECLARATIONS +#endif +// Use BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS instead of BOOST_NO_AUTO_MULTIDECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS) && !defined(BOOST_NO_AUTO_MULTIDECLARATIONS) +# define BOOST_NO_AUTO_MULTIDECLARATIONS +#endif +// Use BOOST_NO_CXX11_CHAR16_T instead of BOOST_NO_CHAR16_T +#if defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CHAR16_T) +# define BOOST_NO_CHAR16_T +#endif +// Use BOOST_NO_CXX11_CHAR32_T instead of BOOST_NO_CHAR32_T +#if defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CHAR32_T) +# define BOOST_NO_CHAR32_T +#endif +// Use BOOST_NO_CXX11_TEMPLATE_ALIASES instead of BOOST_NO_TEMPLATE_ALIASES +#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_TEMPLATE_ALIASES) +# define BOOST_NO_TEMPLATE_ALIASES +#endif +// Use BOOST_NO_CXX11_CONSTEXPR instead of BOOST_NO_CONSTEXPR +#if defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CONSTEXPR) +# define BOOST_NO_CONSTEXPR +#endif +// Use BOOST_NO_CXX11_DECLTYPE_N3276 instead of BOOST_NO_DECLTYPE_N3276 +#if defined(BOOST_NO_CXX11_DECLTYPE_N3276) && !defined(BOOST_NO_DECLTYPE_N3276) +# define BOOST_NO_DECLTYPE_N3276 +#endif +// Use BOOST_NO_CXX11_DECLTYPE instead of BOOST_NO_DECLTYPE +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE) +# define BOOST_NO_DECLTYPE +#endif +// Use BOOST_NO_CXX11_DEFAULTED_FUNCTIONS instead of BOOST_NO_DEFAULTED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_DEFAULTED_FUNCTIONS) +# define BOOST_NO_DEFAULTED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_DELETED_FUNCTIONS instead of BOOST_NO_DELETED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_DELETED_FUNCTIONS) +# define BOOST_NO_DELETED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS instead of BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#endif +// Use BOOST_NO_CXX11_EXTERN_TEMPLATE instead of BOOST_NO_EXTERN_TEMPLATE +#if defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) && !defined(BOOST_NO_EXTERN_TEMPLATE) +# define BOOST_NO_EXTERN_TEMPLATE +#endif +// Use BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS instead of BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +// Use BOOST_NO_CXX11_LAMBDAS instead of BOOST_NO_LAMBDAS +#if defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) +# define BOOST_NO_LAMBDAS +#endif +// Use BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS instead of BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#if defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS) && !defined(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif +// Use BOOST_NO_CXX11_NOEXCEPT instead of BOOST_NO_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT) +# define BOOST_NO_NOEXCEPT +#endif +// Use BOOST_NO_CXX11_NULLPTR instead of BOOST_NO_NULLPTR +#if defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR) +# define BOOST_NO_NULLPTR +#endif +// Use BOOST_NO_CXX11_RAW_LITERALS instead of BOOST_NO_RAW_LITERALS +#if defined(BOOST_NO_CXX11_RAW_LITERALS) && !defined(BOOST_NO_RAW_LITERALS) +# define BOOST_NO_RAW_LITERALS +#endif +// Use BOOST_NO_CXX11_RVALUE_REFERENCES instead of BOOST_NO_RVALUE_REFERENCES +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES) +# define BOOST_NO_RVALUE_REFERENCES +#endif +// Use BOOST_NO_CXX11_SCOPED_ENUMS instead of BOOST_NO_SCOPED_ENUMS +#if defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_NO_SCOPED_ENUMS) +# define BOOST_NO_SCOPED_ENUMS +#endif +// Use BOOST_NO_CXX11_STATIC_ASSERT instead of BOOST_NO_STATIC_ASSERT +#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) +# define BOOST_NO_STATIC_ASSERT +#endif +// Use BOOST_NO_CXX11_STD_UNORDERED instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_STD_UNORDERED) && !defined(BOOST_NO_STD_UNORDERED) +# define BOOST_NO_STD_UNORDERED +#endif +// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) +# define BOOST_NO_UNICODE_LITERALS +#endif +// Use BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX instead of BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX) +# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#endif +// Use BOOST_NO_CXX11_VARIADIC_TEMPLATES instead of BOOST_NO_VARIADIC_TEMPLATES +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +# define BOOST_NO_VARIADIC_TEMPLATES +#endif +// Use BOOST_NO_CXX11_VARIADIC_MACROS instead of BOOST_NO_VARIADIC_MACROS +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS) +# define BOOST_NO_VARIADIC_MACROS +#endif +// Use BOOST_NO_CXX11_NUMERIC_LIMITS instead of BOOST_NO_NUMERIC_LIMITS_LOWEST +#if defined(BOOST_NO_CXX11_NUMERIC_LIMITS) && !defined(BOOST_NO_NUMERIC_LIMITS_LOWEST) +# define BOOST_NO_NUMERIC_LIMITS_LOWEST +#endif +// ------------------ End of deprecated macros for 1.51 --------------------------- + + + +// +// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR +// These aid the transition to C++11 while still supporting C++03 compilers +// +#ifdef BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NOEXCEPT +# define BOOST_NOEXCEPT_IF(Predicate) +# define BOOST_NOEXCEPT_EXPR(Expression) false +#else +# define BOOST_NOEXCEPT noexcept +# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) +# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) +#endif + +// +// constexpr workarounds +// +#if defined(BOOST_NO_CXX11_CONSTEXPR) +#define BOOST_CONSTEXPR +#define BOOST_CONSTEXPR_OR_CONST const +#else +#define BOOST_CONSTEXPR constexpr +#define BOOST_CONSTEXPR_OR_CONST constexpr +#endif + +#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST + +// +// Set BOOST_HAS_STATIC_ASSERT when BOOST_NO_CXX11_STATIC_ASSERT is not defined +// +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) +# define BOOST_HAS_STATIC_ASSERT +#endif + +// +// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_CXX11_RVALUE_REFERENCES is not defined +// +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) +#define BOOST_HAS_RVALUE_REFS +#endif + +// +// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_CXX11_VARIADIC_TEMPLATES is not defined +// +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) +#define BOOST_HAS_VARIADIC_TMPL +#endif + + +#endif diff --git a/project/jni/boost/include/boost/config/user.hpp b/project/jni/boost/include/boost/config/user.hpp index 439d3c7ee..1e2ea1d3a 100644 --- a/project/jni/boost/include/boost/config/user.hpp +++ b/project/jni/boost/include/boost/config/user.hpp @@ -17,6 +17,10 @@ #define __arm__ 1 #define _REENTRANT 1 #define _GLIBCXX__PTHREADS 1 +// There is problem with std::atomic on android (and some other platforms). +// See this link for more info: +// https://code.google.com/p/android/issues/detail?id=42735#makechanges +#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 // define this to locate a compiler config file: // #define BOOST_COMPILER_CONFIG diff --git a/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp b/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp deleted file mode 100644 index 03e12d1d1..000000000 --- a/project/jni/boost/include/boost/container/allocator/scoped_allocator.hpp +++ /dev/null @@ -1,651 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Pablo Halpern 2009. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP -#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP - -#if (defined _MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -#include -#include -#include -#include -#include - -namespace boost { namespace container { - -template -class scoped_allocator_adaptor; - -template -scoped_allocator_adaptor make_scoped(); - -template -class scoped_allocator_adaptor_base : public OuterAlloc -{ - typedef allocator_traits OuterTraits; - -public: - // Workaround for inability of gcc-4.4.1 to expand InnerAllocs... -// typedef scoped_allocator_adaptor inner_allocator_type; - typedef decltype(make_scoped()) inner_allocator_type; - - scoped_allocator_adaptor_base(); - - template - scoped_allocator_adaptor_base(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs); - - template - scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other); - - inner_allocator_type& inner_allocator() - { return _M_inner_allocs; } - inner_allocator_type const& inner_allocator() const - { return _M_inner_allocs; } - - // Allocator propagation functions. - scoped_allocator_adaptor - select_on_container_copy_construction() const; - - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_copy_assignment::value || - inner_allocator_type::propagate_on_container_copy_assignment::value - > propagate_on_container_copy_assignment; - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_move_assignment::value || - inner_allocator_type::propagate_on_container_move_assignment::value - > propagate_on_container_move_assignment; - typedef std::integral_constant< - bool, - OuterTraits::propagate_on_container_swap::value || - inner_allocator_type::propagate_on_container_swap::value - > propagate_on_container_swap; - -private: - inner_allocator_type _M_inner_allocs; -}; - -// Specialization with only one parameter. -template -class scoped_allocator_adaptor_base : public OuterAlloc -{ - typedef allocator_traits OuterTraits; -public: - typedef scoped_allocator_adaptor inner_allocator_type; - - scoped_allocator_adaptor_base(); - - template - scoped_allocator_adaptor_base(OuterA2&& outerAlloc); - - template - scoped_allocator_adaptor_base(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor_base(scoped_allocator_adaptor&& other); - - inner_allocator_type& inner_allocator() - { return static_cast(*this); } - - inner_allocator_type const& inner_allocator() const - { return static_cast(*this); } - - // Allocator propagation functions. - scoped_allocator_adaptor - select_on_container_copy_construction() const; - - typedef typename OuterTraits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment; - typedef typename OuterTraits::propagate_on_container_move_assignment propagate_on_container_move_assignment; - typedef typename OuterTraits::propagate_on_container_swap propagate_on_container_swap; -}; - -template -class scoped_allocator_adaptor - : public scoped_allocator_adaptor_base -{ - typedef scoped_allocator_adaptor_base _Base; - typedef allocator_traits _Traits; - -public: - typedef OuterAlloc outer_allocator_type; - typedef typename _Base::inner_allocator_type inner_allocator_type; - - typedef typename allocator_traits::size_type size_type; - typedef typename allocator_traits::difference_type difference_type; - typedef typename allocator_traits::pointer pointer; - typedef typename allocator_traits::const_pointer const_pointer; - typedef typename allocator_traits::void_pointer void_pointer; - typedef typename allocator_traits::const_void_pointer const_void_pointer; - typedef typename allocator_traits::value_type value_type; - - template - struct rebind { - typedef typename allocator_traits::template rebind_traits rebound_traits; - typedef typename rebound_traits::allocator_type rebound_outer; // exposition only - typedef scoped_allocator_adaptor other; - }; - - scoped_allocator_adaptor(); - scoped_allocator_adaptor(const scoped_allocator_adaptor& other); - - template - scoped_allocator_adaptor(const scoped_allocator_adaptor& other); - template - scoped_allocator_adaptor(scoped_allocator_adaptor&& other); - - template - scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs); - - ~scoped_allocator_adaptor(); - - inner_allocator_type & inner_allocator() - { return _Base::inner_allocator(); } - inner_allocator_type const& inner_allocator() const - { return _Base::inner_allocator(); } - outer_allocator_type & outer_allocator() - { return *this; } - outer_allocator_type const& outer_allocator() const - { return *this; } - - pointer allocate(size_type n); - pointer allocate(size_type n, const_void_pointer hint); - void deallocate(pointer p, size_type n); - size_type max_size() const; - - template - void construct(T* p, Args&&... args); - - // Specializations to pass inner_allocator to pair::first and pair::second - template - void construct(std::pair* p); - template - void construct(std::pair* p, U&& x, V&& y); - template - void construct(std::pair* p, const std::pair& pr); - template - void construct(std::pair* p, std::pair&& pr); - - template - void destroy(T* p); -}; - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b); - -template -inline -bool operator!=(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b); - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor_base -/////////////////////////////////////////////////////////////////////////////// - -template -inline -scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base() -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base(OuterA2&& outerAlloc, - const InnerAllocs&... innerAllocs) - : OuterAlloc(std::forward(outerAlloc)) - , _M_inner_allocs(innerAllocs...) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - const scoped_allocator_adaptor& other) - : OuterAlloc(other.outer_allocator()) - , _M_inner_allocs(other.inner_allocator()) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - scoped_allocator_adaptor&& other) - : OuterAlloc(std::move(other.outer_allocator())) - , _M_inner_allocs(std::move(other.inner_allocator())) -{ -} - -template -inline -scoped_allocator_adaptor -scoped_allocator_adaptor_base:: - select_on_container_copy_construction() const -{ - return scoped_allocator_adaptor( - allocator_traits::select_on_container_copy_construction( - this->outer_allocator()), - allocator_traits::select_on_container_copy_construction( - this->inner_allocator())); -} - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor_base specialization -/////////////////////////////////////////////////////////////////////////////// - -template -inline -scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base() -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base(OuterA2&& outerAlloc) - : OuterAlloc(std::forward(outerAlloc)) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - const scoped_allocator_adaptor& other) - : OuterAlloc(other.outer_allocator()) -{ -} - -template - template - scoped_allocator_adaptor_base:: - scoped_allocator_adaptor_base( - scoped_allocator_adaptor&& other) - : OuterAlloc(std::move(other.outer_allocator())) -{ -} - -// template -// inline -// scoped_allocator_adaptor& -// scoped_allocator_adaptor_base::inner_allocator() -// { -// return *this; -// } - -// template -// inline -// scoped_allocator_adaptor const& -// scoped_allocator_adaptor_base::inner_allocator() cosnt -// { -// return *this; -// } - -template -inline -scoped_allocator_adaptor -scoped_allocator_adaptor_base:: -select_on_container_copy_construction() const -{ - return - allocator_traits::select_on_container_copy_construction( - this->outer_allocator()); -} - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor details -/////////////////////////////////////////////////////////////////////////////// - -namespace __details { - - // Overload resolution for __has_ctor resolves to this function - // when _Tp is constructible with _Args. Returns true_type(). - - static void* __void_p; // Declared but not defined - - template - inline - auto __has_ctor(int, _Args&&... __args) -> - decltype((new (__void_p) _Tp(__args...), std::true_type())) - { return std::true_type(); } - - // Overload resolution for __has_ctor resolves to this function - // when _Tp is not constructible with _Args. Returns false_type(). - template - auto __has_ctor(_LowPriorityConversion, _Args&&...) -> - std::false_type - { return std::false_type(); } - - template - struct __is_scoped_allocator_imp { - template - static char test(int, typename T::outer_allocator_type*); - template - static int test(_LowPriorityConversion, void*); - static const bool value = (1 == sizeof(test<_Alloc>(0, 0))); - }; - - template - struct __is_scoped_allocator - : std::integral_constant::value> - { - }; - -#if 0 - // Called when outer_allocator_type is not a scoped allocator - // (recursion stop). - template - inline - auto __outermost_alloc(_LowPriorityConversion, _Alloc& __a) -> - _Alloc& - { - return __a; - } - - // Called when outer_allocator_type is a scoped allocator to - // return the outermost allocator type. - template - inline auto __outermost_alloc(int, _Alloc& __a) -> - decltype(__outermost_alloc(0,__a.outer_allocator())) - { - return __a.outer_allocator(); - } -#endif - - template - inline void __dispatch_scoped_construct(std::false_type __uses_alloc, - _Ignore __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // _Tp doesn't use allocators. Construct without an - // allocator argument. - allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p, - std::forward<_Args>(__args)...); - } - - template - inline void __dispatch_scoped_construct(std::true_type __uses_alloc, - std::true_type __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // _Tp doesn't use allocators. Construct without an - // allocator argument. - allocator_traits<_OuterAlloc>::construct(__outer_alloc, __p, - allocator_arg, __inner_alloc, - std::forward<_Args>(__args)...); - } - - template - inline void __dispatch_scoped_construct(std::true_type __uses_alloc, - std::false_type __use_alloc_prefix, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // If _Tp uses an allocator compatible with _InnerAlloc, - // but the specific constructor does not have a variant that - // takes an allocator argument, then program is malformed. -// static_assert(has_constructor<_Tp, _Args...>::value, -// "Cannot pass inner allocator to this constructor"); - - allocator_traits<_OuterAlloc>::construct( - __outer_alloc, __p, std::forward<_Args>(__args)..., - __inner_alloc); - } - - template - inline void __do_scoped_construct(std::false_type __scoped_outer, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // Dispatch construction to the correct __dispatch_scoped_construct() - // function based on whether _Tp uses an allocator of type - // _InnerAlloc and, if so, whether there exists the following - // constructor: - // _Tp(allocator_arg_t, _InnerAlloc, Args...). - auto __uses_alloc = uses_allocator<_Tp, _InnerAlloc>(); - auto __use_alloc_prefix = __has_ctor<_Tp>(0, allocator_arg, - __inner_alloc, - std::forward<_Args>(__args)...); - __dispatch_scoped_construct(__uses_alloc, __use_alloc_prefix, - __outer_alloc, - __inner_alloc, - __p, std::forward<_Args>(__args)...); - } - - template - void __do_scoped_construct(std::true_type __scoped_outer, - _OuterAlloc& __outer_alloc, - _InnerAlloc& __inner_alloc, - _Tp* __p, _Args&&... __args) - { - // Use outermost allocator if __outer_alloc is scoped - typedef typename _OuterAlloc::outer_allocator_type outerouter; - __do_scoped_construct(__is_scoped_allocator(), - __outer_alloc.outer_allocator(), - __inner_alloc, - __p, std::forward<_Args>(__args)...); - } - -} // end namespace __details - -/////////////////////////////////////////////////////////////////////////////// -// Implementation of scoped_allocator_adaptor -/////////////////////////////////////////////////////////////////////////////// - -template -scoped_allocator_adaptor:: - scoped_allocator_adaptor() -{ -} - -template -scoped_allocator_adaptor:: - scoped_allocator_adaptor(const scoped_allocator_adaptor& other) - : _Base(other) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(const scoped_allocator_adaptor& other) - : _Base(other) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(scoped_allocator_adaptor&& other) - : _Base(std::move(other)) -{ -} - -template - template - scoped_allocator_adaptor:: - scoped_allocator_adaptor(OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs) - : _Base(std::forward(outerAlloc), innerAllocs...) -{ -} - -template -scoped_allocator_adaptor:: - ~scoped_allocator_adaptor() -{ -} - -template -inline typename allocator_traits::pointer -scoped_allocator_adaptor:: - allocate(size_type n) -{ - return allocator_traits::allocate(outer_allocator(), n); -} - -template -inline typename allocator_traits::pointer -scoped_allocator_adaptor:: - allocate(size_type n, const_void_pointer hint) -{ - return allocator_traits::allocate(outer_allocator(), n, hint); -} - -template -inline void scoped_allocator_adaptor:: - deallocate(pointer p, size_type n) -{ - allocator_traits::deallocate(outer_allocator(), p, n); -} - -template -inline typename allocator_traits::size_type -scoped_allocator_adaptor::max_size() const -{ - return allocator_traits::max_size(outer_allocator()); -} - -template - template - inline void scoped_allocator_adaptor:: - destroy(T* p) -{ - allocator_traits::destroy(outer_allocator(), p); -} - -template - template - inline - void scoped_allocator_adaptor::construct(T* p, - Args&&... args) -{ - __do_scoped_construct(__details::__is_scoped_allocator(), - this->outer_allocator(), this->inner_allocator(), - p, std::forward(args)...); -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p) -{ - construct(addressof(p->first)); - try { - construct(addressof(p->second)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, U&& x, V&& y) -{ - construct(addressof(p->first), std::forward(x)); - try { - construct(addressof(p->second), std::forward(y)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, const std::pair& pr) -{ - construct(addressof(p->first), pr.first); - try { - construct(addressof(p->second), pr.second); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template - template - void scoped_allocator_adaptor::construct( - std::pair* p, std::pair&& pr) -{ - construct(addressof(p->first), std::move(pr.first)); - try { - construct(addressof(p->second), std::move(pr.second)); - } - catch (...) { - destroy(addressof(p->first)); - throw; - } -} - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return a.outer_allocator() == b.outer_allocator() - && a.inner_allocator() == b.inner_allocator(); -} - -template -inline -bool operator==(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return a.outer_allocator() == b.outer_allocator(); -} - -template -inline -bool operator!=(const scoped_allocator_adaptor& a, - const scoped_allocator_adaptor& b) -{ - return ! (a == b); -} - -}} // namespace boost { namespace container { - -#include - -#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP diff --git a/project/jni/boost/include/boost/container/allocator/allocator_traits.hpp b/project/jni/boost/include/boost/container/allocator_traits.hpp similarity index 74% rename from project/jni/boost/include/boost/container/allocator/allocator_traits.hpp rename to project/jni/boost/include/boost/container/allocator_traits.hpp index 01921615c..828d664d0 100644 --- a/project/jni/boost/include/boost/container/allocator/allocator_traits.hpp +++ b/project/jni/boost/include/boost/container/allocator_traits.hpp @@ -6,7 +6,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -24,10 +24,11 @@ #include #include #include -#include +#include +#include #include #include -#include +#include #include //numeric_limits<>::max() #include //placement new #include //std::allocator @@ -53,6 +54,8 @@ struct is_std_allocator< std::allocator > ///@endcond +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits template struct allocator_traits { @@ -62,64 +65,64 @@ struct allocator_traits typedef typename Alloc::value_type value_type; #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //!Alloc::pointer if such a type exists; otherwise, value_type* + //! Alloc::pointer if such a type exists; otherwise, value_type* //! typedef unspecified pointer; - //!Alloc::const_pointer if such a type exists ; otherwise, pointer_traits::rebind::rebind::rebind. + typedef see_documentation const_pointer; + //! Non-standard extension + //! Alloc::reference if such a type exists; otherwise, value_type& + typedef see_documentation reference; + //! Non-standard extension + //! Alloc::const_reference if such a type exists ; otherwise, const value_type& + typedef see_documentation const_reference; + //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits::rebind. //! - typedef unspecified void_pointer; - //!Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits::rebind::rebind::difference_type. + typedef see_documentation const_void_pointer; + //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits::difference_type. //! - typedef unspecified difference_type; - //!Alloc::size_type if such a type exists ; otherwise, make_unsigned::type + typedef see_documentation difference_type; + //! Alloc::size_type if such a type exists ; otherwise, make_unsigned::type //! - typedef unspecified size_type; - //!Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_copy_assignment; - //!Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_move_assignment; - //!Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant - //!type with internal constant static member
value
== false. - typedef unspecified propagate_on_container_swap; - //!Defines an allocator: Alloc::rebind::other if such a type exists; otherwise, Alloc - //!if Alloc is a class template instantiation of the form Alloc, where Args is zero or - //!more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + typedef see_documentation size_type; + //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_swap; + //! Defines an allocator: Alloc::rebind::other if such a type exists; otherwise, Alloc + //! if Alloc is a class template instantiation of the form Alloc, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. //! - //!In C++03 compilers
rebind_alloc
is a struct derived from an allocator - //!deduced by previously detailed rules. - template using rebind_alloc = unspecified; + //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator + //! deduced by previously detailed rules. + template using rebind_alloc = see_documentation; - //!In C++03 compilers
rebind_traits
is a struct derived from - //!
allocator_traits
, where `OtherAlloc` is
-      //!the allocator deduced by rules explained in `rebind_alloc`.
+      //! In C++03 compilers `rebind_traits` is a struct derived from
+      //! `allocator_traits`, where `OtherAlloc` is
+      //! the allocator deduced by rules explained in `rebind_alloc`.
       template  using rebind_traits = allocator_traits >;
 
-      //!Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
-      //!`type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
+      //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
+      //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
       template 
       struct portable_rebind_alloc
-      {  typedef unspecified_type type;  };
+      {  typedef see_documentation type;  };
    #else
       //pointer
       typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
          pointer, value_type*)
             pointer;
       //const_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
          const_pointer, typename boost::intrusive::pointer_traits::template
             rebind_pointer)
                const_pointer;
@@ -128,11 +131,11 @@ struct allocator_traits
          reference, typename container_detail::unvoid::type&)
             reference;
       //const_reference
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
          const_reference, const typename container_detail::unvoid::type&)
                const_reference;
       //void_pointer
-      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, 
+      typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
          void_pointer, typename boost::intrusive::pointer_traits::template
             rebind_pointer)
                void_pointer;
@@ -162,22 +165,22 @@ struct allocator_traits
          propagate_on_container_swap, boost::false_type)
             propagate_on_container_swap;
 
-      #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+      #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
          //C++11
-         template  using rebind_alloc  = boost::intrusive::detail::type_rebinder::type;
+         template  using rebind_alloc  = typename boost::intrusive::detail::type_rebinder::type;
          template  using rebind_traits = allocator_traits< rebind_alloc >;
-      #else    //!defined(BOOST_NO_TEMPLATE_ALIASES)
+      #else    // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
          //Some workaround for C++03 or C++11 compilers with no template aliases
          template 
          struct rebind_alloc : boost::intrusive::detail::type_rebinder::type
          {
             typedef typename boost::intrusive::detail::type_rebinder::type Base;
-            #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
             template 
-            rebind_alloc(Args&&... args)
+            rebind_alloc(BOOST_FWD_REF(Args)... args)
                : Base(boost::forward(args)...)
             {}
-            #else    //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
             #define BOOST_PP_LOCAL_MACRO(n)                                                        \
             BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
             rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                       \
@@ -186,32 +189,32 @@ struct allocator_traits
             //
             #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
             #include BOOST_PP_LOCAL_ITERATE()
-            #endif   //!defined(BOOST_NO_VARIADIC_TEMPLATES)
+            #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          };
 
          template 
          struct rebind_traits
             : allocator_traits::type>
          {};
-      #endif   //!defined(BOOST_NO_TEMPLATE_ALIASES)
+      #endif   // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
       template 
       struct portable_rebind_alloc
       {  typedef typename boost::intrusive::detail::type_rebinder::type type;  };
    #endif   //BOOST_CONTAINER_DOXYGEN_INVOKED
 
-   //!Returns: a.allocate(n)
+   //! Returns: `a.allocate(n)`
    //!
    static pointer allocate(Alloc &a, size_type n)
    {  return a.allocate(n);  }
 
-   //!Returns: a.deallocate(p, n)
+   //! Returns: `a.deallocate(p, n)`
    //!
-   //!Throws: Nothing
+   //! Throws: Nothing
    static void deallocate(Alloc &a, pointer p, size_type n)
    {  return a.deallocate(p, n);  }
 
-   //!Effects: calls `a.construct(p, std::forward(args)...)` if that call is well-formed;
-   //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+   //! Effects: calls `a.allocate(n, p)` if that call is well-formed;
+   //! otherwise, invokes `a.allocate(n)`
    static pointer allocate(Alloc &a, size_type n, const_void_pointer p)
    {
       const bool value = boost::container::container_detail::
@@ -221,8 +224,8 @@ struct allocator_traits
       return allocator_traits::priv_allocate(flag, a, n, p);
    }
 
-   //!Effects: calls a.destroy(p) if that call is well-formed;
-   //!otherwise, invokes `p->~T()`.
+   //! Effects: calls `a.destroy(p)` if that call is well-formed;
+   //! otherwise, invokes `p->~T()`.
    template
    static void destroy(Alloc &a, T*p)
    {
@@ -234,8 +237,8 @@ struct allocator_traits
       allocator_traits::priv_destroy(flag, a, p);
    }
 
-   //!Returns: a.max_size() if that expression is well-formed; otherwise,
-   //!`numeric_limits::max()`.
+   //! Returns: `a.max_size()` if that expression is well-formed; otherwise,
+   //! `numeric_limits::max()`.
    static size_type max_size(const Alloc &a)
    {
       const bool value = boost::container::container_detail::
@@ -245,8 +248,8 @@ struct allocator_traits
       return allocator_traits::priv_max_size(flag, a);
    }
 
-   //!Returns: a.select_on_container_copy_construction() if that expres sion is well- formed;
-   //!otherwise, a.
+   //! Returns: `a.select_on_container_copy_construction()` if that expression is well-formed;
+   //! otherwise, a.
    static Alloc select_on_container_copy_construction(const Alloc &a)
    {
       const bool value = boost::container::container_detail::
@@ -256,17 +259,17 @@ struct allocator_traits
       return allocator_traits::priv_select_on_container_copy_construction(flag, a);
    }
 
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-      //!Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; 
-      //!otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      //! Effects: calls `a.construct(p, std::forward(args)...)` if that call is well-formed;
+      //! otherwise, invokes `::new (static_cast(p)) T(std::forward(args)...)`
       template 
-      static void construct(Alloc & a, T* p, Args&&... args)
+      static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
       {
          ::boost::integral_constant::value> flag;
          allocator_traits::priv_construct(flag, a, p, ::boost::forward(args)...);
       }
    #endif
-
+   ///@cond
    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
       private:
       static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p)
@@ -295,10 +298,10 @@ struct allocator_traits
       static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a)
       {  return a;  }
 
-      #if defined(BOOST_CONTAINER_PERFECT_FORWARDING)
+      #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          template
-         static void priv_construct(boost::false_type, Alloc &a, T *p, Args && ...args)                    
-         {                                                                                                  
+         static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)                   
+         {                                                                                                 
             const bool value = boost::container::container_detail::
                   has_member_function_callable_with_construct
                      < Alloc, T*, Args... >::value;
@@ -307,19 +310,19 @@ struct allocator_traits
          }
 
          template
-         static void priv_construct(boost::true_type, Alloc &a, T *p, Args && ...args)
+         static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
          {
             priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward(args)...);
          }
 
          template
-         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, Args && ...args)
+         static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
          {  a.construct( p, ::boost::forward(args)...);  }
 
          template
-         static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, Args && ...args)
+         static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args)
          {  ::new((void*)p) T(::boost::forward(args)...); }
-      #else
+      #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
          public:
          #define BOOST_PP_LOCAL_MACRO(n)                                                              \
          template                                 \
@@ -333,7 +336,7 @@ struct allocator_traits
          //
          #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
          #include BOOST_PP_LOCAL_ITERATE()
-      
+     
          private:
          #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
          template                                      \
@@ -368,7 +371,7 @@ struct allocator_traits
          //
          #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
          #include BOOST_PP_LOCAL_ITERATE()
-      #endif   //BOOST_CONTAINER_PERFECT_FORWARDING
+      #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
    #endif   //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    ///@endcond
diff --git a/project/jni/boost/include/boost/container/container_fwd.hpp b/project/jni/boost/include/boost/container/container_fwd.hpp
index da325e446..bdefd81e0 100644
--- a/project/jni/boost/include/boost/container/container_fwd.hpp
+++ b/project/jni/boost/include/boost/container/container_fwd.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -21,8 +21,8 @@
 
 /// @cond
 
-namespace boost{ 
-namespace intrusive{ 
+namespace boost{
+namespace intrusive{
    //Create namespace to avoid compilation errors
 }}
 
@@ -32,9 +32,9 @@ namespace bi = boost::intrusive;
 
 }}}
 
-#include  
-#include  
-#include  
+#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -49,109 +49,105 @@ namespace container {
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class vector;
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class stable_vector;
 
 //vector class
 template  >
+         ,class Allocator = std::allocator >
 class deque;
 
 //list class
 template  >
+         ,class Allocator = std::allocator >
 class list;
 
 //slist class
 template  >
+         ,class Allocator = std::allocator >
 class slist;
 
 //set class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class set;
 
 //multiset class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class multiset;
 
 //map class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class map;
 
 //multimap class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class multimap;
 
 //flat_set class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class flat_set;
 
 //flat_multiset class
-template 
-         ,class A = std::allocator >
+template 
+         ,class Allocator = std::allocator >
 class flat_multiset;
 
 //flat_map class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class flat_map;
 
 //flat_multimap class
 template 
-         ,class A = std::allocator > >
+         ,class Compare  = std::less
+         ,class Allocator = std::allocator > >
 class flat_multimap;
 
 //basic_string class
 template 
-         ,class A  = std::allocator > 
+         ,class Allocator  = std::allocator >
 class basic_string;
 
 //! Type used to tag that the input range is
 //! guaranteed to be ordered
-struct ordered_range_impl_t {};
+struct ordered_range_t
+{};
 
 //! Type used to tag that the input range is
 //! guaranteed to be ordered and unique
-struct ordered_unique_range_impl_t{};
-
-/// @cond
-
-typedef ordered_range_impl_t * ordered_range_t;
-typedef ordered_unique_range_impl_t *ordered_unique_range_t;
-
-/// @endcond
+struct ordered_unique_range_t
+   : public ordered_range_t
+{};
 
 //! Value used to tag that the input range is
 //! guaranteed to be ordered
-static const ordered_range_t ordered_range = 0;
+static const ordered_range_t ordered_range = ordered_range_t();
 
 //! Value used to tag that the input range is
 //! guaranteed to be ordered and unique
-static const ordered_unique_range_t ordered_unique_range = 0;
+static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t();
 
 /// @cond
 
diff --git a/project/jni/boost/include/boost/container/deque.hpp b/project/jni/boost/include/boost/container/deque.hpp
index 9ee0ee137..32fa480e9 100644
--- a/project/jni/boost/include/boost/container/deque.hpp
+++ b/project/jni/boost/include/boost/container/deque.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -44,7 +44,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -58,29 +58,30 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
 
 /// @cond
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
 class deque;
 
-template 
+template 
 struct deque_value_traits
 {
    typedef T value_type;
-   typedef A allocator_type;
+   typedef Allocator allocator_type;
    static const bool trivial_dctr = boost::has_trivial_destructor::value;
-   static const bool trivial_dctr_after_move = false;
-      //::boost::has_trivial_destructor_after_move::value || trivial_dctr;
+   static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move::value;
    static const bool trivial_copy = has_trivial_copy::value;
    static const bool nothrow_copy = has_nothrow_copy::value;
    static const bool trivial_assign = has_trivial_assign::value;
@@ -90,54 +91,54 @@ struct deque_value_traits
 
 // Note: this function is simply a kludge to work around several compilers'
 //  bugs in handling constant expressions.
-inline std::size_t deque_buf_size(std::size_t size) 
+inline std::size_t deque_buf_size(std::size_t size)
    {  return size < 512 ? std::size_t(512 / size) : std::size_t(1);  }
 
 // Deque base class.  It has two purposes.  First, its constructor
 //  and destructor allocate (but don't initialize) storage.  This makes
 //  exception safety easier.
-template 
+template 
 class deque_base
 {
    BOOST_COPYABLE_AND_MOVABLE(deque_base)
    public:
-   typedef allocator_traits                                     val_alloc_traits_type;
-   typedef typename val_alloc_traits_type::value_type              val_alloc_val;
-   typedef typename val_alloc_traits_type::pointer                 val_alloc_ptr;
-   typedef typename val_alloc_traits_type::const_pointer           val_alloc_cptr;
-   typedef typename val_alloc_traits_type::reference               val_alloc_ref;
-   typedef typename val_alloc_traits_type::const_reference         val_alloc_cref;
-   typedef typename val_alloc_traits_type::difference_type         val_alloc_diff;
-   typedef typename val_alloc_traits_type::size_type               val_alloc_size;
+   typedef allocator_traits                            val_alloc_traits_type;
+   typedef typename val_alloc_traits_type::value_type             val_alloc_val;
+   typedef typename val_alloc_traits_type::pointer                val_alloc_ptr;
+   typedef typename val_alloc_traits_type::const_pointer          val_alloc_cptr;
+   typedef typename val_alloc_traits_type::reference              val_alloc_ref;
+   typedef typename val_alloc_traits_type::const_reference        val_alloc_cref;
+   typedef typename val_alloc_traits_type::difference_type        val_alloc_diff;
+   typedef typename val_alloc_traits_type::size_type              val_alloc_size;
    typedef typename val_alloc_traits_type::template
-      portable_rebind_alloc::type                   ptr_alloc_t;
-   typedef allocator_traits                           ptr_alloc_traits_type;
+      portable_rebind_alloc::type                  ptr_alloc_t;
+   typedef allocator_traits                          ptr_alloc_traits_type;
    typedef typename ptr_alloc_traits_type::value_type             ptr_alloc_val;
    typedef typename ptr_alloc_traits_type::pointer                ptr_alloc_ptr;
    typedef typename ptr_alloc_traits_type::const_pointer          ptr_alloc_cptr;
    typedef typename ptr_alloc_traits_type::reference              ptr_alloc_ref;
    typedef typename ptr_alloc_traits_type::const_reference        ptr_alloc_cref;
-   typedef A                                                      allocator_type;
+   typedef Allocator                                                      allocator_type;
    typedef allocator_type                                         stored_allocator_type;
    typedef val_alloc_size                                         size_type;
 
    protected:
 
-   typedef deque_value_traits             traits_t;
+   typedef deque_value_traits             traits_t;
    typedef ptr_alloc_t                          map_allocator_type;
 
    static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
 
-   val_alloc_ptr priv_allocate_node() 
+   val_alloc_ptr priv_allocate_node()
       {  return this->alloc().allocate(s_buffer_size());  }
 
-   void priv_deallocate_node(val_alloc_ptr p) 
+   void priv_deallocate_node(val_alloc_ptr p)
       {  this->alloc().deallocate(p, s_buffer_size());  }
 
-   ptr_alloc_ptr priv_allocate_map(size_type n) 
+   ptr_alloc_ptr priv_allocate_map(size_type n)
       { return this->ptr_alloc().allocate(n); }
 
-   void priv_deallocate_map(ptr_alloc_ptr p, size_type n) 
+   void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
       { this->ptr_alloc().deallocate(p, n); }
 
  public:
@@ -145,7 +146,7 @@ class deque_base
    //  For any nonsingular iterator i:
    //    i.node is the address of an element in the map array.  The
    //      contents of i.node is a pointer to the beginning of a node.
-   //    i.first == //(i.node) 
+   //    i.first == //(i.node)
    //    i.last  == i.first + node_size
    //    i.cur is a pointer in the range [i.first, i.last).  NOTE:
    //      the implication of this is that i.cur is always a dereferenceable
@@ -160,18 +161,18 @@ class deque_base
    //    [start.cur, start.last) and [finish.first, finish.cur) are initialized
    //    objects, and [start.first, start.cur) and [finish.cur, finish.last)
    //    are uninitialized storage.
-   //  [map, map + map_size) is a valid, non-empty range.  
-   //  [start.node, finish.node] is a valid range contained within 
-   //    [map, map + map_size).  
-   //  A pointer in the range [map, map + map_size) points to an allocated node
+   //  [map, map + map_size) is a valid, non-empty range. 
+   //  [start.node, finish.node] is a valid range contained within
+   //    [map, map + map_size). 
+   //  Allocator pointer in the range [map, map + map_size) points to an allocated node
    //    if and only if the pointer is in the range [start.node, finish.node].
-   class const_iterator 
-      : public std::iterator
    {
       public:
-      static size_type s_buffer_size() { return deque_base::s_buffer_size(); }
+      static size_type s_buffer_size() { return deque_base::s_buffer_size(); }
 
       typedef std::random_access_iterator_tag   iterator_category;
       typedef val_alloc_val                     value_type;
@@ -182,33 +183,33 @@ class deque_base
       typedef ptr_alloc_ptr                     index_pointer;
       typedef const_iterator                    self_t;
 
-      friend class deque;
-      friend class deque_base;
+      friend class deque;
+      friend class deque_base;
 
-      protected: 
+      protected:
       val_alloc_ptr  m_cur;
       val_alloc_ptr  m_first;
       val_alloc_ptr  m_last;
       index_pointer  m_node;
 
-      public: 
-      const_iterator(val_alloc_ptr x, index_pointer y) 
+      public:
+      const_iterator(val_alloc_ptr x, index_pointer y)
          : m_cur(x), m_first(*y),
            m_last(*y + s_buffer_size()), m_node(y) {}
 
       const_iterator() : m_cur(0), m_first(0), m_last(0), m_node(0) {}
 
       const_iterator(const const_iterator& x)
-         : m_cur(x.m_cur),   m_first(x.m_first), 
+         : m_cur(x.m_cur),   m_first(x.m_first),
            m_last(x.m_last), m_node(x.m_node) {}
 
-      reference operator*() const 
+      reference operator*() const
          { return *this->m_cur; }
 
-      pointer operator->() const 
+      pointer operator->() const
          { return this->m_cur; }
 
-      difference_type operator-(const self_t& x) const 
+      difference_type operator-(const self_t& x) const
       {
          if(!this->m_cur && !x.m_cur){
             return 0;
@@ -217,24 +218,24 @@ class deque_base
             (this->m_cur - this->m_first) + (x.m_last - x.m_cur);
       }
 
-      self_t& operator++() 
+      self_t& operator++()
       {
          ++this->m_cur;
          if (this->m_cur == this->m_last) {
             this->priv_set_node(this->m_node + 1);
             this->m_cur = this->m_first;
          }
-         return *this; 
+         return *this;
       }
 
-      self_t operator++(int)  
+      self_t operator++(int) 
       {
          self_t tmp = *this;
          ++*this;
          return tmp;
       }
 
-      self_t& operator--() 
+      self_t& operator--()
       {
          if (this->m_cur == this->m_first) {
             this->priv_set_node(this->m_node - 1);
@@ -244,7 +245,7 @@ class deque_base
          return *this;
       }
 
-      self_t operator--(int) 
+      self_t operator--(int)
       {
          self_t tmp = *this;
          --*this;
@@ -261,7 +262,7 @@ class deque_base
             offset > 0 ? offset / difference_type(this->s_buffer_size())
                         : -difference_type((-offset - 1) / this->s_buffer_size()) - 1;
             this->priv_set_node(this->m_node + node_offset);
-            this->m_cur = this->m_first + 
+            this->m_cur = this->m_first +
             (offset - node_offset * difference_type(this->s_buffer_size()));
          }
          return *this;
@@ -270,41 +271,41 @@ class deque_base
       self_t operator+(difference_type n) const
          {  self_t tmp = *this; return tmp += n;  }
 
-      self_t& operator-=(difference_type n) 
+      self_t& operator-=(difference_type n)
          { return *this += -n; }
-       
-      self_t operator-(difference_type n) const 
+      
+      self_t operator-(difference_type n) const
          {  self_t tmp = *this; return tmp -= n;  }
 
-      reference operator[](difference_type n) const 
+      reference operator[](difference_type n) const
          { return *(*this + n); }
 
-      bool operator==(const self_t& x) const 
+      bool operator==(const self_t& x) const
          { return this->m_cur == x.m_cur; }
 
-      bool operator!=(const self_t& x) const 
+      bool operator!=(const self_t& x) const
          { return !(*this == x); }
 
-      bool operator<(const self_t& x) const 
+      bool operator<(const self_t& x) const
       {
-         return (this->m_node == x.m_node) ? 
+         return (this->m_node == x.m_node) ?
             (this->m_cur < x.m_cur) : (this->m_node < x.m_node);
       }
 
-      bool operator>(const self_t& x) const  
+      bool operator>(const self_t& x) const 
          { return x < *this; }
 
-      bool operator<=(const self_t& x) const 
+      bool operator<=(const self_t& x) const
          { return !(x < *this); }
 
-      bool operator>=(const self_t& x) const 
+      bool operator>=(const self_t& x) const
          { return !(*this < x); }
 
-      void priv_set_node(index_pointer new_node) 
+      void priv_set_node(index_pointer new_node)
       {
          this->m_node = new_node;
          this->m_first = *new_node;
-         this->m_last = this->m_first + difference_type(this->s_buffer_size());
+         this->m_last = this->m_first + this->s_buffer_size();
       }
 
       friend const_iterator operator+(difference_type n, const const_iterator& x)
@@ -323,8 +324,8 @@ class deque_base
       typedef ptr_alloc_ptr                     index_pointer;
       typedef const_iterator                    self_t;
 
-      friend class deque;
-      friend class deque_base;
+      friend class deque;
+      friend class deque_base;
 
       private:
       explicit iterator(const const_iterator& x) : const_iterator(x){}
@@ -343,12 +344,12 @@ class deque_base
       reference operator[](difference_type n) const { return *(*this + n); }
 
       //Increment / Decrement
-      iterator& operator++()  
+      iterator& operator++() 
          { this->const_iterator::operator++(); return *this;  }
 
       iterator operator++(int)
          { iterator tmp = *this; ++*this; return tmp; }
-      
+     
       iterator& operator--()
          {  this->const_iterator::operator--(); return *this;  }
 
@@ -379,7 +380,7 @@ class deque_base
       :  members_(a)
    { this->priv_initialize_map(num_elements); }
 
-   explicit deque_base(const allocator_type& a) 
+   explicit deque_base(const allocator_type& a)
       :  members_(a)
    {}
 
@@ -402,7 +403,7 @@ class deque_base
 
    private:
    deque_base(const deque_base&);
-  
+ 
    protected:
 
    void swap_members(deque_base &x)
@@ -423,7 +424,7 @@ class deque_base
 
          ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
          ptr_alloc_ptr nfinish = nstart + num_nodes;
-             
+            
          BOOST_TRY {
             this->priv_create_nodes(nstart, nfinish);
          }
@@ -508,16 +509,16 @@ class deque_base
       iterator        m_finish;
    } members_;
 
-   ptr_alloc_t &ptr_alloc() 
+   ptr_alloc_t &ptr_alloc()
    {  return members_;  }
-   
-   const ptr_alloc_t &ptr_alloc() const 
+  
+   const ptr_alloc_t &ptr_alloc() const
    {  return members_;  }
 
-   allocator_type &alloc() 
+   allocator_type &alloc()
    {  return members_;  }
-   
-   const allocator_type &alloc() const 
+  
+   const allocator_type &alloc() const
    {  return members_;  }
 };
 /// @endcond
@@ -525,323 +526,72 @@ class deque_base
 //! Deque class
 //!
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class deque : protected deque_base
+class deque : protected deque_base
 {
    /// @cond
    private:
-   typedef deque_base Base;
-   typedef typename Base::val_alloc_val            val_alloc_val;
-   typedef typename Base::val_alloc_ptr            val_alloc_ptr;
-   typedef typename Base::val_alloc_cptr           val_alloc_cptr;
-   typedef typename Base::val_alloc_ref            val_alloc_ref;
-   typedef typename Base::val_alloc_cref           val_alloc_cref;
-   typedef typename Base::val_alloc_size           val_alloc_size;
-   typedef typename Base::val_alloc_diff           val_alloc_diff;
-
-   typedef typename Base::ptr_alloc_t              ptr_alloc_t;
-   typedef typename Base::ptr_alloc_val            ptr_alloc_val;
-   typedef typename Base::ptr_alloc_ptr            ptr_alloc_ptr;
-   typedef typename Base::ptr_alloc_cptr           ptr_alloc_cptr;
-   typedef typename Base::ptr_alloc_ref            ptr_alloc_ref;
-   typedef typename Base::ptr_alloc_cref           ptr_alloc_cref;
+   typedef deque_base Base;
    /// @endcond
 
-   public:                         // Basic types
-   typedef T                                    value_type;
-   typedef val_alloc_ptr                        pointer;
-   typedef val_alloc_cptr                       const_pointer;
-   typedef val_alloc_ref                        reference;
-   typedef val_alloc_cref                       const_reference;
-   typedef val_alloc_size                       size_type;
-   typedef val_alloc_diff                       difference_type;
-   typedef typename Base::allocator_type        allocator_type;
+   public:
 
-   public:                                // Iterators
-   typedef typename Base::iterator              iterator;
-   typedef typename Base::const_iterator        const_iterator;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   typedef std::reverse_iterator const_reverse_iterator;
-   typedef std::reverse_iterator      reverse_iterator;
-
-   typedef allocator_type                       stored_allocator_type;
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(allocator_type)                                      stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator)                             iterator;
+   typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator)                       const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    /// @cond
 
    private:                      // Internal typedefs
    BOOST_COPYABLE_AND_MOVABLE(deque)
-   typedef ptr_alloc_ptr index_pointer;
-   static size_type s_buffer_size() 
+   typedef typename Base::ptr_alloc_ptr index_pointer;
+   static size_type s_buffer_size()
       { return Base::s_buffer_size(); }
-   typedef container_detail::advanced_insert_aux_int advanced_insert_aux_int_t;
-   typedef repeat_iterator  r_iterator;
-   typedef boost::move_iterator     move_it;
-   typedef allocator_traits                  allocator_traits_type;
+   typedef allocator_traits                  allocator_traits_type;
 
    /// @endcond
 
    public:
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
-   { return Base::alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return Base::alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return Base::alloc(); }
-
-   //! Effects: Returns an iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin() BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns an iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end() BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a const_iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns a const_iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
-      { return reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
-      { return reverse_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start; }
-
-   //! Effects: Returns a const_iterator to the end of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish; }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_finish); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed deque. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
-      { return const_reverse_iterator(this->members_.m_start); }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start[difference_type(n)]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_start[difference_type(n)]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n)
-      { this->priv_range_check(n); return (*this)[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n) const
-      { this->priv_range_check(n); return (*this)[n]; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front() BOOST_CONTAINER_NOEXCEPT
-      { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const BOOST_CONTAINER_NOEXCEPT
-      { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference back() BOOST_CONTAINER_NOEXCEPT
-      {  return *(end()-1); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference back() const BOOST_CONTAINER_NOEXCEPT
-      {  return *(cend()-1);  }
-
-   //! Effects: Returns the number of the elements contained in the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const BOOST_CONTAINER_NOEXCEPT
-      { return this->members_.m_finish - this->members_.m_start; }
-
-   //! Effects: Returns the largest possible size of the deque.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
-      { return allocator_traits_type::max_size(this->alloc()); }
-
-   //! Effects: Returns true if the deque contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_finish == this->members_.m_start; }
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructors a deque.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   deque() 
+   deque()
       : Base()
    {}
 
    //! Effects: Constructs a deque taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit deque(const allocator_type& a) 
+   explicit deque(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       : Base(a)
    {}
 
@@ -850,13 +600,13 @@ class deque : protected deque_base
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit deque(size_type n)
       : Base(n, allocator_type())
    {
-      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-      proxy.uninitialized_copy_remaining_to(this->begin());
+      container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+      proxy.uninitialized_copy_n_and_update(this->begin(), n);
       //deque_base will deallocate in case of exception...
    }
 
@@ -865,17 +615,38 @@ class deque : protected deque_base
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    deque(size_type n, const value_type& value,
          const allocator_type& a = allocator_type())
       : Base(n, a)
    { this->priv_fill_initialize(value); }
 
+   //! Effects: Constructs a deque that will use a copy of allocator a
+   //!   and inserts a copy of the range [first, last) in the deque.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor
+   //!   throws or T's constructor taking an dereferenced InIt throws.
+   //!
+   //! Complexity: Linear to the range [first, last).
+   template 
+   deque(InIt first, InIt last, const allocator_type& a = allocator_type()
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
+      : Base(a)
+   {
+      typedef typename std::iterator_traits::iterator_category ItCat;
+      this->priv_range_initialize(first, last, ItCat());
+   }
+
    //! Effects: Copy constructs a deque.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    deque(const deque& x)
       :  Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
@@ -890,27 +661,50 @@ class deque : protected deque_base
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   deque(BOOST_RV_REF(deque) x) 
+   deque(BOOST_RV_REF(deque) x)
       :  Base(boost::move(static_cast(x)))
    {  this->swap_members(x);   }
 
-   //! Effects: Constructs a deque that will use a copy of allocator a
-   //!   and inserts a copy of the range [first, last) in the deque.
+   //! Effects: Copy constructs a vector using the specified allocator.
    //!
-   //! Throws: If allocator_type's default constructor or copy constructor
-   //!   throws or T's constructor taking an dereferenced InIt throws.
+   //! Postcondition: x == *this.
    //!
-   //! Complexity: Linear to the range [first, last).
-   template 
-   deque(InpIt first, InpIt last, const allocator_type& a = allocator_type())
-      : Base(a) 
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   deque(const deque& x, const allocator_type &a)
+      :  Base(a)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_initialize_dispatch(first, last, Result());
+      if(x.size()){
+         this->priv_initialize_map(x.size());
+         boost::container::uninitialized_copy_alloc
+            (this->alloc(), x.begin(), x.end(), this->members_.m_start);
+      }
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
+      :  Base(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         if(mx.size()){
+            this->priv_initialize_map(mx.size());
+            boost::container::uninitialized_copy_alloc
+               (this->alloc(), mx.begin(), mx.end(), this->members_.m_start);
+         }
+      }
    }
 
    //! Effects: Destroys the deque. All stored values are destroyed
@@ -921,18 +715,18 @@ class deque : protected deque_base
    //! Complexity: Linear to the number of elements.
    ~deque() BOOST_CONTAINER_NOEXCEPT
    {
-      priv_destroy_range(this->members_.m_start, this->members_.m_finish);
+      this->priv_destroy_range(this->members_.m_start, this->members_.m_finish);
    }
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to the number of elements in x.
-   deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x) 
+   deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
    {
       if (&x != this){
          allocator_type &this_alloc     = this->alloc();
@@ -984,195 +778,385 @@ class deque : protected deque_base
       return *this;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(deque &x)
-   {
-      this->swap_members(x);
-      container_detail::bool_ flag;
-      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
-      container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
-   }
-
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
    void assign(size_type n, const T& val)
-   {  this->priv_fill_assign(n, val);  }
+   {
+      typedef constant_iterator c_it;
+      this->assign(c_it(val, n), c_it());
+   }
 
    //! Effects: Assigns the the range [first, last) to *this.
    //!
    //! Throws: If memory allocation throws or
-   //!   T's constructor from dereferencing InpIt throws.
+   //!   T's constructor from dereferencing InIt throws.
    //!
    //! Complexity: Linear to n.
-   template 
-   void assign(InpIt first, InpIt last)
+   template 
+   void assign(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
-   }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the end of the deque.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(const T &x);
-
-   //! Effects: Constructs a new element in the end of the deque
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
-   #endif
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the front of the deque.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(const T &x);
-
-   //! Effects: Constructs a new element in the front of the deque
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
-   #endif
-
-   //! Effects: Removes the last element from the deque.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant time.
-   void pop_back() BOOST_CONTAINER_NOEXCEPT
-   {
-      if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
-         --this->members_.m_finish.m_cur;
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
-            );
+      iterator cur = this->begin();
+      for ( ; first != last && cur != end(); ++cur, ++first){
+         *cur = *first;
       }
-      else
-         this->priv_pop_back_aux();
-   }
-
-   //! Effects: Removes the first element from the deque.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant time.
-   void pop_front() BOOST_CONTAINER_NOEXCEPT
-   {
-      if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
-            );
-         ++this->members_.m_start.m_cur;
-      }
-      else 
-         this->priv_pop_front_aux();
-   }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of x before position.
-   //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, const T &x);
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a new element before position with mx's resources.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
-   #endif
-
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert n copies of x before pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator pos, size_type n, const value_type& x)
-   { this->priv_fill_insert(pos, n, x); }
-
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before pos.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator pos, InpIt first, InpIt last) 
-   {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(pos, first, last, Result());
-   }
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the end of the deque.
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws.
-   //!
-   //! Complexity: Amortized constant time
-   template 
-   void emplace_back(Args&&... args)
-   {
-      if(this->priv_push_back_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc()
-            , this->priv_push_back_simple_pos()
-            , boost::forward(args)...);
-         this->priv_push_back_simple_commit();
+      if (first == last){
+         this->erase(cur, this->cend());
       }
       else{
-         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_back_aux_impl(1, proxy);
+         this->insert(this->cend(), first, last);
       }
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   void assign(FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type len = std::distance(first, last);
+      if (len > size()) {
+         FwdIt mid = first;
+         std::advance(mid, this->size());
+         boost::copy_or_move(first, mid, begin());
+         this->insert(this->cend(), mid, last);
+      }
+      else{
+         this->erase(boost::copy_or_move(first, last, this->begin()), cend());
+      }
+   }
+   #endif
+
+   //! Effects: Returns a copy of the internal allocator.
+   //!
+   //! Throws: If allocator's copy constructor throws.
+   //!
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   { return Base::alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return Base::alloc(); }
+
+   //! Effects: Returns an iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns a const_iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns an iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a const_iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return reverse_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start; }
+
+   //! Effects: Returns a const_iterator to the end of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish; }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_finish); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return const_reverse_iterator(this->members_.m_start); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the deque contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_finish == this->members_.m_start; }
+
+   //! Effects: Returns the number of the elements contained in the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_finish - this->members_.m_start; }
+
+   //! Effects: Returns the largest possible size of the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+      { return allocator_traits_type::max_size(this->alloc()); }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
+   {
+      const size_type len = size();
+      if (new_size < len)
+         this->priv_erase_last_n(len - new_size);
+      else{
+         const size_type n = new_size - this->size();
+         container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+         priv_insert_back_aux_impl(n, proxy);
+      }
+   }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const value_type& x)
+   {
+      const size_type len = size();
+      if (new_size < len)
+         this->erase(this->members_.m_start + new_size, this->members_.m_finish);
+      else
+         this->insert(this->members_.m_finish, new_size - len, x);
+   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the deque is unchanged
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Constant.
+   void shrink_to_fit()
+   {
+      //This deque implementation already
+      //deallocates excess nodes when erasing
+      //so there is nothing to do except for
+      //empty deque
+      if(this->empty()){
+         this->priv_clear_map();
+      }
+   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front() BOOST_CONTAINER_NOEXCEPT
+      { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+      { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference back() BOOST_CONTAINER_NOEXCEPT
+      {  return *(end()-1); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+      {  return *(cend()-1);  }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start[difference_type(n)]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+      { return this->members_.m_start[difference_type(n)]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   reference at(size_type n)
+      { this->priv_range_check(n); return (*this)[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const
+      { this->priv_range_check(n); return (*this)[n]; }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the beginning of the deque.
    //!
@@ -1190,9 +1174,30 @@ class deque : protected deque_base
          this->priv_push_front_simple_commit();
       }
       else{
-         typedef container_detail::advanced_insert_aux_non_movable_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_front_aux_impl(1, proxy);
+         typedef container_detail::insert_non_movable_emplace_proxy type;
+         this->priv_insert_front_aux_impl(1, type(this->alloc(), boost::forward(args)...));
+      }
+   }
+
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... in the end of the deque.
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws.
+   //!
+   //! Complexity: Amortized constant time
+   template 
+   void emplace_back(Args&&... args)
+   {
+      if(this->priv_push_back_simple_available()){
+         allocator_traits_type::construct
+            ( this->alloc()
+            , this->priv_push_back_simple_pos()
+            , boost::forward(args)...);
+         this->priv_push_back_simple_commit();
+      }
+      else{
+         typedef container_detail::insert_non_movable_emplace_proxy type;
+         this->priv_insert_back_aux_impl(1, type(this->alloc(), boost::forward(args)...));
       }
    }
 
@@ -1217,11 +1222,8 @@ class deque : protected deque_base
          return (this->end()-1);
       }
       else{
-         size_type n = p - this->cbegin();
-         typedef container_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(this->alloc(), boost::forward(args)...);
-         this->priv_insert_aux_impl(p, 1, proxy);
-         return iterator(this->begin() + n);
+         typedef container_detail::insert_emplace_proxy type;
+         return this->priv_insert_aux_impl(p, 1, type(this->alloc(), boost::forward(args)...));
       }
    }
 
@@ -1229,25 +1231,6 @@ class deque : protected deque_base
 
    //advanced_insert_int.hpp includes all necessary preprocessor machinery...
    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                     \
-   {                                                                                         \
-      if(priv_push_back_simple_available()){                                                 \
-         allocator_traits_type::construct                                                    \
-            ( this->alloc()                                                                  \
-            , this->priv_push_back_simple_pos()                                              \
-              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
-         priv_push_back_simple_commit();                                                     \
-      }                                                                                      \
-      else{                                                                                  \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(                                        \
-            advanced_insert_aux_non_movable_emplace, n), arg)                                \
-                proxy                       \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
-         priv_insert_back_aux_impl(1, proxy);                                                \
-      }                                                                                      \
-   }                                                                                         \
-                                                                                             \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >  )  \
    void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                    \
    {                                                                                         \
@@ -1259,15 +1242,32 @@ class deque : protected deque_base
          priv_push_front_simple_commit();                                                    \
       }                                                                                      \
       else{                                                                                  \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT                                         \
-            (advanced_insert_aux_non_movable_emplace, n), arg)                               \
-                proxy                       \
+         container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n)             \
+                proxy               \
             (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
          priv_insert_front_aux_impl(1, proxy);                                               \
       }                                                                                      \
    }                                                                                         \
                                                                                              \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                     \
+   {                                                                                         \
+      if(priv_push_back_simple_available()){                                                 \
+         allocator_traits_type::construct                                                    \
+            ( this->alloc()                                                                  \
+            , this->priv_push_back_simple_pos()                                              \
+              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));               \
+         priv_push_back_simple_commit();                                                     \
+      }                                                                                      \
+      else{                                                                                  \
+         container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n)             \
+                proxy               \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
+         priv_insert_back_aux_impl(1, proxy);                                                \
+      }                                                                                      \
+   }                                                                                         \
+                                                                                             \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
    iterator emplace(const_iterator p                                                         \
                     BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
    {                                                                                         \
@@ -1280,12 +1280,10 @@ class deque : protected deque_base
          return (this->end()-1);                                                             \
       }                                                                                      \
       else{                                                                                  \
-         size_type pos_num = p - this->cbegin();                                             \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)   \
-             proxy                          \
+         container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                         \
+             proxy                  \
             (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));  \
-         this->priv_insert_aux_impl(p, 1, proxy);                                            \
-         return iterator(this->begin() + pos_num);                                           \
+         return this->priv_insert_aux_impl(p, 1, proxy);                                     \
       }                                                                                      \
    }                                                                                         \
    //!
@@ -1294,44 +1292,177 @@ class deque : protected deque_base
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the front of the deque.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const value_type& x) 
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the front of the deque
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the deque.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the deque
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or pos if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator pos, size_type n, const value_type& x)
    {
-      const size_type len = size();
-      if (new_size < len) 
-         this->erase(this->members_.m_start + new_size, this->members_.m_finish);
-      else
-         this->insert(this->members_.m_finish, new_size - len, x);
+      typedef constant_iterator c_it;
+      return this->insert(pos, c_it(x, n), c_it());
    }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
+   //! Requires: pos must be a valid iterator of *this.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Effects: Insert a copy of the [first, last) range before pos.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size) 
+   //! Returns: an iterator to the first inserted element or pos if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InIt throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator pos, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      const size_type len = size();
-      if (new_size < len) 
-         this->priv_erase_last_n(len - new_size);
-      else{
-         size_type n = new_size - this->size();
-         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-         priv_insert_back_aux_impl(n, proxy);
+      size_type n = 0;
+      iterator it(pos);
+      for(;first != last; ++first, ++n){
+         it = this->emplace(it, *first);
+         ++it;
       }
+      it -= n;
+      return it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, FwdIt first, FwdIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      container_detail::insert_range_proxy proxy(this->alloc(), first);
+      return priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
+   }
+   #endif
+
+   //! Effects: Removes the first element from the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_front() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
+         allocator_traits_type::destroy
+            ( this->alloc()
+            , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
+            );
+         ++this->members_.m_start.m_cur;
+      }
+      else
+         this->priv_pop_front_aux();
+   }
+
+   //! Effects: Removes the last element from the deque.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
+         --this->members_.m_finish.m_cur;
+         allocator_traits_type::destroy
+            ( this->alloc()
+            , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
+            );
+      }
+      else
+         this->priv_pop_back_aux();
    }
 
    //! Effects: Erases the element at position pos.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
    //!   Constant if pos is the first or the last element.
@@ -1339,8 +1470,8 @@ class deque : protected deque_base
    {
       const_iterator next = pos;
       ++next;
-      difference_type index = pos - this->members_.m_start;
-      if (size_type(index) < (this->size() >> 1)) {
+      size_type index = pos - this->members_.m_start;
+      if (index < (this->size()/2)) {
          boost::move_backward(begin(), iterator(pos), iterator(next));
          pop_front();
       }
@@ -1356,7 +1487,7 @@ class deque : protected deque_base
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the distance between first and
-   //!   last plus the elements between pos and the 
+   //!   last plus the elements between pos and the
    //!   last element (if pos is near the end) or the first element
    //!   if(pos is near the beginning).
    iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
@@ -1366,9 +1497,9 @@ class deque : protected deque_base
          return this->members_.m_finish;
       }
       else {
-         difference_type n = last - first;
-         difference_type elems_before = first - this->members_.m_start;
-         if (elems_before < static_cast(this->size() - n) - elems_before) {
+         const size_type n = static_cast(last - first);
+         const size_type elems_before = static_cast(first - this->members_.m_start);
+         if (elems_before < (this->size() - n) - elems_before) {
             boost::move_backward(begin(), iterator(first), iterator(last));
             iterator new_start = this->members_.m_start + n;
             if(!Base::traits_t::trivial_dctr_after_move)
@@ -1388,18 +1519,17 @@ class deque : protected deque_base
       }
    }
 
-   void priv_erase_last_n(size_type n)
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(deque &x)
    {
-      if(n == this->size()) {
-         this->clear();
-      }
-      else {
-         iterator new_finish = this->members_.m_finish - n;
-         if(!Base::traits_t::trivial_dctr_after_move)
-            this->priv_destroy_range(new_finish, this->members_.m_finish);
-         this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
-         this->members_.m_finish = new_finish;
-      }
+      this->swap_members(x);
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+      container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
    }
 
    //! Effects: Erases all the elements of the deque.
@@ -1427,108 +1557,69 @@ class deque : protected deque_base
       this->members_.m_finish = this->members_.m_start;
    }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the deque is unchanged
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Constant.
-   void shrink_to_fit()
+   /// @cond
+   private:
+
+   void priv_erase_last_n(size_type n)
    {
-      //This deque implementation already
-      //deallocates excess nodes when erasing
-      //so there is nothing to do except for
-      //empty deque
-      if(this->empty()){
-         this->priv_clear_map();
+      if(n == this->size()) {
+         this->clear();
+      }
+      else {
+         iterator new_finish = this->members_.m_finish - n;
+         if(!Base::traits_t::trivial_dctr_after_move)
+            this->priv_destroy_range(new_finish, this->members_.m_finish);
+         this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
+         this->members_.m_finish = new_finish;
       }
    }
 
-   /// @cond
-   private:
-   void priv_range_check(size_type n) const 
+   void priv_range_check(size_type n) const
       {  if (n >= this->size())  BOOST_RETHROW std::out_of_range("deque");   }
 
-   iterator priv_insert(const_iterator position, const value_type &x) 
+   template 
+   iterator priv_insert(const_iterator position, BOOST_FWD_REF(U) x)
    {
       if (position == cbegin()){
-         this->push_front(x);
+         this->push_front(::boost::forward(x));
          return begin();
       }
       else if (position == cend()){
-         this->push_back(x);
-         return (end()-1);
+         this->push_back(::boost::forward(x));
+         return --end();
       }
       else {
-         size_type n = position - cbegin();
-         this->priv_insert_aux(position, size_type(1), x);
-         return iterator(this->begin() + n);
+         return priv_insert_aux_impl
+            (position, (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
       }
    }
 
-   iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx) 
-   {
-      if (position == cbegin()) {
-         this->push_front(boost::move(mx));
-         return begin();
-      }
-      else if (position == cend()) {
-         this->push_back(boost::move(mx));
-         return(end()-1);
-      }
-      else {
-         //Just call more general insert(pos, size, value) and return iterator
-         size_type n = position - begin();
-         this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
-         return iterator(this->begin() + n);
-      }
-   }
-
-   void priv_push_front(const value_type &t)
+   template 
+   void priv_push_front(BOOST_FWD_REF(U) x)
    {
       if(this->priv_push_front_simple_available()){
          allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_front_simple_pos(), t);
+            ( this->alloc(), this->priv_push_front_simple_pos(), ::boost::forward(x));
          this->priv_push_front_simple_commit();
       }
       else{
-         this->priv_insert_aux(cbegin(), size_type(1), t);
+         priv_insert_aux_impl
+            (this->cbegin(), (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
       }
    }
 
-   void priv_push_front(BOOST_RV_REF(value_type) t)
-   {
-      if(this->priv_push_front_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_front_simple_pos(), boost::move(t));
-         this->priv_push_front_simple_commit();
-      }
-      else{
-         this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
-      }
-   }
-
-   void priv_push_back(const value_type &t)
+   template 
+   void priv_push_back(BOOST_FWD_REF(U) x)
    {
       if(this->priv_push_back_simple_available()){
          allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_back_simple_pos(), t);
+            ( this->alloc(), this->priv_push_back_simple_pos(), ::boost::forward(x));
          this->priv_push_back_simple_commit();
       }
       else{
-         this->priv_insert_aux(cend(), size_type(1), t);
-      }
-   }
-
-   void priv_push_back(BOOST_RV_REF(T) t)
-   {
-      if(this->priv_push_back_simple_available()){
-         allocator_traits_type::construct
-            ( this->alloc(), this->priv_push_back_simple_pos(), boost::move(t));
-         this->priv_push_back_simple_commit();
-      }
-      else{
-         this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+         priv_insert_aux_impl
+            (this->cend(), (size_type)1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
+         container_detail::insert_copy_proxy proxy(this->alloc(), x);
       }
    }
 
@@ -1560,48 +1651,6 @@ class deque : protected deque_base
    void priv_push_front_simple_commit()
    {  --this->members_.m_start.m_cur;   }
 
-   template 
-   void priv_insert_aux(const_iterator pos, InpIt first, InpIt last, std::input_iterator_tag)
-   {
-      for(;first != last; ++first){
-         this->insert(pos, boost::move(value_type(*first)));
-      }
-   }
-
-   template 
-   void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag) 
-   {  this->priv_insert_aux(pos, first, last);  }
-
-  // assign(), a generalized assignment member function.  Two
-  // versions: one that takes a count, and one that takes a range.
-  // The range version is a member template, so we dispatch on whether
-  // or not the type is an integer.
-   void priv_fill_assign(size_type n, const T& val)
-   {
-      if (n > size()) {
-         std::fill(begin(), end(), val);
-         this->insert(cend(), n - size(), val);
-      }
-      else {
-         this->erase(cbegin() + n, cend());
-         std::fill(begin(), end(), val);
-      }
-   }
-
-   template 
-   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_) 
-   {
-      this->priv_initialize_map(n);
-      this->priv_fill_initialize(x);
-   }
-
-   template 
-   void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_range_initialize(first, last, ItCat());
-   }
-
    void priv_destroy_range(iterator p, iterator p2)
    {
       for(;p != p2; ++p){
@@ -1622,127 +1671,95 @@ class deque : protected deque_base
       }
    }
 
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-      { this->priv_fill_assign((size_type) n, (value_type)val); }
-
-   template 
-   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_assign_aux(first, last, ItCat());
-   }
-
-   template 
-   void priv_assign_aux(InpIt first, InpIt last, std::input_iterator_tag)
-   {
-      iterator cur = begin();
-      for ( ; first != last && cur != end(); ++cur, ++first)
-         *cur = *first;
-      if (first == last)
-         this->erase(cur, cend());
-      else
-         this->insert(cend(), first, last);
-   }
-
-   template 
-   void priv_assign_aux(FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      size_type len = std::distance(first, last);
-      if (len > size()) {
-         FwdIt mid = first;
-         std::advance(mid, size());
-         boost::copy_or_move(first, mid, begin());
-         this->insert(cend(), mid, last);
-      }
-      else
-         this->erase(boost::copy_or_move(first, last, begin()), cend());
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_) 
-   {  this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_insert_aux(pos, first, last, ItCat());
-   }
-
-   void priv_insert_aux(const_iterator pos, size_type n, const value_type& x)
-   {
-      typedef constant_iterator c_it;
-      this->priv_insert_aux(pos, c_it(x, n), c_it());
-   }
-
-   //Just forward all operations to priv_insert_aux_impl
-   template 
-   void priv_insert_aux(const_iterator p, FwdIt first, FwdIt last)
-   {
-      container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
-      priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
-   }
-
-   void priv_insert_aux_impl(const_iterator p, size_type n, advanced_insert_aux_int_t &interf)
+   template
+   iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy interf)
    {
       iterator pos(p);
+      const size_type pos_n = p - this->cbegin();
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
          pos = this->begin();
       }
 
-      const difference_type elemsbefore = pos - this->members_.m_start;
-      size_type length = this->size();
-      if (elemsbefore < static_cast(length / 2)) {
-         iterator new_start = this->priv_reserve_elements_at_front(n);
-         iterator old_start = this->members_.m_start;
-         pos = this->members_.m_start + elemsbefore;
-         if (elemsbefore >= difference_type(n)) {
-            iterator start_n = this->members_.m_start + difference_type(n); 
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), this->members_.m_start, start_n, new_start);
+      const size_type elemsbefore = static_cast(pos - this->members_.m_start);
+      const size_type length = this->size();
+      if (elemsbefore < length / 2) {
+         const iterator new_start = this->priv_reserve_elements_at_front(n);
+         const iterator old_start = this->members_.m_start;
+         if(!elemsbefore){
+            interf.uninitialized_copy_n_and_update(new_start, n);
             this->members_.m_start = new_start;
-            boost::move(start_n, pos, old_start);
-            interf.copy_remaining_to(pos - difference_type(n));
          }
-         else {
-            difference_type mid_count = (difference_type(n) - elemsbefore);
-            iterator mid_start = old_start - mid_count;
-            interf.uninitialized_copy_some_and_update(mid_start, mid_count, true);
-            this->members_.m_start = mid_start;
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), old_start, pos, new_start);
-            this->members_.m_start = new_start;
-            interf.copy_remaining_to(old_start);
+         else{
+            pos = this->members_.m_start + elemsbefore;
+            if (elemsbefore >= n) {
+               const iterator start_n = this->members_.m_start + n;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), this->members_.m_start, start_n, new_start);
+               this->members_.m_start = new_start;
+               boost::move(start_n, pos, old_start);
+               interf.copy_n_and_update(pos - n, n);
+            }
+            else {
+               const size_type mid_count = n - elemsbefore;
+               const iterator mid_start = old_start - mid_count;
+               interf.uninitialized_copy_n_and_update(mid_start, mid_count);
+               this->members_.m_start = mid_start;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), old_start, pos, new_start);
+               this->members_.m_start = new_start;
+               interf.copy_n_and_update(old_start, elemsbefore);
+            }
          }
       }
       else {
-         iterator new_finish = this->priv_reserve_elements_at_back(n);
-         iterator old_finish = this->members_.m_finish;
-         const difference_type elemsafter = 
-            difference_type(length) - elemsbefore;
-         pos = this->members_.m_finish - elemsafter;
-         if (elemsafter >= difference_type(n)) {
-            iterator finish_n = this->members_.m_finish - difference_type(n);
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
+         const iterator new_finish = this->priv_reserve_elements_at_back(n);
+         const iterator old_finish = this->members_.m_finish;
+         const size_type elemsafter = length - elemsbefore;
+         if(!elemsafter){
+            interf.uninitialized_copy_n_and_update(old_finish, n);
             this->members_.m_finish = new_finish;
-            boost::move_backward(pos, finish_n, old_finish);
-            interf.copy_remaining_to(pos);
          }
-         else {
-            interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
-            this->members_.m_finish += n-elemsafter;
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, old_finish, this->members_.m_finish);
-            this->members_.m_finish = new_finish;
-            interf.copy_remaining_to(pos);
+         else{
+            pos = this->members_.m_finish - elemsafter;
+            if (elemsafter >= n) {
+               iterator finish_n = this->members_.m_finish - difference_type(n);
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), finish_n, this->members_.m_finish, this->members_.m_finish);
+               this->members_.m_finish = new_finish;
+               boost::move_backward(pos, finish_n, old_finish);
+               interf.copy_n_and_update(pos, n);
+            }
+            else {
+               const size_type raw_gap = n - elemsafter;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, this->members_.m_finish + raw_gap);
+               BOOST_TRY{
+                  interf.uninitialized_copy_n_and_update(old_finish, raw_gap);
+               }
+               BOOST_CATCH(...){
+                  this->priv_destroy_range(this->members_.m_finish, this->members_.m_finish + (old_finish - pos));
+                  BOOST_RETHROW
+               }
+               BOOST_CATCH_END
+               this->members_.m_finish = new_finish;
+               interf.copy_n_and_update(pos, elemsafter);
+   /*
+               interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
+               this->members_.m_finish += n-elemsafter;
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, this->members_.m_finish);
+               this->members_.m_finish = new_finish;
+               interf.copy_remaining_to(pos);
+   */
+            }
          }
       }
+      return this->begin() + pos_n;
    }
 
-   void priv_insert_back_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_insert_back_aux_impl(size_type n, InsertProxy interf)
    {
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
@@ -1750,31 +1767,33 @@ class deque : protected deque_base
 
       iterator new_finish = this->priv_reserve_elements_at_back(n);
       iterator old_finish = this->members_.m_finish;
-      interf.uninitialized_copy_some_and_update(old_finish, n, true);
+      interf.uninitialized_copy_n_and_update(old_finish, n);
       this->members_.m_finish = new_finish;
+      return iterator(this->members_.m_finish - n);
    }
 
-   void priv_insert_front_aux_impl(size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_insert_front_aux_impl(size_type n, InsertProxy interf)
    {
       if(!this->members_.m_map){
          this->priv_initialize_map(0);
       }
 
       iterator new_start = this->priv_reserve_elements_at_front(n);
-      interf.uninitialized_copy_some_and_update(new_start, difference_type(n), true);
+      interf.uninitialized_copy_n_and_update(new_start, n);
       this->members_.m_start = new_start;
+      return new_start;
    }
 
-
-   void priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
+   iterator priv_fill_insert(const_iterator pos, size_type n, const value_type& x)
    {
       typedef constant_iterator c_it;
-      this->insert(pos, c_it(x, n), c_it());
+      return this->insert(pos, c_it(x, n), c_it());
    }
 
    // Precondition: this->members_.m_start and this->members_.m_finish have already been initialized,
    // but none of the deque's elements have yet been constructed.
-   void priv_fill_initialize(const value_type& value) 
+   void priv_fill_initialize(const value_type& value)
    {
       index_pointer cur;
       BOOST_TRY {
@@ -1792,13 +1811,13 @@ class deque : protected deque_base
       BOOST_CATCH_END
    }
 
-   template 
-   void priv_range_initialize(InpIt first, InpIt last, std::input_iterator_tag)
+   template 
+   void priv_range_initialize(InIt first, InIt last, std::input_iterator_tag)
    {
       this->priv_initialize_map(0);
       BOOST_TRY {
          for ( ; first != last; ++first)
-            this->push_back(*first);
+            this->emplace_back(*first);
       }
       BOOST_CATCH(...){
          this->clear();
@@ -1816,8 +1835,8 @@ class deque : protected deque_base
 
       index_pointer cur_node;
       BOOST_TRY {
-         for (cur_node = this->members_.m_start.m_node; 
-               cur_node < this->members_.m_finish.m_node; 
+         for (cur_node = this->members_.m_start.m_node;
+               cur_node < this->members_.m_finish.m_node;
                ++cur_node) {
             FwdIt mid = first;
             std::advance(mid, this->s_buffer_size());
@@ -1847,9 +1866,9 @@ class deque : protected deque_base
          );
    }
 
-   // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1.  Note that 
-   // if the deque has at least one element (a precondition for this member 
-   // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque 
+   // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1.  Note that
+   // if the deque has at least one element (a precondition for this member
+   // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
    // must have at least two nodes.
    void priv_pop_front_aux()
    {
@@ -1860,14 +1879,14 @@ class deque : protected deque_base
       this->priv_deallocate_node(this->members_.m_start.m_first);
       this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
       this->members_.m_start.m_cur = this->members_.m_start.m_first;
-   }      
+   }     
 
-   iterator priv_reserve_elements_at_front(size_type n) 
+   iterator priv_reserve_elements_at_front(size_type n)
    {
       size_type vacancies = this->members_.m_start.m_cur - this->members_.m_start.m_first;
       if (n > vacancies){
          size_type new_elems = n-vacancies;
-         size_type new_nodes = (new_elems + this->s_buffer_size() - 1) / 
+         size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
             this->s_buffer_size();
          size_type s = (size_type)(this->members_.m_start.m_node - this->members_.m_map);
          if (new_nodes > s){
@@ -1880,7 +1899,7 @@ class deque : protected deque_base
          }
          BOOST_CATCH(...) {
             for (size_type j = 1; j < i; ++j)
-               this->priv_deallocate_node(*(this->members_.m_start.m_node - j));      
+               this->priv_deallocate_node(*(this->members_.m_start.m_node - j));     
             BOOST_RETHROW
          }
          BOOST_CATCH_END
@@ -1888,7 +1907,7 @@ class deque : protected deque_base
       return this->members_.m_start - difference_type(n);
    }
 
-   iterator priv_reserve_elements_at_back(size_type n) 
+   iterator priv_reserve_elements_at_back(size_type n)
    {
       size_type vacancies = (this->members_.m_finish.m_last - this->members_.m_finish.m_cur) - 1;
       if (n > vacancies){
@@ -1905,7 +1924,7 @@ class deque : protected deque_base
          }
          BOOST_CATCH(...) {
             for (size_type j = 1; j < i; ++j)
-               this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));      
+               this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));     
             BOOST_RETHROW
          }
          BOOST_CATCH_END
@@ -1920,7 +1939,7 @@ class deque : protected deque_base
 
       index_pointer new_nstart;
       if (this->members_.m_map_size > 2 * new_num_nodes) {
-         new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2 
+         new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
                            + (add_at_front ? nodes_to_add : 0);
          if (new_nstart < this->members_.m_start.m_node)
             boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
@@ -1929,7 +1948,7 @@ class deque : protected deque_base
                (this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
       }
       else {
-         size_type new_map_size = 
+         size_type new_map_size =
             this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
 
          index_pointer new_map = this->priv_allocate_map(new_map_size);
@@ -1949,43 +1968,36 @@ class deque : protected deque_base
 };
 
 // Nonmember functions.
-template 
-inline bool operator==(const deque& x,
-                       const deque& y)
+template 
+inline bool operator==(const deque& x, const deque& y)
 {
    return x.size() == y.size() && equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool operator<(const deque& x,
-                      const deque& y) 
+template 
+inline bool operator<(const deque& x, const deque& y)
 {
    return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline bool operator!=(const deque& x,
-                       const deque& y) 
+template 
+inline bool operator!=(const deque& x, const deque& y)
    {  return !(x == y);   }
 
-template 
-inline bool operator>(const deque& x,
-                      const deque& y) 
+template 
+inline bool operator>(const deque& x, const deque& y)
    {  return y < x; }
 
-template 
-inline bool operator<=(const deque& x,
-                       const deque& y) 
-   {  return !(y < x); }
-
-template 
-inline bool operator>=(const deque& x,
-                       const deque& y) 
+template 
+inline bool operator>=(const deque& x, const deque& y)
    {  return !(x < y); }
 
+template 
+inline bool operator<=(const deque& x, const deque& y)
+   {  return !(y < x); }
 
-template 
-inline void swap(deque& x, deque& y)
+template 
+inline void swap(deque& x, deque& y)
 {  x.swap(y);  }
 
 }}
@@ -1993,15 +2005,14 @@ inline void swap(deque& x, deque& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   enum {   value = has_trivial_destructor::value  };
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 }
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp b/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
index 36495795f..42bdf4339 100644
--- a/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
+++ b/project/jni/boost/include/boost/container/detail/adaptive_node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -21,16 +21,28 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace boost {
 namespace container {
+
+namespace adaptive_pool_flag {
+
+static const unsigned int none            = 0u;
+static const unsigned int align_only      = 1u << 0u;
+static const unsigned int size_ordered    = 1u << 1u;
+static const unsigned int address_ordered = 1u << 2u;
+
+}  //namespace adaptive_pool_flag{
+
 namespace container_detail {
 
 template
@@ -42,42 +54,160 @@ struct hdr_offset_holder_t
    size_type hdr_offset;
 };
 
+template
+struct less_func;
+
+template
+struct less_func
+{
+   static bool less(SizeType, SizeType, const void *, const void *)
+   {  return true;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType ls, SizeType rs, const void *, const void *)
+   {  return ls < rs;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType, SizeType, const void *la, const void *ra)
+   {  return &la < &ra;   }
+};
+
+template
+struct less_func
+{
+   static bool less(SizeType ls, SizeType rs, const void *la, const void *ra)
+   {  return (ls < rs) || ((ls == rs) && (la < ra));  }
+};
+
+template
+struct block_container_traits
+{
+   typedef typename bi::make_set_base_hook
+      < bi::void_pointer
+      , bi::optimize_size
+      , bi::link_mode >::type hook_t;
+
+   template
+   struct container
+   {
+      typedef typename bi::make_multiset
+         , bi::size_type >::type  type;
+   };
+
+   template
+   static void reinsert_was_used(Container &container, typename Container::reference v, bool)
+   {
+      typedef typename Container::const_iterator const_block_iterator;
+      const const_block_iterator this_block
+         (Container::s_iterator_to(const_cast(v)));
+      const_block_iterator next_block(this_block);
+      if(++next_block != container.cend()){
+         if(this_block->free_nodes.size() > next_block->free_nodes.size()){
+            container.erase(this_block);
+            container.insert(v);
+         }
+      }
+   }
+
+   template
+   static void insert_was_empty(Container &container, typename Container::value_type &v, bool)
+   {
+      container.insert(v);
+   }
+
+   template
+   static void erase_first(Container &container)
+   {
+      container.erase(container.cbegin());
+   }
+
+   template
+   static void erase_last(Container &container)
+   {
+      container.erase(--container.cend());
+   }
+};
+
 template
+struct block_container_traits
+{
+   typedef typename bi::make_list_base_hook
+      < bi::void_pointer
+      , bi::link_mode >::type hook_t;
+
+   template
+   struct container
+   {
+      typedef typename bi::make_list
+         , bi::size_type, bi::constant_time_size >::type  type;
+   };
+
+   template
+   static void reinsert_was_used(Container &container, typename Container::value_type &v, bool is_full)
+   {
+      if(is_full){
+         container.erase(Container::s_iterator_to(v));
+         container.push_back(v);
+      }
+   }
+
+   template
+   static void insert_was_empty(Container &container, typename Container::value_type &v, bool is_full)
+   {
+      if(is_full){
+         container.push_back(v);
+      }
+      else{
+         container.push_front(v);
+      }
+   }
+
+   template
+   static void erase_first(Container &container)
+   {
+      container.pop_front();
+   }
+
+   template
+   static void erase_last(Container &container)
+   {
+      container.pop_back();
+   }
+};
+
+template
 struct adaptive_pool_types
 {
    typedef VoidPointer void_pointer;
-   typedef typename bi::make_set_base_hook
-      < bi::void_pointer
-      , bi::optimize_size
-      , bi::constant_time_size
-      , bi::link_mode >::type multiset_hook_t;
-   
+   static const bool ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered)) != 0;
+   typedef block_container_traits block_container_traits_t;
+   typedef typename block_container_traits_t::hook_t hook_t;
    typedef hdr_offset_holder_t hdr_offset_holder;
+   static const unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered);
+   typedef MultiallocationChain free_nodes_t;
 
    struct block_info_t
-      :  
-         public hdr_offset_holder,
-         public multiset_hook_t
+      : public hdr_offset_holder,
+        public hook_t
    {
-      typedef typename node_slist::node_slist_t free_nodes_t;
       //An intrusive list of free node from this block
       free_nodes_t free_nodes;
       friend bool operator <(const block_info_t &l, const block_info_t &r)
       {
-//      {  return l.free_nodes.size() < r.free_nodes.size();   }
-         //Let's order blocks first by free nodes and then by address
-         //so that highest address fully free blocks are deallocated.
-         //This improves returning memory to the OS (trimming).
-         const bool is_less  = l.free_nodes.size() < r.free_nodes.size();
-         const bool is_equal = l.free_nodes.size() == r.free_nodes.size();
-         return is_less || (is_equal && (&l < &r));
+         return less_func::
+            less(l.free_nodes.size(), r.free_nodes.size(), &l , &r);
       }
 
       friend bool operator ==(const block_info_t &l, const block_info_t &r)
       {  return &l == &r;  }
    };
-   typedef typename bi::make_multiset
-       >::type  block_multiset_t;
+   typedef typename block_container_traits_t:: template container::type  block_container_t;
 };
 
 template
@@ -89,7 +219,7 @@ inline size_type calculate_alignment
    const size_type divisor  = overhead_percent*real_node_size;
    const size_type dividend = hdr_offset_size*100;
    size_type elements_per_subblock = (dividend - 1)/divisor + 1;
-   size_type candidate_power_of_2 = 
+   size_type candidate_power_of_2 =
       upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size);
    bool overhead_satisfied = false;
    //Now calculate the wors-case overhead for a subblock
@@ -113,9 +243,9 @@ inline void calculate_num_subblocks
    , size_type &num_subblocks, size_type &real_num_node, size_type overhead_percent
    , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
 {
+   const size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
    size_type elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
    size_type possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
-   size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
    while(((possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements) < elements_per_block){
       ++possible_num_subblock;
    }
@@ -135,7 +265,7 @@ inline void calculate_num_subblocks
    real_num_node = (possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements;
 }
 
-template
+template
 class private_adaptive_node_pool_impl
 {
    //Non-copyable
@@ -147,27 +277,42 @@ class private_adaptive_node_pool_impl
    typedef typename SegmentManagerBase::void_pointer void_pointer;
    static const typename SegmentManagerBase::
       size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
+   //Flags
+   //align_only
+   static const bool AlignOnly      = (Flags & adaptive_pool_flag::align_only) != 0;
    typedef bool_            IsAlignOnly;
    typedef true_                       AlignOnlyTrue;
    typedef false_                      AlignOnlyFalse;
+   //size_ordered
+   static const bool SizeOrdered    = (Flags & adaptive_pool_flag::size_ordered) != 0;
+   typedef bool_          IsSizeOrdered;
+   typedef true_                       SizeOrderedTrue;
+   typedef false_                      SizeOrderedFalse;
+   //address_ordered
+   static const bool AddressOrdered = (Flags & adaptive_pool_flag::address_ordered) != 0;
+   typedef bool_       IsAddressOrdered;
+   typedef true_                       AddressOrderedTrue;
+   typedef false_                      AddressOrderedFalse;
 
    public:
-   typedef typename node_slist::node_t node_t;
-   typedef typename node_slist::node_slist_t free_nodes_t;
-   typedef typename SegmentManagerBase::multiallocation_chain     multiallocation_chain;
-   typedef typename SegmentManagerBase::size_type                 size_type;
+   typedef typename SegmentManagerBase::multiallocation_chain        multiallocation_chain;
+   typedef typename SegmentManagerBase::size_type                    size_type;
 
    private:
-   typedef typename adaptive_pool_types::block_info_t      block_info_t;
-   typedef typename adaptive_pool_types::block_multiset_t  block_multiset_t;
-   typedef typename block_multiset_t::iterator                                      block_iterator;
-   typedef typename adaptive_pool_types::hdr_offset_holder hdr_offset_holder;
+   typedef adaptive_pool_types
+              adaptive_pool_types_t;
+   typedef typename adaptive_pool_types_t::free_nodes_t              free_nodes_t;
+   typedef typename adaptive_pool_types_t::block_info_t              block_info_t;
+   typedef typename adaptive_pool_types_t::block_container_t         block_container_t;
+   typedef typename adaptive_pool_types_t::block_container_traits_t  block_container_traits_t;
+   typedef typename block_container_t::iterator                      block_iterator;
+   typedef typename block_container_t::const_iterator                const_block_iterator;
+   typedef typename adaptive_pool_types_t::hdr_offset_holder         hdr_offset_holder;
 
-   static const size_type MaxAlign = alignment_of::value;
+   static const size_type MaxAlign = alignment_of::value;
    static const size_type HdrSize  = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
    static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
 
-
    public:
    //!Segment manager typedef
    typedef SegmentManagerBase                 segment_manager_base_type;
@@ -181,7 +326,7 @@ class private_adaptive_node_pool_impl
       , unsigned char overhead_percent
       )
    :  m_max_free_blocks(max_free_blocks)
-   ,  m_real_node_size(lcm(node_size, size_type(alignment_of::value)))
+   ,  m_real_node_size(lcm(node_size, size_type(alignment_of::value)))
       //Round the size to a power of two value.
       //This is the total memory size (including payload) that we want to
       //allocate from the general-purpose allocator
@@ -195,7 +340,7 @@ class private_adaptive_node_pool_impl
    ,  m_real_num_node(AlignOnly ? (m_real_block_alignment - PayloadPerAllocation - HdrSize)/m_real_node_size : 0)
       //General purpose allocator
    ,  mp_segment_mngr_base(segment_mngr_base)
-   ,  m_block_multiset()
+   ,  m_block_container()
    ,  m_totally_free_blocks(0)
    {
       if(!AlignOnly){
@@ -214,7 +359,7 @@ class private_adaptive_node_pool_impl
 
    //!Destructor. Deallocates all allocated blocks. Never throws
    ~private_adaptive_node_pool_impl()
-   {  priv_clear();  }
+   {  this->priv_clear();  }
 
    size_type get_real_num_node() const
    {  return m_real_num_node; }
@@ -226,84 +371,157 @@ class private_adaptive_node_pool_impl
    //!Allocates array of count elements. Can throw
    void *allocate_node()
    {
-      priv_invariants();
+      this->priv_invariants();
       //If there are no free nodes we allocate a new block
-      if (m_block_multiset.empty()){ 
-         priv_alloc_block(1);
+      if(!m_block_container.empty()){
+         //We take the first free node the multiset can't be empty
+         free_nodes_t &free_nodes = m_block_container.begin()->free_nodes;
+         BOOST_ASSERT(!free_nodes.empty());
+         const size_type free_nodes_count = free_nodes.size();
+         void *first_node = container_detail::to_raw_pointer(free_nodes.pop_front());
+         if(free_nodes.empty()){
+            block_container_traits_t::erase_first(m_block_container);
+         }
+         m_totally_free_blocks -= static_cast(free_nodes_count == m_real_num_node);
+         this->priv_invariants();
+         return first_node;
+      }
+      else{
+         multiallocation_chain chain;
+         this->priv_append_from_new_blocks(1, chain, IsAlignOnly());
+         return container_detail::to_raw_pointer(chain.pop_front());
       }
-      //We take the first free node the multiset can't be empty
-      return priv_take_first_node();
    }
 
    //!Deallocates an array pointed by ptr. Never throws
    void deallocate_node(void *pElem)
    {
-      multiallocation_chain chain;
-      chain.push_front(void_pointer(pElem));
-      this->priv_reinsert_nodes_in_block(chain, 1);
-      //Update free block count<
-      if(m_totally_free_blocks > m_max_free_blocks){
-         this->priv_deallocate_free_blocks(m_max_free_blocks);
-      }
-      priv_invariants();
+      this->priv_invariants();
+      block_info_t &block_info = *this->priv_block_from_node(pElem);
+      BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node);
+
+      //We put the node at the beginning of the free node list
+      block_info.free_nodes.push_back(void_pointer(pElem));
+
+      //The loop reinserts all blocks except the last one
+      this->priv_reinsert_block(block_info, block_info.free_nodes.size() == 1);
+      this->priv_deallocate_free_blocks(m_max_free_blocks);
+      this->priv_invariants();
    }
 
-   //!Allocates n nodes. 
+   //!Allocates n nodes.
    //!Can throw
-   multiallocation_chain allocate_nodes(const size_type n)
+   void allocate_nodes(const size_type n, multiallocation_chain &chain)
    {
-      multiallocation_chain chain;
       size_type i = 0;
-      try{
-         priv_invariants();
+      BOOST_TRY{
+         this->priv_invariants();
          while(i != n){
             //If there are no free nodes we allocate all needed blocks
-            if (m_block_multiset.empty()){
-               priv_alloc_block(((n - i) - 1)/m_real_num_node + 1);
+            if (m_block_container.empty()){
+               this->priv_append_from_new_blocks(n - i, chain, IsAlignOnly());
+               BOOST_ASSERT(m_block_container.empty() || (++m_block_container.cbegin() == m_block_container.cend()));
+               BOOST_ASSERT(chain.size() == n);
+               break;
             }
-            free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
+            free_nodes_t &free_nodes = m_block_container.begin()->free_nodes;
             const size_type free_nodes_count_before = free_nodes.size();
-            if(free_nodes_count_before == m_real_num_node){
-               --m_totally_free_blocks;
-            }
-            const size_type num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
-            for(size_type j = 0; j != num_elems; ++j){
-               void *new_node = &free_nodes.front();
-               free_nodes.pop_front();
-               chain.push_back(new_node);
-            }
+            m_totally_free_blocks -= static_cast(free_nodes_count_before == m_real_num_node);
+            const size_type num_left  = n-i;
+            const size_type num_elems = (num_left < free_nodes_count_before) ? num_left : free_nodes_count_before;
+            typedef typename free_nodes_t::iterator free_nodes_iterator;
 
-            if(free_nodes.empty()){
-               m_block_multiset.erase(m_block_multiset.begin());
+            if(num_left < free_nodes_count_before){
+               const free_nodes_iterator it_bbeg(free_nodes.before_begin());
+               free_nodes_iterator it_bend(it_bbeg);
+               for(size_type j = 0; j != num_elems; ++j){
+                  ++it_bend;
+               }
+               free_nodes_iterator it_end = it_bend; ++it_end;
+               free_nodes_iterator it_beg = it_bbeg; ++it_beg;
+               free_nodes.erase_after(it_bbeg, it_end, num_elems);
+               chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems);
+               //chain.splice_after(chain.last(), free_nodes, it_bbeg, it_bend, num_elems);
+               BOOST_ASSERT(!free_nodes.empty());
+            }
+            else{
+               const free_nodes_iterator it_beg(free_nodes.begin()), it_bend(free_nodes.last());
+               free_nodes.clear();
+               chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems);
+               block_container_traits_t::erase_first(m_block_container);
             }
             i += num_elems;
          }
       }
-      catch(...){
-         this->deallocate_nodes(boost::move(chain));
-         throw;
+      BOOST_CATCH(...){
+         this->deallocate_nodes(chain);
+         BOOST_RETHROW
       }
-      priv_invariants();
-      return boost::move(chain);
+      BOOST_CATCH_END
+      this->priv_invariants();
    }
 
    //!Deallocates a linked list of nodes. Never throws
-   void deallocate_nodes(multiallocation_chain nodes)
+   void deallocate_nodes(multiallocation_chain &nodes)
    {
-      this->priv_reinsert_nodes_in_block(nodes, nodes.size());
-      if(m_totally_free_blocks > m_max_free_blocks){
+      this->priv_invariants();
+      //To take advantage of node locality, wait until two
+      //nodes belong to different blocks. Only then reinsert
+      //the block of the first node in the block tree.
+      //Cache of the previous block
+      block_info_t *prev_block_info = 0;
+
+      //If block was empty before this call, it's not already
+      //inserted in the block tree.
+      bool prev_block_was_empty     = false;
+      typedef typename free_nodes_t::iterator free_nodes_iterator;
+      {
+         const free_nodes_iterator itbb(nodes.before_begin()), ite(nodes.end());
+         free_nodes_iterator itf(nodes.begin()), itbf(itbb);
+         size_type splice_node_count = size_type(-1);
+         while(itf != ite){
+            void *pElem = container_detail::to_raw_pointer(&*itf);
+            block_info_t &block_info = *this->priv_block_from_node(pElem);
+            BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node);
+            ++splice_node_count;
+
+            //If block change is detected calculate the cached block position in the tree
+            if(&block_info != prev_block_info){
+               if(prev_block_info){ //Make sure we skip the initial "dummy" cache
+                  free_nodes_iterator it(itbb); ++it;
+                  nodes.erase_after(itbb, itf, splice_node_count);
+                  prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*it, &*itbf, splice_node_count);
+                  this->priv_reinsert_block(*prev_block_info, prev_block_was_empty);
+                  splice_node_count = 0;
+               }
+               //Update cache with new data
+               prev_block_was_empty = block_info.free_nodes.empty();
+               prev_block_info = &block_info;
+            }
+            itbf = itf;
+            ++itf;
+         }
+      }
+      if(prev_block_info){
+         //The loop reinserts all blocks except the last one
+         const free_nodes_iterator itfirst(nodes.begin()), itlast(nodes.last());
+         const size_type splice_node_count = nodes.size();
+         nodes.clear();
+         prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*itfirst, &*itlast, splice_node_count);
+         this->priv_reinsert_block(*prev_block_info, prev_block_was_empty);
+         this->priv_invariants();
          this->priv_deallocate_free_blocks(m_max_free_blocks);
       }
    }
 
    void deallocate_free_blocks()
-   {  this->priv_deallocate_free_blocks(0);   }
+   {  this->priv_deallocate_free_blocks(0);  }
 
    size_type num_free_nodes()
    {
-      typedef typename block_multiset_t::const_iterator citerator;
+      typedef typename block_container_t::const_iterator citerator;
       size_type count = 0;
-      citerator it (m_block_multiset.begin()), itend(m_block_multiset.end());
+      citerator it (m_block_container.begin()), itend(m_block_container.end());
       for(; it != itend; ++it){
          count += it->free_nodes.size();
       }
@@ -318,7 +536,7 @@ class private_adaptive_node_pool_impl
       BOOST_ASSERT(m_real_num_node == other.m_real_num_node);
       std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
       std::swap(m_totally_free_blocks, other.m_totally_free_blocks);
-      m_block_multiset.swap(other.m_block_multiset);
+      m_block_container.swap(other.m_block_container);
    }
 
    //Deprecated, use deallocate_free_blocks
@@ -326,84 +544,54 @@ class private_adaptive_node_pool_impl
    {  this->priv_deallocate_free_blocks(0);   }
 
    private:
+
    void priv_deallocate_free_blocks(size_type max_free_blocks)
+   {  //Trampoline function to ease inlining
+      if(m_totally_free_blocks > max_free_blocks){
+         this->priv_deallocate_free_blocks_impl(max_free_blocks);
+      }
+   }
+
+   void priv_deallocate_free_blocks_impl(size_type max_free_blocks)
    {
-      priv_invariants();
+      this->priv_invariants();
       //Now check if we've reached the free nodes limit
       //and check if we have free blocks. If so, deallocate as much
       //as we can to stay below the limit
-      for( block_iterator itend = m_block_multiset.end()
-         ; m_totally_free_blocks > max_free_blocks
-         ; --m_totally_free_blocks
-         ){
-         BOOST_ASSERT(!m_block_multiset.empty());
-         block_iterator it = itend;
+      multiallocation_chain chain;
+      {
+         const const_block_iterator itend = m_block_container.cend();
+         const_block_iterator it = itend;
          --it;
-         BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
-         m_block_multiset.erase_and_dispose(it, block_destroyer(this));
+         size_type totally_free_blocks = m_totally_free_blocks;
+
+         for( ; totally_free_blocks > max_free_blocks; --totally_free_blocks){
+            BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
+            void *addr = priv_first_subblock_from_block(const_cast(&*it));
+            --it;
+            block_container_traits_t::erase_last(m_block_container);
+            chain.push_front(void_pointer(addr));
+         }
+         BOOST_ASSERT((m_totally_free_blocks - max_free_blocks) == chain.size());
+         m_totally_free_blocks = max_free_blocks;
       }
+      this->mp_segment_mngr_base->deallocate_many(chain);
    }
 
-   void priv_reinsert_nodes_in_block(multiallocation_chain &chain, size_type n)
+   void priv_reinsert_block(block_info_t &prev_block_info, const bool prev_block_was_empty)
    {
-      block_iterator block_it(m_block_multiset.end());
-      while(n--){
-         void *pElem = container_detail::to_raw_pointer(chain.front());
-         chain.pop_front();
-         priv_invariants();
-         block_info_t *block_info = this->priv_block_from_node(pElem);
-         BOOST_ASSERT(block_info->free_nodes.size() < m_real_num_node);
-         //We put the node at the beginning of the free node list
-         node_t * to_deallocate = static_cast(pElem);
-         block_info->free_nodes.push_front(*to_deallocate);
+      //Cache the free nodes from the block
+      const size_type this_block_free_nodes = prev_block_info.free_nodes.size();
+      const bool is_full = this_block_free_nodes == m_real_num_node;
 
-         block_iterator this_block(block_multiset_t::s_iterator_to(*block_info));
-         block_iterator next_block(this_block);
-         ++next_block;
-
-         //Cache the free nodes from the block
-         size_type this_block_free_nodes = this_block->free_nodes.size();
-
-         if(this_block_free_nodes == 1){
-            m_block_multiset.insert(m_block_multiset.begin(), *block_info);
-         }
-         else{
-            block_iterator next_block(this_block);
-            ++next_block;
-            if(next_block != block_it){
-               size_type next_free_nodes = next_block->free_nodes.size();
-               if(this_block_free_nodes > next_free_nodes){
-                  //Now move the block to the new position
-                  m_block_multiset.erase(this_block);
-                  m_block_multiset.insert(*block_info);
-               }
-            }
-         }
-         //Update free block count
-         if(this_block_free_nodes == m_real_num_node){
-            ++m_totally_free_blocks;
-         }
-         priv_invariants();
+      //Update free block count
+      m_totally_free_blocks += static_cast(is_full);
+      if(prev_block_was_empty){
+         block_container_traits_t::insert_was_empty(m_block_container, prev_block_info, is_full);
       }
-   }
-
-   node_t *priv_take_first_node()
-   {
-      BOOST_ASSERT(m_block_multiset.begin() != m_block_multiset.end());
-      //We take the first free node the multiset can't be empty
-      free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
-      node_t *first_node = &free_nodes.front();
-      const size_type free_nodes_count = free_nodes.size();
-      BOOST_ASSERT(0 != free_nodes_count);
-      free_nodes.pop_front();
-      if(free_nodes_count == 1){
-         m_block_multiset.erase(m_block_multiset.begin());
+      else{
+         block_container_traits_t::reinsert_was_used(m_block_container, prev_block_info, is_full);
       }
-      else if(free_nodes_count == m_real_num_node){
-         --m_totally_free_blocks;
-      }
-      priv_invariants();
-      return first_node;
    }
 
    class block_destroyer;
@@ -412,33 +600,31 @@ class private_adaptive_node_pool_impl
    class block_destroyer
    {
       public:
-      block_destroyer(const this_type *impl)
-         :  mp_impl(impl)
+      block_destroyer(const this_type *impl, multiallocation_chain &chain)
+         :  mp_impl(impl), m_chain(chain)
       {}
 
-      void operator()(typename block_multiset_t::pointer to_deallocate)
+      void operator()(typename block_container_t::pointer to_deallocate)
       {  return this->do_destroy(to_deallocate, IsAlignOnly()); }
 
       private:
-      void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyTrue)
+      void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyTrue)
       {
-         size_type free_nodes = to_deallocate->free_nodes.size();
-         (void)free_nodes;
-         BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
-         mp_impl->mp_segment_mngr_base->deallocate(to_deallocate);
+         BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node);
+         m_chain.push_back(to_deallocate);
       }
 
-      void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyFalse)
+      void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyFalse)
       {
-         size_type free_nodes = to_deallocate->free_nodes.size();
-         (void)free_nodes;
-         BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
+         BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node);
          BOOST_ASSERT(0 == to_deallocate->hdr_offset);
-         hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
-         mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
+         hdr_offset_holder *hdr_off_holder =
+            mp_impl->priv_first_subblock_from_block(container_detail::to_raw_pointer(to_deallocate));
+         m_chain.push_back(hdr_off_holder);
       }
 
       const this_type *mp_impl;
+      multiallocation_chain &m_chain;
    };
 
    //This macro will activate invariant checking. Slow, but helpful for debugging the code.
@@ -447,44 +633,45 @@ class private_adaptive_node_pool_impl
    #ifdef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
    #undef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
    {
-      //We iterate through the block tree to free the memory
-      block_iterator it(m_block_multiset.begin()), 
-                     itend(m_block_multiset.end()), to_deallocate;
-      if(it != itend){
-         for(++it; it != itend; ++it){
-            block_iterator prev(it);
-            --prev;
-            size_type sp = prev->free_nodes.size(),
-                        si = it->free_nodes.size();
-            BOOST_ASSERT(sp <= si);
-            (void)sp;   (void)si;
+      const const_block_iterator itend(m_block_container.end());
+
+      {  //We iterate through the block tree to free the memory
+         const_block_iterator it(m_block_container.begin());
+   
+         if(it != itend){
+            for(++it; it != itend; ++it){
+               const_block_iterator prev(it);
+               --prev;
+               BOOST_ASSERT(*prev < *it);
+               (void)prev;   (void)it;
+            }
          }
       }
-      //Check that the total free nodes are correct
-      it    = m_block_multiset.begin();
-      itend = m_block_multiset.end();
-      size_type total_free_nodes = 0;
-      for(; it != itend; ++it){
-         total_free_nodes += it->free_nodes.size();
+      {  //Check that the total free nodes are correct
+         const_block_iterator it(m_block_container.cbegin());
+         size_type total_free_nodes = 0;
+         for(; it != itend; ++it){
+            total_free_nodes += it->free_nodes.size();
+         }
+         BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
       }
-      BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
-
-      //Check that the total totally free blocks are correct
-      it    = m_block_multiset.begin();
-      itend = m_block_multiset.end();
-      total_free = 0;
-      for(; it != itend; ++it){
-         total_free += it->free_nodes.size() == m_real_num_node;
+      {  //Check that the total totally free blocks are correct
+         BOOST_ASSERT(m_block_container.size() >= m_totally_free_blocks);
+         const_block_iterator it = m_block_container.cend();
+         size_type total_free_blocks = m_totally_free_blocks;
+         while(total_free_blocks--){
+            BOOST_ASSERT((--it)->free_nodes.size() == m_real_num_node);
+         }
       }
-      BOOST_ASSERT(total_free >= m_totally_free_blocks);
 
       if(!AlignOnly){
          //Check that header offsets are correct
-         it = m_block_multiset.begin();
+         const_block_iterator it = m_block_container.begin();
          for(; it != itend; ++it){
-            hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it);
+            hdr_offset_holder *hdr_off_holder = this->priv_first_subblock_from_block(const_cast(&*it));
             for(size_type i = 0, max = m_num_subblocks; i < max; ++i){
-               BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast(&*it)- reinterpret_cast(hdr_off_holder)));
+               const size_type offset = reinterpret_cast(const_cast(&*it)) - reinterpret_cast(hdr_off_holder);
+               BOOST_ASSERT(hdr_off_holder->hdr_offset == offset);
                BOOST_ASSERT(0 == ((size_type)hdr_off_holder & (m_real_block_alignment - 1)));
                BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
                hdr_off_holder = reinterpret_cast(reinterpret_cast(hdr_off_holder) + m_real_block_alignment);
@@ -500,19 +687,21 @@ class private_adaptive_node_pool_impl
    void priv_clear()
    {
       #ifndef NDEBUG
-      block_iterator it    = m_block_multiset.begin();
-      block_iterator itend = m_block_multiset.end();
-      size_type num_free_nodes = 0;
+      block_iterator it    = m_block_container.begin();
+      block_iterator itend = m_block_container.end();
+      size_type n_free_nodes = 0;
       for(; it != itend; ++it){
          //Check for memory leak
          BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
-         ++num_free_nodes;
+         ++n_free_nodes;
       }
-      BOOST_ASSERT(num_free_nodes == m_totally_free_blocks);
+      BOOST_ASSERT(n_free_nodes == m_totally_free_blocks);
       #endif
       //Check for memory leaks
-      priv_invariants();
-      m_block_multiset.clear_and_dispose(block_destroyer(this));
+      this->priv_invariants();
+      multiallocation_chain chain;
+      m_block_container.clear_and_dispose(block_destroyer(this, chain));
+      this->mp_segment_mngr_base->deallocate_many(chain);
       m_totally_free_blocks = 0;
    }
 
@@ -534,93 +723,129 @@ class private_adaptive_node_pool_impl
    }
 
    block_info_t *priv_block_from_node(void *node) const
-   {  return priv_block_from_node(node, IsAlignOnly());   }
+   {  return this->priv_block_from_node(node, IsAlignOnly());   }
 
    hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block) const
+   {  return this->priv_first_subblock_from_block(block, IsAlignOnly());   }
+
+   hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyFalse) const
    {
-      hdr_offset_holder *hdr_off_holder = reinterpret_cast
+      hdr_offset_holder *const hdr_off_holder = reinterpret_cast
             (reinterpret_cast(block) - (m_num_subblocks-1)*m_real_block_alignment);
       BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast(block) - reinterpret_cast(hdr_off_holder)));
-     BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+      BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
       BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
       return hdr_off_holder;
    }
 
-   //!Allocates a several blocks of nodes. Can throw
-   void priv_alloc_block(size_type n, AlignOnlyTrue)
+   hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyTrue) const
    {
-      size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
-      for(size_type i = 0; i != n; ++i){
-         //We allocate a new NodeBlock and put it the last
-         //element of the tree
-         char *mem_address = static_cast
-            (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
-         if(!mem_address)   throw std::bad_alloc();
-         ++m_totally_free_blocks;
-         block_info_t *c_info = new(mem_address)block_info_t();
-         m_block_multiset.insert(m_block_multiset.end(), *c_info);
-         
-         mem_address += HdrSize;
-         //We initialize all Nodes in Node Block to insert 
-         //them in the free Node list
-         typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
-         for(size_type i = 0; i < m_real_num_node; ++i){
-            prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *(node_t*)mem_address);
-            mem_address   += m_real_node_size;
+      return reinterpret_cast(block);
+   }
+
+   void priv_dispatch_block_chain_or_free
+      ( multiallocation_chain &chain, block_info_t &c_info, size_type num_node
+      , char *mem_address, size_type total_elements, bool insert_block_if_free)
+   {
+      BOOST_ASSERT(chain.size() <= total_elements);
+      //First add all possible nodes to the chain
+      const size_type left = total_elements - chain.size();
+      const size_type max_chain = (num_node < left) ? num_node : left;
+      mem_address = static_cast(container_detail::to_raw_pointer
+         (chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, max_chain)));
+      //Now store remaining nodes in the free list
+      if(const size_type max_free = num_node - max_chain){
+         free_nodes_t & free_nodes = c_info.free_nodes;
+         free_nodes.incorporate_after(free_nodes.last(), void_pointer(mem_address), m_real_node_size, max_free);
+         if(insert_block_if_free){
+            m_block_container.push_front(c_info);
          }
       }
    }
 
-   void priv_alloc_block(size_type n, AlignOnlyFalse)
+   //!Allocates a several blocks of nodes. Can throw
+   void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyTrue)
    {
-      size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
-      size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
-      size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+      BOOST_ASSERT(m_block_container.empty());
+      BOOST_ASSERT(min_elements > 0);
+      const size_type n = (min_elements - 1)/m_real_num_node + 1;
+      const size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
+      const size_type total_elements = chain.size() + min_elements;
+      for(size_type i = 0; i != n; ++i){
+         //We allocate a new NodeBlock and put it the last
+         //element of the tree
+         char *mem_address = static_cast
+            (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
+         if(!mem_address){
+            //In case of error, free memory deallocating all nodes (the new ones allocated
+            //in this function plus previously stored nodes in chain).
+            this->deallocate_nodes(chain);
+            throw std::bad_alloc();
+         }
+         block_info_t &c_info = *new(mem_address)block_info_t();
+         mem_address += HdrSize;
+         if(i != (n-1)){
+            chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, m_real_num_node);
+         }
+         else{
+            this->priv_dispatch_block_chain_or_free(chain, c_info, m_real_num_node, mem_address, total_elements, true);
+         }
+      }
+   }
+
+   void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyFalse)
+   {
+      BOOST_ASSERT(m_block_container.empty());
+      BOOST_ASSERT(min_elements > 0);
+      const size_type n = (min_elements - 1)/m_real_num_node + 1;
+      const size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
+      const size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
+      const size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+      const size_type total_elements = chain.size() + min_elements;
 
       for(size_type i = 0; i != n; ++i){
          //We allocate a new NodeBlock and put it the last
          //element of the tree
          char *mem_address = static_cast
             (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment));
-         if(!mem_address)   throw std::bad_alloc();
-         ++m_totally_free_blocks;
-
+         if(!mem_address){
+            //In case of error, free memory deallocating all nodes (the new ones allocated
+            //in this function plus previously stored nodes in chain).
+            this->deallocate_nodes(chain);
+            throw std::bad_alloc();
+         }
          //First initialize header information on the last subblock
          char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
-         block_info_t *c_info = new(hdr_addr)block_info_t();
+         block_info_t &c_info = *new(hdr_addr)block_info_t();
          //Some structural checks
-         BOOST_ASSERT(static_cast(&static_cast(c_info)->hdr_offset) ==
-                static_cast(c_info));
-         typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
-         for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
-            ; subblock < maxsubblock
-            ; ++subblock, mem_address += m_real_block_alignment){
-            //Initialize header offset mark
-            new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
-            char *pNode = mem_address + HdrOffsetSize;
-            for(size_type i = 0; i < elements_per_subblock; ++i){
-               prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
-               pNode   += m_real_node_size;
+         BOOST_ASSERT(static_cast(&static_cast(c_info).hdr_offset) ==
+                      static_cast(&c_info));   (void)c_info;
+         if(i != (n-1)){
+            for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
+               ; subblock < maxsubblock
+               ; ++subblock, mem_address += m_real_block_alignment){
+               //Initialize header offset mark
+               new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
+               chain.incorporate_after
+                  (chain.last(), void_pointer(mem_address + HdrOffsetSize), m_real_node_size, elements_per_subblock);
             }
+            chain.incorporate_after(chain.last(), void_pointer(hdr_addr + HdrSize), m_real_node_size, hdr_subblock_elements);
          }
-         {
-            char *pNode = hdr_addr + HdrSize;
-            //We initialize all Nodes in Node Block to insert 
-            //them in the free Node list
-            for(size_type i = 0; i < hdr_subblock_elements; ++i){
-               prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
-               pNode   += m_real_node_size;
+         else{
+            for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
+               ; subblock < maxsubblock
+               ; ++subblock, mem_address += m_real_block_alignment){
+               //Initialize header offset mark
+               new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
+               this->priv_dispatch_block_chain_or_free
+                  (chain, c_info, elements_per_subblock, mem_address + HdrOffsetSize, total_elements, false);
             }
+            this->priv_dispatch_block_chain_or_free
+               (chain, c_info, hdr_subblock_elements, hdr_addr + HdrSize, total_elements, true);
          }
-         //Insert the block after the free node list is full
-         m_block_multiset.insert(m_block_multiset.end(), *c_info);
       }
    }
 
-   //!Allocates a block of nodes. Can throw std::bad_alloc
-   void priv_alloc_block(size_type n)
-   {  return priv_alloc_block(n, IsAlignOnly());   }
-
    private:
    typedef typename boost::intrusive::pointer_traits
       ::template rebind_pointer::type   segment_mngr_base_ptr_t;
@@ -634,9 +859,9 @@ class private_adaptive_node_pool_impl
    //This is the real number of nodes per block
    //const
    size_type m_real_num_node;
-   segment_mngr_base_ptr_t                mp_segment_mngr_base;   //Segment manager
-   block_multiset_t                       m_block_multiset;       //Intrusive block list
-   size_type                            m_totally_free_blocks;  //Free blocks
+   segment_mngr_base_ptr_t             mp_segment_mngr_base;   //Segment manager
+   block_container_t                    m_block_container;       //Intrusive block list
+   size_type                           m_totally_free_blocks;  //Free blocks
 };
 
 }  //namespace container_detail {
diff --git a/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp b/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
index 58199c7aa..4c4fef6e5 100644
--- a/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
+++ b/project/jni/boost/include/boost/container/detail/advanced_insert_int.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -17,163 +17,180 @@
 
 #include "config_begin.hpp"
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include   //std::iterator_traits
 #include 
+#include 
 
 namespace boost { namespace container { namespace container_detail {
 
-//This class will be interface for operations dependent on FwdIt types used advanced_insert_aux_impl
-template
-struct advanced_insert_aux_int
-{
-   typedef typename std::iterator_traits::difference_type difference_type;
-   virtual void copy_remaining_to(Iterator p) = 0;
-   virtual void uninitialized_copy_remaining_to(Iterator p) = 0;
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
-   virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first) = 0;
-   virtual ~advanced_insert_aux_int() {}
-};
-
-//This class template will adapt each FwIt types to advanced_insert_aux_int
 template
-struct advanced_insert_aux_proxy
-   :  public advanced_insert_aux_int
+struct insert_range_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
    typedef typename allocator_traits::size_type size_type;
    typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
 
-   advanced_insert_aux_proxy(A& a, FwdIt first, FwdIt last)
-      :  a_(a), first_(first), last_(last)
+   insert_range_proxy(A& a, FwdIt first)
+      :  a_(a), first_(first)
    {}
 
-   virtual ~advanced_insert_aux_proxy()
-   {}
-
-   virtual void copy_remaining_to(Iterator p)
-   {  ::boost::copy_or_move(first_, last_, p);  }
-
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, last_, p);  }
-
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void uninitialized_copy_n_and_update(Iterator pos, size_type n)
    {
-      FwdIt mid = first_;
-      std::advance(mid, division_count);
-      if(first_n){
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, first_, mid, pos);
-         first_ = mid;
-      }
-      else{
-         ::boost::container::uninitialized_copy_or_move_alloc(a_, mid, last_, pos);
-         last_ = mid;
-      }
+      this->first_ = ::boost::container::uninitialized_copy_or_move_alloc_n_source
+         (this->a_, this->first_, n, pos);
    }
 
-   virtual void copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void copy_n_and_update(Iterator pos, size_type n)
    {
-      FwdIt mid = first_;
-      std::advance(mid, division_count);
-      if(first_n){
-         ::boost::copy_or_move(first_, mid, pos);
-         first_ = mid;
-      }
-      else{
-         ::boost::copy_or_move(mid, last_, pos);
-         last_ = mid;
-      }
+      this->first_ = ::boost::container::copy_or_move_n_source(this->first_, n, pos);
    }
+
    A &a_;
-   FwdIt first_, last_;
+   FwdIt first_;
 };
 
-//This class template will adapt default construction insertions to advanced_insert_aux_int
+
 template
-struct default_construct_aux_proxy
-   :  public advanced_insert_aux_int
+struct insert_n_copies_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
    typedef typename allocator_traits::size_type size_type;
    typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
 
-   default_construct_aux_proxy(A &a, size_type count)
-      :  a_(a), count_(count)
+   insert_n_copies_proxy(A& a, const value_type &v)
+      :  a_(a), v_(v)
    {}
 
-   virtual ~default_construct_aux_proxy()
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {  std::uninitialized_fill_n(p, n, v_);   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {  std::fill_n(p, n, v_);  }
+
+   A &a_;
+   const value_type &v_;
+};
+
+template
+struct insert_default_constructed_n_proxy
+{
+   typedef ::boost::container::allocator_traits alloc_traits;
+   typedef typename allocator_traits::size_type size_type;
+   typedef typename allocator_traits::value_type value_type;
+
+
+   explicit insert_default_constructed_n_proxy(A &a)
+      :  a_(a)
    {}
 
-   virtual void copy_remaining_to(Iterator)
-   {  //This should never be called with any count
-      BOOST_ASSERT(count_ == 0);
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      Iterator orig_p = p;
+      size_type n_left = n;
+      BOOST_TRY{
+         for(; n_left--; ++p){
+            alloc_traits::construct(this->a_, container_detail::to_raw_pointer(&*p));
+         }
+      }
+      BOOST_CATCH(...){
+         for(; orig_p != p; ++orig_p){
+            alloc_traits::destroy(this->a_, container_detail::to_raw_pointer(&*orig_p++));
+         }
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
    }
 
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  this->priv_uninitialized_copy(p, count_); }
-
-   virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
+   void copy_n_and_update(Iterator, size_type)
    {
-      size_type new_count;
-      if(first_n){
-         new_count = division_count;
-      }
-      else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
-      }
-      this->priv_uninitialized_copy(pos, new_count);
-   }
-
-   virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
-   {
-      BOOST_ASSERT(count_ == 0);
-      size_type new_count;
-      if(first_n){
-         new_count = division_count;
-      }
-      else{
-         BOOST_ASSERT(difference_type(count_)>= division_count);
-         new_count = count_ - division_count;
-      }
-      //This function should never called with a count different to zero
-      BOOST_ASSERT(new_count == 0);
-      (void)new_count;
+      BOOST_ASSERT(false);
    }
 
    private:
-   void priv_uninitialized_copy(Iterator p, const size_type n)
-   {
-      BOOST_ASSERT(n <= count_);
-      Iterator orig_p = p;
-      size_type i = 0;
-      try{
-         for(; i < n; ++i, ++p){
-            alloc_traits::construct(a_, container_detail::to_raw_pointer(&*p));
-         }
-      }
-      catch(...){
-         while(i--){
-            alloc_traits::destroy(a_, container_detail::to_raw_pointer(&*orig_p++));
-         }
-         throw;
-      }
-      count_ -= n;
-   }
    A &a_;
-   size_type count_;
 };
 
+template
+struct insert_copy_proxy
+{
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename alloc_traits::size_type size_type;
+   typedef typename alloc_traits::value_type value_type;
+
+   insert_copy_proxy(A& a, const value_type &v)
+      :  a_(a), v_(v)
+   {}
+
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , v_
+                              );
+   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      *p =v_;
+   }
+
+   A &a_;
+   const value_type &v_;
+};
+
+
+template
+struct insert_move_proxy
+{
+   typedef boost::container::allocator_traits alloc_traits;
+   typedef typename alloc_traits::size_type size_type;
+   typedef typename alloc_traits::value_type value_type;
+
+   insert_move_proxy(A& a, value_type &v)
+      :  a_(a), v_(v)
+   {}
+
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , ::boost::move(v_)
+                              );
+   }
+
+   void copy_n_and_update(Iterator p, size_type n)
+   {
+      BOOST_ASSERT(n == 1);  (void)n;
+      *p = ::boost::move(v_);
+   }
+
+   A &a_;
+   value_type &v_;
+};
+
+template
+insert_move_proxy get_insert_value_proxy(A& a, BOOST_RV_REF(typename std::iterator_traits::value_type) v)
+{
+   return insert_move_proxy(a, v);
+}
+
+template
+insert_copy_proxy get_insert_value_proxy(A& a, const typename std::iterator_traits::value_type &v)
+{
+   return insert_copy_proxy(a, v);
+}
+
 }}}   //namespace boost { namespace container { namespace container_detail {
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #include 
-#include 
-#include 
+#include 
 #include 
 //#include  //For debugging purposes
 
@@ -181,125 +198,74 @@ namespace boost {
 namespace container {
 namespace container_detail {
 
-
-//This class template will adapt emplace construction insertions of movable types 
-//to advanced_insert_aux_int
 template
-struct advanced_insert_aux_non_movable_emplace
-   :  public advanced_insert_aux_int
+struct insert_non_movable_emplace_proxy
 {
-   typedef boost::container::allocator_traits alloc_traits;
-   typedef typename allocator_traits::size_type size_type;
-   typedef typename allocator_traits::value_type value_type;
-   typedef typename advanced_insert_aux_int::difference_type difference_type;
-   typedef typename build_number_seq::type             index_tuple_t;
+   typedef boost::container::allocator_traits   alloc_traits;
+   typedef typename alloc_traits::size_type        size_type;
+   typedef typename alloc_traits::value_type       value_type;
 
-   explicit advanced_insert_aux_non_movable_emplace(A &a, Args&&... args)
-      : a_(a)
-      , args_(args...)
-      , used_(false)
+   typedef typename build_number_seq::type index_tuple_t;
+
+   explicit insert_non_movable_emplace_proxy(A &a, Args&&... args)
+      : a_(a), args_(args...)
    {}
 
-   ~advanced_insert_aux_non_movable_emplace()
-   {}
-
-   virtual void copy_remaining_to(Iterator)
-   //This code can't be called since value_type is not movable or copyable
-   {  BOOST_ASSERT(false);   }
-
-   virtual void uninitialized_copy_remaining_to(Iterator p)
-   {  this->priv_uninitialized_copy_remaining_to(index_tuple_t(), p);   }
-
-   virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {  this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
-
-   virtual void copy_some_and_update(Iterator, difference_type, bool )
-   //This code can't be called since value_type is not movable or copyable
-   {  BOOST_ASSERT(false);   }
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)
+   {  this->priv_uninitialized_copy_some_and_update(index_tuple_t(), p, n);  }
 
    private:
    template
-   void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
+   void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, size_type n)
    {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!used_){
-            alloc_traits::construct( a_
-                                   , container_detail::to_raw_pointer(&*p)
-                                   , ::boost::container::container_detail::
-                                       stored_ref::forward(get(args_))...
-                                   );
-            used_ = true;
-         }
-      }
-   }
-
-   template
-   void priv_uninitialized_copy_remaining_to(const index_tuple&, Iterator p)
-   {
-      if(!used_){
-         alloc_traits::construct( a_
-                                , container_detail::to_raw_pointer(&*p)
-                                , ::boost::container::container_detail::
-                                    stored_ref::forward(get(args_))...
-                                );
-         used_ = true;
-      }
+      BOOST_ASSERT(n == 1); (void)n;
+      alloc_traits::construct( this->a_
+                              , container_detail::to_raw_pointer(&*p)
+                              , ::boost::forward(get(this->args_))...
+                              );
    }
 
    protected:
    A &a_;
    tuple args_;
-   bool used_;
 };
 
-//This class template will adapt emplace construction insertions of movable types 
-//to advanced_insert_aux_int
 template
-struct advanced_insert_aux_emplace
-   :  public advanced_insert_aux_non_movable_emplace
+struct insert_emplace_proxy
+   :  public insert_non_movable_emplace_proxy
 {
-   typedef advanced_insert_aux_non_movable_emplace base_t;
-   typedef typename base_t::value_type       value_type;
-   typedef typename base_t::difference_type  difference_type;
-   typedef typename base_t::index_tuple_t    index_tuple_t;
+   typedef insert_non_movable_emplace_proxy base_t;
+   typedef boost::container::allocator_traits   alloc_traits;
+   typedef typename base_t::value_type             value_type;
+   typedef typename base_t::size_type              size_type;
+   typedef typename base_t::index_tuple_t          index_tuple_t;
 
-   explicit advanced_insert_aux_emplace(A &a, Args&&... args)
-      : base_t(a, boost::forward(args)...)
+   explicit insert_emplace_proxy(A &a, Args&&... args)
+      : base_t(a, ::boost::forward(args)...)
    {}
 
-   ~advanced_insert_aux_emplace()
-   {}
-
-   //Override only needed functions
-   virtual void copy_remaining_to(Iterator p)
-   {  this->priv_copy_remaining_to(index_tuple_t(), p);   }
-
-   virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
-   {  this->priv_copy_some_and_update(index_tuple_t(), p, division_count, first_n);  }
+   void copy_n_and_update(Iterator p, size_type n)
+   {  this->priv_copy_some_and_update(index_tuple_t(), p, n);  }
 
    private:
-   template
-   void priv_copy_remaining_to(const index_tuple&, Iterator p)
-   {
-      if(!this->used_){
-         *p = boost::move(value_type (
-            ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
-         this->used_ = true;
-      }
-   }
 
    template
-   void priv_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n)
+   void priv_copy_some_and_update(const index_tuple&, Iterator p, size_type n)
    {
-      BOOST_ASSERT(division_count <=1);
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){
-         if(!this->used_){
-            *p = boost::move(value_type(
-               ::boost::container::container_detail::stored_ref::forward(get(this->args_))...));
-            this->used_ = true;
-         }
+      BOOST_ASSERT(n ==1); (void)n;
+      aligned_storage::value> v;
+      value_type *vp = static_cast(static_cast(&v));
+      alloc_traits::construct(this->a_, vp,
+         ::boost::forward(get(this->args_))...);
+      BOOST_TRY{
+         *p = ::boost::move(*vp);
       }
+      BOOST_CATCH(...){
+         alloc_traits::destroy(this->a_, vp);
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+      alloc_traits::destroy(this->a_, vp);
    }
 };
 
@@ -307,115 +273,80 @@ struct advanced_insert_aux_emplace
 
 #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
-#include  
+#include 
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
-#define BOOST_PP_LOCAL_MACRO(n)                                                     \
-template        \
-struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)  \
-   :  public advanced_insert_aux_int                                      \
+#define BOOST_PP_LOCAL_MACRO(N)                                                     \
+template        \
+struct BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                        \
 {                                                                                   \
    typedef boost::container::allocator_traits alloc_traits;                      \
-   typedef typename allocator_traits::size_type size_type;                       \
-   typedef typename allocator_traits::value_type value_type;                     \
-   typedef typename advanced_insert_aux_int::difference_type              \
-      difference_type;                                                              \
+   typedef typename alloc_traits::size_type size_type;                              \
+   typedef typename alloc_traits::value_type value_type;                            \
                                                                                     \
-   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_non_movable_emplace, n), arg)      \
-      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+   BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                            \
+      ( A &a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
       : a_(a)                                                                       \
-      , used_(false)                                                                \
-      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_INIT, _)                   \
-    {}                                                                              \
+      BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_INIT, _)                   \
+   {}                                                                               \
                                                                                     \
-   virtual void copy_remaining_to(Iterator)                                         \
-   {  BOOST_ASSERT(false);   }                                                      \
-                                                                                    \
-   virtual void uninitialized_copy_remaining_to(Iterator p)                         \
+   void uninitialized_copy_n_and_update(Iterator p, size_type n)                    \
    {                                                                                \
-      if(!used_){                                                                   \
-         alloc_traits::construct                                                    \
-            ( a_                                                                    \
-            , container_detail::to_raw_pointer(&*p)                                 \
-            BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)         \
-            );                                                                      \
-         used_ = true;                                                              \
-      }                                                                             \
+      BOOST_ASSERT(n == 1); (void)n;                                                \
+      alloc_traits::construct                                                       \
+         ( this->a_                                                                 \
+         , container_detail::to_raw_pointer(&*p)                                    \
+         BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)            \
+         );                                                                         \
    }                                                                                \
                                                                                     \
-   virtual void uninitialized_copy_some_and_update                                  \
-      (Iterator p, difference_type division_count, bool first_n)                    \
-   {                                                                                \
-      BOOST_ASSERT(division_count <=1);                                             \
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-         if(!used_){                                                                \
-            alloc_traits::construct                                                 \
-               ( a_                                                                 \
-               , container_detail::to_raw_pointer(&*p)                              \
-               BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)      \
-               );                                                                   \
-            used_ = true;                                                           \
-         }                                                                          \
-      }                                                                             \
-   }                                                                                \
-                                                                                    \
-   virtual void copy_some_and_update(Iterator, difference_type, bool)               \
+   void copy_n_and_update(Iterator, size_type)                                      \
    {  BOOST_ASSERT(false);   }                                                      \
                                                                                     \
+   protected:                                                                       \
    A &a_;                                                                           \
-   bool used_;                                                                      \
-   BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
+   BOOST_PP_REPEAT(N, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
 };                                                                                  \
                                                                                     \
-template        \
-struct BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)              \
-   : BOOST_PP_CAT(BOOST_PP_CAT(                                                     \
-      advanced_insert_aux_non_movable_emplace, n), arg)                             \
-         < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P) >                        \
+template        \
+struct BOOST_PP_CAT(insert_emplace_proxy_arg, N)                                    \
+   : BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                          \
+         < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) >                        \
 {                                                                                   \
-   typedef BOOST_PP_CAT(BOOST_PP_CAT(                                               \
-      advanced_insert_aux_non_movable_emplace, n), arg)                             \
-          base_t;                 \
+   typedef BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N)                    \
+          base_t;                 \
    typedef typename base_t::value_type       value_type;                            \
-   typedef typename base_t::difference_type  difference_type;                       \
+   typedef typename base_t::size_type  size_type;                                   \
+   typedef boost::container::allocator_traits alloc_traits;                      \
                                                                                     \
-   BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)                  \
-      ( A &a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
-      : base_t(a BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) )   \
-    {}                                                                              \
+   BOOST_PP_CAT(insert_emplace_proxy_arg, N)                                        \
+      ( A &a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_LIST, _) )          \
+      : base_t(a BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_PARAM_FORWARD, _) )   \
+   {}                                                                               \
                                                                                     \
-   virtual void copy_remaining_to(Iterator p)                                       \
+   void copy_n_and_update(Iterator p, size_type n)                                  \
    {                                                                                \
-      if(!this->used_){                                                             \
-         value_type v BOOST_PP_LPAREN_IF(n)                                         \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)                  \
-            BOOST_PP_RPAREN_IF(n);                                                  \
-         *p = boost::move(v);                                                       \
-         this->used_ = true;                                                        \
+      BOOST_ASSERT(n == 1); (void)n;                                                \
+      aligned_storage::value> v;       \
+      value_type *vp = static_cast(static_cast(&v));          \
+      alloc_traits::construct(this->a_, vp                                          \
+         BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _));          \
+      BOOST_TRY{                                                                    \
+         *p = ::boost::move(*vp);                                                   \
       }                                                                             \
-   }                                                                                \
-                                                                                    \
-   virtual void copy_some_and_update                                                \
-      (Iterator p, difference_type division_count, bool first_n)                    \
-   {                                                                                \
-      BOOST_ASSERT(division_count <=1);                                             \
-      if((first_n && division_count == 1) || (!first_n && division_count == 0)){    \
-         if(!this->used_){                                                          \
-            value_type v BOOST_PP_LPAREN_IF(n)                                      \
-                  BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)            \
-                BOOST_PP_RPAREN_IF(n);                                              \
-            *p = boost::move(v);                                                    \
-            this->used_ = true;                                                     \
-         }                                                                          \
+      BOOST_CATCH(...){                                                             \
+         alloc_traits::destroy(this->a_, vp);                                       \
+         BOOST_RETHROW                                                              \
       }                                                                             \
+      BOOST_CATCH_END                                                               \
+      alloc_traits::destroy(this->a_, vp);                                          \
    }                                                                                \
 };                                                                                  \
 //!
-
 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 #include BOOST_PP_LOCAL_ITERATE()
 
diff --git a/project/jni/boost/include/boost/container/detail/algorithms.hpp b/project/jni/boost/include/boost/container/detail/algorithms.hpp
index a2713f50f..824e44b90 100644
--- a/project/jni/boost/include/boost/container/detail/algorithms.hpp
+++ b/project/jni/boost/include/boost/container/detail/algorithms.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -34,6 +34,30 @@
 namespace boost {
 namespace container {
 
+template
+struct is_default_construct_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct is_default_construct_iterator >
+{
+   static const bool value = true;
+};
+
+template
+struct is_emplace_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct is_emplace_iterator >
+{
+   static const bool value = true;
+};
+
 template
 inline void construct_in_place(A &a, T* dest, InpIt source)
 {     boost::container::allocator_traits::construct(a, dest, *source);  }
@@ -51,7 +75,7 @@ inline void construct_in_place(A &a, T *dest, emplace_iterator ei)
    ei.construct_in_place(a, dest);
 }
 
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/allocation_type.hpp b/project/jni/boost/include/boost/container/detail/allocation_type.hpp
index edad487c5..1ebf20ed7 100644
--- a/project/jni/boost/include/boost/container/detail/allocation_type.hpp
+++ b/project/jni/boost/include/boost/container/detail/allocation_type.hpp
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -23,7 +23,7 @@ namespace container {
 
 /// @cond
 enum allocation_type_v
-{   
+{  
    // constants for allocation commands
    allocate_new_v   = 0x01,
    expand_fwd_v     = 0x02,
diff --git a/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp b/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp
new file mode 100644
index 000000000..d69e61bc9
--- /dev/null
+++ b/project/jni/boost/include/boost/container/detail/allocator_version_traits.hpp
@@ -0,0 +1,163 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP
+#define BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include              //allocator_traits
+#include  //multiallocation_chain
+#include           //version_type
+#include        //allocation_type
+#include                    //integral_constant
+#include                //pointer_traits
+#include                                           //pair
+#include                                         //runtime_error
+#include            //BOOST_TRY
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template::value>
+struct allocator_version_traits
+{
+   typedef ::boost::container::container_detail::integral_constant
+       alloc_version;
+
+   typedef typename Allocator::multiallocation_chain multiallocation_chain;
+
+   typedef typename boost::container::allocator_traits::pointer    pointer;
+   typedef typename boost::container::allocator_traits::size_type  size_type;
+
+   //Node allocation interface
+   static pointer allocate_one(Allocator &a)
+   {  return a.allocate_one();   }
+
+   static void deallocate_one(Allocator &a, const pointer &p)
+   {  a.deallocate_one(p);   }
+
+   static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+   {  return a.allocate_individual(n, m);   }
+
+   static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+   {  a.deallocate_individual(holder);   }
+
+   static std::pair
+      allocation_command(Allocator &a, allocation_type command,
+                         size_type limit_size, size_type preferred_size,
+                         size_type &received_size, const pointer &reuse)
+   {
+      return a.allocation_command
+         (command, limit_size, preferred_size, received_size, reuse);
+   }
+};
+
+template
+struct allocator_version_traits
+{
+   typedef ::boost::container::container_detail::integral_constant
+       alloc_version;
+
+   typedef typename boost::container::allocator_traits::pointer    pointer;
+   typedef typename boost::container::allocator_traits::size_type  size_type;
+   typedef typename boost::container::allocator_traits::value_type value_type;
+
+   typedef typename boost::intrusive::pointer_traits::
+         template rebind_pointer::type                void_ptr;
+   typedef container_detail::basic_multiallocation_chain
+                                                  multialloc_cached_counted;
+   typedef boost::container::container_detail::
+      transform_multiallocation_chain
+         < multialloc_cached_counted, value_type>           multiallocation_chain;
+
+   //Node allocation interface
+   static pointer allocate_one(Allocator &a)
+   {  return a.allocate(1);   }
+
+   static void deallocate_one(Allocator &a, const pointer &p)
+   {  a.deallocate(p, 1);   }
+
+   static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+   {
+      while(!holder.empty()){
+         a.deallocate(holder.pop_front(), 1);
+      }
+   }
+
+   struct allocate_individual_rollback
+   {
+      allocate_individual_rollback(Allocator &a, multiallocation_chain &chain)
+         : mr_a(a), mp_chain(&chain)
+      {}
+
+      ~allocate_individual_rollback()
+      {
+         if(mp_chain)
+            allocator_version_traits::deallocate_individual(mr_a, *mp_chain);
+      }
+
+      void release()
+      {
+         mp_chain = 0;
+      }
+
+      Allocator &mr_a;
+      multiallocation_chain * mp_chain;
+   };
+
+   static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+   {
+      allocate_individual_rollback rollback(a, m);
+      while(n--){
+         m.push_front(a.allocate(1));
+      }
+      rollback.release();
+   }
+
+   static std::pair
+      allocation_command(Allocator &a, allocation_type command,
+                         size_type, size_type preferred_size,
+                         size_type &received_size, const pointer &)
+   {
+      std::pair ret(pointer(), false);
+      if(!(command & allocate_new)){
+         if(!(command & nothrow_allocation)){
+            throw std::runtime_error("version 1 allocator without allocate_new flag");
+         }
+      }
+      else{
+         received_size = preferred_size;
+         BOOST_TRY{
+            ret.first = a.allocate(received_size);
+         }
+         BOOST_CATCH(...){
+            if(!(command & nothrow_allocation)){
+               BOOST_RETHROW
+            }
+         }
+         BOOST_CATCH_END
+      }
+      return ret;
+   }
+};
+
+}  //namespace container_detail {
+}  //namespace container {
+}  //namespace boost {
+
+#include 
+
+#endif // ! defined(BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP)
diff --git a/project/jni/boost/include/boost/container/detail/config_begin.hpp b/project/jni/boost/include/boost/container/detail/config_begin.hpp
index bd44daacf..83c2cfe40 100644
--- a/project/jni/boost/include/boost/container/detail/config_begin.hpp
+++ b/project/jni/boost/include/boost/container/detail/config_begin.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -45,4 +45,5 @@
                                     //    with /GR-; unpredictable behavior may result
    #pragma warning (disable : 4673) //  throwing '' the following types will not be considered at the catch site
    #pragma warning (disable : 4671) //  the copy constructor is inaccessible
+   #pragma warning (disable : 4584) //  X is already a base-class of Y
 #endif   //BOOST_MSVC
diff --git a/project/jni/boost/include/boost/container/detail/config_end.hpp b/project/jni/boost/include/boost/container/detail/config_end.hpp
index b71fabcda..34513718c 100644
--- a/project/jni/boost/include/boost/container/detail/config_end.hpp
+++ b/project/jni/boost/include/boost/container/detail/config_end.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
diff --git a/project/jni/boost/include/boost/container/detail/destroyers.hpp b/project/jni/boost/include/boost/container/detail/destroyers.hpp
index 26ae089aa..f9bfd867a 100644
--- a/project/jni/boost/include/boost/container/detail/destroyers.hpp
+++ b/project/jni/boost/include/boost/container/detail/destroyers.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,12 +21,74 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
+//!A deleter for scoped_ptr that deallocates the memory
+//!allocated for an object using a STL allocator.
+template 
+struct scoped_deallocator
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::pointer pointer;
+   typedef container_detail::integral_constant::value>                   alloc_version;
+   typedef container_detail::integral_constant     allocator_v1;
+   typedef container_detail::integral_constant     allocator_v2;
+
+   private:
+   void priv_deallocate(allocator_v1)
+   {  m_alloc.deallocate(m_ptr, 1); }
+
+   void priv_deallocate(allocator_v2)
+   {  m_alloc.deallocate_one(m_ptr); }
+
+   BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
+
+   public:
+
+   pointer     m_ptr;
+   A&  m_alloc;
+
+   scoped_deallocator(pointer p, A& a)
+      : m_ptr(p), m_alloc(a)
+   {}
+
+   ~scoped_deallocator()
+   {  if (m_ptr)priv_deallocate(alloc_version());  }
+
+   scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
+      :  m_ptr(o.m_ptr), m_alloc(o.m_alloc)
+   {  o.release();  }
+
+   pointer get() const
+   {  return m_ptr;  }
+
+   void release()
+   {  m_ptr = 0; }
+};
+
+template 
+struct null_scoped_deallocator
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
+
+   null_scoped_deallocator(pointer, Allocator&, size_type)
+   {}
+
+   void release()
+   {}
+
+   pointer get() const
+   {  return pointer();  }
+};
+
 //!A deleter for scoped_ptr that deallocates the memory
 //!allocated for an array of objects using a STL allocator.
 template 
@@ -65,6 +127,44 @@ struct null_scoped_array_deallocator
    {}
 };
 
+template 
+struct scoped_destroy_deallocator
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   typedef typename AllocTraits::pointer    pointer;
+   typedef typename AllocTraits::size_type  size_type;
+   typedef container_detail::integral_constant::value>                          alloc_version;
+   typedef container_detail::integral_constant  allocator_v1;
+   typedef container_detail::integral_constant  allocator_v2;
+
+   scoped_destroy_deallocator(pointer p, Allocator& a)
+      : m_ptr(p), m_alloc(a) {}
+
+   ~scoped_destroy_deallocator()
+   {
+      if(m_ptr){
+         AllocTraits::destroy(m_alloc, container_detail::to_raw_pointer(m_ptr));
+         priv_deallocate(m_ptr, alloc_version());
+      }
+   }
+
+   void release()
+   {  m_ptr = 0; }
+
+   private:
+
+   void priv_deallocate(const pointer &p, allocator_v1)
+   {  AllocTraits::deallocate(m_alloc, p, 1); }
+
+   void priv_deallocate(const pointer &p, allocator_v2)
+   {  m_alloc.deallocate_one(p); }
+
+   pointer     m_ptr;
+   Allocator&  m_alloc;
+};
+
 
 //!A deleter for scoped_ptr that destroys
 //!an object using a STL allocator.
@@ -85,13 +185,20 @@ struct scoped_destructor_n
 
    void increment_size(size_type inc)
    {  m_n += inc;   }
-   
+
+   void increment_size_backwards(size_type inc)
+   {  m_n += inc;   m_p -= inc;  }
+
+   void shrink_forward(size_type inc)
+   {  m_n -= inc;   m_p += inc;  }
+  
    ~scoped_destructor_n()
    {
       if(!m_p) return;
       value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
-      for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
+      while(m_n--){
          AllocTraits::destroy(m_a, raw_ptr);
+      }
    }
 
    private:
@@ -115,10 +222,59 @@ struct null_scoped_destructor_n
    void increment_size(size_type)
    {}
 
+   void increment_size_backwards(size_type)
+   {}
+
    void release()
    {}
 };
 
+template
+class scoped_destructor
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   public:
+   typedef typename A::value_type value_type;
+   scoped_destructor(A &a, value_type *pv)
+      : pv_(pv), a_(a)
+   {}
+
+   ~scoped_destructor()
+   {
+      if(pv_){
+         AllocTraits::destroy(a_, pv_);
+      }
+   }
+
+   void release()
+   {  pv_ = 0; }
+
+   private:
+   value_type *pv_;
+   A &a_;
+};
+
+
+template
+class value_destructor
+{
+   typedef boost::container::allocator_traits AllocTraits;
+   public:
+   typedef typename A::value_type value_type;
+   value_destructor(A &a, value_type &rv)
+      : rv_(rv), a_(a)
+   {}
+
+   ~value_destructor()
+   {
+      AllocTraits::destroy(a_, &rv_);
+   }
+
+   private:
+   value_type &rv_;
+   A &a_;
+};
+
 template 
 class allocator_destroyer
 {
@@ -149,13 +305,59 @@ class allocator_destroyer
    void operator()(const pointer &p)
    {
       AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
-      priv_deallocate(p, alloc_version());
+      this->priv_deallocate(p, alloc_version());
    }
 };
 
+template 
+class allocator_destroyer_and_chain_builder
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename A::multiallocation_chain    multiallocation_chain;
 
-}  //namespace container_detail { 
-}  //namespace container { 
+   A & a_;
+   multiallocation_chain &c_;
+
+   public:
+   allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c)
+      :  a_(a), c_(c)
+   {}
+
+   void operator()(const typename A::pointer &p)
+   {
+      allocator_traits::destroy(a_, container_detail::to_raw_pointer(p));
+      c_.push_back(p);
+   }
+};
+
+template 
+class allocator_multialloc_chain_node_deallocator
+{
+   typedef allocator_traits allocator_traits_type;
+   typedef typename allocator_traits_type::value_type value_type;
+   typedef typename A::multiallocation_chain    multiallocation_chain;
+   typedef allocator_destroyer_and_chain_builder chain_builder;
+
+   A & a_;
+   multiallocation_chain c_;
+
+   public:
+   allocator_multialloc_chain_node_deallocator(A &a)
+      :  a_(a), c_()
+   {}
+
+   chain_builder get_chain_builder()
+   {  return chain_builder(a_, c_);  }
+
+   ~allocator_multialloc_chain_node_deallocator()
+   {
+      a_.deallocate_individual(c_);
+   }
+};
+
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/flat_tree.hpp b/project/jni/boost/include/boost/container/detail/flat_tree.hpp
index 44438386a..2af12d431 100644
--- a/project/jni/boost/include/boost/container/detail/flat_tree.hpp
+++ b/project/jni/boost/include/boost/container/detail/flat_tree.hpp
@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -25,13 +25,15 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost {
 
@@ -46,24 +48,24 @@ class flat_tree_value_compare
    typedef Value              first_argument_type;
    typedef Value              second_argument_type;
    typedef bool               return_type;
-   public:     
+   public:    
    flat_tree_value_compare()
       : Compare()
    {}
 
-   flat_tree_value_compare(const Compare &pred) 
+   flat_tree_value_compare(const Compare &pred)
       : Compare(pred)
    {}
 
    bool operator()(const Value& lhs, const Value& rhs) const
-   { 
+   {
       KeyOfValue key_extract;
-      return Compare::operator()(key_extract(lhs), key_extract(rhs)); 
+      return Compare::operator()(key_extract(lhs), key_extract(rhs));
    }
 
    const Compare &get_comp() const
       {  return *this;  }
-   
+  
    Compare &get_comp()
       {  return *this;  }
 };
@@ -79,7 +81,7 @@ struct get_flat_tree_iterators
    typedef std::reverse_iterator      const_reverse_iterator;
 };
 
-template 
 class flat_tree
 {
@@ -90,7 +92,7 @@ class flat_tree
    typedef flat_tree_value_compare value_compare;
 
  private:
-   struct Data 
+   struct Data
       //Inherit from value_compare to do EBO
       : public value_compare
    {
@@ -102,19 +104,27 @@ class flat_tree
       {}
 
       Data(const Data &d)
-         : value_compare(d), m_vect(d.m_vect)
+         : value_compare(static_cast(d)), m_vect(d.m_vect)
       {}
 
       Data(BOOST_RV_REF(Data) d)
-         : value_compare(boost::move(d)), m_vect(boost::move(d.m_vect))
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect))
       {}
 
-      Data(const Compare &comp) 
+      Data(const Data &d, const A &a)
+         : value_compare(static_cast(d)), m_vect(d.m_vect, a)
+      {}
+
+      Data(BOOST_RV_REF(Data) d, const A &a)
+         : value_compare(boost::move(static_cast(d))), m_vect(boost::move(d.m_vect), a)
+      {}
+
+      Data(const Compare &comp)
          : value_compare(comp), m_vect()
       {}
 
       Data(const Compare &comp,
-           const allocator_t &alloc) 
+           const allocator_t &alloc)
          : value_compare(comp), m_vect(alloc)
       {}
 
@@ -165,6 +175,10 @@ class flat_tree
    //!Standard extension
    typedef allocator_type                             stored_allocator_type;
 
+   private:
+   typedef allocator_traits stored_allocator_traits;
+
+   public:
    flat_tree()
       : m_data()
    { }
@@ -177,7 +191,7 @@ class flat_tree
       : m_data(comp, a)
    { }
 
-   flat_tree(const flat_tree& x) 
+   flat_tree(const flat_tree& x)
       :  m_data(x.m_data)
    { }
 
@@ -185,6 +199,14 @@ class flat_tree
       :  m_data(boost::move(x.m_data))
    { }
 
+   flat_tree(const flat_tree& x, const allocator_type &a)
+      :  m_data(x.m_data, a)
+   { }
+
+   flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a)
+      :  m_data(boost::move(x.m_data), a)
+   { }
+
    template 
    flat_tree( ordered_range_t, InputIterator first, InputIterator last
             , const Compare& comp     = Compare()
@@ -192,6 +214,21 @@ class flat_tree
       : m_data(comp, a)
    { this->m_data.m_vect.insert(this->m_data.m_vect.end(), first, last); }
 
+   template 
+   flat_tree( bool unique_insertion
+            , InputIterator first, InputIterator last
+            , const Compare& comp     = Compare()
+            , const allocator_type& a = allocator_type())
+      : m_data(comp, a)
+   {
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         this->insert_equal(first, last);
+      }
+   }
+
    ~flat_tree()
    { }
 
@@ -201,66 +238,66 @@ class flat_tree
    flat_tree&  operator=(BOOST_RV_REF(flat_tree) mx)
    {  m_data = boost::move(mx.m_data); return *this;  }
 
-   public:    
+   public:   
    // accessors:
-   Compare key_comp() const 
+   Compare key_comp() const
    { return this->m_data.get_comp(); }
 
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return this->m_data.m_vect.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   const stored_allocator_type &get_stored_allocator() const
    {  return this->m_data.m_vect.get_stored_allocator(); }
 
    stored_allocator_type &get_stored_allocator()
    {  return this->m_data.m_vect.get_stored_allocator(); }
 
-   iterator begin() 
+   iterator begin()
    { return this->m_data.m_vect.begin(); }
 
-   const_iterator begin() const 
+   const_iterator begin() const
    { return this->cbegin(); }
 
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return this->m_data.m_vect.begin(); }
 
-   iterator end() 
+   iterator end()
    { return this->m_data.m_vect.end(); }
 
-   const_iterator end() const 
+   const_iterator end() const
    { return this->cend(); }
 
-   const_iterator cend() const 
+   const_iterator cend() const
    { return this->m_data.m_vect.end(); }
 
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin()
    { return reverse_iterator(this->end()); }
 
-   const_reverse_iterator rbegin() const 
+   const_reverse_iterator rbegin() const
    {  return this->crbegin();  }
 
-   const_reverse_iterator crbegin() const 
+   const_reverse_iterator crbegin() const
    {  return const_reverse_iterator(this->cend());  }
 
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return reverse_iterator(this->begin()); }
 
-   const_reverse_iterator rend() const 
-   { return this->crend(); } 
+   const_reverse_iterator rend() const
+   { return this->crend(); }
 
-   const_reverse_iterator crend() const 
-   { return const_reverse_iterator(this->cbegin()); } 
+   const_reverse_iterator crend() const
+   { return const_reverse_iterator(this->cbegin()); }
 
-   bool empty() const 
+   bool empty() const
    { return this->m_data.m_vect.empty(); }
 
-   size_type size() const 
+   size_type size() const
    { return this->m_data.m_vect.size(); }
 
-   size_type max_size() const 
+   size_type max_size() const
    { return this->m_data.m_vect.max_size(); }
 
-   void swap(flat_tree& other) 
+   void swap(flat_tree& other)
    {  this->m_data.swap(other.m_data);  }
 
    public:
@@ -268,9 +305,9 @@ class flat_tree
    std::pair insert_unique(const value_type& val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(val, data);
+      std::pair ret = this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, val);
+         ret.first = this->priv_insert_commit(data, val);
       }
       return ret;
    }
@@ -278,14 +315,13 @@ class flat_tree
    std::pair insert_unique(BOOST_RV_REF(value_type) val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(val, data);
+      std::pair ret = this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret;
    }
 
-
    iterator insert_equal(const value_type& val)
    {
       iterator i = this->upper_bound(KeyOfValue()(val));
@@ -303,9 +339,9 @@ class flat_tree
    iterator insert_unique(const_iterator pos, const value_type& val)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(pos, val, data);
+      std::pair ret = this->priv_insert_unique_prepare(pos, val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, val);
+         ret.first = this->priv_insert_commit(data, val);
       }
       return ret.first;
    }
@@ -313,9 +349,9 @@ class flat_tree
    iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(pos, mval, data);
+      std::pair ret = this->priv_insert_unique_prepare(pos, mval, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(mval));
+         ret.first = this->priv_insert_commit(data, boost::move(mval));
       }
       return ret.first;
    }
@@ -323,30 +359,169 @@ class flat_tree
    iterator insert_equal(const_iterator pos, const value_type& val)
    {
       insert_commit_data data;
-      priv_insert_equal_prepare(pos, val, data);
-      return priv_insert_commit(data, val);
+      this->priv_insert_equal_prepare(pos, val, data);
+      return this->priv_insert_commit(data, val);
    }
 
    iterator insert_equal(const_iterator pos, BOOST_RV_REF(value_type) mval)
    {
       insert_commit_data data;
-      priv_insert_equal_prepare(pos, mval, data);
-      return priv_insert_commit(data, boost::move(mval));
+      this->priv_insert_equal_prepare(pos, mval, data);
+      return this->priv_insert_commit(data, boost::move(mval));
    }
 
    template 
    void insert_unique(InIt first, InIt last)
+   {  this->priv_insert_unique_loop(first, last); }
+
+   template 
+   void insert_equal(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_equal_loop(first, last);  }
+
+   template 
+   void insert_equal(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      for ( ; first != last; ++first)
-         this->insert_unique(*first);
+      const size_type len = static_cast(std::distance(first, last));
+      this->reserve(this->size()+len);
+      this->priv_insert_equal_loop(first, last);
+   }
+
+   //Ordered
+
+   template 
+   void insert_equal(ordered_range_t, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_equal_loop_ordered(first, last); }
+
+   template 
+   void insert_equal(ordered_range_t, FwdIt first, FwdIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value &&
+		   container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      const size_type len = static_cast(std::distance(first, last));
+      this->reserve(this->size()+len);
+      this->priv_insert_equal_loop_ordered(first, last);
+   }
+
+   template 
+   void insert_equal(ordered_range_t, BidirIt first, BidirIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_input_iterator::value &&
+           !container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      size_type len = static_cast(std::distance(first, last));
+      const size_type BurstSize = 16;
+      size_type positions[BurstSize];
+
+      //Prereserve all memory so that iterators are not invalidated
+      this->reserve(this->size()+len);
+      const const_iterator b(this->cbegin());
+      const_iterator pos(b);
+      //Loop in burst sizes
+      while(len){
+         const size_type burst = len < BurstSize ? len : BurstSize;
+         const const_iterator ce(this->cend());
+         len -= burst;
+         for(size_type i = 0; i != burst; ++i){
+            //Get the insertion position for each key
+            pos = const_cast(*this).priv_upper_bound(pos, ce, KeyOfValue()(*first));
+            positions[i] = static_cast(pos - b);
+            ++first;
+         }
+         //Insert all in a single step in the precalculated positions
+         this->m_data.m_vect.insert_ordered_at(burst, positions + burst, first);
+         //Next search position updated
+         pos += burst;
+      }
    }
 
    template 
-   void insert_equal(InIt first, InIt last)
+   void insert_unique(ordered_unique_range_t, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value ||
+           container_detail::is_forward_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {  this->priv_insert_unique_loop_hint(first, last);  }
+
+   template 
+   void insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !(container_detail::is_input_iterator::value ||
+             container_detail::is_forward_iterator::value)
+         >::type * = 0
+      #endif
+      )
    {
-      typedef typename 
-         std::iterator_traits::iterator_category ItCat;
-      priv_insert_equal(first, last, ItCat());
+      size_type len = static_cast(std::distance(first, last));
+      const size_type BurstSize = 16;
+      size_type positions[BurstSize];
+      size_type skips[BurstSize];
+
+      //Prereserve all memory so that iterators are not invalidated
+      this->reserve(this->size()+len);
+      const const_iterator b(this->cbegin());
+      const_iterator pos(b);
+      const value_compare &value_comp = this->m_data;
+      skips[0u] = 0u;
+      //Loop in burst sizes
+      while(len){
+         const size_type burst = len < BurstSize ? len : BurstSize;
+         size_type unique_burst = 0u;
+         const const_iterator ce(this->cend());
+         while(unique_burst < burst && len > 0){
+            //Get the insertion position for each key
+            const value_type & val = *first++;
+            --len;
+            pos = const_cast(*this).priv_lower_bound(pos, ce, KeyOfValue()(val));
+            //Check if already present
+            if(pos != ce && !value_comp(val, *pos)){
+               if(unique_burst > 0){
+                  ++skips[unique_burst-1];
+               }
+               continue;
+            }
+
+            //If not present, calculate position
+            positions[unique_burst] = static_cast(pos - b);
+            skips[unique_burst++] = 0u;
+         }
+         if(unique_burst){
+            //Insert all in a single step in the precalculated positions
+            this->m_data.m_vect.insert_ordered_at(unique_burst, positions + unique_burst, skips + unique_burst, first);
+            //Next search position updated
+            pos += unique_burst;
+         }
+      }
    }
 
    #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -354,12 +529,16 @@ class flat_tree
    template 
    std::pair emplace_unique(Args&&... args)
    {
-      value_type && val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
       std::pair ret =
-         priv_insert_unique_prepare(val, data);
+         this->priv_insert_unique_prepare(val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret;
    }
@@ -367,11 +546,15 @@ class flat_tree
    template 
    iterator emplace_hint_unique(const_iterator hint, Args&&... args)
    {
-      value_type && val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
-      std::pair ret = priv_insert_unique_prepare(hint, val, data);
+      std::pair ret = this->priv_insert_unique_prepare(hint, val, data);
       if(ret.second){
-         ret.first = priv_insert_commit(data, boost::move(val));
+         ret.first = this->priv_insert_commit(data, boost::move(val));
       }
       return ret.first;
    }
@@ -379,7 +562,11 @@ class flat_tree
    template 
    iterator emplace_equal(Args&&... args)
    {
-      value_type &&val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       iterator i = this->upper_bound(KeyOfValue()(val));
       i = this->m_data.m_vect.insert(i, boost::move(val));
       return i;
@@ -388,10 +575,15 @@ class flat_tree
    template 
    iterator emplace_hint_equal(const_iterator hint, Args&&... args)
    {
-      value_type &&val = value_type(boost::forward(args)...);
+      aligned_storage::value> v;
+      value_type &val = *static_cast(static_cast(&v));
+      stored_allocator_type &a = this->get_stored_allocator();
+      stored_allocator_traits::construct(a, &val, ::boost::forward(args)... );
+      value_destructor d(a, val);
       insert_commit_data data;
-      priv_insert_equal_prepare(hint, val, data);
-      return priv_insert_commit(data, boost::move(val));
+      this->priv_insert_equal_prepare(hint, val, data);
+      iterator i = this->priv_insert_commit(data, boost::move(val));
+      return i;
    }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -401,14 +593,16 @@ class flat_tree
    std::pair                                                              \
       emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                  \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a, val);                                  \
       insert_commit_data data;                                                            \
-      std::pair ret = priv_insert_unique_prepare(val, data);               \
+      std::pair ret = this->priv_insert_unique_prepare(val, data);         \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val));                          \
+         ret.first = this->priv_insert_commit(data, boost::move(val));                    \
       }                                                                                   \
       return ret;                                                                         \
    }                                                                                      \
@@ -417,14 +611,16 @@ class flat_tree
    iterator emplace_hint_unique(const_iterator hint                                       \
                         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))      \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       insert_commit_data data;                                                            \
-      std::pair ret = priv_insert_unique_prepare(hint, val, data);         \
+      std::pair ret = this->priv_insert_unique_prepare(hint, val, data);   \
       if(ret.second){                                                                     \
-         ret.first = priv_insert_commit(data, boost::move(val));                          \
+         ret.first = this->priv_insert_commit(data, boost::move(val));                    \
       }                                                                                   \
       return ret.first;                                                                   \
    }                                                                                      \
@@ -432,10 +628,12 @@ class flat_tree
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
    iterator emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))             \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       iterator i = this->upper_bound(KeyOfValue()(val));                                  \
       i = this->m_data.m_vect.insert(i, boost::move(val));                                \
       return i;                                                                           \
@@ -445,14 +643,18 @@ class flat_tree
    iterator emplace_hint_equal(const_iterator hint                                        \
                       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))        \
    {                                                                                      \
-      BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), container_detail::value_init<) value_type         \
-         BOOST_PP_EXPR_IF(BOOST_PP_NOT(n), >) vval BOOST_PP_LPAREN_IF(n)                  \
-            BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) BOOST_PP_RPAREN_IF(n);  \
-      value_type &val = vval;                                                             \
+      aligned_storage::value> v;             \
+      value_type &val = *static_cast(static_cast(&v));              \
+      stored_allocator_type &a = this->get_stored_allocator();                            \
+      stored_allocator_traits::construct(a, &val                                          \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );                \
+      value_destructor d(a,  val);                                 \
       insert_commit_data data;                                                            \
-      priv_insert_equal_prepare(hint, val, data);                                         \
-      return priv_insert_commit(data, boost::move(val));                                  \
+      this->priv_insert_equal_prepare(hint, val, data);                                   \
+      iterator i = this->priv_insert_commit(data, boost::move(val));                      \
+      return i;                                                                           \
    }                                                                                      \
+
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
    #include BOOST_PP_LOCAL_ITERATE()
@@ -490,22 +692,22 @@ class flat_tree
    // set operations:
    iterator find(const key_type& k)
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       iterator i = this->lower_bound(k);
 
-      if (i != this->end() && key_comp(k, KeyOfValue()(*i))){  
-         i = this->end();  
+      if (i != this->end() && key_cmp(k, KeyOfValue()(*i))){ 
+         i = this->end(); 
       }
       return i;
    }
 
    const_iterator find(const key_type& k) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       const_iterator i = this->lower_bound(k);
 
-      if (i != this->end() && key_comp(k, KeyOfValue()(*i))){  
-         i = this->end();  
+      if (i != this->end() && key_cmp(k, KeyOfValue()(*i))){ 
+         i = this->end(); 
       }
       return i;
    }
@@ -535,11 +737,11 @@ class flat_tree
    std::pair equal_range(const key_type& k) const
    {  return this->priv_equal_range(this->begin(), this->end(), k);  }
 
-   size_type capacity() const           
+   size_type capacity() const          
    { return this->m_data.m_vect.capacity(); }
 
-   void reserve(size_type count)       
-   { this->m_data.m_vect.reserve(count);   }
+   void reserve(size_type cnt)      
+   { this->m_data.m_vect.reserve(cnt);   }
 
    private:
    struct insert_commit_data
@@ -567,29 +769,29 @@ class flat_tree
             data.position = pos;
          }
          else{
-            data.position = 
+            data.position =
                this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
          }
       }
       else{
-         data.position = 
+         data.position =
             this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
       }
    }
 
    std::pair priv_insert_unique_prepare
-      (const_iterator beg, const_iterator end, const value_type& val, insert_commit_data &commit_data)
+      (const_iterator b, const_iterator e, const value_type& val, insert_commit_data &commit_data)
    {
       const value_compare &value_comp  = this->m_data;
-      commit_data.position = this->priv_lower_bound(beg, end, KeyOfValue()(val));
+      commit_data.position = this->priv_lower_bound(b, e, KeyOfValue()(val));
       return std::pair
          ( *reinterpret_cast(&commit_data.position)
-         , commit_data.position == end || value_comp(val, *commit_data.position));
+         , commit_data.position == e || value_comp(val, *commit_data.position));
    }
 
    std::pair priv_insert_unique_prepare
       (const value_type& val, insert_commit_data &commit_data)
-   {  return priv_insert_unique_prepare(this->begin(), this->end(), val, commit_data);   }
+   {  return this->priv_insert_unique_prepare(this->begin(), this->end(), val, commit_data);   }
 
    std::pair priv_insert_unique_prepare
       (const_iterator pos, const value_type& val, insert_commit_data &commit_data)
@@ -652,7 +854,7 @@ class flat_tree
    RanIt priv_lower_bound(RanIt first, RanIt last,
                           const key_type & key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle;
@@ -662,7 +864,7 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key_extract(*middle), key)) {
+         if (key_cmp(key_extract(*middle), key)) {
             ++middle;
             first = middle;
             len = len - half - 1;
@@ -677,7 +879,7 @@ class flat_tree
    RanIt priv_upper_bound(RanIt first, RanIt last,
                           const key_type & key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle;
@@ -687,12 +889,12 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key, key_extract(*middle))) {
+         if (key_cmp(key, key_extract(*middle))) {
             len = half;
          }
          else{
             first = ++middle;
-            len = len - half - 1;  
+            len = len - half - 1; 
          }
       }
       return first;
@@ -702,7 +904,7 @@ class flat_tree
    std::pair
       priv_equal_range(RanIt first, RanIt last, const key_type& key) const
    {
-      const Compare &key_comp = this->m_data.get_comp();
+      const Compare &key_cmp = this->m_data.get_comp();
       KeyOfValue key_extract;
       difference_type len = last - first, half;
       RanIt middle, left, right;
@@ -712,12 +914,12 @@ class flat_tree
          middle = first;
          middle += half;
 
-         if (key_comp(key_extract(*middle), key)){
+         if (key_cmp(key_extract(*middle), key)){
             first = middle;
             ++first;
             len = len - half - 1;
          }
-         else if (key_comp(key, key_extract(*middle))){
+         else if (key_cmp(key, key_extract(*middle))){
             len = half;
          }
          else {
@@ -730,75 +932,94 @@ class flat_tree
       return std::pair(first, first);
    }
 
-   template 
-   void priv_insert_equal(FwdIt first, FwdIt last, std::forward_iterator_tag)
+   template
+   void priv_insert_equal_loop(InIt first, InIt last)
    {
-      size_type len = static_cast(std::distance(first, last));
-      this->reserve(this->size()+len);
-      this->priv_insert_equal(first, last, std::input_iterator_tag());
+      for ( ; first != last; ++first){
+         this->insert_equal(*first);
+      }
    }
 
-   template 
-   void priv_insert_equal(InIt first, InIt last, std::input_iterator_tag)
+   template
+   void priv_insert_equal_loop_ordered(InIt first, InIt last)
    {
-      for ( ; first != last; ++first)
-         this->insert_equal(*first);
+      const_iterator pos(this->cend());
+      for ( ; first != last; ++first){
+         pos = this->insert_equal(pos, *first);
+      }
+   }
+
+   template
+   void priv_insert_unique_loop(InIt first, InIt last)
+   {
+      for ( ; first != last; ++first){
+         this->insert_unique(*first);
+      }
+   }
+
+   template
+   void priv_insert_unique_loop_ordered(InIt first, InIt last)
+   {
+      const_iterator pos(this->cend());
+      for ( ; first != last; ++first){
+         pos = this->insert_unique(pos, *first);
+      }
    }
 };
 
-template 
-inline bool 
-operator==(const flat_tree& x, 
+inline bool
+operator==(const flat_tree& x,
            const flat_tree& y)
 {
   return x.size() == y.size() &&
          std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const flat_tree& x, 
+inline bool
+operator<(const flat_tree& x,
           const flat_tree& y)
 {
-  return std::lexicographical_compare(x.begin(), x.end(), 
+  return std::lexicographical_compare(x.begin(), x.end(),
                                       y.begin(), y.end());
 }
 
-template 
-inline bool 
-operator!=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator!=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(x == y); }
 
-template 
-inline bool 
-operator>(const flat_tree& x, 
-          const flat_tree& y) 
+inline bool
+operator>(const flat_tree& x,
+          const flat_tree& y)
    {  return y < x;  }
 
-template 
-inline bool 
-operator<=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator<=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(y < x);  }
 
-template 
-inline bool 
-operator>=(const flat_tree& x, 
-           const flat_tree& y) 
+inline bool
+operator>=(const flat_tree& x,
+           const flat_tree& y)
    {  return !(x < y);  }
 
 
-template 
-inline void 
-swap(flat_tree& x, 
+inline void
+swap(flat_tree& x,
      flat_tree& y)
    {  x.swap(y);  }
 
@@ -808,11 +1029,11 @@ swap(flat_tree& x,
 /*
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
 struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
 */
 }  //namespace boost {
diff --git a/project/jni/boost/include/boost/container/detail/function_detector.hpp b/project/jni/boost/include/boost/container/detail/function_detector.hpp
index c37c76684..5a5f6fd77 100644
--- a/project/jni/boost/include/boost/container/detail/function_detector.hpp
+++ b/project/jni/boost/include/boost/container/detail/function_detector.hpp
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga  2009-2011.
+// (C) Copyright Ion Gaztanaga  2009-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 //    (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,7 +15,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright 2007 Alexandre Courpron
 //
-// Permission to use, copy, modify, redistribute and sell this software, 
+// Permission to use, copy, modify, redistribute and sell this software,
 // provided that this copyright notice appears on all copies of the software.
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -74,7 +74,7 @@ namespace function_detector {
    public : \
       static const int check = NotFound + (sizeof(Test(0, 0)) - sizeof(NotFoundType));\
    };\
-}}} //namespace boost::container::function_detector { 
+}}} //namespace boost::container::function_detector {
 
 #define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
     ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
diff --git a/project/jni/boost/include/boost/container/detail/iterators.hpp b/project/jni/boost/include/boost/container/detail/iterators.hpp
index 899cbe434..f58c4ce63 100644
--- a/project/jni/boost/include/boost/container/detail/iterators.hpp
+++ b/project/jni/boost/include/boost/container/detail/iterators.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -20,12 +20,12 @@
 
 #include "config_begin.hpp"
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
-#include 
 #else
 #include 
 #endif
@@ -33,7 +33,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 
 template 
 class constant_iterator
@@ -50,9 +50,9 @@ class constant_iterator
    constant_iterator()
       :  m_ptr(0), m_num(0){}
 
-   constant_iterator& operator++() 
+   constant_iterator& operator++()
    { increment();   return *this;   }
-   
+  
    constant_iterator operator++(int)
    {
       constant_iterator result (*this);
@@ -60,9 +60,9 @@ class constant_iterator
       return result;
    }
 
-   constant_iterator& operator--() 
+   constant_iterator& operator--()
    { decrement();   return *this;   }
-   
+  
    constant_iterator operator--(int)
    {
       constant_iterator result (*this);
@@ -161,9 +161,9 @@ class default_construct_iterator
    default_construct_iterator()
       :  m_num(0){}
 
-   default_construct_iterator& operator++() 
+   default_construct_iterator& operator++()
    { increment();   return *this;   }
-   
+  
    default_construct_iterator operator++(int)
    {
       default_construct_iterator result (*this);
@@ -171,9 +171,9 @@ class default_construct_iterator
       return result;
    }
 
-   default_construct_iterator& operator--() 
+   default_construct_iterator& operator--()
    { decrement();   return *this;   }
-   
+  
    default_construct_iterator operator--(int)
    {
       default_construct_iterator result (*this);
@@ -222,14 +222,12 @@ class default_construct_iterator
    default_construct_iterator operator-(Difference off) const
    {  return *this + (-off);  }
 
-   const T& operator*() const
-   { return dereference(); }
-
-   const T* operator->() const
-   { return &(dereference()); }
-
-   const T& operator[] (Difference n) const
-   { return dereference(); }
+   //This pseudo-iterator's dereference operations have no sense since value is not
+   //constructed until ::boost::container::construct_in_place is called.
+   //So comment them to catch bad uses
+   //const T& operator*() const;
+   //const T& operator[](difference_type) const;
+   //const T* operator->() const;
 
    private:
    Difference  m_num;
@@ -247,7 +245,7 @@ class default_construct_iterator
    {  return other.m_num < m_num;   }
 
    const T & dereference() const
-   { 
+   {
       static T dummy;
       return dummy;
    }
@@ -273,9 +271,9 @@ class repeat_iterator
    repeat_iterator()
       :  m_ptr(0), m_num(0){}
 
-   this_type& operator++() 
+   this_type& operator++()
    { increment();   return *this;   }
-   
+  
    this_type operator++(int)
    {
       this_type result (*this);
@@ -283,9 +281,9 @@ class repeat_iterator
       return result;
    }
 
-   this_type& operator--() 
+   this_type& operator--()
    { increment();   return *this;   }
-   
+  
    this_type operator--(int)
    {
       this_type result (*this);
@@ -384,9 +382,9 @@ class emplace_iterator
    emplace_iterator()
       :  m_num(0), m_pe(0){}
 
-   this_type& operator++() 
+   this_type& operator++()
    { increment();   return *this;   }
-   
+  
    this_type operator++(int)
    {
       this_type result (*this);
@@ -394,9 +392,9 @@ class emplace_iterator
       return result;
    }
 
-   this_type& operator--() 
+   this_type& operator--()
    { decrement();   return *this;   }
-   
+  
    this_type operator--(int)
    {
       this_type result (*this);
@@ -445,14 +443,12 @@ class emplace_iterator
    this_type operator-(difference_type off) const
    {  return *this + (-off);  }
 
-   const T& operator*() const
-   { return dereference(); }
-
-   const T& operator[](difference_type) const
-   { return dereference(); }
-
-   const T* operator->() const
-   { return &(dereference()); }
+   //This pseudo-iterator's dereference operations have no sense since value is not
+   //constructed until ::boost::container::construct_in_place is called.
+   //So comment them to catch bad uses
+   //const T& operator*() const;
+   //const T& operator[](difference_type) const;
+   //const T* operator->() const;
 
    template
    void construct_in_place(A &a, T* ptr)
@@ -475,7 +471,7 @@ class emplace_iterator
    {  return other.m_num < m_num;   }
 
    const T & dereference() const
-   { 
+   {
       static T dummy;
       return dummy;
    }
@@ -506,14 +502,13 @@ struct emplace_functor
    void inplace_impl(A &a, T* ptr, const container_detail::index_tuple&)
    {
       allocator_traits::construct
-         (a, ptr, container_detail::stored_ref::forward
-          (container_detail::get(args_))...);
+         (a, ptr, ::boost::forward(container_detail::get(args_))...);
    }
 
    container_detail::tuple args_;
 };
 
-#else
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
 #define BOOST_PP_LOCAL_MACRO(n)                                                        \
    BOOST_PP_EXPR_IF(n, template <)                                                     \
@@ -522,16 +517,16 @@ struct emplace_functor
    struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                          \
    {                                                                                   \
       BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                              \
-         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                       \
-      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}    \
+         ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) )                        \
+      BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){}      \
                                                                                        \
       template                                                       \
       void operator()(A &a, T *ptr)                                                    \
       {                                                                                \
          allocator_traits::construct                                                \
-            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) );\
+            (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) ); \
       }                                                                                \
-      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                         \
+      BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _)                           \
    };                                                                                  \
    //!
 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -539,10 +534,78 @@ struct emplace_functor
 
 #endif
 
-}  //namespace container { 
+namespace container_detail {
+
+template
+struct has_iterator_category
+{
+   template 
+   static char test(int, typename X::iterator_category*);
+
+   template 
+   static int test(int, ...);
+
+   static const bool value = (1 == sizeof(test(0, 0)));
+};
+
+
+template::value >
+struct is_input_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_input_iterator
+{
+   static const bool value = false;
+};
+
+template::value >
+struct is_forward_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_forward_iterator
+{
+   static const bool value = false;
+};
+
+template::value >
+struct is_bidirectional_iterator
+{
+   static const bool value = is_same::value;
+};
+
+template
+struct is_bidirectional_iterator
+{
+   static const bool value = false;
+};
+
+template
+struct iiterator_types
+{
+   typedef typename std::iterator_traits::pointer         it_pointer;
+   typedef typename std::iterator_traits::difference_type difference_type;
+   typedef typename ::boost::intrusive::pointer_traits::
+      template rebind_pointer::type                               pointer;
+   typedef typename ::boost::intrusive::pointer_traits::
+      template rebind_pointer::type                         const_pointer;
+   typedef typename ::boost::intrusive::
+      pointer_traits::reference                             reference;
+   typedef typename ::boost::intrusive::
+      pointer_traits::reference                       const_reference;
+};
+
+
+}  //namespace container_detail {
+
+}  //namespace container {
 }  //namespace boost {
 
 #include 
 
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
-
diff --git a/project/jni/boost/include/boost/container/detail/math_functions.hpp b/project/jni/boost/include/boost/container/detail/math_functions.hpp
index 4613573d4..fe8386be6 100644
--- a/project/jni/boost/include/boost/container/detail/math_functions.hpp
+++ b/project/jni/boost/include/boost/container/detail/math_functions.hpp
@@ -1,10 +1,10 @@
 //////////////////////////////////////////////////////////////////////////////
 //
 // (C) Copyright Stephen Cleary 2000.
-// (C) Copyright Ion Gaztanaga 2007-2011.
+// (C) Copyright Ion Gaztanaga 2007-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
-//    (See accompanying file LICENSE_1_0.txt or copy at 
+//    (See accompanying file LICENSE_1_0.txt or copy at
 //    http://www.boost.org/LICENSE_1_0.txt)
 //
 // See http://www.boost.org/libs/container for documentation.
@@ -94,7 +94,7 @@ inline std::size_t floor_log2 (std::size_t x)
 
    std::size_t n = x;
    std::size_t log2 = 0;
-   
+  
    for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
       std::size_t tmp = n >> shift;
       if (tmp)
diff --git a/project/jni/boost/include/boost/container/allocator/memory_util.hpp b/project/jni/boost/include/boost/container/detail/memory_util.hpp
similarity index 98%
rename from project/jni/boost/include/boost/container/allocator/memory_util.hpp
rename to project/jni/boost/include/boost/container/detail/memory_util.hpp
index ea4bc0554..c00172c60 100644
--- a/project/jni/boost/include/boost/container/allocator/memory_util.hpp
+++ b/project/jni/boost/include/boost/container/detail/memory_util.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
diff --git a/project/jni/boost/include/boost/container/detail/mpl.hpp b/project/jni/boost/include/boost/container/detail/mpl.hpp
index c2d0ce41b..74a1ce0e6 100644
--- a/project/jni/boost/include/boost/container/detail/mpl.hpp
+++ b/project/jni/boost/include/boost/container/detail/mpl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,7 +20,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template 
@@ -109,24 +109,24 @@ struct if_
 
 
 template 
-struct select1st 
-//   : public std::unary_function 
+struct select1st
+//   : public std::unary_function
 {
    template
-   const typename Pair::first_type& operator()(const OtherPair& x) const 
+   const typename Pair::first_type& operator()(const OtherPair& x) const
    {  return x.first;   }
 
-   const typename Pair::first_type& operator()(const typename Pair::first_type& x) const 
+   const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
    {  return x;   }
 };
 
 // identity is an extension: it is not part of the standard.
 template 
-struct identity 
-//   : public std::unary_function 
+struct identity
+//   : public std::unary_function
 {
    typedef T type;
-   const T& operator()(const T& x) const 
+   const T& operator()(const T& x) const
    { return x; }
 };
 
@@ -152,8 +152,8 @@ template  struct unvoid { typedef T type; };
 template <> struct unvoid { struct type { }; };
 template <> struct unvoid { struct type { }; };
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #endif   //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
diff --git a/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp b/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
index a67fd770b..2e29f9c1a 100644
--- a/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
+++ b/project/jni/boost/include/boost/container/detail/multiallocation_chain.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace boost {
 namespace container {
@@ -45,30 +45,43 @@ class basic_multiallocation_chain
                     > slist_impl_t;
    slist_impl_t slist_impl_;
 
-   static node & to_node(VoidPointer p)
-   {  return *static_cast(static_cast(container_detail::to_raw_pointer(p))); }
+   typedef typename boost::intrusive::pointer_traits
+      ::template rebind_pointer::type    node_ptr;
+   typedef typename boost::intrusive::
+      pointer_traits                              node_ptr_traits;
+
+   static node & to_node(const VoidPointer &p)
+   {  return *static_cast(static_cast(container_detail::to_raw_pointer(p)));  }
+
+   static VoidPointer from_node(node &n)
+   {  return node_ptr_traits::pointer_to(n);  }
+
+   static node_ptr to_node_ptr(const VoidPointer &p)
+   {  return node_ptr_traits::static_cast_from(p);   }
 
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
 
    public:
 
-
-   typedef VoidPointer  void_pointer;
-   typedef typename slist_impl_t::iterator iterator;
-   typedef typename slist_impl_t::size_type size_type;
+   typedef VoidPointer                       void_pointer;
+   typedef typename slist_impl_t::iterator   iterator;
+   typedef typename slist_impl_t::size_type  size_type;
 
    basic_multiallocation_chain()
       :  slist_impl_()
    {}
 
+   basic_multiallocation_chain(const void_pointer &b, const void_pointer &before_e, size_type n)
+      :  slist_impl_(to_node_ptr(b), to_node_ptr(before_e), n)
+   {}
+
    basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
-      :  slist_impl_()
-   {  slist_impl_.swap(other.slist_impl_); }
+      :  slist_impl_(::boost::move(other.slist_impl_))
+   {}
 
    basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
    {
-      basic_multiallocation_chain tmp(boost::move(other));
-      this->swap(tmp);
+      slist_impl_ = ::boost::move(other.slist_impl_);
       return *this;
    }
 
@@ -96,37 +109,52 @@ class basic_multiallocation_chain
    iterator insert_after(iterator it, void_pointer m)
    {  return slist_impl_.insert_after(it, to_node(m));   }
 
-   void push_front(void_pointer m)
-   {  return slist_impl_.push_front(to_node(m));   }
+   void push_front(const void_pointer &m)
+   {  return slist_impl_.push_front(to_node(m));  }
 
-   void push_back(void_pointer m)
+   void push_back(const void_pointer &m)
    {  return slist_impl_.push_back(to_node(m));   }
 
-   void pop_front()
-   {  return slist_impl_.pop_front();   }
+   void_pointer pop_front()
+   {
+      node & n = slist_impl_.front();
+      void_pointer ret = from_node(n);
+      slist_impl_.pop_front();
+      return ret;
+   }
 
-   void *front()
-   {  return &*slist_impl_.begin();   }
-
-   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end)
-   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end);   }
-
-   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
-   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end, n);   }
+   void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+   {  slist_impl_.splice_after(after_this, x.slist_impl_, before_b, before_e, n);   }
 
    void splice_after(iterator after_this, basic_multiallocation_chain &x)
    {  slist_impl_.splice_after(after_this, x.slist_impl_);   }
 
-   void incorporate_after(iterator after_this, void_pointer begin , iterator before_end)
-   {  slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end));   }
+   void erase_after(iterator before_b, iterator e, size_type n)
+   {  slist_impl_.erase_after(before_b, e, n);   }
 
-   void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
-   {  slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end), n);   }
+   void_pointer incorporate_after(iterator after_this, const void_pointer &b, size_type unit_bytes, size_type num_units)
+   {
+      typedef typename boost::intrusive::pointer_traits char_pointer_traits;
+      char_ptr elem = char_pointer_traits::static_cast_from(b);
+      if(num_units){
+         char_ptr prev_elem = elem;
+         elem += unit_bytes;
+         for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
+            ::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem);
+            prev_elem = elem;
+         }
+         slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);
+      }
+      return elem;
+   }
+
+   void incorporate_after(iterator after_this, void_pointer b, void_pointer before_e, size_type n)
+   {  slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(before_e), n);   }
 
    void swap(basic_multiallocation_chain &x)
    {  slist_impl_.swap(x.slist_impl_);   }
 
-   static iterator iterator_to(void_pointer p)
+   static iterator iterator_to(const void_pointer &p)
    {  return slist_impl_t::s_iterator_to(to_node(p));   }
 
    std::pair extract_data()
@@ -150,63 +178,66 @@ struct cast_functor
 
 template
 class transform_multiallocation_chain
+   : public MultiallocationChain
 {
    private:
    BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
+   //transform_multiallocation_chain(const transform_multiallocation_chain &);
+   //transform_multiallocation_chain & operator=(const transform_multiallocation_chain &);
 
-   MultiallocationChain   holder_;
    typedef typename MultiallocationChain::void_pointer   void_pointer;
    typedef typename boost::intrusive::pointer_traits
-      ::template rebind_pointer::type   pointer;
+                                           void_pointer_traits;
+   typedef typename void_pointer_traits::template
+      rebind_pointer::type                            pointer;
+   typedef typename boost::intrusive::pointer_traits
+                                                pointer_traits;
 
-   static pointer cast(void_pointer p)
-   {
-      return pointer(static_cast(container_detail::to_raw_pointer(p)));
-   }
+   static pointer cast(const void_pointer &p)
+   {  return pointer_traits::static_cast_from(p);  }
 
    public:
    typedef transform_iterator
       < typename MultiallocationChain::iterator
-      , container_detail::cast_functor  >                 iterator;
-   typedef typename MultiallocationChain::size_type           size_type;
+      , container_detail::cast_functor  >             iterator;
+   typedef typename MultiallocationChain::size_type      size_type;
 
    transform_multiallocation_chain()
-      : holder_()
+      : MultiallocationChain()
    {}
 
    transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
-      : holder_()
-   {  this->swap(other); }
+      : MultiallocationChain(::boost::move(static_cast(other)))
+   {}
 
    transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
-      : holder_(boost::move(other))
+      : MultiallocationChain(::boost::move(static_cast(other)))
    {}
 
    transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
    {
-      transform_multiallocation_chain tmp(boost::move(other));
-      this->swap(tmp);
-      return *this;
+      return static_cast
+         (this->MultiallocationChain::operator=(::boost::move(static_cast(other))));
    }
-
-   void push_front(pointer mem)
+/*
+   void push_front(const pointer &mem)
    {  holder_.push_front(mem);  }
 
+   void push_back(const pointer &mem)
+   {  return holder_.push_back(mem);   }
+
    void swap(transform_multiallocation_chain &other_chain)
    {  holder_.swap(other_chain.holder_); }
 
-   void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
-   {  holder_.splice_after(after_this.base(), x.holder_, before_begin.base(), before_end.base(), n);  }
-
-   void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
-   {  holder_.incorporate_after(after_this.base(), begin, before_end, n);  }
-
-   void pop_front()
-   {  holder_.pop_front();  }
-
-   pointer front()
-   {  return cast(holder_.front());   }
+   void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+   {  holder_.splice_after(after_this.base(), x.holder_, before_b.base(), before_e.base(), n);  }
 
+   void incorporate_after(iterator after_this, pointer b, pointer before_e, size_type n)
+   {  holder_.incorporate_after(after_this.base(), b, before_e, n);  }
+*/
+   pointer pop_front()
+   {  return cast(this->MultiallocationChain::pop_front());  }
+/*
    bool empty() const
    {  return holder_.empty(); }
 
@@ -227,20 +258,21 @@ class transform_multiallocation_chain
 
    void clear()
    {  holder_.clear(); }
-
+*/
    iterator insert_after(iterator it, pointer m)
-   {  return iterator(holder_.insert_after(it.base(), m)); }
+   {  return iterator(this->MultiallocationChain::insert_after(it.base(), m)); }
 
-   static iterator iterator_to(pointer p)
+   static iterator iterator_to(const pointer &p)
    {  return iterator(MultiallocationChain::iterator_to(p));  }
 
-   std::pair extract_data()
-   {  return holder_.extract_data();  }
-
-   MultiallocationChain extract_multiallocation_chain()
+   std::pair extract_data()
    {
-      return MultiallocationChain(boost::move(holder_));
+      std::pair data(this->MultiallocationChain::extract_data());
+      return std::pair(cast(data.first), cast(data.second));
    }
+/*
+   MultiallocationChain &extract_multiallocation_chain()
+   {  return holder_;  }*/
 };
 
 }}}
diff --git a/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp b/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
index 9b0a0a524..7d851c06e 100644
--- a/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
+++ b/project/jni/boost/include/boost/container/detail/node_alloc_holder.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -21,120 +21,30 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
+#include 
+#include 
 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
 #include 
+#include 
 
 
 namespace boost {
 namespace container {
 namespace container_detail {
 
-//!A deleter for scoped_ptr that deallocates the memory
-//!allocated for an object using a STL allocator.
-template 
-struct scoped_deallocator
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::pointer pointer;
-   typedef container_detail::integral_constant::value>                   alloc_version;
-   typedef container_detail::integral_constant     allocator_v1;
-   typedef container_detail::integral_constant     allocator_v2;
-
-   private:
-   void priv_deallocate(allocator_v1)
-   {  m_alloc.deallocate(m_ptr, 1); }
-
-   void priv_deallocate(allocator_v2)
-   {  m_alloc.deallocate_one(m_ptr); }
-
-   BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
-
-   public:
-
-   pointer     m_ptr;
-   A&  m_alloc;
-
-   scoped_deallocator(pointer p, A& a)
-      : m_ptr(p), m_alloc(a)
-   {}
-
-   ~scoped_deallocator()
-   {  if (m_ptr)priv_deallocate(alloc_version());  }
-
-   scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
-      :  m_ptr(o.m_ptr), m_alloc(o.m_alloc)
-   {  o.release();  }
-
-   pointer get() const
-   {  return m_ptr;  }
-
-   void release()
-   {  m_ptr = 0; }
-};
-
-template 
-class allocator_destroyer_and_chain_builder
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::value_type value_type;
-   typedef typename A::multiallocation_chain    multiallocation_chain;
-
-   A & a_;
-   multiallocation_chain &c_;
-
-   public:
-   allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c)
-      :  a_(a), c_(c)
-   {}
-
-   void operator()(const typename A::pointer &p)
-   {
-      allocator_traits::destroy(a_, container_detail::to_raw_pointer(p));
-      c_.push_front(p);
-   }
-};
-
-template 
-class allocator_multialloc_chain_node_deallocator
-{
-   typedef allocator_traits allocator_traits_type;
-   typedef typename allocator_traits_type::value_type value_type;
-   typedef typename A::multiallocation_chain    multiallocation_chain;
-   typedef allocator_destroyer_and_chain_builder chain_builder;
-
-   A & a_;
-   multiallocation_chain c_;
-
-   public:
-   allocator_multialloc_chain_node_deallocator(A &a)
-      :  a_(a), c_()
-   {}
-
-   chain_builder get_chain_builder()
-   {  return chain_builder(a_, c_);  }
-
-   ~allocator_multialloc_chain_node_deallocator()
-   {
-      if(!c_.empty())
-         a_.deallocate_individual(boost::move(c_));
-   }
-};
-
 template
 struct node_compare
    :  private ValueCompare
@@ -181,6 +91,7 @@ struct node_alloc_holder
    typedef typename ICont::const_iterator             icont_citerator;
    typedef allocator_destroyer             Destroyer;
    typedef allocator_traits                NodeAllocTraits;
+   typedef allocator_version_traits        AllocVersionTraits;
 
    private:
    BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
@@ -188,11 +99,11 @@ struct node_alloc_holder
    public:
 
    //Constructors for sequence containers
-   node_alloc_holder() 
+   node_alloc_holder()
       : members_()
    {}
 
-   explicit node_alloc_holder(const ValAlloc &a) 
+   explicit node_alloc_holder(const ValAlloc &a)
       : members_(a)
    {}
 
@@ -205,7 +116,7 @@ struct node_alloc_holder
    {  this->icont().swap(x.icont());  }
 
    //Constructors for associative containers
-   explicit node_alloc_holder(const ValAlloc &a, const Pred &c) 
+   explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
       : members_(a, c)
    {}
 
@@ -223,7 +134,7 @@ struct node_alloc_holder
    {  this->icont().swap(x.icont());  }
 
    void copy_assign_alloc(const node_alloc_holder &x)
-   {  
+   { 
       container_detail::bool_ flag;
       container_detail::assign_alloc( static_cast(this->members_)
                                     , static_cast(x.members_), flag);
@@ -243,63 +154,25 @@ struct node_alloc_holder
    {  return allocator_traits_type::max_size(this->node_alloc());  }
 
    NodePtr allocate_one()
-   {  return this->allocate_one(alloc_version());   }
-
-   NodePtr allocate_one(allocator_v1)
-   {  return this->node_alloc().allocate(1);   }
-
-   NodePtr allocate_one(allocator_v2)
-   {  return this->node_alloc().allocate_one();   }
+   {  return AllocVersionTraits::allocate_one(this->node_alloc());   }
 
    void deallocate_one(const NodePtr &p)
-   {  return this->deallocate_one(p, alloc_version());   }
+   {  AllocVersionTraits::deallocate_one(this->node_alloc(), p);  }
 
-   void deallocate_one(const NodePtr &p, allocator_v1)
-   {  this->node_alloc().deallocate(p, 1);   }
-
-   void deallocate_one(const NodePtr &p, allocator_v2)
-   {  this->node_alloc().deallocate_one(p);   }
-/*
-   template
-   static void construct(A &a, const NodePtr &ptr,
-      BOOST_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
-   {
-      typedef typename Node::hook_type                hook_type;
-      typedef typename Node::value_type::first_type   first_type;
-      typedef typename Node::value_type::second_type  second_type;
-      Node *nodeptr = container_detail::to_raw_pointer(ptr);
-
-      //Hook constructor does not throw
-      allocator_traits::construct(a, static_cast(nodeptr));
-
-      //Now construct pair members_holder
-      value_type *valueptr = &nodeptr->get_data();
-      allocator_traits::construct(a, &valueptr->first, boost::move(value.first));
-      BOOST_TRY{
-         allocator_traits::construct(a, &valueptr->second, boost::move(value.second));
-      }
-      BOOST_CATCH(...){
-         allocator_traits::destroy(a, &valueptr->first);
-         BOOST_RETHROW
-      }
-      BOOST_CATCH_END
-   }
-*/
    #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-/*
-   template
-   static void construct(A &a, const NodePtr &ptr, Args &&...args)
-   {  
-   }
-*/
+
    template
    NodePtr create_node(Args &&...args)
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
       allocator_traits::construct
-         (this->node_alloc(), container_detail::to_raw_pointer(p), boost::forward(args)...);
+         ( this->node_alloc()
+         , container_detail::addressof(p->m_data), boost::forward(args)...);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -313,9 +186,11 @@ struct node_alloc_holder
       NodePtr p = this->allocate_one();                                                   \
       Deallocator node_deallocator(p, this->node_alloc());                                \
       allocator_traits::construct                                              \
-         (this->node_alloc(), container_detail::to_raw_pointer(p)                         \
+         (this->node_alloc(), container_detail::addressof(p->m_data)                      \
             BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));              \
       node_deallocator.release();                                                         \
+      typedef typename Node::hook_type hook_type;                                         \
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;      \
       return (p);                                                                         \
    }                                                                                      \
    //!
@@ -329,8 +204,11 @@ struct node_alloc_holder
    {
       NodePtr p = this->allocate_one();
       Deallocator node_deallocator(p, this->node_alloc());
-      ::boost::container::construct_in_place(this->node_alloc(), container_detail::to_raw_pointer(p), it);
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
       node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
       return (p);
    }
 
@@ -348,38 +226,51 @@ struct node_alloc_holder
    }
 
    template
-   FwdIterator allocate_many_and_construct
+   void allocate_many_and_construct
       (FwdIterator beg, difference_type n, Inserter inserter)
    {
-      if(n){
-         typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
+      /*
+      NodePtr p = this->allocate_one();
+      Deallocator node_deallocator(p, this->node_alloc());
+      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
+      node_deallocator.release();
+      //This does not throw
+      typedef typename Node::hook_type hook_type;
+      ::new(static_cast(container_detail::to_raw_pointer(p))) hook_type;
+      return (p);
+      */
+      typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
 
-         //Try to allocate memory in a single block
-         multiallocation_chain mem(this->node_alloc().allocate_individual(n));
-         int constructed = 0;
-         Node *p = 0;
-         BOOST_TRY{
-               for(difference_type i = 0; i < n; ++i, ++beg, --constructed){
-               p = container_detail::to_raw_pointer(mem.front());
-               mem.pop_front();
-               //This can throw
-               constructed = 0;
-               boost::container::construct_in_place(this->node_alloc(), p, beg);
-               ++constructed;
-               //This can throw in some containers (predicate might throw)
-               inserter(*p);
-            }
+      //Try to allocate memory in a single block
+      typedef typename multiallocation_chain::iterator multialloc_iterator;
+      multiallocation_chain mem;
+      this->node_alloc().allocate_individual(n, mem);
+      multialloc_iterator itbeg(mem.begin()), itlast(mem.last());
+      mem.clear();
+      Node *p = 0;
+      NodeAlloc &nalloc = this->node_alloc();
+      BOOST_TRY{
+         while(n--){
+            p = container_detail::to_raw_pointer(&*itbeg);
+            ++itbeg;
+            //This can throw
+            Deallocator node_deallocator(p, nalloc);
+            boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg);
+            ++beg;
+            node_deallocator.release();
+            //This does not throw
+            typedef typename Node::hook_type hook_type;
+            ::new(static_cast(p)) hook_type;
+            //This can throw in some containers (predicate might throw)
+            inserter(*p);
          }
-         BOOST_CATCH(...){
-            if(constructed){
-               allocator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(p));
-            }
-            this->node_alloc().deallocate_individual(boost::move(mem));
-            BOOST_RETHROW
-         }
-         BOOST_CATCH_END
       }
-      return beg;
+      BOOST_CATCH(...){
+         mem.incorporate_after(mem.last(), &*itbeg, &*itlast, n);
+         this->node_alloc().deallocate_individual(mem);
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
    }
 
    void clear(allocator_v1)
@@ -392,7 +283,7 @@ struct node_alloc_holder
       this->icont().clear_and_dispose(builder);
       //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled::value == true));
       if(!chain.empty())
-         this->node_alloc().deallocate_individual(boost::move(chain));
+         this->node_alloc().deallocate_individual(chain);
    }
 
    icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v1)
@@ -400,8 +291,13 @@ struct node_alloc_holder
 
    icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, allocator_v2)
    {
-      allocator_multialloc_chain_node_deallocator chain_holder(this->node_alloc());
-      return this->icont().erase_and_dispose(first, last, chain_holder.get_chain_builder());
+      typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
+      NodeAlloc & nalloc = this->node_alloc();
+      multiallocation_chain chain;
+      allocator_destroyer_and_chain_builder chain_builder(nalloc, chain);
+      icont_iterator ret_it = this->icont().erase_and_dispose(first, last, chain_builder);
+      nalloc.deallocate_individual(chain);
+      return ret_it;
    }
 
    template
diff --git a/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp b/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
index 9ee9e311c..53e35ac36 100644
--- a/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
+++ b/project/jni/boost/include/boost/container/detail/node_pool_impl.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -26,10 +26,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include    //std::unary_function
 
+
 namespace boost {
 namespace container {
 namespace container_detail {
@@ -85,19 +87,19 @@ class private_node_pool_impl
    {  return container_detail::to_raw_pointer(mp_segment_mngr_base);  }
 
    void *allocate_node()
-   {  return priv_alloc_node();  }
-   
+   {  return this->priv_alloc_node();  }
+  
    //!Deallocates an array pointed by ptr. Never throws
    void deallocate_node(void *ptr)
-   {  priv_dealloc_node(ptr); }
+   {  this->priv_dealloc_node(ptr); }
 
-   //!Allocates a singly linked list of n nodes ending in null pointer. 
-   multiallocation_chain allocate_nodes(const size_type n)
+   //!Allocates a singly linked list of n nodes ending in null pointer.
+   void allocate_nodes(const size_type n, multiallocation_chain &chain)
    {
       //Preallocate all needed blocks to fulfill the request
       size_type cur_nodes = m_freelist.size();
       if(cur_nodes < n){
-         priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
+         this->priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
       }
 
       //We just iterate the needed nodes to get the last we'll erase
@@ -118,20 +120,18 @@ class private_node_pool_impl
 
       //Now take the last erased node and just splice it in the end
       //of the intrusive list that will be traversed by the multialloc iterator.
-      multiallocation_chain chain;
       chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n);
       m_allocated += n;
-      return boost::move(chain);
    }
 
-   void deallocate_nodes(multiallocation_chain chain)
+   void deallocate_nodes(multiallocation_chain &chain)
    {
       typedef typename multiallocation_chain::iterator iterator;
       iterator it(chain.begin()), itend(chain.end());
       while(it != itend){
          void *pElem = &*it;
          ++it;
-         priv_dealloc_node(pElem);
+         this->priv_dealloc_node(pElem);
       }
    }
 
@@ -238,7 +238,7 @@ class private_node_pool_impl
       push_in_list(free_nodes_t &l, typename free_nodes_t::iterator &it)
          :  slist_(l), last_it_(it)
       {}
-      
+     
       void operator()(typename free_nodes_t::pointer p) const
       {
          slist_.push_front(*p);
@@ -258,10 +258,10 @@ class private_node_pool_impl
       is_between(const void *addr, std::size_t size)
          :  beg_(static_cast(addr)), end_(beg_+size)
       {}
-      
+     
       bool operator()(typename free_nodes_t::const_reference v) const
       {
-         return (beg_ <= reinterpret_cast(&v) && 
+         return (beg_ <= reinterpret_cast(&v) &&
                  end_ >  reinterpret_cast(&v));
       }
       private:
@@ -275,7 +275,7 @@ class private_node_pool_impl
    {
       //If there are no free nodes we allocate a new block
       if (m_freelist.empty())
-         priv_alloc_block();
+         this->priv_alloc_block(1);
       //We take the first free node
       node_t *n = (node_t*)&m_freelist.front();
       m_freelist.pop_front();
@@ -295,14 +295,13 @@ class private_node_pool_impl
    }
 
    //!Allocates several blocks of nodes. Can throw
-   void priv_alloc_block(size_type num_blocks = 1)
+   void priv_alloc_block(size_type num_blocks)
    {
-      if(!num_blocks)
-         return;
-      size_type blocksize = 
+      BOOST_ASSERT(num_blocks > 0);
+      size_type blocksize =
          get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of::value);
 
-      try{
+      BOOST_TRY{
          for(size_type i = 0; i != num_blocks; ++i){
             //We allocate a new NodeBlock and put it as first
             //element in the free Node list
@@ -311,17 +310,18 @@ class private_node_pool_impl
             char *pBlock = pNode;
             m_blocklist.push_front(get_block_hook(pBlock, blocksize));
 
-            //We initialize all Nodes in Node Block to insert 
+            //We initialize all Nodes in Node Block to insert
             //them in the free Node list
-            for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
+            for(size_type j = 0; j < m_nodes_per_block; ++j, pNode += m_real_node_size){
                m_freelist.push_front(*new (pNode) node_t);
             }
          }
       }
-      catch(...){
+      BOOST_CATCH(...){
          //to-do: if possible, an efficient way to deallocate allocated blocks
-         throw;
+         BOOST_RETHROW
       }
+      BOOST_CATCH_END
    }
 
    //!Deprecated, use deallocate_free_blocks
@@ -335,13 +335,13 @@ class private_node_pool_impl
    private:
    //!Returns a reference to the block hook placed in the end of the block
    static node_t & get_block_hook (void *block, size_type blocksize)
-   {  
-      return *reinterpret_cast(reinterpret_cast(block) + blocksize);  
+   { 
+      return *reinterpret_cast(reinterpret_cast(block) + blocksize); 
    }
 
    //!Returns the starting address of the block reference to the block hook placed in the end of the block
    void *get_block_from_hook (node_t *hook, size_type blocksize)
-   {  
+   { 
       return (reinterpret_cast(hook) - blocksize);
    }
 
diff --git a/project/jni/boost/include/boost/container/detail/pair.hpp b/project/jni/boost/include/boost/container/detail/pair.hpp
index 1aeff9113..79753a861 100644
--- a/project/jni/boost/include/boost/container/detail/pair.hpp
+++ b/project/jni/boost/include/boost/container/detail/pair.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,12 +20,15 @@
 #include "config_begin.hpp"
 #include 
 
+#include 
+#include 
 #include 
 #include 
 
 #include    //std::pair
+#include  //std::swap
 
-#include 
+#include 
 #include 
 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -33,7 +36,7 @@
 #endif
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template 
@@ -62,6 +65,33 @@ struct pair_nat;
 struct piecewise_construct_t { };
 static const piecewise_construct_t piecewise_construct = piecewise_construct_t();
 
+/*
+template 
+struct pair
+{
+    template  pair(pair&& p);
+    template 
+        pair(piecewise_construct_t, tuple first_args,
+             tuple second_args);
+
+    template  pair& operator=(const pair& p);
+    pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value &&
+                                       is_nothrow_move_assignable::value);
+    template  pair& operator=(pair&& p);
+
+    void swap(pair& p) noexcept(noexcept(swap(first, p.first)) &&
+                                noexcept(swap(second, p.second)));
+};
+
+template  bool operator==(const pair&, const pair&);
+template  bool operator!=(const pair&, const pair&);
+template  bool operator< (const pair&, const pair&);
+template  bool operator> (const pair&, const pair&);
+template  bool operator>=(const pair&, const pair&);
+template  bool operator<=(const pair&, const pair&);
+*/
+
+
 template 
 struct pair
 {
@@ -79,47 +109,40 @@ struct pair
    pair()
       : first(), second()
    {}
-/*
-   //pair from two values
-   pair(const T1 &t1, const T2 &t2)
-      : first(t1)
-      , second(t2)
-   {}
-
-
-   //pair from two values
-   pair(BOOST_RV_REF(T1) t1, BOOST_RV_REF(T2) t2)
-      : first(::boost::move(t1))
-      , second(::boost::move(t2))
-   {}
-*/
-   template
-   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
-      : first(::boost::forward(u))
-      , second(::boost::forward(v))
-   {}
 
    //pair copy assignment
    pair(const pair& x)
       : first(x.first), second(x.second)
    {}
 
-   template 
-   pair(const pair &p)
-      : first(p.first), second(p.second)
-   {}
-
    //pair move constructor
    pair(BOOST_RV_REF(pair) p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   pair(const pair &p)
+      : first(p.first), second(p.second)
+   {}
+
+   template 
+   pair(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   //std::pair copy constructor
+   //pair from two values
+   pair(const T1 &t1, const T2 &t2)
+      : first(t1)
+      , second(t2)
+   {}
+
+   template
+   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
+      : first(::boost::forward(u))
+      , second(::boost::forward(v))
+   {}
+
+   //And now compatibility with std::pair
    pair(const std::pair& x)
       : first(x.first), second(x.second)
    {}
@@ -129,17 +152,20 @@ struct pair
       : first(p.first), second(p.second)
    {}
 
-   //std::pair move constructor
-   template 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
-   pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   template 
+   pair(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
       : first(::boost::move(p.first)), second(::boost::move(p.second))
    {}
 
    //piecewise_construct missing
+   //template  pair(pair&& p);
+   //template 
+   //   pair(piecewise_construct_t, tuple first_args,
+   //        tuple second_args);
 /*
    //Variadic versions
    template
@@ -179,14 +205,6 @@ struct pair
       return *this;
    }
 
-   template 
-   pair& operator=(const pair&p)
-   {
-      first  = p.first;
-      second = p.second;
-      return *this;
-   }
-
    //pair move assignment
    pair& operator=(BOOST_RV_REF(pair) p)
    {
@@ -196,7 +214,23 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+   typename ::boost::container::container_detail::enable_if_c
+      < !(::boost::container::container_detail::is_same::value &&
+          ::boost::container::container_detail::is_same::value)
+      , pair &>::type
+      operator=(const pair&p)
+   {
+      first  = p.first;
+      second = p.second;
+      return *this;
+   }
+
+   template 
+   typename ::boost::container::container_detail::enable_if_c
+      < !(::boost::container::container_detail::is_same::value &&
+          ::boost::container::container_detail::is_same::value)
+      , pair &>::type
+      operator=(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -220,7 +254,7 @@ struct pair
    }
 
    //std::pair move assignment
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -228,7 +262,7 @@ struct pair
    }
 
    template 
-   pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+   pair& operator=(BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END p)
    {
       first  = ::boost::move(p.first);
       second = ::boost::move(p.second);
@@ -280,8 +314,8 @@ inline void swap(pair& x, pair& y)
    swap(x.second, y.second);
 }
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 
 
 //Without this specialization recursive flat_(multi)map instantiation fails
@@ -303,7 +337,7 @@ struct is_class< ::boost::container::container_detail::pair >
    : public ::boost::true_type
 {};
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
 
 template
 struct has_move_emulation_enabled< ::boost::container::container_detail::pair >
diff --git a/project/jni/boost/include/boost/container/detail/pool_common.hpp b/project/jni/boost/include/boost/container/detail/pool_common.hpp
index c66e2cd18..983d1413a 100644
--- a/project/jni/boost/include/boost/container/detail/pool_common.hpp
+++ b/project/jni/boost/include/boost/container/detail/pool_common.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -34,7 +34,7 @@ struct node_slist
    typedef slist_hook_t node_t;
 
    typedef typename bi::make_slist
-      , bi::base_hook >::type node_slist_t;
+      , bi::cache_last, bi::base_hook >::type node_slist_t;
 };
 
 template
diff --git a/project/jni/boost/include/boost/container/detail/preprocessor.hpp b/project/jni/boost/include/boost/container/detail/preprocessor.hpp
index 9916fbac6..4e175a82f 100644
--- a/project/jni/boost/include/boost/container/detail/preprocessor.hpp
+++ b/project/jni/boost/include/boost/container/detail/preprocessor.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -16,18 +16,14 @@
 #endif
 
 #include 
-
-#ifndef BOOST_NO_RVALUE_REFERENCES
-#include 
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
-
 #include 
+#include 
 
 #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 //#error "This file is not needed when perfect forwarding is available"
 #endif   //BOOST_CONTAINER_PERFECT_FORWARDING
 
-#include  
+#include 
 #include 
 #include 
 #include 
@@ -43,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
 
@@ -52,7 +49,7 @@
 //This cast is ugly but it is necessary until "perfect forwarding"
 //is achieved in C++0x. Meanwhile, if we want to be able to
 //bind rvalues with non-const references, we have to be ugly
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
    #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
    //!
@@ -60,9 +57,13 @@
    #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
    const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
    //!
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
+#endif   //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \
+const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
+//!
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
    #define BOOST_CONTAINER_PP_PARAM(U, u) \
    U && u \
    //!
@@ -70,37 +71,87 @@
    #define BOOST_CONTAINER_PP_PARAM(U, u) \
    const U & u \
    //!
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
+#endif   //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+   #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
+   BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ))           \
+   //!
 
-      #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
-      BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ))           \
-      //!
-
-   #else    //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-
-      #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
-      BOOST_PP_CAT(m_p, n) (static_cast( BOOST_PP_CAT(p, n) ))           \
-      //!
-
-   #endif   //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-
-#else //BOOST_NO_RVALUE_REFERENCES
+#else //BOOST_NO_CXX11_RVALUE_REFERENCES
 
    #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
    BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \
    //!
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
+#endif   //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
    #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
+      namespace boost {
+      namespace container {
+      namespace container_detail {
+         template
+         struct ref_holder;
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &t)
+               : t_(t)
+            {}
+            T &t_;
+            T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(const T &t)
+               : t_(t)
+            {}
+            const T &t_;
+            const T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(const T &t)
+               : t_(t)
+            {}
+            const T &t_;
+            const T & get() {  return t_;   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &&t)
+               : t_(t)
+            {}
+            T &t_;
+            T && get() {  return ::boost::move(t_);   }
+         };
+
+         template
+         struct ref_holder
+         {
+            explicit ref_holder(T &&t)
+               : t_(t)
+            {}
+            T &t_;
+            T && get()  { return ::boost::move(t_); }
+         };
+
+      }  //namespace container_detail {
+      }  //namespace container {
+      }  //namespace boost {
+
       #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
-      BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);            \
+         ::boost::container::container_detail::ref_holder BOOST_PP_CAT(m_p, n);  \
       //!
 
    #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
@@ -111,26 +162,25 @@
 
    #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-#else //BOOST_NO_RVALUE_REFERENCES
+#else //BOOST_NO_CXX11_RVALUE_REFERENCES
 
    #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data)  \
    BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n);             \
    //!
-#endif   //#ifndef BOOST_NO_RVALUE_REFERENCES
+#endif   //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
-   #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
-   ::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(this->m_p, n) ) \
+   #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \
    //!
 
-#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#else //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
    #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
-   boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \
+   ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \
    //!
 
-#endif   //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#endif   //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
 
 #define BOOST_CONTAINER_PP_PARAM_INC(z, n, data)   \
   BOOST_PP_CAT(++this->m_p, n)                     \
@@ -140,11 +190,11 @@
 
 
 #define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \
-boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
+::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
 //!
 
 #define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \
-boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
+::boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \
 //!
 
 #define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \
@@ -152,7 +202,11 @@ BOOST_PP_CAT(*this->m_p, n) \
 //!
 
 #define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data)   \
-  BOOST_PP_CAT(class P, n) = void                                      \
+  BOOST_PP_CAT(class P, n) = void                                    \
+//!
+
+#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \
+  BOOST_PP_CAT(class P, n) = default_type                                  \
 //!
 
 #define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \
diff --git a/project/jni/boost/include/boost/container/detail/stored_ref.hpp b/project/jni/boost/include/boost/container/detail/stored_ref.hpp
deleted file mode 100644
index df0faa85a..000000000
--- a/project/jni/boost/include/boost/container/detail/stored_ref.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/container for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_CONTAINER_DETAIL_STORED_REF_HPP
-#define BOOST_CONTAINER_DETAIL_STORED_REF_HPP
-
-#include "config_begin.hpp"
-#include 
-
-#ifndef BOOST_NO_RVALUE_REFERENCES
-
-namespace boost{
-namespace container{
-namespace container_detail{
-
-template
-struct stored_ref
-{
-
-   static T && forward(T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return boost::move(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T && forward(const T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return static_cast(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static T && forward(T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return boost::move(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T && forward(const T &t)
-   #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
-   { return t; }
-   #else
-   { return static_cast(t); }
-   #endif
-};
-
-template
-struct stored_ref
-{
-   static const T & forward(const T &t)
-   {  return t; }
-};
-
-template
-struct stored_ref
-{
-   static T & forward(T &t)
-   {  return t; }
-};
-
-}  //namespace container_detail{
-}  //namespace container{
-}  //namespace boost{
-
-#else
-#error "This header can be included only for compiler with rvalue references"
-#endif   //BOOST_NO_RVALUE_REFERENCES
-
-#include 
-
-#endif   //BOOST_CONTAINER_DETAIL_STORED_REF_HPP
diff --git a/project/jni/boost/include/boost/container/detail/transform_iterator.hpp b/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
index 17eca9ef6..98f5c04d6 100644
--- a/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
+++ b/project/jni/boost/include/boost/container/detail/transform_iterator.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 // (C) Copyright Gennaro Prota 2003 - 2004.
 //
 // Distributed under the Boost Software License, Version 1.0.
@@ -24,7 +24,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 
 template 
 struct operator_arrow_proxy
@@ -74,7 +74,7 @@ class transform_iterator
    {}
 
    //Constructors
-   transform_iterator& operator++() 
+   transform_iterator& operator++()
    { increment();   return *this;   }
 
    transform_iterator operator++(int)
@@ -168,7 +168,7 @@ make_transform_iterator(Iterator it, UnaryFunc fun)
    return transform_iterator(it, fun);
 }
 
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/tree.hpp b/project/jni/boost/include/boost/container/detail/tree.hpp
index 6cd91ed2a..9cb3c9f80 100644
--- a/project/jni/boost/include/boost/container/detail/tree.hpp
+++ b/project/jni/boost/include/boost/container/detail/tree.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -15,7 +15,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -27,7 +27,8 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
@@ -41,15 +42,15 @@ namespace container {
 namespace container_detail {
 
 template
-struct value_compare_impl
+struct tree_value_compare
    :  public KeyCompare
 {
    typedef Value        value_type;
-   typedef KeyCompare   key_compare; 
+   typedef KeyCompare   key_compare;
    typedef KeyOfValue   key_of_value;
    typedef Key          key_type;
 
-   value_compare_impl(const key_compare &kcomp)
+   tree_value_compare(const key_compare &kcomp)
       :  key_compare(kcomp)
    {}
 
@@ -90,70 +91,38 @@ struct rbtree_hook
       >::type  type;
 };
 
+//This trait is used to type-pun std::pair because in C++03
+//compilers std::pair is useless for C++11 features
 template
-struct rbtree_type
+struct rbtree_internal_data_type
 {
    typedef T type;
 };
 
 template
-struct rbtree_type< std::pair >
+struct rbtree_internal_data_type< std::pair >
 {
    typedef pair type;
 };
 
+
+//The node to be store in the tree
 template 
 struct rbtree_node
    :  public rbtree_hook::type
 {
    private:
-   BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+   //BOOST_COPYABLE_AND_MOVABLE(rbtree_node)
+   rbtree_node();
 
    public:
    typedef typename rbtree_hook::type hook_type;
 
    typedef T value_type;
-   typedef typename rbtree_type::type internal_type;
+   typedef typename rbtree_internal_data_type::type internal_type;
 
    typedef rbtree_node node_type;
 
-   rbtree_node()
-      : m_data()
-   {}
-
-   rbtree_node(const rbtree_node &other)
-      : m_data(other.m_data)
-   {}
-
-   rbtree_node(BOOST_RV_REF(rbtree_node) other)
-      : m_data(boost::move(other.m_data))
-   {}
-
-   #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                           \
-   template                                \
-   rbtree_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))           \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))        \
-   {}                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   template
-   rbtree_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   rbtree_node &operator=(const rbtree_node &other)
-   {  do_assign(other.m_data);   return *this;  }
-
-   rbtree_node &operator=(BOOST_RV_REF(rbtree_node) other)
-   {  do_move(other.m_data);   return *this;  }
-
    T &get_data()
    {
       T* ptr = reinterpret_cast(&this->m_data);
@@ -166,7 +135,6 @@ struct rbtree_node
       return *ptr;
    }
 
-   private:
    internal_type m_data;
 
    template
@@ -188,22 +156,22 @@ struct rbtree_node
    {  m_data = v; }
 
    template
-   void do_move(std::pair &p)
+   void do_move_assign(std::pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      const_cast(m_data.first) = ::boost::move(p.first);
+      m_data.second = ::boost::move(p.second);
    }
 
    template
-   void do_move(pair &p)
+   void do_move_assign(pair &p)
    {
-      const_cast(m_data.first) = boost::move(p.first);
-      m_data.second  = boost::move(p.second);
+      const_cast(m_data.first) = ::boost::move(p.first);
+      m_data.second  = ::boost::move(p.second);
    }
 
    template
-   void do_move(V &v)
-   {  m_data = boost::move(v); }
+   void do_move_assign(V &v)
+   {  m_data = ::boost::move(v); }
 };
 
 }//namespace container_detail {
@@ -236,22 +204,22 @@ struct intrusive_rbtree_type
 
 namespace container_detail {
 
-template 
 class rbtree
    : protected container_detail::node_alloc_holder
       < A
       , typename container_detail::intrusive_rbtree_type
-           
+          
          >::type
       , KeyCompare
       >
 {
    typedef typename container_detail::intrusive_rbtree_type
-         < A, value_compare_impl
+         < A, tree_value_compare
             
          >::type                                            Icont;
-   typedef container_detail::node_alloc_holder  
+   typedef container_detail::node_alloc_holder 
                                       AllocHolder;
    typedef typename AllocHolder::NodePtr                    NodePtr;
    typedef rbtree < Key, Value, KeyOfValue
@@ -280,22 +248,23 @@ class rbtree
       {
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
-            try{
+            BOOST_TRY{
                //This can throw
-               *p = other;
+               p->do_assign(other.m_data);
                return p;
             }
-            catch(...){
+            BOOST_CATCH(...){
                //If there is an exception destroy the whole source
                m_holder.destroy_node(p);
                while((p = m_icont.unlink_leftmost_without_rebalance())){
                   m_holder.destroy_node(p);
                }
-               throw;
+               BOOST_RETHROW
             }
+            BOOST_CATCH_END
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -317,22 +286,23 @@ class rbtree
       {
          if(NodePtr p = m_icont.unlink_leftmost_without_rebalance()){
             //First recycle a node (this can't throw)
-            try{
+            BOOST_TRY{
                //This can throw
-               *p = boost::move(other);
+               p->do_move_assign(const_cast(other).m_data);
                return p;
             }
-            catch(...){
+            BOOST_CATCH(...){
                //If there is an exception destroy the whole source
                m_holder.destroy_node(p);
                while((p = m_icont.unlink_leftmost_without_rebalance())){
                   m_holder.destroy_node(p);
                }
-               throw;
+               BOOST_RETHROW
             }
+            BOOST_CATCH_END
          }
          else{
-            return m_holder.create_node(other);
+            return m_holder.create_node(other.m_data);
          }
       }
 
@@ -348,7 +318,7 @@ class rbtree
    typedef Value                                      value_type;
    typedef A                                          allocator_type;
    typedef KeyCompare                                 key_compare;
-   typedef value_compare_impl< Key, Value
+   typedef tree_value_compare< Key, Value
                         , KeyCompare, KeyOfValue>     value_compare;
    typedef typename boost::container::
       allocator_traits::pointer                    pointer;
@@ -431,17 +401,17 @@ class rbtree
       {}
 
       //Pointer like operators
-      const_reference operator*()  const 
+      const_reference operator*()  const
       { return  m_it->get_data();  }
 
-      const_pointer   operator->() const 
+      const_pointer   operator->() const
       { return  const_pointer(&m_it->get_data()); }
 
       //Increment / Decrement
-      const_iterator& operator++()       
+      const_iterator& operator++()      
       { prot_incr();  return *this; }
 
-      const_iterator operator++(int)      
+      const_iterator operator++(int)     
       { iiterator tmp = m_it; ++*this; return const_iterator(tmp);  }
 
       const_iterator& operator--()
@@ -465,7 +435,7 @@ class rbtree
       explicit iterator(iiterator it)
          :  const_iterator(it)
       {}
-   
+  
       iiterator get()
       {  return this->m_it;   }
 
@@ -478,16 +448,18 @@ class rbtree
       iterator(){}
 
       //Pointer like operators
-      reference operator*()  const {  return  this->m_it->get_data();  }
-      pointer   operator->() const {  return  pointer(&this->m_it->get_data());  }
+      reference operator*()  const
+         {  return this->m_it->get_data();  }
+      pointer   operator->() const
+         {  return boost::intrusive::pointer_traits::pointer_to(this->m_it->get_data());  }
 
       //Increment / Decrement
-      iterator& operator++()  
+      iterator& operator++() 
          { this->prot_incr(); return *this;  }
 
       iterator operator++(int)
          { iiterator tmp = this->m_it; ++*this; return iterator(tmp); }
-      
+     
       iterator& operator--()
          {  this->prot_decr(); return *this;  }
 
@@ -507,34 +479,109 @@ class rbtree
    {}
 
    template 
-   rbtree(InputIterator first, InputIterator last, const key_compare& comp,
-          const allocator_type& a, bool unique_insertion)
+   rbtree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
+          const allocator_type& a
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < container_detail::is_input_iterator::value
+            || container_detail::is_same::value
+         >::type * = 0
+      #endif
+         )
       : AllocHolder(a, comp)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(first, last, unique_insertion, alloc_version(), ItCat());
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         this->insert_equal(first, last);
+      }
+   }
+
+   template 
+   rbtree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
+          const allocator_type& a
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !(container_detail::is_input_iterator::value
+            || container_detail::is_same::value)
+         >::type * = 0
+      #endif
+         )
+      : AllocHolder(a, comp)
+   {
+      if(unique_insertion){
+         this->insert_unique(first, last);
+      }
+      else{
+         //Optimized allocation and construction
+         this->allocate_many_and_construct
+            (first, std::distance(first, last), insert_equal_end_hint_functor(this->icont()));
+      }
    }
 
    template 
    rbtree( ordered_range_t, InputIterator first, InputIterator last
-         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type())
+         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
+         #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , typename container_detail::enable_if_c
+            < container_detail::is_input_iterator::value
+               || container_detail::is_same::value
+            >::type * = 0
+         #endif
+         )
       : AllocHolder(a, comp)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_ordered_nodes(first, last, alloc_version(), ItCat());
+      this->insert_equal(first, last);
    }
 
-   rbtree(const rbtree& x) 
+   template 
+   rbtree( ordered_range_t, InputIterator first, InputIterator last
+         , const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
+         #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , typename container_detail::enable_if_c
+            < !(container_detail::is_input_iterator::value
+               || container_detail::is_same::value)
+            >::type * = 0
+         #endif
+         )
+      : AllocHolder(a, comp)
+   {
+      //Optimized allocation and construction
+      this->allocate_many_and_construct
+         (first, std::distance(first, last), push_back_functor(this->icont()));
+   }
+
+   rbtree(const rbtree& x)
       :  AllocHolder(x, x.key_comp())
    {
       this->icont().clone_from
          (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
    }
 
-   rbtree(BOOST_RV_REF(rbtree) x) 
-      :  AllocHolder(boost::move(static_cast(x)), x.key_comp())
+   rbtree(BOOST_RV_REF(rbtree) x)
+      :  AllocHolder(::boost::move(static_cast(x)), x.key_comp())
    {}
 
+   rbtree(const rbtree& x, const allocator_type &a)
+      :  AllocHolder(a, x.key_comp())
+   {
+      this->icont().clone_from
+         (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+   }
+
+   rbtree(BOOST_RV_REF(rbtree) x, const allocator_type &a)
+      :  AllocHolder(a, x.key_comp())
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->icont().clone_from
+            (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
+      }
+   }
+
    ~rbtree()
    {} //AllocHolder clears the tree
 
@@ -552,7 +599,7 @@ class rbtree
          //Transfer all the nodes to a temporary tree
          //If anything goes wrong, all the nodes will be destroyed
          //automatically
-         Icont other_tree(boost::move(this->icont()));
+         Icont other_tree(::boost::move(this->icont()));
 
          //Now recreate the source tree reusing nodes stored by other_tree
          this->icont().clone_from
@@ -578,7 +625,7 @@ class rbtree
          if(this_alloc == x_alloc){
             //Destroy and swap pointers
             this->clear();
-            this->icont() = boost::move(x.icont());
+            this->icont() = ::boost::move(x.icont());
             //Move allocator if needed
             this->AllocHolder::move_assign_alloc(x);
          }
@@ -587,7 +634,7 @@ class rbtree
             //Transfer all the nodes to a temporary tree
             //If anything goes wrong, all the nodes will be destroyed
             //automatically
-            Icont other_tree(boost::move(this->icont()));
+            Icont other_tree(::boost::move(this->icont()));
 
             //Now recreate the source tree reusing nodes stored by other_tree
             this->icont().clone_from
@@ -605,18 +652,18 @@ class rbtree
       return *this;
    }
 
-   public:    
+   public:   
    // accessors:
-   value_compare value_comp() const 
+   value_compare value_comp() const
    {  return this->icont().value_comp().value_comp(); }
 
-   key_compare key_comp() const 
+   key_compare key_comp() const
    {  return this->icont().value_comp().value_comp().key_comp(); }
 
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    {  return allocator_type(this->node_alloc()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   const stored_allocator_type &get_stored_allocator() const
    {  return this->node_alloc(); }
 
    stored_allocator_type &get_stored_allocator()
@@ -647,46 +694,46 @@ class rbtree
    {  return this->crend();   }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return const_iterator(this->non_const_icont().begin()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return const_iterator(this->non_const_icont().end()); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return const_reverse_iterator(cend()); } 
+   const_reverse_iterator crbegin() const
+   { return const_reverse_iterator(cend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return const_reverse_iterator(cbegin()); }
 
-   bool empty() const 
+   bool empty() const
    {  return !this->size();  }
 
-   size_type size() const 
+   size_type size() const
    {  return this->icont().size();   }
 
-   size_type max_size() const 
+   size_type max_size() const
    {  return AllocHolder::max_size();  }
 
    void swap(ThisType& x)
@@ -700,7 +747,7 @@ class rbtree
    std::pair insert_unique_check
       (const key_type& key, insert_commit_data &data)
    {
-      std::pair ret = 
+      std::pair ret =
          this->icont().insert_unique_check(key, KeyNodeCompare(value_comp()), data);
       return std::pair(iterator(ret.first), ret.second);
    }
@@ -708,7 +755,7 @@ class rbtree
    std::pair insert_unique_check
       (const_iterator hint, const key_type& key, insert_commit_data &data)
    {
-      std::pair ret = 
+      std::pair ret =
          this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(value_comp()), data);
       return std::pair(iterator(ret.first), ret.second);
    }
@@ -757,12 +804,14 @@ class rbtree
    {
       value_type &v = p->get_data();
       insert_commit_data data;
+      scoped_destroy_deallocator destroy_deallocator(p, this->node_alloc());
       std::pair ret =
          this->insert_unique_check(KeyOfValue()(v), data);
       if(!ret.second){
-         Destroyer(this->node_alloc())(p);
          return ret;
       }
+      //No throw insertion part, release rollback
+      destroy_deallocator.release();
       return std::pair
          ( iterator(iiterator(this->icont().insert_unique_commit(*p, data)))
          , true );
@@ -872,9 +921,9 @@ class rbtree
       if(this->empty()){
          //Insert with end hint, to achieve linear
          //complexity if [first, last) is ordered
-         const_iterator end(this->end());
+         const_iterator hint(this->cend());
          for( ; first != last; ++first)
-            this->insert_unique(end, *first);
+            hint = this->insert_unique(hint, *first);
       }
       else{
          for( ; first != last; ++first)
@@ -913,9 +962,9 @@ class rbtree
    {
       //Insert with end hint, to achieve linear
       //complexity if [first, last) is ordered
-      const_iterator end(this->cend());
+      const_iterator hint(this->cend());
       for( ; first != last; ++first)
-         this->insert_equal(end, *first);
+         hint = this->insert_equal(hint, *first);
    }
 
    iterator erase(const_iterator position)
@@ -927,7 +976,7 @@ class rbtree
    iterator erase(const_iterator first, const_iterator last)
    {  return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
 
-   void clear() 
+   void clear()
    {  AllocHolder::clear(alloc_version());  }
 
    // set operations:
@@ -953,14 +1002,14 @@ class rbtree
    {  return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(value_comp())));  }
 
    std::pair equal_range(const key_type& k)
-   {  
+   {
       std::pair ret =
          this->icont().equal_range(k, KeyNodeCompare(value_comp()));
       return std::pair(iterator(ret.first), iterator(ret.second));
    }
 
    std::pair equal_range(const key_type& k) const
-   {  
+   {
       std::pair ret =
          this->non_const_icont().equal_range(k, KeyNodeCompare(value_comp()));
       return std::pair
@@ -968,167 +1017,98 @@ class rbtree
    }
 
    private:
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (InpIterator beg, InpIterator end, bool unique, allocator_v1, std::input_iterator_tag)
-   {
-      if(unique){
-         for (; beg != end; ++beg){
-            this->insert_unique(*beg);
-         }
-      }
-      else{
-         for (; beg != end; ++beg){
-            this->insert_equal(*beg);
-         }
-      }
-   }
 
-   template
-   void priv_create_and_insert_nodes
-      (InpIterator beg, InpIterator end, bool unique, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(beg, end, unique, allocator_v1(), std::input_iterator_tag());
-   }
+   class insert_equal_end_hint_functor;
+   friend class insert_equal_end_hint_functor;
 
-   class insertion_functor;
-   friend class insertion_functor;
-
-   class insertion_functor
+   class insert_equal_end_hint_functor
    {
       Icont &icont_;
+      const iconst_iterator cend_;
 
       public:
-      insertion_functor(Icont &icont)
-         :  icont_(icont)
+      insert_equal_end_hint_functor(Icont &icont)
+         :  icont_(icont), cend_(this->icont_.cend())
       {}
 
       void operator()(Node &n)
-      {  this->icont_.insert_equal(this->icont_.cend(), n); }
+      {  this->icont_.insert_equal(cend_, n); }
    };
 
+   class push_back_functor;
+   friend class push_back_functor;
 
-   template
-   void priv_create_and_insert_nodes
-      (FwdIterator beg, FwdIterator end, bool unique, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         if(unique){
-            priv_create_and_insert_nodes(beg, end, unique, allocator_v2(), std::input_iterator_tag());
-         }
-         else{
-            //Optimized allocation and construction
-            this->allocate_many_and_construct
-               (beg, std::distance(beg, end), insertion_functor(this->icont()));
-         }
-      }
-   }
-
-   //Iterator range version
-   template
-   void priv_create_and_insert_ordered_nodes
-      (InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
-   {
-      const_iterator cend_n(this->cend());
-      for (; beg != end; ++beg){
-         this->insert_before(cend_n, *beg);
-      }
-   }
-
-   template
-   void priv_create_and_insert_ordered_nodes
-      (InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_ordered_nodes(beg, end, allocator_v1(), std::input_iterator_tag());
-   }
-
-   class back_insertion_functor;
-   friend class back_insertion_functor;
-
-   class back_insertion_functor
+   class push_back_functor
    {
       Icont &icont_;
 
       public:
-      back_insertion_functor(Icont &icont)
+      push_back_functor(Icont &icont)
          :  icont_(icont)
       {}
 
       void operator()(Node &n)
       {  this->icont_.push_back(n); }
    };
-
-
-   template
-   void priv_create_and_insert_ordered_nodes
-      (FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         //Optimized allocation and construction
-         this->allocate_many_and_construct
-            (beg, std::distance(beg, end), back_insertion_functor(this->icont()));
-      }
-   }
 };
 
-template 
-inline bool 
-operator==(const rbtree& x, 
+inline bool
+operator==(const rbtree& x,
            const rbtree& y)
 {
   return x.size() == y.size() &&
          std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const rbtree& x, 
+inline bool
+operator<(const rbtree& x,
           const rbtree& y)
 {
-  return std::lexicographical_compare(x.begin(), x.end(), 
+  return std::lexicographical_compare(x.begin(), x.end(),
                                       y.begin(), y.end());
 }
 
-template 
-inline bool 
-operator!=(const rbtree& x, 
+inline bool
+operator!=(const rbtree& x,
            const rbtree& y) {
   return !(x == y);
 }
 
-template 
-inline bool 
-operator>(const rbtree& x, 
+inline bool
+operator>(const rbtree& x,
           const rbtree& y) {
   return y < x;
 }
 
-template 
-inline bool 
-operator<=(const rbtree& x, 
+inline bool
+operator<=(const rbtree& x,
            const rbtree& y) {
   return !(y < x);
 }
 
-template 
-inline bool 
-operator>=(const rbtree& x, 
+inline bool
+operator>=(const rbtree& x,
            const rbtree& y) {
   return !(x < y);
 }
 
 
-template 
-inline void 
-swap(rbtree& x, 
+inline void
+swap(rbtree& x,
      rbtree& y)
 {
   x.swap(y);
@@ -1139,12 +1119,12 @@ swap(rbtree& x,
 /*
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
 struct has_trivial_destructor_after_move
     >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
 */
 } //namespace boost  {
diff --git a/project/jni/boost/include/boost/container/detail/type_traits.hpp b/project/jni/boost/include/boost/container/detail/type_traits.hpp
index 6a0b3ed58..5020ee9fc 100644
--- a/project/jni/boost/include/boost/container/detail/type_traits.hpp
+++ b/project/jni/boost/include/boost/container/detail/type_traits.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 // (C) Copyright John Maddock 2000.
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,14 +21,21 @@
 
 #include "config_begin.hpp"
 
-#include 
+#include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 struct nat{};
 
+template 
+struct LowPriorityConversion
+{
+   // Convertible from T with user-defined-conversion rank.
+   LowPriorityConversion(const U&) { }
+};
+
 //boost::alignment_of yields to 10K lines of preprocessed code, so we
 //need an alternative
 template  struct alignment_of;
@@ -83,7 +90,7 @@ struct remove_reference
    typedef T type;
 };
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
 template
 struct remove_reference
@@ -195,7 +202,7 @@ struct remove_ref_const
 };
 
 } // namespace container_detail
-}  //namespace container { 
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/utilities.hpp b/project/jni/boost/include/boost/container/detail/utilities.hpp
index ee0fe993b..5c294e1cd 100644
--- a/project/jni/boost/include/boost/container/detail/utilities.hpp
+++ b/project/jni/boost/include/boost/container/detail/utilities.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -18,16 +18,29 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
 namespace container_detail {
 
+template 
+inline T* addressof(T& obj)
+{
+   return static_cast(
+	   static_cast(
+	      const_cast(
+            &reinterpret_cast(obj)
+   )));
+}
+
 template
 const T &max_value(const T &a, const T &b)
 {  return a > b ? a : b;   }
@@ -112,46 +125,6 @@ struct ct_rounded_size
 {
    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
 };
-/*
-template 
-struct __rw_is_enum
-{
-   struct _C_no { };
-   struct _C_yes { int _C_dummy [2]; };
-
-   struct _C_indirect {
-   // prevent classes with user-defined conversions from matching
-
-   // use double to prevent float->int gcc conversion warnings
-   _C_indirect (double);
-};
-
-// nested struct gets rid of bogus gcc errors
-struct _C_nest {
-   // supply first argument to prevent HP aCC warnings
-   static _C_no _C_is (int, ...);
-   static _C_yes _C_is (int, _C_indirect);
-
-   static _TypeT _C_make_T ();
-};
-
-enum {
-   _C_val = sizeof (_C_yes) == sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
-   && !::boost::is_fundamental<_TypeT>::value
-};
-
-}; 
-*/
-
-template
-struct move_const_ref_type
-   : if_c
-//   < ::boost::is_fundamental::value || ::boost::is_pointer::value || ::boost::is_member_pointer::value || ::boost::is_enum::value
-   < !::boost::is_class::value
-   ,const T &
-   ,BOOST_CATCH_CONST_RLVALUE(T)
-   >
-{};
 
 }  //namespace container_detail {
 
@@ -174,13 +147,95 @@ template
     typename F> // F models ForwardIterator
 F uninitialized_move_alloc(A &a, I f, I l, F r)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
-      ++f; ++r;
+   F back = r;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
    return r;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_move_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, boost::move(*first));
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_move_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, boost::move(*first));
+//!   \endcode
+//!
+//! Returns: first (after incremented)
+template
+    // F models ForwardIterator
+I uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return f;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //                               uninitialized_copy_alloc
@@ -200,13 +255,95 @@ template
     typename F> // F models ForwardIterator
 F uninitialized_copy_alloc(A &a, I f, I l, F r)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
-      ++f; ++r;
+   F back = r;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
    return r;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: result
+template
+    // F models ForwardIterator
+F uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                               uninitialized_copy_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! Effects:
+//!   \code
+//!   for (; n--; ++result, ++first)
+//!      allocator_traits::construct(a, &*result, *first);
+//!   \endcode
+//!
+//! Returns: first (after incremented)
+template
+    // F models ForwardIterator
+I uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r)
+{
+   F back = r;
+   BOOST_TRY{
+      while (n--) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*r), *f);
+         ++f; ++r;
+      }
+   }
+   BOOST_CATCH(...){
+	   for (; back != r; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
+   return f;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //                               uninitialized_copy_alloc
@@ -223,13 +360,23 @@ F uninitialized_copy_alloc(A &a, I f, I l, F r)
 template
     
+    typename T>
 void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
 {
-   while (f != l) {
-      allocator_traits::construct(a, container_detail::to_raw_pointer(&*f), t);
-      ++f;
+   F back = f;
+   BOOST_TRY{
+      while (f != l) {
+         allocator_traits::construct(a, container_detail::to_raw_pointer(&*f), t);
+         ++f;
+      }
    }
+   BOOST_CATCH(...){
+	   for (; back != l; ++back){
+         allocator_traits::destroy(a, container_detail::to_raw_pointer(&*back));
+      }
+	   BOOST_RETHROW;
+   }
+   BOOST_CATCH_END
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -262,6 +409,169 @@ F uninitialized_copy_or_move_alloc
    return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
 }
 
+//////////////////////////////////////////////////////////////////////////////
+//
+//                            uninitialized_copy_or_move_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc_n
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_move_alloc_n(a, f, n, r);
+}
+
+template
+   // F models ForwardIterator
+F uninitialized_copy_or_move_alloc_n
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_copy_alloc_n(a, f, n, r);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                            uninitialized_copy_or_move_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+I uninitialized_copy_or_move_alloc_n_source
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_move_alloc_n_source(a, f, n, r);
+}
+
+template
+   // F models ForwardIterator
+I uninitialized_copy_or_move_alloc_n_source
+   (A &a, I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   return ::boost::container::uninitialized_copy_alloc_n_source(a, f, n, r);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+inline F copy_or_move(I f, I l, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (f != l) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return r;
+}
+
+template
+   // F models ForwardIterator
+inline F copy_or_move(I f, I l, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (f != l) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+inline F copy_or_move_n(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return r;
+}
+
+template
+   // F models ForwardIterator
+inline F copy_or_move_n(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//                         copy_or_move_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+   // F models ForwardIterator
+inline I copy_or_move_n_source(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::enable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = ::boost::move(*f);
+      ++f; ++r;
+   }
+   return f;
+}
+
+template
+   // F models ForwardIterator
+inline I copy_or_move_n_source(I f, typename std::iterator_traits::difference_type n, F r
+   ,typename boost::container::container_detail::disable_if
+      < boost::move_detail::is_move_iterator >::type* = 0)
+{
+   while (n--) {
+      *r = *f;
+      ++f; ++r;
+   }
+   return f;
+}
+
 }  //namespace container {
 }  //namespace boost {
 
diff --git a/project/jni/boost/include/boost/container/detail/value_init.hpp b/project/jni/boost/include/boost/container/detail/value_init.hpp
index afbc9c1e3..ec1a99c56 100644
--- a/project/jni/boost/include/boost/container/detail/value_init.hpp
+++ b/project/jni/boost/include/boost/container/detail/value_init.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011.
+// (C) Copyright Ion Gaztanaga 2005-2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
@@ -21,7 +21,7 @@
 #include 
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template
@@ -36,8 +36,8 @@ struct value_init
    T m_t;
 };
 
-}  //namespace container_detail { 
-}  //namespace container { 
+}  //namespace container_detail {
+}  //namespace container {
 }  //namespace boost {
 
 #include 
diff --git a/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp b/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
index f21f972ab..d903dfa04 100644
--- a/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
+++ b/project/jni/boost/include/boost/container/detail/variadic_templates_tools.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -21,7 +21,7 @@
 #include    //std::size_t
 
 namespace boost {
-namespace container { 
+namespace container {
 namespace container_detail {
 
 template
@@ -136,7 +136,7 @@ struct index_tuple{};
 template >
 struct build_number_seq;
 
-template 
+template
 struct build_number_seq >
    : build_number_seq >
 {};
diff --git a/project/jni/boost/include/boost/container/detail/version_type.hpp b/project/jni/boost/include/boost/container/detail/version_type.hpp
index 46344faca..e47ba26f1 100644
--- a/project/jni/boost/include/boost/container/detail/version_type.hpp
+++ b/project/jni/boost/include/boost/container/detail/version_type.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -38,7 +38,7 @@ struct version_type
 
 namespace impl{
 
-template , typename T::version>::value>
 struct extract_version
 {
diff --git a/project/jni/boost/include/boost/container/detail/workaround.hpp b/project/jni/boost/include/boost/container/detail/workaround.hpp
index 45ab2f2c4..06cb7337c 100644
--- a/project/jni/boost/include/boost/container/detail/workaround.hpp
+++ b/project/jni/boost/include/boost/container/detail/workaround.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -13,19 +13,32 @@
 
 #include 
 
-#if    !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
+#if    !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)\
     && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
    #define BOOST_CONTAINER_PERFECT_FORWARDING
 #endif
 
-#if defined(BOOST_NO_NOEXCEPT)
-   #define BOOST_CONTAINER_NOEXCEPT
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
+   #if defined(BOOST_MSVC)
+      #define BOOST_CONTAINER_NOEXCEPT throw()
+   #else
+      #define BOOST_CONTAINER_NOEXCEPT
+   #endif
    #define BOOST_CONTAINER_NOEXCEPT_IF(x)
 #else
    #define BOOST_CONTAINER_NOEXCEPT    noexcept
    #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
 #endif
 
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
+    && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
+   #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
+#endif
+
+//Macros for documentation purposes. For code, expands to the argument
+#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE
+#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE
+
 #include 
 
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
diff --git a/project/jni/boost/include/boost/container/flat_map.hpp b/project/jni/boost/include/boost/container/flat_map.hpp
index 2d4515b4a..2dd2210e0 100644
--- a/project/jni/boost/include/boost/container/flat_map.hpp
+++ b/project/jni/boost/include/boost/container/flat_map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -26,33 +26,25 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators == and <, needed for friend declarations.
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
-#else
-template 
-#endif
+template 
 class flat_map;
 
-template 
-inline bool operator==(const flat_map& x, 
-                       const flat_map& y);
+template 
+inline bool operator==(const flat_map& x,
+                       const flat_map& y);
 
-template 
-inline bool operator<(const flat_map& x, 
-                      const flat_map& y);
+template 
+inline bool operator<(const flat_map& x,
+                      const flat_map& y);
 
 namespace container_detail{
 
@@ -73,346 +65,414 @@ static D force_copy(S s)
 /// @endcond
 
 //! A flat_map is a kind of associative container that supports unique keys (contains at
-//! most one of each key value) and provides for fast retrieval of values of another 
+//! most one of each key value) and provides for fast retrieval of values of another
 //! type T based on the keys. The flat_map class supports random-access iterators.
-//! 
-//! A flat_map satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. A flat_map also provides 
-//! most operations described for unique keys. For a 
+//!
+//! A flat_map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. A flat_map also provides
+//! most operations described for unique keys. For a
 //! flat_map the key_type is Key and the value_type is std::pair
 //! (unlike std::map which value_type is std::pair<const Key, T>).
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair >).
-//! 
+//!
 //! flat_map is similar to std::map but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_map invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_map invalidates iterators and references 
+//! Erasing an element of a flat_map invalidates iterators and references
 //! pointing to elements that come after (their keys are bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< Key, T> > >
 #else
-template 
+template 
 #endif
-class flat_map 
+class flat_map
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_map)
    //This is the tree that we should store if pair was movable
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+   typedef container_detail::flat_tree,
+                           container_detail::select1st< std::pair >,
+                           Compare,
+                           Allocator> tree_t;
 
    //This is the real tree stored here. It's based on a movable pair
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st >, 
-                           Pred, 
-                           typename allocator_traits::template portable_rebind_alloc
+   typedef container_detail::flat_tree,
+                           container_detail::select1st >,
+                           Compare,
+                           typename allocator_traits::template portable_rebind_alloc
                                >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
-   typedef typename impl_tree_t::pointer                 impl_pointer;
-   typedef typename impl_tree_t::const_pointer           impl_const_pointer;
-   typedef typename impl_tree_t::reference               impl_reference;
-   typedef typename impl_tree_t::const_reference         impl_const_reference;
-   typedef typename impl_tree_t::value_compare           impl_value_compare;
-   typedef typename impl_tree_t::iterator                impl_iterator;
    typedef typename impl_tree_t::const_iterator          impl_const_iterator;
-   typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
-   typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
-   typedef allocator_traits                           allocator_traits_type;
-
-
-
+   typedef container_detail::flat_tree_value_compare
+      < Compare
+      , container_detail::select1st< std::pair >
+      , std::pair >                                                         value_compare_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::iterator                  iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+      ::pointer>::const_iterator               const_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::reverse_iterator          reverse_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::const_reverse_iterator    const_reverse_iterator_impl;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef Key                                              key_type;
-   typedef T                                                mapped_type;
-   typedef typename std::pair        value_type;
-   typedef typename allocator_traits_type::pointer          pointer;
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   typedef typename allocator_traits_type::reference        reference;
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   typedef typename impl_tree_t::size_type                  size_type;
-   typedef typename impl_tree_t::difference_type            difference_type;
-
-   typedef container_detail::flat_tree_value_compare
-      < Pred
-      , container_detail::select1st< std::pair >
-      , std::pair >                                 value_compare;
-   typedef Pred                                             key_compare;
-   typedef typename container_detail::
-      get_flat_tree_iterators::iterator            iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators::const_iterator      const_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::reverse_iterator                        reverse_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::const_reverse_iterator                  const_reverse_iterator;
-   typedef A                                                allocator_type;
-   typedef A                                                stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                        value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(Allocator)                                        stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                    iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                              const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(reverse_iterator_impl)                            reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_reverse_iterator_impl)                      const_reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(impl_value_type)                                  movable_value_type;
 
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Default constructs an empty flat_map.
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_map() 
+   flat_map()
       : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_map using the specified
    //! comparison object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type()) 
+   explicit flat_map(const Compare& comp, const allocator_type& a = allocator_type())
       : m_flat_tree(comp, container_detail::force(a)) {}
 
-   //! Effects: Constructs an empty flat_map using the specified comparison object and 
+   //! Effects: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   flat_map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   flat_map(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force(a)) 
-      { m_flat_tree.insert_unique(first, last); }
+      : m_flat_tree(true, first, last, comp, container_detail::force(a))
+   {}
 
-   //! Effects: Constructs an empty flat_map using the specified comparison object and 
+   //! Effects: Constructs an empty flat_map using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_map( ordered_unique_range_t, InputIterator first, InputIterator last
-           , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+           , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a flat_map.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_map(const flat_map& x) 
+   flat_map(const flat_map& x)
       : m_flat_tree(x.m_flat_tree) {}
 
    //! Effects: Move constructs a flat_map.
    //!   Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_map(BOOST_RV_REF(flat_map) x) 
+   flat_map(BOOST_RV_REF(flat_map) x)
       : m_flat_tree(boost::move(x.m_flat_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a flat_map using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
+   flat_map(const flat_map& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_map using the specified allocator.
+   //!   Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if x.get_allocator() == a, linear otherwise.
+   flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a)
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
    {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: Move constructs a flat_map.
    //!   Constructs *this using x's resources.
-   //! 
+   //!
    //! Complexity: Construct.
-   //! 
+   //!
    //! Postcondition: x is emptied.
-   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
+   flat_map& operator=(BOOST_RV_REF(flat_map) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return container_detail::force(m_flat_tree.key_comp()); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
-      { return container_detail::force(m_flat_tree.get_allocator()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.get_allocator()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-      { return container_detail::force(m_flat_tree.begin()); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const 
-      { return container_detail::force(m_flat_tree.cbegin()); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-      { return container_detail::force(m_flat_tree.end()); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
-   //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
-      { return container_detail::force(m_flat_tree.cend()); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return container_detail::force(m_flat_tree.rbegin()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return container_detail::force(m_flat_tree.rbegin()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return container_detail::force(m_flat_tree.crbegin()); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
-      { return container_detail::force(m_flat_tree.rend()); }
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
-      { return container_detail::force(m_flat_tree.rend()); }
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cbegin()); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cend()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crbegin()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
-      { return container_detail::force(m_flat_tree.crend()); }
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crend()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT        
+      { return m_flat_tree.capacity(); }
+
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+   //!
+   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
+   //!
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: If there is no key equivalent to x in the flat_map, inserts 
+   //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //!   value_type(x, T()) into the flat_map.
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type &operator[](const key_type& k);
 
-   //! Effects: If there is no key equivalent to x in the flat_map, inserts 
+   //! Effects: If there is no key equivalent to x in the flat_map, inserts
    //! value_type(move(x), T()) into the flat_map (the key is move-constructed)
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type &operator[](key_type &&k) ;
 
    #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
    #endif
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
+   //!
    //! Throws: An exception object of type out_of_range if no such element is present.
+   //!
    //! Complexity: logarithmic.
    T& at(const key_type& k)
    {
@@ -423,8 +483,10 @@ class flat_map
       return i->second;
    }
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
+   //!
    //! Throws: An exception object of type out_of_range if no such element is present.
+   //!
    //! Complexity: logarithmic.
    const T& at(const key_type& k) const
    {
@@ -435,124 +497,19 @@ class flat_map
       return i->second;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(flat_map& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
-
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(const value_type& x) 
-      { return container_detail::force >(
-         m_flat_tree.insert_unique(container_detail::force(x))); }
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return container_detail::force >(
-      m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); }
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(impl_value_type) x) 
-   {
-      return container_detail::force >
-      (m_flat_tree.insert_unique(boost::move(x)));
-   }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, const value_type& x)
-      { return container_detail::force_copy(
-         m_flat_tree.insert_unique(container_detail::force(position), container_detail::force(x))); }
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
-      { return container_detail::force_copy
-         (m_flat_tree.insert_unique(container_detail::force(position), boost::move(container_detail::force(x)))); }
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
-   {
-      return container_detail::force_copy(
-         m_flat_tree.insert_unique(container_detail::force(position), boost::move(x)));
-   }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_flat_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is no element in the container 
+   //!   std::forward(args)... if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -565,7 +522,7 @@ class flat_map
    {  return container_detail::force_copy< std::pair >(m_flat_tree.emplace_unique(boost::forward(args)...)); }
 
    //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -578,8 +535,11 @@ class flat_map
    //! Note: If an element is inserted it might invalidate elements.
    template 
    iterator emplace_hint(const_iterator hint, Args&&... args)
-   {  return container_detail::force_copy
-      (m_flat_tree.emplace_hint_unique(container_detail::force(hint), boost::forward(args)...)); }
+   {
+      return container_detail::force_copy
+         (m_flat_tree.emplace_hint_unique( container_detail::force_copy(hint)
+                                         , boost::forward(args)...));
+   }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
@@ -593,7 +553,7 @@ class flat_map
    iterator emplace_hint(const_iterator hint                                                       \
                          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))              \
    {  return container_detail::force_copy(m_flat_tree.emplace_hint_unique                \
-            (container_detail::force(hint)                                    \
+            (container_detail::force_copy(hint)                               \
                BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                 \
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -601,18 +561,147 @@ class flat_map
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(const value_type& x)
+      { return container_detail::force_copy >(
+         m_flat_tree.insert_unique(container_detail::force(x))); }
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(BOOST_RV_REF(value_type) x)
+   {  return container_detail::force_copy >(
+      m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); }
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(BOOST_RV_REF(movable_value_type) x)
+   {
+      return container_detail::force_copy >
+      (m_flat_tree.insert_unique(boost::move(x)));
+   }
+
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, const value_type& x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_unique( container_detail::force_copy(position)
+                                  , container_detail::force(x)));
+   }
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_unique( container_detail::force_copy(position)
+                                   , boost::move(container_detail::force(x))));
+   }
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_unique(container_detail::force_copy(position), boost::move(x)));
+   }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_flat_tree.insert_unique(first, last);  }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Requires: [first ,last) must be ordered according to the predicate and must be
+   //! unique values.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element. This
+   //!   function is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(ordered_unique_range, first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
-      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
+   iterator erase(const_iterator position)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.erase(container_detail::force_copy(position)));
+   }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -620,7 +709,7 @@ class flat_map
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       { return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -632,106 +721,113 @@ class flat_map
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return container_detail::force_copy
-         (m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
+   {
+      return container_detail::force_copy(
+         m_flat_tree.erase( container_detail::force_copy(first)
+                          , container_detail::force_copy(last)));
+   }
+
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_map& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return container_detail::force_copy(m_flat_tree.key_comp()); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return container_detail::force_copy(m_flat_tree.find(x)); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
-      { return container_detail::force(m_flat_tree.find(x)); }
+   const_iterator find(const key_type& x) const
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       {  return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.lower_bound(x)); }
+   const_iterator lower_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
       {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
+   const_iterator upper_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
-      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
+   std::pair equal_range(const key_type& x)
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) const 
-      {  return container_detail::force >(m_flat_tree.equal_range(x)); }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
+   std::pair equal_range(const key_type& x) const
+      {  return container_detail::force_copy >(m_flat_tree.equal_range(x)); }
 
    /// @cond
    template 
@@ -752,7 +848,7 @@ class flat_map
       }
       return (*i).second;
    }
-   mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk) 
+   mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
    {
       key_type &k = mk;
       iterator i = lower_bound(k);
@@ -766,448 +862,445 @@ class flat_map
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator==(const flat_map& x,
+                       const flat_map& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_map& x, 
-                      const flat_map& y) 
+template 
+inline bool operator<(const flat_map& x,
+                      const flat_map& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator!=(const flat_map& x,
+                       const flat_map& y)
    {  return !(x == y); }
 
-template 
-inline bool operator>(const flat_map& x, 
-                      const flat_map& y) 
+template 
+inline bool operator>(const flat_map& x,
+                      const flat_map& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator<=(const flat_map& x,
+                       const flat_map& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_map& x, 
-                       const flat_map& y) 
+template 
+inline bool operator>=(const flat_map& x,
+                       const flat_map& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_map& x, 
-                 flat_map& y) 
+template 
+inline void swap(flat_map& x,
+                 flat_map& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
-#else
-template 
-#endif
+template 
 class flat_multimap;
 
-template 
-inline bool operator==(const flat_multimap& x, 
-                       const flat_multimap& y);
+template 
+inline bool operator==(const flat_multimap& x,
+                       const flat_multimap& y);
 
-template 
-inline bool operator<(const flat_multimap& x, 
-                      const flat_multimap& y);
+template 
+inline bool operator<(const flat_multimap& x,
+                      const flat_multimap& y);
 /// @endcond
 
-//! A flat_multimap is a kind of associative container that supports equivalent keys 
-//! (possibly containing multiple copies of the same key value) and provides for 
-//! fast retrieval of values of another type T based on the keys. The flat_multimap 
+//! A flat_multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
+//! fast retrieval of values of another type T based on the keys. The flat_multimap
 //! class supports random-access iterators.
-//! 
-//! A flat_multimap satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
+//!
+//! A flat_multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
 //! flat_multimap the key_type is Key and the value_type is std::pair
 //! (unlike std::multimap which value_type is std::pair<const Key, T>).
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair >).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< Key, T> > >
 #else
-template 
+template 
 #endif
-class flat_multimap 
+class flat_multimap
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+   typedef container_detail::flat_tree,
+                           container_detail::select1st< std::pair >,
+                           Compare,
+                           Allocator> tree_t;
    //This is the real tree stored here. It's based on a movable pair
-   typedef container_detail::flat_tree, 
-                           container_detail::select1st >, 
-                           Pred, 
-                           typename allocator_traits::template portable_rebind_alloc
+   typedef container_detail::flat_tree,
+                           container_detail::select1st >,
+                           Compare,
+                           typename allocator_traits::template portable_rebind_alloc
                                >::type> impl_tree_t;
    impl_tree_t m_flat_tree;  // flat tree representing flat_map
 
    typedef typename impl_tree_t::value_type              impl_value_type;
-   typedef typename impl_tree_t::pointer                 impl_pointer;
-   typedef typename impl_tree_t::const_pointer           impl_const_pointer;
-   typedef typename impl_tree_t::reference               impl_reference;
-   typedef typename impl_tree_t::const_reference         impl_const_reference;
-   typedef typename impl_tree_t::value_compare           impl_value_compare;
-   typedef typename impl_tree_t::iterator                impl_iterator;
    typedef typename impl_tree_t::const_iterator          impl_const_iterator;
-   typedef typename impl_tree_t::reverse_iterator        impl_reverse_iterator;
-   typedef typename impl_tree_t::const_reverse_iterator  impl_const_reverse_iterator;
    typedef typename impl_tree_t::allocator_type          impl_allocator_type;
-   typedef allocator_traits                           allocator_traits_type;
-
+   typedef container_detail::flat_tree_value_compare
+      < Compare
+      , container_detail::select1st< std::pair >
+      , std::pair >                                                         value_compare_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::iterator                  iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+      ::pointer>::const_iterator               const_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::reverse_iterator          reverse_iterator_impl;
+   typedef typename container_detail::get_flat_tree_iterators
+         ::pointer>::const_reverse_iterator    const_reverse_iterator_impl;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef Key                                              key_type;
-   typedef T                                                mapped_type;
-   typedef Pred                                             key_compare;
-   typedef typename std::pair        value_type;
-   typedef typename allocator_traits_type::pointer          pointer;
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   typedef typename allocator_traits_type::reference        reference;
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   typedef typename impl_tree_t::size_type                  size_type;
-   typedef typename impl_tree_t::difference_type            difference_type;
-   typedef container_detail::flat_tree_value_compare
-      < Pred
-      , container_detail::select1st< std::pair >
-      , std::pair >                                 value_compare;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                        value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(Allocator)                                        stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                    iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                              const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(reverse_iterator_impl)                            reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_reverse_iterator_impl)                      const_reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(impl_value_type)                                  movable_value_type;
 
-   typedef typename container_detail::
-      get_flat_tree_iterators::iterator            iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators::const_iterator      const_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::reverse_iterator                        reverse_iterator;
-   typedef typename container_detail::
-      get_flat_tree_iterators
-         ::const_reverse_iterator                  const_reverse_iterator;
-   typedef A                                                allocator_type;
-   //Non-standard extension
-   typedef A                                                stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty flat_map.
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_multimap() 
+   flat_multimap()
       : m_flat_tree() {}
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_multimap(const Pred& comp,
+   explicit flat_multimap(const Compare& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, container_detail::force(a)) { }
 
    //! Effects: Constructs an empty flat_multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    flat_multimap(InputIterator first, InputIterator last,
-            const Pred& comp        = Pred(),
+            const Compare& comp        = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, container_detail::force(a)) 
-      { m_flat_tree.insert_equal(first, last); }
+      : m_flat_tree(false, first, last, comp, container_detail::force(a))
+   {}
 
-   //! Effects: Constructs an empty flat_multimap using the specified comparison object and 
+   //! Effects: Constructs an empty flat_multimap using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_multimap(ordered_range_t, InputIterator first, InputIterator last,
-            const Pred& comp        = Pred(),
+            const Compare& comp        = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a flat_multimap.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_multimap(const flat_multimap& x) 
+   flat_multimap(const flat_multimap& x)
       : m_flat_tree(x.m_flat_tree) { }
 
    //! Effects: Move constructs a flat_multimap. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_multimap(BOOST_RV_REF(flat_multimap) x) 
+   flat_multimap(BOOST_RV_REF(flat_multimap) x)
       : m_flat_tree(boost::move(x.m_flat_tree))
+   {}
+
+   //! Effects: Copy constructs a flat_multimap using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multimap(const flat_multimap& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a)
+      : m_flat_tree(boost::move(x.m_flat_tree), a)
    { }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x) 
+   flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx) 
+   flat_multimap& operator=(BOOST_RV_REF(flat_multimap) mx)
       {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return container_detail::force(m_flat_tree.key_comp()); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return value_compare(container_detail::force(m_flat_tree.key_comp())); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
-      { return container_detail::force(m_flat_tree.get_allocator()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.get_allocator()); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force(m_flat_tree.get_stored_allocator()); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-      { return container_detail::force(m_flat_tree.begin()); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.begin()); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return container_detail::force_copy(m_flat_tree.end()); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-      { return container_detail::force(m_flat_tree.end()); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.end()); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return container_detail::force(m_flat_tree.rbegin()); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return container_detail::force(m_flat_tree.rbegin()); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rbegin()); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
-      { return container_detail::force(m_flat_tree.rend()); }
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
-      { return container_detail::force(m_flat_tree.rend()); }
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.rend()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cbegin()); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.cend()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crbegin()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+      { return container_detail::force_copy(m_flat_tree.crend()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_multimap& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const value_type& x) 
-      { return container_detail::force_copy(m_flat_tree.insert_equal(container_detail::force(x))); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(impl_value_type) x) 
-      { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, const value_type& x) 
-      { return container_detail::force_copy
-         (m_flat_tree.insert_equal(container_detail::force(position), container_detail::force(x))); }
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {
-      return container_detail::force_copy
-         (m_flat_tree.insert_equal(container_detail::force(position)
-                                  , boost::move(x)));
-   }
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant time if the value
-   //!   is to be inserted before p) plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x) 
-   {
-      return container_detail::force_copy(
-         m_flat_tree.insert_equal(container_detail::force(position), boost::move(x)));
-   }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_equal(first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic search time plus linear insertion
    //!   to the elements with bigger keys than x.
@@ -1233,7 +1326,7 @@ class flat_multimap
    iterator emplace_hint(const_iterator hint, Args&&... args)
    {
       return container_detail::force_copy(m_flat_tree.emplace_hint_equal
-         (container_detail::force(hint), boost::forward(args)...));
+         (container_detail::force_copy(hint), boost::forward(args)...));
    }
 
    #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -1248,7 +1341,7 @@ class flat_multimap
    iterator emplace_hint(const_iterator hint                                                       \
                          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))              \
    {  return container_detail::force_copy(m_flat_tree.emplace_hint_equal                 \
-            (container_detail::force(hint)                                    \
+            (container_detail::force_copy(hint)                               \
                BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); }                 \
    //!
    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -1256,18 +1349,135 @@ class flat_multimap
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const value_type& x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_equal(container_detail::force(x)));
+   }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(BOOST_RV_REF(value_type) x)
+   { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(BOOST_RV_REF(impl_value_type) x)
+      { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); }
+
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, const value_type& x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_equal( container_detail::force_copy(position)
+                                  , container_detail::force(x)));
+   }
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+   {
+      return container_detail::force_copy
+         (m_flat_tree.insert_equal(container_detail::force_copy(position)
+                                  , boost::move(x)));
+   }
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant time if the value
+   //!   is to be inserted before p) plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.insert_equal(container_detail::force_copy(position), boost::move(x)));
+   }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(first, last); }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Requires: [first ,last) must be ordered according to the predicate.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element. This
+   //!   function is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(ordered_range, first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
-      { return container_detail::force_copy(m_flat_tree.erase(container_detail::force(position))); }
+   iterator erase(const_iterator position)
+   {
+      return container_detail::force_copy(
+         m_flat_tree.erase(container_detail::force_copy(position)));
+   }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
    //!
@@ -1275,7 +1485,7 @@ class flat_multimap
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       { return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1287,25 +1497,53 @@ class flat_multimap
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
    iterator erase(const_iterator first, const_iterator last)
-      { return container_detail::force_copy
-         (m_flat_tree.erase(container_detail::force(first), container_detail::force(last))); }
+   {
+      return container_detail::force_copy
+         (m_flat_tree.erase( container_detail::force_copy(first)
+                           , container_detail::force_copy(last)));
+   }
+
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_multimap& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
 
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return container_detail::force_copy(m_flat_tree.key_comp()); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
@@ -1318,77 +1556,55 @@ class flat_multimap
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
-      { return container_detail::force(m_flat_tree.find(x)); }
+   const_iterator find(const key_type& x) const
+      { return container_detail::force_copy(m_flat_tree.find(x)); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       { return m_flat_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
-      {return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
+   iterator lower_bound(const key_type& x)
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key
+   //! Returns: Allocator const iterator pointing to the first element with key
    //!   not less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.lower_bound(x));  }
+   const_iterator lower_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.lower_bound(x));  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
       {return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
-   //! Returns: A const iterator pointing to the first element with key
+   //! Returns: Allocator const iterator pointing to the first element with key
    //!   not less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
-      {  return container_detail::force(m_flat_tree.upper_bound(x)); }
+   const_iterator upper_bound(const key_type& x) const
+      {  return container_detail::force_copy(m_flat_tree.upper_bound(x)); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return container_detail::force_copy >(m_flat_tree.equal_range(x));   }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_multimap& x,
@@ -1400,38 +1616,38 @@ class flat_multimap
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator==(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_multimap& x, 
-                      const flat_multimap& y) 
+template 
+inline bool operator<(const flat_multimap& x,
+                      const flat_multimap& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator!=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(x == y);  }
 
-template 
-inline bool operator>(const flat_multimap& x, 
-                      const flat_multimap& y) 
+template 
+inline bool operator>(const flat_multimap& x,
+                      const flat_multimap& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator<=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_multimap& x, 
-                       const flat_multimap& y) 
+template 
+inline bool operator>=(const flat_multimap& x,
+                       const flat_multimap& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_multimap& x, flat_multimap& y) 
+template 
+inline void swap(flat_multimap& x, flat_multimap& y)
    {  x.swap(y);  }
 
 }}
@@ -1439,16 +1655,16 @@ inline void swap(flat_multimap& x, flat_multimap& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move< boost::container::flat_multimap >
+template 
+struct has_trivial_destructor_after_move< boost::container::flat_multimap >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
-}  //namespace boost { 
+
+}  //namespace boost {
 
 /// @endcond
 
diff --git a/project/jni/boost/include/boost/container/flat_set.hpp b/project/jni/boost/include/boost/container/flat_set.hpp
index f36730972..82bdea8c0 100644
--- a/project/jni/boost/include/boost/container/flat_set.hpp
+++ b/project/jni/boost/include/boost/container/flat_set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -24,405 +24,384 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators < and ==, needed for friend declaration.
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class flat_set;
 
-template 
-inline bool operator==(const flat_set& x, 
-                       const flat_set& y);
+template 
+inline bool operator==(const flat_set& x,
+                       const flat_set& y);
 
-template 
-inline bool operator<(const flat_set& x, 
-                      const flat_set& y);
+template 
+inline bool operator<(const flat_set& x,
+                      const flat_set& y);
 /// @endcond
 
-//! flat_set is a Sorted Associative Container that stores objects of type Key. 
-//! flat_set is a Simple Associative Container, meaning that its value type, 
-//! as well as its key type, is Key. It is also a Unique Associative Container, 
-//! meaning that no two elements are the same. 
-//! 
+//! flat_set is a Sorted Associative Container that stores objects of type Key.
+//! flat_set is a Simple Associative Container, meaning that its value type,
+//! as well as its key type, is Key. It is also a Unique Associative Container,
+//! meaning that no two elements are the same.
+//!
 //! flat_set is similar to std::set but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_set invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_set invalidates iterators and references 
+//! Erasing an element of a flat_set invalidates iterators and references
 //! pointing to elements that come after (their keys are bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class flat_set 
+class flat_set
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_set)
-   typedef container_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Compare, Allocator> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_set
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef typename tree_t::key_compare            key_compare;
-   typedef typename tree_t::value_compare          value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
-   //! Effects: Defatuls constructs an empty flat_map.
-   //! 
+   //! Effects: Default constructs an empty flat_set.
+   //!
    //! Complexity: Constant.
    explicit flat_set()
       : m_flat_tree()
    {}
 
-   //! Effects: Constructs an empty flat_map using the specified
+   //! Effects: Constructs an empty flat_set using the specified
    //! comparison object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit flat_set(const Pred& comp,
+   explicit flat_set(const Compare& comp,
                      const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a)
    {}
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   flat_set(InputIterator first, InputIterator last, 
-            const Pred& comp = Pred(),
+   flat_set(InputIterator first, InputIterator last,
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, a) 
-      { m_flat_tree.insert_unique(first, last); }
+      : m_flat_tree(true, first, last, comp, a)
+   {}
 
-   //! Effects: Constructs an empty flat_set using the specified comparison object and 
+   //! Effects: Constructs an empty flat_set using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
-   flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, 
-            const Pred& comp = Pred(),
+   flat_set(ordered_unique_range_t, InputIterator first, InputIterator last,
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
-   //! Effects: Copy constructs a map.
-   //! 
+   //! Effects: Copy constructs a set.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set(const flat_set& x) 
-      : m_flat_tree(x.m_flat_tree) {}
+   flat_set(const flat_set& x)
+      : m_flat_tree(x.m_flat_tree)
+   {}
 
-   //! Effects: Move constructs a map. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //! Effects: Move constructs a set. Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   flat_set(BOOST_RV_REF(flat_set) mx) 
+   flat_set(BOOST_RV_REF(flat_set) mx)
       : m_flat_tree(boost::move(mx.m_flat_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a set using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
+   flat_set(const flat_set& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_set(BOOST_RV_REF(flat_set) mx, const allocator_type &a)
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Makes *this a copy of the previous value of xx.
+   //!
    //! Complexity: Linear in x.size().
-   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
+   flat_set& operator=(BOOST_RV_REF(flat_set) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return m_flat_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return m_flat_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    {  return m_flat_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    {  return m_flat_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
-   //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const 
-      { return m_flat_tree.cbegin(); }
-
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
-   //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
-      { return m_flat_tree.cend(); }
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return m_flat_tree.rbegin(); } 
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return m_flat_tree.rbegin(); } 
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return m_flat_tree.crbegin(); } 
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend()
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.cbegin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.cend(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.crbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.crend(); }
 
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_set& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
+   //! Throws: If memory allocation allocation throws or Key's copy constructor throws.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   std::pair insert(T &x)
-   { return this->insert(const_cast(x)); }
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or Key's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   template
-   std::pair insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a new value_type move constructed from the pair if and
-   //! only if there is no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_unique(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_unique(position, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is no element in the container 
+   //! Effects: Inserts an object x of type Key constructed with
+   //!   std::forward(args)... if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -434,8 +413,8 @@ class flat_set
    std::pair emplace(Args&&... args)
    {  return m_flat_tree.emplace_unique(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //! Effects: Inserts an object of type Key constructed with
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -468,17 +447,106 @@ class flat_set
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(const value_type &x);
+
+   //! Effects: Inserts a new value_type move constructed from the pair if and
+   //! only if there is no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   std::pair insert(value_type &&x);
+   #else
+   private:
+   typedef std::pair insert_return_pair;
+   public:
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(first, last);  }
+
+   //! Requires: first, last are not iterators into *this and
+   //! must be ordered according to the predicate and must be
+   //! unique values.
+   //!
+   //! Effects: inserts each element from the range [first,last) .This function
+   //! is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: Non-standard extension. If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_unique(ordered_unique_range, first, last);  }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
       {  return m_flat_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -487,7 +555,7 @@ class flat_set
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       {  return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -498,58 +566,83 @@ class flat_set
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
       {  return m_flat_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_set& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return m_flat_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
       { return m_flat_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       {  return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return m_flat_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
       {  return m_flat_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -559,48 +652,25 @@ class flat_set
    iterator upper_bound(const key_type& x)
       {  return m_flat_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
       {  return m_flat_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return m_flat_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return m_flat_tree.equal_range(x); }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_set&, const flat_set&);
@@ -609,414 +679,407 @@ class flat_set
    friend bool operator< (const flat_set&, const flat_set&);
 
    private:
-   std::pair priv_insert(const T &x) 
-   {  return m_flat_tree.insert_unique(x);  }
+   template
+   std::pair priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_unique(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_flat_tree.insert_unique(p, x); }
+   template
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_unique(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator==(const flat_set& x,
+                       const flat_set& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_set& x, 
-                      const flat_set& y) 
+template 
+inline bool operator<(const flat_set& x,
+                      const flat_set& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator!=(const flat_set& x,
+                       const flat_set& y)
    {  return !(x == y);   }
 
-template 
-inline bool operator>(const flat_set& x, 
-                      const flat_set& y) 
+template 
+inline bool operator>(const flat_set& x,
+                      const flat_set& y)
    {  return y < x; }
 
-template 
-inline bool operator<=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator<=(const flat_set& x,
+                       const flat_set& y)
    {  return !(y < x); }
 
-template 
-inline bool operator>=(const flat_set& x, 
-                       const flat_set& y) 
+template 
+inline bool operator>=(const flat_set& x,
+                       const flat_set& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(flat_set& x, flat_set& y) 
+template 
+inline void swap(flat_set& x, flat_set& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value &&has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value &&has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class flat_multiset;
 
-template 
-inline bool operator==(const flat_multiset& x, 
-                       const flat_multiset& y);
+template 
+inline bool operator==(const flat_multiset& x,
+                       const flat_multiset& y);
 
-template 
-inline bool operator<(const flat_multiset& x, 
-                      const flat_multiset& y);
+template 
+inline bool operator<(const flat_multiset& x,
+                      const flat_multiset& y);
 /// @endcond
 
-//! flat_multiset is a Sorted Associative Container that stores objects of type Key. 
-//! flat_multiset is a Simple Associative Container, meaning that its value type, 
+//! flat_multiset is a Sorted Associative Container that stores objects of type Key.
+//! flat_multiset is a Simple Associative Container, meaning that its value type,
 //! as well as its key type, is Key.
 //! flat_Multiset can store multiple copies of the same key value.
-//! 
+//!
 //! flat_multiset is similar to std::multiset but it's implemented like an ordered vector.
 //! This means that inserting a new element into a flat_multiset invalidates
 //! previous iterators and references
 //!
-//! Erasing an element of a flat_multiset invalidates iterators and references 
+//! Erasing an element of a flat_multiset invalidates iterators and references
 //! pointing to elements that come after (their keys are equal or bigger) the erased element.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class flat_multiset 
+class flat_multiset
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
-   typedef container_detail::flat_tree, Pred, A> tree_t;
+   typedef container_detail::flat_tree, Compare, Allocator> tree_t;
    tree_t m_flat_tree;  // flat tree representing flat_multiset
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef typename tree_t::key_compare            key_compare;
-   typedef typename tree_t::value_compare          value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   //! Effects: Defatuls constructs an empty flat_map.
-   //! 
+   //! Effects: Default constructs an empty flat_multiset.
+   //!
    //! Complexity: Constant.
    explicit flat_multiset()
       : m_flat_tree()
    {}
 
-   explicit flat_multiset(const Pred& comp,
+   explicit flat_multiset(const Compare& comp,
                           const allocator_type& a = allocator_type())
       : m_flat_tree(comp, a) {}
 
    template 
    flat_multiset(InputIterator first, InputIterator last,
-                 const Pred& comp        = Pred(),
+                 const Compare& comp        = Compare(),
                  const allocator_type& a = allocator_type())
-      : m_flat_tree(comp, a) 
-      { m_flat_tree.insert_equal(first, last); }
+      : m_flat_tree(false, first, last, comp, a)
+   {}
 
-   //! Effects: Constructs an empty flat_multiset using the specified comparison object and 
+   //! Effects: Constructs an empty flat_multiset using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last ). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
+   //!
+   //! Note: Non-standard extension.
    template 
    flat_multiset(ordered_range_t, InputIterator first, InputIterator last,
-                 const Pred& comp        = Pred(),
+                 const Compare& comp        = Compare(),
                  const allocator_type& a = allocator_type())
-      : m_flat_tree(ordered_range, first, last, comp, a) 
+      : m_flat_tree(ordered_range, first, last, comp, a)
    {}
 
-   flat_multiset(const flat_multiset& x) 
-      : m_flat_tree(x.m_flat_tree) {}
-
-   flat_multiset(BOOST_RV_REF(flat_multiset) x) 
-      : m_flat_tree(boost::move(x.m_flat_tree))
+   //! Effects: Copy constructs a flat_multiset.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x)
+      : m_flat_tree(x.m_flat_tree)
    {}
 
-   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) 
+   //! Effects: Move constructs a flat_multiset. Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Postcondition: x is emptied.
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx)
+      : m_flat_tree(boost::move(mx.m_flat_tree))
+   {}
+
+   //! Effects: Copy constructs a flat_multiset using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset(const flat_multiset& x, const allocator_type &a)
+      : m_flat_tree(x.m_flat_tree, a)
+   {}
+
+   //! Effects: Move constructs a flat_multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise
+   flat_multiset(BOOST_RV_REF(flat_multiset) mx, const allocator_type &a)
+      : m_flat_tree(boost::move(mx.m_flat_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
       {  m_flat_tree = x.m_flat_tree;   return *this;  }
 
-   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx) 
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   flat_multiset& operator=(BOOST_RV_REF(flat_multiset) mx)
    {  m_flat_tree = boost::move(mx.m_flat_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-      { return m_flat_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-      { return m_flat_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_flat_tree.get_stored_allocator(); }
 
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
       { return m_flat_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-      { return m_flat_tree.rbegin(); } 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-      { return m_flat_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-      { return m_flat_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend()
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
       { return m_flat_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   void swap(flat_multiset& x)
-   { m_flat_tree.swap(x.m_flat_tree); }
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+      { return m_flat_tree.capacity(); }
 
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
    //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
+   //! Throws: If memory allocation allocation throws or Key's copy constructor throws.
    //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
+   //! Note: If capacity() is less than "cnt", iterators and references to
+   //!   to values might be invalidated.
+   void reserve(size_type cnt)      
+      { m_flat_tree.reserve(cnt);   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(T &x)
-   { return this->insert(const_cast(x)); }
+   //! Effects: Tries to deallocate the excess of memory created
+   //    with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or Key's copy constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+      { m_flat_tree.shrink_to_fit(); }
 
-   template
-   iterator insert(const U &u, typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a new value_type move constructed from x
-   //!   and returns the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic search time plus linear insertion
-   //!   to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_equal(boost::move(x));   }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts a new value move constructed  from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic search time (constant if x is inserted
-   //!   right before p) plus insertion linear to the elements with bigger keys than x.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) 
-   {  return m_flat_tree.insert_equal(position, boost::move(x));  }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   //!   search time plus N*size() insertion time.
-   //!
-   //! Note: If an element is inserted it might invalidate elements.
-   template 
-   void insert(InputIterator first, InputIterator last) 
-      {  m_flat_tree.insert_equal(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic search time plus linear insertion
    //!   to the elements with bigger keys than x.
@@ -1026,7 +1089,7 @@ class flat_multiset
    iterator emplace(Args&&... args)
    {  return m_flat_tree.emplace_equal(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... in the container.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -1059,17 +1122,93 @@ class flat_multiset
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const value_type &x);
+
+   //! Effects: Inserts a new value_type move constructed from x
+   //!   and returns the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic search time plus linear insertion
+   //!   to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts a new value move constructed  from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic search time (constant if x is inserted
+   //!   right before p) plus insertion linear to the elements with bigger keys than x.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: If an element is inserted it might invalidate elements.
+   template 
+   void insert(InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(first, last);  }
+
+   //! Requires: first, last are not iterators into *this and
+   //! must be ordered according to the predicate.
+   //!
+   //! Effects: inserts each element from the range [first,last) .This function
+   //! is more efficient than the normal range creation for ordered ranges.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   //!   search time plus N*size() insertion time.
+   //!
+   //! Note: Non-standard extension. If an element is inserted it might invalidate elements.
+   template 
+   void insert(ordered_range_t, InputIterator first, InputIterator last)
+      {  m_flat_tree.insert_equal(ordered_range, first, last);  }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Linear to the elements with keys bigger than position
    //!
    //! Note: Invalidates elements with keys
    //!   not less than the erased element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
       {  return m_flat_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1078,7 +1217,7 @@ class flat_multiset
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
       {  return m_flat_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1089,58 +1228,83 @@ class flat_multiset
    //!
    //! Complexity: Logarithmic search time plus erasure time
    //!   linear to the elements with bigger keys.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
       {  return m_flat_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(flat_multiset& x)
+   { m_flat_tree.swap(x.m_flat_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
       { m_flat_tree.clear(); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //    with previous allocations. The size of the vector is unchanged
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Complexity: Constant.
+   key_compare key_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
    //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-      { m_flat_tree.shrink_to_fit(); }
+   //! Complexity: Constant.
+   value_compare value_comp() const
+      { return m_flat_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
 
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
       { return m_flat_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.s
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
       { return m_flat_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
       { return m_flat_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
       {  return m_flat_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
       {  return m_flat_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -1150,48 +1314,25 @@ class flat_multiset
    iterator upper_bound(const key_type& x)
       {  return m_flat_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
       {  return m_flat_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
       {  return m_flat_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
       {  return m_flat_tree.equal_range(x); }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const           
-      { return m_flat_tree.capacity(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy constructor throws.
-   //!
-   //! Note: If capacity() is less than "count", iterators and references to
-   //!   to values might be invalidated.
-   void reserve(size_type count)       
-      { m_flat_tree.reserve(count);   }
-
    /// @cond
    template 
    friend bool operator== (const flat_multiset&,
@@ -1200,60 +1341,62 @@ class flat_multiset
    friend bool operator< (const flat_multiset&,
                           const flat_multiset&);
    private:
-   iterator priv_insert(const T &x) 
-   {  return m_flat_tree.insert_equal(x);  }
+   template 
+   iterator priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_equal(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_flat_tree.insert_equal(p, x); }
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_flat_tree.insert_equal(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator==(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return x.m_flat_tree == y.m_flat_tree;  }
 
-template 
-inline bool operator<(const flat_multiset& x, 
-                      const flat_multiset& y) 
+template 
+inline bool operator<(const flat_multiset& x,
+                      const flat_multiset& y)
    {  return x.m_flat_tree < y.m_flat_tree;   }
 
-template 
-inline bool operator!=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator!=(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return !(x == y);  }
 
-template 
-inline bool operator>(const flat_multiset& x, 
-                      const flat_multiset& y) 
+template 
+inline bool operator>(const flat_multiset& x,
+                      const flat_multiset& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator<=(const flat_multiset& x,
+                       const flat_multiset& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const flat_multiset& x, 
-                       const flat_multiset& y) 
+template 
+inline bool operator>=(const flat_multiset& x,
+                       const flat_multiset& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(flat_multiset& x, flat_multiset& y) 
+template 
+inline void swap(flat_multiset& x, flat_multiset& y)
    {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/list.hpp b/project/jni/boost/include/boost/container/list.hpp
index 6df999bb5..571e63aca 100644
--- a/project/jni/boost/include/boost/container/list.hpp
+++ b/project/jni/boost/include/boost/container/list.hpp
@@ -1,14 +1,14 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 // See http://www.boost.org/libs/container for documentation.
 //
 
-#ifndef BOOST_CONTAINER_LIST_HPP_
-#define BOOST_CONTAINER_LIST_HPP_
+#ifndef BOOST_CONTAINER_LIST_HPP
+#define BOOST_CONTAINER_LIST_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -18,8 +18,9 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +33,7 @@
 #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 #else
 //Preprocessor library to emulate perfect forwarding
-#include  
+#include 
 #endif
 
 #include 
@@ -43,13 +44,8 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 namespace container_detail {
@@ -65,37 +61,18 @@ template 
 struct list_node
    :  public list_hook::type
 {
+   private:
+   list_node();
 
-   list_node()
-      : m_data()
-   {}
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   list_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-
-   #else //#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   template                                                \
-   list_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                          \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                     \
-   {}                                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename list_hook::type hook_type;
    T m_data;
 };
 
-template
+template
 struct intrusive_list_type
 {
-   typedef boost::container::allocator_traits   allocator_traits_type;
+   typedef boost::container::allocator_traits   allocator_traits_type;
    typedef typename allocator_traits_type::value_type value_type;
    typedef typename boost::intrusive::pointer_traits
       ::template
@@ -113,42 +90,140 @@ struct intrusive_list_type
    typedef container_type                       type ;
 };
 
+template
+class list_const_iterator
+   : public std::iterator< std::bidirectional_iterator_tag, T
+                         , typename iiterator_types::difference_type
+                         , typename iiterator_types::const_pointer
+                         , typename iiterator_types::const_reference>
+{
+   protected:
+
+   IIterator m_it;
+
+   public:
+   typedef typename iiterator_types::const_pointer     const_pointer;
+   typedef typename iiterator_types::const_reference   const_reference;
+
+   //Constructors
+   list_const_iterator()
+      : m_it()
+   {}
+
+   explicit list_const_iterator(const IIterator &it) 
+      : m_it(it)
+   {}
+
+   //Pointer like operators
+   const_reference operator*() const
+   { return this->m_it->m_data;  }
+
+   const_pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   list_const_iterator& operator++()      
+   { ++this->m_it;  return *this; }
+
+   list_const_iterator operator++(int)     
+   { IIterator tmp = this->m_it; ++*this; return list_const_iterator(tmp);  }
+
+   list_const_iterator& operator--()
+   { --this->m_it; return *this;   }
+
+   list_const_iterator operator--(int)
+   {  IIterator tmp = this->m_it; --*this; return list_const_iterator(tmp); }
+
+   //Comparison operators
+   friend bool operator== (const list_const_iterator& l, const list_const_iterator& r)
+   {  return l.m_it == r.m_it;  }
+
+   friend bool operator!= (const list_const_iterator& l, const list_const_iterator& r)
+   {  return l.m_it != r.m_it;  }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
+template
+class list_iterator
+   : public list_const_iterator
+{
+   private:
+   typedef list_const_iterator const_iterator;
+
+   public:
+   typedef typename iiterator_types::pointer           pointer;
+   typedef typename iiterator_types::reference         reference;
+
+   //Constructors
+   list_iterator()
+      : const_iterator()
+   {}
+
+   explicit list_iterator(const IIterator &it)
+      :  const_iterator(it)
+   {}
+
+   //Pointer like operators
+   reference operator*()  const
+   {  return  this->m_it->m_data;  }
+
+   pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   list_iterator& operator++() 
+   { ++this->m_it; return *this;  }
+
+   list_iterator operator++(int)
+   { IIterator tmp = this->m_it; ++*this; return list_iterator(tmp); }
+
+   list_iterator& operator--()
+   { --this->m_it; return *this;   }
+
+   list_iterator operator--(int)
+   {  IIterator tmp = this->m_it; --*this; return list_iterator(tmp); }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
 }  //namespace container_detail {
 /// @endcond
 
 //! A list is a doubly linked list. That is, it is a Sequence that supports both
-//! forward and backward traversal, and (amortized) constant time insertion and 
-//! removal of elements at the beginning or the end, or in the middle. Lists have 
-//! the important property that insertion and splicing do not invalidate iterators 
-//! to list elements, and that even removal invalidates only the iterators that point 
-//! to the elements that are removed. The ordering of iterators may be changed 
-//! (that is, list::iterator might have a different predecessor or successor 
-//! after a list operation than it did before), but the iterators themselves will 
-//! not be invalidated or made to point to different elements unless that invalidation 
+//! forward and backward traversal, and (amortized) constant time insertion and
+//! removal of elements at the beginning or the end, or in the middle. Lists have
+//! the important property that insertion and splicing do not invalidate iterators
+//! to list elements, and that even removal invalidates only the iterators that point
+//! to the elements that are removed. The ordering of iterators may be changed
+//! (that is, list::iterator might have a different predecessor or successor
+//! after a list operation than it did before), but the iterators themselves will
+//! not be invalidated or made to point to different elements unless that invalidation
 //! or mutation is explicit.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class list 
+class list
    : protected container_detail::node_alloc_holder
-      ::type>
+      ::type>
 {
    /// @cond
-   typedef typename 
-      container_detail::intrusive_list_type::type Icont;
-   typedef list                                 ThisType;
-   typedef container_detail::node_alloc_holder        AllocHolder;
-   typedef typename AllocHolder::NodePtr              NodePtr;
-   typedef typename AllocHolder::NodeAlloc            NodeAlloc;
-   typedef typename AllocHolder::ValAlloc             ValAlloc;
-   typedef typename AllocHolder::Node                 Node;
-   typedef container_detail::allocator_destroyer     Destroyer;
-   typedef typename AllocHolder::allocator_v1         allocator_v1;
-   typedef typename AllocHolder::allocator_v2         allocator_v2;
-   typedef typename AllocHolder::alloc_version        alloc_version;
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef typename
+      container_detail::intrusive_list_type::type Icont;
+   typedef container_detail::node_alloc_holder  AllocHolder;
+   typedef typename AllocHolder::NodePtr                          NodePtr;
+   typedef typename AllocHolder::NodeAlloc                        NodeAlloc;
+   typedef typename AllocHolder::ValAlloc                         ValAlloc;
+   typedef typename AllocHolder::Node                             Node;
+   typedef container_detail::allocator_destroyer       Destroyer;
+   typedef typename AllocHolder::allocator_v1                     allocator_v1;
+   typedef typename AllocHolder::allocator_v2                     allocator_v2;
+   typedef typename AllocHolder::alloc_version                    alloc_version;
+   typedef boost::container::allocator_traits          allocator_traits_type;
 
    class equal_to_value
    {
@@ -178,157 +253,55 @@ class list
       bool operator()(const Node &a) const
       {  return static_cast(*this)(a.m_data);  }
    };
-   /// @endcond
 
-   public:
-   //! The type of object, T, stored in the list
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                                allocator_type;
-   //! Non-standard extension: the stored allocator type
-   typedef NodeAlloc                                        stored_allocator_type;
-
-   /// @cond
-   private:
    BOOST_COPYABLE_AND_MOVABLE(list)
-   typedef difference_type                         list_difference_type;
-   typedef pointer                                 list_pointer;
-   typedef const_pointer                           list_const_pointer;
-   typedef reference                               list_reference;
-   typedef const_reference                         list_const_reference;
+
+   typedef container_detail::list_iterator      iterator_impl;
+   typedef container_detail::list_const_iteratorconst_iterator_impl;
    /// @endcond
 
    public:
-   //! Const iterator used to iterate through a list. 
-   class const_iterator
-      /// @cond
-      : public std::iterator
-   {
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-      protected:
-      typename Icont::iterator m_it;
-      explicit const_iterator(typename Icont::iterator it)  : m_it(it){}
-      void prot_incr() { ++m_it; }
-      void prot_decr() { --m_it; }
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(NodeAlloc)                                           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                       iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                                 const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
-      private:
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class list;
-      typedef list_difference_type        difference_type;
-
-      //Constructors
-      const_iterator()
-         :  m_it()
-      {}
-
-      //Pointer like operators
-      const_reference operator*()  const 
-      { return  m_it->m_data;  }
-
-      const_pointer   operator->() const 
-      { return  const_pointer(&m_it->m_data); }
-
-      //Increment / Decrement
-      const_iterator& operator++()       
-      { prot_incr();  return *this; }
-
-      const_iterator operator++(int)      
-      { typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp);  }
-
-      const_iterator& operator--()
-      {   prot_decr(); return *this;   }
-
-      const_iterator operator--(int)
-      {  typename Icont::iterator tmp = m_it; --*this; return const_iterator(tmp); }
-
-      //Comparison operators
-      bool operator==   (const const_iterator& r)  const
-      {  return m_it == r.m_it;  }
-
-      bool operator!=   (const const_iterator& r)  const
-      {  return m_it != r.m_it;  }
-   }
-   /// @endcond
-   ;
-
-   //! Iterator used to iterate through a list
-   class iterator
-   /// @cond
-      : public const_iterator
-   {
-
-      private:
-      explicit iterator(typename Icont::iterator it)
-         :  const_iterator(it)
-      {}
-   
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class list;
-      typedef list_pointer       pointer;
-      typedef list_reference     reference;
-
-      //Constructors
-      iterator(){}
-
-      //Pointer like operators
-      reference operator*()  const {  return  this->m_it->m_data;  }
-      pointer   operator->() const {  return  pointer(&this->m_it->m_data);  }
-
-      //Increment / Decrement
-      iterator& operator++()  
-         { this->prot_incr(); return *this;  }
-
-      iterator operator++(int)
-         { typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
-      
-      iterator& operator--()
-         {  this->prot_decr(); return *this;  }
-
-      iterator operator--(int)
-         {  iterator tmp = *this; --*this; return tmp; }
-   };
-   /// @endcond
-
-   //! Iterator used to iterate backwards through a list. 
-   typedef std::reverse_iterator        reverse_iterator;
-   //! Const iterator used to iterate backwards through a list. 
-   typedef std::reverse_iterator  const_reverse_iterator;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs a list.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   list() 
+   list()
       : AllocHolder()
    {}
 
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit list(const allocator_type &a)
+   explicit list(const allocator_type &a) BOOST_CONTAINER_NOEXCEPT
       : AllocHolder(a)
    {}
 
@@ -337,10 +310,10 @@ class list
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit list(size_type n)
-      : AllocHolder(A())
+      : AllocHolder(Allocator())
    {  this->resize(n);  }
 
    //! Effects: Constructs a list that will use a copy of allocator a
@@ -348,32 +321,60 @@ class list
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   list(size_type n, const T& value, const A& a = A())
+   list(size_type n, const T& value, const Allocator& a = Allocator())
       : AllocHolder(a)
    {  this->insert(this->cbegin(), n, value);  }
 
    //! Effects: Copy constructs a list.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
-   list(const list& x) 
+   list(const list& x)
       : AllocHolder(x)
    {  this->insert(this->cbegin(), x.begin(), x.end());   }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    list(BOOST_RV_REF(list) x)
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   list(const list& x, const allocator_type &a)
+      : AllocHolder(a)
+   {  this->insert(this->cbegin(), x.begin(), x.end());   }
+
+   //! Effects: Move constructor sing the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   list(BOOST_RV_REF(list) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
    //! Effects: Constructs a list that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the list.
    //!
@@ -382,7 +383,7 @@ class list
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   list(InpIt first, InpIt last, const A &a = A())
+   list(InpIt first, InpIt last, const Allocator &a = Allocator())
       : AllocHolder(a)
    {  this->insert(this->cbegin(), first, last);  }
 
@@ -392,331 +393,18 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements.
-   ~list()
+   ~list() BOOST_CONTAINER_NOEXCEPT
    {} //AllocHolder clears the list
 
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const
-   {  return allocator_type(this->node_alloc()); }
-
-   const stored_allocator_type &get_stored_allocator() const 
-   {  return this->node_alloc(); }
-
-   stored_allocator_type &get_stored_allocator()
-   {  return this->node_alloc(); }
-
-   //! Effects: Erases all the elements of the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements in the list.
-   void clear()
-   {  AllocHolder::clear(alloc_version());  }
-
-   //! Effects: Returns an iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin()
-   { return iterator(this->icont().begin()); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const
-   {  return this->cbegin();   }
-
-   //! Effects: Returns an iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end()
-   {  return iterator(this->icont().end());  }
-
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const
-   {  return this->cend();  }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin()
-   {  return reverse_iterator(end());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const
-   {  return this->crbegin();  }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend()
-   {  return reverse_iterator(begin());   }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const
-   {  return this->crend();   }
-
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const
-   {  return const_iterator(this->non_const_icont().begin());   }
-
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const
-   {  return const_iterator(this->non_const_icont().end());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const
-   {  return const_reverse_iterator(this->cend());  }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const
-   {  return const_reverse_iterator(this->cbegin());   }
-
-   //! Effects: Returns true if the list contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const 
-   {  return !this->size();  }
-
-   //! Effects: Returns the number of the elements contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const 
-   {   return this->icont().size();   }
-
-   //! Effects: Returns the largest possible size of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const 
-   {  return AllocHolder::max_size();  }
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the beginning of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(const T &x);
-
-   //! Effects: Constructs a new element in the beginning of the list
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
-   #endif
-
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts a copy of x at the end of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(const T &x);
-
-   //! Effects: Constructs a new element in the end of the list
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
-   #endif
-
-   //! Effects: Removes the first element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_front()              
-   {  this->erase(this->cbegin());      }
-
-   //! Effects: Removes the last element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_back()               
-   {  const_iterator tmp = this->cend(); this->erase(--tmp);  }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front()             
-   { return *this->begin(); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const 
-   { return *this->begin(); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference back()              
-   { return *(--this->end()); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference back()  const 
-   { return *(--this->end()); }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x)
-   {
-      const_iterator iend = this->cend();
-      size_type len = this->size();
-      
-      if(len > new_size){
-         size_type to_erase = len - new_size;
-         while(to_erase--){
-            --iend;
-         }
-         this->erase(iend, this->cend());
-      }
-      else{
-         this->priv_create_and_insert_nodes(iend, new_size - len, x);
-      }
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size)
-   {
-      const_iterator iend = this->end();
-      size_type len = this->size();
-      
-      if(len > new_size){
-         size_type to_erase = len - new_size;
-         const_iterator ifirst;
-         if(to_erase < len/2u){
-            ifirst = iend;
-            while(to_erase--){
-               --ifirst;
-            }
-         }
-         else{
-            ifirst = this->begin();
-            size_type to_skip = len - to_erase;
-            while(to_skip--){
-               ++ifirst;
-            }
-         }
-         this->erase(ifirst, iend);
-      }
-      else{
-         this->priv_create_and_insert_nodes(this->cend(), new_size - len);
-      }
-   }
-
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(ThisType& x)
-   {  AllocHolder::swap(x);   }
-
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to the number of elements in x.
-   ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
+   list& operator=(BOOST_COPY_ASSIGN_REF(list) x)
    {
       if (&x != this){
          NodeAlloc &this_alloc     = this->node_alloc();
@@ -740,7 +428,7 @@ class list
    //! Throws: If allocator_type's copy constructor throws.
    //!
    //! Complexity: Constant.
-   ThisType& operator=(BOOST_RV_REF(ThisType) x)
+   list& operator=(BOOST_RV_REF(list) x)
    {
       if (&x != this){
          NodeAlloc &this_alloc = this->node_alloc();
@@ -763,53 +451,291 @@ class list
       return *this;
    }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x before p.
+   //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
-   void insert(const_iterator p, size_type n, const T& x)
-   { this->priv_create_and_insert_nodes(p, n, x); }
-
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before p.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator p, InpIt first, InpIt last) 
+   void assign(size_type n, const T& val)
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(p, first, last, Result());
+      typedef constant_iterator cvalue_iterator;
+      return this->assign(cvalue_iterator(val, n), cvalue_iterator());
    }
 
-   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Requires: position must be a valid iterator of *this.
+   //! Effects: Assigns the the range [first, last) to *this.
    //!
-   //! Effects: Insert a copy of x before position.
+   //! Throws: If memory allocation throws or
+   //!   T's constructor from dereferencing InpIt throws.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   iterator insert(const_iterator position, const T &x);
+   //! Complexity: Linear to n.
+   template 
+   void assign(InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
+   {
+      iterator first1      = this->begin();
+      const iterator last1 = this->end();
+      for ( ; first1 != last1 && first != last; ++first1, ++first)
+         *first1 = *first;
+      if (first == last)
+         this->erase(first1, last1);
+      else{
+         this->insert(last1, first, last);
+      }
+   }
 
-   //! Requires: position must be a valid iterator of *this.
+   //! Effects: Returns a copy of the internal allocator.
    //!
-   //! Effects: Insert a new element before position with mx's resources.
+   //! Throws: If allocator's copy constructor throws.
    //!
-   //! Throws: If memory allocation throws.
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return allocator_type(this->node_alloc()); }
+
+   //! Effects: Returns a reference to the internal allocator.
    //!
-   //! Complexity: Amortized constant time.
-   iterator insert(const_iterator position, T &&x);
-   #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
-   #endif
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().begin()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cbegin();   }
+
+   //! Effects: Returns an iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->icont().end());  }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cend();  }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(end());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->crbegin();  }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(begin());   }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->crend();   }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->non_const_icont().begin());   }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->non_const_icont().end());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->cend());  }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->cbegin());   }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the list contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   {  return !this->size();  }
+
+   //! Effects: Returns the number of the elements contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+   {   return this->icont().size();   }
+
+   //! Effects: Returns the largest possible size of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   {  return AllocHolder::max_size();  }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
+   {
+      if(!priv_try_shrink(new_size)){
+         typedef default_construct_iterator default_iterator;
+         this->insert(this->cend(), default_iterator(new_size - this->size()), default_iterator());
+      }
+   }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      if(!priv_try_shrink(new_size)){
+         this->insert(this->cend(), new_size - this->size(), x);
+      }
+   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front() BOOST_CONTAINER_NOEXCEPT
+   { return *this->begin(); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+   { return *this->begin(); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference back() BOOST_CONTAINER_NOEXCEPT
+   { return *(--this->end()); }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+   { return *(--this->end()); }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -822,9 +748,7 @@ class list
    //! Complexity: Constant
    template 
    void emplace_back(Args&&... args)
-   {
-      this->emplace(this->cend(), boost::forward(args)...);
-   }
+   {  this->emplace(this->cend(), boost::forward(args)...); }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... in the beginning of the list.
@@ -835,9 +759,7 @@ class list
    //! Complexity: Constant
    template 
    void emplace_front(Args&&... args)
-   {
-      this->emplace(this->cbegin(), boost::forward(args)...);
-   }
+   {  this->emplace(this->cbegin(), boost::forward(args)...);  }
 
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... before p.
@@ -884,6 +806,157 @@ class list
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the beginning of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the beginning of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator p, size_type n, const T& x)
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->insert(p, cvalue_iterator(x, n), cvalue_iterator());
+   }
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator p, InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && (container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      #endif
+      )
+   {
+      const typename Icont::iterator ipos(p.get());
+      iterator ret_it(ipos);
+      if(first != last){
+         ret_it = iterator(this->icont().insert(ipos, *this->create_node_from_it(first)));
+         ++first;
+      }
+      for (; first != last; ++first){
+         this->icont().insert(ipos, *this->create_node_from_it(first));
+      }
+      return ret_it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !(container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      )
+   {
+      //Optimized allocation and construction
+      insertion_functor func(this->icont(), p.get());
+      iterator before_p(p.get());
+      --before_p;
+      this->allocate_many_and_construct(first, std::distance(first, last), func);
+      return ++before_p;
+   }
+   #endif
+
+   //! Effects: Removes the first element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_front() BOOST_CONTAINER_NOEXCEPT
+   {  this->erase(this->cbegin());      }
+
+   //! Effects: Removes the last element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {  const_iterator tmp = this->cend(); this->erase(--tmp);  }
+
    //! Requires: p must be a valid iterator of *this.
    //!
    //! Effects: Erases the element at p p.
@@ -891,7 +964,7 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Amortized constant time.
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
    {  return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); }
 
    //! Requires: first and last must be valid iterator to elements in *this.
@@ -901,137 +974,195 @@ class list
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the distance between first and last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {  return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
 
-   //! Effects: Assigns the n copies of val to *this.
+   //! Effects: Swaps the contents of *this and x.
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to n.
-   void assign(size_type n, const T& val) 
-   {  this->priv_fill_assign(n, val);  }
+   //! Complexity: Constant.
+   void swap(list& x)
+   {  AllocHolder::swap(x);   }
 
-   //! Effects: Assigns the the range [first, last) to *this.
+   //! Effects: Erases all the elements of the list.
    //!
-   //! Throws: If memory allocation throws or
-   //!   T's constructor from dereferencing InpIt throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to n.
-   template 
-   void assign(InpIt first, InpIt last) 
-   {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
-   }
+   //! Complexity: Linear to the number of elements in the list.
+   void clear() BOOST_CONTAINER_NOEXCEPT
+   {  AllocHolder::clear(alloc_version());  }
+
+   //////////////////////////////////////////////
+   //
+   //              slist operations
+   //
+   //////////////////////////////////////////////
 
    //! Requires: p must point to an element contained
-   //!   by the list. x != *this
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
    //!
    //! Effects: Transfers all the elements of list x to this list, before the
    //!   the element pointed by p. No destructors or copy constructors are called.
    //!
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
+   //! Throws: Nothing
    //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, list& x) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont());
    }
 
    //! Requires: p must point to an element contained
-   //!   by this list. i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //!   If p == i or p == ++i, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(list) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, list &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      //BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), i.get());
    }
 
    //! Requires: p must point to an element contained
-   //!   by this list. first and last must point to elements contained in list x.
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
    //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear to the number of elements transferred.
-   //! 
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), i);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of elements transferred.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), first.get(), last.get());
    }
 
    //! Requires: p must point to an element contained
    //!   by this list. first and last must point to elements contained in list x.
-   //!   n == std::distance(first, last)
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
    //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of elements transferred.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   n == std::distance(first, last). this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws:  Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   //!
+   //! Note: Non-standard extension
+   void splice(const_iterator p, list &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
    {
-      BOOST_ASSERT((NodeAlloc&)*this == (NodeAlloc&)x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
       this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
    }
 
-   //! Effects: Reverses the order of elements in the list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: This function is linear time.
-   //! 
-   //! Note: Iterators and references are not invalidated
-   void reverse()
-   {  this->icont().reverse(); }    
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   n == std::distance(first, last). this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   //!
+   //! Note: Non-standard extension
+   void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last, n);  }
 
    //! Effects: Removes all the elements that compare equal to value.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: Linear time. It performs exactly size() comparisons for equality.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void remove(const T& value)
-   {  remove_if(equal_to_value(value));  }
+   {  this->remove_if(equal_to_value(value));  }
 
    //! Effects: Removes all the elements for which a specified
    //!   predicate is satisfied.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() calls to the predicate.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    template 
@@ -1041,25 +1172,25 @@ class list
       this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that are equal from the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void unique()
    {  this->unique(value_equal());  }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that satisfy some binary predicate from the list.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
-   //! 
+   //!
+   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    template 
@@ -1069,65 +1200,93 @@ class list
       this->icont().unique_and_dispose(Predicate(binary_pred), Destroyer(this->node_alloc()));
    }
 
-   //! Requires: The lists x and *this must be distinct. 
+   //! Requires: The lists x and *this must be distinct.
    //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this according to std::less. The merge is stable; 
-   //!   that is, if an element from *this is equivalent to one from x, then the element 
-   //!   from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   void merge(list& x)
+   void merge(list &x)
    {  this->merge(x, value_less());  }
 
+   //! Requires: The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   void merge(BOOST_RV_REF(list) x)
+   {  this->merge(static_cast(x)); }
+
    //! Requires: p must be a comparison function that induces a strict weak
    //!   ordering and both *this and x must be sorted according to that ordering
-   //!   The lists x and *this must be distinct. 
-   //! 
+   //!   The lists x and *this must be distinct.
+   //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this. The merge is stable; that is, if an element from *this is 
-   //!   equivalent to one from x, then the element from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   //! 
+   //!
    //! Note: Iterators and references to *this are not invalidated.
    template 
-   void merge(list &x, StrictWeakOrdering comp)
+   void merge(list &x, const StrictWeakOrdering &comp)
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().merge(x.icont(),
-            ValueCompareToNodeCompare(comp));
-      }
-      else{
-         throw std::runtime_error("list::merge called with unequal allocators");
-      }
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().merge(x.icont(),
+         ValueCompareToNodeCompare(comp));
    }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
+   //! Note: Iterators and references to *this are not invalidated.
+   template 
+   void merge(BOOST_RV_REF(list) x, StrictWeakOrdering comp)
+   {  this->merge(static_cast(x), comp); }
+
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
    //!
-   //! Throws: Nothing.
+   //! Throws: If comparison throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //!   
+   //!  
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    void sort()
    {  this->sort(value_less());  }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comp throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    template 
@@ -1139,65 +1298,79 @@ class list
       this->icont().sort(ValueCompareToNodeCompare(comp));
    }
 
+   //! Effects: Reverses the order of elements in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: This function is linear time.
+   //!
+   //! Note: Iterators and references are not invalidated
+   void reverse() BOOST_CONTAINER_NOEXCEPT
+   {  this->icont().reverse(); }   
+
    /// @cond
    private:
 
-   iterator priv_insert(const_iterator p, const T &x) 
+   bool priv_try_shrink(size_type new_size)
+   {
+      const size_type len = this->size();
+      if(len > new_size){
+         const const_iterator iend = this->cend();
+         size_type to_erase = len - new_size;
+         const_iterator ifirst;
+         if(to_erase < len/2u){
+            ifirst = iend;
+            while(to_erase--){
+               --ifirst;
+            }
+         }
+         else{
+            ifirst = this->cbegin();
+            size_type to_skip = len - to_erase;
+            while(to_skip--){
+               ++ifirst;
+            }
+         }
+         this->erase(ifirst, iend);
+         return true;
+      }
+      else{
+         return false;
+      }
+   }
+
+   iterator priv_insert(const_iterator p, const T &x)
    {
       NodePtr tmp = AllocHolder::create_node(x);
       return iterator(this->icont().insert(p.get(), *tmp));
    }
 
-   iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) 
+   iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
    {
       NodePtr tmp = AllocHolder::create_node(boost::move(x));
       return iterator(this->icont().insert(p.get(), *tmp));
    }
 
-   void priv_push_back (const T &x)   
+   void priv_push_back (const T &x)  
    {  this->insert(this->cend(), x);    }
 
    void priv_push_back (BOOST_RV_REF(T) x)
    {  this->insert(this->cend(), boost::move(x));    }
 
-   void priv_push_front (const T &x)   
+   void priv_push_front (const T &x)  
    {  this->insert(this->cbegin(), x);  }
 
    void priv_push_front (BOOST_RV_REF(T) x)
    {  this->insert(this->cbegin(), boost::move(x));  }
 
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end)
-   {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(pos, beg, end, alloc_version(), ItCat());
-   }
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
-   {
-      for (; beg != end; ++beg){
-         this->icont().insert(pos.get(), *this->create_node_from_it(beg));
-      }
-   }
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(pos, beg, end, allocator_v1(), std::input_iterator_tag());
-   }
-
    class insertion_functor;
    friend class insertion_functor;
 
    class insertion_functor
    {
       Icont &icont_;
-      typename Icont::const_iterator pos_;
+      typedef typename Icont::const_iterator iconst_iterator;
+      const iconst_iterator pos_;
 
       public:
       insertion_functor(Icont &icont, typename Icont::const_iterator pos)
@@ -1205,78 +1378,11 @@ class list
       {}
 
       void operator()(Node &n)
-      {  this->icont_.insert(pos_, n); }
+      {
+         this->icont_.insert(pos_, n);
+      }
    };
 
-
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator pos, FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      if(beg != end){
-         //Optimized allocation and construction
-         this->allocate_many_and_construct
-            (beg, std::distance(beg, end), insertion_functor(this->icont(), pos.get()));
-      }
-   }
-
-   //Default constructed version
-   void priv_create_and_insert_nodes(const_iterator pos, size_type n)
-   {
-      typedef default_construct_iterator default_iterator;
-      this->priv_create_and_insert_nodes(pos, default_iterator(n), default_iterator());
-   }
-
-   //Copy constructed version
-   void priv_create_and_insert_nodes(const_iterator pos, size_type n, const T& x)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->priv_create_and_insert_nodes(pos, cvalue_iterator(x, n), cvalue_iterator());
-   }
-
-   //Dispatch to detect iterator range or integer overloads
-   template 
-   void priv_insert_dispatch(const_iterator p,
-                             InputIter first, InputIter last,
-                             container_detail::false_)
-   {  this->priv_create_and_insert_nodes(p, first, last);   }
-
-   template
-   void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_) 
-   {  this->insert(p, (size_type)n, x);  }
-
-   void priv_fill_assign(size_type n, const T& val) 
-   {
-      iterator i = this->begin(), iend = this->end();
-
-      for ( ; i != iend && n > 0; ++i, --n)
-         *i = val;
-      if (n > 0){
-         this->priv_create_and_insert_nodes(this->cend(), n, val);
-      }
-      else{
-         this->erase(i, cend());
-      }
-   }
-
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-   {  this->priv_fill_assign((size_type) n, (T) val); }
-
-   template 
-   void priv_assign_dispatch(InputIter first2, InputIter last2, container_detail::false_)
-   {
-      iterator first1   = this->begin();
-      iterator last1    = this->end();
-      for ( ; first1 != last1 && first2 != last2; ++first1, ++first2)
-         *first1 = *first2;
-      if (first2 == last2)
-         this->erase(first1, last1);
-      else{
-         this->priv_create_and_insert_nodes(last1, first2, last2);
-      }
-   }
-
    //Functors for member algorithm defaults
    struct value_less
    {
@@ -1293,13 +1399,13 @@ class list
 
 };
 
-template 
-inline bool operator==(const list& x, const list& y)
+template 
+inline bool operator==(const list& x, const list& y)
 {
    if(x.size() != y.size()){
       return false;
    }
-   typedef typename list::const_iterator const_iterator;
+   typedef typename list::const_iterator const_iterator;
    const_iterator end1 = x.end();
 
    const_iterator i1 = x.begin();
@@ -1311,39 +1417,39 @@ inline bool operator==(const list& x, const list& y)
    return i1 == end1;
 }
 
-template 
-inline bool operator<(const list& x,
-                      const list& y)
+template 
+inline bool operator<(const list& x,
+                      const list& y)
 {
   return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline bool operator!=(const list& x, const list& y) 
+template 
+inline bool operator!=(const list& x, const list& y)
 {
   return !(x == y);
 }
 
-template 
-inline bool operator>(const list& x, const list& y) 
+template 
+inline bool operator>(const list& x, const list& y)
 {
   return y < x;
 }
 
-template 
-inline bool operator<=(const list& x, const list& y) 
+template 
+inline bool operator<=(const list& x, const list& y)
 {
   return !(y < x);
 }
 
-template 
-inline bool operator>=(const list& x, const list& y) 
+template 
+inline bool operator>=(const list& x, const list& y)
 {
   return !(x < y);
 }
 
-template 
-inline void swap(list& x, list& y)
+template 
+inline void swap(list& x, list& y)
 {
   x.swap(y);
 }
@@ -1351,15 +1457,14 @@ inline void swap(list& x, list& y)
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 namespace container {
 
 /// @endcond
@@ -1368,4 +1473,4 @@ namespace container {
 
 #include 
 
-#endif // BOOST_CONTAINER_LIST_HPP_
+#endif // BOOST_CONTAINER_LIST_HPP
diff --git a/project/jni/boost/include/boost/container/map.hpp b/project/jni/boost/include/boost/container/map.hpp
index 8f7ecd42b..d4ab4236b 100644
--- a/project/jni/boost/include/boost/container/map.hpp
+++ b/project/jni/boost/include/boost/container/map.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -30,328 +30,393 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
 
-
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators == and <, needed for friend declarations.
-template 
-inline bool operator==(const map& x, 
-                       const map& y);
+template 
+inline bool operator==(const map& x,
+                       const map& y);
 
-template 
-inline bool operator<(const map& x, 
-                      const map& y);
+template 
+inline bool operator<(const map& x,
+                      const map& y);
 /// @endcond
 
-//! A map is a kind of associative container that supports unique keys (contains at 
-//! most one of each key value) and provides for fast retrieval of values of another 
+//! A map is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of values of another
 //! type T based on the keys. The map class supports bidirectional iterators.
-//! 
-//! A map satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
+//!
+//! A map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
 //! map the key_type is Key and the value_type is std::pair.
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! Compare is the ordering function for Keys (e.g. std::less).
 //!
-//! A is the allocator to allocate the value_types
+//! Allocator is the allocator to allocate the value_types
 //! (e.g. allocator< std::pair > ).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< const Key, T> > >
 #else
-template 
+template 
 #endif
-class map 
+class map
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(map)
-   typedef container_detail::rbtree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
-   tree_t m_tree;  // red-black tree representing map
 
+   typedef std::pair  value_type_impl;
+   typedef container_detail::rbtree
+      , Compare, Allocator> tree_t;
+   typedef container_detail::pair  movable_value_type_impl;
+   typedef container_detail::tree_value_compare
+      < Key, value_type_impl, Compare, container_detail::select1st
+      >  value_compare_impl;
+   tree_t m_tree;  // red-black tree representing map
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef T                                       mapped_type;
-   typedef Pred                                    key_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
-   typedef std::pair        nonconst_value_type;
-   typedef container_detail::pair
-                            nonconst_impl_value_type;
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                  value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                        iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                  const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)          const_reverse_iterator;
+   typedef std::pair                                         nonconst_value_type;
+   typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl)                          movable_value_type;
 
-   /// @cond
-   class value_compare_impl
-      :  public Pred,
-         public std::binary_function 
-   {
-      friend class map;
-    protected :
-      value_compare_impl(const Pred &c) : Pred(c) {}
-    public:
-      bool operator()(const value_type& x, const value_type& y) const {
-         return Pred::operator()(x.first, y.first);
-      }
-   };
-   /// @endcond
-   typedef value_compare_impl             value_compare;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty map.
-   //! 
+   //!
    //! Complexity: Constant.
    map()
       : m_tree()
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object 
+   //! Effects: Constructs an empty map using the specified comparison object
    //! and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit map(const Pred& comp,
+   explicit map(const Compare& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty map using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   map(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, true) 
+      : m_tree(true, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty map using the specified comparison object and 
+   //! Effects: Constructs an empty map using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
    map( ordered_unique_range_t, InputIterator first, InputIterator last
-      , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_tree(ordered_range, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Copy constructs a map.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   map(const map& x) 
+   map(const map& x)
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Move constructs a map. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   map(BOOST_RV_REF(map) x) 
+   map(BOOST_RV_REF(map) x)
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Copy constructs a map using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   map(const map& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Move constructs a map using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if x == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   map(BOOST_RV_REF(map) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
    map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
    map& operator=(BOOST_RV_REF(map) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return value_compare(m_tree.key_comp()); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   { return m_tree.begin(); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-   { return m_tree.end(); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.begin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.end(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.rbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.max_size(); }
 
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: If there is no key equivalent to x in the map, inserts 
+   //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(x, T()) into the map.
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type& operator[](const key_type &k);
 
-   //! Effects: If there is no key equivalent to x in the map, inserts 
+   //! Effects: If there is no key equivalent to x in the map, inserts
    //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
-   //! 
-   //! Returns: A reference to the mapped_type corresponding to x in *this.
-   //! 
+   //!
+   //! Returns: Allocator reference to the mapped_type corresponding to x in *this.
+   //!
    //! Complexity: Logarithmic.
    mapped_type& operator[](key_type &&k);
    #else
-   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, priv_subscript)
+   BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
    #endif
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
    //! Complexity: logarithmic.
    T& at(const key_type& k)
@@ -363,7 +428,7 @@ class map
       return i->second;
    }
 
-   //! Returns: A reference to the element whose key is equivalent to x.
+   //! Returns: Allocator reference to the element whose key is equivalent to x.
    //! Throws: An exception object of type out_of_range if no such element is present.
    //! Complexity: logarithmic.
    const T& at(const key_type& k) const
@@ -375,70 +440,68 @@ class map
       return i->second;
    }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(map& x)
-   { m_tree.swap(x.m_tree); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
-   //! Effects: Inserts x if and only if there is no element in the container 
+   //! Effects: Inserts x if and only if there is no element in the container
    //!   with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(const value_type& x) 
+   std::pair insert(const value_type& x)
    { return m_tree.insert_unique(x); }
 
-   //! Effects: Inserts a new value_type created from the pair if and only if 
+   //! Effects: Inserts a new value_type created from the pair if and only if
    //! there is no element in the container  with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(const nonconst_value_type& x) 
+   std::pair insert(const nonconst_value_type& x)
    { return m_tree.insert_unique(x); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(nonconst_value_type) x) 
+   std::pair insert(BOOST_RV_REF(nonconst_value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
    //! Effects: Inserts a new value_type move constructed from the pair if and
    //! only if there is no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(nonconst_impl_value_type) x) 
+   std::pair insert(BOOST_RV_REF(movable_value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
+   std::pair insert(BOOST_RV_REF(value_type) x)
    { return m_tree.insert_unique(boost::move(x)); }
 
-   //! Effects: Inserts a copy of x in the container if and only if there is 
+   //! Effects: Inserts a copy of x in the container if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -447,10 +510,10 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, const value_type& x)
+   iterator insert(const_iterator position, const value_type& x)
    { return m_tree.insert_unique(position, x); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -459,10 +522,10 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
-   //! Effects: Move constructs a new value from x if and only if there is 
+   //! Effects: Move constructs a new value from x if and only if there is
    //!   no element in the container with key equivalent to the key of x.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -471,7 +534,7 @@ class map
    //!
    //! Complexity: Logarithmic in general, but amortized constant if t
    //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! Effects: Inserts a copy of x in the container.
@@ -480,7 +543,7 @@ class map
    //! Returns: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   iterator insert(iterator position, const nonconst_value_type& x)
+   iterator insert(const_iterator position, const nonconst_value_type& x)
    { return m_tree.insert_unique(position, x); }
 
    //! Effects: Inserts an element move constructed from x in the container.
@@ -489,27 +552,27 @@ class map
    //! Returns: An iterator pointing to the element with key equivalent to the key of x.
    //!
    //! Complexity: Logarithmic.
-   iterator insert(iterator position, BOOST_RV_REF(value_type) x)
+   iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
    { return m_tree.insert_unique(position, boost::move(x)); }
 
    //! Requires: first, last are not iterators into *this.
    //!
-   //! Effects: inserts each element from the range [first,last) if and only 
+   //! Effects: inserts each element from the range [first,last) if and only
    //!   if there is no element with key equivalent to the key of that element.
    //!
    //! Complexity: At most N log(size()+N) (N is the distance from first to last)
    template 
-   void insert(InputIterator first, InputIterator last) 
+   void insert(InputIterator first, InputIterator last)
    {  m_tree.insert_unique(first, last);  }
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
    //! Effects: Inserts an object x of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with an equivalent key.
    //!   p is a hint pointing to where the insert should start to search.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
@@ -520,7 +583,7 @@ class map
    {  return m_tree.emplace_unique(boost::forward(args)...); }
 
    //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the container if and only if there is 
+   //!   std::forward(args)... in the container if and only if there is
    //!   no element in the container with an equivalent key.
    //!   p is a hint pointing to where the insert should start to search.
    //!
@@ -554,11 +617,11 @@ class map
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -566,7 +629,7 @@ class map
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -574,75 +637,109 @@ class map
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(map& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return value_compare(m_tree.key_comp()); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.find(x) == m_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -660,13 +757,13 @@ class map
       // i->first is greater than or equivalent to k.
       if (i == end() || key_comp()(k, (*i).first)){
          container_detail::value_init m;
-         nonconst_impl_value_type val(k, boost::move(m.m_t));
+         movable_value_type val(k, boost::move(m.m_t));
          i = insert(i, boost::move(val));
       }
       return (*i).second;
    }
 
-   mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk) 
+   mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
    {
       key_type &k = mk;
       //we can optimize this
@@ -674,7 +771,7 @@ class map
       // i->first is greater than or equivalent to k.
       if (i == end() || key_comp()(k, (*i).first)){
          container_detail::value_init m;
-         nonconst_impl_value_type val(boost::move(k), boost::move(m.m_t));
+         movable_value_type val(boost::move(k), boost::move(m.m_t));
          i = insert(i, boost::move(val));
       }
       return (*i).second;
@@ -683,429 +780,408 @@ class map
    /// @endcond
 };
 
-template 
-inline bool operator==(const map& x, 
-                       const map& y) 
+template 
+inline bool operator==(const map& x,
+                       const map& y)
    {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const map& x, 
-                      const map& y) 
+template 
+inline bool operator<(const map& x,
+                      const map& y)
    {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator!=(const map& x,
+                       const map& y)
    {  return !(x == y); }
 
-template 
-inline bool operator>(const map& x, 
-                      const map& y) 
+template 
+inline bool operator>(const map& x,
+                      const map& y)
    {  return y < x;  }
 
-template 
-inline bool operator<=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator<=(const map& x,
+                       const map& y)
    {  return !(y < x);  }
 
-template 
-inline bool operator>=(const map& x, 
-                       const map& y) 
+template 
+inline bool operator>=(const map& x,
+                       const map& y)
    {  return !(x < y);  }
 
-template 
-inline void swap(map& x, map& y) 
+template 
+inline void swap(map& x, map& y)
    {  x.swap(y);  }
 
 /// @cond
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
-template 
-inline bool operator==(const multimap& x, 
-                       const multimap& y);
+template 
+inline bool operator==(const multimap& x,
+                       const multimap& y);
 
-template 
-inline bool operator<(const multimap& x, 
-                      const multimap& y);
+template 
+inline bool operator<(const multimap& x,
+                      const multimap& y);
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
 
-//! A multimap is a kind of associative container that supports equivalent keys 
-//! (possibly containing multiple copies of the same key value) and provides for 
+//! A multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
 //! fast retrieval of values of another type T based on the keys. The multimap class
 //! supports bidirectional iterators.
-//! 
-//! A multimap satisfies all of the requirements of a container and of a reversible 
-//! container and of an associative container. For a 
-//! map the key_type is Key and the value_type is std::pair. 
 //!
-//! Pred is the ordering function for Keys (e.g. std::less).
+//! A multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
+//! map the key_type is Key and the value_type is std::pair.
 //!
-//! A is the allocator to allocate the value_types
+//! Compare is the ordering function for Keys (e.g. std::less).
+//!
+//! Allocator is the allocator to allocate the value_types
 //!(e.g. allocator< std::pair<const Key, T> >).
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >, class A = std::allocator >
+template , class Allocator = std::allocator< std::pair< const Key, T> > >
 #else
-template 
+template 
 #endif
-class multimap 
+class multimap
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multimap)
-   typedef container_detail::rbtree, 
-                           container_detail::select1st< std::pair >, 
-                           Pred, 
-                           A> tree_t;
+
+   typedef std::pair  value_type_impl;
+   typedef container_detail::rbtree
+      , Compare, Allocator> tree_t;
+   typedef container_detail::pair  movable_value_type_impl;
+   typedef container_detail::tree_value_compare
+      < Key, value_type_impl, Compare, container_detail::select1st
+      >  value_compare_impl;
    tree_t m_tree;  // red-black tree representing map
-   typedef typename container_detail::
-      move_const_ref_type::type insert_key_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef T                                       mapped_type;
-   typedef Pred                                    key_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
-   typedef std::pair        nonconst_value_type;
-   typedef container_detail::pair
-                            nonconst_impl_value_type;
+   typedef Key                                                                      key_type;
+   typedef T                                                                        mapped_type;
+   typedef std::pair                                                  value_type;
+   typedef typename boost::container::allocator_traits::pointer          pointer;
+   typedef typename boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename boost::container::allocator_traits::reference        reference;
+   typedef typename boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename boost::container::allocator_traits::size_type        size_type;
+   typedef typename boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)           stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(value_compare_impl)                               value_compare;
+   typedef Compare                                                                  key_compare;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                        iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                  const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)          const_reverse_iterator;
+   typedef std::pair                                         nonconst_value_type;
+   typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl)                          movable_value_type;
 
-   /// @cond
-   class value_compare_impl
-      :  public Pred,
-         public std::binary_function 
-   {
-      friend class multimap;
-    protected :
-      value_compare_impl(const Pred &c) : Pred(c) {}
-    public:
-      bool operator()(const value_type& x, const value_type& y) const {
-         return Pred::operator()(x.first, y.first);
-      }
-   };
-   /// @endcond
-   typedef value_compare_impl                      value_compare;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty multimap.
-   //! 
+   //!
    //! Complexity: Constant.
    multimap()
       : m_tree()
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit multimap(const Pred& comp, const allocator_type& a = allocator_type())
+   explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Constructs an empty multimap using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    multimap(InputIterator first, InputIterator last,
-            const Pred& comp = Pred(),
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, false) 
+      : m_tree(false, first, last, comp, a)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
-   //! Effects: Constructs an empty multimap using the specified comparison object and 
+   //! Effects: Constructs an empty multimap using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
-   multimap(ordered_range_t ordered_range, InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
-
    //! Effects: Copy constructs a multimap.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multimap(const multimap& x) 
+   multimap(const multimap& x)
       : m_tree(x.m_tree)
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Move constructs a multimap. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   multimap(BOOST_RV_REF(multimap) x) 
+   multimap(BOOST_RV_REF(multimap) x)
       : m_tree(boost::move(x.m_tree))
    {
       //Allocator type must be std::pair
-      BOOST_STATIC_ASSERT((container_detail::is_same, typename     A::value_type>::value));
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Copy constructs a multimap.
+   //!
+   //! Complexity: Linear in x.size().
+   multimap(const multimap& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
+   }
+
+   //! Effects: Move constructs a multimap using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {
+      //Allocator type must be std::pair
+      BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value));
    }
 
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x) 
+   multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   multimap& operator=(BOOST_RV_REF(multimap) x) 
+   multimap& operator=(BOOST_RV_REF(multimap) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return value_compare(m_tree.key_comp()); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
-   stored_allocator_type &get_stored_allocator()
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   { return m_tree.begin(); }
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cbegin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
-   { return m_tree.end(); }
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); }
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.begin(); }
+
+   //! Effects: Returns a const_iterator to the end of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.end(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return m_tree.rbegin(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.rend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(multimap& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const value_type& x) 
-   { return m_tree.insert_equal(x); }
-
-   //! Effects: Inserts a new value constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const nonconst_value_type& x) 
-   { return m_tree.insert_equal(x); }
-
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(BOOST_RV_REF(nonconst_value_type) x) 
-   { return m_tree.insert_equal(boost::move(x)); }
-
-   //! Effects: Inserts a new value move-constructed from x and returns 
-   //!   the iterator pointing to the newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(BOOST_RV_REF(nonconst_impl_value_type) x) 
-   { return m_tree.insert_equal(boost::move(x)); }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, const value_type& x)
-   { return m_tree.insert_equal(position, x); }
-
-   //! Effects: Inserts a new value constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, const nonconst_value_type& x)
-   { return m_tree.insert_equal(position, x); }
-
-   //! Effects: Inserts a new value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
-   { return m_tree.insert_equal(position, boost::move(x)); }
-
-   //! Effects: Inserts a new value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
-   { return m_tree.insert_equal(position, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_equal(first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -1153,14 +1229,95 @@ class multimap
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const value_type& x)
+   { return m_tree.insert_equal(x); }
+
+   //! Effects: Inserts a new value constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const nonconst_value_type& x)
+   { return m_tree.insert_equal(x); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(BOOST_RV_REF(nonconst_value_type) x)
+   { return m_tree.insert_equal(boost::move(x)); }
+
+   //! Effects: Inserts a new value move-constructed from x and returns
+   //!   the iterator pointing to the newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(BOOST_RV_REF(movable_value_type) x)
+   { return m_tree.insert_equal(boost::move(x)); }
+
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, const value_type& x)
+   { return m_tree.insert_equal(position, x); }
+
+   //! Effects: Inserts a new value constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, const nonconst_value_type& x)
+   { return m_tree.insert_equal(position, x); }
+
+   //! Effects: Inserts a new value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x)
+   { return m_tree.insert_equal(position, boost::move(x)); }
+
+   //! Effects: Inserts a new value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
+   { return m_tree.insert_equal(position, boost::move(x)); }
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_equal(first, last); }
+
    //! Effects: Erases the element pointed to by position.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(position); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1168,7 +1325,7 @@ class multimap
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1176,76 +1333,109 @@ class multimap
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    { return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(multimap& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear() BOOST_CONTAINER_NOEXCEPT
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return value_compare(m_tree.key_comp()); }
+
+   //////////////////////////////////////////////
+   //
+   //              map operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const iterator pointing to an element with the key
+   //! Returns: Allocator const iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    { return m_tree.count(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x);  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator upper_bound(const key_type& x) 
+   iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x); }
 
-   //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
-   //!
-   //! Complexity: Logarithmic
-   std::pair equal_range(const key_type& x) 
-   {  return m_tree.equal_range(x);   }
-
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x)
+   {  return m_tree.equal_range(x);   }
+
+   //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
+   //!
+   //! Complexity: Logarithmic
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x);   }
 
    /// @cond
@@ -1259,52 +1449,52 @@ class multimap
    /// @endcond
 };
 
-template 
-inline bool operator==(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator==(const multimap& x,
+                       const multimap& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const multimap& x, 
-                      const multimap& y) 
+template 
+inline bool operator<(const multimap& x,
+                      const multimap& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator!=(const multimap& x,
+                       const multimap& y)
 {  return !(x == y);  }
 
-template 
-inline bool operator>(const multimap& x, 
-                      const multimap& y) 
+template 
+inline bool operator>(const multimap& x,
+                      const multimap& y)
 {  return y < x;  }
 
-template 
-inline bool operator<=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator<=(const multimap& x,
+                       const multimap& y)
 {  return !(y < x);  }
 
-template 
-inline bool operator>=(const multimap& x, 
-                       const multimap& y) 
+template 
+inline bool operator>=(const multimap& x,
+                       const multimap& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(multimap& x, multimap& y) 
+template 
+inline void swap(multimap& x, multimap& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/scoped_allocator.hpp b/project/jni/boost/include/boost/container/scoped_allocator.hpp
new file mode 100644
index 000000000..39fd4da90
--- /dev/null
+++ b/project/jni/boost/include/boost/container/scoped_allocator.hpp
@@ -0,0 +1,1470 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Pablo Halpern 2009. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
+
+#if (defined MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace boost { namespace container {
+
+//! Remark: if a specialization is derived from true_type, indicates that T may be constructed
+//! with an allocator as its last constructor argument.  Ideally, all constructors of T (including the
+//! copy and move constructors) should have a variant that accepts a final argument of
+//! allocator_type.
+//!
+//! Requires: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_type is the last
+//! parameter.  If not all constructors of T can be called with a final allocator_type argument,
+//! and if T is used in a context where a container must call such a constructor, then the program is
+//! ill-formed.
+//!
+//! [Example:
+//!  template  >  
+//!  class Z {
+//!    public:
+//!      typedef Allocator allocator_type;
+//!
+//!    // Default constructor with optional allocator suffix
+//!    Z(const allocator_type& a = allocator_type());
+//!
+//!    // Copy constructor and allocator-extended copy constructor
+//!    Z(const Z& zz);
+//!    Z(const Z& zz, const allocator_type& a);
+//! };
+//!
+//! // Specialize trait for class template Z
+//! template  >
+//! struct constructible_with_allocator_suffix > 
+//!      : ::boost::true_type { };
+//! -- end example]
+//!
+//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
+//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
+//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
+//! Applications aiming portability with several compilers should always define this trait.
+//!
+//! In conforming C++11 compilers or compilers supporting SFINAE expressions
+//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
+//! to detect if a type should be constructed with suffix or prefix allocator arguments.
+template 
+struct constructible_with_allocator_suffix
+   : ::boost::false_type
+{};
+
+//! Remark: if a specialization is derived from true_type, indicates that T may be constructed
+//! with allocator_arg and T::allocator_type as its first two constructor arguments. 
+//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
+//! that accepts these two initial arguments.
+//!
+//! Requires: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_arg_t is the first
+//! parameter and allocator_type is the second parameter.  If not all constructors of T can be
+//! called with these initial arguments, and if T is used in a context where a container must call such
+//! a constructor, then the program is ill-formed.
+//!
+//! [Example:
+//! template  >
+//! class Y {
+//!    public:
+//!       typedef Allocator allocator_type;
+//! 
+//!       // Default constructor with and allocator-extended default constructor
+//!       Y();
+//!       Y(allocator_arg_t, const allocator_type& a);
+//! 
+//!       // Copy constructor and allocator-extended copy constructor
+//!       Y(const Y& yy);
+//!       Y(allocator_arg_t, const allocator_type& a, const Y& yy);
+//! 
+//!       // Variadic constructor and allocator-extended variadic constructor
+//!       template Y(Args&& args...);
+//!       template 
+//!       Y(allocator_arg_t, const allocator_type& a, Args&&... args);
+//! };
+//! 
+//! // Specialize trait for class template Y
+//! template  >
+//! struct constructible_with_allocator_prefix > 
+//!       : ::boost::true_type { };
+//! 
+//! -- end example]
+//!
+//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
+//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
+//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
+//! Applications aiming portability with several compilers should always define this trait.
+//!
+//! In conforming C++11 compilers or compilers supporting SFINAE expressions
+//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
+//! to detect if a type should be constructed with suffix or prefix allocator arguments.
+template 
+struct constructible_with_allocator_prefix
+    : ::boost::false_type
+{};
+
+///@cond
+
+namespace container_detail {
+
+template
+struct uses_allocator_imp
+{
+   // Use SFINAE (Substitution Failure Is Not An Error) to detect the
+   // presence of an 'allocator_type' nested type convertilble from Alloc.
+
+   private:
+   // Match this function if TypeT::allocator_type exists and is
+   // implicitly convertible from Alloc
+   template 
+   static char test(int, typename U::allocator_type);
+
+   // Match this function if TypeT::allocator_type does not exist or is
+   // not convertible from Alloc.
+   template 
+   static int test(LowPriorityConversion, LowPriorityConversion);
+
+   static Alloc alloc;  // Declared but not defined
+
+   public:
+   enum { value = sizeof(test(0, alloc)) == sizeof(char) };
+};
+
+}  //namespace container_detail {
+
+///@endcond
+
+//! Remark: Automatically detects if T has a nested allocator_type that is convertible from
+//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
+//! specialize this type to derive from true_type for a T of user-defined type if T does not
+//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
+//!
+//! Result: derived from true_type if Convertible and
+//! derived from false_type otherwise.
+template 
+struct uses_allocator
+   : boost::integral_constant::value>
+{};
+
+///@cond
+
+namespace container_detail {
+
+template 
+struct is_scoped_allocator_imp
+{
+   template 
+   static char test(int, typename T::outer_allocator_type*);
+
+   template 
+   static int test(LowPriorityConversion, void*);
+
+   static const bool value = (sizeof(char) == sizeof(test(0, 0)));
+};
+
+template::value >
+struct outermost_allocator_type_impl
+{
+   typedef typename MaybeScopedAlloc::outer_allocator_type outer_type;
+   typedef typename outermost_allocator_type_impl::type type;
+};
+
+template
+struct outermost_allocator_type_impl
+{
+   typedef MaybeScopedAlloc type;
+};
+
+template::value >
+struct outermost_allocator_imp
+{
+   typedef MaybeScopedAlloc type;
+
+   static type &get(MaybeScopedAlloc &a)
+   {  return a;  }
+
+   static const type &get(const MaybeScopedAlloc &a)
+   {  return a;  }
+};
+
+template
+struct outermost_allocator_imp
+{
+   typedef typename MaybeScopedAlloc::outer_allocator_type outer_type;
+   typedef typename outermost_allocator_type_impl::type type;
+
+   static type &get(MaybeScopedAlloc &a)
+   {  return outermost_allocator_imp::get(a.outer_allocator());  }
+
+   static const type &get(const MaybeScopedAlloc &a)
+   {  return outermost_allocator_imp::get(a.outer_allocator());  }
+};
+
+}  //namespace container_detail {
+
+template 
+struct is_scoped_allocator
+   : boost::integral_constant::value>
+{};
+
+template 
+struct outermost_allocator
+   : container_detail::outermost_allocator_imp
+{};
+
+template 
+typename container_detail::outermost_allocator_imp::type &
+   get_outermost_allocator(Alloc &a)
+{  return container_detail::outermost_allocator_imp::get(a);   }
+
+template 
+const typename container_detail::outermost_allocator_imp::type &
+   get_outermost_allocator(const Alloc &a)
+{  return container_detail::outermost_allocator_imp::get(a);   }
+
+namespace container_detail {
+
+// Check if we can detect is_convertible using advanced SFINAE expressions
+#if !defined(BOOST_NO_SFINAE_EXPR)
+
+   //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list
+   //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html
+   //! Thanks Mathias!
+
+   //With variadic templates, we need a single class to implement the trait
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template
+   struct is_constructible_impl
+   {
+      typedef char yes_type;
+      struct no_type
+      { char padding[2]; };
+
+      template
+      struct dummy;
+
+      template
+      static yes_type test(dummy()...))>*);
+
+      template
+      static no_type test(...);
+
+      static const bool value = sizeof(test(0)) == sizeof(yes_type);
+   };
+
+   template
+   struct is_constructible
+      : boost::integral_constant::value>
+   {};
+
+   template 
+   struct is_constructible_with_allocator_prefix
+      : is_constructible
+   {};
+
+   #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   //Without variadic templates, we need to use de preprocessor to generate
+   //some specializations.
+
+   #define BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS \
+      BOOST_PP_ADD(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, 3)
+   //!
+
+   //Generate N+1 template parameters so that we can specialize N
+   template
+   struct is_constructible_impl;
+
+   //Generate N specializations, from 0 to
+   //BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS parameters
+   #define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+   template                                     \
+   struct is_constructible_impl                                                                    \
+                                                                                            \
+   {                                                                                               \
+      typedef char yes_type;                                                                       \
+      struct no_type                                                                               \
+      { char padding[2]; };                                                                        \
+                                                                                                   \
+      template                                                                      \
+      struct dummy;                                                                                \
+                                                                                                   \
+      template                                                                            \
+      static yes_type test(dummy*);    \
+                                                                                                   \
+      template                                                                            \
+      static no_type test(...);                                                                    \
+                                                                                                   \
+      static const bool value = sizeof(test(0)) == sizeof(yes_type);                            \
+   };                                                                                              \
+   //!
+
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   //Finally just inherit from the implementation to define he trait
+   template< class T
+           BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS
+                                 , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                 , void)
+           >
+   struct is_constructible
+      : boost::integral_constant
+         < bool
+         , is_constructible_impl
+            < T
+            BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P)
+            , void>::value
+         >
+   {};
+
+   //Finally just inherit from the implementation to define he trait
+   template 
+   struct is_constructible_with_allocator_prefix
+      : is_constructible
+         < T, allocator_arg_t, InnerAlloc
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2), P)
+         >
+   {};
+/*
+   template 
+   struct is_constructible_with_allocator_suffix
+      : is_constructible
+         < T
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1), P)
+         , InnerAlloc
+         >
+   {};*/
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#else    // #if !defined(BOOST_NO_SFINAE_EXPR)
+
+   //Without advanced SFINAE expressions, we can't use is_constructible
+   //so backup to constructible_with_allocator_xxx
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template < class T, class InnerAlloc, class ...Args>
+   struct is_constructible_with_allocator_prefix
+      : constructible_with_allocator_prefix
+   {};
+/*
+   template < class T, class InnerAlloc, class ...Args>
+   struct is_constructible_with_allocator_suffix
+      : constructible_with_allocator_suffix
+   {};*/
+
+   #else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   template < class T
+            , class InnerAlloc
+            BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+                                  , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                  , void)
+            >
+   struct is_constructible_with_allocator_prefix
+      : constructible_with_allocator_prefix
+   {};
+/*
+   template < class T
+            , class InnerAlloc
+            BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+                                  , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
+                                  , void)
+            >
+   struct is_constructible_with_allocator_suffix
+      : constructible_with_allocator_suffix
+   {};*/
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#endif   // #if !defined(BOOST_NO_SFINAE_EXPR)
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_allocator_prefix_suffix
+   ( boost::true_type  use_alloc_prefix, OutermostAlloc& outermost_alloc
+   , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args)
+{
+   (void)use_alloc_prefix;
+   allocator_traits::construct
+      ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward(args)...);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_allocator_prefix_suffix
+   ( boost::false_type use_alloc_prefix, OutermostAlloc& outermost_alloc
+   , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)use_alloc_prefix;
+   allocator_traits::construct
+      (outermost_alloc, p, ::boost::forward(args)..., inner_alloc);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_uses_allocator
+   ( boost::true_type uses_allocator, OutermostAlloc& outermost_alloc
+   , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)uses_allocator;
+   //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix::value ||
+   //                     is_constructible_with_allocator_suffix::value ));
+   dispatch_allocator_prefix_suffix
+      ( is_constructible_with_allocator_prefix()
+      , outermost_alloc, inner_alloc, p, ::boost::forward(args)...);
+}
+
+template < typename OutermostAlloc
+         , typename InnerAlloc
+         , typename T
+         , class ...Args
+         >
+inline void dispatch_uses_allocator
+   ( boost::false_type uses_allocator, OutermostAlloc & outermost_alloc
+   , InnerAlloc & inner_alloc
+   ,T* p, BOOST_FWD_REF(Args)...args)
+{
+   (void)uses_allocator; (void)inner_alloc;
+   allocator_traits::construct
+      (outermost_alloc, p, ::boost::forward(args)...);
+}
+
+#else    //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#define BOOST_PP_LOCAL_MACRO(n)                                                              \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_allocator_prefix_suffix(                                                \
+                                       boost::true_type  use_alloc_prefix,                   \
+                                       OutermostAlloc& outermost_alloc,                      \
+                                       InnerAlloc&    inner_alloc,                           \
+                                       T* p                                                  \
+                              BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))   \
+{                                                                                            \
+   (void)use_alloc_prefix,                                                                   \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p, allocator_arg, inner_alloc                                        \
+       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                      \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_allocator_prefix_suffix(                                                \
+                           boost::false_type use_alloc_prefix,                               \
+                           OutermostAlloc& outermost_alloc,                                  \
+                           InnerAlloc&    inner_alloc,                                       \
+                           T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+{                                                                                            \
+   (void)use_alloc_prefix;                                                                   \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p                                                                    \
+       BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                        \
+      , inner_alloc);                                                                        \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_uses_allocator(boost::true_type uses_allocator,                         \
+                        OutermostAlloc& outermost_alloc,                                     \
+                        InnerAlloc&    inner_alloc,                                          \
+                        T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))    \
+{                                                                                            \
+   (void)uses_allocator;                                                                     \
+   dispatch_allocator_prefix_suffix                                                          \
+      (is_constructible_with_allocator_prefix                                                \
+         < T, InnerAlloc BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>()                              \
+         , outermost_alloc, inner_alloc, p                                                   \
+         BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                    \
+}                                                                                            \
+                                                                                             \
+template < typename OutermostAlloc                                                           \
+         , typename InnerAlloc                                                               \
+         , typename T                                                                        \
+         BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+         >                                                                                   \
+inline void dispatch_uses_allocator(boost::false_type uses_allocator                         \
+                        ,OutermostAlloc &    outermost_alloc                                 \
+                        ,InnerAlloc &    inner_alloc                                         \
+                        ,T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))   \
+{                                                                                            \
+   (void)uses_allocator; (void)inner_alloc;                                                  \
+   allocator_traits::construct                                               \
+      (outermost_alloc, p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));   \
+}                                                                                            \
+//!
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif   //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template 
+class scoped_allocator_adaptor_base
+   : public OuterAlloc
+{
+   typedef allocator_traits outer_traits_type;
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)
+
+   public:
+   template 
+   struct rebind_base
+   {
+      typedef scoped_allocator_adaptor_base other;
+   };
+
+   typedef OuterAlloc outer_allocator_type;
+   typedef scoped_allocator_adaptor inner_allocator_type;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_copy_assignment::value ||
+      inner_allocator_type::propagate_on_container_copy_assignment::value
+      > propagate_on_container_copy_assignment;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_move_assignment::value ||
+      inner_allocator_type::propagate_on_container_move_assignment::value
+      > propagate_on_container_move_assignment;
+   typedef boost::integral_constant<
+      bool,
+      outer_traits_type::propagate_on_container_swap::value ||
+      inner_allocator_type::propagate_on_container_swap::value
+      > propagate_on_container_swap;
+
+   scoped_allocator_adaptor_base()
+      {}
+
+   template 
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      , m_inner(args...)
+      {}
+
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+      : outer_allocator_type(::boost::move(other.outer_allocator()))
+      , m_inner(::boost::move(other.inner_allocator()))
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base
+          BOOST_RV_REF_END other)
+      : outer_allocator_type(other.outer_allocator())
+      , m_inner(other.inner_allocator())
+      {}
+
+   protected:
+   struct internal_type_t{};
+
+   template 
+   scoped_allocator_adaptor_base
+      ( internal_type_t
+      , BOOST_FWD_REF(OuterA2) outerAlloc
+      , const inner_allocator_type &inner)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      , m_inner(inner)
+   {}
+
+   public:
+
+   scoped_allocator_adaptor_base &operator=
+      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(other.outer_allocator());
+      m_inner = other.inner_allocator();
+      return *this;
+   }
+
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));
+      m_inner = ::boost::move(other.inner_allocator());
+      return *this;
+   }
+
+   inner_allocator_type&       inner_allocator()
+      { return m_inner; }
+
+   inner_allocator_type const& inner_allocator() const
+      { return m_inner; }
+
+   outer_allocator_type      & outer_allocator()
+      { return static_cast(*this); }
+
+   const outer_allocator_type &outer_allocator() const
+      { return static_cast(*this); }
+
+   private:
+   inner_allocator_type m_inner;
+};
+
+#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+//Let's add a dummy first template parameter to allow creating
+//specializations up to maximum InnerAlloc count
+template <
+   typename OuterAlloc
+   , bool Dummy
+   BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
+   >
+class scoped_allocator_adaptor_base;
+
+//Specializations for the adaptor with InnerAlloc allocators
+
+#define BOOST_PP_LOCAL_MACRO(n)                                                                 \
+template                                                                                                \
+class scoped_allocator_adaptor_base                                                                                            \
+   : public OuterAlloc                                                                          \
+{                                                                                               \
+   typedef allocator_traits outer_traits_type;                                      \
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)                                    \
+                                                                                                \
+   public:                                                                                      \
+   template                                                                      \
+   struct rebind_base                                                                           \
+   {                                                                                            \
+      typedef scoped_allocator_adaptor_base other;                                                                               \
+   };                                                                                           \
+                                                                                                \
+   typedef OuterAlloc outer_allocator_type;                                                     \
+   typedef scoped_allocator_adaptor inner_allocator_type;                                                                   \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_copy_assignment::value ||                       \
+      inner_allocator_type::propagate_on_container_copy_assignment::value                       \
+      > propagate_on_container_copy_assignment;                                                 \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_move_assignment::value ||                       \
+      inner_allocator_type::propagate_on_container_move_assignment::value                       \
+      > propagate_on_container_move_assignment;                                                 \
+   typedef boost::integral_constant<                                                            \
+      bool,                                                                                     \
+      outer_traits_type::propagate_on_container_swap::value ||                                  \
+      inner_allocator_type::propagate_on_container_swap::value                                  \
+      > propagate_on_container_swap;                                                            \
+                                                                                                \
+   scoped_allocator_adaptor_base()                                                              \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc                              \
+      BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _))                  \
+      : outer_allocator_type(::boost::forward(outerAlloc))                             \
+      , m_inner(BOOST_PP_ENUM_PARAMS(n, q))                                                     \
+      {}                                                                                        \
+                                                                                                \
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)                    \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)             \
+      : outer_allocator_type(::boost::move(other.outer_allocator()))                            \
+      , m_inner(::boost::move(other.inner_allocator()))                                         \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)                                                                              \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base                                                                \
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base BOOST_RV_REF_END other)                                                              \
+      : outer_allocator_type(other.outer_allocator())                                           \
+      , m_inner(other.inner_allocator())                                                        \
+      {}                                                                                        \
+                                                                                                \
+   protected:                                                                                   \
+   struct internal_type_t{};                                                                    \
+                                                                                                \
+   template                                                                      \
+   scoped_allocator_adaptor_base                                                                \
+      ( internal_type_t                                                                         \
+      , BOOST_FWD_REF(OuterA2) outerAlloc                                                       \
+      , const inner_allocator_type &inner)                                                      \
+      : outer_allocator_type(::boost::forward(outerAlloc))                             \
+      , m_inner(inner)                                                                          \
+   {}                                                                                           \
+                                                                                                \
+   public:                                                                                      \
+   scoped_allocator_adaptor_base &operator=                                                     \
+      (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)                              \
+   {                                                                                            \
+      outer_allocator_type::operator=(other.outer_allocator());                                 \
+      m_inner = other.inner_allocator();                                                        \
+      return *this;                                                                             \
+   }                                                                                            \
+                                                                                                \
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)  \
+   {                                                                                            \
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));                    \
+      m_inner = ::boost::move(other.inner_allocator());                                         \
+      return *this;                                                                             \
+   }                                                                                            \
+                                                                                                \
+   inner_allocator_type&       inner_allocator()                                                \
+      { return m_inner; }                                                                       \
+                                                                                                \
+   inner_allocator_type const& inner_allocator() const                                          \
+      { return m_inner; }                                                                       \
+                                                                                                \
+   outer_allocator_type      & outer_allocator()                                                \
+      { return static_cast(*this); }                                     \
+                                                                                                \
+   const outer_allocator_type &outer_allocator() const                                          \
+      { return static_cast(*this); }                               \
+                                                                                                \
+   private:                                                                                     \
+   inner_allocator_type m_inner;                                                                \
+};                                                                                              \
+//!
+#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif   //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+//Specialization for adaptor without any InnerAlloc
+template 
+class scoped_allocator_adaptor_base
+   < OuterAlloc
+   #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+      , true
+      BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat)
+   #endif
+   >
+   : public OuterAlloc
+{
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base)
+   public:
+
+   template 
+   struct rebind_base
+   {
+      typedef scoped_allocator_adaptor_base
+         ::template portable_rebind_alloc::type
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         > other;
+   };
+
+   typedef OuterAlloc                           outer_allocator_type;
+   typedef allocator_traits         outer_traits_type;
+   typedef scoped_allocator_adaptor inner_allocator_type;
+   typedef typename outer_traits_type::
+      propagate_on_container_copy_assignment    propagate_on_container_copy_assignment;
+   typedef typename outer_traits_type::
+      propagate_on_container_move_assignment    propagate_on_container_move_assignment;
+   typedef typename outer_traits_type::
+      propagate_on_container_swap               propagate_on_container_swap;
+
+   scoped_allocator_adaptor_base()
+      {}
+
+   template 
+   scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      {}
+
+   scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+      : outer_allocator_type(::boost::move(other.outer_allocator()))
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (const scoped_allocator_adaptor_base<
+         OuterA2
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         >& other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   template 
+   scoped_allocator_adaptor_base
+      (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<
+         OuterA2
+         #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+         , true
+         BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
+         #endif
+         > BOOST_RV_REF_END other)
+      : outer_allocator_type(other.outer_allocator())
+      {}
+
+   protected:
+   struct internal_type_t{};
+
+   template 
+   scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &)
+      : outer_allocator_type(::boost::forward(outerAlloc))
+      {}
+ 
+   public:
+   scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(other.outer_allocator());
+      return *this;
+   }
+
+   scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)
+   {
+      outer_allocator_type::operator=(boost::move(other.outer_allocator()));
+      return *this;
+   }
+
+   inner_allocator_type&       inner_allocator()
+      { return static_cast(*this); }
+
+   inner_allocator_type const& inner_allocator() const
+      { return static_cast(*this); }
+
+   outer_allocator_type      & outer_allocator()
+      { return static_cast(*this); }
+
+   const outer_allocator_type &outer_allocator() const
+      { return static_cast(*this); }
+};
+
+}  //namespace container_detail {
+
+///@endcond
+
+//Scoped allocator
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   //! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
+   //! The class template scoped_allocator_adaptor is an allocator template that specifies
+   //! the memory resource (the outer allocator) to be used by a container (as any other
+   //! allocator does) and also specifies an inner allocator resource to be passed to
+   //! the constructor of every element within the container.
+   //!
+   //! This adaptor is
+   //! instantiated with one outer and zero or more inner allocator types. If
+   //! instantiated with only one allocator type, the inner allocator becomes the
+   //! scoped_allocator_adaptor itself, thus using the same allocator resource for the
+   //! container and every element within the container and, if the elements themselves
+   //! are containers, each of their elements recursively. If instantiated with more than
+   //! one allocator, the first allocator is the outer allocator for use by the container,
+   //! the second allocator is passed to the constructors of the container's elements,
+   //! and, if the elements themselves are containers, the third allocator is passed to
+   //! the elements' elements, and so on. If containers are nested to a depth greater
+   //! than the number of allocators, the last allocator is used repeatedly, as in the
+   //! single-allocator case, for any remaining recursions.
+   //!
+   //! [Note: The
+   //! scoped_allocator_adaptor is derived from the outer allocator type so it can be
+   //! substituted for the outer allocator type in most expressions. -end note]
+   //!
+   //! In the construct member functions, `OUTERMOST(x)` is x if x does not have
+   //! an `outer_allocator()` member function and
+   //! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is
+   //! `allocator_traits`.
+   //!
+   //! [Note: `OUTERMOST(x)` and
+   //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
+   //! the definition of `outer_allocator()` to ensure that the recursion terminates.
+   //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
+   template 
+   class scoped_allocator_adaptor
+
+   #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor
+
+   #endif   // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+template 
+class scoped_allocator_adaptor
+#endif
+   : public container_detail::scoped_allocator_adaptor_base
+         
+{
+   BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor)
+
+   public:
+   /// @cond
+   typedef container_detail::scoped_allocator_adaptor_base
+                             base_type;
+   typedef typename base_type::internal_type_t internal_type_t;
+   /// @endcond
+   typedef OuterAlloc                                       outer_allocator_type;
+   //! Type: For exposition only
+   //!
+   typedef allocator_traits                     outer_traits_type;
+   //! Type: `scoped_allocator_adaptor` if `sizeof...(InnerAllocs)` is zero; otherwise,
+   //! `scoped_allocator_adaptor`.
+   typedef typename base_type::inner_allocator_type         inner_allocator_type;
+   typedef typename outer_traits_type::value_type           value_type;
+   typedef typename outer_traits_type::size_type            size_type;
+   typedef typename outer_traits_type::difference_type      difference_type;
+   typedef typename outer_traits_type::pointer              pointer;
+   typedef typename outer_traits_type::const_pointer        const_pointer;
+   typedef typename outer_traits_type::void_pointer         void_pointer;
+   typedef typename outer_traits_type::const_void_pointer   const_void_pointer;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_copy_assignment::value` is
+   //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_copy_assignment                propagate_on_container_copy_assignment;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_move_assignment::value` is
+   //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_move_assignment                propagate_on_container_move_assignment;
+   //! Type: `true_type` if `allocator_traits::propagate_on_container_swap::value` is true for any
+   //! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type.
+   typedef typename base_type::
+      propagate_on_container_swap                           propagate_on_container_swap;
+
+   //! Type: Rebinds scoped allocator to
+   //!    `typedef scoped_allocator_adaptor
+   //!      < typename outer_traits_type::template portable_rebind_alloc::type
+   //!      , InnerAllocs... >`
+   template 
+   struct rebind
+   {
+      typedef scoped_allocator_adaptor
+         < typename outer_traits_type::template portable_rebind_alloc::type
+         #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+         , InnerAllocs...
+         #else
+         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
+         #endif
+         > other;
+   };
+
+   //! Effects: value-initializes the OuterAlloc base class
+   //! and the inner allocator object.
+   scoped_allocator_adaptor()
+      {}
+
+   ~scoped_allocator_adaptor()
+      {}
+
+   //! Effects: initializes each allocator within the adaptor with
+   //! the corresponding allocator from other.
+   scoped_allocator_adaptor(const scoped_allocator_adaptor& other)
+      : base_type(other.base())
+      {}
+
+   //! Effects: move constructs each allocator within the adaptor with
+   //! the corresponding allocator from other.
+   scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other)
+      : base_type(::boost::move(other.base()))
+      {}
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes the OuterAlloc base class with boost::forward(outerAlloc) and inner
+   //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
+   //! corresponding allocator from the argument list).
+   template 
+   scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs)
+      : base_type(::boost::forward(outerAlloc), innerAllocs...)
+      {}
+   #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   template                                                                      \
+   scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc                                   \
+                     BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _))   \
+      : base_type(::boost::forward(outerAlloc)                                         \
+                  BOOST_PP_ENUM_TRAILING_PARAMS(n, q)                                           \
+                  )                                                                             \
+      {}                                                                                        \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes each allocator within the adaptor with the corresponding allocator from other.
+   template 
+   scoped_allocator_adaptor(const scoped_allocator_adaptor &other)
+      : base_type(other.base())
+      {}
+
+   //! Requires: OuterAlloc shall be constructible from OuterA2.
+   //!
+   //! Effects: initializes each allocator within the adaptor with the corresponding allocator
+   //! rvalue from other.
+   template 
+   scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor BOOST_RV_REF_END other)
+      : base_type(::boost::move(other.base()))
+      {}
+
+   scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
+   {
+      base_type::operator=(static_cast(other));
+      return *this;
+   }
+
+   scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
+   {
+      base_type::operator=(boost::move(static_cast(other)));
+      return *this;
+   }
+
+   //! Returns:
+   //!   `static_cast(*this)`.
+   outer_allocator_type      & outer_allocator()
+      {  return *this; }
+
+   //! Returns:
+   //!   `static_cast(*this)`.
+   const outer_allocator_type &outer_allocator() const
+      {  return *this; }
+
+   //! Returns:
+   //!   *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
+   inner_allocator_type&       inner_allocator()
+      {  return base_type::inner_allocator(); }
+
+   //! Returns:
+   //!   *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
+   inner_allocator_type const& inner_allocator() const
+      {  return base_type::inner_allocator(); }
+
+   //! Returns:
+   //!   `allocator_traits::max_size(outer_allocator())`.
+   size_type max_size() const
+   {
+      return outer_traits_type::max_size(this->outer_allocator());
+   }
+
+   //! Effects:
+   //!   calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`.
+   template 
+   void destroy(T* p)
+   {
+      allocator_traits::type>
+         ::destroy(get_outermost_allocator(this->outer_allocator()), p);
+   }
+
+   //! Returns:
+   //! `allocator_traits::allocate(outer_allocator(), n)`.
+   pointer allocate(size_type n)
+   {
+      return outer_traits_type::allocate(this->outer_allocator(), n);
+   }
+
+   //! Returns:
+   //! `allocator_traits::allocate(outer_allocator(), n, hint)`.
+   pointer allocate(size_type n, const_void_pointer hint)
+   {
+      return outer_traits_type::allocate(this->outer_allocator(), n, hint);
+   }
+
+   //! Effects:
+   //! `allocator_traits::deallocate(outer_allocator(), p, n)`.
+   void deallocate(pointer p, size_type n)
+   {
+      outer_traits_type::deallocate(this->outer_allocator(), p, n);
+   }
+
+   //! Returns: Allocator new scoped_allocator_adaptor object where each allocator
+   //! A in the adaptor is initialized from the result of calling
+   //! `allocator_traits::select_on_container_copy_construction()` on
+   //! the corresponding allocator in *this.
+   scoped_allocator_adaptor select_on_container_copy_construction() const
+   {
+      return scoped_allocator_adaptor
+         (internal_type_t()
+         ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
+         ,outer_traits_type::select_on_container_copy_construction(this->inner_allocator())
+         );
+   }
+   /// @cond
+   base_type &base()             { return *this; }
+
+   const base_type &base() const { return *this; }
+   /// @endcond
+
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //! Effects:
+   //! 1) If `uses_allocator::value` is false calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct
+   //!       (OUTERMOST(*this), p, std::forward(args)...)`.
+   //!
+   //! 2) Otherwise, if `uses_allocator::value` is true and
+   //!    `is_constructible::value` is true, calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
+   //!    inner_allocator(), std::forward(args)...)`.
+   //!
+   //! [Note: In compilers without advanced decltype SFINAE support, `is_constructible` can't
+   //! be implemented so that condition will be replaced by
+   //! constructible_with_allocator_prefix::value. -end note]
+   //!
+   //! 3) Otherwise, if uses_allocator::value is true and
+   //!    `is_constructible::value` is true, calls
+   //!    `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
+   //!    std::forward(args)..., inner_allocator())`.
+   //!
+   //! [Note: In compilers without advanced decltype SFINAE support, `is_constructible` can't be
+   //! implemented so that condition will be replaced by
+   //! `constructible_with_allocator_suffix::value`. -end note]
+   //!
+   //! 4) Otherwise, the program is ill-formed.
+   //!
+   //! [Note: An error will result if `uses_allocator` evaluates
+   //! to true but the specific constructor does not take an allocator. This definition prevents a silent
+   //! failure to pass an inner allocator to a contained element. -end note]
+   template < typename T, class ...Args>
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   void
+   #else
+   typename container_detail::enable_if_c::value, void>::type
+   #endif
+   construct(T* p, BOOST_FWD_REF(Args)...args)
+   {
+      container_detail::dispatch_uses_allocator
+         ( uses_allocator()
+         , get_outermost_allocator(this->outer_allocator())
+         , this->inner_allocator()
+         , p, ::boost::forward(args)...);
+   }
+
+   #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   //Disable this overload if the first argument is pair as some compilers have
+   //overload selection problems when the first parameter is a pair.
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   template < typename T                                                                        \
+            BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)                                           \
+            >                                                                                   \
+   typename container_detail::enable_if_c::value, void>::type     \
+      construct(T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))               \
+   {                                                                                            \
+      container_detail::dispatch_uses_allocator                                                 \
+         ( uses_allocator()                                            \
+         , get_outermost_allocator(this->outer_allocator())                                     \
+         , this->inner_allocator()                                                              \
+         , p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
+   }                                                                                            \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+   template 
+   void construct(std::pair* p)
+   {  this->construct_pair(p);  }
+
+   template 
+   void construct(container_detail::pair* p)
+   {  this->construct_pair(p);  }
+
+   template 
+   void construct(std::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {  this->construct_pair(p, ::boost::forward(x), ::boost::forward(y));   }
+
+   template 
+   void construct(container_detail::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {  this->construct_pair(p, ::boost::forward(x), ::boost::forward(y));   }
+  
+   template 
+   void construct(std::pair* p, const std::pair& x)
+   {  this->construct_pair(p, x);   }
+
+   template 
+   void construct( container_detail::pair* p
+                 , const container_detail::pair& x)
+   {  this->construct_pair(p, x);   }
+  
+   template 
+   void construct( std::pair* p
+                 , BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END x)
+   {  this->construct_pair(p, x);   }
+
+   template 
+   void construct( container_detail::pair* p
+                 , BOOST_RV_REF_BEG container_detail::pair BOOST_RV_REF_END x)
+   {  this->construct_pair(p, x);   }
+
+   /// @cond
+   private:
+   template 
+   void construct_pair(Pair* p)
+   {
+      this->construct(container_detail::addressof(p->first));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
+   {
+      this->construct(container_detail::addressof(p->first), ::boost::forward(x));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), ::boost::forward(y));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, const Pair2& pr)
+   {
+      this->construct(container_detail::addressof(p->first), pr.first);
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), pr.second);
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   template 
+   void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr)
+   {
+      this->construct(container_detail::addressof(p->first), ::boost::move(pr.first));
+      BOOST_TRY{
+         this->construct(container_detail::addressof(p->second), ::boost::move(pr.second));
+      }
+      BOOST_CATCH(...){
+         this->destroy(container_detail::addressof(p->first));
+         BOOST_RETHROW
+      }
+      BOOST_CATCH_END
+   }
+
+   //template 
+   //void construct(pair* p, piecewise_construct_t, tuple x, tuple y);
+
+   private:
+   template 
+   scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner)
+      : base_type(internal_type_t(), ::boost::forward(outer), inner)
+   {}
+
+   /// @endcond
+};
+
+template 
+inline bool operator==(
+   const scoped_allocator_adaptor& a,
+   const scoped_allocator_adaptor& b)
+{
+   #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)  
+   const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
+   #else
+   const bool has_zero_inner =
+      boost::container::container_detail::is_same
+         ::value;
+   #endif
+
+    return a.outer_allocator() == b.outer_allocator()
+        && (has_zero_inner || a.inner_allocator() == b.inner_allocator());
+}
+
+template 
+inline bool operator!=(
+   const scoped_allocator_adaptor& a,
+   const scoped_allocator_adaptor& b)
+{
+    return ! (a == b);
+}
+
+}} // namespace boost { namespace container {
+
+#include 
+
+#endif //  BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
diff --git a/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp b/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp
new file mode 100644
index 000000000..ef2479933
--- /dev/null
+++ b/project/jni/boost/include/boost/container/scoped_allocator_fwd.hpp
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
+
+#if (defined MSC_VER) && (_MSC_VER >= 1200)
+#  pragma once
+#endif
+
+#include 
+#include 
+
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include 
+#include 
+#endif
+
+namespace boost { namespace container {
+
+///@cond
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+   #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor;
+
+   #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+   template 
+   class scoped_allocator_adaptor;
+
+   template 
+   class scoped_allocator_adaptor;
+
+   #endif   // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
+
+
+#else    // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+
+template 
+class scoped_allocator_adaptor;
+
+#endif
+
+///@endcond
+
+//! The allocator_arg_t struct is an empty structure type used as a unique type to
+//! disambiguate constructor and function overloading. Specifically, several types
+//! have constructors with allocator_arg_t as the first argument, immediately followed
+//! by an argument of a type that satisfies the Allocator requirements
+struct allocator_arg_t{};
+
+//! A instance of type allocator_arg_t
+//!
+static const allocator_arg_t allocator_arg = allocator_arg_t();
+
+template 
+struct constructible_with_allocator_suffix;
+
+template 
+struct constructible_with_allocator_prefix;
+
+template 
+struct uses_allocator;
+
+}} // namespace boost { namespace container {
+
+#include 
+
+#endif //  BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
diff --git a/project/jni/boost/include/boost/container/set.hpp b/project/jni/boost/include/boost/container/set.hpp
index b25e7013f..0b4937610 100644
--- a/project/jni/boost/include/boost/container/set.hpp
+++ b/project/jni/boost/include/boost/container/set.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -23,402 +23,357 @@
 #include 
 #include 
 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
+#include 
 #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
 #include 
 #endif
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 // Forward declarations of operators < and ==, needed for friend declaration.
-template 
-inline bool operator==(const set& x, 
-                       const set& y);
+template 
+inline bool operator==(const set& x,
+                       const set& y);
 
-template 
-inline bool operator<(const set& x, 
-                      const set& y);
+template 
+inline bool operator<(const set& x,
+                      const set& y);
 /// @endcond
 
-//! A set is a kind of associative container that supports unique keys (contains at 
-//! most one of each key value) and provides for fast retrieval of the keys themselves. 
-//! Class set supports bidirectional iterators. 
-//! 
-//! A set satisfies all of the requirements of a container and of a reversible container 
-//! , and of an associative container. A set also provides most operations described in 
+//! A set is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of the keys themselves.
+//! Class set supports bidirectional iterators.
+//!
+//! A set satisfies all of the requirements of a container and of a reversible container
+//! , and of an associative container. A set also provides most operations described in
 //! for unique keys.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class set 
+class set
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(set)
-   typedef container_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Compare, Allocator> tree_t;
    tree_t m_tree;  // red-black tree representing set
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef Pred                                    key_compare;
-   typedef Pred                                    value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs an empty set.
-   //! 
+   //!
    //! Complexity: Constant.
    set()
       : m_tree()
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object 
+   //! Effects: Constructs an empty set using the specified comparison object
    //! and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit set(const Pred& comp,
+   explicit set(const Compare& comp,
                 const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
-   set(InputIterator first, InputIterator last, const Pred& comp = Pred(),
+   set(InputIterator first, InputIterator last, const Compare& comp = Compare(),
          const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, true) 
+      : m_tree(true, first, last, comp, a)
    {}
 
-   //! Effects: Constructs an empty set using the specified comparison object and 
+   //! Effects: Constructs an empty set using the specified comparison object and
    //! allocator, and inserts elements from the ordered unique range [first ,last). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate and must be
    //! unique values.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
    set( ordered_unique_range_t, InputIterator first, InputIterator last
-      , const Pred& comp = Pred(), const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a set.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   set(const set& x) 
+   set(const set& x)
       : m_tree(x.m_tree)
    {}
 
    //! Effects: Move constructs a set. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   set(BOOST_RV_REF(set) x) 
+   set(BOOST_RV_REF(set) x)
       : m_tree(boost::move(x.m_tree))
    {}
 
+   //! Effects: Copy constructs a set using the specified allocator.
+   //!
+   //! Complexity: Linear in x.size().
+   set(const set& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a set using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   set(BOOST_RV_REF(set) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
    //! Effects: Makes *this a copy of x.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
    set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
    set& operator=(BOOST_RV_REF(set) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return m_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const
    { return m_tree.get_stored_allocator(); }
 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator()
    { return m_tree.get_stored_allocator(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant
-   iterator begin() 
+   iterator begin()
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
    { return m_tree.begin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end()
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const
    { return m_tree.end(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-   { return m_tree.rbegin(); } 
+   reverse_iterator rbegin()
+   { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const
+   { return m_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return m_tree.cbegin(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return m_tree.cend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return m_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const
+   { return m_tree.crbegin(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return m_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(set& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x if and only if there is no element in the container 
-   //!   with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   std::pair insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   std::pair insert(T &x)
-   { return this->insert(const_cast(x)); }
-
-   template
-   std::pair insert(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Move constructs a new value from x if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!
-   //! Returns: The bool component of the returned pair is true if and only 
-   //!   if the insertion takes place, and the iterator component of the pair
-   //!   points to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   std::pair insert(BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_unique(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container if and only if there is 
-   //!   no element in the container with key equivalent to the key of x.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts an element move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_unique(p, boost::move(x)); }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) if and only 
-   //!   if there is no element with key equivalent to the key of that element.
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_unique(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects:  Inserts an object x of type T constructed with
-   //!   std::forward(args)... if and only if there is 
+   //! Effects:  Inserts an object x of type Key constructed with
+   //!   std::forward(args)... if and only if there is
    //!   no element in the container with equivalent value.
    //!   and returns the iterator pointing to the
    //!   newly inserted element.
    //!
-   //! Returns: The bool component of the returned pair is true if and only 
+   //! Returns: The bool component of the returned pair is true if and only
    //!   if the insertion takes place, and the iterator component of the pair
    //!   points to the element with key equivalent to the key of x.
    //!
    //! Throws: If memory allocation throws or
-   //!   T's in-place constructor throws.
+   //!   Key's in-place constructor throws.
    //!
    //! Complexity: Logarithmic.
    template 
    std::pair emplace(Args&&... args)
    {  return m_tree.emplace_unique(boost::forward(args)...); }
 
-   //! Effects:  Inserts an object of type T constructed with
-   //!   std::forward(args)... if and only if there is 
+   //! Effects:  Inserts an object of type Key constructed with
+   //!   std::forward(args)... if and only if there is
    //!   no element in the container with equivalent value.
    //!   p is a hint pointing to where the insert
    //!   should start to search.
@@ -448,14 +403,74 @@ class set
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x if and only if there is no element in the container
+   //!   with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   std::pair insert(const value_type &x);
+
+   //! Effects: Move constructs a new value from x if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!
+   //! Returns: The bool component of the returned pair is true if and only
+   //!   if the insertion takes place, and the iterator component of the pair
+   //!   points to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   std::pair insert(value_type &&x);
+   #else
+   private:
+   typedef std::pair insert_return_pair;
+   public:
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container if and only if there is
+   //!   no element in the container with key equivalent to the key of x.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts an element move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent to the key of x.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) if and only
+   //!   if there is no element with key equivalent to the key of that element.
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_unique(first, last);  }
+
    //! Effects: Erases the element pointed to by p.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p)
    {  return m_tree.erase(p); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -463,7 +478,7 @@ class set
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
    {  return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -471,49 +486,83 @@ class set
    //! Returns: Returns last.
    //!
    //! Complexity: log(size())+N where N is the distance from first to last.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
    {  return m_tree.erase(first, last);  }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(set& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear()
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return m_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const_iterator pointing to an element with the key
+   //! Returns: Allocator const_iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.find(x) == m_tree.end() ? 0 : 1;  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -523,25 +572,23 @@ class set
    iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -552,121 +599,130 @@ class set
    friend bool operator< (const set&, const set&);
 
    private:
-   std::pair priv_insert(const T &x) 
-   {  return m_tree.insert_unique(x);  }
-
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_tree.insert_unique(p, x); }
+   template 
+   std::pair priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_unique(::boost::forward(x));  }
 
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_unique(p, ::boost::forward(x)); }
    /// @endcond
 };
 
-template 
-inline bool operator==(const set& x, 
-                       const set& y) 
+template 
+inline bool operator==(const set& x,
+                       const set& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const set& x, 
-                      const set& y) 
+template 
+inline bool operator<(const set& x,
+                      const set& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator!=(const set& x,
+                       const set& y)
 {  return !(x == y);   }
 
-template 
-inline bool operator>(const set& x, 
-                      const set& y) 
+template 
+inline bool operator>(const set& x,
+                      const set& y)
 {  return y < x; }
 
-template 
-inline bool operator<=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator<=(const set& x,
+                       const set& y)
 {  return !(y < x); }
 
-template 
-inline bool operator>=(const set& x, 
-                       const set& y) 
+template 
+inline bool operator>=(const set& x,
+                       const set& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(set& x, set& y) 
+template 
+inline void swap(set& x, set& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 // Forward declaration of operators < and ==, needed for friend declaration.
 
-template 
-inline bool operator==(const multiset& x, 
-                       const multiset& y);
+template 
+inline bool operator==(const multiset& x,
+                       const multiset& y);
 
-template 
-inline bool operator<(const multiset& x, 
-                      const multiset& y);
+template 
+inline bool operator<(const multiset& x,
+                      const multiset& y);
 /// @endcond
 
-//! A multiset is a kind of associative container that supports equivalent keys 
-//! (possibly contains multiple copies of the same key value) and provides for 
+//! A multiset is a kind of associative container that supports equivalent keys
+//! (possibly contains multiple copies of the same key value) and provides for
 //! fast retrieval of the keys themselves. Class multiset supports bidirectional iterators.
-//! 
-//! A multiset satisfies all of the requirements of a container and of a reversible 
-//! container, and of an associative container). multiset also provides most operations 
+//!
+//! A multiset satisfies all of the requirements of a container and of a reversible
+//! container, and of an associative container). multiset also provides most operations
 //! described for duplicate keys.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
-class multiset 
+class multiset
 {
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(multiset)
-   typedef container_detail::rbtree, Pred, A> tree_t;
+   typedef container_detail::rbtree, Compare, Allocator> tree_t;
    tree_t m_tree;  // red-black tree representing multiset
-   typedef typename container_detail::
-      move_const_ref_type::type insert_const_ref_type;
    /// @endcond
 
    public:
 
-   // typedefs:
-   typedef typename tree_t::key_type               key_type;
-   typedef typename tree_t::value_type             value_type;
-   typedef typename tree_t::pointer                pointer;
-   typedef typename tree_t::const_pointer          const_pointer;
-   typedef typename tree_t::reference              reference;
-   typedef typename tree_t::const_reference        const_reference;
-   typedef Pred                                    key_compare;
-   typedef Pred                                    value_compare;
-   typedef typename tree_t::iterator               iterator;
-   typedef typename tree_t::const_iterator         const_iterator;
-   typedef typename tree_t::reverse_iterator       reverse_iterator;
-   typedef typename tree_t::const_reverse_iterator const_reverse_iterator;
-   typedef typename tree_t::size_type              size_type;
-   typedef typename tree_t::difference_type        difference_type;
-   typedef typename tree_t::allocator_type         allocator_type;
-   typedef typename tree_t::stored_allocator_type  stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Key                                                                         key_type;
+   typedef Key                                                                         value_type;
+   typedef Compare                                                                     key_compare;
+   typedef Compare                                                                     value_compare;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type)              stored_allocator_type;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::iterator)                           iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_iterator)                     const_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::reverse_iterator)                   reverse_iterator;
+   typedef typename BOOST_CONTAINER_IMPDEF(tree_t::const_reverse_iterator)             const_reverse_iterator;
+
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Constructs an empty multiset using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
    multiset()
       : m_tree()
@@ -674,308 +730,267 @@ class multiset
 
    //! Effects: Constructs an empty multiset using the specified comparison
    //!   object and allocator.
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit multiset(const Pred& comp,
+   explicit multiset(const Compare& comp,
                      const allocator_type& a = allocator_type())
       : m_tree(comp, a)
    {}
 
    //! Effects: Constructs an empty multiset using the specified comparison object
    //!   and allocator, and inserts elements from the range [first ,last ).
-   //! 
-   //! Complexity: Linear in N if the range [first ,last ) is already sorted using 
+   //!
+   //! Complexity: Linear in N if the range [first ,last ) is already sorted using
    //! comp and otherwise N logN, where N is last - first.
    template 
    multiset(InputIterator first, InputIterator last,
-            const Pred& comp = Pred(),
+            const Compare& comp = Compare(),
             const allocator_type& a = allocator_type())
-      : m_tree(first, last, comp, a, false) 
+      : m_tree(false, first, last, comp, a)
    {}
 
-   //! Effects: Constructs an empty multiset using the specified comparison object and 
+   //! Effects: Constructs an empty multiset using the specified comparison object and
    //! allocator, and inserts elements from the ordered range [first ,last ). This function
    //! is more efficient than the normal range creation for ordered ranges.
    //!
    //! Requires: [first ,last) must be ordered according to the predicate.
-   //! 
+   //!
    //! Complexity: Linear in N.
    template 
-   multiset( ordered_range_t ordered_range, InputIterator first, InputIterator last
-           , const Pred& comp = Pred()
+   multiset( ordered_range_t, InputIterator first, InputIterator last
+           , const Compare& comp = Compare()
            , const allocator_type& a = allocator_type())
-      : m_tree(ordered_range, first, last, comp, a) 
+      : m_tree(ordered_range, first, last, comp, a)
    {}
 
    //! Effects: Copy constructs a multiset.
-   //! 
+   //!
    //! Complexity: Linear in x.size().
-   multiset(const multiset& x) 
+   multiset(const multiset& x)
       : m_tree(x.m_tree)
    {}
 
    //! Effects: Move constructs a multiset. Constructs *this using x's resources.
-   //! 
-   //! Complexity: Construct.
-   //! 
+   //!
+   //! Complexity: Constant.
+   //!
    //! Postcondition: x is emptied.
-   multiset(BOOST_RV_REF(multiset) x) 
+   multiset(BOOST_RV_REF(multiset) x)
       : m_tree(boost::move(x.m_tree))
    {}
 
-   //! Effects: Makes *this a copy of x.
-   //! 
+   //! Effects: Copy constructs a multiset using the specified allocator.
+   //!
    //! Complexity: Linear in x.size().
-   multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x) 
+   multiset(const multiset& x, const allocator_type &a)
+      : m_tree(x.m_tree, a)
+   {}
+
+   //! Effects: Move constructs a multiset using the specified allocator.
+   //!                 Constructs *this using x's resources.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   //!
+   //! Postcondition: x is emptied.
+   multiset(BOOST_RV_REF(multiset) x, const allocator_type &a)
+      : m_tree(boost::move(x.m_tree), a)
+   {}
+
+   //! Effects: Makes *this a copy of x.
+   //!
+   //! Complexity: Linear in x.size().
+   multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x)
    {  m_tree = x.m_tree;   return *this;  }
 
    //! Effects: this->swap(x.get()).
-   //! 
+   //!
    //! Complexity: Constant.
-   multiset& operator=(BOOST_RV_REF(multiset) x) 
+   multiset& operator=(BOOST_RV_REF(multiset) x)
    {  m_tree = boost::move(x.m_tree);   return *this;  }
 
-   //! Effects: Returns the comparison object out
-   //!   of which a was constructed.
-   //! 
-   //! Complexity: Constant.
-   key_compare key_comp() const 
-   { return m_tree.key_comp(); }
-
-   //! Effects: Returns an object of value_compare constructed out
-   //!   of the comparison object.
-   //! 
-   //! Complexity: Constant.
-   value_compare value_comp() const 
-   { return m_tree.key_comp(); }
-
    //! Effects: Returns a copy of the Allocator that
    //!   was passed to the object's constructor.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const
    { return m_tree.get_allocator(); }
 
-   const stored_allocator_type &get_stored_allocator() const 
-   { return m_tree.get_stored_allocator(); }
-
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator()
    { return m_tree.get_stored_allocator(); }
 
-   //! Effects: Returns an iterator to the first element contained in the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   iterator begin() 
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const
+   { return m_tree.get_stored_allocator(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin()
    { return m_tree.begin(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
+   const_iterator begin() const
    { return m_tree.begin(); }
 
    //! Effects: Returns an iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator end() 
+   iterator end()
    { return m_tree.end(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator end() const 
+   const_iterator end() const
    { return m_tree.end(); }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rbegin() 
-   { return m_tree.rbegin(); } 
+   reverse_iterator rbegin()
+   { return m_tree.rbegin(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return m_tree.rbegin(); } 
+   const_reverse_iterator rbegin() const
+   { return m_tree.rbegin(); }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator rend() 
+   reverse_iterator rend()
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend() const 
+   const_reverse_iterator rend() const
    { return m_tree.rend(); }
 
    //! Effects: Returns a const_iterator to the first element contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   const_iterator cbegin() const
    { return m_tree.cbegin(); }
 
    //! Effects: Returns a const_iterator to the end of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const 
+   const_iterator cend() const
    { return m_tree.cend(); }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed container. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return m_tree.crbegin(); } 
+   const_reverse_iterator crbegin() const
+   { return m_tree.crbegin(); }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed container. 
-   //! 
+   //! of the reversed container.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend() const 
+   const_reverse_iterator crend() const
    { return m_tree.crend(); }
 
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Returns true if the container contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const 
+   bool empty() const
    { return m_tree.empty(); }
 
    //! Effects: Returns the number of the elements contained in the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    { return m_tree.size(); }
 
    //! Effects: Returns the largest possible size of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    { return m_tree.max_size(); }
 
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(multiset& x)
-   { m_tree.swap(x.m_tree); }
-
-   //! Effects: Inserts x and returns the iterator pointing to the
-   //!   newly inserted element. 
-   //!
-   //! Complexity: Logarithmic.
-   iterator insert(insert_const_ref_type x) 
-   {  return priv_insert(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(T &x)
-   { return this->insert(const_cast(x)); }
-
-   template
-   iterator insert(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(u); }
-   #endif
-
-   //! Effects: Inserts a copy of x in the container.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_equal(boost::move(x));  }
-
-   //! Effects: Inserts a copy of x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, insert_const_ref_type x) 
-   {  return priv_insert(p, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_insert(position, u); }
-   #endif
-
-   //! Effects: Inserts a value move constructed from x in the container.
-   //!   p is a hint pointing to where the insert should start to search.
-   //!
-   //! Returns: An iterator pointing to the element with key equivalent
-   //!   to the key of x.
-   //!
-   //! Complexity: Logarithmic in general, but amortized constant if t
-   //!   is inserted right before p.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return m_tree.insert_equal(p, boost::move(x));  }
-
-   //! Requires: first, last are not iterators into *this.
-   //!
-   //! Effects: inserts each element from the range [first,last) .
-   //!
-   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
-   template 
-   void insert(InputIterator first, InputIterator last) 
-   {  m_tree.insert_equal(first, last);  }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)... and returns the iterator pointing to the
-   //!   newly inserted element. 
+   //!   newly inserted element.
    //!
    //! Complexity: Logarithmic.
    template 
    iterator emplace(Args&&... args)
    {  return m_tree.emplace_equal(boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
+   //! Effects: Inserts an object of type Key constructed with
    //!   std::forward(args)...
    //!
    //! Returns: An iterator pointing to the element with key equivalent
@@ -1005,14 +1020,69 @@ class multiset
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+
+
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts x and returns the iterator pointing to the
+   //!   newly inserted element.
+   //!
+   //! Complexity: Logarithmic.
+   iterator insert(const value_type &x);
+
+   //! Effects: Inserts a copy of x in the container.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator p, const value_type &x);
+
+   //! Effects: Inserts a value move constructed from x in the container.
+   //!   p is a hint pointing to where the insert should start to search.
+   //!
+   //! Returns: An iterator pointing to the element with key equivalent
+   //!   to the key of x.
+   //!
+   //! Complexity: Logarithmic in general, but amortized constant if t
+   //!   is inserted right before p.
+   iterator insert(const_iterator position, value_type &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator)
+   #endif
+
+   //! Requires: first, last are not iterators into *this.
+   //!
+   //! Effects: inserts each element from the range [first,last) .
+   //!
+   //! Complexity: At most N log(size()+N) (N is the distance from first to last)
+   template 
+   void insert(InputIterator first, InputIterator last)
+   {  m_tree.insert_equal(first, last);  }
+
    //! Effects: Erases the element pointed to by p.
    //!
    //! Returns: Returns an iterator pointing to the element immediately
-   //!   following q prior to the element being erased. If no such element exists, 
+   //!   following q prior to the element being erased. If no such element exists,
    //!   returns end().
    //!
    //! Complexity: Amortized constant time
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p)
    {  return m_tree.erase(p); }
 
    //! Effects: Erases all elements in the container with key equivalent to x.
@@ -1020,7 +1090,7 @@ class multiset
    //! Returns: Returns the number of erased elements.
    //!
    //! Complexity: log(size()) + count(k)
-   size_type erase(const key_type& x) 
+   size_type erase(const key_type& x)
    {  return m_tree.erase(x); }
 
    //! Effects: Erases all the elements in the range [first, last).
@@ -1031,46 +1101,80 @@ class multiset
    iterator erase(const_iterator first, const_iterator last)
    {  return m_tree.erase(first, last); }
 
+   //! Effects: Swaps the contents of *this and x.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   void swap(multiset& x)
+   { m_tree.swap(x.m_tree); }
+
    //! Effects: erase(a.begin(),a.end()).
    //!
    //! Postcondition: size() == 0.
    //!
    //! Complexity: linear in size().
-   void clear() 
+   void clear()
    { m_tree.clear(); }
 
+   //////////////////////////////////////////////
+   //
+   //                observers
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns the comparison object out
+   //!   of which a was constructed.
+   //!
+   //! Complexity: Constant.
+   key_compare key_comp() const
+   { return m_tree.key_comp(); }
+
+   //! Effects: Returns an object of value_compare constructed out
+   //!   of the comparison object.
+   //!
+   //! Complexity: Constant.
+   value_compare value_comp() const
+   { return m_tree.key_comp(); }
+
+   //////////////////////////////////////////////
+   //
+   //              set operations
+   //
+   //////////////////////////////////////////////
+
    //! Returns: An iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   iterator find(const key_type& x) 
+   iterator find(const key_type& x)
    { return m_tree.find(x); }
 
-   //! Returns: A const iterator pointing to an element with the key
+   //! Returns: Allocator const iterator pointing to an element with the key
    //!   equivalent to x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic.
-   const_iterator find(const key_type& x) const 
+   const_iterator find(const key_type& x) const
    { return m_tree.find(x); }
 
    //! Returns: The number of elements with key equivalent to x.
    //!
    //! Complexity: log(size())+count(k)
-   size_type count(const key_type& x) const 
+   size_type count(const key_type& x) const
    {  return m_tree.count(x);  }
 
    //! Returns: An iterator pointing to the first element with key not less
    //!   than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   iterator lower_bound(const key_type& x) 
+   iterator lower_bound(const key_type& x)
    {  return m_tree.lower_bound(x); }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than k, or a.end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator lower_bound(const key_type& x) const 
+   const_iterator lower_bound(const key_type& x) const
    {  return m_tree.lower_bound(x); }
 
    //! Returns: An iterator pointing to the first element with key not less
@@ -1080,25 +1184,23 @@ class multiset
    iterator upper_bound(const key_type& x)
    {  return m_tree.upper_bound(x);    }
 
-   //! Returns: A const iterator pointing to the first element with key not
+   //! Returns: Allocator const iterator pointing to the first element with key not
    //!   less than x, or end() if such an element is not found.
    //!
    //! Complexity: Logarithmic
-   const_iterator upper_bound(const key_type& x) const 
+   const_iterator upper_bound(const key_type& x) const
    {  return m_tree.upper_bound(x);    }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) 
+   std::pair equal_range(const key_type& x)
    {  return m_tree.equal_range(x); }
 
    //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
    //!
    //! Complexity: Logarithmic
-   std::pair 
-      equal_range(const key_type& x) const 
+   std::pair equal_range(const key_type& x) const
    {  return m_tree.equal_range(x); }
 
    /// @cond
@@ -1109,61 +1211,63 @@ class multiset
    friend bool operator< (const multiset&,
                           const multiset&);
    private:
-   iterator priv_insert(const T &x) 
-   {  return m_tree.insert_equal(x);  }
+   template 
+   iterator priv_insert(BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_equal(::boost::forward(x));  }
 
-   iterator priv_insert(const_iterator p, const T &x) 
-   {  return m_tree.insert_equal(p, x); }
+   template 
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
+   {  return m_tree.insert_equal(p, ::boost::forward(x)); }
 
    /// @endcond
 };
 
-template 
-inline bool operator==(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator==(const multiset& x,
+                       const multiset& y)
 {  return x.m_tree == y.m_tree;  }
 
-template 
-inline bool operator<(const multiset& x, 
-                      const multiset& y) 
+template 
+inline bool operator<(const multiset& x,
+                      const multiset& y)
 {  return x.m_tree < y.m_tree;   }
 
-template 
-inline bool operator!=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator!=(const multiset& x,
+                       const multiset& y)
 {  return !(x == y);  }
 
-template 
-inline bool operator>(const multiset& x, 
-                      const multiset& y) 
+template 
+inline bool operator>(const multiset& x,
+                      const multiset& y)
 {  return y < x;  }
 
-template 
-inline bool operator<=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator<=(const multiset& x,
+                       const multiset& y)
 {  return !(y < x);  }
 
-template 
-inline bool operator>=(const multiset& x, 
-                       const multiset& y) 
+template 
+inline bool operator>=(const multiset& x,
+                       const multiset& y)
 {  return !(x < y);  }
 
-template 
-inline void swap(multiset& x, multiset& y) 
+template 
+inline void swap(multiset& x, multiset& y)
 {  x.swap(y);  }
 
 /// @cond
 
 }  //namespace container {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
+template 
+struct has_trivial_destructor_after_move >
 {
-   static const bool value = has_trivial_destructor::value && has_trivial_destructor::value;
+   static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value;
 };
-*/
+
 namespace container {
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/slist.hpp b/project/jni/boost/include/boost/container/slist.hpp
index 1cdcdf104..84cccda46 100644
--- a/project/jni/boost/include/boost/container/slist.hpp
+++ b/project/jni/boost/include/boost/container/slist.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -19,10 +19,12 @@
 #include 
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +34,7 @@
 #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 //Preprocessor library to emulate perfect forwarding
 #else
-#include  
+#include 
 #endif
 
 #include 
@@ -42,16 +44,14 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 
+template 
+class slist;
+
 namespace container_detail {
 
 template
@@ -65,38 +65,18 @@ template 
 struct slist_node
    :  public slist_hook::type
 {
+   private:
+   slist_node();
 
-   slist_node()
-      : m_data()
-   {}
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   slist_node(Args &&...args)
-      : m_data(boost::forward(args)...)
-   {}
-
-   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                      \
-   template                           \
-   slist_node(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))       \
-      : m_data(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))   \
-   {}                                                                   \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
+   public:
+   typedef typename slist_hook::type hook_type;
    T m_data;
 };
 
-template
+template
 struct intrusive_slist_type
 {
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef boost::container::allocator_traits      allocator_traits_type;
    typedef typename allocator_traits_type::value_type value_type;
    typedef typename boost::intrusive::pointer_traits
       ::template
@@ -115,59 +95,143 @@ struct intrusive_slist_type
    typedef container_type                       type ;
 };
 
+template
+class slist_const_iterator
+   : public std::iterator< std::forward_iterator_tag, T
+                         , typename iiterator_types::difference_type
+                         , typename iiterator_types::const_pointer
+                         , typename iiterator_types::const_reference>
+{
+   protected:
+
+   IIterator m_it;
+
+   public:
+   typedef typename iiterator_types::const_pointer     const_pointer;
+   typedef typename iiterator_types::const_reference   const_reference;
+
+   //Constructors
+   slist_const_iterator()
+      : m_it()
+   {}
+
+   explicit slist_const_iterator(const IIterator &it) 
+      : m_it(it)
+   {}
+
+   //Pointer like operators
+   const_reference operator*() const
+   { return this->m_it->m_data;  }
+
+   const_pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::pointer_to(this->m_it->m_data); }
+
+   //Increment / Decrement
+   slist_const_iterator& operator++()      
+   { ++this->m_it;  return *this; }
+
+   slist_const_iterator operator++(int)     
+   { IIterator tmp = this->m_it; ++*this; return slist_const_iterator(tmp);  }
+
+   //Comparison operators
+   friend bool operator== (const slist_const_iterator& l, const slist_const_iterator& r)
+   {  return l.m_it == r.m_it;  }
+
+   friend bool operator!= (const slist_const_iterator& l, const slist_const_iterator& r)
+   {  return l.m_it != r.m_it;  }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
+template
+class slist_iterator
+   : public slist_const_iterator
+{
+   private:
+   typedef slist_const_iterator const_iterator;
+
+   public:
+   typedef typename iiterator_types::pointer           pointer;
+   typedef typename iiterator_types::reference         reference;
+
+   //Constructors
+   slist_iterator()
+      : const_iterator()
+   {}
+
+   explicit slist_iterator(const IIterator &it)
+      :  const_iterator(it)
+   {}
+
+   //Pointer like operators
+   reference operator*()  const
+   {  return  this->m_it->m_data;  }
+
+   pointer   operator->() const
+   { return ::boost::intrusive::pointer_traits::to_pointer(this->m_it->m_data); }
+
+   //Increment / Decrement
+   slist_iterator& operator++() 
+   { ++this->m_it; return *this;  }
+
+   slist_iterator operator++(int)
+   { IIterator tmp = this->m_it; ++*this; return slist_iterator(tmp); }
+
+   const IIterator &get() const
+   {  return this->m_it;   }
+};
+
 }  //namespace container_detail {
 
 /// @endcond
 
-//! An slist is a singly linked list: a list where each element is linked to the next 
-//! element, but not to the previous element. That is, it is a Sequence that 
-//! supports forward but not backward traversal, and (amortized) constant time 
-//! insertion and removal of elements. Slists, like lists, have the important 
-//! property that insertion and splicing do not invalidate iterators to list elements, 
-//! and that even removal invalidates only the iterators that point to the elements 
-//! that are removed. The ordering of iterators may be changed (that is, 
-//! slist::iterator might have a different predecessor or successor after a list 
-//! operation than it did before), but the iterators themselves will not be invalidated 
+//! An slist is a singly linked list: a list where each element is linked to the next
+//! element, but not to the previous element. That is, it is a Sequence that
+//! supports forward but not backward traversal, and (amortized) constant time
+//! insertion and removal of elements. Slists, like lists, have the important
+//! property that insertion and splicing do not invalidate iterators to list elements,
+//! and that even removal invalidates only the iterators that point to the elements
+//! that are removed. The ordering of iterators may be changed (that is,
+//! slist::iterator might have a different predecessor or successor after a list
+//! operation than it did before), but the iterators themselves will not be invalidated
 //! or made to point to different elements unless that invalidation or mutation is explicit.
 //!
-//! The main difference between slist and list is that list's iterators are bidirectional 
-//! iterators, while slist's iterators are forward iterators. This means that slist is 
-//! less versatile than list; frequently, however, bidirectional iterators are 
-//! unnecessary. You should usually use slist unless you actually need the extra 
-//! functionality of list, because singly linked lists are smaller and faster than double 
-//! linked lists. 
-//! 
-//! Important performance note: like every other Sequence, slist defines the member 
-//! functions insert and erase. Using these member functions carelessly, however, can 
-//! result in disastrously slow programs. The problem is that insert's first argument is 
-//! an iterator p, and that it inserts the new element(s) before p. This means that 
-//! insert must find the iterator just before p; this is a constant-time operation 
-//! for list, since list has bidirectional iterators, but for slist it must find that 
-//! iterator by traversing the list from the beginning up to p. In other words: 
+//! The main difference between slist and list is that list's iterators are bidirectional
+//! iterators, while slist's iterators are forward iterators. This means that slist is
+//! less versatile than list; frequently, however, bidirectional iterators are
+//! unnecessary. You should usually use slist unless you actually need the extra
+//! functionality of list, because singly linked lists are smaller and faster than double
+//! linked lists.
+//!
+//! Important performance note: like every other Sequence, slist defines the member
+//! functions insert and erase. Using these member functions carelessly, however, can
+//! result in disastrously slow programs. The problem is that insert's first argument is
+//! an iterator p, and that it inserts the new element(s) before p. This means that
+//! insert must find the iterator just before p; this is a constant-time operation
+//! for list, since list has bidirectional iterators, but for slist it must find that
+//! iterator by traversing the list from the beginning up to p. In other words:
 //! insert and erase are slow operations anywhere but near the beginning of the slist.
-//! 
-//! Slist provides the member functions insert_after and erase_after, which are constant 
-//! time operations: you should always use insert_after and erase_after whenever 
-//! possible. If you find that insert_after and erase_after aren't adequate for your 
-//! needs, and that you often need to use insert and erase in the middle of the list, 
+//!
+//! Slist provides the member functions insert_after and erase_after, which are constant
+//! time operations: you should always use insert_after and erase_after whenever
+//! possible. If you find that insert_after and erase_after aren't adequate for your
+//! needs, and that you often need to use insert and erase in the middle of the list,
 //! then you should probably use list instead of slist.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class slist 
+class slist
    : protected container_detail::node_alloc_holder
-      ::type>
+      ::type>
 {
    /// @cond
-   typedef typename container_detail::
-      move_const_ref_type::type                    insert_const_ref_type;
-   typedef typename 
-      container_detail::intrusive_slist_type::type           Icont;
-   typedef container_detail::node_alloc_holder        AllocHolder;
+   typedef typename
+      container_detail::intrusive_slist_type::type           Icont;
+   typedef container_detail::node_alloc_holder        AllocHolder;
    typedef typename AllocHolder::NodePtr              NodePtr;
-   typedef slist                                ThisType;
    typedef typename AllocHolder::NodeAlloc            NodeAlloc;
    typedef typename AllocHolder::ValAlloc             ValAlloc;
    typedef typename AllocHolder::Node                 Node;
@@ -175,7 +239,7 @@ class slist
    typedef typename AllocHolder::allocator_v1         allocator_v1;
    typedef typename AllocHolder::allocator_v2         allocator_v2;
    typedef typename AllocHolder::alloc_version        alloc_version;
-   typedef boost::container::allocator_traits      allocator_traits_type;
+   typedef boost::container::allocator_traits      allocator_traits_type;
 
    class equal_to_value
    {
@@ -205,141 +269,54 @@ class slist
       bool operator()(const Node &a) const
       {  return static_cast(*this)(a.m_data);  }
    };
-   /// @endcond
-   public:
-   //! The type of object, T, stored in the list
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                                allocator_type;
-   //! Non-standard extension: the stored allocator type
-   typedef NodeAlloc                                        stored_allocator_type;
 
-   /// @cond
-   private:
    BOOST_COPYABLE_AND_MOVABLE(slist)
-   typedef difference_type                         list_difference_type;
-   typedef pointer                                 list_pointer;
-   typedef const_pointer                           list_const_pointer;
-   typedef reference                               list_reference;
-   typedef const_reference                         list_const_reference;
+   typedef container_detail::slist_iterator      iterator_impl;
+   typedef container_detail::slist_const_iteratorconst_iterator_impl;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   //! Const iterator used to iterate through a list. 
-   class const_iterator
-      /// @cond
-      : public std::iterator
-   {
-
-      protected:
-      typename Icont::iterator m_it;
-      explicit const_iterator(typename Icont::iterator it)  : m_it(it){}
-      void prot_incr(){ ++m_it; }
-
-      private:
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class slist;
-      typedef list_difference_type        difference_type;
-
-      //Constructors
-      const_iterator()
-         :  m_it()
-      {}
-
-      //Pointer like operators
-      const_reference operator*() const 
-      { return m_it->m_data;  }
-
-      const_pointer   operator->() const 
-      { return  const_pointer(&m_it->m_data); }
-
-      //Increment / Decrement
-      const_iterator& operator++()       
-      { prot_incr();  return *this; }
-
-      const_iterator operator++(int)      
-      { typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp);  }
-
-      //Comparison operators
-      bool operator==   (const const_iterator& r)  const
-      {  return m_it == r.m_it;  }
-
-      bool operator!=   (const const_iterator& r)  const
-      {  return m_it != r.m_it;  }
-   }
-      /// @endcond
-   ;
-
-   //! Iterator used to iterate through a list
-   class iterator
-      /// @cond
-   : public const_iterator
-   {
-
-      private:
-      explicit iterator(typename Icont::iterator it)
-         :  const_iterator(it)
-      {}
-   
-      typename Icont::iterator get()
-      {  return this->m_it;   }
-
-      public:
-      friend class slist;
-      typedef list_pointer       pointer;
-      typedef list_reference     reference;
-
-      //Constructors
-      iterator(){}
-
-      //Pointer like operators
-      reference operator*()  const {  return  this->m_it->m_data;  }
-      pointer   operator->() const {  return  pointer(&this->m_it->m_data);  }
-
-      //Increment / Decrement
-      iterator& operator++()  
-         { this->prot_incr(); return *this;  }
-
-      iterator operator++(int)
-         { typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
-   }
-      /// @endcond
-   ;
+   typedef T                                                                  value_type;
+   typedef typename ::boost::container::allocator_traits::pointer          pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer    const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference        reference;
+   typedef typename ::boost::container::allocator_traits::const_reference  const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type        size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type  difference_type;
+   typedef Allocator                                                                  allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(NodeAlloc)                                  stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                              iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                        const_iterator;
 
    public:
+
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    slist()
       :  AllocHolder()
    {}
 
    //! Effects: Constructs a list taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit slist(const allocator_type& a)
+   explicit slist(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       :  AllocHolder(a)
    {}
 
@@ -352,11 +329,11 @@ class slist
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit slist(size_type n, const value_type& x, const allocator_type& a = allocator_type())
       :  AllocHolder(a)
-   { this->priv_create_and_insert_nodes(this->before_begin(), n, x); }
+   { this->insert_after(this->cbefore_begin(), n, x); }
 
    //! Effects: Constructs a list that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the list.
@@ -366,35 +343,71 @@ class slist
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   slist(InpIt first, InpIt last,
-         const allocator_type& a =  allocator_type()) 
+   slist(InpIt first, InpIt last, const allocator_type& a =  allocator_type())
       : AllocHolder(a)
-   { this->insert_after(this->before_begin(), first, last); }
+   { this->insert_after(this->cbefore_begin(), first, last); }
 
    //! Effects: Copy constructs a list.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
-   slist(const slist& x) 
+   slist(const slist& x)
       : AllocHolder(x)
-   { this->insert_after(this->before_begin(), x.begin(), x.end()); }
+   { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
 
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    slist(BOOST_RV_REF(slist) x)
       : AllocHolder(boost::move(static_cast(x)))
    {}
 
+   //! Effects: Copy constructs a list using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   slist(const slist& x, const allocator_type &a)
+      : AllocHolder(a)
+   { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves x's resources to *this.
+   //!
+   //! Throws: If allocation or value_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise.
+   slist(BOOST_RV_REF(slist) x, const allocator_type &a)
+      : AllocHolder(a)
+   {
+      if(this->node_alloc() == x.node_alloc()){
+         this->icont().swap(x.icont());
+      }
+      else{
+         this->insert(this->cbegin(), x.begin(), x.end());
+      }
+   }
+
+   //! Effects: Destroys the list. All stored values are destroyed
+   //!   and used memory is deallocated.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements.
+   ~slist() BOOST_CONTAINER_NOEXCEPT
+   {} //AllocHolder clears the slist
+
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -417,8 +430,8 @@ class slist
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -446,38 +459,16 @@ class slist
       return *this;
    }
 
-   //! Effects: Destroys the list. All stored values are destroyed
-   //!   and used memory is deallocated.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements.
-   ~slist() 
-   {} //AllocHolder clears the slist
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const
-   {  return allocator_type(this->node_alloc()); }
-
-   const stored_allocator_type &get_stored_allocator() const 
-   {  return this->node_alloc(); }
-
-   stored_allocator_type &get_stored_allocator()
-   {  return this->node_alloc(); }
-
-   public:
-
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
    //! Complexity: Linear to n.
    void assign(size_type n, const T& val)
-   { this->priv_fill_assign(n, val); }
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->assign(cvalue_iterator(val, n), cvalue_iterator());
+   }
 
    //! Effects: Assigns the range [first, last) to *this.
    //!
@@ -486,327 +477,257 @@ class slist
    //!
    //! Complexity: Linear to n.
    template 
-   void assign(InpIt first, InpIt last) 
+   void assign(InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
+      iterator end_n(this->end());
+      iterator prev(this->before_begin());
+      iterator node(this->begin());
+      while (node != end_n && first != last){
+         *node = *first;
+         prev = node;
+         ++node;
+         ++first;
+      }
+      if (first != last)
+         this->insert_after(prev, first, last);
+      else
+         this->erase_after(prev, end_n);
    }
 
-   //! Effects: Returns an iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a copy of the internal allocator.
+   //!
+   //! Throws: If allocator's copy constructor throws.
+   //!
    //! Complexity: Constant.
-   iterator begin() 
-   { return iterator(this->icont().begin()); }
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return allocator_type(this->node_alloc()); }
 
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   const_iterator begin() const 
-   {  return this->cbegin();   }
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
 
-   //! Effects: Returns an iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   iterator end()
-   { return iterator(this->icont().end()); }
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->node_alloc(); }
 
-   //! Effects: Returns a const_iterator to the end of the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const
-   {  return this->cend();   }
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns a non-dereferenceable iterator that,
    //! when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! as the argument to insert_after, erase_after, etc.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator before_begin() 
+   iterator before_begin() BOOST_CONTAINER_NOEXCEPT
    {  return iterator(end());  }
 
-   //! Effects: Returns a non-dereferenceable const_iterator 
+   //! Effects: Returns a non-dereferenceable const_iterator
    //! that, when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! as the argument to insert_after, erase_after, etc.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator before_begin() const
+   const_iterator before_begin() const BOOST_CONTAINER_NOEXCEPT
    {  return this->cbefore_begin();  }
 
-   //! Effects: Returns a const_iterator to the first element contained in the list.
-   //! 
+   //! Effects: Returns an iterator to the first element contained in the list.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cbegin() const 
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().begin()); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cbegin();   }
+
+   //! Effects: Returns an iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->icont().end()); }
+
+   //! Effects: Returns a const_iterator to the end of the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->cend();   }
+
+   //! Effects: Returns a non-dereferenceable const_iterator
+   //! that, when incremented, yields begin().  This iterator may be used
+   //! as the argument to insert_after, erase_after, etc.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbefore_begin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(end());  }
+
+   //! Effects: Returns a const_iterator to the first element contained in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
    {  return const_iterator(this->non_const_icont().begin());   }
 
    //! Effects: Returns a const_iterator to the end of the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator cend() const
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
    {  return const_iterator(this->non_const_icont().end());   }
 
-   //! Effects: Returns a non-dereferenceable const_iterator 
-   //! that, when incremented, yields begin().  This iterator may be used
-   //! as the argument toinsert_after, erase_after, etc.
-   //! 
+   //! Returns: The iterator to the element before i in the sequence.
+   //!   Returns the end-iterator, if either i is the begin-iterator or the
+   //!   sequence is empty.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
+   //! Complexity: Linear to the number of elements before i.
+   //!
+   //! Note: Non-standard extension.
+   iterator previous(iterator p) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->icont().previous(p.get())); }
+
+   //! Returns: The const_iterator to the element before i in the sequence.
+   //!   Returns the end-const_iterator, if either i is the begin-const_iterator or
+   //!   the sequence is empty.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements before i.
+   //!
+   //! Note: Non-standard extension.
+   const_iterator previous(const_iterator p)
+   {  return const_iterator(this->icont().previous(p.get())); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the list contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
    //! Complexity: Constant.
-   const_iterator cbefore_begin() const
-   {  return const_iterator(end());  }
+   bool empty() const
+   {  return !this->size();   }
 
    //! Effects: Returns the number of the elements contained in the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type size() const 
+   size_type size() const
    {  return this->icont().size(); }
 
    //! Effects: Returns the largest possible size of the list.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const 
+   size_type max_size() const
    {  return AllocHolder::max_size();  }
 
-   //! Effects: Returns true if the list contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const 
-   {  return !this->size();   }
-
-   //! Effects: Swaps the contents of *this and x.
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
    //!
-   //! Throws: Nothing.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Complexity: Linear to the number of elements on *this and x.
-   void swap(slist& x)
-   {  AllocHolder::swap(x);   }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference front() 
-   {  return *this->begin();  }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference front() const 
-   {  return *this->begin();  }
-
-   //! Effects: Inserts a copy of t in the beginning of the list.
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(insert_const_ref_type x)
-   {  return priv_push_front(x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   void push_front(T &x) { push_front(const_cast(x)); }
-
-   template
-   void push_front(const U &u
-      , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return priv_push_front(u); }
-   #endif
-
-   //! Effects: Constructs a new element in the beginning of the list
-   //!   and moves the resources of t to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_front(BOOST_RV_REF(T) x)
-   {  this->icont().push_front(*this->create_node(boost::move(x)));  }
-
-   //! Effects: Removes the first element from the list.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Amortized constant time.
-   void pop_front()
-   {  this->icont().pop_front_and_dispose(Destroyer(this->node_alloc()));      }
-
-   //! Returns: The iterator to the element before i in the sequence. 
-   //!   Returns the end-iterator, if either i is the begin-iterator or the 
-   //!   sequence is empty. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear to the number of elements before i. 
-   iterator previous(iterator p) 
-   {  return iterator(this->icont().previous(p.get())); }
-
-   //! Returns: The const_iterator to the element before i in the sequence. 
-   //!   Returns the end-const_iterator, if either i is the begin-const_iterator or 
-   //!   the sequence is empty. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear to the number of elements before i. 
-   const_iterator previous(const_iterator p) 
-   {  return const_iterator(this->icont().previous(p.get())); }
-
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts a copy of the value after the p pointed
-   //!    by prev_p.
-   //!
-   //! Returns: An iterator to the inserted element.
-   //! 
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //! 
-   //! Complexity: Amortized constant time.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   iterator insert_after(const_iterator prev_pos, insert_const_ref_type x) 
-   {  return this->priv_insert_after(prev_pos, x); }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert_after(const_iterator position, T &x)
-   { return this->insert_after(position, const_cast(x)); }
-
-   template
-   iterator insert_after( const_iterator position, const U &u
-                        , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert_after(position, u); }
-   #endif
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts a move constructed copy object from the value after the
-   //!    p pointed by prev_pos.
-   //!
-   //! Returns: An iterator to the inserted element.
-   //! 
-   //! Throws: If memory allocation throws.
-   //! 
-   //! Complexity: Amortized constant time.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   iterator insert_after(const_iterator prev_pos, BOOST_RV_REF(value_type) x) 
-   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(boost::move(x)))); }
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x after prev_pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   //!
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   void insert_after(const_iterator prev_pos, size_type n, const value_type& x)
-   {  this->priv_create_and_insert_nodes(prev_pos, n, x); }
-
-   //! Requires: prev_pos must be a valid iterator of *this.
-   //! 
-   //! Effects: Inserts the range pointed by [first, last) 
-   //!   after the p prev_pos.
-   //! 
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //! 
-   //! Complexity: Linear to the number of elements inserted.
-   //! 
-   //! Note: Does not affect the validity of iterators and references of
-   //!   previous values.
-   template 
-   void insert_after(const_iterator prev_pos, InIter first, InIter last) 
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
    {
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
+      const_iterator last_pos;
+      if(!priv_try_shrink(new_size, last_pos)){
+         typedef default_construct_iterator default_iterator;
+         this->insert_after(last_pos, default_iterator(new_size - this->size()), default_iterator());
+      }
    }
 
-   //! Requires: p must be a valid iterator of *this.
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
    //!
-   //! Effects: Insert a copy of x before p.
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
-   //!
-   //! Complexity: Linear to the elements before p.
-   iterator insert(const_iterator position, insert_const_ref_type x) 
-   {  return this->priv_insert(position, x); }
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      const_iterator last_pos;
+      if(!priv_try_shrink(new_size, last_pos)){
+         this->insert_after(last_pos, new_size, x);
+      }
+   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x)
-   { return this->insert(position, const_cast(x)); }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
-   template
-   iterator insert( const_iterator position, const U &u
-                  , typename container_detail::enable_if_c::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert(position, u); }
-   #endif
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference front()
+   {  return *this->begin();  }
 
-   //! Requires: p must be a valid iterator of *this.
+   //! Requires: !empty()
    //!
-   //! Effects: Insert a new element before p with mx's resources.
+   //! Effects: Returns a const reference to the first element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements before p.
-   iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) 
-   {  return this->insert_after(previous(p), boost::move(x)); }
+   //! Complexity: Constant.
+   const_reference front() const
+   {  return *this->begin();  }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts n copies of x before p.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n plus linear to the elements before p.
-   void insert(const_iterator p, size_type n, const value_type& x) 
-   {  return this->insert_after(previous(p), n, x); }
-      
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before p.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last) plus
-   //!    linear to the elements before p.
-   template 
-   void insert(const_iterator p, InIter first, InIter last) 
-   {  return this->insert_after(previous(p), first, last); }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -821,17 +742,6 @@ class slist
    void emplace_front(Args&&... args)
    {  this->emplace_after(this->cbefore_begin(), boost::forward(args)...); }
 
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... before p
-   //!
-   //! Throws: If memory allocation throws or
-   //!   T's in-place constructor throws.
-   //!
-   //! Complexity: Linear to the elements before p
-   template 
-   iterator emplace(const_iterator p, Args&&... args)
-   {  return this->emplace_after(this->previous(p), boost::forward(args)...);  }
-
    //! Effects: Inserts an object of type T constructed with
    //!   std::forward(args)... after prev
    //!
@@ -857,15 +767,6 @@ class slist
    }                                                                                         \
                                                                                              \
    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   iterator emplace (const_iterator p                                                        \
-                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
-   {                                                                                         \
-      return this->emplace_after                                                             \
-         (this->previous(p)                                                                  \
-          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
-   }                                                                                         \
-                                                                                             \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
    iterator emplace_after(const_iterator prev                                                \
                  BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
    {                                                                                         \
@@ -879,16 +780,149 @@ class slist
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the beginning of the list.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(const T &x);
+
+   //! Effects: Constructs a new element in the beginning of the list
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_front(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+   #endif
+
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts a copy of the value after the position pointed
+   //!    by prev_p.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, const T &x);
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts a move constructed copy object from the value after the
+   //!    p pointed by prev_pos.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_after, T, iterator, priv_insert_after, const_iterator)
+   #endif
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x after prev_pos.
+   //!
+   //! Returns: an iterator to the last inserted element or prev_pos if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //!
+   //! Complexity: Linear to n.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   iterator insert_after(const_iterator prev_pos, size_type n, const value_type& x)
+   {
+      typedef constant_iterator cvalue_iterator;
+      return this->insert_after(prev_pos, cvalue_iterator(x, n), cvalue_iterator());
+   }
+
+   //! Requires: prev_pos must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts the range pointed by [first, last)
+   //!   after the position prev_pos.
+   //!
+   //! Returns: an iterator to the last inserted element or prev_pos if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to the number of elements inserted.
+   //!
+   //! Note: Does not affect the validity of iterators and references of
+   //!   previous values.
+   template 
+   iterator insert_after(const_iterator prev_pos, InpIt first, InpIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+          && (container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      #endif
+      )
+   {
+      iterator ret_it(prev_pos.get());
+      for (; first != last; ++first){
+         ret_it = iterator(this->icont().insert_after(ret_it.get(), *this->create_node_from_it(first)));
+      }
+      return ret_it;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert_after(const_iterator prev, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !(container_detail::is_input_iterator::value
+                || container_detail::is_same::value
+               )
+         >::type * = 0
+      )
+   {
+      //Optimized allocation and construction
+      insertion_functor func(this->icont(), prev.get());
+      this->allocate_many_and_construct(first, std::distance(first, last), func);
+      return iterator(func.inserted_first());
+   }
+   #endif
+
+   //! Effects: Removes the first element from the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Amortized constant time.
+   void pop_front()
+   {  this->icont().pop_front_and_dispose(Destroyer(this->node_alloc()));      }
+
    //! Effects: Erases the element after the element pointed by prev_pos
    //!    of the list.
    //!
    //! Returns: the first element remaining beyond the removed elements,
    //!   or end() if no such element exists.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Does not invalidate iterators or references to non erased elements.
    iterator erase_after(const_iterator prev_pos)
    {
@@ -896,93 +930,43 @@ class slist
    }
 
    //! Effects: Erases the range (before_first, last) from
-   //!   the list. 
+   //!   the list.
    //!
    //! Returns: the first element remaining beyond the removed elements,
    //!   or end() if no such element exists.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Linear to the number of erased elements.
-   //! 
+   //!
    //! Note: Does not invalidate iterators or references to non erased elements.
-   iterator erase_after(const_iterator before_first, const_iterator last) 
+   iterator erase_after(const_iterator before_first, const_iterator last)
    {
       return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
    }
 
-   //! Requires: p must be a valid iterator of *this.
-   //!
-   //! Effects: Erases the element at p p.
+   //! Effects: Swaps the contents of *this and x.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the number of elements before p.
-   iterator erase(const_iterator p) 
-   {  return iterator(this->erase_after(previous(p))); }
-
-   //! Requires: first and last must be valid iterator to elements in *this.
-   //!
-   //! Effects: Erases the elements pointed by [first, last).
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the distance between first and last plus
-   //!   linear to the elements before first.
-   iterator erase(const_iterator first, const_iterator last)
-   {  return iterator(this->erase_after(previous(first), last)); }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x)
-   {
-      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
-      while (++(cur_next = cur) != end_n && new_size > 0){
-         --new_size;
-         cur = cur_next;
-      }
-      if (cur_next != end_n) 
-         this->erase_after(const_iterator(cur), const_iterator(end_n));
-      else
-         this->insert_after(const_iterator(cur), new_size, x);
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size)
-   {
-      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
-      size_type len = this->size();
-      size_type left = new_size;
-      
-      while (++(cur_next = cur) != end_n && left > 0){
-         --left;
-         cur = cur_next;
-      }
-      if (cur_next != end_n){
-         this->erase_after(const_iterator(cur), const_iterator(end_n));
-      }
-      else{
-         this->priv_create_and_insert_nodes(const_iterator(cur), new_size - len);
-      }
-   }
+   //! Complexity: Linear to the number of elements on *this and x.
+   void swap(slist& x)
+   {  AllocHolder::swap(x);   }
 
    //! Effects: Erases all the elements of the list.
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the list.
-   void clear() 
+   void clear()
    {  this->icont().clear_and_dispose(Destroyer(this->node_alloc()));  }
 
+   //////////////////////////////////////////////
+   //
+   //              slist operations
+   //
+   //////////////////////////////////////////////
+
    //! Requires: p must point to an element contained
    //!   by the list. x != *this
    //!
@@ -993,274 +977,298 @@ class slist
    //!   are not equal.
    //!
    //! Complexity: Linear to the elements in x.
-   //! 
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos, slist& x)
+   void splice_after(const_iterator prev_pos, slist& x) BOOST_CONTAINER_NOEXCEPT
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after(prev_pos.get(), x.icont());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   after the element pointed by prev_pos.
-   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos, slist& x, const_iterator prev)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after(prev_pos.get(), x.icont(), prev.get());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   before_first and before_last must be valid iterators of x.
-   //!   prev_pos must not be contained in [before_first, before_last) range.
-   //! 
-   //! Effects: Transfers the range [before_first + 1, before_last + 1)
-   //!   from list x to this list, after the element pointed by prev_pos.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear to the number of transferred elements.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos,      slist& x, 
-      const_iterator before_first,  const_iterator before_last)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after
-            (prev_pos.get(), x.icont(), before_first.get(), before_last.get());
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
-   }
-
-   //! Requires: prev_pos must be a valid iterator of this.
-   //!   before_first and before_last must be valid iterators of x.
-   //!   prev_pos must not be contained in [before_first, before_last) range.
-   //!   n == std::distance(before_first, before_last)
-   //! 
-   //! Effects: Transfers the range [before_first + 1, before_last + 1)
-   //!   from list x to this list, after the element pointed by prev_pos.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Iterators of values obtained from list x now point to elements of this
-   //!   list. Iterators of this list and all the references are not invalidated.
-   void splice_after(const_iterator prev_pos,      slist& x, 
-                     const_iterator before_first,  const_iterator before_last,
-                     size_type n)
-   {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().splice_after
-            (prev_pos.get(), x.icont(), before_first.get(), before_last.get(), n);
-      }
-      else{
-         throw std::runtime_error("slist::splice called with unequal allocators");
-      }
+      BOOST_ASSERT(this != &x);
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after(prev_pos.get(), x.icont());
    }
 
    //! Requires: p must point to an element contained
    //!   by the list. x != *this
    //!
-   //! Effects: Transfers all the elements of list x to this list, before the
+   //! Effects: Transfers all the elements of list x to this list, after the
    //!   the element pointed by p. No destructors or copy constructors are called.
    //!
    //! Throws: std::runtime_error if this' allocator and x's allocator
    //!   are not equal.
    //!
-   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
-   //! 
+   //! Complexity: Linear to the elements in x.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of
    //!    this list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, ThisType& x) 
-   {  this->splice_after(this->previous(p), x);  }
+   void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x));  }
 
-   //! Requires: p must point to an element contained
-   //!   by this list. i must point to an element contained in list x.
-   //! 
-   //! Effects: Transfers the value pointed by i, from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //!   If p == i or p == ++i, this function is a null operation. 
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
-   //! 
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   after the element pointed by prev_pos.
+   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, slist& x, const_iterator i)
-   {  this->splice_after(previous(p), x, i);  }
+   void splice_after(const_iterator prev_pos, slist& x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after(prev_pos.get(), x.icont(), prev.get());
+   }
 
-   //! Requires: p must point to an element contained
-   //!   by this list. first and last must point to elements contained in list x.
-   //! 
-   //! Effects: Transfers the range pointed by first and last from list x to this list, 
-   //!   before the the element pointed by p. No destructors or copy constructors are called.
-   //! 
-   //! Throws: std::runtime_error if this' allocator and x's allocator
-   //!   are not equal.
-   //! 
-   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
-   //!   and in distance(first, last).
-   //! 
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   after the element pointed by prev_pos.
+   //!   If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
    //! Note: Iterators of values obtained from list x now point to elements of this
    //!   list. Iterators of this list and all the references are not invalidated.
-   void splice(const_iterator p, slist& x, const_iterator first, const_iterator last)
-   {  this->splice_after(previous(p), x, previous(first), previous(last));  }
+   void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), prev);  }
 
-   //! Effects: Reverses the order of elements in the list. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: This function is linear time.
-   //! 
-   //! Note: Iterators and references are not invalidated
-   void reverse() 
-   {  this->icont().reverse();  }
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of transferred elements.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      slist& x,
+      const_iterator before_first,  const_iterator before_last) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after
+         (prev_pos.get(), x.icont(), before_first.get(), before_last.get());
+   }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear to the number of transferred elements.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      BOOST_RV_REF(slist) x,
+      const_iterator before_first,  const_iterator before_last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), before_first, before_last);  }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   n == std::distance(before_first, before_last).
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      slist& x,
+                     const_iterator before_first,  const_iterator before_last,
+                     size_type n) BOOST_CONTAINER_NOEXCEPT
+   {
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().splice_after
+         (prev_pos.get(), x.icont(), before_first.get(), before_last.get(), n);
+   }
+
+   //! Requires: prev_pos must be a valid iterator of this.
+   //!   before_first and before_last must be valid iterators of x.
+   //!   prev_pos must not be contained in [before_first, before_last) range.
+   //!   n == std::distance(before_first, before_last).
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the range [before_first + 1, before_last + 1)
+   //!   from list x to this list, after the element pointed by prev_pos.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice_after(const_iterator prev_pos,      BOOST_RV_REF(slist) x,
+                     const_iterator before_first,  const_iterator before_last,
+                     size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(prev_pos, static_cast(x), before_first, before_last, n);  }
 
    //! Effects: Removes all the elements that compare equal to value.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() comparisons for equality.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void remove(const T& value)
-   {  remove_if(equal_to_value(value));  }
+   {  this->remove_if(equal_to_value(value));  }
 
    //! Effects: Removes all the elements for which a specified
    //!   predicate is satisfied.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
+   //!
    //! Complexity: Linear time. It performs exactly size() calls to the predicate.
-   //! 
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
-   template  
+   template 
    void remove_if(Pred pred)
    {
       typedef ValueCompareToNodeCompare Predicate;
       this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that are equal from the list.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
-   //! 
+   //!
+   //! Throws: If comparison throws.
+   //!
+   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
    void unique()
    {  this->unique(value_equal());  }
 
-   //! Effects: Removes adjacent duplicate elements or adjacent 
+   //! Effects: Removes adjacent duplicate elements or adjacent
    //!   elements that satisfy some binary predicate from the list.
-   //! 
+   //!
    //! Throws: If pred throws.
-   //! 
-   //! Complexity: Linear time (size()-1 comparisons equality comparisons).
-   //! 
+   //!
+   //! Complexity: Linear time (size()-1 comparisons calls to pred()).
+   //!
    //! Note: The relative order of elements that are not removed is unchanged,
    //!   and iterators to elements that are not removed remain valid.
-   template  
+   template 
    void unique(Pred pred)
    {
       typedef ValueCompareToNodeCompare Predicate;
       this->icont().unique_and_dispose(Predicate(pred), Destroyer(this->node_alloc()));
    }
 
-   //! Requires: The lists x and *this must be distinct. 
+   //! Requires: The lists x and *this must be distinct.
    //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this according to std::less. The merge is stable; 
-   //!   that is, if an element from *this is equivalent to one from x, then the element 
-   //!   from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
    void merge(slist & x)
    {  this->merge(x, value_less()); }
 
-   //! Requires: p must be a comparison function that induces a strict weak
-   //!   ordering and both *this and x must be sorted according to that ordering
-   //!   The lists x and *this must be distinct. 
-   //! 
+   //! Requires: The lists x and *this must be distinct.
+   //!
    //! Effects: This function removes all of x's elements and inserts them
-   //!   in order into *this. The merge is stable; that is, if an element from *this is 
-   //!   equivalent to one from x, then the element from *this will precede the one from x. 
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //!   in order into *this according to std::less. The merge is stable;
+   //!   that is, if an element from *this is equivalent to one from x, then the element
+   //!   from *this will precede the one from x.
+   //!
+   //! Throws: If comparison throws.
+   //!
    //! Complexity: This function is linear time: it performs at most
    //!   size() + x.size() - 1 comparisons.
-   //! 
+   void merge(BOOST_RV_REF(slist) x)
+   {  this->merge(static_cast(x)); }
+
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
    //! Note: Iterators and references to *this are not invalidated.
    template 
    void merge(slist& x, StrictWeakOrdering comp)
    {
-      if((NodeAlloc&)*this == (NodeAlloc&)x){
-         this->icont().merge(x.icont(),
-            ValueCompareToNodeCompare(comp));
-      }
-      else{
-         throw std::runtime_error("list::merge called with unequal allocators");
-      }
+      BOOST_ASSERT(this->node_alloc() == x.node_alloc());
+      this->icont().merge(x.icont(),
+         ValueCompareToNodeCompare(comp));
    }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Requires: p must be a comparison function that induces a strict weak
+   //!   ordering and both *this and x must be sorted according to that ordering
+   //!   The lists x and *this must be distinct.
+   //!
+   //! Effects: This function removes all of x's elements and inserts them
+   //!   in order into *this. The merge is stable; that is, if an element from *this is
+   //!   equivalent to one from x, then the element from *this will precede the one from x.
+   //!
+   //! Throws: If comp throws.
+   //!
+   //! Complexity: This function is linear time: it performs at most
+   //!   size() + x.size() - 1 comparisons.
+   //!
+   //! Note: Iterators and references to *this are not invalidated.
+   template 
+   void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp)
+   {  this->merge(static_cast(x), comp); }
+
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comparison throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
    void sort()
    {  this->sort(value_less());  }
 
-   //! Effects: This function sorts the list *this according to std::less. 
+   //! Effects: This function sorts the list *this according to std::less.
    //!   The sort is stable, that is, the relative order of equivalent elements is preserved.
-   //! 
-   //! Throws: Nothing.
+   //!
+   //! Throws: If comp throws.
    //!
    //! Notes: Iterators and references are not invalidated.
-   //! 
+   //!
    //! Complexity: The number of comparisons is approximately N log N, where N
    //!   is the list's size.
-   template  
+   template 
    void sort(StrictWeakOrdering comp)
    {
       // nothing if the slist has length 0 or 1.
@@ -1269,42 +1277,264 @@ class slist
       this->icont().sort(ValueCompareToNodeCompare(comp));
    }
 
-   /// @cond
-   private:
-   iterator priv_insert(const_iterator p, const value_type& x) 
-   {  return this->insert_after(previous(p), x); }
+   //! Effects: Reverses the order of elements in the list.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: This function is linear time.
+   //!
+   //! Note: Iterators and references are not invalidated
+   void reverse() BOOST_CONTAINER_NOEXCEPT
+   {  this->icont().reverse();  }
 
-   iterator priv_insert_after(const_iterator prev_pos, const value_type& x) 
-   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(x))); }
+   //////////////////////////////////////////////
+   //
+   //       list compatibility interface
+   //
+   //////////////////////////////////////////////
 
-   void priv_push_front(const value_type &x)
-   {  this->icont().push_front(*this->create_node(x));  }
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-   //Iterator range version
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end)
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... before p
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's in-place constructor throws.
+   //!
+   //! Complexity: Linear to the elements before p
+   template 
+   iterator emplace(const_iterator p, Args&&... args)
+   {  return this->emplace_after(this->previous(p), boost::forward(args)...);  }
+
+   #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
+   iterator emplace (const_iterator p                                                        \
+                 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
+   {                                                                                         \
+      return this->emplace_after                                                             \
+         (this->previous(p)                                                                  \
+          BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));                   \
+   }                                                                                         \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before p.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements before p.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before p with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Linear to the elements before p.
+   iterator insert(const_iterator prev_pos, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts n copies of x before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n == 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n plus linear to the elements before p.
+   iterator insert(const_iterator p, size_type n, const value_type& x)
    {
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      priv_create_and_insert_nodes(prev, beg, end, alloc_version(), ItCat());
+      const_iterator prev(this->previous(p));
+      this->insert_after(prev, n, x);
+      return ++iterator(prev.get());
+   }
+     
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before p.
+   //!
+   //! Returns: an iterator to the first inserted element or p if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last) plus
+   //!    linear to the elements before p.
+   template 
+   iterator insert(const_iterator p, InIter first, InIter last)
+   {
+      const_iterator prev(this->previous(p));
+      this->insert_after(prev, first, last);
+      return ++iterator(prev.get());
    }
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end, allocator_v1, std::input_iterator_tag)
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Erases the element at p p.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements before p.
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->erase_after(previous(p))); }
+
+   //! Requires: first and last must be valid iterator to elements in *this.
+   //!
+   //! Effects: Erases the elements pointed by [first, last).
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the distance between first and last plus
+   //!   linear to the elements before first.
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->erase_after(previous(first), last)); }
+
+   //! Requires: p must point to an element contained
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x);  }
+
+   //! Requires: p must point to an element contained
+   //!   by the list. x != *this. this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers all the elements of list x to this list, before the
+   //!   the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and linear in x.size().
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of
+   //!    this list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x, this->previous(i));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. i must point to an element contained in list x.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Effects: Transfers the value pointed by i, from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   If p == i or p == ++i, this function is a null operation.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), i);  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!   this' allocator and x's allocator shall compare equal.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
+   //!   and in distance(first, last).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, slist& x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice_after(this->previous(p), x, this->previous(first), this->previous(last));  }
+
+   //! Requires: p must point to an element contained
+   //!   by this list. first and last must point to elements contained in list x.
+   //!   this' allocator and x's allocator shall compare equal
+   //!
+   //! Effects: Transfers the range pointed by first and last from list x to this list,
+   //!   before the the element pointed by p. No destructors or copy constructors are called.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Linear in distance(begin(), p), in distance(x.begin(), first),
+   //!   and in distance(first, last).
+   //!
+   //! Note: Iterators of values obtained from list x now point to elements of this
+   //!   list. Iterators of this list and all the references are not invalidated.
+   void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {  this->splice(p, static_cast(x), first, last);  }
+
+   /// @cond
+   private:
+
+   void priv_push_front (const T &x)  
+   {  this->insert(this->cbegin(), x);  }
+
+   void priv_push_front (BOOST_RV_REF(T) x)
+   {  this->insert(this->cbegin(), ::boost::move(x));  }
+
+   bool priv_try_shrink(size_type new_size, const_iterator &last_pos)
    {
-      for (; beg != end; ++beg){
-         this->icont().insert_after(prev.get(), *this->create_node_from_it(beg));
-         ++prev;
+      typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
+      while (++(cur_next = cur) != end_n && new_size > 0){
+         --new_size;
+         cur = cur_next;
+      }
+      last_pos = const_iterator(cur);
+      if (cur_next != end_n){
+         this->erase_after(last_pos, const_iterator(end_n));
+         return true;
+      }
+      else{
+         return false;
       }
    }
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, InpIterator beg, InpIterator end, allocator_v2, std::input_iterator_tag)
-   {  //Just forward to the default one
-      priv_create_and_insert_nodes(prev, beg, end, allocator_v1(), std::input_iterator_tag());
-   }
+   template
+   iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x)
+   {  return this->insert_after(previous(p), ::boost::forward(x)); }
+
+   template
+   iterator priv_insert_after(const_iterator prev_pos, BOOST_FWD_REF(U) x)
+   {  return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(::boost::forward(x)))); }
 
    class insertion_functor;
    friend class insertion_functor;
@@ -1312,97 +1542,25 @@ class slist
    class insertion_functor
    {
       Icont &icont_;
-      typename Icont::const_iterator prev_;
+      typedef typename Icont::iterator       iiterator;
+      typedef typename Icont::const_iterator iconst_iterator;
+      const iconst_iterator prev_;
+      iiterator   ret_;
 
       public:
       insertion_functor(Icont &icont, typename Icont::const_iterator prev)
-         :  icont_(icont), prev_(prev)
+         :  icont_(icont), prev_(prev), ret_(prev.unconst())
       {}
 
       void operator()(Node &n)
-      {  prev_ = this->icont_.insert_after(prev_, n); }
+      {
+         ret_ = this->icont_.insert_after(prev_, n);
+      }
+
+      iiterator inserted_first() const
+      {  return ret_;   }
    };
 
-   template
-   void priv_create_and_insert_nodes
-      (const_iterator prev, FwdIterator beg, FwdIterator end, allocator_v2, std::forward_iterator_tag)
-   {
-      //Optimized allocation and construction
-      this->allocate_many_and_construct
-         (beg, std::distance(beg, end), insertion_functor(this->icont(), prev.get()));
-   }
-
-   //Default constructed version
-   void priv_create_and_insert_nodes(const_iterator prev, size_type n)
-   {
-      typedef default_construct_iterator default_iterator;
-      this->priv_create_and_insert_nodes(prev, default_iterator(n), default_iterator());
-   }
-
-   //Copy constructed version
-   void priv_create_and_insert_nodes(const_iterator prev, size_type n, const T& x)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->priv_create_and_insert_nodes(prev, cvalue_iterator(x, n), cvalue_iterator());
-   }
-
-   //Dispatch to detect iterator range or integer overloads
-   template 
-   void priv_insert_dispatch(const_iterator prev,
-                             InputIter first, InputIter last,
-                             container_detail::false_)
-   {  this->priv_create_and_insert_nodes(prev, first, last);   }
-
-   template
-   void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_) 
-   {  this->priv_create_and_insert_nodes(prev, (size_type)n, x);  }
-
-   void priv_fill_assign(size_type n, const T& val) 
-   {
-      iterator end_n(this->end());
-      iterator prev(this->before_begin());
-      iterator node(this->begin());
-      for ( ; node != end_n && n > 0 ; --n){
-         *node = val;
-         prev = node;
-         ++node;
-      }
-      if (n > 0)
-         this->priv_create_and_insert_nodes(prev, n, val);
-      else
-         this->erase_after(prev, end_n);
-   }
-
-   template 
-   void priv_assign_dispatch(Int n, Int val, container_detail::true_)
-   {  this->priv_fill_assign((size_type) n, (T)val); }
-
-   template 
-   void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
-   {
-      iterator end_n(this->end());
-      iterator prev(this->before_begin());
-      iterator node(this->begin());
-      while (node != end_n && first != last){
-         *node = *first;
-         prev = node;
-         ++node;
-         ++first;
-      }
-      if (first != last)
-         this->priv_create_and_insert_nodes(prev, first, last);
-      else
-         this->erase_after(prev, end_n);
-   }
-
-   template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_) 
-   {  this->priv_create_and_insert_nodes(prev_pos, (size_type)n, x);  }
-
-   template 
-   void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, container_detail::false_) 
-   {  this->priv_create_and_insert_nodes(prev_pos, first, last); }
-
    //Functors for member algorithm defaults
    struct value_less
    {
@@ -1429,14 +1587,14 @@ class slist
    /// @endcond
 };
 
-template 
-inline bool 
-operator==(const slist& x, const slist& y)
+template 
+inline bool
+operator==(const slist& x, const slist& y)
 {
    if(x.size() != y.size()){
       return false;
    }
-   typedef typename slist::const_iterator const_iterator;
+   typedef typename slist::const_iterator const_iterator;
    const_iterator end1 = x.end();
 
    const_iterator i1 = x.begin();
@@ -1448,36 +1606,36 @@ operator==(const slist& x, const slist& y)
    return i1 == end1;
 }
 
-template 
+template 
 inline bool
-operator<(const slist& sL1, const slist& sL2)
+operator<(const slist& sL1, const slist& sL2)
 {
    return std::lexicographical_compare
       (sL1.begin(), sL1.end(), sL2.begin(), sL2.end());
 }
 
-template 
-inline bool 
-operator!=(const slist& sL1, const slist& sL2) 
+template 
+inline bool
+operator!=(const slist& sL1, const slist& sL2)
    {  return !(sL1 == sL2);   }
 
-template 
-inline bool 
-operator>(const slist& sL1, const slist& sL2) 
+template 
+inline bool
+operator>(const slist& sL1, const slist& sL2)
    {  return sL2 < sL1; }
 
-template 
-inline bool 
-operator<=(const slist& sL1, const slist& sL2)
+template 
+inline bool
+operator<=(const slist& sL1, const slist& sL2)
    {  return !(sL2 < sL1); }
 
-template 
-inline bool 
-operator>=(const slist& sL1, const slist& sL2)
+template 
+inline bool
+operator>=(const slist& sL1, const slist& sL2)
    {  return !(sL1 < sL2); }
 
-template 
-inline void swap(slist& x, slist& y) 
+template 
+inline void swap(slist& x, slist& y)
    {  x.swap(y);  }
 
 }}
@@ -1485,15 +1643,14 @@ inline void swap(slist& x, slist& y)
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 namespace container {
 
 /// @endcond
@@ -1505,15 +1662,15 @@ namespace container {
 
 ///@cond
 
-//Ummm, I don't like to define things in namespace std, but 
+//Ummm, I don't like to define things in namespace std, but
 //there is no other way
 namespace std {
 
-template 
-class insert_iterator > 
+template 
+class insert_iterator >
 {
  protected:
-   typedef boost::container::slist Container;
+   typedef boost::container::slist Container;
    Container* container;
    typename Container::iterator iter;
    public:
@@ -1524,14 +1681,14 @@ class insert_iterator >
    typedef void                pointer;
    typedef void                reference;
 
-   insert_iterator(Container& x, 
-                   typename Container::iterator i, 
-                   bool is_previous = false) 
+   insert_iterator(Container& x,
+                   typename Container::iterator i,
+                   bool is_previous = false)
       : container(&x), iter(is_previous ? i : x.previous(i)){ }
 
-   insert_iterator& 
-      operator=(const typename Container::value_type& value) 
-   { 
+   insert_iterator&
+      operator=(const typename Container::value_type& value)
+   {
       iter = container->insert_after(iter, value);
       return *this;
    }
@@ -1546,4 +1703,4 @@ class insert_iterator >
 
 #include 
 
-#endif /* BOOST_CONTAINER_SLIST_HPP */
+#endif // BOOST_CONTAINER_SLIST_HPP
diff --git a/project/jni/boost/include/boost/container/stable_vector.hpp b/project/jni/boost/include/boost/container/stable_vector.hpp
index 851b5f26e..539b2da8e 100644
--- a/project/jni/boost/include/boost/container/stable_vector.hpp
+++ b/project/jni/boost/include/boost/container/stable_vector.hpp
@@ -1,6 +1,6 @@
-//////////////////////////////////////////////////////////////////////////////
+
 //
-// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -28,18 +28,21 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
+#include  //max
 #include 
 #include 
+#include  //placement new
 
 ///@cond
 
@@ -47,10 +50,6 @@
 
 //#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 
-#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
-#include 
-#endif
-
 ///@endcond
 
 namespace boost {
@@ -60,28 +59,6 @@ namespace container {
 
 namespace stable_vector_detail{
 
-template
-struct smart_ptr_type
-{
-   typedef typename SmartPtr::value_type value_type;
-   typedef value_type *pointer;
-   static pointer get (const SmartPtr &smartptr)
-   {  return smartptr.get();}
-};
-
-template
-struct smart_ptr_type
-{
-   typedef T value_type;
-   typedef value_type *pointer;
-   static pointer get (pointer ptr)
-   {  return ptr;}
-};
-
-template
-inline typename smart_ptr_type::pointer to_raw_pointer(const Ptr &ptr)
-{  return smart_ptr_type::get(ptr);   }
-
 template 
 class clear_on_destroy
 {
@@ -97,7 +74,7 @@ class clear_on_destroy
    {
       if(do_clear_){
          c_.clear();
-         c_.clear_pool();  
+         c_.priv_clear_pool(); 
       }
    }
 
@@ -108,51 +85,42 @@ class clear_on_destroy
    bool do_clear_;
 };
 
-template
-struct node_type_base
-{/*
-   node_type_base(VoidPtr p)
-      : up(p)
-   {}*/
-   node_type_base()
-   {}
-   void set_pointer(VoidPtr p)
-   {  up = p; }
+template
+struct node;
 
-   VoidPtr up;
+template
+struct node_base
+{
+   private:
+   typedef typename boost::intrusive::
+      pointer_traits                   void_ptr_traits;
+   typedef typename void_ptr_traits::
+      template rebind_pointer
+         ::type                      node_base_ptr;
+   typedef typename void_ptr_traits::
+      template rebind_pointer
+         ::type                  node_base_ptr_ptr;
+
+   public:
+   node_base(const node_base_ptr_ptr &n)
+      : up(n)
+   {}
+
+   node_base()
+      : up()
+   {}
+
+   node_base_ptr_ptr up;
 };
 
 template
-struct node_type
-   : public node_type_base
+struct node
+   : public node_base
 {
-   node_type()
-      : value()
-   {}
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-   template
-   node_type(Args &&...args)
-      : value(boost::forward(args)...)
-   {}
-
-   #else //BOOST_CONTAINER_PERFECT_FORWARDING
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                           \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \
-   node_type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                             \
-      : value(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))                         \
-   {}                                                                                        \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif//BOOST_CONTAINER_PERFECT_FORWARDING
-   
-   void set_pointer(VoidPointer p)
-   {  node_type_base::set_pointer(p); }
+   private:
+   node();
 
+   public:
    T value;
 };
 
@@ -165,87 +133,78 @@ class iterator
                          , Pointer
                          , Reference>
 {
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type                void_ptr;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type          const_void_ptr;
-   typedef node_type                  node_type_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type         node_type_ptr_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type   const_node_type_ptr_t;
-   typedef typename boost::intrusive::
-      pointer_traits::template
-         rebind_pointer::type            void_ptr_ptr;
+   typedef boost::intrusive::
+      pointer_traits                   ptr_traits;
+   typedef typename ptr_traits::template
+         rebind_pointer::type             void_ptr;
+   typedef node                    node_type;
+   typedef node_base                  node_base_type;
+   typedef typename ptr_traits::template
+         rebind_pointer::type        node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                  node_ptr_traits;
+   typedef typename ptr_traits::template
+         rebind_pointer::type   node_base_ptr;
+   typedef typename ptr_traits::template
+         rebind_pointer::type    node_base_ptr_ptr;
+   typedef typename ptr_traits::template
+      rebind_pointer::type                   friend_iterator_pointer;
 
-   friend class iterator::template rebind_pointer::type>;
+   friend class iterator;
 
    public:
    typedef std::random_access_iterator_tag      iterator_category;
    typedef T                                    value_type;
-   typedef typename boost::intrusive::
-      pointer_traits::difference_type  difference_type;
+   typedef typename ptr_traits::difference_type difference_type;
    typedef Pointer                              pointer;
    typedef Reference                            reference;
 
    iterator()
    {}
 
-   explicit iterator(node_type_ptr_t pn)
-      : pn(pn)
+   explicit iterator(node_ptr p)
+      : pn(p)
    {}
 
-   iterator(const iterator::template rebind_pointer::type>& x)
+   iterator(const iterator& x)
       : pn(x.pn)
    {}
-   
-   private:
-   static node_type_ptr_t node_ptr_cast(const void_ptr &p)
-   {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
 
-   static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
-   {
-      return const_node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
+   node_ptr &node_pointer()
+   {  return pn;  }
 
-   static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
-   {
-      return void_ptr_ptr(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   reference dereference() const
-   {  return pn->value; }
-   bool equal(const iterator& x) const
-   {  return pn==x.pn;  }
-   void increment()
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+1)); }
-   void decrement()
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)-1)); }
-   void advance(difference_type n)
-   {  pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+n)); }
-   difference_type distance_to(const iterator& x)const
-   {  return void_ptr_ptr_cast(x.pn->up) - void_ptr_ptr_cast(pn->up);   }
+   const node_ptr &node_pointer() const
+   {  return pn;  }
 
    public:
    //Pointer like operators
-   reference operator*()  const {  return  this->dereference();  }
-   pointer   operator->() const {  return  pointer(&this->dereference());  }
+   reference operator*()  const
+   {  return  pn->value;  }
+
+   pointer   operator->() const
+   {  return  ptr_traits::pointer_to(this->operator*());  }
 
    //Increment / Decrement
-   iterator& operator++()  
-   {  this->increment(); return *this;  }
+   iterator& operator++()
+   {
+      if(node_base_ptr_ptr p = this->pn->up){
+         ++p;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
+      return *this;
+   }
 
    iterator operator++(int)
    {  iterator tmp(*this);  ++*this; return iterator(tmp); }
 
    iterator& operator--()
-   {  this->decrement(); return *this;  }
+   {
+      if(node_base_ptr_ptr p = this->pn->up){
+         --p;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
+      return *this;
+   }
 
    iterator operator--(int)
    {  iterator tmp(*this);  --*this; return iterator(tmp);  }
@@ -259,7 +218,10 @@ class iterator
 
    iterator& operator+=(difference_type off)
    {
-      pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+off));
+      if(node_base_ptr_ptr p = this->pn->up){
+         p += off;
+         this->pn = node_ptr_traits::static_cast_from(*p);
+      }
       return *this;
    }
 
@@ -289,7 +251,7 @@ class iterator
 
    friend difference_type operator-(const iterator& left, const iterator& right)
    {
-      return void_ptr_ptr_cast(left.pn->up) - void_ptr_ptr_cast(right.pn->up);
+      return left.pn->up - right.pn->up;
    }
 
    //Comparison operators
@@ -300,232 +262,301 @@ class iterator
    {  return l.pn != r.pn;  }
 
    friend bool operator<    (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) < void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up < r.pn->up;  }
 
    friend bool operator<=   (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) <= void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up <= r.pn->up;  }
 
    friend bool operator>    (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) > void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up > r.pn->up;  }
 
    friend bool operator>=   (const iterator& l, const iterator& r)
-   {  return void_ptr_ptr_cast(l.pn->up) >= void_ptr_ptr_cast(r.pn->up);  }
+   {  return l.pn->up >= r.pn->up;  }
 
-   node_type_ptr_t pn;
+   node_ptr pn;
 };
 
-template
-struct select_multiallocation_chain
+template
+struct index_traits
 {
-   typedef typename A::multiallocation_chain type;
-};
+   typedef boost::intrusive::
+      pointer_traits
+                                             void_ptr_traits;
+   typedef stable_vector_detail::
+      node_base                              node_base_type;
+   typedef typename void_ptr_traits::template
+         rebind_pointer::type         node_base_ptr;
+   typedef typename void_ptr_traits::template
+         rebind_pointer::type          node_base_ptr_ptr;
+   typedef boost::intrusive::
+      pointer_traits                   node_base_ptr_traits;
+   typedef boost::intrusive::
+      pointer_traits               node_base_ptr_ptr_traits;
+   typedef typename allocator_traits::
+         template portable_rebind_alloc
+            ::type                     node_base_ptr_allocator;
+   typedef ::boost::container::vector
+              index_type;
+   typedef typename index_type::iterator              index_iterator;
+   typedef typename index_type::const_iterator        const_index_iterator;
+   typedef typename index_type::size_type             size_type;
 
-template
-struct select_multiallocation_chain
-{
-   typedef typename boost::intrusive::pointer_traits
-      ::pointer>::
-         template rebind_pointer::type                void_ptr;
-   typedef container_detail::basic_multiallocation_chain
-                                                  multialloc_cached_counted;
-   typedef boost::container::container_detail::
-      transform_multiallocation_chain
-         < multialloc_cached_counted
-         , typename allocator_traits::value_type>        type;
+   static const size_type ExtraPointers = 3;
+   //Stable vector stores metadata at the end of the index (node_base_ptr vector) with additional 3 pointers:
+   //    back() is this->index.back() - ExtraPointers;
+   //    end node index is    *(this->index.end() - 3)
+   //    Node cache first is  *(this->index.end() - 2);
+   //    Node cache last is   this->index.back();
+
+   static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n)
+   {  return node_base_ptr_ptr_traits::pointer_to(n);   }
+
+   static void fix_up_pointers(index_iterator first, index_iterator last)
+   {
+      while(first != last){
+         typedef typename index_type::reference node_base_ptr_ref;
+         node_base_ptr_ref nbp = *first;
+         nbp->up = index_traits::ptr_to_node_base_ptr(nbp);
+         ++first;
+      }
+   }
+
+   static index_iterator get_fix_up_end(index_type &index)
+   {  return index.end() - (ExtraPointers - 1); }
+
+   static void fix_up_pointers_from(index_type & index, index_iterator first)
+   {  index_traits::fix_up_pointers(first, index_traits::get_fix_up_end(index));   }
+
+   static void readjust_end_node(index_type &index, node_base_type &end_node)
+   {
+      if(!index.empty()){
+         node_base_ptr &end_node_idx_ref = *(--index_traits::get_fix_up_end(index));
+         end_node_idx_ref = node_base_ptr_traits::pointer_to(end_node);
+         end_node.up      = node_base_ptr_ptr_traits::pointer_to(end_node_idx_ref);
+      }
+      else{
+         end_node.up = node_base_ptr_ptr();
+      }
+   }
+
+   static void initialize_end_node(index_type &index, node_base_type &end_node, const size_type index_capacity_if_empty)
+   {
+      if(index.empty()){
+         index.reserve(index_capacity_if_empty + ExtraPointers);
+         index.resize(ExtraPointers);
+         node_base_ptr &end_node_ref = *index.data();
+         end_node_ref = node_base_ptr_traits::pointer_to(end_node);
+         end_node.up = index_traits::ptr_to_node_base_ptr(end_node_ref);
+      }
+   }
+
+
+   #ifdef STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
+   static bool invariants(index_type &index)
+   {
+      for( index_iterator it = index.begin()
+         , it_end = index_traits::get_fix_up_end(index)
+         ; it != it_end
+         ; ++it){
+         if((*it)->up != index_traits::ptr_to_node_base_ptr(*it)){
+            return false;
+         }
+      }
+      return true;
+   }
+   #endif   //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 };
 
 } //namespace stable_vector_detail
 
 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
-#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
+   #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
 
-#define STABLE_VECTOR_CHECK_INVARIANT \
-invariant_checker BOOST_JOIN(check_invariant_,__LINE__)(*this); \
-BOOST_JOIN(check_invariant_,__LINE__).touch();
-#else
+   #define STABLE_VECTOR_CHECK_INVARIANT \
+   invariant_checker BOOST_JOIN(check_invariant_,__LINE__)(*this); \
+   BOOST_JOIN(check_invariant_,__LINE__).touch();
 
-#define STABLE_VECTOR_CHECK_INVARIANT
+   #else //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
 
-#endif   //#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
+   #define STABLE_VECTOR_CHECK_INVARIANT
+
+   #endif   //#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
 
 #endif   //#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
 /// @endcond
 
-//!Originally developed by Joaquin M. Lopez Munoz, stable_vector is std::vector
-//!drop-in replacement implemented as a node container, offering iterator and reference
-//!stability.
+//! Originally developed by Joaquin M. Lopez Munoz, stable_vector is a std::vector
+//! drop-in replacement implemented as a node container, offering iterator and reference
+//! stability.
 //!
-//!More details taken the author's blog: ( Introducing stable_vector)
+//! Here are the details taken from the author's blog
+//! (
+//! Introducing stable_vector):
 //!
-//!We present stable_vector, a fully STL-compliant stable container that provides
-//!most of the features of std::vector except element contiguity. 
+//! We present stable_vector, a fully STL-compliant stable container that provides
+//! most of the features of std::vector except element contiguity.
 //!
-//!General properties: stable_vector satisfies all the requirements of a container,
-//!a reversible container and a sequence and provides all the optional operations
-//!present in std::vector. Like std::vector,  iterators are random access.
-//!stable_vector does not provide element contiguity; in exchange for this absence,
-//!the container is stable, i.e. references and iterators to an element of a stable_vector
-//!remain valid as long as the element is not erased, and an iterator that has been
-//!assigned the return value of end() always remain valid until the destruction of
-//!the associated  stable_vector.
+//! General properties: stable_vector satisfies all the requirements of a container,
+//! a reversible container and a sequence and provides all the optional operations
+//! present in std::vector. Like std::vector, iterators are random access.
+//! stable_vector does not provide element contiguity; in exchange for this absence,
+//! the container is stable, i.e. references and iterators to an element of a stable_vector
+//! remain valid as long as the element is not erased, and an iterator that has been
+//! assigned the return value of end() always remain valid until the destruction of
+//! the associated  stable_vector.
 //!
-//!Operation complexity: The big-O complexities of stable_vector operations match
-//!exactly those of std::vector. In general, insertion/deletion is constant time at
-//!the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
-//!does not internally perform any value_type destruction, copy or assignment
-//!operations other than those exactly corresponding to the insertion of new
-//!elements or deletion of stored elements, which can sometimes compensate in terms
-//!of performance for the extra burden of doing more pointer manipulation and an
-//!additional allocation per element.
+//! Operation complexity: The big-O complexities of stable_vector operations match
+//! exactly those of std::vector. In general, insertion/deletion is constant time at
+//! the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector
+//! does not internally perform any value_type destruction, copy or assignment
+//! operations other than those exactly corresponding to the insertion of new
+//! elements or deletion of stored elements, which can sometimes compensate in terms
+//! of performance for the extra burden of doing more pointer manipulation and an
+//! additional allocation per element.
 //!
-//!Exception safety: As stable_vector does not internally copy elements around, some
-//!operations provide stronger exception safety guarantees than in std::vector:
+//! Exception safety: As stable_vector does not internally copy elements around, some
+//! operations provide stronger exception safety guarantees than in std::vector.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
 class stable_vector
 {
    ///@cond
-   typedef allocator_traits                        allocator_traits_type;
-   typedef typename container_detail::
-      move_const_ref_type::type                    insert_const_ref_type;
+   typedef allocator_traits                allocator_traits_type;
    typedef typename boost::intrusive::pointer_traits
       ::
          template rebind_pointer::type          void_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type             const_void_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type               void_ptr_ptr;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type         const_void_ptr_ptr;
-   typedef stable_vector_detail::node_type
-                                         node_type_t;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type            node_type_ptr_t;
-   typedef stable_vector_detail::node_type_base
-                                            node_type_base_t;
-   typedef typename boost::intrusive::pointer_traits
-      ::template
-         rebind_pointer::type       node_type_base_ptr_t;
-   typedef ::boost::container::vector::type>                         impl_type;
-   typedef typename impl_type::iterator               impl_iterator;
-   typedef typename impl_type::const_iterator         const_impl_iterator;
+   typedef typename allocator_traits_type::
+      template portable_rebind_alloc
+         ::type                                 void_allocator_type;
+   typedef stable_vector_detail::index_traits
+                       index_traits_type;
+   typedef typename index_traits_type::node_base_type node_base_type;
+   typedef typename index_traits_type::node_base_ptr  node_base_ptr;
+   typedef typename index_traits_type::
+      node_base_ptr_ptr                               node_base_ptr_ptr;
+   typedef typename index_traits_type::
+      node_base_ptr_traits                            node_base_ptr_traits;
+   typedef typename index_traits_type::
+      node_base_ptr_ptr_traits                        node_base_ptr_ptr_traits;
+   typedef typename index_traits_type::index_type     index_type;
+   typedef typename index_traits_type::index_iterator index_iterator;
+   typedef typename index_traits_type::
+      const_index_iterator                            const_index_iterator;
+   typedef boost::intrusive::
+      pointer_traits
+             ptr_traits;
+   typedef stable_vector_detail::node    node_type;
+   typedef typename ptr_traits::template
+      rebind_pointer::type                 node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                        node_ptr_traits;
+   typedef typename ptr_traits::template
+      rebind_pointer::type           const_node_ptr;
+   typedef boost::intrusive::
+      pointer_traits                  const_node_ptr_traits;
+   typedef typename node_ptr_traits::reference        node_reference;
+   typedef typename const_node_ptr_traits::reference  const_node_reference;
 
    typedef ::boost::container::container_detail::
       integral_constant                  allocator_v1;
    typedef ::boost::container::container_detail::
       integral_constant                  allocator_v2;
-   typedef ::boost::container::container_detail::integral_constant 
+   typedef ::boost::container::container_detail::integral_constant
       ::value>                              alloc_version;
+      version::value>                              alloc_version;
    typedef typename allocator_traits_type::
       template portable_rebind_alloc
-         ::type                          node_allocator_type;
+         ::type                            node_allocator_type;
 
-   node_type_ptr_t allocate_one()
-   {  return this->allocate_one(alloc_version());   }
+   typedef ::boost::container::container_detail::
+      allocator_version_traits                    allocator_version_traits_t;
+   typedef typename allocator_version_traits_t::multiallocation_chain  multiallocation_chain;
 
-   template
-   node_type_ptr_t allocate_one(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  return node_alloc().allocate(1);   }
+   node_ptr allocate_one()
+   {  return allocator_version_traits_t::allocate_one(this->priv_node_alloc());   }
 
-   template
-   node_type_ptr_t allocate_one(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  return node_alloc().allocate_one();   }
+   void deallocate_one(const node_ptr &p)
+   {  allocator_version_traits_t::deallocate_one(this->priv_node_alloc(), p);   }
 
-   void deallocate_one(node_type_ptr_t p)
-   {  return this->deallocate_one(p, alloc_version());   }
+   void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m)
+   {  allocator_version_traits_t::allocate_individual(this->priv_node_alloc(), n, m);   }
 
-   template
-   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  node_alloc().deallocate(p, 1);   }
-
-   template
-   void deallocate_one(node_type_ptr_t p, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {  node_alloc().deallocate_one(p);   }
+   void deallocate_individual(multiallocation_chain &holder)
+   {  allocator_version_traits_t::deallocate_individual(this->priv_node_alloc(), holder);   }
 
    friend class stable_vector_detail::clear_on_destroy;
+   typedef stable_vector_detail::iterator
+      < T
+      , typename allocator_traits::reference
+      , typename allocator_traits::pointer>              iterator_impl;
+   typedef stable_vector_detail::iterator
+      < T
+      , typename allocator_traits::const_reference
+      , typename allocator_traits::const_pointer>        const_iterator_impl;
    ///@endcond
    public:
 
-
-   // types:
-
-   typedef typename allocator_traits_type::reference              reference;
-   typedef typename allocator_traits_type::const_reference        const_reference;
-   typedef typename allocator_traits_type::pointer                pointer;
-   typedef typename allocator_traits_type::const_pointer          const_pointer;
-   typedef stable_vector_detail::iterator
-                                       iterator;
-   typedef stable_vector_detail::iterator
-                           const_iterator;
-   typedef typename impl_type::size_type              size_type;
-   typedef typename iterator::difference_type         difference_type;
-   typedef T                                          value_type;
-   typedef A                                          allocator_type;
-   typedef std::reverse_iterator            reverse_iterator;
-   typedef std::reverse_iterator      const_reverse_iterator;
-   typedef node_allocator_type                        stored_allocator_type;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef node_allocator_type                                                         stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                       iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                                 const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    ///@cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(stable_vector)
-   static const size_type ExtraPointers = 3;
-   //This container stores metadata at the end of the void_ptr vector with additional 3 pointers:
-   //    back() is impl.back() - ExtraPointers;
-   //    end node index is impl.end()[-3]
-   //    Node cache first is impl.end()[-2];
-   //    Node cache last is  *impl.back();
+   static const size_type ExtraPointers = index_traits_type::ExtraPointers;
 
-   typedef typename stable_vector_detail::
-      select_multiallocation_chain
-      < node_allocator_type
-      , alloc_version::value
-      >::type                                         multiallocation_chain;
+   class insert_rollback;
+   friend class insert_rollback;
+
+   class push_back_rollback;
+   friend class push_back_rollback;
    ///@endcond
+
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Default constructs a stable_vector.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    stable_vector()
-      : internal_data(), impl()
+      : internal_data(), index()
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
 
    //! Effects: Constructs a stable_vector taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   explicit stable_vector(const A& al)
-      : internal_data(al),impl(al)
+   explicit stable_vector(const allocator_type& al) BOOST_CONTAINER_NOEXCEPT
+      : internal_data(al), index(al)
    {
       STABLE_VECTOR_CHECK_INVARIANT;
    }
@@ -535,10 +566,10 @@ class stable_vector
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit stable_vector(size_type n)
-      : internal_data(A()),impl(A())
+      : internal_data(), index()
    {
       stable_vector_detail::clear_on_destroy cod(*this);
       this->resize(n);
@@ -551,13 +582,13 @@ class stable_vector
    //!
    //! Throws: If allocator_type's default constructor or copy constructor
    //!   throws or T's default or copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   stable_vector(size_type n, const T& t, const A& al=A())
-      : internal_data(al),impl(al)
+   stable_vector(size_type n, const T& t, const allocator_type& al = allocator_type())
+      : internal_data(al), index(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), n, t);
+      this->insert(this->cend(), n, t);
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -570,11 +601,11 @@ class stable_vector
    //!
    //! Complexity: Linear to the range [first, last).
    template 
-   stable_vector(InputIterator first,InputIterator last,const A& al=A())
-      : internal_data(al),impl(al)
+   stable_vector(InputIterator first,InputIterator last, const allocator_type& al = allocator_type())
+      : internal_data(al), index(al)
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), first, last);
+      this->insert(this->cend(), first, last);
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -582,16 +613,16 @@ class stable_vector
    //! Effects: Copy constructs a stable_vector.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    stable_vector(const stable_vector& x)
       : internal_data(allocator_traits::
-         select_on_container_copy_construction(x.node_alloc()))
-      , impl(allocator_traits::
-         select_on_container_copy_construction(x.impl.get_stored_allocator()))
+         select_on_container_copy_construction(x.priv_node_alloc()))
+      , index(allocator_traits::
+         select_on_container_copy_construction(x.index.get_stored_allocator()))
    {
       stable_vector_detail::clear_on_destroy cod(*this);
-      this->insert(this->cbegin(), x.begin(), x.end());
+      this->insert(this->cend(), x.begin(), x.end());
       STABLE_VECTOR_CHECK_INVARIANT;
       cod.release();
    }
@@ -599,14 +630,48 @@ class stable_vector
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    stable_vector(BOOST_RV_REF(stable_vector) x)
-      : internal_data(boost::move(x.node_alloc())), impl(boost::move(x.impl))
+      : internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index))
    {
       this->priv_swap_members(x);
    }
 
+   //! Effects: Copy constructs a stable_vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   stable_vector(const stable_vector& x, const allocator_type &a)
+      : internal_data(a), index(a)
+   {
+      stable_vector_detail::clear_on_destroy cod(*this);
+      this->insert(this->cend(), x.begin(), x.end());
+      STABLE_VECTOR_CHECK_INVARIANT;
+      cod.release();
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this.
+   //!
+   //! Throws: If allocator_type's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == x.get_allocator(), linear otherwise
+   stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a)
+      : internal_data(a), index(a)
+   {
+      if(this->priv_node_alloc() == x.priv_node_alloc()){
+         this->priv_swap_members(x);
+      }
+      else{
+         stable_vector_detail::clear_on_destroy cod(*this);
+         this->insert(this->cend(), x.begin(), x.end());
+         STABLE_VECTOR_CHECK_INVARIANT;
+         cod.release();
+      }
+   }
+
    //! Effects: Destroys the stable_vector. All stored values are destroyed
    //!   and used memory is deallocated.
    //!
@@ -616,13 +681,13 @@ class stable_vector
    ~stable_vector()
    {
       this->clear();
-      clear_pool();  
+      this->priv_clear_pool(); 
    }
 
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy constructor throws.
    //!
@@ -631,16 +696,16 @@ class stable_vector
    {
       STABLE_VECTOR_CHECK_INVARIANT;
       if (&x != this){
-         node_allocator_type &this_alloc     = this->node_alloc();
-         const node_allocator_type &x_alloc  = x.node_alloc();
+         node_allocator_type &this_alloc     = this->priv_node_alloc();
+         const node_allocator_type &x_alloc  = x.priv_node_alloc();
          container_detail::bool_ flag;
          if(flag && this_alloc != x_alloc){
             this->clear();
             this->shrink_to_fit();
          }
-         container_detail::assign_alloc(this->node_alloc(), x.node_alloc(), flag);
-         container_detail::assign_alloc(this->impl.get_stored_allocator(), x.impl.get_stored_allocator(), flag);
+         container_detail::assign_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
+         container_detail::assign_alloc(this->index.get_stored_allocator(), x.index.get_stored_allocator(), flag);
          this->assign(x.begin(), x.end());
       }
       return *this;
@@ -657,22 +722,21 @@ class stable_vector
    stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
    {
       if (&x != this){
-         node_allocator_type &this_alloc = this->node_alloc();
-         node_allocator_type &x_alloc    = x.node_alloc();
+         node_allocator_type &this_alloc = this->priv_node_alloc();
+         node_allocator_type &x_alloc    = x.priv_node_alloc();
          //If allocators are equal we can just swap pointers
          if(this_alloc == x_alloc){
             //Destroy objects but retain memory
             this->clear();
-            this->impl = boost::move(x.impl);
+            this->index = boost::move(x.index);
             this->priv_swap_members(x);
             //Move allocator if needed
             container_detail::bool_ flag;
-            container_detail::move_alloc(this->node_alloc(), x.node_alloc(), flag);
+            container_detail::move_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
          }
          //If unequal allocators, then do a one by one move
          else{
-            typedef typename std::iterator_traits::iterator_category ItCat;
             this->assign( boost::make_move_iterator(x.begin())
                         , boost::make_move_iterator(x.end()));
          }
@@ -680,6 +744,18 @@ class stable_vector
       return *this;
    }
 
+
+   //! Effects: Assigns the n copies of val to *this.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   void assign(size_type n, const T& t)
+   {
+      typedef constant_iterator cvalue_iterator;
+      this->assign(cvalue_iterator(t, n), cvalue_iterator());
+   }
+
    //! Effects: Assigns the the range [first, last) to *this.
    //!
    //! Throws: If memory allocation throws or
@@ -687,200 +763,196 @@ class stable_vector
    //!
    //! Complexity: Linear to n.
    template
-   void assign(InputIterator first,InputIterator last)
+   void assign(InputIterator first,InputIterator last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      assign_dispatch(first, last, boost::is_integral());
-   }
-
-
-   //! Effects: Assigns the n copies of val to *this.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void assign(size_type n,const T& t)
-   {
-      typedef constant_iterator cvalue_iterator;
-      return assign_dispatch(cvalue_iterator(t, n), cvalue_iterator(), boost::mpl::false_());
+      STABLE_VECTOR_CHECK_INVARIANT;
+      iterator first1   = this->begin();
+      iterator last1    = this->end();
+      for ( ; first1 != last1 && first != last; ++first1, ++first)
+         *first1 = *first;
+      if (first == last){
+         this->erase(first1, last1);
+      }
+      else{
+         this->insert(last1, first, last);
+      }
    }
 
    //! Effects: Returns a copy of the internal allocator.
-   //! 
+   //!
    //! Throws: If allocator's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator()const  {return node_alloc();}
+   allocator_type get_allocator() const
+   {  return this->priv_node_alloc();  }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return node_alloc(); }
+   {  return this->priv_node_alloc(); }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return node_alloc(); }
+   {  return this->priv_node_alloc(); }
 
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns an iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator  begin()
-   {   return (impl.empty()) ? end(): iterator(node_ptr_cast(impl.front())) ;   }
+   iterator  begin() BOOST_CONTAINER_NOEXCEPT
+   {   return (this->index.empty()) ? this->end(): iterator(node_ptr_traits::static_cast_from(this->index.front())); }
 
    //! Effects: Returns a const_iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator  begin()const
-   {   return (impl.empty()) ? cend() : const_iterator(node_ptr_cast(impl.front())) ;   }
+   const_iterator  begin() const BOOST_CONTAINER_NOEXCEPT
+   {   return (this->index.empty()) ? this->cend() : const_iterator(node_ptr_traits::static_cast_from(this->index.front())) ;   }
 
    //! Effects: Returns an iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   iterator        end()                {return iterator(get_end_node());}
+   iterator        end() BOOST_CONTAINER_NOEXCEPT
+   {  return iterator(this->priv_get_end_node());  }
 
    //! Effects: Returns a const_iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator  end()const           {return const_iterator(get_end_node());}
+   const_iterator  end() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_iterator(this->priv_get_end_node());  }
 
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator       rbegin()      {return reverse_iterator(this->end());}
+   reverse_iterator       rbegin() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(this->end());  }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rbegin()const {return const_reverse_iterator(this->end());}
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->end());  }
 
    //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reverse_iterator       rend()        {return reverse_iterator(this->begin());}
+   reverse_iterator       rend() BOOST_CONTAINER_NOEXCEPT
+   {  return reverse_iterator(this->begin());   }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator rend()const   {return const_reverse_iterator(this->begin());}
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   {  return const_reverse_iterator(this->begin());   }
 
    //! Effects: Returns a const_iterator to the first element contained in the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator         cbegin()const {return this->begin();}
+   const_iterator         cbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->begin();   }
 
    //! Effects: Returns a const_iterator to the end of the stable_vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_iterator         cend()const   {return this->end();}
+   const_iterator         cend() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->end();  }
 
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed stable_vector. 
-   //! 
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crbegin()const{return this->rbegin();}
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->rbegin();  }
 
    //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed stable_vector. 
-   //! 
+   //! of the reversed stable_vector.
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reverse_iterator crend()const  {return this->rend();}
+   const_reverse_iterator crend()const BOOST_CONTAINER_NOEXCEPT
+   {  return this->rend(); }
 
-   //! Effects: Returns the number of the elements contained in the stable_vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const
-   {  return impl.empty() ? 0 : (impl.size() - ExtraPointers);   }
-
-   //! Effects: Returns the largest possible size of the stable_vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const
-   {  return impl.max_size() - ExtraPointers;  }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const
-   {
-      if(!impl.capacity()){
-         return 0;
-      }
-      else{
-         const size_type num_nodes = this->impl.size() + this->internal_data.pool_size;
-         const size_type num_buck  = this->impl.capacity();
-         return (num_nodes < num_buck) ? num_nodes : num_buck;
-      }
-   }
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Returns true if the stable_vector contains no elements.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   bool empty() const
-   {  return impl.empty() || impl.size() == ExtraPointers;  }
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->index.size() <= ExtraPointers;  }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   //! Effects: Returns the number of the elements contained in the stable_vector.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type n, const T& t)
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      if(n > size())
-         this->insert(this->cend(), n - this->size(), t);
-      else if(n < this->size())
-         this->erase(this->cbegin() + n, this->cend());
+      const size_type index_size = this->index.size();
+      return index_size ? (index_size - ExtraPointers) : 0;
    }
 
+   //! Effects: Returns the largest possible size of the stable_vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->index.max_size() - ExtraPointers;  }
+
    //! Effects: Inserts or erases elements at the end such that
    //!   the size becomes n. New elements are default constructed.
    //!
@@ -891,17 +963,49 @@ class stable_vector
    {
       typedef default_construct_iterator default_iterator;
       STABLE_VECTOR_CHECK_INVARIANT;
-      if(n > size())
+      if(n > this->size())
          this->insert(this->cend(), default_iterator(n - this->size()), default_iterator());
       else if(n < this->size())
          this->erase(this->cbegin() + n, this->cend());
    }
 
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type n, const T& t)
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      if(n > this->size())
+         this->insert(this->cend(), n - this->size(), t);
+      else if(n < this->size())
+         this->erase(this->cbegin() + n, this->cend());
+   }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   {
+      const size_type index_size             = this->index.size();
+      BOOST_ASSERT(!index_size || index_size >= ExtraPointers);
+      const size_type bucket_extra_capacity = this->index.capacity()- index_size;
+      const size_type node_extra_capacity   = this->internal_data.pool_size;
+      const size_type extra_capacity        = (bucket_extra_capacity < node_extra_capacity)
+         ? bucket_extra_capacity : node_extra_capacity;
+      return (index_size ? (index_size - ExtraPointers + extra_capacity) : index_size);
+   }
+
    //! Effects: If n is less than or equal to capacity(), this call has no
    //!   effect. Otherwise, it is a request for allocation of additional memory.
    //!   If the request is successful, then capacity() is greater than or equal to
    //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
+   //!
    //! Throws: If memory allocation allocation throws.
    void reserve(size_type n)
    {
@@ -909,221 +1013,161 @@ class stable_vector
       if(n > this->max_size())
          throw std::bad_alloc();
 
-      size_type size = this->size();   
+      size_type sz         = this->size();  
       size_type old_capacity = this->capacity();
       if(n > old_capacity){
-         this->initialize_end_node(n);
-         const void * old_ptr = &impl[0];
-         impl.reserve(n + ExtraPointers);
-         bool realloced = &impl[0] != old_ptr;
+         index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, n);
+         const void * old_ptr = &index[0];
+         this->index.reserve(n + ExtraPointers);
+         bool realloced = &index[0] != old_ptr;
          //Fix the pointers for the newly allocated buffer
          if(realloced){
-            this->align_nodes(impl.begin(), impl.begin()+size+1);
+            index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
          }
          //Now fill pool if data is not enough
-         if((n - size) > this->internal_data.pool_size){
-            this->add_to_pool((n - size) - this->internal_data.pool_size);
+         if((n - sz) > this->internal_data.pool_size){
+            this->priv_increase_pool((n - sz) - this->internal_data.pool_size);
          }
       }
    }
 
-   //! Requires: size() > n.
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the stable_vector is unchanged
    //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n){return value(impl[n]);}
-
-   //! Requires: size() > n.
+   //! Throws: If memory allocation throws.
    //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n)const{return value(impl[n]);}
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n)
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
    {
-      if(n>=size())
-         throw std::out_of_range("invalid subscript at stable_vector::at");
-      return operator[](n);
+      if(this->capacity()){
+         //First empty allocated node pool
+         this->priv_clear_pool();
+         //If empty completely destroy the index, let's recover default-constructed state
+         if(this->empty()){
+            this->index.clear();
+            this->index.shrink_to_fit();
+            this->internal_data.end_node.up = node_base_ptr_ptr();
+         }
+         //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
+         else{
+            const void* old_ptr = &index[0];
+            this->index.shrink_to_fit();
+            bool realloced = &index[0] != old_ptr;
+            //Fix the pointers for the newly allocated buffer
+            if(realloced){
+               index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
+            }
+         }
+      }
    }
 
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n)const
-   {
-      if(n>=size())
-         throw std::out_of_range("invalid subscript at stable_vector::at");
-      return operator[](n);
-   }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a reference to the first
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference front()
-   {  return value(impl.front());   }
+   reference front() BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index.front()).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a const reference to the first
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference front()const
-   {  return value(impl.front());   }
+   const_reference front() const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index.front()).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a reference to the last
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference back()
-   {  return value(*(&impl.back() - ExtraPointers)); }
+   reference back() BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[this->size() - ExtraPointers]).value;  }
 
    //! Requires: !empty()
    //!
    //! Effects: Returns a const reference to the last
    //!   element of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference back()const
-   {  return value(*(&impl.back() - ExtraPointers)); }
+   const_reference back() const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[this->size() - ExtraPointers]).value;  }
 
-   //! Effects: Inserts a copy of x at the end of the stable_vector.
+   //! Requires: size() > n.
    //!
-   //! Throws: If memory allocation throws or
-   //!   T's copy constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(insert_const_ref_type x) 
-   {  return priv_push_back(x);  }
-
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   void push_back(T &x) { push_back(const_cast(x)); }
-
-   template
-   void push_back(const U &u, typename container_detail::enable_if_c
-                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   { return priv_push_back(u); }
-   #endif
-
-   //! Effects: Constructs a new element in the end of the stable_vector
-   //!   and moves the resources of mx to this new element.
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Amortized constant time.
-   void push_back(BOOST_RV_REF(T) t) 
-   {  this->insert(end(), boost::move(t));  }
-
-   //! Effects: Removes the last element from the stable_vector.
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Constant time.
-   void pop_back()
-   {  this->erase(this->end()-1);   }
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[n]).value;  }
 
-   //! Requires: position must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert a copy of x before position.
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, insert_const_ref_type x) 
-   {  return this->priv_insert(position, x); }
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+   {  return static_cast(*this->index[n]).value;   }
 
-   #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); }
-
-   template
-   iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c
-                  ::value && !::boost::has_move_emulation_enabled::value >::type* =0)
-   {  return this->priv_insert(position, u); }
-   #endif
-
-   //! Requires: position must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert a new element before position with mx's resources.
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws.
+   //! Throws: std::range_error if n >= size()
    //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   iterator insert(const_iterator position, BOOST_RV_REF(T) x) 
+   //! Complexity: Constant.
+   reference at(size_type n)
    {
-      typedef repeat_iterator           repeat_it;
-      typedef boost::move_iterator repeat_move_it;
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position
-         ,repeat_move_it(repeat_it(x, 1))
-         ,repeat_move_it(repeat_it()));
-      return iterator(this->begin() + pos_n);
+      if(n>=this->size())
+         throw std::out_of_range("invalid subscript at stable_vector::at");
+      return operator[](n);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
+   //! Requires: size() > n.
    //!
-   //! Effects: Insert n copies of x before pos.
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
    //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //! Throws: std::range_error if n >= size()
    //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator position, size_type n, const T& t)
+   //! Complexity: Constant.
+   const_reference at(size_type n)const
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      this->insert_not_iter(position, n, t);
+      if(n>=this->size())
+         throw std::out_of_range("invalid subscript at stable_vector::at");
+      return operator[](n);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert a copy of the [first, last) range before pos.
-   //!
-   //! Throws: If memory allocation throws, T's constructor from a
-   //!   dereferenced InpIt throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to std::distance [first, last).
-   template 
-   void insert(const_iterator position,InputIterator first, InputIterator last)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      this->insert_iter(position,first,last,
-                        boost::mpl::not_ >());
-   }
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
 
    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -1137,7 +1181,7 @@ class stable_vector
    void emplace_back(Args &&...args)
    {
       typedef emplace_functor         EmplaceFunctor;
-      typedef emplace_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
    }
@@ -1157,7 +1201,7 @@ class stable_vector
       //Just call more general insert(pos, size, value) and return iterator
       size_type pos_n = position - cbegin();
       typedef emplace_functor         EmplaceFunctor;
-      typedef emplace_iterator EmplaceIterator;
+      typedef emplace_iterator EmplaceIterator;
       EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...);
       this->insert(position, EmplaceIterator(ef), EmplaceIterator());
       return iterator(this->begin() + pos_n);
@@ -1172,7 +1216,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1186,7 +1230,7 @@ class stable_vector
       typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg)                               \
          BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >)               \
             EmplaceFunctor;                                                                     \
-      typedef emplace_iterator  EmplaceIterator;  \
+      typedef emplace_iterator  EmplaceIterator;   \
       EmplaceFunctor ef BOOST_PP_LPAREN_IF(n)                                                   \
                         BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)                   \
                         BOOST_PP_RPAREN_IF(n);                                                  \
@@ -1200,21 +1244,162 @@ class stable_vector
 
    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts a copy of x at the end of the stable_vector.
+   //!
+   //! Throws: If memory allocation throws or
+   //!   T's copy constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(const T &x);
+
+   //! Effects: Constructs a new element in the end of the stable_vector
+   //!   and moves the resources of mx to this new element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: Amortized constant time.
+   void push_back(T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+   #endif
+
+   #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of x before position.
+   //!
+   //! Returns: An iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws or x's copy constructor throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, const T &x);
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a new element before position with mx's resources.
+   //!
+   //! Returns: an iterator to the inserted element.
+   //!
+   //! Throws: If memory allocation throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   iterator insert(const_iterator position, T &&x);
+   #else
+   BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+   #endif
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before position.
+   //!
+   //! Returns: an iterator to the first inserted element or position if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator position, size_type n, const T& t)
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      typedef constant_iterator cvalue_iterator;
+      return this->insert(position, cvalue_iterator(t, n), cvalue_iterator());
+   }
+
+   //! Requires: pos must be a valid iterator of *this.
+   //!
+   //! Effects: Insert a copy of the [first, last) range before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or position if first == last.
+   //!
+   //! Throws: If memory allocation throws, T's constructor from a
+   //!   dereferenced InpIt throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to std::distance [first, last).
+   template 
+   iterator insert(const_iterator position, InputIterator first, InputIterator last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      const size_type pos_n = position - this->cbegin();
+      for(; first != last; ++first){
+         this->emplace(position, *first);
+      }
+      return this->begin() + pos_n;
+   }
+
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator position, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type num_new = static_cast(std::distance(first, last));
+      const size_type pos     = static_cast(position - this->cbegin());
+      if(num_new){
+         //Fills the node pool and inserts num_new null pointers in pos.
+         //If a new buffer was needed fixes up pointers up to pos so
+         //past-new nodes are not aligned until the end of this function
+         //or in a rollback in case of exception
+         index_iterator it_past_newly_constructed(this->priv_insert_forward_non_templated(pos, num_new));
+         const index_iterator it_past_new(it_past_newly_constructed + num_new);
+         {
+            //Prepare rollback
+            insert_rollback rollback(*this, it_past_newly_constructed, it_past_new);
+            while(first != last){
+               const node_ptr p = this->priv_get_from_pool();
+               BOOST_ASSERT(!!p);
+               //Put it in the index so rollback can return it in pool if construct_in_place throws
+               *it_past_newly_constructed = p;
+               //Constructs and fixes up pointers This can throw
+               this->priv_build_node_from_it(p, it_past_newly_constructed, first);
+               ++first;
+               ++it_past_newly_constructed;
+            }
+            //rollback.~insert_rollback() called in case of exception
+         }
+         //Fix up pointers for past-new nodes (new nodes were fixed during construction) and
+         //nodes before insertion position in priv_insert_forward_non_templated(...)
+         index_traits_type::fix_up_pointers_from(this->index, it_past_newly_constructed);
+      }
+      return this->begin() + pos;
+   }
+   #endif
+
+   //! Effects: Removes the last element from the stable_vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant time.
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
+   {  this->erase(--this->cend());   }
+
    //! Effects: Erases the element at position pos.
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element. Constant if pos is the last element.
-   iterator erase(const_iterator position)
+   iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT
    {
       STABLE_VECTOR_CHECK_INVARIANT;
-      difference_type d = position - this->cbegin();
-      impl_iterator   it = impl.begin() + d;
-      this->delete_node(*it);
-      it = impl.erase(it);
-      this->align_nodes(it, get_last_align());
-      return this->begin()+d;
+      const size_type d = position - this->cbegin();
+      index_iterator it = this->index.begin() + d;
+      this->priv_delete_node(position.node_pointer());
+      it = this->index.erase(it);
+      index_traits_type::fix_up_pointers_from(this->index, it);
+      return iterator(node_ptr_traits::static_cast_from(*it));
    }
 
    //! Effects: Erases the elements pointed by [first, last).
@@ -1223,8 +1408,31 @@ class stable_vector
    //!
    //! Complexity: Linear to the distance between first and last
    //!   plus linear to the elements between pos and the last element.
-   iterator erase(const_iterator first, const_iterator last)
-   {   return priv_erase(first, last, alloc_version());  }
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
+   {
+      STABLE_VECTOR_CHECK_INVARIANT;
+      const const_iterator cbeg(this->cbegin());
+      const size_type d1 = static_cast(first - cbeg),
+                      d2 = static_cast(last  - cbeg);
+      size_type d_dif = d2 - d1;
+      if(d_dif){
+         multiallocation_chain holder;
+         const index_iterator it1(this->index.begin() + d1);
+         const index_iterator it2(it1 + d_dif);
+         index_iterator it(it1);
+         while(d_dif--){
+            node_base_ptr &nb = *it;
+            ++it;
+            node_type &n = *node_ptr_traits::static_cast_from(nb);
+            this->priv_destroy_node(n);
+            holder.push_back(node_ptr_traits::pointer_to(n));
+         }
+         this->priv_put_in_pool(holder);
+         const index_iterator e = this->index.erase(it1, it2);
+         index_traits_type::fix_up_pointers_from(this->index, e);
+      }
+      return iterator(last.node_pointer());
+   }
 
    //! Effects: Swaps the contents of *this and x.
    //!
@@ -1235,9 +1443,9 @@ class stable_vector
    {
       STABLE_VECTOR_CHECK_INVARIANT;
       container_detail::bool_ flag;
-      container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
+      container_detail::swap_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag);
       //vector's allocator is swapped here
-      this->impl.swap(x.impl);
+      this->index.swap(x.index);
       this->priv_swap_members(x);
    }
 
@@ -1246,453 +1454,292 @@ class stable_vector
    //! Throws: Nothing.
    //!
    //! Complexity: Linear to the number of elements in the stable_vector.
-   void clear()
+   void clear() BOOST_CONTAINER_NOEXCEPT
    {   this->erase(this->cbegin(),this->cend()); }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the stable_vector is unchanged
-   //!
-   //! Throws: If memory allocation throws.
-   //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
+   /// @cond
+
+   private:
+
+   class insert_rollback
    {
-      if(this->capacity()){
-         //First empty allocated node pool
-         this->clear_pool();
-         //If empty completely destroy the index, let's recover default-constructed state
-         if(this->empty()){
-            this->impl.clear();
-            this->impl.shrink_to_fit();
-            this->internal_data.set_end_pointer_to_default_constructed();
-         }
-         //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
-         else{
-            const size_type size = this->size();
-            const void* old_ptr = &impl[0];
-            this->impl.shrink_to_fit();
-            bool realloced = &impl[0] != old_ptr;
-            //Fix the pointers for the newly allocated buffer
-            if(realloced){
-               this->align_nodes(impl.begin(), impl.begin()+size+1);
-            }
+      public:
+
+      insert_rollback(stable_vector &sv, index_iterator &it_past_constructed, const index_iterator &it_past_new)
+         : m_sv(sv), m_it_past_constructed(it_past_constructed), m_it_past_new(it_past_new)
+      {}
+
+      ~insert_rollback()
+      {
+         if(m_it_past_constructed != m_it_past_new){
+            m_sv.priv_put_in_pool(node_ptr_traits::static_cast_from(*m_it_past_constructed));
+            index_iterator e = m_sv.index.erase(m_it_past_constructed, m_it_past_new);
+            index_traits_type::fix_up_pointers_from(m_sv.index, e);
          }
       }
+
+      private:
+      stable_vector &m_sv;
+      index_iterator &m_it_past_constructed;
+      const index_iterator &m_it_past_new;
+   };
+
+   class push_back_rollback
+   {
+      public:
+      push_back_rollback(stable_vector &sv, const node_ptr &p)
+         : m_sv(sv), m_p(p)
+      {}
+
+      ~push_back_rollback()
+      {
+         if(m_p){
+            m_sv.priv_put_in_pool(m_p);
+         }
+      }
+
+      void release()
+      {  m_p = node_ptr();  }
+
+      private:
+      stable_vector &m_sv;
+      node_ptr m_p;
+   };
+
+   index_iterator priv_insert_forward_non_templated(size_type pos, size_type num_new)
+   {
+      index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, num_new);
+
+      //Now try to fill the pool with new data
+      if(this->internal_data.pool_size < num_new){
+         this->priv_increase_pool(num_new - this->internal_data.pool_size);
+      }
+
+      //Now try to make room in the vector
+      const node_base_ptr_ptr old_buffer = this->index.data();
+      this->index.insert(this->index.begin() + pos, num_new, node_ptr());
+      bool new_buffer = this->index.data() != old_buffer;
+
+      //Fix the pointers for the newly allocated buffer
+      const index_iterator index_beg = this->index.begin();
+      if(new_buffer){
+         index_traits_type::fix_up_pointers(index_beg, index_beg + pos);
+      }
+      return index_beg + pos;
    }
 
-   /// @cond
+   bool priv_capacity_bigger_than_size() const
+   {
+      return this->index.capacity() > this->index.size() &&
+             this->internal_data.pool_size > 0;
+   }
+
+   template 
+   void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
+   {
+      if(this->priv_capacity_bigger_than_size()){
+         //Enough memory in the pool and in the index
+         const node_ptr p = this->priv_get_from_pool();
+         BOOST_ASSERT(!!p);
+         {
+            push_back_rollback rollback(*this, p);
+            //This might throw
+            this->priv_build_node_from_convertible(p, ::boost::forward(x));
+            rollback.release();
+         }
+         //This can't throw as there is room for a new elements in the index
+         index_iterator new_index = this->index.insert(this->index.end() - ExtraPointers, p);
+         index_traits_type::fix_up_pointers_from(this->index, new_index);
+      }
+      else{
+         this->insert(this->cend(), ::boost::forward(x));
+      }
+   }
 
    iterator priv_insert(const_iterator position, const value_type &t)
    {
       typedef constant_iterator cvalue_iterator;
-      return this->insert_iter(position, cvalue_iterator(t, 1), cvalue_iterator(), std::forward_iterator_tag());
+      return this->insert(position, cvalue_iterator(t, 1), cvalue_iterator());
    }
 
-   void priv_push_back(const value_type &t)
-   {  this->insert(end(), t);  }
-
-   template
-   void clear_pool(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
+   iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
    {
-      if(!impl.empty() && impl.back()){
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
+      typedef repeat_iterator  repeat_it;
+      typedef boost::move_iterator      repeat_move_it;
+      //Just call more general insert(pos, size, value) and return iterator
+      return this->insert(position, repeat_move_it(repeat_it(x, 1)), repeat_move_it(repeat_it()));
+   }
+
+   void priv_clear_pool()
+   {
+      if(!this->index.empty() && this->index.back()){
+         node_base_ptr &pool_first_ref = *(this->index.end() - 2);
+         node_base_ptr &pool_last_ref  = this->index.back();
 
          multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, this->internal_data.pool_size);
-         while(!holder.empty()){
-            node_type_ptr_t n = holder.front();
-            holder.pop_front();
-            this->deallocate_one(n);
-         }
+         holder.incorporate_after( holder.before_begin()
+                                 , node_ptr_traits::static_cast_from(pool_first_ref)
+                                 , node_ptr_traits::static_cast_from(pool_last_ref)
+                                 , internal_data.pool_size);
+         this->deallocate_individual(holder);
          pool_first_ref = pool_last_ref = 0;
          this->internal_data.pool_size = 0;
       }
    }
 
-   template
-   void clear_pool(AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
+   void priv_increase_pool(size_type n)
    {
-      if(!impl.empty() && impl.back()){
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
-         multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-         node_alloc().deallocate_individual(boost::move(holder));
-         pool_first_ref = pool_last_ref = 0;
-         this->internal_data.pool_size = 0;
-      }
-   }
-
-   void clear_pool()
-   {
-      this->clear_pool(alloc_version());
-   }
-
-   void add_to_pool(size_type n)
-   {
-      this->add_to_pool(n, alloc_version());
-   }
-
-   template
-   void add_to_pool(size_type n, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      size_type remaining = n;
-      while(remaining--){
-         this->put_in_pool(this->allocate_one());
-      }
-   }
-
-   template
-   void add_to_pool(size_type n, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      void_ptr &pool_first_ref = impl.end()[-2];
-      void_ptr &pool_last_ref = impl.back();
+      node_base_ptr &pool_first_ref = *(this->index.end() - 2);
+      node_base_ptr &pool_last_ref  = this->index.back();
       multiallocation_chain holder;
-      holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-      //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled::value == true));
-      multiallocation_chain m (node_alloc().allocate_individual(n));
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      multiallocation_chain m;
+      this->allocate_individual(n, m);
       holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n);
       this->internal_data.pool_size += n;
-      std::pair data(holder.extract_data());
+      std::pair data(holder.extract_data());
       pool_first_ref = data.first;
       pool_last_ref = data.second;
    }
 
-   void put_in_pool(node_type_ptr_t p)
+   void priv_put_in_pool(const node_ptr &p)
    {
-      void_ptr &pool_first_ref = impl.end()[-2];
-      void_ptr &pool_last_ref = impl.back();
+      node_base_ptr &pool_first_ref = *(this->index.end()-2);
+      node_base_ptr &pool_last_ref  = this->index.back();
       multiallocation_chain holder;
-      holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
       holder.push_front(p);
       ++this->internal_data.pool_size;
-      std::pair ret(holder.extract_data());
+      std::pair ret(holder.extract_data());
       pool_first_ref = ret.first;
-      pool_last_ref = ret.second;
+      pool_last_ref  = ret.second;
    }
 
-   node_type_ptr_t get_from_pool()
+   void priv_put_in_pool(multiallocation_chain &ch)
    {
-      if(!impl.back()){
-         return node_type_ptr_t(0);
+      node_base_ptr &pool_first_ref = *(this->index.end()-(ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = this->index.back();
+      ch.incorporate_after( ch.before_begin()
+                          , node_ptr_traits::static_cast_from(pool_first_ref)
+                          , node_ptr_traits::static_cast_from(pool_last_ref)
+                          , internal_data.pool_size);
+      this->internal_data.pool_size = ch.size();
+      const std::pair ret(ch.extract_data());
+      pool_first_ref = ret.first;
+      pool_last_ref  = ret.second;
+   }
+
+   node_ptr priv_get_from_pool()
+   {
+      //Precondition: index is not empty
+      BOOST_ASSERT(!this->index.empty());
+      node_base_ptr &pool_first_ref = *(this->index.end() - (ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = this->index.back();
+      multiallocation_chain holder;
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      node_ptr ret = holder.pop_front();
+      --this->internal_data.pool_size;
+      if(!internal_data.pool_size){
+         pool_first_ref = pool_last_ref = node_ptr();
       }
       else{
-         void_ptr &pool_first_ref = impl.end()[-2];
-         void_ptr &pool_last_ref = impl.back();
-         multiallocation_chain holder;
-         holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
-         node_type_ptr_t ret = holder.front();
-         holder.pop_front();
-         --this->internal_data.pool_size;
-         if(!internal_data.pool_size){
-            pool_first_ref = pool_last_ref = void_ptr(0);
-         }
-         else{
-            std::pair data(holder.extract_data());
-            pool_first_ref = data.first;
-            pool_last_ref = data.second;
-         }
-         return ret;
+         const std::pair data(holder.extract_data());
+         pool_first_ref = data.first;
+         pool_last_ref  = data.second;
       }
+      return ret;
    }
 
-   void insert_iter_prolog(size_type n, difference_type d)
+   node_ptr priv_get_end_node() const
    {
-      initialize_end_node(n);
-      const void* old_ptr = &impl[0];
-      //size_type old_capacity = capacity();
-      //size_type old_size = size();
-      impl.insert(impl.begin()+d, n, 0);
-      bool realloced = &impl[0] != old_ptr;
-      //Fix the pointers for the newly allocated buffer
-      if(realloced){
-         align_nodes(impl.begin(), impl.begin()+d);
-      }
+      return node_ptr_traits::pointer_to
+         (static_cast(const_cast(this->internal_data.end_node)));
    }
 
-   template
-   void assign_dispatch(InputIterator first, InputIterator last, boost::mpl::false_)
+   void priv_destroy_node(const node_type &n)
    {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      iterator first1   = this->begin();
-      iterator last1    = this->end();
-      for ( ; first1 != last1 && first != last; ++first1, ++first)
-         *first1 = *first;
-      if (first == last){
-         this->erase(first1, last1);
-      }
-      else{
-         this->insert(last1, first, last);
-      }
-   }
-
-   template
-   void assign_dispatch(Integer n, Integer t, boost::mpl::true_)
-   {
-      typedef constant_iterator cvalue_iterator;
-      this->assign_dispatch(cvalue_iterator(t, n), cvalue_iterator(), boost::mpl::false_());
-   }
-
-   iterator priv_erase(const_iterator first, const_iterator last, allocator_v1)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      difference_type d1 = first - this->cbegin(), d2 = last - this->cbegin();
-      if(d1 != d2){
-         impl_iterator it1(impl.begin() + d1), it2(impl.begin() + d2);
-         for(impl_iterator it = it1; it != it2; ++it)
-            this->delete_node(*it);
-         impl_iterator e = impl.erase(it1, it2);
-         this->align_nodes(e, get_last_align());
-      }
-      return iterator(this->begin() + d1);
-   }
-
-   impl_iterator get_last_align()
-   {
-      return impl.end() - (ExtraPointers - 1);
-   }
-
-   const_impl_iterator get_last_align() const
-   {
-      return impl.cend() - (ExtraPointers - 1);
-   }
-
-   template
-   iterator priv_erase(const_iterator first, const_iterator last, AllocatorVersion,
-      typename boost::container::container_detail::enable_if_c
-         
-            ::value>::type * = 0)
-   {
-      STABLE_VECTOR_CHECK_INVARIANT;
-      return priv_erase(first, last, allocator_v1());
-   }
-
-   static node_type_ptr_t node_ptr_cast(const void_ptr &p)
-   {
-      return node_type_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
-   {
-      return node_type_base_ptr_t(static_cast(stable_vector_detail::to_raw_pointer(p)));
-   }
-
-   static value_type& value(const void_ptr &p)
-   {
-      return node_ptr_cast(p)->value;
-   }
-
-   void initialize_end_node(size_type impl_capacity = 0)
-   {
-      if(impl.empty()){
-         impl.reserve(impl_capacity + ExtraPointers);
-         impl.resize (ExtraPointers, void_ptr(0));
-         impl[0] = &this->internal_data.end_node;
-         this->internal_data.end_node.up = &impl[0];
-      }
-   }
-
-   void readjust_end_node()
-   {
-      if(!this->impl.empty()){
-         void_ptr &end_node_ref = *(this->get_last_align()-1);
-         end_node_ref = this->get_end_node();
-         this->internal_data.end_node.up = &end_node_ref;
-      }
-      else{
-         this->internal_data.end_node.up = void_ptr(&this->internal_data.end_node.up);
-      }
-   }
-
-   node_type_ptr_t get_end_node() const
-   {
-      const node_type_base_t* cp = &this->internal_data.end_node;
-      node_type_base_t* p = const_cast(cp);
-      return node_ptr_cast(p);
-   }
-
-   template
-   void_ptr new_node(const void_ptr &up, Iter it)
-   {
-      node_type_ptr_t p = this->allocate_one();
-      try{
-         boost::container::construct_in_place(this->node_alloc(), &*p, it);
-         p->set_pointer(up);
-      }
-      catch(...){
-         this->deallocate_one(p);
-         throw;
-      }
-      return p;
-   }
-
-   void delete_node(const void_ptr &p)
-   {
-      node_type_ptr_t n(node_ptr_cast(p));
       allocator_traits::
-         destroy(this->node_alloc(), container_detail::to_raw_pointer(n));
-      this->put_in_pool(n);
+         destroy(this->priv_node_alloc(), container_detail::addressof(n.value));
+      static_cast(&n)->~node_base_type();
    }
 
-   static void align_nodes(impl_iterator first, impl_iterator last)
+   void priv_delete_node(const node_ptr &n)
    {
-      while(first!=last){
-         node_ptr_cast(*first)->up = void_ptr(&*first);
-         ++first;
-      }
+      this->priv_destroy_node(*n);
+      this->priv_put_in_pool(n);
    }
 
-   void insert_not_iter(const_iterator position, size_type n, const T& t)
+   template
+   void priv_build_node_from_it(const node_ptr &p, const index_iterator &up_index, const Iterator &it)
    {
-      typedef constant_iterator cvalue_iterator;
-      this->insert_iter(position, cvalue_iterator(t, n), cvalue_iterator(), std::forward_iterator_tag());
+      //This can throw
+      boost::container::construct_in_place
+         ( this->priv_node_alloc()
+         , container_detail::addressof(p->value)
+         , it);
+      //This does not throw
+      ::new(static_cast(container_detail::to_raw_pointer(p)))
+         node_base_type(index_traits_type::ptr_to_node_base_ptr(*up_index));
    }
 
-   template 
-   void insert_iter(const_iterator position,InputIterator first,InputIterator last, boost::mpl::true_)
+   template
+   void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible)
    {
-      typedef typename std::iterator_traits::iterator_category category;
-      this->insert_iter(position, first, last, category());
+      //This can throw
+      boost::container::allocator_traits::construct
+         ( this->priv_node_alloc()
+         , container_detail::addressof(p->value)
+         , ::boost::forward(value_convertible));
+      //This does not throw
+      ::new(static_cast(container_detail::to_raw_pointer(p))) node_base_type;
    }
 
-   template 
-   void insert_iter(const_iterator position,InputIterator first,InputIterator last,std::input_iterator_tag)
+   void priv_swap_members(stable_vector &x)
    {
-      for(; first!=last; ++first){
-         this->insert(position, *first);
-      }    
-   }
-
-   template 
-   iterator insert_iter(const_iterator position, InputIterator first, InputIterator last, std::forward_iterator_tag)
-   {
-      size_type       n = (size_type)std::distance(first,last);
-      difference_type d = position-this->cbegin();
-      if(n){
-         this->insert_iter_prolog(n, d);
-         const impl_iterator it(impl.begin() + d);
-         this->insert_iter_fwd(it, first, last, n);
-         //Fix the pointers for the newly allocated buffer
-         this->align_nodes(it + n, get_last_align());
-      }
-      return this->begin() + d;
-   }
-
-   template 
-   void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v1)
-   {
-      size_type i=0;
-      try{
-         while(first!=last){
-            it[i] = this->new_node(void_ptr_ptr(&it[i]), first);
-            ++first;
-            ++i;
-         }
-      }
-      catch(...){
-         impl_iterator e = impl.erase(it + i, it + n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter_fwd_alloc(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n, allocator_v2)
-   {
-      multiallocation_chain mem(node_alloc().allocate_individual(n));
-
-      size_type i = 0;
-      node_type_ptr_t p = 0;
-      try{
-         while(first != last){
-            p = mem.front();
-            mem.pop_front();
-            //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
-            p->set_pointer(void_ptr_ptr(&it[i]));
-            ++first;
-            it[i] = p;
-            ++i;
-         }
-      }
-      catch(...){
-         node_alloc().deallocate_one(p);
-         node_alloc().deallocate_many(boost::move(mem));
-         impl_iterator e = impl.erase(it+i, it+n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter_fwd(const impl_iterator it, FwdIterator first, FwdIterator last, difference_type n)
-   {
-      size_type i = 0;
-      node_type_ptr_t p = 0;
-      try{
-         while(first != last){
-            p = this->get_from_pool();
-            if(!p){
-               insert_iter_fwd_alloc(it+i, first, last, n-i, alloc_version());
-               break;
-            }
-            //This can throw
-            boost::container::construct_in_place(this->node_alloc(), &*p, first);
-            p->set_pointer(void_ptr_ptr(&it[i]));
-            ++first;
-            it[i]=p;
-            ++i;
-         }
-      }
-      catch(...){
-         put_in_pool(p);
-         impl_iterator e = impl.erase(it+i, it+n);
-         this->align_nodes(e, get_last_align());
-         throw;
-      }
-   }
-
-   template 
-   void insert_iter(const_iterator position, InputIterator first, InputIterator last, boost::mpl::false_)
-   {
-      this->insert_not_iter(position, first, last);
+      container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
+      index_traits_type::readjust_end_node(this->index, this->internal_data.end_node);
+      index_traits_type::readjust_end_node(x.index, x.internal_data.end_node);
    }
 
    #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING)
-   bool invariant()const
+   bool priv_invariant()const
    {
-      if(impl.empty())
-         return !capacity() && !size();
-      if(get_end_node() != *(impl.end() - ExtraPointers)){
+      index_type & index_ref =  const_cast(this->index);
+
+      if(index.empty())
+         return !this->capacity() && !this->size();
+      if(this->priv_get_end_node() != *(index.end() - ExtraPointers)){
          return false;
       }
-      for(const_impl_iterator it = impl.begin(), it_end = get_last_align(); it != it_end; ++it){
-         if(const_void_ptr(node_ptr_cast(*it)->up) != 
-               const_void_ptr(const_void_ptr_ptr(&*it)))
-            return false;
+
+      if(!index_traits_type::invariants(index_ref)){
+         return false;
       }
-      size_type n = capacity()-size();
-      const void_ptr &pool_head = impl.back();
+
+      size_type n = this->capacity() - this->size();
+      node_base_ptr &pool_first_ref = *(index_ref.end() - (ExtraPointers-1));
+      node_base_ptr &pool_last_ref  = index_ref.back();
+      multiallocation_chain holder;
+      holder.incorporate_after( holder.before_begin()
+                              , node_ptr_traits::static_cast_from(pool_first_ref)
+                              , node_ptr_traits::static_cast_from(pool_last_ref)
+                              , internal_data.pool_size);
+      typename multiallocation_chain::iterator beg(holder.begin()), end(holder.end());
       size_type num_pool = 0;
-      node_type_ptr_t p = node_ptr_cast(pool_head);
-      while(p){
+      while(beg != end){
          ++num_pool;
-         p = node_ptr_cast(p->up);
+         ++beg;
       }
-      return n >= num_pool;
+      return n >= num_pool && num_pool == internal_data.pool_size;
    }
 
    class invariant_checker
@@ -1703,7 +1750,7 @@ class stable_vector
 
       public:
       invariant_checker(const stable_vector& v):p(&v){}
-      ~invariant_checker(){BOOST_ASSERT(p->invariant());}
+      ~invariant_checker(){BOOST_ASSERT(p->priv_invariant());}
       void touch(){}
    };
    #endif
@@ -1713,94 +1760,72 @@ class stable_vector
    {
       private:
       BOOST_MOVABLE_BUT_NOT_COPYABLE(ebo_holder)
+
       public:
-/*
-      explicit ebo_holder(BOOST_RV_REF(ebo_holder) x)
-         : node_allocator_type(boost::move(static_cast(x)))
-         , pool_size(0)
-         , end_node()
-      {}
-*/
       template
       explicit ebo_holder(BOOST_FWD_REF(AllocatorRLValue) a)
          : node_allocator_type(boost::forward(a))
          , pool_size(0)
          , end_node()
-      {
-         this->set_end_pointer_to_default_constructed();
-      }
+      {}
 
       ebo_holder()
          : node_allocator_type()
          , pool_size(0)
          , end_node()
-      {
-         this->set_end_pointer_to_default_constructed();
-      }
-
-      void set_end_pointer_to_default_constructed()
-      {
-         end_node.set_pointer(void_ptr(&end_node.up));
-      }
+      {}
 
       size_type pool_size;
-      node_type_base_t end_node;
+      node_base_type end_node;
    } internal_data;
 
-   void priv_swap_members(stable_vector &x)
-   {
-      container_detail::do_swap(this->internal_data.pool_size, x.internal_data.pool_size);
-      this->readjust_end_node();
-      x.readjust_end_node();
-   }
+   node_allocator_type &priv_node_alloc()              { return internal_data;  }
+   const node_allocator_type &priv_node_alloc() const  { return internal_data;  }
 
-   node_allocator_type &node_alloc()              { return internal_data;  }
-   const node_allocator_type &node_alloc() const  { return internal_data;  }
-
-   impl_type                           impl;
+   index_type                           index;
    /// @endcond
 };
 
-template 
-bool operator==(const stable_vector& x,const stable_vector& y)
+template 
+bool operator==(const stable_vector& x,const stable_vector& y)
 {
    return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin());
 }
 
-template 
-bool operator< (const stable_vector& x,const stable_vector& y)
+template 
+bool operator< (const stable_vector& x,const stable_vector& y)
 {
    return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
 }
 
-template 
-bool operator!=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator!=(const stable_vector& x,const stable_vector& y)
 {
    return !(x==y);
 }
 
-template 
-bool operator> (const stable_vector& x,const stable_vector& y)
+template 
+bool operator> (const stable_vector& x,const stable_vector& y)
 {
    return y
-bool operator>=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator>=(const stable_vector& x,const stable_vector& y)
 {
    return !(x
-bool operator<=(const stable_vector& x,const stable_vector& y)
+template 
+bool operator<=(const stable_vector& x,const stable_vector& y)
 {
    return !(x>y);
 }
 
 // specialized algorithms:
 
-template 
-void swap(stable_vector& x,stable_vector& y)
+template 
+void swap(stable_vector& x,stable_vector& y)
 {
    x.swap(y);
 }
@@ -1811,6 +1836,17 @@ void swap(stable_vector& x,stable_vector& y)
 
 /// @endcond
 
+/*
+
+//!has_trivial_destructor_after_move<> == true_type
+//!specialization for optimizations
+template 
+struct has_trivial_destructor_after_move >
+   : public has_trivial_destructor_after_move::value
+{};
+
+*/
+
 }}
 
 #include 
diff --git a/project/jni/boost/include/boost/container/string.hpp b/project/jni/boost/include/boost/container/string.hpp
index 3a9c55a3c..40b2397a7 100644
--- a/project/jni/boost/include/boost/container/string.hpp
+++ b/project/jni/boost/include/boost/container/string.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -43,15 +43,19 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
-#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
-#include       
-#include   
+#include      
+#include  
 #include 
 #include 
 #include 
@@ -67,39 +71,34 @@
 #include 
 #include 
 
-#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
 namespace boost {
 namespace container {
-#else
-namespace boost {
-namespace container {
-#endif
 
 /// @cond
 namespace container_detail {
 // ------------------------------------------------------------
-// Class basic_string_base.  
+// Class basic_string_base. 
 
 // basic_string_base is a helper class that makes it it easier to write
 // an exception-safe version of basic_string.  The constructor allocates,
 // but does not initialize, a block of memory.  The destructor
 // deallocates, but does not destroy elements within, a block of
-// memory.  The destructor assumes that the memory either is the internal buffer, 
-// or else points to a block of memory that was allocated using _String_base's 
+// memory. The destructor assumes that the memory either is the internal buffer,
+// or else points to a block of memory that was allocated using string_base's
 // allocator and whose size is this->m_storage.
-template 
+template 
 class basic_string_base
 {
    BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
 
-   typedef allocator_traits allocator_traits_type;
+   typedef allocator_traits allocator_traits_type;
  public:
-   typedef A allocator_type;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
+   typedef Allocator                                  allocator_type;
+   typedef allocator_type                              stored_allocator_type;
    typedef typename allocator_traits_type::pointer     pointer;
    typedef typename allocator_traits_type::value_type  value_type;
    typedef typename allocator_traits_type::size_type   size_type;
+   typedef ::boost::intrusive::pointer_traits pointer_traits;
 
    basic_string_base()
       : members_()
@@ -111,32 +110,29 @@ class basic_string_base
 
    basic_string_base(const allocator_type& a, size_type n)
       : members_(a)
-   {  
-      this->init(); 
+   { 
+      this->init();
       this->allocate_initial_block(n);
    }
 
    basic_string_base(BOOST_RV_REF(basic_string_base) b)
       :  members_(boost::move(b.alloc()))
-   {  
+   { 
       this->init();
-      this->swap_data(b); 
+      this->swap_data(b);
    }
 
-   ~basic_string_base() 
-   {  
+   ~basic_string_base()
+   { 
       if(!this->is_short()){
-         this->deallocate_block(); 
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , static_cast(static_cast(&this->members_.m_repr.r))
-            );
+         this->deallocate_block();
+         this->is_short(true);
       }
    }
 
    private:
 
-   //This is the structure controlling a long string 
+   //This is the structure controlling a long string
    struct long_t
    {
       size_type      is_short  : 1;
@@ -175,8 +171,8 @@ class basic_string_base
 
    //This type has the same alignment and size as long_t but it's POD
    //so, unlike long_t, it can be placed in a union
-   
-   typedef typename boost::aligned_storage< sizeof(long_t), 
+  
+   typedef typename boost::aligned_storage< sizeof(long_t),
        container_detail::alignment_of::value>::type   long_raw_t;
 
    protected:
@@ -187,13 +183,13 @@ class basic_string_base
       container_detail::ct_rounded_size::value;
    static const size_type  ZeroCostInternalBufferChars =
       (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
-   static const size_type  UnalignedFinalInternalBufferChars = 
+   static const size_type  UnalignedFinalInternalBufferChars =
       (ZeroCostInternalBufferChars > MinInternalBufferChars) ?
                 ZeroCostInternalBufferChars : MinInternalBufferChars;
 
    struct short_t
    {
-      short_header   h; 
+      short_header   h;
       value_type     data[UnalignedFinalInternalBufferChars];
    };
 
@@ -202,32 +198,38 @@ class basic_string_base
       long_raw_t  r;
       short_t     s;
 
-      short_t &short_repr() const
-      {  return *const_cast(&s);  }
+      const short_t &short_repr() const
+      {  return s;  }
 
-      long_t &long_repr() const
-      {  return *const_cast(reinterpret_cast(&r));  }
+      const long_t &long_repr() const
+      {  return *static_cast(static_cast(&r));  }
+
+      short_t &short_repr()
+      {  return s;  }
+
+      long_t &long_repr()
+      {  return *static_cast(static_cast(&r));  }
    };
 
    struct members_holder
-      :  public A
+      :  public Allocator
    {
       members_holder()
-         : A()
+         : Allocator()
       {}
 
       template
       explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
-         :  A(boost::forward(a))
+         :  Allocator(boost::forward(a))
       {}
 
       repr_t m_repr;
    } members_;
 
-   const A &alloc() const
+   const Allocator &alloc() const
    {  return members_;  }
 
-   A &alloc()
+   Allocator &alloc()
    {  return members_;  }
 
    static const size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
@@ -241,20 +243,22 @@ class basic_string_base
    {  return static_cast(this->members_.m_repr.s.h.is_short != 0);  }
 
    void is_short(bool yes)
-   {  
-      if(yes && !this->is_short()){
+   {
+      const bool was_short = this->is_short();
+      if(yes && !was_short){
          allocator_traits_type::destroy
             ( this->alloc()
             , static_cast(static_cast(&this->members_.m_repr.r))
             );
+         this->members_.m_repr.s.h.is_short = true;
       }
-      else{
+      else if(!yes && was_short){
          allocator_traits_type::construct
             ( this->alloc()
             , static_cast(static_cast(&this->members_.m_repr.r))
             );
+         this->members_.m_repr.s.h.is_short = false;
       }
-      this->members_.m_repr.s.h.is_short = yes;
    }
 
    private:
@@ -269,55 +273,27 @@ class basic_string_base
    typedef container_detail::integral_constant      allocator_v1;
    typedef container_detail::integral_constant      allocator_v2;
    typedef container_detail::integral_constant::value> alloc_version;
+      boost::container::container_detail::version::value> alloc_version;
 
    std::pair
       allocation_command(allocation_type command,
-                         size_type limit_size, 
+                         size_type limit_size,
                          size_type preferred_size,
                          size_type &received_size, pointer reuse = 0)
    {
       if(this->is_short() && (command & (expand_fwd | expand_bwd)) ){
-         reuse = pointer(0);
+         reuse = pointer();
          command &= ~(expand_fwd | expand_bwd);
       }
-      return this->allocation_command
-         (command, limit_size, preferred_size, received_size, reuse, alloc_version());
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v1)
-   {
-      (void)limit_size;
-      (void)reuse;
-      if(!(command & allocate_new))
-         return std::pair(pointer(0), false);
-      received_size = preferred_size;
-      return std::make_pair(this->alloc().allocate(received_size), false);
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         pointer reuse,
-                         allocator_v2)
-   {
-      return this->alloc().allocation_command(command, limit_size, preferred_size, 
-                                              received_size, reuse);
+      return container_detail::allocator_version_traits::allocation_command
+         (this->alloc(), command, limit_size, preferred_size, received_size, reuse);
    }
 
    size_type next_capacity(size_type additional_objects) const
    {  return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects);  }
 
-   void deallocate(pointer p, size_type n) 
-   {  
+   void deallocate(pointer p, size_type n)
+   { 
       if (p && (n > InternalBufferChars))
          this->alloc().deallocate(p, n);
    }
@@ -333,11 +309,9 @@ class basic_string_base
 
    void destroy(pointer p, size_type n)
    {
-      for(; n--; ++p){
-         allocator_traits_type::destroy
-            ( this->alloc()
-            , container_detail::to_raw_pointer(p)
-            );
+      value_type *raw_p = container_detail::to_raw_pointer(p);
+      for(; n--; ++raw_p){
+         allocator_traits_type::destroy( this->alloc(), raw_p);
       }
    }
 
@@ -357,7 +331,7 @@ class basic_string_base
             pointer p = this->allocation_command(allocate_new, n, new_cap, new_cap).first;
             this->is_short(false);
             this->priv_long_addr(p);
-            this->priv_size(0);
+            this->priv_long_size(0);
             this->priv_storage(new_cap);
          }
       }
@@ -365,9 +339,9 @@ class basic_string_base
          throw_length_error();
    }
 
-   void deallocate_block() 
+   void deallocate_block()
    {  this->deallocate(this->priv_addr(), this->priv_storage());  }
-      
+     
    size_type max_size() const
    {  return allocator_traits_type::max_size(this->alloc()) - 1; }
 
@@ -383,13 +357,26 @@ class basic_string_base
    { return this->priv_storage() - 1; }
 
    pointer priv_short_addr() const
-   {  return pointer(&this->members_.m_repr.short_repr().data[0]);  }
+   {  return pointer_traits::pointer_to(const_cast(this->members_.m_repr.short_repr().data[0]));  }
 
    pointer priv_long_addr() const
    {  return this->members_.m_repr.long_repr().start;  }
 
    pointer priv_addr() const
-   {  return this->is_short() ? pointer(&this->members_.m_repr.short_repr().data[0]) : this->members_.m_repr.long_repr().start;  }
+   {
+      return this->is_short()
+         ? priv_short_addr()
+         : priv_long_addr()
+         ;
+   }
+
+   pointer priv_end_addr() const
+   {
+      return this->is_short()
+         ? this->priv_short_addr() + this->priv_short_size()
+         : this->priv_long_addr()  + this->priv_long_size()
+         ;
+   }
 
    void priv_long_addr(pointer addr)
    {  this->members_.m_repr.long_repr().start = addr;  }
@@ -404,18 +391,18 @@ class basic_string_base
    {  return this->members_.m_repr.long_repr().storage;  }
 
    void priv_storage(size_type storage)
-   {  
+   { 
       if(!this->is_short())
          this->priv_long_storage(storage);
    }
 
    void priv_long_storage(size_type storage)
-   {  
+   { 
       this->members_.m_repr.long_repr().storage = storage;
    }
 
    size_type priv_size() const
-   {  return this->is_short() ? priv_short_size() : priv_long_size();  }
+   {  return this->is_short() ? this->priv_short_size() : this->priv_long_size();  }
 
    size_type priv_short_size() const
    {  return this->members_.m_repr.short_repr().h.length;  }
@@ -424,7 +411,7 @@ class basic_string_base
    {  return this->members_.m_repr.long_repr().length;  }
 
    void priv_size(size_type sz)
-   {  
+   { 
       if(this->is_short())
          this->priv_short_size(sz);
       else
@@ -432,13 +419,13 @@ class basic_string_base
    }
 
    void priv_short_size(size_type sz)
-   {  
+   { 
       this->members_.m_repr.s.h.length = (unsigned char)sz;
    }
 
    void priv_long_size(size_type sz)
-   {  
-      this->members_.m_repr.long_repr().length = static_cast(sz);
+   { 
+      this->members_.m_repr.long_repr().length = sz;
    }
 
    void swap_data(basic_string_base& other)
@@ -448,16 +435,22 @@ class basic_string_base
             container_detail::do_swap(this->members_.m_repr, other.members_.m_repr);
          }
          else{
-            repr_t copied(this->members_.m_repr);
-            this->members_.m_repr.long_repr() = other.members_.m_repr.long_repr();
-            other.members_.m_repr = copied;
+            short_t short_backup(this->members_.m_repr.short_repr());
+            long_t  long_backup (other.members_.m_repr.long_repr());
+            other.members_.m_repr.long_repr().~long_t();
+            ::new(&this->members_.m_repr.long_repr()) long_t;
+            this->members_.m_repr.long_repr()  = long_backup;
+            other.members_.m_repr.short_repr() = short_backup;
          }
       }
       else{
          if(other.is_short()){
-            repr_t copied(other.members_.m_repr);
-            other.members_.m_repr.long_repr() = this->members_.m_repr.long_repr();
-            this->members_.m_repr = copied;
+            short_t short_backup(other.members_.m_repr.short_repr());
+            long_t  long_backup (this->members_.m_repr.long_repr());
+            this->members_.m_repr.long_repr().~long_t();
+            ::new(&other.members_.m_repr.long_repr()) long_t;
+            other.members_.m_repr.long_repr()  = long_backup;
+            this->members_.m_repr.short_repr() = short_backup;
          }
          else{
             container_detail::do_swap(this->members_.m_repr.long_repr(), other.members_.m_repr.long_repr());
@@ -470,51 +463,51 @@ class basic_string_base
 
 /// @endcond
 
-//! The basic_string class represents a Sequence of characters. It contains all the 
-//! usual operations of a Sequence, and, additionally, it contains standard string 
+//! The basic_string class represents a Sequence of characters. It contains all the
+//! usual operations of a Sequence, and, additionally, it contains standard string
 //! operations such as search and concatenation.
 //!
-//! The basic_string class is parameterized by character type, and by that type's 
+//! The basic_string class is parameterized by character type, and by that type's
 //! Character Traits.
-//! 
-//! This class has performance characteristics very much like vector<>, meaning, 
+//!
+//! This class has performance characteristics very much like vector<>, meaning,
 //! for example, that it does not perform reference-count or copy-on-write, and that
-//! concatenation of two strings is an O(N) operation. 
-//! 
-//! Some of basic_string's member functions use an unusual method of specifying positions 
-//! and ranges. In addition to the conventional method using iterators, many of 
-//! basic_string's member functions use a single value pos of type size_type to represent a 
-//! position (in which case the position is begin() + pos, and many of basic_string's 
-//! member functions use two values, pos and n, to represent a range. In that case pos is 
-//! the beginning of the range and n is its size. That is, the range is 
-//! [begin() + pos, begin() + pos + n). 
-//! 
-//! Note that the C++ standard does not specify the complexity of basic_string operations. 
-//! In this implementation, basic_string has performance characteristics very similar to 
-//! those of vector: access to a single character is O(1), while copy and concatenation 
+//! concatenation of two strings is an O(N) operation.
+//!
+//! Some of basic_string's member functions use an unusual method of specifying positions
+//! and ranges. In addition to the conventional method using iterators, many of
+//! basic_string's member functions use a single value pos of type size_type to represent a
+//! position (in which case the position is begin() + pos, and many of basic_string's
+//! member functions use two values, pos and n, to represent a range. In that case pos is
+//! the beginning of the range and n is its size. That is, the range is
+//! [begin() + pos, begin() + pos + n).
+//!
+//! Note that the C++ standard does not specify the complexity of basic_string operations.
+//! In this implementation, basic_string has performance characteristics very similar to
+//! those of vector: access to a single character is O(1), while copy and concatenation
 //! are O(N).
-//! 
-//! In this implementation, begin(), 
+//!
+//! In this implementation, begin(),
 //! end(), rbegin(), rend(), operator[], c_str(), and data() do not invalidate iterators.
 //! In this implementation, iterators are only invalidated by member functions that
-//! explicitly change the string's contents. 
+//! explicitly change the string's contents.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template , class A = std::allocator >
+template , class Allocator = std::allocator >
 #else
-template 
+template 
 #endif
 class basic_string
-   :  private container_detail::basic_string_base 
+   :  private container_detail::basic_string_base
 {
    /// @cond
    private:
-   typedef allocator_traits allocator_traits_type;
+   typedef allocator_traits allocator_traits_type;
    BOOST_COPYABLE_AND_MOVABLE(basic_string)
-   typedef container_detail::basic_string_base base_t;
+   typedef container_detail::basic_string_base base_t;
    static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
 
    protected:
-   // A helper class to use a char_traits as a function object.
+   // Allocator helper class to use a char_traits as a function object.
 
    template 
    struct Eq_traits
@@ -535,49 +528,38 @@ class basic_string
       const Pointer m_first;
       const Pointer m_last;
 
-      Not_within_traits(Pointer f, Pointer l) 
+      Not_within_traits(Pointer f, Pointer l)
          : m_first(f), m_last(l) {}
 
-      bool operator()(const typename Tr::char_type& x) const 
+      bool operator()(const typename Tr::char_type& x) const
       {
-         return std::find_if(m_first, m_last, 
+         return std::find_if(m_first, m_last,
                         std::bind1st(Eq_traits(), x)) == m_last;
       }
    };
    /// @endcond
 
    public:
-
-   //! The allocator type
-   typedef A                                       allocator_type;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
-   //! The type of object, CharT, stored in the string
-   typedef CharT                                   value_type;
-   //! The second template parameter Traits
-   typedef Traits                                  traits_type;
-   //! Pointer to CharT
-   typedef typename allocator_traits_type::pointer pointer;
-   //! Const pointer to CharT 
-   typedef typename allocator_traits_type::const_pointer               const_pointer;
-   //! Reference to CharT 
-   typedef typename allocator_traits_type::reference                   reference;
-   //! Const reference to CharT 
-   typedef typename allocator_traits_type::const_reference             const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type                   size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type             difference_type;
-   //! Iterator used to iterate through a string. It's a Random Access Iterator
-   typedef pointer                                 iterator;
-   //! Const iterator used to iterate through a string. It's a Random Access Iterator
-   typedef const_pointer                           const_iterator;
-   //! Iterator used to iterate backwards through a string
-   typedef std::reverse_iterator       reverse_iterator;
-   //! Const iterator used to iterate backwards through a string
-   typedef std::reverse_iterator const_reverse_iterator;
-   //! The largest possible value of type size_type. That is, size_type(-1). 
-   static const size_type npos;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
+   typedef Traits                                                                      traits_type;
+   typedef CharT                                                                       value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(allocator_type)                                      stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(pointer)                                             iterator;
+   typedef BOOST_CONTAINER_IMPDEF(const_pointer)                                       const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
+   static const size_type npos = size_type(-1);
 
    /// @cond
    private:
@@ -585,9 +567,15 @@ class basic_string
    typedef typename base_t::allocator_v1  allocator_v1;
    typedef typename base_t::allocator_v2  allocator_v2;
    typedef typename base_t::alloc_version  alloc_version;
+   typedef ::boost::intrusive::pointer_traits pointer_traits;
    /// @endcond
 
    public:                         // Constructor, destructor, assignment.
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
    /// @cond
    struct reserve_t {};
 
@@ -602,7 +590,7 @@ class basic_string
    /// @endcond
 
    //! Effects: Default constructs a basic_string.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
    basic_string()
       : base_t()
@@ -610,78 +598,112 @@ class basic_string
 
 
    //! Effects: Constructs a basic_string taking the allocator as parameter.
-   //! 
-   //! Throws: If allocator_type's copy constructor throws.
-   explicit basic_string(const allocator_type& a)
+   //!
+   //! Throws: Nothing
+   explicit basic_string(const allocator_type& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    { this->priv_terminate_string(); }
 
    //! Effects: Copy constructs a basic_string.
    //!
    //! Postcondition: x == *this.
-   //! 
-   //! Throws: If allocator_type's default constructor or copy constructor throws.
-   basic_string(const basic_string& s) 
-      :  base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
-   { this->priv_range_initialize(s.begin(), s.end()); }
-
-   //! Effects: Move constructor. Moves mx's resources to *this.
    //!
-   //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //! Throws: If allocator_type's default constructor throws.
+   basic_string(const basic_string& s)
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
+   {
+      this->priv_terminate_string();
+      this->assign(s.begin(), s.end());
+   }
+
+   //! Effects: Move constructor. Moves s's resources to *this.
+   //!
+   //! Throws: Nothing.
+   //!
    //! Complexity: Constant.
-   basic_string(BOOST_RV_REF(basic_string) s) 
+   basic_string(BOOST_RV_REF(basic_string) s) BOOST_CONTAINER_NOEXCEPT
       : base_t(boost::move((base_t&)s))
    {}
 
-   //! Effects: Constructs a basic_string taking the allocator as parameter,
-   //!   and is initialized by a specific number of characters of the s string. 
-   basic_string(const basic_string& s, size_type pos, size_type n = npos,
-               const allocator_type& a = allocator_type()) 
-      : base_t(a) 
+   //! Effects: Copy constructs a basic_string using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocation throws.
+   basic_string(const basic_string& s, const allocator_type &a)
+      :  base_t(a)
    {
+      this->priv_terminate_string();
+      this->assign(s.begin(), s.end());
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves s's resources to *this.
+   //!
+   //! Throws: If allocation throws.
+   //!
+   //! Complexity: Constant if a == s.get_allocator(), linear otherwise.
+   basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      if(a == this->alloc()){
+         this->swap_data(s);
+      }
+      else{
+         this->assign(s.begin(), s.end());
+      }
+   }
+
+   //! Effects: Constructs a basic_string taking the allocator as parameter,
+   //!   and is initialized by a specific number of characters of the s string.
+   basic_string(const basic_string& s, size_type pos, size_type n = npos,
+                const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
       if (pos > s.size())
          this->throw_out_of_range();
       else
-         this->priv_range_initialize
+         this->assign
             (s.begin() + pos, s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by a specific number of characters of the s c-string.
-   basic_string(const CharT* s, size_type n,
-               const allocator_type& a = allocator_type()) 
-      : base_t(a) 
-   { this->priv_range_initialize(s, s + n); }
+   basic_string(const CharT* s, size_type n, const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      this->assign(s, s + n);
+   }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by the null-terminated s c-string.
-   basic_string(const CharT* s,
-                const allocator_type& a = allocator_type())
-      : base_t(a) 
-   { this->priv_range_initialize(s, s + Traits::length(s)); }
+   basic_string(const CharT* s, const allocator_type& a = allocator_type())
+      : base_t(a)
+   {
+      this->priv_terminate_string();
+      this->assign(s, s + Traits::length(s));
+   }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and is initialized by n copies of c.
-   basic_string(size_type n, CharT c,
-                const allocator_type& a = allocator_type())
+   basic_string(size_type n, CharT c, const allocator_type& a = allocator_type())
       : base_t(a)
-   {  
-      this->priv_range_initialize(cvalue_iterator(c, n),
-                                  cvalue_iterator());
+   {
+      this->priv_terminate_string();
+      this->assign(n, c);
    }
 
    //! Effects: Constructs a basic_string taking the allocator as parameter,
    //!   and a range of iterators.
    template 
-   basic_string(InputIterator f, InputIterator l,
-               const allocator_type& a = allocator_type())
+   basic_string(InputIterator f, InputIterator l, const allocator_type& a = allocator_type())
       : base_t(a)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_initialize_dispatch(f, l, Result());
+      this->priv_terminate_string();
+      this->assign(f, l);
    }
 
    //! Effects: Destroys the basic_string. All used memory is deallocated.
@@ -689,13 +711,13 @@ class basic_string
    //! Throws: Nothing.
    //!
    //! Complexity: Constant.
-   ~basic_string() 
+   ~basic_string() BOOST_CONTAINER_NOEXCEPT
    {}
-      
+     
    //! Effects: Copy constructs a string.
    //!
    //! Postcondition: x == *this.
-   //! 
+   //!
    //! Complexity: Linear to the elements x contains.
    basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) x)
    {
@@ -708,8 +730,8 @@ class basic_string
             if(!this->is_short()){
                this->deallocate_block();
                this->is_short(true);
-               Traits::assign(*this->priv_addr(), this->priv_null());
-               this->priv_size(0);
+               Traits::assign(*this->priv_addr(), CharT(0));
+               this->priv_short_size(0);
             }
          }
          container_detail::assign_alloc(this->alloc(), x.alloc(), flag);
@@ -721,9 +743,9 @@ class basic_string
    //! Effects: Move constructor. Moves mx's resources to *this.
    //!
    //! Throws: If allocator_type's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   basic_string& operator=(BOOST_RV_REF(basic_string) x)
+   basic_string& operator=(BOOST_RV_REF(basic_string) x) BOOST_CONTAINER_NOEXCEPT
    {
       if (&x != this){
          allocator_type &this_alloc = this->alloc();
@@ -747,165 +769,185 @@ class basic_string
    }
 
    //! Effects: Assignment from a null-terminated c-string.
-   basic_string& operator=(const CharT* s) 
+   basic_string& operator=(const CharT* s)
    { return this->assign(s, s + Traits::length(s)); }
 
    //! Effects: Assignment from character.
    basic_string& operator=(CharT c)
    { return this->assign(static_cast(1), c); }
 
-   //! Effects: Returns an iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin()
-   { return this->priv_addr(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const
-   { return this->priv_addr(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const
-   { return this->priv_addr(); }
-
-   //! Effects: Returns an iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end()
-   { return this->priv_addr() + this->priv_size(); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const 
-   { return this->priv_addr() + this->priv_size(); }  
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const 
-   { return this->priv_addr() + this->priv_size(); }  
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin()             
-   { return reverse_iterator(this->priv_addr() + this->priv_size()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const 
-   { return this->crbegin(); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const 
-   { return const_reverse_iterator(this->priv_addr() + this->priv_size()); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend()               
-   { return reverse_iterator(this->priv_addr()); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend()   const 
-   { return this->crend(); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend()   const 
-   { return const_reverse_iterator(this->priv_addr()); }
-
    //! Effects: Returns a copy of the internal allocator.
-   //! 
+   //!
    //! Throws: If allocator's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
-   allocator_type get_allocator() const 
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
    { return this->alloc(); }
 
    //! Effects: Returns a reference to the internal allocator.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
+   //!
    //! Note: Non-standard extension.
    stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
    {  return this->alloc(); }
 
-   //! Effects: Returns the number of the elements contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
    //! Complexity: Constant.
-   size_type size() const    
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns an iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin()  BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->priv_end_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend()  BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->priv_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_addr(); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_end_addr(); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->priv_end_addr()); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->priv_addr()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the vector contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return !this->priv_size(); }
+
+   //! Effects: Returns the number of the elements contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const    BOOST_CONTAINER_NOEXCEPT
    { return this->priv_size(); }
 
    //! Effects: Returns the number of the elements contained in the vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type length() const
+   size_type length() const BOOST_CONTAINER_NOEXCEPT
    { return this->size(); }
 
    //! Effects: Returns the largest possible size of the vector.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   size_type max_size() const
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
    { return base_t::max_size(); }
 
    //! Effects: Inserts or erases elements at the end such that
@@ -916,7 +958,7 @@ class basic_string
    //! Complexity: Linear to the difference between size() and new_size.
    void resize(size_type n, CharT c)
    {
-      if (n <= size())
+      if (n <= this->size())
          this->erase(this->begin() + n, this->end());
       else
          this->append(n - this->size(), c);
@@ -929,18 +971,28 @@ class basic_string
    //!
    //! Complexity: Linear to the difference between size() and new_size.
    void resize(size_type n)
-   { resize(n, this->priv_null()); }
+   { resize(n, CharT()); }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   { return this->priv_capacity(); }
 
    //! Effects: If n is less than or equal to capacity(), this call has no
    //!   effect. Otherwise, it is a request for allocation of additional memory.
    //!   If the request is successful, then capacity() is greater than or equal to
    //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
+   //!
    //! Throws: If memory allocation allocation throws
    void reserve(size_type res_arg)
    {
-      if (res_arg > this->max_size())
+      if (res_arg > this->max_size()){
          this->throw_length_error();
+      }
 
       if (this->capacity() < res_arg){
          size_type n = container_detail::max_value(res_arg, this->size()) + 1;
@@ -949,39 +1001,18 @@ class basic_string
             (allocate_new, n, new_cap, new_cap).first;
          size_type new_length = 0;
 
+         const pointer addr = this->priv_addr();
          new_length += priv_uninitialized_copy
-            (this->priv_addr(), this->priv_addr() + this->priv_size(), new_start);
+            (addr, addr + this->priv_size(), new_start);
          this->priv_construct_null(new_start + new_length);
          this->deallocate_block();
          this->is_short(false);
          this->priv_long_addr(new_start);
-         this->priv_size(new_length);
+         this->priv_long_size(new_length);
          this->priv_storage(new_cap);
       }
    }
 
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const
-   { return this->priv_capacity(); }
-
-   //! Effects: Erases all the elements of the vector.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Linear to the number of elements in the vector.
-   void clear()
-   {
-      if (!empty()) {
-         Traits::assign(*this->priv_addr(), this->priv_null());
-         this->priv_size(0);
-      }
-   }
-
    //! Effects: Tries to deallocate the excess of memory created
    //!   with previous allocations. The size of the string is unchanged
    //!
@@ -994,7 +1025,7 @@ class basic_string
       if(this->priv_storage() > InternalBufferChars){
          //Check if we should pass from dynamically allocated buffer
          //to the internal storage
-         if(this->priv_size() < (InternalBufferChars)){
+         if(this->priv_size() < InternalBufferChars){
             //Dynamically allocated buffer attributes
             pointer   long_addr    = this->priv_long_addr();
             size_type long_storage = this->priv_long_storage();
@@ -1013,64 +1044,69 @@ class basic_string
       }
    }
 
-   //! Effects: Returns true if the vector contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const
-   { return !this->priv_size(); }
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a reference to the nth element 
+   //! Effects: Returns a reference to the nth element
    //!   from the beginning of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   reference operator[](size_type n)
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
       { return *(this->priv_addr() + n); }
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a const reference to the nth element 
+   //! Effects: Returns a const reference to the nth element
    //!   from the beginning of the container.
-   //! 
+   //!
    //! Throws: Nothing.
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference operator[](size_type n) const
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
       { return *(this->priv_addr() + n); }
 
    //! Requires: size() > n.
    //!
-   //! Effects: Returns a reference to the nth element 
+   //! Effects: Returns a reference to the nth element
    //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n) {
-      if (n >= size())
-      this->throw_out_of_range();
-      return *(this->priv_addr() + n);
-   }
-
-   //! Requires: size() > n.
    //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
    //! Throws: std::range_error if n >= size()
-   //! 
+   //!
    //! Complexity: Constant.
-   const_reference at(size_type n) const {
-      if (n >= size())
+   reference at(size_type n)
+   {
+      if (n >= this->size())
          this->throw_out_of_range();
       return *(this->priv_addr() + n);
    }
 
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const {
+      if (n >= this->size())
+         this->throw_out_of_range();
+      return *(this->priv_addr() + n);
+   }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
    //! Effects: Calls append(str.data, str.size()).
    //!
    //! Returns: *this
@@ -1092,12 +1128,12 @@ class basic_string
    //! Effects: Calls append(str.data(), str.size()).
    //!
    //! Returns: *this
-   basic_string& append(const basic_string& s) 
+   basic_string& append(const basic_string& s)
    {  return this->append(s.begin(), s.end());  }
 
    //! Requires: pos <= str.size()
    //!
-   //! Effects: Determines the effective length rlen of the string to append 
+   //! Effects: Determines the effective length rlen of the string to append
    //! as the smaller of n and str.size() - pos and calls append(str.data() + pos, rlen).
    //!
    //! Throws: If memory allocation throws and out_of_range if pos > str.size()
@@ -1121,7 +1157,7 @@ class basic_string
    //! Throws: If memory allocation throws length_error if size() + n > max_size().
    //!
    //! Returns: *this
-   basic_string& append(const CharT* s, size_type n) 
+   basic_string& append(const CharT* s, size_type n)
    {  return this->append(s, s + n);  }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1129,7 +1165,7 @@ class basic_string
    //! Effects: Calls append(s, traits::length(s)).
    //!
    //! Returns: *this
-   basic_string& append(const CharT* s) 
+   basic_string& append(const CharT* s)
    {  return this->append(s, s + Traits::length(s));  }
 
    //! Effects: Equivalent to append(basic_string(n, c)).
@@ -1150,31 +1186,33 @@ class basic_string
    //! Effects: Equivalent to append(static_cast(1), c).
    void push_back(CharT c)
    {
-      if (this->priv_size() < this->capacity()){
-         this->priv_construct_null(this->priv_addr() + (this->priv_size() + 1));
-         Traits::assign(this->priv_addr()[this->priv_size()], c);
-         this->priv_size(this->priv_size()+1);
+      const size_type old_size = this->priv_size();
+      if (old_size < this->capacity()){
+         const pointer addr = this->priv_addr();
+         this->priv_construct_null(addr + old_size + 1);
+         Traits::assign(addr[old_size], c);
+         this->priv_size(old_size+1);
       }
       else{
          //No enough memory, insert a new object at the end
-         this->append((size_type)1, c);
+         this->append(size_type(1), c);
       }
    }
 
    //! Effects: Equivalent to assign(str, 0, npos).
    //!
    //! Returns: *this
-   basic_string& assign(const basic_string& s) 
+   basic_string& assign(const basic_string& s)
    {  return this->operator=(s); }
 
    //! Effects: The function replaces the string controlled by *this
-   //!    with a string of length str.size() whose elements are a copy of the string 
+   //!    with a string of length str.size() whose elements are a copy of the string
    //!   controlled by str. Leaves str in a valid but unspecified state.
    //!
    //! Throws: Nothing
    //!
    //! Returns: *this
-   basic_string& assign(BOOST_RV_REF(basic_string) ms) 
+   basic_string& assign(BOOST_RV_REF(basic_string) ms) BOOST_CONTAINER_NOEXCEPT
    {  return this->swap_data(ms), *this;  }
 
    //! Requires: pos <= str.size()
@@ -1185,11 +1223,11 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > str.size().
    //!
    //! Returns: *this
-   basic_string& assign(const basic_string& s, 
-                        size_type pos, size_type n) {
+   basic_string& assign(const basic_string& s, size_type pos, size_type n)
+   {
       if (pos > s.size())
       this->throw_out_of_range();
-      return this->assign(s.begin() + pos, 
+      return this->assign(s.begin() + pos,
                           s.begin() + pos + container_detail::min_value(n, s.size() - pos));
    }
 
@@ -1199,7 +1237,7 @@ class basic_string
    //! length n whose elements are a copy of those pointed to by s.
    //!
    //! Throws: If memory allocation throws or length_error if n > max_size().
-   //!    
+   //!   
    //! Returns: *this
    basic_string& assign(const CharT* s, size_type n)
    {  return this->assign(s, s + n);   }
@@ -1222,12 +1260,29 @@ class basic_string
    //!
    //! Returns: *this
    template 
-   basic_string& assign(InputIter first, InputIter last) 
+   basic_string& assign(InputIter first, InputIter last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      return this->priv_assign_dispatch(first, last, Result());
+      size_type cur = 0;
+      const pointer addr = this->priv_addr();
+      CharT *ptr = container_detail::to_raw_pointer(addr);
+      const size_type old_size = this->priv_size();
+      while (first != last && cur != old_size) {
+         Traits::assign(*ptr, *first);
+         ++first;
+         ++cur;
+         ++ptr;
+      }
+      if (first == last)
+         this->erase(addr + cur, addr + old_size);
+      else
+         this->append(first, last);
+      return *this;
    }
 
    //! Requires: pos <= size().
@@ -1237,11 +1292,12 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const basic_string& s) 
+   basic_string& insert(size_type pos, const basic_string& s)
    {
-      if (pos > size())
+      const size_type sz = this->size();
+      if (pos > sz)
          this->throw_out_of_range();
-      if (this->size() > this->max_size() - s.size())
+      if (sz > this->max_size() - s.size())
          this->throw_length_error();
       this->insert(this->priv_addr() + pos, s.begin(), s.end());
       return *this;
@@ -1255,13 +1311,14 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos1 > size() or pos2 > str.size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos1, const basic_string& s,
-                        size_type pos2, size_type n) 
+   basic_string& insert(size_type pos1, const basic_string& s, size_type pos2, size_type n)
    {
-      if (pos1 > this->size() || pos2 > s.size())
+      const size_type sz = this->size();
+      const size_type str_size = s.size();
+      if (pos1 > sz || pos2 > str_size)
          this->throw_out_of_range();
-      size_type len = container_detail::min_value(n, s.size() - pos2);
-      if (this->size() > this->max_size() - len)
+      size_type len = container_detail::min_value(n, str_size - pos2);
+      if (sz > this->max_size() - len)
          this->throw_length_error();
       const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2;
       const CharT *end_ptr = beg_ptr + len;
@@ -1280,7 +1337,7 @@ class basic_string
    //!   length_error if size() + n > max_size().
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const CharT* s, size_type n) 
+   basic_string& insert(size_type pos, const CharT* s, size_type n)
    {
       if (pos > this->size())
          this->throw_out_of_range();
@@ -1298,9 +1355,9 @@ class basic_string
    //!   length_error if size() > max_size() - Traits::length(s)
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, const CharT* s) 
+   basic_string& insert(size_type pos, const CharT* s)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
       size_type len = Traits::length(s);
       if (this->size() > this->max_size() - len)
@@ -1315,7 +1372,7 @@ class basic_string
    //!   length_error if size() > max_size() - n
    //!
    //! Returns: *this
-   basic_string& insert(size_type pos, size_type n, CharT c) 
+   basic_string& insert(size_type pos, size_type n, CharT c)
    {
       if (pos > this->size())
          this->throw_out_of_range();
@@ -1330,9 +1387,9 @@ class basic_string
    //! Effects: inserts a copy of c before the character referred to by p.
    //!
    //! Returns: An iterator which refers to the copy of the inserted character.
-   iterator insert(const_iterator p, CharT c) 
+   iterator insert(const_iterator p, CharT c)
    {
-      size_type new_offset = p - this->priv_addr() + 1;
+      size_type new_offset = p - this->priv_addr();
       this->insert(p, cvalue_iterator(c, 1), cvalue_iterator());
       return this->priv_addr() + new_offset;
    }
@@ -1342,28 +1399,144 @@ class basic_string
    //!
    //! Effects: Inserts n copies of c before the character referred to by p.
    //!
-   //! Returns: An iterator which refers to the copy of the first
-   //!   inserted character, or p if n == 0.
-   void insert(const_iterator p, size_type n, CharT c)
-   {
-      this->insert(p, cvalue_iterator(c, n), cvalue_iterator());
-   }
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   iterator insert(const_iterator p, size_type n, CharT c)
+   {  return this->insert(p, cvalue_iterator(c, n), cvalue_iterator());  }
 
    //! Requires: p is a valid iterator on *this. [first,last) is a valid range.
    //!
    //! Effects: Equivalent to insert(p - begin(), basic_string(first, last)).
    //!
-   //! Returns: An iterator which refers to the copy of the first
-   //!   inserted character, or p if first == last.
+   //! Returns: an iterator to the first inserted element or p if first == last.
    template 
-   void insert(const_iterator p, InputIter first, InputIter last) 
+   iterator insert(const_iterator p, InputIter first, InputIter last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(p, first, last, Result());
+      const size_type n_pos = p - this->cbegin();
+      for ( ; first != last; ++first, ++p) {
+         p = this->insert(p, *first);
+      }
+      return this->begin() + n_pos; 
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator p, ForwardIter first, ForwardIter last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      const size_type n_pos = p - this->cbegin();
+      if (first != last) {
+         const size_type n = std::distance(first, last);
+         const size_type old_size = this->priv_size();
+         const size_type remaining = this->capacity() - old_size;
+         const pointer old_start = this->priv_addr();
+         bool enough_capacity = false;
+         std::pair allocation_ret;
+         size_type new_cap = 0;
+
+         //Check if we have enough capacity
+         if (remaining >= n){
+            enough_capacity = true;           
+         }
+         else {
+            //Otherwise expand current buffer or allocate new storage
+            new_cap  = this->next_capacity(n);
+            allocation_ret = this->allocation_command
+                  (allocate_new | expand_fwd | expand_bwd, old_size + n + 1,
+                     new_cap, new_cap, old_start);
+
+            //Check forward expansion
+            if(old_start == allocation_ret.first){
+               enough_capacity = true;
+               this->priv_storage(new_cap);
+            }
+         }
+
+         //Reuse same buffer
+         if(enough_capacity){
+            const size_type elems_after = old_size - (p - old_start);
+            const size_type old_length = old_size;
+            if (elems_after >= n) {
+               const pointer pointer_past_last = old_start + old_size + 1;
+               priv_uninitialized_copy(old_start + (old_size - n + 1),
+                                       pointer_past_last, pointer_past_last);
+
+               this->priv_size(old_size+n);
+               Traits::move(const_cast(container_detail::to_raw_pointer(p + n)),
+                           container_detail::to_raw_pointer(p),
+                           (elems_after - n) + 1);
+               this->priv_copy(first, last, const_cast(container_detail::to_raw_pointer(p)));
+            }
+            else {
+               ForwardIter mid = first;
+               std::advance(mid, elems_after + 1);
+
+               priv_uninitialized_copy(mid, last, old_start + old_size + 1);
+               const size_type newer_size = old_size + (n - elems_after);
+               this->priv_size(newer_size);
+               priv_uninitialized_copy
+                  (p, const_iterator(old_start + old_length + 1),
+                  old_start + newer_size);
+               this->priv_size(newer_size + elems_after);
+               this->priv_copy(first, mid, const_cast(container_detail::to_raw_pointer(p)));
+            }
+         }
+         else{
+            pointer new_start = allocation_ret.first;
+            if(!allocation_ret.second){
+               //Copy data to new buffer
+               size_type new_length = 0;
+               //This can't throw, since characters are POD
+               new_length += priv_uninitialized_copy
+                              (const_iterator(old_start), p, new_start);
+               new_length += priv_uninitialized_copy
+                              (first, last, new_start + new_length);
+               new_length += priv_uninitialized_copy
+                              (p, const_iterator(old_start + old_size),
+                              new_start + new_length);
+               this->priv_construct_null(new_start + new_length);
+
+               this->deallocate_block();
+               this->is_short(false);
+               this->priv_long_addr(new_start);
+               this->priv_long_size(new_length);
+               this->priv_long_storage(new_cap);
+            }
+            else{
+               //value_type is POD, so backwards expansion is much easier
+               //than with vector
+               value_type * const oldbuf     = container_detail::to_raw_pointer(old_start);
+               value_type * const newbuf     = container_detail::to_raw_pointer(new_start);
+               const value_type *const pos   = container_detail::to_raw_pointer(p);
+               const size_type before  = pos - oldbuf;
+
+               //First move old data
+               Traits::move(newbuf, oldbuf, before);
+               Traits::move(newbuf + before + n, pos, old_size - before);
+               //Now initialize the new data
+               priv_uninitialized_copy(first, last, new_start + before);
+               this->priv_construct_null(new_start + (old_size + n));
+               this->is_short(false);
+               this->priv_long_addr(new_start);
+               this->priv_long_size(old_size + n);
+               this->priv_long_storage(new_cap);
+            }
+         }
+      }
+      return this->begin() + n_pos;
+   }
+   #endif
+
    //! Requires: pos <= size()
    //!
    //! Effects: Determines the effective length xlen of the string to be removed as the smaller of n and size() - pos.
@@ -1375,13 +1548,14 @@ class basic_string
    //! Throws: out_of_range if pos > size().
    //!
    //! Returns: *this
-   basic_string& erase(size_type pos = 0, size_type n = npos) 
+   basic_string& erase(size_type pos = 0, size_type n = npos)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      erase(this->priv_addr() + pos, this->priv_addr() + pos + container_detail::min_value(n, size() - pos));
+      const pointer addr = this->priv_addr();
+      erase(addr + pos, addr + pos + container_detail::min_value(n, this->size() - pos));
       return *this;
-   }  
+   } 
 
    //! Effects: Removes the character referred to by p.
    //!
@@ -1389,14 +1563,15 @@ class basic_string
    //!
    //! Returns: An iterator which points to the element immediately following p prior to the element being
    //!    erased. If no such element exists, end() is returned.
-   iterator erase(const_iterator p) 
+   iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT
    {
       // The move includes the terminating null.
-      CharT *ptr = const_cast(container_detail::to_raw_pointer(p));
+      CharT * const ptr = const_cast(container_detail::to_raw_pointer(p));
+      const size_type old_size = this->priv_size();
       Traits::move(ptr,
-                   container_detail::to_raw_pointer(p + 1), 
-                   this->priv_size() - (p - this->priv_addr()));
-      this->priv_size(this->priv_size()-1);
+                   container_detail::to_raw_pointer(p + 1),
+                   old_size - (p - this->priv_addr()));
+      this->priv_size(old_size-1);
       return iterator(ptr);
    }
 
@@ -1408,15 +1583,16 @@ class basic_string
    //!
    //! Returns: An iterator which points to the element pointed to by last prior to
    //!   the other elements being erased. If no such element exists, end() is returned.
-   iterator erase(const_iterator first, const_iterator last)
+   iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
    {
       CharT * f = const_cast(container_detail::to_raw_pointer(first));
       if (first != last) { // The move includes the terminating null.
-         size_type num_erased = last - first;
+         const size_type num_erased = last - first;
+         const size_type old_size = this->priv_size();
          Traits::move(f,
-                      container_detail::to_raw_pointer(last), 
-                      (this->priv_size() + 1)-(last - this->priv_addr()));
-         size_type new_length = this->priv_size() - num_erased;
+                      container_detail::to_raw_pointer(last),
+                      (old_size + 1)-(last - this->priv_addr()));
+         const size_type new_length = old_size - num_erased;
          this->priv_size(new_length);
       }
       return iterator(f);
@@ -1427,10 +1603,24 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Effects: Equivalent to erase(size() - 1, 1).
-   void pop_back()
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
-      Traits::assign(this->priv_addr()[this->priv_size()-1], this->priv_null());
-      this->priv_size(this->priv_size()-1);;
+      const size_type old_size = this->priv_size();
+      Traits::assign(this->priv_addr()[old_size-1], CharT(0));
+      this->priv_size(old_size-1);;
+   }
+
+   //! Effects: Erases all the elements of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Linear to the number of elements in the vector.
+   void clear() BOOST_CONTAINER_NOEXCEPT
+   {
+      if (!this->empty()) {
+         Traits::assign(*this->priv_addr(), CharT(0));
+         this->priv_size(0);
+      }
    }
 
    //! Requires: pos1 <= size().
@@ -1440,15 +1630,17 @@ class basic_string
    //! Throws: if memory allocation throws or out_of_range if pos1 > size().
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1, const basic_string& str) 
+   basic_string& replace(size_type pos1, size_type n1, const basic_string& str)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
       if (this->size() - len >= this->max_size() - str.size())
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, 
-                           str.begin(), str.end());
+      const pointer addr = this->priv_addr();
+      return this->replace( const_iterator(addr + pos1)
+                          , const_iterator(addr + pos1 + len)
+                          , str.begin(), str.end());
    }
 
    //! Requires: pos1 <= size() and pos2 <= str.size().
@@ -1461,42 +1653,43 @@ class basic_string
    //!
    //! Returns: *this
    basic_string& replace(size_type pos1, size_type n1,
-                         const basic_string& str, size_type pos2, size_type n2) 
+                         const basic_string& str, size_type pos2, size_type n2)
    {
-      if (pos1 > size() || pos2 > str.size())
+      if (pos1 > this->size() || pos2 > str.size())
          this->throw_out_of_range();
-      const size_type len1 = container_detail::min_value(n1, size() - pos1);
+      const size_type len1 = container_detail::min_value(n1, this->size() - pos1);
       const size_type len2 = container_detail::min_value(n2, str.size() - pos2);
       if (this->size() - len1 >= this->max_size() - len2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len1,
-                     str.priv_addr() + pos2, str.priv_addr() + pos2 + len2);
+      const pointer addr    = this->priv_addr();
+      const pointer straddr = str.priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len1,
+                     straddr + pos2, straddr + pos2 + len2);
    }
 
    //! Requires: pos1 <= size() and s points to an array of at least n2 elements of CharT.
    //!
-   //! Effects: Determines the effective length xlen of the string to be removed as the 
-   //!   smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error. 
-   //!   Otherwise, the function replaces the string controlled by *this with a string of 
-   //!   length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements 
-   //!   of the original string controlled by *this, whose next n2 elements are a copy of the 
-   //!   initial n2 elements of s, and whose remaining elements are a copy of the elements of 
+   //! Effects: Determines the effective length xlen of the string to be removed as the
+   //!   smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error.
+   //!   Otherwise, the function replaces the string controlled by *this with a string of
+   //!   length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements
+   //!   of the original string controlled by *this, whose next n2 elements are a copy of the
+   //!   initial n2 elements of s, and whose remaining elements are a copy of the elements of
    //!   the original string controlled by *this beginning at position pos + xlen.
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the  resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1,
-                        const CharT* s, size_type n2) 
+   basic_string& replace(size_type pos1, size_type n1, const CharT* s, size_type n2)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
       if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
-                     s, s + n2);
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len, s, s + n2);
    }
 
    //! Requires: pos1 <= size() and s points to an array of at least n2 elements of CharT.
@@ -1509,19 +1702,20 @@ class basic_string
    //! remaining elements are a copy of the elements of the original string controlled by *this
    //! beginning at position pos + xlen.
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos, size_type n1, const CharT* s) 
+   basic_string& replace(size_type pos, size_type n1, const CharT* s)
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos);
+      const size_type len = container_detail::min_value(n1, this->size() - pos);
       const size_type n2 = Traits::length(s);
-      if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
+      if (n2 > this->max_size() || this->size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos, this->priv_addr() + pos + len,
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos, addr + pos + len,
                      s, s + Traits::length(s));
    }
 
@@ -1529,18 +1723,19 @@ class basic_string
    //!
    //! Effects: Equivalent to replace(pos1, n1, basic_string(n2, c)).
    //!
-   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error 
+   //! Throws: if memory allocation throws, out_of_range if pos1 > size() or length_error
    //!   if the length of the  resulting string would exceed max_size()
    //!
    //! Returns: *this
-   basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c) 
+   basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c)
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n1, size() - pos1);
-      if (n2 > this->max_size() || size() - len >= this->max_size() - n2)
+      const size_type len = container_detail::min_value(n1, this->size() - pos1);
+      if (n2 > this->max_size() || this->size() - len >= this->max_size() - n2)
          this->throw_length_error();
-      return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len, n2, c);
+      const pointer addr    = this->priv_addr();
+      return this->replace(addr + pos1, addr + pos1 + len, n2, c);
    }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges.
@@ -1550,10 +1745,10 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str)
    { return this->replace(i1, i2, str.begin(), str.end()); }
 
-   //! Requires: [begin(),i1) and [i1,i2) are valid ranges and 
+   //! Requires: [begin(),i1) and [i1,i2) are valid ranges and
    //!   s points to an array of at least n elements
    //!
    //! Effects: Calls replace(i1 - begin(), i2 - i1, s, n).
@@ -1561,7 +1756,7 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n)
    { return this->replace(i1, i2, s, s + n); }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges and s points to an
@@ -1572,7 +1767,7 @@ class basic_string
    //! Throws: if memory allocation throws
    //!
    //! Returns: *this
-   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s) 
+   basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s)
    {  return this->replace(i1, i2, s, s + Traits::length(s));   }
 
    //! Requires: [begin(),i1) and [i1,i2) are valid ranges.
@@ -1604,35 +1799,72 @@ class basic_string
    //!
    //! Returns: *this
    template 
-   basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2) 
+   basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      return this->priv_replace_dispatch(i1, i2, j1, j2,  Result());
+      for ( ; i1 != i2 && j1 != j2; ++i1, ++j1){
+         Traits::assign(*const_cast(container_detail::to_raw_pointer(i1)), *j1);
+      }
+
+      if (j1 == j2)
+         this->erase(i1, i2);
+      else
+         this->insert(i2, j1, j2);
+      return *this;
    }
 
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   basic_string& replace(const_iterator i1, const_iterator i2, ForwardIter j1, ForwardIter j2
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      difference_type n = std::distance(j1, j2);
+      const difference_type len = i2 - i1;
+      if (len >= n) {
+         this->priv_copy(j1, j2, const_cast(container_detail::to_raw_pointer(i1)));
+         this->erase(i1 + n, i2);
+      }
+      else {
+         ForwardIter m = j1;
+         std::advance(m, len);
+         this->priv_copy(j1, m, const_cast(container_detail::to_raw_pointer(i1)));
+         this->insert(i2, m, j2);
+      }
+      return *this;
+   }
+   #endif
+
    //! Requires: pos <= size()
    //!
    //! Effects: Determines the effective length rlen of the string to copy as the
    //!   smaller of n and size() - pos. s shall designate an array of at least rlen elements.
-   //!   The function then replaces the string designated by s with a string of length rlen 
+   //!   The function then replaces the string designated by s with a string of length rlen
    //!   whose elements are a copy of the string controlled by *this beginning at position pos.
    //!   The function does not append a null object to the string designated by s.
    //!
    //! Throws: if memory allocation throws, out_of_range if pos > size().
    //!
    //! Returns: rlen
-   size_type copy(CharT* s, size_type n, size_type pos = 0) const 
+   size_type copy(CharT* s, size_type n, size_type pos = 0) const
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      const size_type len = container_detail::min_value(n, size() - pos);
+      const size_type len = container_detail::min_value(n, this->size() - pos);
       Traits::copy(s, container_detail::to_raw_pointer(this->priv_addr() + pos), len);
       return len;
    }
 
-   //! Effects: *this contains the same sequence of characters that was in s, 
+   //! Effects: *this contains the same sequence of characters that was in s,
    //!   s contains the same sequence of characters that was in *this.
    //!
    //! Throws: Nothing
@@ -1643,30 +1875,42 @@ class basic_string
       container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
+   //////////////////////////////////////////////
+   //
+   //                 data access
+   //
+   //////////////////////////////////////////////
+
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
-   //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
+   //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
    //!
    //! Complexity: constant time.
-   const CharT* c_str() const 
+   const CharT* c_str() const BOOST_CONTAINER_NOEXCEPT
    {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
    //! Requires: The program shall not alter any of the values stored in the character array.
    //!
-   //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
+   //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
    //!
    //! Complexity: constant time.
-   const CharT* data()  const 
+   const CharT* data()  const BOOST_CONTAINER_NOEXCEPT
    {  return container_detail::to_raw_pointer(this->priv_addr()); }
 
-   //! Effects: Determines the lowest position xpos, if possible, such that both 
+   //////////////////////////////////////////////
+   //
+   //             string operations
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Determines the lowest position xpos, if possible, such that both
    //!   of the following conditions obtain: 19 pos <= xpos and xpos + str.size() <= size();
    //!   2) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
    //!
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find(const basic_string& s, size_type pos = 0) const 
+   size_type find(const basic_string& s, size_type pos = 0) const
    { return find(s.c_str(), pos, s.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1676,12 +1920,13 @@ class basic_string
    //! Returns: find(basic_string(s,n),pos).
    size_type find(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos + n > size())
+      if (pos + n > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
+         const pointer addr = this->priv_addr();
+         pointer finish = addr + this->priv_size();
          const const_iterator result =
-            std::search(container_detail::to_raw_pointer(this->priv_addr() + pos), 
+            std::search(container_detail::to_raw_pointer(addr + pos),
                    container_detail::to_raw_pointer(finish),
                    s, s + n, Eq_traits());
          return result != finish ? result - begin() : npos;
@@ -1693,26 +1938,28 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find(basic_string(s), pos).
-   size_type find(const CharT* s, size_type pos = 0) const 
-   { return find(s, pos, Traits::length(s)); }
+   size_type find(const CharT* s, size_type pos = 0) const
+   { return this->find(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
    //!
    //! Returns: find(basic_string(1,c), pos).
    size_type find(CharT c, size_type pos = 0) const
    {
-      if (pos >= size())
+      const size_type sz = this->size();
+      if (pos >= sz)
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
+         const pointer addr    = this->priv_addr();
+         pointer finish = addr + sz;
          const const_iterator result =
-            std::find_if(this->priv_addr() + pos, finish,
+            std::find_if(addr + pos, finish,
                   std::bind2nd(Eq_traits(), c));
          return result != finish ? result - begin() : npos;
       }
    }
 
-   //! Effects: Determines the highest position xpos, if possible, such 
+   //! Effects: Determines the highest position xpos, if possible, such
    //!   that both of the following conditions obtain:
    //!   a) xpos <= pos and xpos + str.size() <= size();
    //!   b) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
@@ -1720,7 +1967,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type rfind(const basic_string& str, size_type pos = npos) const 
+   size_type rfind(const basic_string& str, size_type pos = npos) const
       { return rfind(str.c_str(), pos, str.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1730,7 +1977,7 @@ class basic_string
    //! Returns: rfind(basic_string(s, n), pos).
    size_type rfind(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (n > len)
          return npos;
@@ -1745,13 +1992,13 @@ class basic_string
       }
    }
 
-   //! Requires: pos <= size() and s points to an array of at least 
+   //! Requires: pos <= size() and s points to an array of at least
    //!   traits::length(s) + 1 elements of CharT.
    //!
    //! Throws: Nothing
    //!
    //! Returns: rfind(basic_string(s), pos).
-   size_type rfind(const CharT* s, size_type pos = npos) const 
+   size_type rfind(const CharT* s, size_type pos = npos) const
       { return rfind(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
@@ -1759,7 +2006,7 @@ class basic_string
    //! Returns: rfind(basic_string(1,c),pos).
    size_type rfind(CharT c, size_type pos = npos) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
@@ -1779,7 +2026,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find_first_of(const basic_string& s, size_type pos = 0) const 
+   size_type find_first_of(const basic_string& s, size_type pos = 0) const
       { return find_first_of(s.c_str(), pos, s.size()); }
 
    //! Requires: s points to an array of at least n elements of CharT.
@@ -1789,14 +2036,15 @@ class basic_string
    //! Returns: find_first_of(basic_string(s, n), pos).
    size_type find_first_of(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos >= size())
+      const size_type sz = this->size();
+      if (pos >= sz)
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result = std::find_first_of(this->priv_addr() + pos, finish,
-                                                    s, s + n,
-                                                    Eq_traits());
-         return result != finish ? result - begin() : npos;
+         const pointer addr    = this->priv_addr();
+         pointer finish = addr + sz;
+         const_iterator result = std::find_first_of
+            (addr + pos, finish, s, s + n, Eq_traits());
+         return result != finish ? result - this->begin() : npos;
       }
    }
 
@@ -1805,7 +2053,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_of(basic_string(s), pos).
-   size_type find_first_of(const CharT* s, size_type pos = 0) const 
+   size_type find_first_of(const CharT* s, size_type pos = 0) const
       { return find_first_of(s, pos, Traits::length(s)); }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1813,10 +2061,10 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_of(basic_string(1,c), pos).
-   size_type find_first_of(CharT c, size_type pos = 0) const 
+   size_type find_first_of(CharT c, size_type pos = 0) const
     { return find(c, pos); }
 
-   //! Effects: Determines the highest position xpos, if possible, such that both of 
+   //! Effects: Determines the highest position xpos, if possible, such that both of
    //!   the following conditions obtain: a) xpos <= pos and xpos < size(); b)
    //!   traits::eq(at(xpos), str.at(I)) for some element I of the string controlled by str.
    //!
@@ -1833,17 +2081,17 @@ class basic_string
    //! Returns: find_last_of(basic_string(s, n), pos).
    size_type find_last_of(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
       else {
-         const const_iterator last = this->priv_addr() + container_detail::min_value(len - 1, pos) + 1;
+         const pointer addr    = this->priv_addr();
+         const const_iterator last = addr + container_detail::min_value(len - 1, pos) + 1;
          const const_reverse_iterator rresult =
             std::find_first_of(const_reverse_iterator(last), rend(),
-                               s, s + n,
-                               Eq_traits());
-         return rresult != rend() ? (rresult.base() - 1) - this->priv_addr() : npos;
+                               s, s + n, Eq_traits());
+         return rresult != rend() ? (rresult.base() - 1) - addr : npos;
       }
    }
 
@@ -1852,16 +2100,16 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_last_of(basic_string(1,c),pos).
-   size_type find_last_of(const CharT* s, size_type pos = npos) const 
+   size_type find_last_of(const CharT* s, size_type pos = npos) const
       { return find_last_of(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
    //!
    //! Returns: find_last_of(basic_string(s), pos).
-   size_type find_last_of(CharT c, size_type pos = npos) const 
+   size_type find_last_of(CharT c, size_type pos = npos) const
       {  return rfind(c, pos);   }
 
-   //! Effects: Determines the lowest position xpos, if possible, such that 
+   //! Effects: Determines the lowest position xpos, if possible, such that
    //!   both of the following conditions obtain:
    //!   a) pos <= xpos and xpos < size(); b) traits::eq(at(xpos), str.at(I)) for no
    //!   element I of the string controlled by str.
@@ -1869,7 +2117,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
-   size_type find_first_not_of(const basic_string& str, size_type pos = 0) const 
+   size_type find_first_not_of(const basic_string& str, size_type pos = 0) const
       { return find_first_not_of(str.c_str(), pos, str.size()); }
 
    //! Requires: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1879,13 +2127,14 @@ class basic_string
    //! Returns: find_first_not_of(basic_string(s, n), pos).
    size_type find_first_not_of(const CharT* s, size_type pos, size_type n) const
    {
-      if (pos > size())
+      if (pos > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result = std::find_if(this->priv_addr() + pos, finish,
-                                    Not_within_traits(s, s + n));
-         return result != finish ? result - this->priv_addr() : npos;
+         const pointer addr   = this->priv_addr();
+         const pointer finish = addr + this->priv_size();
+         const const_iterator result = std::find_if
+            (addr + pos, finish, Not_within_traits(s, s + n));
+         return result != finish ? result - addr : npos;
       }
    }
 
@@ -1894,7 +2143,7 @@ class basic_string
    //! Throws: Nothing
    //!
    //! Returns: find_first_not_of(basic_string(s), pos).
-   size_type find_first_not_of(const CharT* s, size_type pos = 0) const 
+   size_type find_first_not_of(const CharT* s, size_type pos = 0) const
       { return find_first_not_of(s, pos, Traits::length(s)); }
 
    //! Throws: Nothing
@@ -1902,19 +2151,20 @@ class basic_string
    //! Returns: find_first_not_of(basic_string(1, c), pos).
    size_type find_first_not_of(CharT c, size_type pos = 0) const
    {
-      if (pos > size())
+      if (pos > this->size())
          return npos;
       else {
-         pointer finish = this->priv_addr() + this->priv_size();
-         const_iterator result
-            = std::find_if(this->priv_addr() + pos, finish,
+         const pointer addr   = this->priv_addr();
+         const pointer finish = addr + this->priv_size();
+         const const_iterator result
+            = std::find_if(addr + pos, finish,
                      std::not1(std::bind2nd(Eq_traits(), c)));
          return result != finish ? result - begin() : npos;
       }
    }
 
    //! Effects: Determines the highest position xpos, if possible, such that
-   //!   both of the following conditions obtain: a) xpos <= pos and xpos < size(); 
+   //!   both of the following conditions obtain: a) xpos <= pos and xpos < size();
    //!   b) traits::eq(at(xpos), str.at(I)) for no element I of the string controlled by str.
    //!
    //! Throws: Nothing
@@ -1930,7 +2180,7 @@ class basic_string
    //! Returns: find_last_not_of(basic_string(s, n), pos).
    size_type find_last_not_of(const CharT* s, size_type pos, size_type n) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
@@ -1956,13 +2206,13 @@ class basic_string
    //! Returns: find_last_not_of(basic_string(1, c), pos).
    size_type find_last_not_of(CharT c, size_type pos = npos) const
    {
-      const size_type len = size();
+      const size_type len = this->size();
 
       if (len < 1)
          return npos;
       else {
          const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1;
-         const_reverse_iterator rresult =
+         const const_reverse_iterator rresult =
             std::find_if(const_reverse_iterator(last), rend(),
                   std::not1(std::bind2nd(Eq_traits(), c)));
          return rresult != rend() ? (rresult.base() - 1) - begin() : npos;
@@ -1977,12 +2227,13 @@ class basic_string
    //! Throws: If memory allocation throws or out_of_range if pos > size().
    //!
    //! Returns: basic_string(data()+pos,rlen).
-   basic_string substr(size_type pos = 0, size_type n = npos) const 
+   basic_string substr(size_type pos = 0, size_type n = npos) const
    {
-      if (pos > size())
+      if (pos > this->size())
          this->throw_out_of_range();
-      return basic_string(this->priv_addr() + pos, 
-                          this->priv_addr() + pos + container_detail::min_value(n, size() - pos), this->alloc());
+      const pointer addr = this->priv_addr();
+      return basic_string(addr + pos,
+                          addr + pos + container_detail::min_value(n, size() - pos), this->alloc());
    }
 
    //! Effects: Determines the effective length rlen of the string to copy as
@@ -1994,8 +2245,12 @@ class basic_string
    //! Returns: The nonzero result if the result of the comparison is nonzero.
    //!   Otherwise, returns a value < 0 if size() < str.size(), a 0 value if size() == str.size(),
    //!   and value > 0 if size() > str.size()
-   int compare(const basic_string& str) const 
-   { return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), str.priv_addr(), str.priv_addr() + str.priv_size()); }
+   int compare(const basic_string& str) const
+   {
+      const pointer addr     = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr, addr + this->priv_size(), str_addr, str_addr + str.priv_size());
+   }
 
    //! Requires: pos1 <= size()
    //!
@@ -2005,16 +2260,18 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns:basic_string(*this,pos1,n1).compare(str).
-   int compare(size_type pos1, size_type n1, const basic_string& str) const 
+   int compare(size_type pos1, size_type n1, const basic_string& str) const
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
-                        str.priv_addr(), str.priv_addr() + str.priv_size());
+      const pointer addr    = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
+                        str_addr, str_addr + str.priv_size());
    }
 
-   //! Requires: pos1 <= size() and pos2 <= str.size() 
+   //! Requires: pos1 <= size() and pos2 <= str.size()
    //!
    //! Effects: Determines the effective length rlen of the string to copy as
    //!   the smaller of
@@ -2022,21 +2279,26 @@ class basic_string
    //! Throws: out_of_range if pos1 > size() or pos2 > str.size()
    //!
    //! Returns: basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2)).
-   int compare(size_type pos1, size_type n1, 
-               const basic_string& str, size_type pos2, size_type n2) const {
-      if (pos1 > size() || pos2 > str.size())
+   int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2) const
+   {
+      if (pos1 > this->size() || pos2 > str.size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
-                        str.priv_addr() + pos2, 
-                        str.priv_addr() + pos2 + container_detail::min_value(n2, size() - pos2));
+      const pointer addr     = this->priv_addr();
+      const pointer str_addr = str.priv_addr();
+      return s_compare(addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
+                        str_addr + pos2,
+                        str_addr + pos2 + container_detail::min_value(n2, str.size() - pos2));
    }
 
    //! Throws: Nothing
    //!
    //! Returns: compare(basic_string(s)).
-   int compare(const CharT* s) const 
-   {  return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), s, s + Traits::length(s));   }
+   int compare(const CharT* s) const
+   {
+      const pointer addr = this->priv_addr();
+      return s_compare(addr, addr + this->priv_size(), s, s + Traits::length(s));
+   }
 
 
    //! Requires: pos1 > size() and s points to an array of at least n2 elements of CharT.
@@ -2044,13 +2306,13 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
-   int compare(size_type pos1, size_type n1,
-               const CharT* s, size_type n2) const 
+   int compare(size_type pos1, size_type n1, const CharT* s, size_type n2) const
    {
-      if (pos1 > size())
+      if (pos1 > this->size())
          this->throw_out_of_range();
-      return s_compare(this->priv_addr() + pos1, 
-                        this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
+      const pointer addr = this->priv_addr();
+      return s_compare( addr + pos1,
+                        addr + pos1 + container_detail::min_value(n1, this->size() - pos1),
                         s, s + n2);
    }
 
@@ -2059,18 +2321,18 @@ class basic_string
    //! Throws: out_of_range if pos1 > size()
    //!
    //! Returns: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
-   int compare(size_type pos1, size_type n1, const CharT* s) const 
+   int compare(size_type pos1, size_type n1, const CharT* s) const
    {  return this->compare(pos1, n1, s, Traits::length(s)); }
 
    /// @cond
    private:
    static int s_compare(const_pointer f1, const_pointer l1,
-                        const_pointer f2, const_pointer l2) 
+                        const_pointer f2, const_pointer l2)
    {
       const difference_type n1 = l1 - f1;
       const difference_type n2 = l2 - f2;
-      const int cmp = Traits::compare(container_detail::to_raw_pointer(f1), 
-                                      container_detail::to_raw_pointer(f2), 
+      const int cmp = Traits::compare(container_detail::to_raw_pointer(f1),
+                                      container_detail::to_raw_pointer(f2),
                                       container_detail::min_value(n1, n2));
       return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
    }
@@ -2082,12 +2344,12 @@ class basic_string
    {
       //Allocate a new buffer.
       size_type real_cap = 0;
-      pointer   long_addr    = this->priv_long_addr();
-      size_type long_size    = this->priv_long_size();
-      size_type long_storage = this->priv_long_storage();
+      const pointer   long_addr    = this->priv_long_addr();
+      const size_type long_size    = this->priv_long_size();
+      const size_type long_storage = this->priv_long_storage();
       //We can make this nothrow as chars are always NoThrowCopyables
-      try{
-         std::pair ret = this->allocation_command
+      BOOST_TRY{
+         const std::pair ret = this->allocation_command
                (allocate_new, long_size+1, long_size+1, real_cap, long_addr);
          //Copy and update
          Traits::copy( container_detail::to_raw_pointer(ret.first)
@@ -2098,14 +2360,15 @@ class basic_string
          //And release old buffer
          this->alloc().deallocate(long_addr, long_storage);
       }
-      catch(...){
+      BOOST_CATCH(...){
          return;
       }
+      BOOST_CATCH_END
    }
 
    template
    void priv_shrink_to_fit_dynamic_buffer
-      ( AllocVersion 
+      ( AllocVersion
       , typename container_detail::enable_if >::type* = 0)
    {
       size_type received_size;
@@ -2118,56 +2381,13 @@ class basic_string
    }
 
    void priv_construct_null(pointer p)
-   {  this->construct(p, 0);  }
-
-   static CharT priv_null()
-   {  return (CharT) 0; }
+   {  this->construct(p, CharT(0));  }
 
    // Helper functions used by constructors.  It is a severe error for
    // any of them to be called anywhere except from within constructors.
-   void priv_terminate_string() 
-   {  this->priv_construct_null(this->priv_addr() + this->priv_size());  }
+   void priv_terminate_string()
+   {  this->priv_construct_null(this->priv_end_addr());  }
 
-   template 
-   void priv_range_initialize(InputIter f, InputIter l,
-                              std::input_iterator_tag)
-   {
-      this->allocate_initial_block(InternalBufferChars);
-      this->priv_construct_null(this->priv_addr() + this->priv_size());
-      this->append(f, l);
-   }
-
-   template 
-   void priv_range_initialize(ForwardIter f, ForwardIter l, 
-                              std::forward_iterator_tag)
-   {
-      difference_type n = std::distance(f, l);
-      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
-      priv_uninitialized_copy(f, l, this->priv_addr());
-      this->priv_size(n);
-      this->priv_terminate_string();
-   }
-
-   template 
-   void priv_range_initialize(InputIter f, InputIter l)
-   {
-      typedef typename std::iterator_traits::iterator_category Category;
-      this->priv_range_initialize(f, l, Category());
-   }
-
-   template 
-   void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
-   {
-      this->allocate_initial_block(container_detail::max_value(n+1, InternalBufferChars));
-      priv_uninitialized_fill_n(this->priv_addr(), n, x);
-      this->priv_size(n);
-      this->priv_terminate_string();
-   }
-
-   template 
-   void priv_initialize_dispatch(InputIter f, InputIter l, container_detail::false_)
-   {  this->priv_range_initialize(f, l);  }
- 
    template inline
    void priv_uninitialized_fill_n(FwdIt first, Count count, const CharT val)
    {
@@ -2214,154 +2434,6 @@ class basic_string
       return (constructed);
    }
 
-   template 
-   basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_) 
-   {  return this->assign((size_type) n, (CharT) x);   }
-
-   template 
-   basic_string& priv_assign_dispatch(InputIter f, InputIter l,
-                                      container_detail::false_)
-   {
-      size_type cur = 0;
-      CharT *ptr = container_detail::to_raw_pointer(this->priv_addr());
-      while (f != l && cur != this->priv_size()) {
-         Traits::assign(*ptr, *f);
-         ++f;
-         ++cur;
-         ++ptr;
-      }
-      if (f == l)
-         this->erase(this->priv_addr() + cur, this->priv_addr() + this->priv_size());
-      else
-         this->append(f, l);
-      return *this;
-   }
-
-   template 
-   void priv_insert(const_iterator p, InputIter first, InputIter last, std::input_iterator_tag)
-   {
-      for ( ; first != last; ++first, ++p) {
-         p = this->insert(p, *first);
-      }
-   }
-
-   template 
-   void priv_insert(const_iterator position, ForwardIter first, 
-                    ForwardIter last,  std::forward_iterator_tag)
-   {
-      if (first != last) {
-         size_type n = std::distance(first, last);
-         size_type remaining = this->capacity() - this->priv_size();
-         const size_type old_size = this->size();
-         pointer old_start = this->priv_addr();
-         bool enough_capacity = false;
-         std::pair allocation_ret;
-         size_type new_cap = 0;
-
-         //Check if we have enough capacity
-         if (remaining >= n){
-            enough_capacity = true;            
-         }
-         else {
-            //Otherwise expand current buffer or allocate new storage
-            new_cap  = this->next_capacity(n);
-            allocation_ret = this->allocation_command
-                  (allocate_new | expand_fwd | expand_bwd, old_size + n + 1, 
-                     new_cap, new_cap, old_start);
-
-            //Check forward expansion
-            if(old_start == allocation_ret.first){
-               enough_capacity = true;
-               this->priv_storage(new_cap);
-            }
-         }
-
-         //Reuse same buffer
-         if(enough_capacity){
-            const size_type elems_after =
-               this->priv_size() - (position - this->priv_addr());
-            size_type old_length = this->priv_size();
-            if (elems_after >= n) {
-               pointer pointer_past_last = this->priv_addr() + this->priv_size() + 1;
-               priv_uninitialized_copy(this->priv_addr() + (this->priv_size() - n + 1),
-                                       pointer_past_last, pointer_past_last);
-
-               this->priv_size(this->priv_size()+n);
-               Traits::move(const_cast(container_detail::to_raw_pointer(position + n)),
-                           container_detail::to_raw_pointer(position),
-                           (elems_after - n) + 1);
-               this->priv_copy(first, last, const_cast(container_detail::to_raw_pointer(position)));
-            }
-            else {
-               ForwardIter mid = first;
-               std::advance(mid, elems_after + 1);
-
-               priv_uninitialized_copy(mid, last, this->priv_addr() + this->priv_size() + 1);
-               this->priv_size(this->priv_size() + (n - elems_after));
-               priv_uninitialized_copy
-                  (position, const_iterator(this->priv_addr() + old_length + 1),
-                  this->priv_addr() + this->priv_size());
-               this->priv_size(this->priv_size() + elems_after);
-               this->priv_copy(first, mid, const_cast(container_detail::to_raw_pointer(position)));
-            }
-         }
-         else{
-            pointer new_start = allocation_ret.first;
-            if(!allocation_ret.second){
-               //Copy data to new buffer
-               size_type new_length = 0;
-               //This can't throw, since characters are POD
-               new_length += priv_uninitialized_copy
-                              (const_iterator(this->priv_addr()), position, new_start);
-               new_length += priv_uninitialized_copy
-                              (first, last, new_start + new_length);
-               new_length += priv_uninitialized_copy
-                              (position, const_iterator(this->priv_addr() + this->priv_size()),
-                              new_start + new_length);
-               this->priv_construct_null(new_start + new_length);
-
-               this->deallocate_block();
-               this->is_short(false);
-               this->priv_long_addr(new_start);
-               this->priv_long_size(new_length);
-               this->priv_long_storage(new_cap);
-            }
-            else{
-               //value_type is POD, so backwards expansion is much easier 
-               //than with vector
-               value_type *oldbuf = container_detail::to_raw_pointer(old_start);
-               value_type *newbuf = container_detail::to_raw_pointer(new_start);
-               const value_type *pos    = container_detail::to_raw_pointer(position);
-               size_type  before  = pos - oldbuf;
-
-               //First move old data
-               Traits::move(newbuf, oldbuf, before);
-               Traits::move(newbuf + before + n, pos, old_size - before);
-               //Now initialize the new data
-               priv_uninitialized_copy(first, last, new_start + before);
-               this->priv_construct_null(new_start + (old_size + n));
-               this->is_short(false);
-               this->priv_long_addr(new_start);
-               this->priv_long_size(old_size + n);
-               this->priv_long_storage(new_cap);
-            }
-         }
-      }
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator p, Integer n, Integer x,
-                           container_detail::true_) 
-   {  insert(p, (size_type) n, (CharT) x);   }
-
-   template 
-   void priv_insert_dispatch(const_iterator p, InputIter first, InputIter last,
-                           container_detail::false_) 
-   {
-      typedef typename std::iterator_traits::iterator_category Category;
-      priv_insert(p, first, last, Category());
-   }
-
    template 
    void priv_copy(InputIterator first, InputIterator last, OutIterator result)
    {
@@ -2369,58 +2441,24 @@ class basic_string
          Traits::assign(*result, *first);
    }
 
-   void priv_copy(const CharT* first, const CharT* last, CharT* result) 
+   void priv_copy(const CharT* first, const CharT* last, CharT* result)
    {  Traits::copy(result, first, last - first);  }
 
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        Integer n, Integer x,
-                                       container_detail::true_) 
+                                       container_detail::true_)
    {  return this->replace(first, last, (size_type) n, (CharT) x);   }
 
    template 
    basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
                                        InputIter f, InputIter l,
-                                       container_detail::false_) 
+                                       container_detail::false_)
    {
       typedef typename std::iterator_traits::iterator_category Category;
       return this->priv_replace(first, last, f, l, Category());
    }
 
-
-   template 
-   basic_string& priv_replace(const_iterator first, const_iterator last,
-                              InputIter f, InputIter l, std::input_iterator_tag)
-   {
-      for ( ; first != last && f != l; ++first, ++f)
-         Traits::assign(*first, *f);
-
-      if (f == l)
-         this->erase(first, last);
-      else
-         this->insert(last, f, l);
-      return *this;
-   }
-
-   template 
-   basic_string& priv_replace(const_iterator first, const_iterator last,
-                              ForwardIter f, ForwardIter l, 
-                              std::forward_iterator_tag)
-   {
-      difference_type n = std::distance(f, l);
-      const difference_type len = last - first;
-      if (len >= n) {
-         this->priv_copy(f, l, const_cast(container_detail::to_raw_pointer(first)));
-         this->erase(first + n, last);
-      }
-      else {
-         ForwardIter m = f;
-         std::advance(m, len);
-         this->priv_copy(f, m, const_cast(container_detail::to_raw_pointer(first)));
-         this->insert(last, m, l);
-      }
-      return *this;
-   }
    /// @endcond
 };
 
@@ -2440,291 +2478,221 @@ typedef basic_string
    ,std::allocator >
 wstring;
 
-/// @cond
-
-template  
-const typename basic_string::size_type 
-basic_string::npos 
-  = (typename basic_string::size_type) -1;
-
-/// @endcond
-
 // ------------------------------------------------------------
 // Non-member functions.
 
 // Operator+
 
-template 
-inline basic_string
-operator+(const basic_string& x,
-          const basic_string& y)
+template  inline 
+   basic_string
+   operator+(const basic_string& x
+            ,const basic_string& y)
 {
-   typedef basic_string str_t;
+   typedef basic_string str_t;
    typedef typename str_t::reserve_t reserve_t;
    reserve_t reserve;
    str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
    result.append(x);
    result.append(y);
-   return boost::move(result);
+   return result;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(
-   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-   , BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline
+   basic_string operator+
+      ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END mx
+      , BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END my)
 {
    mx += my;
    return boost::move(mx);
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(
-   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-   , const basic_string& y)
+template  inline
+   basic_string operator+
+      ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END mx
+      , const basic_string& y)
 {
    mx += y;
    return boost::move(mx);
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-   operator+(const basic_string& x,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline
+   basic_string operator+
+      (const basic_string& x
+      ,BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END my)
 {
-   typedef typename basic_string::size_type size_type;
-   my.replace(size_type(0), size_type(0), x);
+   my.insert(my.begin(), x.begin(), x.end());
    return boost::move(my);
 }
 
-template 
-inline basic_string
-operator+(const CharT* s, const basic_string& y) 
+template  inline
+   basic_string operator+
+      (const CharT* s, basic_string y)
 {
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   const typename str_t::size_type n = Traits::length(s);
-   str_t result(reserve, n + y.size());
-   result.append(s, s + n);
-   result.append(y);
-   return boost::move(result);
+   y.insert(y.begin(), s, s + Traits::length(s));
+   return y;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(const CharT* s,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline 
+   basic_string operator+
+      (basic_string x, const CharT* s)
 {
-   typedef typename basic_string::size_type size_type;
-   return boost::move(my.replace(size_type(0), size_type(0), s));
+   x += s;
+   return x;
 }
 
-template 
-inline basic_string
-operator+(CharT c, const basic_string& y) 
+template  inline
+   basic_string operator+
+      (CharT c, basic_string y)
 {
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   str_t result(reserve, 1 + y.size());
-   result.push_back(c);
-   result.append(y);
-   return boost::move(result);
+   y.insert(y.begin(), c);
+   return y;
 }
 
-template  inline
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(CharT c,
-         BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+template  inline 
+   basic_string operator+
+      (basic_string x, const CharT c)
 {
-   typedef typename basic_string::size_type size_type;
-   return boost::move(my.replace(size_type(0), size_type(0), &c, &c + 1));
-}
-
-template 
-inline basic_string
-operator+(const basic_string& x, const CharT* s) 
-{
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   const typename str_t::size_type n = Traits::length(s);
-   str_t result(reserve, x.size() + n, x.get_stored_allocator());
-   result.append(x);
-   result.append(s, s + n);
-   return boost::move(result);
-}
-
-template 
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-         , const CharT* s)
-{
-   mx += s;
-   return boost::move(mx);
-}
-
-template 
-inline basic_string
-operator+(const basic_string& x, const CharT c) 
-{
-   typedef basic_string str_t;
-   typedef typename str_t::reserve_t reserve_t;
-   reserve_t reserve;
-   str_t result(reserve, x.size() + 1, x.get_stored_allocator());
-   result.append(x);
-   result.push_back(c);
-   return boost::move(result);
-}
-
-template 
-BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+( BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
-         , const CharT c)
-{
-   mx += c;
-   return boost::move(mx);
+   x += c;
+   return x;
 }
 
 // Operator== and operator!=
 
-template 
+template 
 inline bool
-operator==(const basic_string& x,
-           const basic_string& y) 
+operator==(const basic_string& x,
+           const basic_string& y)
 {
    return x.size() == y.size() &&
           Traits::compare(x.data(), y.data(), x.size()) == 0;
 }
 
-template 
+template 
 inline bool
-operator==(const CharT* s, const basic_string& y) 
+operator==(const CharT* s, const basic_string& y)
 {
-   typename basic_string::size_type n = Traits::length(s);
+   typename basic_string::size_type n = Traits::length(s);
    return n == y.size() && Traits::compare(s, y.data(), n) == 0;
 }
 
-template 
+template 
 inline bool
-operator==(const basic_string& x, const CharT* s) 
+operator==(const basic_string& x, const CharT* s)
 {
-   typename basic_string::size_type n = Traits::length(s);
+   typename basic_string::size_type n = Traits::length(s);
    return x.size() == n && Traits::compare(x.data(), s, n) == 0;
 }
 
-template 
+template 
 inline bool
-operator!=(const basic_string& x,
-           const basic_string& y) 
+operator!=(const basic_string& x,
+           const basic_string& y)
    {  return !(x == y);  }
 
-template 
+template 
 inline bool
-operator!=(const CharT* s, const basic_string& y) 
+operator!=(const CharT* s, const basic_string& y)
    {  return !(s == y); }
 
-template 
+template 
 inline bool
-operator!=(const basic_string& x, const CharT* s) 
+operator!=(const basic_string& x, const CharT* s)
    {  return !(x == s);   }
 
 
 // Operator< (and also >, <=, and >=).
 
-template 
+template 
 inline bool
-operator<(const basic_string& x, const basic_string& y) 
+operator<(const basic_string& x, const basic_string& y)
 {
    return x.compare(y) < 0;
-//   return basic_string
+//   return basic_string
 //      ::s_compare(x.begin(), x.end(), y.begin(), y.end()) < 0;
 }
 
-template 
+template 
 inline bool
-operator<(const CharT* s, const basic_string& y) 
+operator<(const CharT* s, const basic_string& y)
 {
    return y.compare(s) > 0;
-//   basic_string::size_type n = Traits::length(s);
-//   return basic_string
+//   basic_string::size_type n = Traits::length(s);
+//   return basic_string
 //          ::s_compare(s, s + n, y.begin(), y.end()) < 0;
 }
 
-template 
+template 
 inline bool
-operator<(const basic_string& x,
-          const CharT* s) 
+operator<(const basic_string& x,
+          const CharT* s)
 {
    return x.compare(s) < 0;
-//   basic_string::size_type n = Traits::length(s);
-//   return basic_string
+//   basic_string::size_type n = Traits::length(s);
+//   return basic_string
 //      ::s_compare(x.begin(), x.end(), s, s + n) < 0;
 }
 
-template 
+template 
 inline bool
-operator>(const basic_string& x,
-          const basic_string& y) {
+operator>(const basic_string& x,
+          const basic_string& y) {
    return y < x;
 }
 
-template 
+template 
 inline bool
-operator>(const CharT* s, const basic_string& y) {
+operator>(const CharT* s, const basic_string& y) {
    return y < s;
 }
 
-template 
+template 
 inline bool
-operator>(const basic_string& x, const CharT* s) 
+operator>(const basic_string& x, const CharT* s)
 {
    return s < x;
 }
 
-template 
+template 
 inline bool
-operator<=(const basic_string& x,
-           const basic_string& y) 
+operator<=(const basic_string& x,
+           const basic_string& y)
 {
   return !(y < x);
 }
 
-template 
+template 
 inline bool
-operator<=(const CharT* s, const basic_string& y) 
+operator<=(const CharT* s, const basic_string& y)
    {  return !(y < s);  }
 
-template 
+template 
 inline bool
-operator<=(const basic_string& x, const CharT* s) 
+operator<=(const basic_string& x, const CharT* s)
    {  return !(s < x);  }
 
-template 
+template 
 inline bool
-operator>=(const basic_string& x,
-           const basic_string& y) 
+operator>=(const basic_string& x,
+           const basic_string& y)
    {  return !(x < y);  }
 
-template 
+template 
 inline bool
-operator>=(const CharT* s, const basic_string& y) 
+operator>=(const CharT* s, const basic_string& y)
    {  return !(s < y);  }
 
-template 
+template 
 inline bool
-operator>=(const basic_string& x, const CharT* s) 
+operator>=(const basic_string& x, const CharT* s)
    {  return !(x < s);  }
 
 // Swap.
-template 
-inline void swap(basic_string& x, basic_string& y) 
+template 
+inline void swap(basic_string& x, basic_string& y)
 {  x.swap(y);  }
 
 /// @cond
-// I/O.  
+// I/O. 
 namespace container_detail {
 
 template 
@@ -2745,28 +2713,28 @@ string_fill(std::basic_ostream& os,
 }  //namespace container_detail {
 /// @endcond
 
-template 
+template 
 std::basic_ostream&
-operator<<(std::basic_ostream& os, const basic_string& s)
+operator<<(std::basic_ostream& os, const basic_string& s)
 {
    typename std::basic_ostream::sentry sentry(os);
    bool ok = false;
 
    if (sentry) {
       ok = true;
-      typename basic_string::size_type n = s.size();
-      typename basic_string::size_type pad_len = 0;
+      typename basic_string::size_type n = s.size();
+      typename basic_string::size_type pad_len = 0;
       const bool left = (os.flags() & std::ios::left) != 0;
       const std::size_t w = os.width(0);
       std::basic_streambuf* buf = os.rdbuf();
 
       if (w != 0 && n < w)
          pad_len = w - n;
-       
+      
       if (!left)
-         ok = container_detail::string_fill(os, buf, pad_len);    
+         ok = container_detail::string_fill(os, buf, pad_len);   
 
-      ok = ok && 
+      ok = ok &&
             buf->sputn(s.data(), std::streamsize(n)) == std::streamsize(n);
 
       if (left)
@@ -2780,9 +2748,9 @@ operator<<(std::basic_ostream& os, const basic_string
-std::basic_istream& 
-operator>>(std::basic_istream& is, basic_string& s)
+template 
+std::basic_istream&
+operator>>(std::basic_istream& is, basic_string& s)
 {
    typename std::basic_istream::sentry sentry(is);
 
@@ -2816,7 +2784,7 @@ operator>>(std::basic_istream& is, basic_string&
                s.push_back(c);
          }
       }
-      
+     
       // If we have read no characters, then set failbit.
       if (s.size() == 0)
          is.setstate(std::ios_base::failbit);
@@ -2827,11 +2795,11 @@ operator>>(std::basic_istream& is, basic_string&
    return is;
 }
 
-template     
-std::basic_istream& 
-getline(std::istream& is, basic_string& s,CharT delim)
+template    
+std::basic_istream&
+getline(std::istream& is, basic_string& s,CharT delim)
 {
-   typename basic_string::size_type nread = 0;
+   typename basic_string::size_type nread = 0;
    typename std::basic_istream::sentry sentry(is, true);
    if (sentry) {
       std::basic_streambuf* buf = is.rdbuf();
@@ -2846,7 +2814,7 @@ getline(std::istream& is, basic_string& s,CharT delim)
          else {
             ++nread;
             CharT c = Traits::to_char_type(c1);
-            if (!Traits::eq(c, delim)) 
+            if (!Traits::eq(c, delim))
                s.push_back(c);
             else
                break;              // Character is extracted but not appended.
@@ -2859,15 +2827,15 @@ getline(std::istream& is, basic_string& s,CharT delim)
    return is;
 }
 
-template     
-inline std::basic_istream& 
-getline(std::basic_istream& is, basic_string& s)
+template    
+inline std::basic_istream&
+getline(std::basic_istream& is, basic_string& s)
 {
    return getline(is, s, '\n');
 }
 
-template 
-inline std::size_t hash_value(basic_string, A> const& v)
+template 
+inline std::size_t hash_value(basic_string, Allocator> const& v)
 {
    return hash_range(v.begin(), v.end());
 }
@@ -2877,15 +2845,14 @@ inline std::size_t hash_value(basic_string, A> const& v
 /// @cond
 
 namespace boost {
-/*
+
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
-*/
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
+
 }
 
 /// @endcond
diff --git a/project/jni/boost/include/boost/container/vector.hpp b/project/jni/boost/include/boost/container/vector.hpp
index 742d00d37..3c4c9c50e 100644
--- a/project/jni/boost/include/boost/container/vector.hpp
+++ b/project/jni/boost/include/boost/container/vector.hpp
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -32,20 +32,23 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 namespace boost {
 namespace container {
@@ -54,7 +57,7 @@ namespace container {
 
 namespace container_detail {
 
-//! Const vector_iterator used to iterate through a vector. 
+//! Const vector_iterator used to iterate through a vector.
 template 
 class vector_const_iterator
 {
@@ -81,20 +84,20 @@ class vector_const_iterator
    vector_const_iterator() : m_ptr(0){}
 
    //Pointer like operators
-   reference operator*()   const  
+   reference operator*()   const 
    {  return *m_ptr;  }
 
-   const value_type * operator->()  const  
-   {  return  container_detail::to_raw_pointer(m_ptr);  }
+   const value_type * operator->()  const 
+   {  return container_detail::to_raw_pointer(m_ptr);  }
 
    reference operator[](difference_type off) const
    {  return m_ptr[off];   }
 
    //Increment / Decrement
-   vector_const_iterator& operator++()       
+   vector_const_iterator& operator++()      
    { ++m_ptr;  return *this; }
 
-   vector_const_iterator operator++(int)      
+   vector_const_iterator operator++(int)     
    {  Pointer tmp = m_ptr; ++*this; return vector_const_iterator(tmp);  }
 
    vector_const_iterator& operator--()
@@ -164,22 +167,22 @@ class vector_iterator
    {}
 
    //Pointer like operators
-   reference operator*()  const  
+   reference operator*()  const 
    {  return *this->m_ptr;  }
 
-   value_type* operator->() const  
+   value_type* operator->() const 
    {  return  container_detail::to_raw_pointer(this->m_ptr);  }
 
-   reference operator[](difference_type off) const 
+   reference operator[](difference_type off) const
    {  return this->m_ptr[off];   }
 
    //Increment / Decrement
-   vector_iterator& operator++()  
+   vector_iterator& operator++() 
    {  ++this->m_ptr; return *this;  }
 
    vector_iterator operator++(int)
    {  pointer tmp = this->m_ptr; ++*this; return vector_iterator(tmp);  }
-   
+  
    vector_iterator& operator--()
    {  --this->m_ptr; return *this;  }
 
@@ -206,14 +209,13 @@ class vector_iterator
    {  return static_cast&>(*this) - right;   }
 };
 
-template 
+template 
 struct vector_value_traits
 {
    typedef T value_type;
-   typedef A allocator_type;
+   typedef Allocator allocator_type;
    static const bool trivial_dctr = boost::has_trivial_destructor::value;
-   static const bool trivial_dctr_after_move = trivial_dctr;
-      //::boost::has_trivial_destructor_after_move::value || trivial_dctr;
+   static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move::value;
    //static const bool trivial_copy = has_trivial_copy::value;
    //static const bool nothrow_copy = has_nothrow_copy::value;
    //static const bool trivial_assign = has_trivial_assign::value;
@@ -228,37 +230,37 @@ struct vector_value_traits
    //to deallocate values already constructed
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   OldArrayDestructor;
    //This is the anti-exception array destructor
    //to destroy objects created with copy construction
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_destructor_n
+      ,container_detail::null_scoped_destructor_n
+      ,container_detail::scoped_destructor_n
       >::type   ArrayDestructor;
    //This is the anti-exception array deallocator
    typedef typename container_detail::if_c
       
-      ,container_detail::scoped_array_deallocator
+      ,container_detail::null_scoped_array_deallocator
+      ,container_detail::scoped_array_deallocator
       >::type   ArrayDeallocator;
 };
 
 //!This struct deallocates and allocated memory
-template 
-struct vector_alloc_holder 
+template 
+struct vector_alloc_holder
 {
-   typedef boost::container::allocator_traits         allocator_traits_type;
+   typedef boost::container::allocator_traits allocator_traits_type;
    typedef typename allocator_traits_type::pointer       pointer;
    typedef typename allocator_traits_type::size_type     size_type;
    typedef typename allocator_traits_type::value_type    value_type;
-   typedef vector_value_traits            value_traits;
+   typedef vector_value_traits    value_traits;
 
    //Constructor, does not throw
    vector_alloc_holder()
-      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
       : members_()
    {}
 
@@ -278,53 +280,28 @@ struct vector_alloc_holder
    typedef container_detail::integral_constant      allocator_v1;
    typedef container_detail::integral_constant      allocator_v2;
    typedef container_detail::integral_constant::value> alloc_version;
+      boost::container::container_detail::version::value> alloc_version;
    std::pair
       allocation_command(allocation_type command,
-                         size_type limit_size, 
+                         size_type limit_size,
                          size_type preferred_size,
                          size_type &received_size, const pointer &reuse = 0)
    {
-      return allocation_command(command, limit_size, preferred_size,
-                               received_size, reuse, alloc_version());
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v1)
-   {
-      (void)limit_size;
-      (void)reuse;
-      if(!(command & allocate_new))
-         return std::pair(pointer(0), false);
-      received_size = preferred_size;
-      return std::make_pair(this->alloc().allocate(received_size), false);
-   }
-
-   std::pair
-      allocation_command(allocation_type command,
-                         size_type limit_size, 
-                         size_type preferred_size,
-                         size_type &received_size,
-                         const pointer &reuse,
-                         allocator_v2)
-   {
-      return this->alloc().allocation_command
-         (command, limit_size, preferred_size, received_size, reuse);
+      return allocator_version_traits::allocation_command
+         (this->alloc(), command, limit_size, preferred_size, received_size, reuse);
    }
 
    size_type next_capacity(size_type additional_objects) const
    {
+      std::size_t num_objects   = this->members_.m_size + additional_objects;
+      std::size_t next_cap = this->members_.m_capacity + this->members_.m_capacity/2;
+      return num_objects > next_cap ? num_objects : next_cap;/*
       return get_next_capacity( allocator_traits_type::max_size(this->alloc())
-                              , this->members_.m_capacity, additional_objects);
+                              , this->members_.m_capacity, additional_objects);*/
    }
 
    struct members_holder
-      : public A
+      : public Allocator
    {
       private:
       members_holder(const members_holder&);
@@ -332,11 +309,11 @@ struct vector_alloc_holder
       public:
       template
       explicit members_holder(BOOST_FWD_REF(Alloc) alloc)
-         :  A(boost::forward(alloc)), m_start(0), m_size(0), m_capacity(0)
+         :  Allocator(boost::forward(alloc)), m_start(0), m_size(0), m_capacity(0)
       {}
 
       members_holder()
-         :  A(), m_start(0), m_size(0), m_capacity(0)
+         :  Allocator(), m_start(0), m_size(0), m_capacity(0)
       {}
 
       pointer     m_start;
@@ -351,10 +328,10 @@ struct vector_alloc_holder
       container_detail::do_swap(this->members_.m_capacity, x.members_.m_capacity);
    }
 
-   A &alloc()
+   Allocator &alloc()
    {  return members_;  }
 
-   const A &alloc() const
+   const Allocator &alloc() const
    {  return members_;  }
 
    protected:
@@ -393,88 +370,79 @@ struct vector_alloc_holder
 /// @endcond
 
 //! \class vector
-//! A vector is a sequence that supports random access to elements, constant 
-//! time insertion and removal of elements at the end, and linear time insertion 
-//! and removal of elements at the beginning or in the middle. The number of 
+//! A vector is a sequence that supports random access to elements, constant
+//! time insertion and removal of elements at the end, and linear time insertion
+//! and removal of elements at the beginning or in the middle. The number of
 //! elements in a vector may vary dynamically; memory management is automatic.
 //! boost::container::vector is similar to std::vector but it's compatible
 //! with shared memory and memory mapped files.
 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template  >
+template  >
 #else
-template 
+template 
 #endif
-class vector : private container_detail::vector_alloc_holder
+class vector : private container_detail::vector_alloc_holder
 {
    /// @cond
-   typedef vector                   self_t;
-   typedef container_detail::vector_alloc_holder base_t;
-   typedef allocator_traits            allocator_traits_type;
+   typedef container_detail::vector_alloc_holder base_t;
+   typedef allocator_traits            allocator_traits_type;
    /// @endcond
    public:
-   //! The type of object, T, stored in the vector
-   typedef T                                                value_type;
-   //! Pointer to T
-   typedef typename allocator_traits_type::pointer          pointer;
-   //! Const pointer to T
-   typedef typename allocator_traits_type::const_pointer    const_pointer;
-   //! Reference to T
-   typedef typename allocator_traits_type::reference        reference;
-   //! Const reference to T
-   typedef typename allocator_traits_type::const_reference  const_reference;
-   //! An unsigned integral type
-   typedef typename allocator_traits_type::size_type        size_type;
-   //! A signed integral type
-   typedef typename allocator_traits_type::difference_type  difference_type;
-   //! The allocator type
-   typedef A                                       allocator_type;
-   //! The random access iterator
-   typedef container_detail::vector_iterator        iterator;
-   //! The random access const_iterator
-   typedef container_detail::vector_const_iterator  const_iterator;
+   //////////////////////////////////////////////
+   //
+   //                    types
+   //
+   //////////////////////////////////////////////
 
-   //! Iterator used to iterate backwards through a vector. 
-   typedef std::reverse_iterator   
-      reverse_iterator;
-   //! Const iterator used to iterate backwards through a vector. 
-   typedef std::reverse_iterator                 
-      const_reverse_iterator;
-   //! The stored allocator type
-   typedef allocator_type                          stored_allocator_type;
+   typedef T                                                                           value_type;
+   typedef typename ::boost::container::allocator_traits::pointer           pointer;
+   typedef typename ::boost::container::allocator_traits::const_pointer     const_pointer;
+   typedef typename ::boost::container::allocator_traits::reference         reference;
+   typedef typename ::boost::container::allocator_traits::const_reference   const_reference;
+   typedef typename ::boost::container::allocator_traits::size_type         size_type;
+   typedef typename ::boost::container::allocator_traits::difference_type   difference_type;
+   typedef Allocator                                                                   allocator_type;
+   typedef Allocator                                                                   stored_allocator_type;
+   typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_iterator)          iterator;
+   typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_const_iterator)    const_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)                     reverse_iterator;
+   typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator)               const_reverse_iterator;
 
    /// @cond
    private:
    BOOST_COPYABLE_AND_MOVABLE(vector)
-   typedef container_detail::advanced_insert_aux_int    advanced_insert_aux_int_t;
-   typedef container_detail::vector_value_traits value_traits;
+   typedef container_detail::vector_value_traits value_traits;
 
    typedef typename base_t::allocator_v1           allocator_v1;
    typedef typename base_t::allocator_v2           allocator_v2;
    typedef typename base_t::alloc_version          alloc_version;
 
    typedef constant_iterator   cvalue_iterator;
-   typedef repeat_iterator     repeat_it;
-   typedef boost::move_iterator         repeat_move_it;
    /// @endcond
 
    public:
+   //////////////////////////////////////////////
+   //
+   //          construct/copy/destroy
+   //
+   //////////////////////////////////////////////
 
    //! Effects: Constructs a vector taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: If allocator_type's default constructor throws.
-   //! 
+   //!
    //! Complexity: Constant.
    vector()
-      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
+      BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value)
       : base_t()
    {}
 
    //! Effects: Constructs a vector taking the allocator as parameter.
-   //! 
+   //!
    //! Throws: Nothing
-   //! 
+   //!
    //! Complexity: Constant.
-   explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
+   explicit vector(const Allocator& a) BOOST_CONTAINER_NOEXCEPT
       : base_t(a)
    {}
 
@@ -483,62 +451,22 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Throws: If allocator_type's default constructor or allocation
    //!   throws or T's default constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
    explicit vector(size_type n)
       :  base_t()
-   {
-      //Allocate
-      size_type real_cap;
-      std::pair ret =
-         this->allocation_command(allocate_new, n, n, real_cap, this->members_.m_start);
-      T *new_mem = container_detail::to_raw_pointer(ret.first);
-      //Anti-exception rollback
-      typename value_traits::ArrayDeallocator scoped_alloc(new_mem, this->alloc(), real_cap);
-      //Default constructor
-      container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-      proxy.uninitialized_copy_remaining_to(new_mem);
-      //All ok, commit
-      this->members_.m_start = ret.first;
-      this->members_.m_size  = n;
-      this->members_.m_capacity = real_cap;
-      scoped_alloc.release();
-   }
+   {  this->resize(n);  }
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts n copies of value.
    //!
    //! Throws: If allocator_type's default constructor or allocation
    //!   throws or T's copy constructor throws.
-   //! 
+   //!
    //! Complexity: Linear to n.
-   vector(size_type n, const T& value, const allocator_type& a = allocator_type()) 
+   vector(size_type n, const T& value, const allocator_type& a = allocator_type())
       :  base_t(a)
-   {  this->insert(this->cend(), n, value); }
-
-   //! Effects: Copy constructs a vector.
-   //!
-   //! Postcondition: x == *this.
-   //! 
-   //! Throws: If allocator_type's default constructor or allocation
-   //!   throws or T's copy constructor throws.
-   //! 
-   //! Complexity: Linear to the elements x contains.
-   vector(const vector &x) 
-      :  base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
-   {
-      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
-                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
-   }
-
-   //! Effects: Move constructor. Moves mx's resources to *this.
-   //!
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
-      :  base_t(boost::move(mx.alloc()))
-   {  this->swap_members(mx);   }
+   {  this->resize(n, value); }
 
    //! Effects: Constructs a vector that will use a copy of allocator a
    //!   and inserts a copy of the range [first, last) in the vector.
@@ -552,6 +480,64 @@ class vector : private container_detail::vector_alloc_holder
       :  base_t(a)
    {  this->assign(first, last); }
 
+   //! Effects: Copy constructs a vector.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocator_type's default constructor or allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   vector(const vector &x)
+      :  base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
+   {
+      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+   }
+
+   //! Effects: Move constructor. Moves mx's resources to *this.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
+      :  base_t(boost::move(mx.alloc()))
+   {  this->swap_members(mx);   }
+
+   //! Effects: Copy constructs a vector using the specified allocator.
+   //!
+   //! Postcondition: x == *this.
+   //!
+   //! Throws: If allocation
+   //!   throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the elements x contains.
+   vector(const vector &x, const allocator_type &a)
+      :  base_t(a)
+   {
+      this->assign( container_detail::to_raw_pointer(x.members_.m_start)
+                  , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
+   }
+
+   //! Effects: Move constructor using the specified allocator.
+   //!                 Moves mx's resources to *this if a == allocator_type().
+   //!                 Otherwise copies values from x to *this.
+   //!
+   //! Throws: If allocation or T's copy constructor throws.
+   //!
+   //! Complexity: Constant if a == mx.get_allocator(), linear otherwise.
+   vector(BOOST_RV_REF(vector) mx, const allocator_type &a)
+      :  base_t(a)
+   {
+      if(mx.alloc() == a){
+         this->swap_members(mx);
+      }
+      else{
+         this->assign( container_detail::to_raw_pointer(mx.members_.m_start)
+                     , container_detail::to_raw_pointer(mx.members_.m_start) + mx.members_.m_size);
+      }
+   }
+
    //! Effects: Destroys the vector. All stored values are destroyed
    //!   and used memory is deallocated.
    //!
@@ -561,340 +547,10 @@ class vector : private container_detail::vector_alloc_holder
    ~vector() BOOST_CONTAINER_NOEXCEPT
    {} //vector_alloc_holder clears the data
 
-   //! Effects: Returns an iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator begin() BOOST_CONTAINER_NOEXCEPT
-   { return iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start); }
-
-   //! Effects: Returns an iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   iterator end() BOOST_CONTAINER_NOEXCEPT
-   { return iterator(this->members_.m_start + this->members_.m_size); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
-   { return this->cend(); }
-
-   //! Effects: Returns a reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
-   { return reverse_iterator(this->end());      }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return this->crbegin(); }
-
-   //! Effects: Returns a reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
-   { return reverse_iterator(this->begin());       }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
-   { return this->crend(); }
-
-   //! Effects: Returns a const_iterator to the first element contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start); }
-
-   //! Effects: Returns a const_iterator to the end of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
-   { return const_iterator(this->members_.m_start + this->members_.m_size); }
-
-   //! Effects: Returns a const_reverse_iterator pointing to the beginning 
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
-   { return const_reverse_iterator(this->end());}
-
-   //! Effects: Returns a const_reverse_iterator pointing to the end
-   //! of the reversed vector. 
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
-   { return const_reverse_iterator(this->begin()); }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference         front() BOOST_CONTAINER_NOEXCEPT
-   { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the first
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference   front() const BOOST_CONTAINER_NOEXCEPT
-   { return *this->members_.m_start; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference         back() BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[this->members_.m_size - 1]; }
-
-   //! Requires: !empty()
-   //!
-   //! Effects: Returns a const reference to the last
-   //!   element of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference   back()  const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[this->members_.m_size - 1]; }
-
-   //! Returns: A pointer such that [data(),data() + size()) is a valid range.
-   //!   For a non-empty vector, data() == &front().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   pointer data() BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start; }
-
-   //! Returns: A pointer such that [data(),data() + size()) is a valid range.
-   //!   For a non-empty vector, data() == &front().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_pointer data()  const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start; }
-
-   //! Effects: Returns the number of the elements contained in the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type size() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_size; }
-
-   //! Effects: Returns the largest possible size of the vector.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
-   { return allocator_traits_type::max_size(this->alloc()); }
-
-   //! Effects: Number of elements for which memory has been allocated.
-   //!   capacity() is always greater than or equal to size().
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_capacity; }
-
-   //! Effects: Returns true if the vector contains no elements.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   bool empty() const BOOST_CONTAINER_NOEXCEPT
-   { return !this->members_.m_size; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   reference operator[](size_type n)         
-   { return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: Nothing.
-   //! 
-   //! Complexity: Constant.
-   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
-   { return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   reference at(size_type n) 
-   { this->priv_check_range(n); return this->members_.m_start[n]; }
-
-   //! Requires: size() > n.
-   //!
-   //! Effects: Returns a const reference to the nth element 
-   //!   from the beginning of the container.
-   //! 
-   //! Throws: std::range_error if n >= size()
-   //! 
-   //! Complexity: Constant.
-   const_reference at(size_type n) const
-   { this->priv_check_range(n); return this->members_.m_start[n]; }
-
-   //! Effects: Returns a copy of the internal allocator.
-   //! 
-   //! Throws: If allocator's copy constructor throws.
-   //! 
-   //! Complexity: Constant.
-   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
-   { return this->alloc();  }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: Returns a reference to the internal allocator.
-   //! 
-   //! Throws: Nothing
-   //! 
-   //! Complexity: Constant.
-   //! 
-   //! Note: Non-standard extension.
-   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
-   {  return this->alloc(); }
-
-   //! Effects: If n is less than or equal to capacity(), this call has no
-   //!   effect. Otherwise, it is a request for allocation of additional memory.
-   //!   If the request is successful, then capacity() is greater than or equal to
-   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
-   //! 
-   //! Throws: If memory allocation allocation throws or T's copy/move constructor throws.
-   void reserve(size_type new_cap)
-   {
-      if (this->capacity() < new_cap){
-         //There is not enough memory, allocate a new
-         //buffer or expand the old one.
-         bool same_buffer_start;
-         size_type real_cap = 0;
-         std::pair ret =
-            this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  new_cap, new_cap, real_cap, this->members_.m_start);
-
-         //Check for forward expansion
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-            ++this->num_expand_fwd;
-            #endif
-            this->members_.m_capacity  = real_cap;
-         }
-
-         //If there is no forward expansion, move objects
-         else{
-            //We will reuse insert code, so create a dummy input iterator
-            T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
-            container_detail::advanced_insert_aux_proxy, T*>
-               proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
-            //Backwards (and possibly forward) expansion
-            if(ret.second){
-               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-               ++this->num_expand_bwd;
-               #endif
-               this->priv_range_insert_expand_backwards
-                  ( container_detail::to_raw_pointer(ret.first)
-                  , real_cap
-                  , container_detail::to_raw_pointer(this->members_.m_start)
-                  , 0
-                  , proxy);
-            }
-            //New buffer
-            else{
-               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-               ++this->num_alloc;
-               #endif
-               this->priv_range_insert_new_allocation
-                  ( container_detail::to_raw_pointer(ret.first)
-                  , real_cap
-                  , container_detail::to_raw_pointer(this->members_.m_start)
-                  , 0
-                  , proxy);
-            }
-         }
-      }
-   }
-
    //! Effects: Makes *this contain the same elements as x.
    //!
-   //! Postcondition: this->size() == x.size(). *this contains a copy 
-   //! of each of x's elements. 
+   //! Postcondition: this->size() == x.size(). *this contains a copy
+   //! of each of x's elements.
    //!
    //! Throws: If memory allocation throws or T's copy/move constructor/assignment throws.
    //!
@@ -951,6 +607,38 @@ class vector : private container_detail::vector_alloc_holder
       return *this;
    }
 
+   //! Effects: Assigns the the range [first, last) to *this.
+   //!
+   //! Throws: If memory allocation throws or T's copy/move constructor/assignment or
+   //!   T's constructor/assignment from dereferencing InpIt throws.
+   //!
+   //! Complexity: Linear to n.
+   template 
+   void assign(InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            //&& container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
+   {
+      //Overwrite all elements we can from [first, last)
+      iterator cur = this->begin();
+      for ( ; first != last && cur != end(); ++cur, ++first){
+         *cur = *first;
+      }
+
+      if (first == last){
+         //There are no more elements in the sequence, erase remaining
+         this->erase(cur, this->cend());
+      }
+      else{
+         //There are more elements in the range, insert the remaining ones
+         this->insert(this->cend(), first, last);
+      }
+   }
+
    //! Effects: Assigns the n copies of val to *this.
    //!
    //! Throws: If memory allocation throws or
@@ -960,21 +648,494 @@ class vector : private container_detail::vector_alloc_holder
    void assign(size_type n, const value_type& val)
    {  this->assign(cvalue_iterator(val, n), cvalue_iterator());   }
 
-   //! Effects: Assigns the the range [first, last) to *this.
+   //! Effects: Returns a copy of the internal allocator.
    //!
-   //! Throws: If memory allocation throws or T's copy/move constructor/assignment or
-   //!   T's constructor/assignment from dereferencing InpIt throws.
+   //! Throws: If allocator's copy constructor throws.
    //!
-   //! Complexity: Linear to n.
-   template 
-   void assign(InIt first, InIt last) 
+   //! Complexity: Constant.
+   allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+   { return this->alloc();  }
+
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //! Effects: Returns a reference to the internal allocator.
+   //!
+   //! Throws: Nothing
+   //!
+   //! Complexity: Constant.
+   //!
+   //! Note: Non-standard extension.
+   const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+   {  return this->alloc(); }
+
+   //////////////////////////////////////////////
+   //
+   //                iterators
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns an iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator begin() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start); }
+
+   //! Effects: Returns an iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   iterator end() BOOST_CONTAINER_NOEXCEPT
+   { return iterator(this->members_.m_start + this->members_.m_size); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+   { return this->cend(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->end());      }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crbegin(); }
+
+   //! Effects: Returns a reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+   { return reverse_iterator(this->begin());       }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+   { return this->crend(); }
+
+   //! Effects: Returns a const_iterator to the first element contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start); }
+
+   //! Effects: Returns a const_iterator to the end of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_iterator(this->members_.m_start + this->members_.m_size); }
+
+   //! Effects: Returns a const_reverse_iterator pointing to the beginning
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->end());}
+
+   //! Effects: Returns a const_reverse_iterator pointing to the end
+   //! of the reversed vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+   { return const_reverse_iterator(this->begin()); }
+
+   //////////////////////////////////////////////
+   //
+   //                capacity
+   //
+   //////////////////////////////////////////////
+
+   //! Effects: Returns true if the vector contains no elements.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   bool empty() const BOOST_CONTAINER_NOEXCEPT
+   { return !this->members_.m_size; }
+
+   //! Effects: Returns the number of the elements contained in the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type size() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_size; }
+
+   //! Effects: Returns the largest possible size of the vector.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+   { return allocator_traits_type::max_size(this->alloc()); }
+
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are default constructed.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size)
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_assign_dispatch(first, last, Result());
+      if (new_size < this->size()){
+         //Destroy last elements
+         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
+      }
+      else{
+         const size_type n = new_size - this->size();
+         this->reserve(new_size);
+         container_detail::insert_default_constructed_n_proxy proxy(this->alloc());
+         this->priv_forward_range_insert(this->cend().get_ptr(), n, proxy);
+      }
    }
 
+   //! Effects: Inserts or erases elements at the end such that
+   //!   the size becomes n. New elements are copy constructed from x.
+   //!
+   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to the difference between size() and new_size.
+   void resize(size_type new_size, const T& x)
+   {
+      pointer finish = this->members_.m_start + this->members_.m_size;
+      if (new_size < size()){
+         //Destroy last elements
+         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
+      }
+      else{
+         //Insert new elements at the end
+         this->insert(const_iterator(finish), new_size - this->size(), x);
+      }
+   }
+
+   //! Effects: Number of elements for which memory has been allocated.
+   //!   capacity() is always greater than or equal to size().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_capacity; }
+
+   //! Effects: If n is less than or equal to capacity(), this call has no
+   //!   effect. Otherwise, it is a request for allocation of additional memory.
+   //!   If the request is successful, then capacity() is greater than or equal to
+   //!   n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+   //!
+   //! Throws: If memory allocation allocation throws or T's copy/move constructor throws.
+   void reserve(size_type new_cap)
+   {
+      if (this->capacity() < new_cap){
+         //There is not enough memory, allocate a new
+         //buffer or expand the old one.
+         bool same_buffer_start;
+         size_type real_cap = 0;
+         std::pair ret =
+            this->allocation_command
+               (allocate_new | expand_fwd | expand_bwd,
+                  new_cap, new_cap, real_cap, this->members_.m_start);
+
+         //Check for forward expansion
+         same_buffer_start = ret.second && this->members_.m_start == ret.first;
+         if(same_buffer_start){
+            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+            ++this->num_expand_fwd;
+            #endif
+            this->members_.m_capacity  = real_cap;
+         }
+
+         //If there is no forward expansion, move objects
+         else{
+            //We will reuse insert code, so create a dummy input iterator
+            container_detail::insert_range_proxy, T*>
+               proxy(this->alloc(), ::boost::make_move_iterator((T *)0));
+            //Backwards (and possibly forward) expansion
+            if(alloc_version::value > 1 && ret.second){
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_expand_bwd;
+               #endif
+               this->priv_range_insert_expand_backwards
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap
+                  , container_detail::to_raw_pointer(this->members_.m_start)
+                  , 0
+                  , proxy);
+            }
+            //New buffer
+            else{
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_alloc;
+               #endif
+               this->priv_range_insert_new_allocation
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap
+                  , container_detail::to_raw_pointer(this->members_.m_start)
+                  , 0
+                  , proxy);
+            }
+         }
+      }
+   }
+
+   //! Effects: Tries to deallocate the excess of memory created
+   //!   with previous allocations. The size of the vector is unchanged
+   //!
+   //! Throws: If memory allocation throws, or T's copy/move constructor throws.
+   //!
+   //! Complexity: Linear to size().
+   void shrink_to_fit()
+   {  this->priv_shrink_to_fit(alloc_version());   }
+
+   //////////////////////////////////////////////
+   //
+   //               element access
+   //
+   //////////////////////////////////////////////
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference         front() BOOST_CONTAINER_NOEXCEPT
+   { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the first
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference   front() const BOOST_CONTAINER_NOEXCEPT
+   { return *this->members_.m_start; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference         back() BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[this->members_.m_size - 1]; }
+
+   //! Requires: !empty()
+   //!
+   //! Effects: Returns a const reference to the last
+   //!   element of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference   back()  const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[this->members_.m_size - 1]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+   { return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   reference at(size_type n)
+   { this->priv_check_range(n); return this->members_.m_start[n]; }
+
+   //! Requires: size() > n.
+   //!
+   //! Effects: Returns a const reference to the nth element
+   //!   from the beginning of the container.
+   //!
+   //! Throws: std::range_error if n >= size()
+   //!
+   //! Complexity: Constant.
+   const_reference at(size_type n) const
+   { this->priv_check_range(n); return this->members_.m_start[n]; }
+
+   //////////////////////////////////////////////
+   //
+   //                 data access
+   //
+   //////////////////////////////////////////////
+
+   //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range.
+   //!   For a non-empty vector, data() == &front().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   T* data() BOOST_CONTAINER_NOEXCEPT
+   { return container_detail::to_raw_pointer(this->members_.m_start); }
+
+   //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range.
+   //!   For a non-empty vector, data() == &front().
+   //!
+   //! Throws: Nothing.
+   //!
+   //! Complexity: Constant.
+   const T * data()  const BOOST_CONTAINER_NOEXCEPT
+   { return container_detail::to_raw_pointer(this->members_.m_start); }
+
+   //////////////////////////////////////////////
+   //
+   //                modifiers
+   //
+   //////////////////////////////////////////////
+
+   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... in the end of the vector.
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor throws.
+   //!
+   //! Complexity: Amortized constant time.
+   template
+   void emplace_back(Args &&...args)
+   {
+      T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+      if (this->members_.m_size < this->members_.m_capacity){
+         //There is more memory, just construct a new object at the end
+         allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward(args)...);
+         ++this->members_.m_size;
+      }
+      else{
+         typedef container_detail::insert_emplace_proxy type;
+         this->priv_forward_range_insert
+            (back_pos, 1, type(this->alloc(), ::boost::forward(args)...));
+      }
+   }
+
+   //! Requires: position must be a valid iterator of *this.
+   //!
+   //! Effects: Inserts an object of type T constructed with
+   //!   std::forward(args)... before position
+   //!
+   //! Throws: If memory allocation throws or the in-place constructor throws or
+   //!   T's move constructor/assignment throws.
+   //!
+   //! Complexity: If position is end(), amortized constant time
+   //!   Linear time otherwise.
+   template
+   iterator emplace(const_iterator position, Args && ...args)
+   {
+      //Just call more general insert(pos, size, value) and return iterator
+      typedef container_detail::insert_emplace_proxy type;
+      return this->priv_forward_range_insert
+         (position.get_ptr(), 1, type(this->alloc(), ::boost::forward(args)...));
+   }
+
+   #else
+
+   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
+   {                                                                                            \
+      T* back_pos = container_detail::to_raw_pointer                                            \
+         (this->members_.m_start) + this->members_.m_size;                                      \
+      if (this->members_.m_size < this->members_.m_capacity){                                   \
+         allocator_traits_type::construct (this->alloc()                                        \
+            , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );        \
+         ++this->members_.m_size;                                                               \
+      }                                                                                         \
+      else{                                                                                     \
+         container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                            \
+             proxy                           \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
+         this->priv_forward_range_insert(back_pos, 1, proxy);                                   \
+      }                                                                                         \
+   }                                                                                            \
+                                                                                                \
+   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
+   iterator emplace(const_iterator pos                                                          \
+                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
+   {                                                                                            \
+      container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                               \
+          proxy                              \
+            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
+      return this->priv_forward_range_insert                                                    \
+         (container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy);                           \
+   }                                                                                            \
+   //!
+   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+   #include BOOST_PP_LOCAL_ITERATE()
+
+   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Effects: Inserts a copy of x at the end of the vector.
    //!
@@ -995,104 +1156,7 @@ class vector : private container_detail::vector_alloc_holder
    #else
    BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
    #endif
-
-   #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... in the end of the vector.
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws or
-   //!   T's move constructor throws.
-   //!
-   //! Complexity: Amortized constant time.
-   template
-   void emplace_back(Args &&...args)
-   {
-      T* back_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
-      if (this->members_.m_size < this->members_.m_capacity){
-         //There is more memory, just construct a new object at the end
-         allocator_traits_type::construct(this->alloc(), back_pos, ::boost::forward(args)...);
-         ++this->members_.m_size;
-      }
-      else{
-         typedef container_detail::advanced_insert_aux_emplace type;
-         type &&proxy = type(this->alloc(), ::boost::forward(args)...);
-         priv_range_insert(back_pos, 1, proxy);
-      }
-   }
-
-   //! Requires: position must be a valid iterator of *this.
-   //!
-   //! Effects: Inserts an object of type T constructed with
-   //!   std::forward(args)... before position
-   //!
-   //! Throws: If memory allocation throws or the in-place constructor throws or
-   //!   T's move constructor/assignment throws.
-   //!
-   //! Complexity: If position is end(), amortized constant time
-   //!   Linear time otherwise.
-   template
-   iterator emplace(const_iterator position, Args && ...args)
-   {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      typedef container_detail::advanced_insert_aux_emplace type;
-      type &&proxy = type(this->alloc(), ::boost::forward(args)...);
-      priv_range_insert(position.get_ptr(), 1, proxy);
-      return iterator(this->members_.m_start + pos_n);
-   }
-
-   #else
-
-   #define BOOST_PP_LOCAL_MACRO(n)                                                              \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
-   void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                        \
-   {                                                                                            \
-      T* back_pos = container_detail::to_raw_pointer                                            \
-         (this->members_.m_start) + this->members_.m_size;                                      \
-      if (this->members_.m_size < this->members_.m_capacity){                                   \
-         allocator_traits_type::construct (this->alloc()                                        \
-            , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );        \
-         ++this->members_.m_size;                                                               \
-      }                                                                                         \
-      else{                                                                                     \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)      \
-             proxy                                   \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
-         priv_range_insert(back_pos, 1, proxy);                                                 \
-      }                                                                                         \
-   }                                                                                            \
-                                                                                                \
-   BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)       \
-   iterator emplace(const_iterator pos                                                          \
-                    BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                \
-   {                                                                                            \
-      size_type pos_n = pos - cbegin();                                                         \
-         container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg)      \
-             proxy                                   \
-            (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));     \
-      priv_range_insert(container_detail::to_raw_pointer(pos.get_ptr()), 1, proxy);             \
-      return iterator(this->members_.m_start + pos_n);                                          \
-   }                                                                                            \
-   //!
-   #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-   #include BOOST_PP_LOCAL_ITERATE()
-
-   #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-  
-   //! Effects: Swaps the contents of *this and x.
-   //!
-   //! Throws: Nothing.
-   //!
-   //! Complexity: Constant.
-   void swap(vector& x)
-   {
-      //Just swap internals
-      this->swap_members(x);
-      //And now the allocator
-      container_detail::bool_ flag;
-      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
-   }
-
+ 
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
    //! Requires: position must be a valid iterator of *this.
    //!
@@ -1117,39 +1181,70 @@ class vector : private container_detail::vector_alloc_holder
    BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
    #endif
 
-   //! Requires: pos must be a valid iterator of *this.
+   //! Requires: p must be a valid iterator of *this.
+   //!
+   //! Effects: Insert n copies of x before pos.
+   //!
+   //! Returns: an iterator to the first inserted element or p if n is 0.
+   //!
+   //! Throws: If memory allocation throws or T's copy constructor throws.
+   //!
+   //! Complexity: Linear to n.
+   iterator insert(const_iterator p, size_type n, const T& x)
+   {
+      container_detail::insert_n_copies_proxy proxy(this->alloc(), x);
+      return this->priv_forward_range_insert(p.get_ptr(), n, proxy);
+   }
+
+   //! Requires: p must be a valid iterator of *this.
    //!
    //! Effects: Insert a copy of the [first, last) range before pos.
    //!
+   //! Returns: an iterator to the first inserted element or pos if first == last.
+   //!
    //! Throws: If memory allocation throws, T's constructor from a
    //!   dereferenced InpIt throws or T's copy/move constructor/assignment throws.
    //!
    //! Complexity: Linear to std::distance [first, last).
    template 
-   void insert(const_iterator pos, InIt first, InIt last)
+   iterator insert(const_iterator pos, InIt first, InIt last
+      #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && container_detail::is_input_iterator::value
+         >::type * = 0
+      #endif
+      )
    {
-      //Dispatch depending on integer/iterator
-      const bool aux_boolean = container_detail::is_convertible::value;
-      typedef container_detail::bool_ Result;
-      this->priv_insert_dispatch(pos, first, last, Result());
+      const size_type n_pos = pos - this->cbegin();
+      iterator it(pos.get_ptr());
+      for(;first != last; ++first){
+         it = this->emplace(it, *first);
+         ++it;
+      }
+      return iterator(this->members_.m_start + n_pos);
    }
 
-   //! Requires: pos must be a valid iterator of *this.
-   //!
-   //! Effects: Insert n copies of x before pos.
-   //!
-   //! Throws: If memory allocation throws or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to n.
-   void insert(const_iterator p, size_type n, const T& x)
-   {  this->insert(p, cvalue_iterator(x, n), cvalue_iterator());  }
+   #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+   template 
+   iterator insert(const_iterator pos, FwdIt first, FwdIt last
+      , typename container_detail::enable_if_c
+         < !container_detail::is_convertible::value
+            && !container_detail::is_input_iterator::value
+         >::type * = 0
+      )
+   {
+      container_detail::insert_range_proxy proxy(this->alloc(), first);
+      return this->priv_forward_range_insert(pos.get_ptr(), std::distance(first, last), proxy);
+   }
+   #endif
 
    //! Effects: Removes the last element from the vector.
    //!
    //! Throws: Nothing.
    //!
    //! Complexity: Constant time.
-   void pop_back() 
+   void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
       //Destroy last element
       --this->members_.m_size;
@@ -1160,12 +1255,12 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the elements between pos and the 
+   //! Complexity: Linear to the elements between pos and the
    //!   last element. Constant if pos is the last element.
-   iterator erase(const_iterator position) 
+   iterator erase(const_iterator position)
    {
-      T *pos = container_detail::to_raw_pointer(position.get_ptr());
-      T *beg = container_detail::to_raw_pointer(this->members_.m_start);
+      T *const pos = container_detail::to_raw_pointer(position.get_ptr());
+      T *const beg = container_detail::to_raw_pointer(this->members_.m_start);
       ::boost::move(pos + 1, beg + this->members_.m_size, pos);
       --this->members_.m_size;
       //Destroy last element
@@ -1179,59 +1274,34 @@ class vector : private container_detail::vector_alloc_holder
    //!
    //! Complexity: Linear to the distance between first and last
    //!   plus linear to the elements between pos and the last element.
-   iterator erase(const_iterator first, const_iterator last) 
+   iterator erase(const_iterator first, const_iterator last)
    {
-      if (first != last){   // worth doing, copy down over hole
+      if (first != last){
          T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
          T* ptr = container_detail::to_raw_pointer(boost::move
             (container_detail::to_raw_pointer(last.get_ptr())
             ,end_pos
             ,container_detail::to_raw_pointer(first.get_ptr())
             ));
-         size_type destroyed = (end_pos - ptr);
+         const size_type destroyed = (end_pos - ptr);
          this->destroy_n(ptr, destroyed);
          this->members_.m_size -= destroyed;
       }
       return iterator(first.get_ptr());
    }
 
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are copy constructed from x.
+   //! Effects: Swaps the contents of *this and x.
    //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
+   //! Throws: Nothing.
    //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size, const T& x) 
+   //! Complexity: Constant.
+   void swap(vector& x)
    {
-      pointer finish = this->members_.m_start + this->members_.m_size;
-      if (new_size < size()){
-         //Destroy last elements
-         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
-      }
-      else{
-         //Insert new elements at the end
-         this->insert(const_iterator(finish), new_size - this->size(), x);
-      }
-   }
-
-   //! Effects: Inserts or erases elements at the end such that
-   //!   the size becomes n. New elements are default constructed.
-   //!
-   //! Throws: If memory allocation throws, or T's copy constructor throws.
-   //!
-   //! Complexity: Linear to the difference between size() and new_size.
-   void resize(size_type new_size) 
-   {
-      if (new_size < this->size()){
-         //Destroy last elements
-         this->erase(const_iterator(this->members_.m_start + new_size), this->end());
-      }
-      else{
-         size_type n = new_size - this->size();
-         this->reserve(new_size);
-         container_detail::default_construct_aux_proxy proxy(this->alloc(), n);
-         priv_range_insert(this->cend().get_ptr(), n, proxy);
-      }
+      //Just swap internals
+      this->swap_members(x);
+      //And now the allocator
+      container_detail::bool_ flag;
+      container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
    }
 
    //! Effects: Erases all the elements of the vector.
@@ -1242,38 +1312,33 @@ class vector : private container_detail::vector_alloc_holder
    void clear() BOOST_CONTAINER_NOEXCEPT
    {  this->prot_destroy_all();  }
 
-   //! Effects: Tries to deallocate the excess of memory created
-   //!   with previous allocations. The size of the vector is unchanged
-   //!
-   //! Throws: If memory allocation throws, or T's copy/move constructor throws.
-   //!
-   //! Complexity: Linear to size().
-   void shrink_to_fit()
-   {  priv_shrink_to_fit(alloc_version());   }
-
    /// @cond
 
-   private:
-   iterator priv_insert(const_iterator position, const T &x) 
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
    {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position, (size_type)1, x);
-      return iterator(this->members_.m_start + pos_n);
+      const size_type *dummy = 0;
+      this->priv_insert_ordered_at(element_count, last_position_it, false, &dummy[0], last_value_it);
    }
 
-   iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x) 
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
    {
-      //Just call more general insert(pos, size, value) and return iterator
-      size_type pos_n = position - cbegin();
-      this->insert(position
-                  ,repeat_move_it(repeat_it(x, 1))
-                  ,repeat_move_it(repeat_it()));
-      return iterator(this->members_.m_start + pos_n);
+      this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it);
+   }
+
+   private:
+   template
+   iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x)
+   {
+      return this->priv_forward_range_insert
+         (p.get_ptr(), 1, container_detail::get_insert_value_proxy(this->alloc(), ::boost::forward(x)));
    }
 
    template 
-   void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
+   void priv_push_back(BOOST_FWD_REF(U) x)
    {
       if (this->members_.m_size < this->members_.m_capacity){
          //There is more memory, just construct a new object at the end
@@ -1284,17 +1349,14 @@ class vector : private container_detail::vector_alloc_holder
          ++this->members_.m_size;
       }
       else{
-         this->insert(this->cend(), ::boost::forward(x));
+         this->priv_insert(this->cend(), ::boost::forward(x));
       }
    }
 
-   template
-   void priv_shrink_to_fit( AllocVersion
-                          , typename container_detail::enable_if_c<
-                              container_detail::is_same::value >::type * = 0)
+   void priv_shrink_to_fit(allocator_v1)
    {
       if(this->members_.m_capacity){
-         if(!size()){
+         if(!this->size()){
             this->prot_deallocate();
          }
          else{
@@ -1305,9 +1367,8 @@ class vector : private container_detail::vector_alloc_holder
                   (allocate_new, this->size(), this->size(), real_cap, this->members_.m_start);
             if(real_cap < this->capacity()){
                //We will reuse insert code, so create a dummy input iterator
-               T *dummy_it(container_detail::to_raw_pointer(this->members_.m_start));
-               container_detail::advanced_insert_aux_proxy, T*>
-                  proxy(this->alloc(), ::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+               container_detail::insert_range_proxy, T*>
+                  proxy(this->alloc(), ::boost::make_move_iterator((T *)0));
                #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
                ++this->num_alloc;
                #endif
@@ -1325,10 +1386,7 @@ class vector : private container_detail::vector_alloc_holder
       }
    }
 
-   template
-   void priv_shrink_to_fit(AllocVersion
-                          , typename container_detail::enable_if_c<
-                              !container_detail::is_same::value >::type * = 0)
+   void priv_shrink_to_fit(allocator_v2)
    {
       if(this->members_.m_capacity){
          if(!size()){
@@ -1336,7 +1394,7 @@ class vector : private container_detail::vector_alloc_holder
          }
          else{
             size_type received_size;
-            if(this->alloc().allocation_command
+            if(this->allocation_command
                ( shrink_in_place | nothrow_allocation
                , this->capacity(), this->size()
                , received_size,   this->members_.m_start).first){
@@ -1349,94 +1407,245 @@ class vector : private container_detail::vector_alloc_holder
       }
    }
 
-   template 
-   void priv_range_insert(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      if(first != last){        
-         const size_type n = std::distance(first, last);
-         container_detail::advanced_insert_aux_proxy proxy(this->alloc(), first, last);
-         priv_range_insert(pos.get_ptr(), n, proxy);
-      }
-   }
-
-   template 
-   void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
-   {
-      for(;first != last; ++first){
-         this->emplace(pos, *first);
-      }
-   }
-
-   void priv_range_insert(pointer pos, const size_type n, advanced_insert_aux_int_t &interf)
+   template 
+   iterator priv_forward_range_insert
+      (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy)
    {
       //Check if we have enough memory or try to expand current memory
-      size_type remaining = this->members_.m_capacity - this->members_.m_size;
-      bool same_buffer_start;
-      std::pair ret;
-      size_type real_cap = this->members_.m_capacity;
+      const size_type remaining = this->members_.m_capacity - this->members_.m_size;
+      const size_type n_pos = pos - this->members_.m_start;
+      T *const raw_pos = container_detail::to_raw_pointer(pos);
 
       //Check if we already have room
-      if (n <= remaining){
-         same_buffer_start = true;
-      }
-      else{
-         //There is not enough memory, allocate a new
-         //buffer or expand the old one.
-         size_type new_cap = this->next_capacity(n);
-         ret = this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  this->members_.m_size + n, new_cap, real_cap, this->members_.m_start);
+      if(alloc_version::value > 1){   //Version 2 allocator, compile time check
+         bool same_buffer_start = n <= remaining;
+         if (!same_buffer_start){
+            size_type real_cap = 0;
+            //There is not enough memory, allocate a new
+            //buffer or expand the old one.
+            std::pair ret = (this->allocation_command
+                  (allocate_new | expand_fwd | expand_bwd,
+                     this->members_.m_size + n, this->next_capacity(n), real_cap, this->members_.m_start));
 
-         //Check for forward expansion
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            this->members_.m_capacity  = real_cap;
+            //Buffer reallocated
+            if(ret.second){
+               //Forward expansion, delay insertion
+               if(this->members_.m_start == ret.first){
+                  #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+                  ++this->num_expand_fwd;
+                  #endif
+                  this->members_.m_capacity = real_cap;
+                  //Expand forward
+                  this->priv_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+               }
+               //Backwards (and possibly forward) expansion
+               else{
+                  #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+                  ++this->num_expand_bwd;
+                  #endif
+                  this->priv_range_insert_expand_backwards
+                     ( container_detail::to_raw_pointer(ret.first)
+                     , real_cap, raw_pos, n, insert_range_proxy);
+               }
+            }
+            //New buffer
+            else{
+               #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+               ++this->num_alloc;
+               #endif
+               this->priv_range_insert_new_allocation
+                  ( container_detail::to_raw_pointer(ret.first)
+                  , real_cap, raw_pos, n, insert_range_proxy);
+            }
+         }
+         else{
+            //Expand forward
+            this->priv_range_insert_expand_forward
+               (raw_pos, n, insert_range_proxy);
          }
       }
-      
-      //If we had room or we have expanded forward
-      if (same_buffer_start){
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_expand_fwd;
-         #endif
-         this->priv_range_insert_expand_forward
-            (container_detail::to_raw_pointer(pos), n, interf);
+      else{ //Version 1 allocator
+         if (n <= remaining){
+            this->priv_range_insert_expand_forward
+               (raw_pos, n, insert_range_proxy);
+         }
+         else{
+            const size_type new_cap = this->next_capacity(n);
+            T * new_buf = container_detail::to_raw_pointer(this->alloc().allocate(new_cap));
+            #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+            ++this->num_alloc;
+            #endif
+            this->priv_range_insert_new_allocation
+               ( new_buf, new_cap, raw_pos, n, insert_range_proxy);
+         }
       }
-      //Backwards (and possibly forward) expansion
-      else if(ret.second){
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_expand_bwd;
-         #endif
-         this->priv_range_insert_expand_backwards
-            ( container_detail::to_raw_pointer(ret.first)
-            , real_cap
-            , container_detail::to_raw_pointer(pos)
-            , n
-            , interf);
-      }
-      //New buffer
-      else{
-         #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
-         ++this->num_alloc;
-         #endif
-         this->priv_range_insert_new_allocation
-            ( container_detail::to_raw_pointer(ret.first)
-            , real_cap
-            , container_detail::to_raw_pointer(pos)
-            , n
-            , interf);
+      return iterator(this->members_.m_start + n_pos);
+   }
+
+   //Absolutely experimental. This function might change, disappear or simply crash!
+   template
+   void priv_insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
+                              , bool do_skip, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
+   {
+      const size_type old_size_pos = this->size();
+      this->reserve(old_size_pos + element_count);
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+      size_type insertions_left = element_count;
+      size_type next_pos = old_size_pos;
+      size_type hole_size = element_count;
+
+      //Exception rollback. If any copy throws before the hole is filled, values
+      //already inserted/copied at the end of the buffer will be destroyed.
+      typename value_traits::ArrayDestructor past_hole_values_destroyer
+         (begin_ptr + old_size_pos + element_count, this->alloc(), size_type(0u));
+      //Loop for each insertion backwards, first moving the elements after the insertion point,
+      //then inserting the element.
+      while(insertions_left){
+         if(do_skip){
+            size_type n = *(--last_skip_it);
+            std::advance(last_value_it, -difference_type(n));
+         }
+         const size_type pos = static_cast(*(--last_position_it));
+         BOOST_ASSERT(pos <= old_size_pos);
+         //If needed shift the range after the insertion point and the previous insertion point.
+         //Function will take care if the shift crosses the size() boundary, using copy/move
+         //or uninitialized copy/move if necessary.
+         size_type new_hole_size = (pos != next_pos)
+            ? priv_insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left)
+            : hole_size
+            ;
+         if(new_hole_size > 0){
+            //The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
+            past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
+            //Insert the new value in the hole
+            allocator_traits_type::construct(this->alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it));
+            --new_hole_size;
+            if(new_hole_size == 0){
+               //Hole was just filled, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            else{
+               //The hole was reduced by the new insertion by one
+               past_hole_values_destroyer.increment_size_backwards(size_type(1u));
+            }
+         }
+         else{
+            if(hole_size){
+               //Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
+               past_hole_values_destroyer.release();
+               this->members_.m_size += element_count;
+            }
+            //Insert the new value in the already constructed range
+            begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
+         }
+         --insertions_left;
+         hole_size = new_hole_size;
+         next_pos = pos;
       }
    }
 
-   void priv_range_insert_expand_forward(T* pos, size_type n, advanced_insert_aux_int_t &interf)
+   //Takes the range pointed by [first_pos, last_pos) and shifts it to the right
+   //by 'shift_count'. 'limit_pos' marks the end of constructed elements.
+   //
+   //Precondition: first_pos <= last_pos <= limit_pos
+   //
+   //The shift operation might cross limit_pos so elements to moved beyond limit_pos
+   //are uninitialized_moved with an allocator. Other elements are moved.
+   //
+   //The shift operation might left uninitialized elements after limit_pos
+   //and the number of uninitialized elements is returned by the function.
+   //
+   //Old situation:
+   //       first_pos   last_pos         old_limit
+   //             |       |                  | 
+   // ____________V_______V__________________V_____________
+   //|   prefix   | range |     suffix       |raw_mem      ~
+   //|____________|_______|__________________|_____________~
+   //
+   //New situation in Case Allocator (hole_size == 0):
+   // range is moved through move assignments
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V_____________
+   //|   prefix'  |       |  | range |suffix'|raw_mem      ~
+   //|________________+______|___^___|_______|_____________~
+   //                 |          |
+   //                 |_>_>_>_>_>^                    
+   //
+   //
+   //New situation in Case B (hole_size > 0):
+   // range is moved through uninitialized moves
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V________________
+   //|    prefix' |       |                  | [hole] | range |
+   //|_______________________________________|________|___^___|
+   //                 |                                   |
+   //                 |_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_^
+   //
+   //New situation in Case C (hole_size == 0):
+   // range is moved through move assignments and uninitialized moves
+   //
+   //       first_pos   last_pos         limit_pos
+   //             |       |                  | 
+   // ____________V_______V__________________V___
+   //|   prefix'  |       |              | range |
+   //|___________________________________|___^___|
+   //                 |                      |
+   //                 |_>_>_>_>_>_>_>_>_>_>_>^
+   size_type priv_insert_ordered_at_shift_range
+      (size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
+   {
+      BOOST_ASSERT(first_pos <= last_pos);
+      BOOST_ASSERT(last_pos <= limit_pos);
+      //
+      T* const begin_ptr = container_detail::to_raw_pointer(this->members_.m_start);
+      T* const first_ptr = begin_ptr + first_pos;
+      T* const last_ptr  = begin_ptr + last_pos;
+
+      size_type hole_size = 0;
+      //Case Allocator:
+      if((last_pos + shift_count) <= limit_pos){
+         //All move assigned
+         boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count);
+      }
+      //Case B:
+      else if((first_pos + shift_count) >= limit_pos){
+         //All uninitialized_moved
+         ::boost::container::uninitialized_move_alloc(this->alloc(), first_ptr, last_ptr, first_ptr + shift_count);
+         hole_size = last_pos + shift_count - limit_pos;
+      }
+      //Case C:
+      else{
+         //Some uninitialized_moved
+         T* const limit_ptr    = begin_ptr + limit_pos;
+         T* const boundary_ptr = limit_ptr - shift_count;
+         ::boost::container::uninitialized_move_alloc(this->alloc(), boundary_ptr, last_ptr, limit_ptr);
+         //The rest is move assigned
+         boost::move_backward(first_ptr, boundary_ptr, limit_ptr);
+      }
+      return hole_size;
+   }
+
+   private:
+   template 
+   void priv_range_insert_expand_forward(T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can't be 0, because there is nothing to do in that case
       if(!n) return;
       //There is enough memory
-      T* old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
+      T* const old_finish = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
       const size_type elems_after = old_finish - pos;
 
-      if (elems_after >= n){
+      if (!elems_after){
+         //Copy first new elements in pos
+         insert_range_proxy.uninitialized_copy_n_and_update(pos, n);
+         this->members_.m_size += n;
+      }
+      else if (elems_after >= n){
          //New elements can be just copied.
          //Move to uninitialized memory last objects
          ::boost::container::uninitialized_move_alloc
@@ -1445,24 +1654,31 @@ class vector : private container_detail::vector_alloc_holder
          //Copy previous to last objects to the initialized end
          boost::move_backward(pos, old_finish - n, old_finish);
          //Insert new objects in the pos
-         interf.copy_remaining_to(pos);
+         insert_range_proxy.copy_n_and_update(pos, n);
       }
       else {
-         //The new elements don't fit in the [pos, end()) range. Copy
-         //to the beginning of the unallocated zone the last new elements.
-         interf.uninitialized_copy_some_and_update(old_finish, elems_after, false);
-         this->members_.m_size += n - elems_after;
-         //Copy old [pos, end()) elements to the uninitialized memory
-         ::boost::container::uninitialized_move_alloc
-            (this->alloc(), pos, old_finish, container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size);
-         this->members_.m_size += elems_after;
-         //Copy first new elements in pos
-         interf.copy_remaining_to(pos);
+         //The new elements don't fit in the [pos, end()) range.
+
+         //Copy old [pos, end()) elements to the uninitialized memory (a gap is created)
+         ::boost::container::uninitialized_move_alloc(this->alloc(), pos, old_finish, pos + n);
+         BOOST_TRY{
+            //Copy first new elements in pos (gap is still there)
+            insert_range_proxy.copy_n_and_update(pos, elems_after);
+            //Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
+            insert_range_proxy.uninitialized_copy_n_and_update(old_finish, n - elems_after);
+            this->members_.m_size += n;
+         }
+         BOOST_CATCH(...){
+            this->destroy_n(pos + n, elems_after);
+            BOOST_RETHROW
+         }
+         BOOST_CATCH_END
       }
    }
 
+   template 
    void priv_range_insert_new_allocation
-      (T* new_start, size_type new_cap, T* pos, size_type n, advanced_insert_aux_int_t &interf)
+      (T* const new_start, size_type new_cap, T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can be zero, if we want to reallocate!
       T *new_finish = new_start;
@@ -1471,7 +1687,7 @@ class vector : private container_detail::vector_alloc_holder
       typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
       typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
 
-      //Initialize with [begin(), pos) old buffer 
+      //Initialize with [begin(), pos) old buffer
       //the start of the new buffer
       T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
       if(old_buffer){
@@ -1480,10 +1696,10 @@ class vector : private container_detail::vector_alloc_holder
          constructed_values_destroyer.increment_size(new_finish - old_finish);
       }
       //Initialize new objects, starting from previous point
-      interf.uninitialized_copy_remaining_to(old_finish = new_finish);
+      insert_range_proxy.uninitialized_copy_n_and_update(old_finish = new_finish, n);
       new_finish += n;
       constructed_values_destroyer.increment_size(new_finish - old_finish);
-      //Initialize from the rest of the old buffer, 
+      //Initialize from the rest of the old buffer,
       //starting from previous point
       if(old_buffer){
          new_finish = ::boost::container::uninitialized_move_alloc
@@ -1491,7 +1707,7 @@ class vector : private container_detail::vector_alloc_holder
          //Destroy and deallocate old elements
          //If there is allocated memory, destroy and deallocate
          if(!value_traits::trivial_dctr_after_move)
-            this->destroy_n(old_buffer, this->members_.m_size); 
+            this->destroy_n(old_buffer, this->members_.m_size);
          this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
       }
       this->members_.m_start     = new_start;
@@ -1502,19 +1718,21 @@ class vector : private container_detail::vector_alloc_holder
       scoped_alloc.release();
    }
 
+   template 
    void priv_range_insert_expand_backwards
-         (T* new_start, size_type new_capacity,
-          T* pos, const size_type n, advanced_insert_aux_int_t &interf)
+         (T* const new_start, const size_type new_capacity,
+          T* const pos, const size_type n, InsertionProxy insert_range_proxy)
    {
       //n can be zero to just expand capacity
       //Backup old data
-      T* old_start  = container_detail::to_raw_pointer(this->members_.m_start);
-      T* old_finish = old_start + this->members_.m_size;
-      size_type old_size = this->members_.m_size;
+      T* const old_start  = container_detail::to_raw_pointer(this->members_.m_start);
+      T* const old_finish = old_start + this->members_.m_size;
+      const size_type old_size = this->members_.m_size;
 
       //We can have 8 possibilities:
-      const size_type elemsbefore   = (size_type)(pos - old_start);
-      const size_type s_before      = (size_type)(old_start - new_start);
+      const size_type elemsbefore = static_cast(pos - old_start);
+      const size_type s_before    = static_cast(old_start - new_start);
+      const size_type before_plus_new = elemsbefore + n;
 
       //Update the vector buffer information to a safe state
       this->members_.m_start      = new_start;
@@ -1525,15 +1743,16 @@ class vector : private container_detail::vector_alloc_holder
       //all the old objects to fulfill previous vector state
       typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
       //Check if s_before is big enough to hold the beginning of old data + new data
-      if(difference_type(s_before) >= difference_type(elemsbefore + n)){
+      if(s_before >= before_plus_new){
          //Copy first old values before pos, after that the new objects
-         ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
+         T *const new_elem_pos = ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
          this->members_.m_size = elemsbefore;
-         interf.uninitialized_copy_remaining_to(new_start + elemsbefore);
+         insert_range_proxy.uninitialized_copy_n_and_update(new_elem_pos, n);
          this->members_.m_size += n;
          //Check if s_before is so big that even copying the old data + new data
          //there is a gap between the new data and the old data
-         if(s_before >= (old_size + n)){
+         const size_type new_size = old_size + n;
+         if(s_before >= new_size){
             //Old situation:
             // _________________________________________________________
             //|            raw_mem                | old_begin | old_end |
@@ -1546,9 +1765,9 @@ class vector : private container_detail::vector_alloc_holder
             //
             //Now initialize the rest of memory with the last old values
             ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, old_finish, new_start + elemsbefore + n);
+               (this->alloc(), pos, old_finish, new_start + before_plus_new);
             //All new elements correctly constructed, avoid new element destruction
-            this->members_.m_size = old_size + n;
+            this->members_.m_size = new_size;
             //Old values destroyed automatically with "old_values_destroyer"
             //when "old_values_destroyer" goes out of scope unless the have trivial
             //destructor after move.
@@ -1569,17 +1788,17 @@ class vector : private container_detail::vector_alloc_holder
             //
             //Now initialize the rest of memory with the last old values
             //All new elements correctly constructed, avoid new element destruction
-            size_type raw_gap = s_before - (elemsbefore + n);
+            const size_type raw_gap = s_before - before_plus_new;
             //Now initialize the rest of s_before memory with the
             //first of elements after new values
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), pos, pos + raw_gap, new_start + elemsbefore + n);
+            ::boost::container::uninitialized_move_alloc_n
+               (this->alloc(), pos, raw_gap, new_start + before_plus_new);
             //Update size since we have a contiguous buffer
             this->members_.m_size = old_size + s_before;
             //All new elements correctly constructed, avoid old element destruction
             old_values_destroyer.release();
             //Now copy remaining last objects in the old buffer begin
-            T *to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
+            T * const to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
             //Now destroy redundant elements except if they were moved and
             //they have trivial destructor after move
             size_type n_destroy =  old_finish - to_destroy;
@@ -1608,7 +1827,7 @@ class vector : private container_detail::vector_alloc_holder
          //| old_begin + new + old_end  |  raw_mem           |
          //|____________________________|____________________|
          //
-         bool do_after    = n > s_before;
+         const bool do_after = n > s_before;
 
          //Now we can have two situations: the raw_mem of the
          //beginning divides the old_begin, or the new elements:
@@ -1637,28 +1856,26 @@ class vector : private container_detail::vector_alloc_holder
             //|___________|_____|_________|_____________________|
             //
             //Copy the first part of old_begin to raw_mem
-            T *start_n = old_start + difference_type(s_before); 
-            ::boost::container::uninitialized_move_alloc
-               (this->alloc(), old_start, start_n, new_start);
+            ::boost::container::uninitialized_move_alloc_n
+               (this->alloc(), old_start, s_before, new_start);
             //The buffer is all constructed until old_end,
             //release destroyer and update size
             old_values_destroyer.release();
             this->members_.m_size = old_size + s_before;
-            //Now copy the second part of old_begin overwriting himself
-            T* next = ::boost::move(start_n, pos, old_start);
+            //Now copy the second part of old_begin overwriting itself
+            T *const next = ::boost::move(old_start + s_before, pos, old_start);
             if(do_after){
                //Now copy the new_beg elements
-               interf.copy_some_and_update(next, s_before, true);
+               insert_range_proxy.copy_n_and_update(next, s_before);
             }
             else{
                //Now copy the all the new elements
-               interf.copy_remaining_to(next);
-               T* move_start = next + n;
+               insert_range_proxy.copy_n_and_update(next, n);
                //Now displace old_end elements
-               T* move_end   = ::boost::move(pos, old_finish, move_start);
+               T* const move_end   = ::boost::move(pos, old_finish, next + n);
                //Destroy remaining moved elements from old_end except if
                //they have trivial destructor after being moved
-               difference_type n_destroy = s_before - n;
+               const size_type n_destroy = s_before - n;
                if(!value_traits::trivial_dctr_after_move)
                   this->destroy_n(move_end, n_destroy);
                this->members_.m_size -= n_destroy;
@@ -1691,30 +1908,30 @@ class vector : private container_detail::vector_alloc_holder
             //|___________|_____|_________|__________________________|
             //
             //First copy whole old_begin and part of new to raw_mem
-            ::boost::container::uninitialized_move_alloc
+            T * const new_pos = ::boost::container::uninitialized_move_alloc
                (this->alloc(), old_start, pos, new_start);
             this->members_.m_size = elemsbefore;
-
-            const size_type mid_n = difference_type(s_before) - elemsbefore;
-            interf.uninitialized_copy_some_and_update(new_start + elemsbefore, mid_n, true);
-            this->members_.m_size = old_size + s_before;
+            const size_type mid_n = s_before - elemsbefore;
+            insert_range_proxy.uninitialized_copy_n_and_update(new_pos, mid_n);
             //The buffer is all constructed until old_end,
-            //release destroyer and update size
+            //release destroyer
+            this->members_.m_size = old_size + s_before;
             old_values_destroyer.release();
 
             if(do_after){
                //Copy new_beg part
-               interf.copy_some_and_update(old_start, s_before - mid_n, true);
+               insert_range_proxy.copy_n_and_update(old_start, elemsbefore);
             }
             else{
                //Copy all new elements
-               interf.copy_remaining_to(old_start);
-               T* move_start = old_start + (n-mid_n);
+               const size_type rest_new = n - mid_n;
+               insert_range_proxy.copy_n_and_update(old_start, rest_new);
+               T* move_start = old_start + rest_new;
                //Displace old_end
                T* move_end = ::boost::move(pos, old_finish, move_start);
                //Destroy remaining moved elements from old_end except if they
                //have trivial destructor after being moved
-               difference_type n_destroy = s_before - n;
+               size_type n_destroy = s_before - n;
                if(!value_traits::trivial_dctr_after_move)
                   this->destroy_n(move_end, n_destroy);
                this->members_.m_size -= n_destroy;
@@ -1722,9 +1939,6 @@ class vector : private container_detail::vector_alloc_holder
          }
 
          //This is only executed if two phase construction is needed
-         //This can be executed without exception handling since we
-         //have to just copy and append in raw memory and
-         //old_values_destroyer has been released in phase 1.
          if(do_after){
             //The raw memory divides the new elements
             //
@@ -1743,11 +1957,11 @@ class vector : private container_detail::vector_alloc_holder
             //| old_begin      +       new            | old_end |raw |
             //|_______________________________________|_________|____|
             //
-            const size_type n_after  = n - s_before;
-            const difference_type elemsafter = old_size - elemsbefore;
+            const size_type n_after    = n - s_before;
+            const size_type elemsafter = old_size - elemsbefore;
 
             //We can have two situations:
-            if (elemsafter > difference_type(n_after)){
+            if (elemsafter >= n_after){
                //The raw_mem from end will divide displaced old_end
                //
                //Old situation:
@@ -1761,7 +1975,7 @@ class vector : private container_detail::vector_alloc_holder
                //|__________________________|_________|________|_________|
                //
                //First copy the part of old_end raw_mem
-               T* finish_n = old_finish - difference_type(n_after);
+               T* finish_n = old_finish - n_after;
                ::boost::container::uninitialized_move_alloc
                   (this->alloc(), finish_n, old_finish, old_finish);
                this->members_.m_size += n_after;
@@ -1769,7 +1983,7 @@ class vector : private container_detail::vector_alloc_holder
                boost::move_backward(pos, finish_n, old_finish);
                //Now overwrite with new_end
                //The new_end part is [first + (n - n_after), last)
-               interf.copy_remaining_to(pos);
+               insert_range_proxy.copy_n_and_update(pos, n_after);
             }
             else {
                //The raw_mem from end will divide new_end part
@@ -1784,188 +1998,47 @@ class vector : private container_detail::vector_alloc_holder
                //| old_begin   +   new_beg  |     new_end   |old_end | raw_mem |
                //|__________________________|_______________|________|_________|
                //
+
+               const size_type mid_last_dist = n_after - elemsafter;
+               //First initialize data in raw memory
+
+               //Copy to the old_end part to the uninitialized zone leaving a gap.
+               ::boost::container::uninitialized_move_alloc
+                  (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
+
+               BOOST_TRY{
+                  //Copy the first part to the already constructed old_end zone
+                  insert_range_proxy.copy_n_and_update(pos, elemsafter);
+                  //Copy the rest to the uninitialized zone filling the gap
+                  insert_range_proxy.uninitialized_copy_n_and_update(old_finish, mid_last_dist);
+                  this->members_.m_size += n_after;
+               }
+               BOOST_CATCH(...){
+                  this->destroy_n(pos, mid_last_dist);
+                  BOOST_RETHROW
+               }
+               BOOST_CATCH_END
+/*
                size_type mid_last_dist = n_after - elemsafter;
                //First initialize data in raw memory
+
                //The new_end part is [first + (n - n_after), last)
-               interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
+               insert_range_proxy.uninitialized_copy_last_and_update(old_finish, elemsafter);
                this->members_.m_size += mid_last_dist;
                ::boost::container::uninitialized_move_alloc
                   (this->alloc(), pos, old_finish, old_finish + mid_last_dist);
                this->members_.m_size += n_after - mid_last_dist;
                //Now copy the part of new_end over constructed elements
-               interf.copy_remaining_to(pos);
+               insert_range_proxy.copy_remaining_to(pos);*/
             }
          }
       }
    }
 
-   template 
-   void priv_assign_aux(InIt first, InIt last, std::input_iterator_tag)
-   {
-      //Overwrite all elements we can from [first, last)
-      iterator cur = begin();
-      for ( ; first != last && cur != end(); ++cur, ++first){
-         *cur = *first;
-      }
-
-      if (first == last){
-         //There are no more elements in the sequence, erase remaining
-         this->erase(cur, cend());
-      }
-      else{
-         //There are more elements in the range, insert the remaining ones
-         this->insert(this->cend(), first, last);
-      }
-   }
-
-   template 
-   void priv_assign_aux(FwdIt first, FwdIt last, std::forward_iterator_tag)
-   {
-      size_type n = std::distance(first, last);
-      if(!n){
-         this->prot_destroy_all();
-         return;
-      }
-      //Check if we have enough memory or try to expand current memory
-      size_type remaining = this->members_.m_capacity - this->members_.m_size;
-      bool same_buffer_start;
-      std::pair ret;
-      size_type real_cap = this->members_.m_capacity;
-
-      if (n <= remaining){
-         same_buffer_start = true;
-      }
-      else{
-         //There is not enough memory, allocate a new buffer
-         size_type new_cap = this->next_capacity(n);
-         ret = this->allocation_command
-               (allocate_new | expand_fwd | expand_bwd,
-                  this->size() + n, new_cap, real_cap, this->members_.m_start);
-         same_buffer_start = ret.second && this->members_.m_start == ret.first;
-         if(same_buffer_start){
-            this->members_.m_capacity  = real_cap;
-         }
-      }
-      
-      if(same_buffer_start){
-         T *start = container_detail::to_raw_pointer(this->members_.m_start);
-         if (this->size() >= n){
-            //There is memory, but there are more old elements than new ones
-            //Overwrite old elements with new ones
-            std::copy(first, last, start);
-            //Destroy remaining old elements
-            this->destroy_n(start + n, this->members_.m_size - n);
-            this->members_.m_size = n;
-         }
-         else{
-            //There is memory, but there are less old elements than new ones
-            //First overwrite some old elements with new ones
-            FwdIt mid = first;
-            std::advance(mid, this->size());
-            // iG T *end = std::copy(first, mid, start);
-            T *end = std::copy(first, mid, start);
-            //Initialize the remaining new elements in the uninitialized memory
-            ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), mid, last, end);
-            this->members_.m_size = n;
-         }
-      }
-      else if(!ret.second){
-         typename value_traits::ArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
-         ::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), first, last, container_detail::to_raw_pointer(ret.first));
-         scoped_alloc.release();
-         //Destroy and deallocate old buffer
-         if(this->members_.m_start != 0){
-            this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size); 
-            this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
-         }
-         this->members_.m_start     = ret.first;
-         this->members_.m_size      = n;
-         this->members_.m_capacity  = real_cap;
-      }
-      else{
-         //Backwards expansion
-         //If anything goes wrong, this object will destroy old objects
-         T *old_start         = container_detail::to_raw_pointer(this->members_.m_start);
-         size_type old_size   = this->members_.m_size;
-         typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
-         //If something goes wrong size will be 0
-         //but holding the whole buffer
-         this->members_.m_size  = 0;
-         this->members_.m_start = ret.first;
-         this->members_.m_capacity = real_cap;
-         
-         //Backup old buffer data
-         size_type old_offset    = old_start - container_detail::to_raw_pointer(ret.first);
-         size_type first_count   = container_detail::min_value(n, old_offset);
-
-         FwdIt mid = first;
-         std::advance(mid, first_count);
-         ::boost::container::uninitialized_copy_or_move_alloc
-            (this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
-
-         if(old_offset > n){
-            //All old elements will be destroyed by "old_values_destroyer" 
-            this->members_.m_size = n;
-         }
-         else{
-            //We have constructed objects from the new begin until
-            //the old end so release the rollback destruction
-            old_values_destroyer.release();
-            this->members_.m_start  = ret.first;
-            this->members_.m_size   = first_count + old_size;
-            //Now overwrite the old values
-            size_type second_count = container_detail::min_value(old_size, n - first_count);
-            FwdIt mid2 = mid;
-            std::advance(mid2, second_count);
-            // iG std::copy(mid, mid2, old_start);
-            std::copy(mid, mid2, old_start);
-            
-            //Check if we still have to append elements in the
-            //uninitialized end
-            if(second_count == old_size){
-               // iG std::copy(mid2, last, old_start + old_size);
-               std::copy(mid2, last, old_start + old_size);
-            }
-            else{
-               //We have to destroy some old values
-               this->destroy_n
-                  (old_start + second_count, old_size - second_count);
-               this->members_.m_size = n;
-            }
-            this->members_.m_size = n;                        
-         }
-      }
-   }
-
-   template 
-   void priv_assign_dispatch(Integer n, Integer val, container_detail::true_)
-   { this->assign((size_type) n, (value_type)val); }
-
-   template 
-   void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
-   { 
-      //Dispatch depending on integer/iterator
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_assign_aux(first, last, ItCat()); 
-   }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_) 
-   {  this->insert(pos, (size_type)n, (T)val);  }
-
-   template 
-   void priv_insert_dispatch(const_iterator pos, InIt first, 
-                             InIt last,      container_detail::false_)
-   {
-      //Dispatch depending on integer/iterator
-      typedef typename std::iterator_traits::iterator_category ItCat;
-      this->priv_range_insert(pos, first, last, ItCat());
-   }
-
-   void priv_check_range(size_type n) const 
+   void priv_check_range(size_type n) const
    {
       //If n is out of range, throw an out_of_range exception
-      if (n >= size())
+      if (n >= this->size())
          throw std::out_of_range("vector::at");
    }
 
@@ -1981,31 +2054,31 @@ class vector : private container_detail::vector_alloc_holder
    /// @endcond
 };
 
-template 
-inline bool 
-operator==(const vector& x, const vector& y)
+template 
+inline bool
+operator==(const vector& x, const vector& y)
 {
    //Check first size and each element if needed
    return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator!=(const vector& x, const vector& y)
+template 
+inline bool
+operator!=(const vector& x, const vector& y)
 {
    //Check first size and each element if needed
   return x.size() != y.size() || !std::equal(x.begin(), x.end(), y.begin());
 }
 
-template 
-inline bool 
-operator<(const vector& x, const vector& y)
+template 
+inline bool
+operator<(const vector& x, const vector& y)
 {
    return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
-template 
-inline void swap(vector& x, vector& y)
+template 
+inline void swap(vector& x, vector& y)
 {  x.swap(y);  }
 
 }}
@@ -2014,17 +2087,14 @@ inline void swap(vector& x, vector& y)
 
 namespace boost {
 
-/*
 
 //!has_trivial_destructor_after_move<> == true_type
 //!specialization for optimizations
-template 
-struct has_trivial_destructor_after_move >
-{
-   static const bool value = has_trivial_destructor::value;
-};
+template 
+struct has_trivial_destructor_after_move >
+   : public ::boost::has_trivial_destructor_after_move
+{};
 
-*/
 
 }
 
diff --git a/project/jni/boost/include/boost/context/all.hpp b/project/jni/boost/include/boost/context/all.hpp
new file mode 100644
index 000000000..6bf7e8f19
--- /dev/null
+++ b/project/jni/boost/include/boost/context/all.hpp
@@ -0,0 +1,12 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_ALL_H
+#define BOOST_CONTEXT_ALL_H
+
+#include 
+
+#endif // BOOST_CONTEXT_ALL_H
diff --git a/project/jni/boost/include/boost/context/detail/config.hpp b/project/jni/boost/include/boost/context/detail/config.hpp
new file mode 100644
index 000000000..0d7b7fce6
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/config.hpp
@@ -0,0 +1,42 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_CONFIG_H
+#define BOOST_CONTEXT_DETAIL_CONFIG_H
+
+#include 
+#include 
+
+#ifdef BOOST_CONTEXT_DECL
+# undef BOOST_CONTEXT_DECL
+#endif
+
+#if defined(BOOST_HAS_DECLSPEC)
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+#  if ! defined(BOOST_DYN_LINK)
+#   define BOOST_DYN_LINK
+#  endif
+#  if defined(BOOST_CONTEXT_SOURCE)
+#   define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT
+#  else 
+#   define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT
+#  endif
+# endif
+#endif
+
+#if ! defined(BOOST_CONTEXT_DECL)
+# define BOOST_CONTEXT_DECL
+#endif
+
+#if ! defined(BOOST_CONTEXT_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_CONTEXT_NO_LIB)
+# define BOOST_LIB_NAME boost_context
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
+#  define BOOST_DYN_LINK
+# endif
+# include 
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_CONFIG_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp b/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp
new file mode 100644
index 000000000..8b88ccfdd
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_arm.hpp
@@ -0,0 +1,68 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[16];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[11];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp b/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp
new file mode 100644
index 000000000..2e0132355
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_i386.hpp
@@ -0,0 +1,59 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL __attribute__((cdecl))
+
+struct stack_t
+{
+    void            *   sp;
+    std::size_t         size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[6];
+    stack_t             fc_stack;
+    boost::uint32_t     fc_freg[2];
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_freg()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp b/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp
new file mode 100644
index 000000000..4a5ee39e2
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_i386_win.hpp
@@ -0,0 +1,86 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4351)
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL __cdecl
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+    void    *   limit;
+
+    stack_t() :
+        sp( 0), size( 0), limit( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[2];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[6];
+    stack_t             fc_stack;
+    void            *   fc_excpt_lst;
+    void            *   fc_local_storage;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_excpt_lst( 0),
+        fc_local_storage( 0),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp b/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp
new file mode 100644
index 000000000..d3cd60de4
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_mips.hpp
@@ -0,0 +1,70 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+// on MIPS we assume 64bit regsiters - even for 32bit ABIs
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint64_t     fc_freg[6];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint32_t     fc_greg[12];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp b/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp
new file mode 100644
index 000000000..6cb019f54
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_ppc.hpp
@@ -0,0 +1,72 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint64_t     fc_freg[19];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+# if defined(__powerpc64__)
+    boost::uint64_t     fc_greg[23];
+# else
+    boost::uint32_t     fc_greg[23];
+# endif
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp b/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp
new file mode 100644
index 000000000..6e8d93c0c
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_x86_64.hpp
@@ -0,0 +1,68 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+
+    stack_t() :
+        sp( 0), size( 0)
+    {}
+};
+
+struct fp_t
+{
+    boost::uint32_t     fc_freg[2];
+
+    fp_t() :
+        fc_freg()
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint64_t     fc_greg[8];
+    stack_t             fc_stack;
+    fp_t                fc_fp;
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
diff --git a/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp b/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp
new file mode 100644
index 000000000..833e3d01b
--- /dev/null
+++ b/project/jni/boost/include/boost/context/detail/fcontext_x86_64_win.hpp
@@ -0,0 +1,75 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4351)
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" {
+
+#define BOOST_CONTEXT_CALLDECL
+
+struct stack_t
+{
+    void    *   sp;
+    std::size_t size;
+    void    *   limit;
+
+    stack_t() :
+        sp( 0), size( 0), limit( 0)
+    {}
+};
+
+struct fcontext_t
+{
+    boost::uint64_t     fc_greg[10];
+    stack_t             fc_stack;
+    void            *   fc_local_storage;
+    boost::uint64_t     fc_fp[24];
+
+    fcontext_t() :
+        fc_greg(),
+        fc_stack(),
+        fc_local_storage( 0),
+        fc_fp()
+    {}
+};
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H
diff --git a/project/jni/boost/include/boost/context/fcontext.hpp b/project/jni/boost/include/boost/context/fcontext.hpp
new file mode 100644
index 000000000..47b29c33a
--- /dev/null
+++ b/project/jni/boost/include/boost/context/fcontext.hpp
@@ -0,0 +1,81 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONTEXT_FCONTEXT_H
+#define BOOST_CONTEXT_FCONTEXT_H
+
+#if defined(__PGI)
+#include 
+#endif
+
+#if defined(_WIN32_WCE)
+typedef int intptr_t;
+#endif
+
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+    || defined(__amd64__) || defined(__amd64) \
+    || defined(_M_X64) || defined(_M_AMD64)
+# if defined(BOOST_WINDOWS)
+#  include 
+# else
+#  include 
+# endif
+// i386
+#elif defined(i386) || defined(__i386__) || defined(__i386) \
+    || defined(__i486__) || defined(__i586__) || defined(__i686__) \
+    || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \
+    || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \
+    || defined(_M_IX86) || defined(_I86_)
+# if defined(BOOST_WINDOWS)
+#  include 
+# else
+#  include 
+# endif
+// arm
+#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \
+    || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM)
+# include 
+// mips
+#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \
+    || defined(_R3000)
+# include 
+// powerpc
+#elif defined(__powerpc) || defined(__powerpc__) || defined(__ppc) \
+    || defined(__ppc__) || defined(_ARCH_PPC) || defined(__POWERPC__) \
+    || defined(__PPCGECKO__) || defined(__PPCBROADWAY) || defined(_XENON)
+# include 
+#else
+# error "platform not supported"
+#endif
+
+namespace boost {
+namespace context {
+
+extern "C" BOOST_CONTEXT_DECL
+intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true);
+extern "C" BOOST_CONTEXT_DECL
+fcontext_t * BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( intptr_t) );
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_CONTEXT_FCONTEXT_H
+
diff --git a/project/jni/boost/include/boost/coroutine/all.hpp b/project/jni/boost/include/boost/coroutine/all.hpp
new file mode 100644
index 000000000..d80ca206b
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/all.hpp
@@ -0,0 +1,15 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_ALL_H
+#define BOOST_COROUTINES_ALL_H
+
+#include 
+#include 
+#include 
+#include 
+
+#endif // BOOST_COROUTINES_ALL_H
diff --git a/project/jni/boost/include/boost/coroutine/attributes.hpp b/project/jni/boost/include/boost/coroutine/attributes.hpp
new file mode 100644
index 000000000..285508242
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/attributes.hpp
@@ -0,0 +1,85 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_ATTRIBUTES_H
+#define BOOST_COROUTINES_ATTRIBUTES_H
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+
+struct attributes
+{
+    std::size_t     size;
+    flag_unwind_t   do_unwind;
+    flag_fpu_t      preserve_fpu;
+
+    attributes() BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( stack_unwind),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( std::size_t size_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( stack_unwind),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( do_unwind_),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes( flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( stack_unwind),
+        preserve_fpu( preserve_fpu_)
+    {}
+
+    explicit attributes(
+            std::size_t size_,
+            flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( do_unwind_),
+        preserve_fpu( fpu_preserved)
+    {}
+
+    explicit attributes(
+            std::size_t size_,
+            flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( size_),
+        do_unwind( stack_unwind),
+        preserve_fpu( preserve_fpu_)
+    {}
+
+    explicit attributes(
+            flag_unwind_t do_unwind_,
+            flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT :
+        size( stack_allocator::default_stacksize() ),
+        do_unwind( do_unwind_),
+        preserve_fpu( preserve_fpu_)
+    {}
+};
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_ATTRIBUTES_H
diff --git a/project/jni/boost/include/boost/coroutine/coroutine.hpp b/project/jni/boost/include/boost/coroutine/coroutine.hpp
new file mode 100644
index 000000000..b6196edfb
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/coroutine.hpp
@@ -0,0 +1,1405 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_COROUTINE_H
+#define BOOST_COROUTINES_COROUTINE_H
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result = typename function_traits< Signature >::result_type,
+    int arity = function_traits< Signature >::arity
+>
+struct caller;
+
+template<
+    typename Signature,
+    template< class, int > class C
+>
+struct caller< Signature, C, void, 0 >
+{ typedef C< void(), 0 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result
+>
+struct caller< Signature, C, Result, 0 >
+{ typedef C< void( Result), 1 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    int arity
+>
+struct caller< Signature, C, void, arity >
+{ typedef C< typename detail::arg< Signature >::type(), 0 > type; };
+
+template<
+    typename Signature,
+    template< class, int > class C,
+    typename Result, int arity
+>
+struct caller
+{ typedef C< typename detail::arg< Signature >::type( Result), 1 > type; };
+
+}
+
+template< typename Signature, int arity = function_traits< Signature >::arity >
+class coroutine;
+
+template< typename Signature >
+class coroutine< Signature, 0 > : public detail::coroutine_op<
+                                        Signature,
+                                        coroutine< Signature >,
+                                        typename function_traits< Signature >::result_type,
+                                        function_traits< Signature >::arity
+                                  >,
+                                  public detail::coroutine_get<
+                                        coroutine< Signature >,
+                                        typename function_traits< Signature >::result_type,
+                                        function_traits< Signature >::arity
+                                  >
+{
+private:
+    typedef detail::coroutine_base< Signature >                 base_t;
+    typedef typename base_t::ptr_t                              ptr_t;
+
+    template< typename X, typename Y, int >
+    friend struct detail::coroutine_get;
+    template< typename X, typename Y, typename Z, int >
+    friend struct detail::coroutine_op;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class detail::coroutine_object;
+
+    struct dummy
+    { void nonnull() {} };
+
+    typedef void ( dummy::*safe_bool)();
+
+    ptr_t  impl_;
+
+    BOOST_MOVABLE_BUT_NOT_COPYABLE( coroutine);
+
+    template< typename Allocator >
+    coroutine( context::fcontext_t * callee,
+               bool unwind, bool preserve_fpu,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_caller<
+                Signature, Allocator
+        >                               caller_t;
+        typename caller_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) caller_t(
+                callee, unwind, preserve_fpu, a) );
+    }
+
+public:
+    typedef typename detail::caller<
+            Signature,
+            boost::coroutines::coroutine
+    >::type                                                     caller_type;
+
+    coroutine() BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {}
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_MSVC
+    typedef void ( * coroutine_fn) ( caller_type &);
+
+    explicit coroutine( coroutine_fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+       typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator, typename Allocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+#endif
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+#else
+    template< typename Fn >
+    explicit coroutine( Fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+#endif
+
+    coroutine( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    { swap( other); }
+
+    coroutine & operator=( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT
+    {
+        coroutine tmp( boost::move( other) );
+        swap( tmp);
+        return * this;
+    }
+
+    bool empty() const BOOST_NOEXCEPT
+    { return ! impl_; }
+
+    operator safe_bool() const BOOST_NOEXCEPT
+    { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+
+    bool operator!() const BOOST_NOEXCEPT
+    { return empty() || impl_->is_complete(); }
+
+    void swap( coroutine & other) BOOST_NOEXCEPT
+    { impl_.swap( other.impl_); }
+};
+
+template< typename Signature, int arity >
+class coroutine : public detail::coroutine_op<
+                        Signature,
+                        coroutine< Signature >,
+                        typename function_traits< Signature >::result_type,
+                        function_traits< Signature >::arity
+                  >,
+                  public detail::coroutine_get<
+                        coroutine< Signature >,
+                        typename function_traits< Signature >::result_type,
+                        function_traits< Signature >::arity
+                  >
+{
+private:
+    typedef detail::coroutine_base< Signature >                 base_t;
+    typedef typename base_t::ptr_t                              ptr_t;
+
+    template< typename X, typename Y, int >
+    friend struct detail::coroutine_get;
+    template< typename X, typename Y, typename Z, int >
+    friend struct detail::coroutine_op;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class detail::coroutine_object;
+
+    struct dummy
+    { void nonnull() {} };
+
+    typedef void ( dummy::*safe_bool)();
+
+    ptr_t  impl_;
+
+    BOOST_MOVABLE_BUT_NOT_COPYABLE( coroutine);
+
+    template< typename Allocator >
+    coroutine( context::fcontext_t * callee,
+               bool unwind, bool preserve_fpu,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_caller<
+                Signature, Allocator
+            >                               caller_t;
+        typename caller_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) caller_t(
+                callee, unwind, preserve_fpu, a) );
+    }
+
+public:
+    typedef typename detail::caller<
+        Signature,
+        boost::coroutines::coroutine
+    >::type                                                     caller_type;
+    typedef typename detail::arg< Signature >::type             arguments;
+
+    coroutine() BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {}
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_MSVC
+    typedef void ( * coroutine_fn) ( caller_type &);
+
+    explicit coroutine( coroutine_fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    explicit coroutine( coroutine_fn fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+       typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >() ) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename StackAllocator, typename Allocator >
+    explicit coroutine( coroutine_fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+        typedef detail::coroutine_object<
+                Signature,
+                coroutine_fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+        >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< coroutine_fn >( fn), attr, stack_alloc, a) );
+    }
+#endif
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, arguments arg, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( forward< Fn >( fn), arg, attr, stack_alloc, a) );
+    }
+#else
+    template< typename Fn >
+    explicit coroutine( Fn fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( Fn fn, arguments arg, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, arg, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( Fn fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_convertible< Fn &, BOOST_RV_REF( Fn) >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr = attributes(),
+               stack_allocator const& stack_alloc =
+                    stack_allocator(),
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, stack_allocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               std::allocator< coroutine > const& alloc =
+                    std::allocator< coroutine >(),
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, std::allocator< coroutine >,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+
+    template< typename Fn, typename StackAllocator, typename Allocator >
+    explicit coroutine( BOOST_RV_REF( Fn) fn, attributes const& attr,
+               StackAllocator const& stack_alloc,
+               Allocator const& alloc,
+               typename disable_if<
+                   is_same< typename decay< Fn >::type, coroutine >,
+                   dummy *
+               >::type = 0) :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    {
+//      BOOST_STATIC_ASSERT((
+//          is_same< void, typename result_of< Fn() >::type >::value));
+        typedef detail::coroutine_object<
+                Signature,
+                Fn, StackAllocator, Allocator,
+                caller_type,
+                typename function_traits< Signature >::result_type,
+                function_traits< Signature >::arity
+            >                               object_t;
+        typename object_t::allocator_t a( alloc);
+        impl_ = ptr_t(
+            // placement new
+            ::new( a.allocate( 1) ) object_t( fn, attr, stack_alloc, a) );
+    }
+#endif
+
+    coroutine( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT :
+        detail::coroutine_op<
+            Signature,
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        detail::coroutine_get<
+            coroutine< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        impl_()
+    { swap( other); }
+
+    coroutine & operator=( BOOST_RV_REF( coroutine) other) BOOST_NOEXCEPT
+    {
+        coroutine tmp( boost::move( other) );
+        swap( tmp);
+        return * this;
+    }
+
+    bool empty() const BOOST_NOEXCEPT
+    { return ! impl_; }
+
+    operator safe_bool() const BOOST_NOEXCEPT
+    { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+
+    bool operator!() const BOOST_NOEXCEPT
+    { return empty() || impl_->is_complete(); }
+
+    void swap( coroutine & other) BOOST_NOEXCEPT
+    { impl_.swap( other.impl_); }
+};
+
+template< typename Signature >
+void swap( coroutine< Signature > & l, coroutine< Signature > & r) BOOST_NOEXCEPT
+{ l.swap( r); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::iterator
+range_begin( coroutine< Signature > & c)
+{ return typename coroutine< Signature >::iterator( & c); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::const_iterator
+range_begin( coroutine< Signature > const& c)
+{ return typename coroutine< Signature >::const_iterator( & c); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::iterator
+range_end( coroutine< Signature > & c)
+{ return typename coroutine< Signature >::iterator(); }
+
+template< typename Signature >
+inline
+typename coroutine< Signature >::const_iterator
+range_end( coroutine< Signature > const& c)
+{ return typename coroutine< Signature >::const_iterator(); }
+
+}
+
+template< typename Signature >
+struct range_mutable_iterator< coroutines::coroutine< Signature > >
+{ typedef typename coroutines::coroutine< Signature >::iterator type; };
+
+template< typename Signature >
+struct range_const_iterator< coroutines::coroutine< Signature > >
+{ typedef typename coroutines::coroutine< Signature >::const_iterator type; };
+
+}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_COROUTINE_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/arg.hpp b/project/jni/boost/include/boost/coroutine/detail/arg.hpp
new file mode 100644
index 000000000..f3d35c564
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/arg.hpp
@@ -0,0 +1,61 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_COROUTINES_DETAIL_ARG_H
+#define BOOST_COROUTINES_DETAIL_ARG_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename Signature,
+    int arity = function_traits< Signature >::arity >
+struct arg;
+
+template< typename Signature >
+struct arg< Signature, 1 >
+{
+    typedef typename function_traits< Signature >::arg1_type    type;
+};
+
+#define BOOST_CONTEXT_TUPLE_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_CONTEXT_TUPLE_TYPE(z,n,unused) \
+    BOOST_CONTEXT_TUPLE_COMMA(n) typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_CONTEXT_TUPLE_TYPES(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_CONTEXT_TUPLE_TYPE,~)
+#define BOOST_CONTEXT_TUPLE(z,n,unused) \
+template< typename Signature > \
+struct arg< Signature, n > \
+{ \
+    typedef tuple< BOOST_CONTEXT_TUPLE_TYPES(n) >   type; \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_CONTEXT_TUPLE,~)
+#undef BOOST_CONTEXT_TUPLE
+#undef BOOST_CONTEXT_TUPLE_TYPES
+#undef BOOST_CONTEXT_TUPLE_TYPE
+#undef BOOST_CONTEXT_TUPLE_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_ARG_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/config.hpp b/project/jni/boost/include/boost/coroutine/detail/config.hpp
new file mode 100644
index 000000000..c08a9a3b2
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/config.hpp
@@ -0,0 +1,42 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_CONFIG_H
+#define BOOST_COROUTINES_DETAIL_CONFIG_H
+
+#include 
+#include 
+
+#ifdef BOOST_COROUTINES_DECL
+# undef BOOST_COROUTINES_DECL
+#endif
+
+#if defined(BOOST_HAS_DECLSPEC)
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COROUTINES_DYN_LINK)
+#  if ! defined(BOOST_DYN_LINK)
+#   define BOOST_DYN_LINK
+#  endif
+#  if defined(BOOST_COROUTINES_SOURCE)
+#   define BOOST_COROUTINES_DECL BOOST_SYMBOL_EXPORT
+#  else 
+#   define BOOST_COROUTINES_DECL BOOST_SYMBOL_IMPORT
+#  endif
+# endif
+#endif
+
+#if ! defined(BOOST_COROUTINES_DECL)
+# define BOOST_COROUTINES_DECL
+#endif
+
+#if ! defined(BOOST_COROUTINES_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_COROUTINES_NO_LIB)
+# define BOOST_LIB_NAME boost_context
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COROUTINES_DYN_LINK)
+#  define BOOST_DYN_LINK
+# endif
+# include 
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_CONFIG_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp
new file mode 100644
index 000000000..8f649c54f
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_base.hpp
@@ -0,0 +1,103 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature >
+class coroutine_base : private noncopyable,
+                       public coroutine_base_resume<
+                            Signature,
+                            coroutine_base< Signature >,
+                            typename function_traits< Signature >::result_type,
+                            function_traits< Signature >::arity
+                       >
+{
+public:
+    typedef intrusive_ptr< coroutine_base >     ptr_t;
+
+private:
+    template< typename X, typename Y, typename Z, int >
+    friend class coroutine_base_resume;
+    template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
+    friend class coroutine_object;
+
+    unsigned int            use_count_;
+    context::fcontext_t     caller_;
+    context::fcontext_t *   callee_;
+    int                     flags_;
+    exception_ptr           except_;
+
+protected:
+    virtual void deallocate_object() = 0;
+
+public:
+    coroutine_base( context::fcontext_t * callee, bool unwind, bool preserve_fpu) :
+        coroutine_base_resume<
+            Signature,
+            coroutine_base< Signature >,
+            typename function_traits< Signature >::result_type,
+            function_traits< Signature >::arity
+        >(),
+        use_count_( 0),
+        caller_(),
+        callee_( callee),
+        flags_( 0),
+        except_()
+    {
+        if ( unwind) flags_ |= flag_force_unwind;
+        if ( preserve_fpu) flags_ |= flag_preserve_fpu;
+    }
+
+    virtual ~coroutine_base()
+    {}
+
+    bool force_unwind() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_force_unwind); }
+
+    bool unwind_requested() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_unwind_stack); }
+
+    bool preserve_fpu() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_preserve_fpu); }
+
+    bool is_complete() const BOOST_NOEXCEPT
+    { return 0 != ( flags_ & flag_complete); }
+
+    friend inline void intrusive_ptr_add_ref( coroutine_base * p) BOOST_NOEXCEPT
+    { ++p->use_count_; }
+
+    friend inline void intrusive_ptr_release( coroutine_base * p) BOOST_NOEXCEPT
+    { if ( --p->use_count_ == 0) p->deallocate_object(); }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp
new file mode 100644
index 000000000..83a398835
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_base_resume.hpp
@@ -0,0 +1,237 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename D, typename Result, int arity >
+class coroutine_base_resume;
+
+template< typename Signature, typename D >
+class coroutine_base_resume< Signature, D, void, 0 >
+{
+public:
+    void resume()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+class coroutine_base_resume< Signature, D, Result, 0 >
+{
+public:
+    void resume()
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        result_ = hldr_from->data;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+
+protected:
+    template< typename X, typename Y, int >
+    friend struct coroutine_get;
+
+    optional< Result >  result_;
+};
+
+template< typename Signature, typename D >
+class coroutine_base_resume< Signature, D, void, 1 >
+{
+public:
+    typedef typename arg< Signature >::type     arg_type;
+
+    void resume( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+class coroutine_base_resume< Signature, D, Result, 1 >
+{
+public:
+    typedef typename arg< Signature >::type     arg_type;
+
+    void resume( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this));
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
+        BOOST_ASSERT( static_cast< D * >( this)->callee_);
+
+        context::fcontext_t caller;
+        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+            hldr_to.ctx,
+            static_cast< D * >( this)->callee_,
+            reinterpret_cast< intptr_t >( & hldr_to),
+            static_cast< D * >( this)->preserve_fpu() ) ) );
+        static_cast< D * >( this)->callee_ = hldr_from->ctx;
+        result_ = hldr_from->data;
+        if ( hldr_from->force_unwind) throw forced_unwind();
+        if ( static_cast< D * >( this)->except_)
+            rethrow_exception( static_cast< D * >( this)->except_);
+    }
+
+protected:
+    template< typename X, typename Y, int >
+    friend struct coroutine_get;
+
+    optional< Result >  result_;
+};
+
+#define BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_COROUTINE_BASE_RESUME_VAL(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_BASE_RESUME_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_VAL,~)
+#define BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) \
+    typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_COROUTINE_BASE_RESUME_ARG(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_BASE_RESUME_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_ARG,~)
+#define BOOST_COROUTINE_BASE_RESUME(z,n,unused) \
+template< typename Signature, typename D > \
+class coroutine_base_resume< Signature, D, void, n > \
+{ \
+public: \
+    typedef typename arg< Signature >::type     arg_type; \
+\
+    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
+        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
+\
+        holder< arg_type > hldr_to( \
+            & static_cast< D * >( this)->caller_, \
+            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
+        holder< void > * hldr_from( \
+            reinterpret_cast< holder< void > * >( context::jump_fcontext( \
+                hldr_to.ctx, \
+                static_cast< D * >( this)->callee_, \
+                reinterpret_cast< intptr_t >( & hldr_to), \
+                static_cast< D * >( this)->preserve_fpu() ) ) ); \
+        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
+        if ( hldr_from->force_unwind) throw forced_unwind(); \
+        if ( static_cast< D * >( this)->except_) \
+            rethrow_exception( static_cast< D * >( this)->except_); \
+    } \
+}; \
+\
+template< typename Signature, typename D, typename Result > \
+class coroutine_base_resume< Signature, D, Result, n > \
+{ \
+public: \
+    typedef typename arg< Signature >::type     arg_type; \
+\
+    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
+        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
+\
+        holder< arg_type > hldr_to( \
+            & static_cast< D * >( this)->caller_, \
+            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
+        holder< Result > * hldr_from( \
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext( \
+                hldr_to.ctx, \
+                static_cast< D * >( this)->callee_, \
+                reinterpret_cast< intptr_t >( & hldr_to), \
+                static_cast< D * >( this)->preserve_fpu() ) ) ); \
+        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
+        result_ = hldr_from->data; \
+        if ( hldr_from->force_unwind) throw forced_unwind(); \
+        if ( static_cast< D * >( this)->except_) \
+            rethrow_exception( static_cast< D * >( this)->except_); \
+    } \
+\
+protected: \
+    template< typename X, typename Y, int > \
+    friend struct coroutine_get; \
+\
+    optional< Result >  result_; \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_BASE_RESUME,~)
+#undef BOOST_COROUTINE_BASE_RESUME
+#undef BOOST_COROUTINE_BASE_RESUME_ARGS
+#undef BOOST_COROUTINE_BASE_RESUME_ARG
+#undef BOOST_COROUTINE_BASE_RESUME_ARG_TYPE
+#undef BOOST_COROUTINE_BASE_RESUME_VALS
+#undef BOOST_COROUTINE_BASE_RESUME_VAL
+#undef BOOST_COROUTINE_BASE_RESUME_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_coroutine_base_resume_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp
new file mode 100644
index 000000000..067aff875
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_caller.hpp
@@ -0,0 +1,57 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
+
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename Allocator >
+class coroutine_caller : public  coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_caller< Signature, Allocator >
+    >::other   allocator_t;
+
+    coroutine_caller( context::fcontext_t * callee, bool unwind, bool preserve_fpu,
+                    allocator_t const& alloc) BOOST_NOEXCEPT :
+        coroutine_base< Signature >( callee, unwind, preserve_fpu),
+        alloc_( alloc)
+    {}
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+
+private:
+    allocator_t   alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_caller * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp
new file mode 100644
index 000000000..c2a333909
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_get.hpp
@@ -0,0 +1,54 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template<
+    typename D,
+    typename Result, int arity
+>
+struct coroutine_get;
+
+template< typename D, int arity >
+struct coroutine_get< D, void, arity >
+{};
+
+template< typename D, typename Result, int arity >
+struct coroutine_get
+{
+    bool has_result() const
+    { return static_cast< D const* >( this)->impl_->result_; }
+
+    typename param< Result >::type get() const
+    {
+        BOOST_ASSERT( static_cast< D const* >( this)->impl_->result_);
+        return static_cast< D const* >( this)->impl_->result_.get();
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp
new file mode 100644
index 000000000..219be5295
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object.hpp
@@ -0,0 +1,79 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Coroutine >
+void trampoline1( intptr_t vp)
+{
+    BOOST_ASSERT( vp);
+
+    reinterpret_cast< Coroutine * >( vp)->run();
+}
+
+template< typename Coroutine, typename Arg >
+void trampoline2( intptr_t vp)
+{
+    BOOST_ASSERT( vp);
+
+    tuple< Coroutine *, Arg > * tpl(
+        reinterpret_cast< tuple< Coroutine *, Arg > * >( vp) );
+    Coroutine * coro( get< 0 >( * tpl) );
+    Arg arg( get< 1 >( * tpl) );
+
+    coro->run( arg);
+}
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object;
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp
new file mode 100644
index 000000000..1186b0d69
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_0.ipp
@@ -0,0 +1,409 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
+        >
+    >::other                                            allocator_t;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            holder< Result > hldr_to( & caller);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp
new file mode 100644
index 000000000..5042ccb69
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_1.ipp
@@ -0,0 +1,553 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp
new file mode 100644
index 000000000..975365ed8
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_result_arity.ipp
@@ -0,0 +1,553 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    typename Result, int arity
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< Result > * hldr_from(
+            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        this->result_ = hldr_from->data;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< Result > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp
new file mode 100644
index 000000000..1fad47d8d
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_0.ipp
@@ -0,0 +1,403 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 0
+        >
+    >::other                                        allocator_t;
+
+private:
+    typedef coroutine_base< Signature >             base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object const&);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr_to( & caller);
+            context::jump_fcontext(
+                hldr_to.ctx, callee,
+                reinterpret_cast< intptr_t >( & hldr_to),
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< void > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp
new file mode 100644
index 000000000..76cac246f
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_1.ipp
@@ -0,0 +1,546 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn,
+                      typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, 1
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn,
+                      typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp
new file mode 100644
index 000000000..0f0eeeb2a
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_object_void_arity.ipp
@@ -0,0 +1,547 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( forward< Fn >( fn) ),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#else
+    coroutine_object( Fn fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+#endif
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
+
+template<
+    typename Signature,
+    typename Fn, typename StackAllocator, typename Allocator,
+    typename Caller,
+    int arity
+>
+class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
+    public coroutine_base< Signature >
+{
+public:
+    typedef typename Allocator::template rebind<
+        coroutine_object<
+            Signature, Fn, StackAllocator, Allocator, Caller, void, arity
+        >
+    >::other                                            allocator_t;
+    typedef typename arg< Signature >::type             arg_type;
+
+private:
+    typedef coroutine_base< Signature >                 base_type;
+
+    Fn                  fn_;
+    context::stack_t    stack_;
+    StackAllocator      stack_alloc_;
+    allocator_t         alloc_;
+
+    static void destroy_( allocator_t & alloc, coroutine_object * p)
+    {
+        alloc.destroy( p);
+        alloc.deallocate( p, 1);
+    }
+
+    coroutine_object( coroutine_object &);
+    coroutine_object & operator=( coroutine_object const&);
+
+    void enter_()
+    {
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( this),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void enter_( typename detail::param< arg_type >::type arg)
+    {
+        tuple< coroutine_object *,
+               typename detail::param< arg_type >::type
+        > tpl( this, arg);
+        holder< void > * hldr_from(
+            reinterpret_cast< holder< void > * >( context::jump_fcontext(
+                & this->caller_, this->callee_,
+                reinterpret_cast< intptr_t >( & tpl),
+                this->preserve_fpu() ) ) );
+        this->callee_ = hldr_from->ctx;
+        if ( this->except_) rethrow_exception( this->except_);
+    }
+
+    void run_( Caller & c)
+    {
+        context::fcontext_t * callee( 0);
+        context::fcontext_t caller;
+        try
+        {
+            fn_( c);
+            this->flags_ |= flag_complete;
+            callee = c.impl_->callee_;
+            BOOST_ASSERT( callee);
+            holder< void > hldr( & caller);
+            context::jump_fcontext(
+                hldr.ctx, callee,
+                ( intptr_t) & hldr,
+                this->preserve_fpu() );
+            BOOST_ASSERT_MSG( false, "coroutine is complete");
+        }
+        catch ( forced_unwind const&)
+        {}
+        catch (...)
+        { this->except_ = current_exception(); }
+
+        this->flags_ |= flag_complete;
+        callee = c.impl_->callee_;
+        BOOST_ASSERT( callee);
+        context::jump_fcontext(
+            & caller, callee,
+            reinterpret_cast< intptr_t >( & caller),
+            this->preserve_fpu() );
+        BOOST_ASSERT_MSG( false, "coroutine is complete");
+    }
+
+    void unwind_stack_() BOOST_NOEXCEPT
+    {
+        BOOST_ASSERT( ! this->is_complete() );
+
+        this->flags_ |= flag_unwind_stack;
+        holder< arg_type > hldr( & this->caller_, true);
+        context::jump_fcontext(
+            hldr.ctx, this->callee_,
+            reinterpret_cast< intptr_t >( & hldr),
+            this->preserve_fpu() );
+        this->flags_ &= ~flag_unwind_stack;
+
+        BOOST_ASSERT( this->is_complete() );
+    }
+
+public:
+    coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline1< coroutine_object >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_(); }
+
+    coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
+                      StackAllocator const& stack_alloc,
+                      allocator_t const& alloc) :
+        base_type(
+            context::make_fcontext(
+                stack_alloc.allocate( attr.size), attr.size,
+                trampoline2< coroutine_object, typename detail::param< arg_type >::type >),
+            stack_unwind == attr.do_unwind,
+            fpu_preserved == attr.preserve_fpu),
+        fn_( fn),
+        stack_( base_type::callee_->fc_stack),
+        stack_alloc_( stack_alloc),
+        alloc_( alloc)
+    { enter_( arg); }
+
+    ~coroutine_object()
+    {
+        if ( ! this->is_complete() && this->force_unwind() ) unwind_stack_();
+        stack_alloc_.deallocate( stack_.sp, stack_.size);
+    }
+
+    void run()
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        run_( c);
+    }
+
+    void run( typename detail::param< arg_type >::type arg)
+    {
+        Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
+        c.impl_->result_ = arg;
+        run_( c);
+    }
+
+    void deallocate_object()
+    { destroy_( alloc_, this); }
+};
diff --git a/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp b/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp
new file mode 100644
index 000000000..4bab16f0c
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/coroutine_op.hpp
@@ -0,0 +1,312 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
+#define BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Signature, typename D, typename Result, int arity >
+struct coroutine_op;
+
+template< typename Signature, typename D >
+struct coroutine_op< Signature, D, void, 0 >
+{
+    D & operator()()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume();
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+struct coroutine_op< Signature, D, Result, 0 >
+{
+    class iterator : public std::iterator< std::input_iterator_tag, typename remove_reference< Result >::type >
+    {
+    private:
+        D               *   dp_;
+        optional< Result >  val_;
+
+        void fetch_()
+        {
+            BOOST_ASSERT( dp_);
+
+            if ( ! dp_->has_result() )
+            {
+                dp_ = 0;
+                val_ = none;
+                return;
+            }
+            val_ = dp_->get();
+        }
+
+        void increment_()
+        {
+            BOOST_ASSERT( dp_);
+            BOOST_ASSERT( * dp_);
+
+            ( * dp_)();
+            fetch_();
+        }
+
+    public:
+        typedef typename std::iterator_traits< iterator >::pointer      pointer_t;
+        typedef typename std::iterator_traits< iterator >::reference    reference_t;
+
+        iterator() :
+            dp_( 0), val_()
+        {}
+
+        explicit iterator( D * dp) :
+            dp_( dp), val_()
+        { fetch_(); }
+
+        iterator( iterator const& other) :
+            dp_( other.dp_), val_( other.val_)
+        {}
+
+        iterator & operator=( iterator const& other)
+        {
+            if ( this == & other) return * this;
+            dp_ = other.dp_;
+            val_ = other.val_;
+            return * this;
+        }
+
+        bool operator==( iterator const& other)
+        { return other.dp_ == dp_ && other.val_ == val_; }
+
+        bool operator!=( iterator const& other)
+        { return other.dp_ != dp_ || other.val_ != val_; }
+
+        iterator & operator++()
+        {
+            increment_();
+            return * this;
+        }
+
+        reference_t operator*() const
+        { return const_cast< optional< Result > & >( val_).get(); }
+
+        pointer_t operator->() const
+        { return const_cast< optional< Result > & >( val_).get_ptr(); }
+    };
+
+    class const_iterator : public std::iterator< std::input_iterator_tag, typename remove_reference< const Result >::type >
+    {
+    private:
+        D                       *   dp_;
+        optional< const Result >    val_;
+
+        void fetch_()
+        {
+            BOOST_ASSERT( dp_);
+
+            if ( ! dp_->has_result() )
+            {
+                dp_ = 0;
+                val_ = none;
+                return;
+            }
+            val_ = dp_->get();
+        }
+
+        void increment_()
+        {
+            BOOST_ASSERT( dp_);
+            BOOST_ASSERT( * dp_);
+
+            ( * dp_)();
+            fetch_();
+        }
+
+    public:
+        typedef typename std::iterator_traits< iterator >::pointer      pointer_t;
+        typedef typename std::iterator_traits< iterator >::reference    reference_t;
+
+        const_iterator() :
+            dp_( 0), val_()
+        {}
+
+        explicit const_iterator( D * dp) :
+            dp_( dp), val_()
+        { fetch_(); }
+
+        const_iterator( const_iterator const& other) :
+            dp_( other.dp_), val_( other.val_)
+        {}
+
+        const_iterator & operator=( const_iterator const& other)
+        {
+            if ( this == & other) return * this;
+            dp_ = other.dp_;
+            val_ = other.val_;
+            return * this;
+        }
+
+        bool operator==( const_iterator const& other)
+        { return other.dp_ == dp_ && other.val_ == val_; }
+
+        bool operator!=( const_iterator const& other)
+        { return other.dp_ != dp_ || other.val_ != val_; }
+
+        const_iterator & operator++()
+        {
+            increment_();
+            return * this;
+        }
+
+        reference_t operator*() const
+        { return val_.get(); }
+
+        pointer_t operator->() const
+        { return val_.get_ptr(); }
+    };
+
+    D & operator()()
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume();
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D >
+struct coroutine_op< Signature, D, void, 1 >
+{
+    typedef typename arg< Signature >::type   arg_type;
+
+    class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void >
+    {
+    private:
+       D    *   dp_;
+
+    public:
+        iterator() :
+           dp_( 0)
+        {}
+
+        explicit iterator( D * dp) :
+            dp_( dp)
+        {}
+
+        iterator & operator=( arg_type a1)
+        {
+            BOOST_ASSERT( dp_);
+            if ( ! ( * dp_)( a1) ) dp_ = 0;
+            return * this;
+        }
+
+        bool operator==( iterator const& other)
+        { return other.dp_ == dp_; }
+
+        bool operator!=( iterator const& other)
+        { return other.dp_ != dp_; }
+
+        iterator & operator*()
+        { return * this; }
+
+        iterator & operator++()
+        { return * this; }
+    };
+
+    struct const_iterator;
+
+    D & operator()( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume( a1);
+
+        return * static_cast< D * >( this);
+    }
+};
+
+template< typename Signature, typename D, typename Result >
+struct coroutine_op< Signature, D, Result, 1 >
+{
+    typedef typename arg< Signature >::type   arg_type;
+
+    D & operator()( arg_type a1)
+    {
+        BOOST_ASSERT( static_cast< D * >( this)->impl_);
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
+
+        static_cast< D * >( this)->impl_->resume( a1);
+
+        return * static_cast< D * >( this);
+    }
+};
+
+#define BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
+#define BOOST_COROUTINE_OP_VAL(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_OP_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_VAL,~)
+#define BOOST_COROUTINE_OP_ARG_TYPE(n) \
+    typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
+#define BOOST_COROUTINE_OP_ARG(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_COROUTINE_OP_ARG_TYPE(n) BOOST_PP_CAT(a,n)
+#define BOOST_COROUTINE_OP_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_ARG,~)
+#define BOOST_COROUTINE_OP(z,n,unused) \
+template< typename Signature, typename D, typename Result > \
+struct coroutine_op< Signature, D, Result, n > \
+{ \
+    D & operator()( BOOST_COROUTINE_OP_ARGS(n)) \
+    { \
+        BOOST_ASSERT( static_cast< D * >( this)->impl_); \
+        BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() ); \
+\
+        static_cast< D * >( this)->impl_->resume(BOOST_COROUTINE_OP_VALS(n)); \
+\
+        return * static_cast< D * >( this); \
+    } \
+};
+BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_OP,~)
+#undef BOOST_COROUTINE_OP
+#undef BOOST_COROUTINE_OP_ARGS
+#undef BOOST_COROUTINE_OP_ARG
+#undef BOOST_COROUTINE_OP_ARG_TYPE
+#undef BOOST_COROUTINE_OP_VALS
+#undef BOOST_COROUTINE_OP_VAL
+#undef BOOST_COROUTINE_OP_COMMA
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp b/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp
new file mode 100644
index 000000000..39f385407
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/exceptions.hpp
@@ -0,0 +1,28 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
+#define BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+struct forced_unwind {};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_EXCEPTIONs_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/flags.hpp b/project/jni/boost/include/boost/coroutine/detail/flags.hpp
new file mode 100644
index 000000000..33f2142f7
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/flags.hpp
@@ -0,0 +1,34 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_FLAGS_H
+#define BOOST_COROUTINES_DETAIL_FLAGS_H
+
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+enum flag_t
+{
+    flag_complete       = 1 << 1,
+    flag_unwind_stack   = 1 << 2,
+    flag_force_unwind   = 1 << 3,
+    flag_preserve_fpu   = 1 << 4
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_FLAGS_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/holder.hpp b/project/jni/boost/include/boost/coroutine/detail/holder.hpp
new file mode 100644
index 000000000..f72115859
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/holder.hpp
@@ -0,0 +1,88 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_HOLDER_H
+#define BOOST_COROUTINES_DETAIL_HOLDER_H
+
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename Data >
+struct holder
+{
+    context::fcontext_t *   ctx;
+    optional< Data >        data;
+    bool                    force_unwind;
+
+    holder( context::fcontext_t * ctx_) :
+        ctx( ctx_), data(), force_unwind( false)
+    { BOOST_ASSERT( ctx); }
+
+    holder( context::fcontext_t * ctx_, Data data_) :
+        ctx( ctx_), data( data_), force_unwind( false)
+    { BOOST_ASSERT( ctx); }
+
+    holder( context::fcontext_t * ctx_, bool force_unwind_) :
+        ctx( ctx_), data(), force_unwind( force_unwind_)
+    {
+        BOOST_ASSERT( ctx);
+        BOOST_ASSERT( force_unwind);
+    }
+
+    holder( holder const& other) :
+        ctx( other.ctx), data( other.data),
+        force_unwind( other.force_unwind)
+    {}
+
+    holder & operator=( holder const& other)
+    {
+        if ( this == & other) return * this;
+        ctx = other.ctx;
+        data = other.data;
+        force_unwind = other.force_unwind;
+        return * this;
+    }
+};
+
+template<>
+struct holder< void >
+{
+    context::fcontext_t *   ctx;
+    bool                    force_unwind;
+
+    holder( context::fcontext_t * ctx_, bool force_unwind_ = false) :
+        ctx( ctx_), force_unwind( force_unwind_)
+    { BOOST_ASSERT( ctx); }
+
+    holder( holder const& other) :
+        ctx( other.ctx), force_unwind( other.force_unwind)
+    {}
+
+    holder & operator=( holder const& other)
+    {
+        if ( this == & other) return * this;
+        ctx = other.ctx;
+        force_unwind = other.force_unwind;
+        return * this;
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_HOLDER_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/param.hpp b/project/jni/boost/include/boost/coroutine/detail/param.hpp
new file mode 100644
index 000000000..4e8f1fecb
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/param.hpp
@@ -0,0 +1,46 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_PARAM_H
+#define BOOST_COROUTINES_DETAIL_PARAM_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+template< typename T >
+struct param : 
+    public mpl::eval_if<
+        mpl::or_<
+            is_scalar< T >,
+            is_stateless< T >,
+            is_reference< T >
+        >,
+        mpl::identity< T >,
+        add_reference< T >
+    >
+{};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_COROUTINES_DETAIL_PARAM_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp
new file mode 100644
index 000000000..2dac80108
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_posix.hpp
@@ -0,0 +1,165 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+
+#include 
+
+extern "C" {
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+}
+
+//#if _POSIX_C_SOURCE >= 200112L
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#if !defined (SIGSTKSZ)
+# define SIGSTKSZ (8 * 1024)
+# define UDEF_SIGSTKSZ
+#endif
+
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+inline
+std::size_t pagesize()
+{
+    // conform to POSIX.1-2001
+    static std::size_t size = ::sysconf( _SC_PAGESIZE);
+    return size;
+}
+
+inline
+rlimit stacksize_limit_()
+{
+    rlimit limit;
+    // conforming to POSIX.1-2001
+    const int result = ::getrlimit( RLIMIT_STACK, & limit);
+    BOOST_ASSERT( 0 == result);
+    return limit;
+}
+
+inline
+rlimit stacksize_limit()
+{
+    static rlimit limit = stacksize_limit_();
+    return limit;
+}
+
+inline
+std::size_t page_count( std::size_t stacksize)
+{
+    return static_cast< std::size_t >( 
+        std::ceil(
+            static_cast< float >( stacksize) / pagesize() ) );
+}
+
+class stack_allocator
+{
+public:
+    static bool is_stack_unbound()
+    { return RLIM_INFINITY == stacksize_limit().rlim_max; }
+
+    static std::size_t default_stacksize()
+    {
+        std::size_t size = 8 * minimum_stacksize();
+        if ( is_stack_unbound() ) return size;
+        
+        BOOST_ASSERT( maximum_stacksize() >= minimum_stacksize() );
+        return maximum_stacksize() == size
+            ? size
+            : (std::min)( size, maximum_stacksize() );
+    }
+
+    static std::size_t minimum_stacksize()
+    { return SIGSTKSZ + sizeof( context::fcontext_t) + 15; }
+
+    static std::size_t maximum_stacksize()
+    {
+        BOOST_ASSERT( ! is_stack_unbound() );
+        return static_cast< std::size_t >( stacksize_limit().rlim_max);
+    }
+
+    void * allocate( std::size_t size) const
+    {
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages( page_count( size) + 1); // add one guard page
+        const std::size_t size_( pages * pagesize() );
+        BOOST_ASSERT( 0 < size && 0 < size_);
+
+        const int fd( ::open("/dev/zero", O_RDONLY) );
+        BOOST_ASSERT( -1 != fd);
+        // conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
+        void * limit =
+# if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+        ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+# else
+        ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+# endif
+        ::close( fd);
+        if ( ! limit) throw std::bad_alloc();
+
+        std::memset( limit, size_, '\0');
+
+        // conforming to POSIX.1-2001
+        const int result( ::mprotect( limit, pagesize(), PROT_NONE) );
+        BOOST_ASSERT( 0 == result);
+
+        return static_cast< char * >( limit) + size_;
+    }
+
+    void deallocate( void * vp, std::size_t size) const
+    {
+        BOOST_ASSERT( vp);
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages = page_count( size) + 1;
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+        void * limit = static_cast< char * >( vp) - size_;
+        // conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
+        ::munmap( limit, size_);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+#ifdef UDEF_SIGSTKSZ
+# undef SIGSTKSZ
+#endif
+
+//#endif
+
+#endif // BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp
new file mode 100644
index 000000000..7cbdcbe5b
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/detail/stack_allocator_windows.hpp
@@ -0,0 +1,158 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
+
+#include 
+
+extern "C" {
+#include 
+}
+
+//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+# if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable:4244 4267)
+# endif
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+    || defined(__amd64__) || defined(__amd64) \
+    || defined(_M_X64) || defined(_M_AMD64)
+
+// Windows seams not to provide a constant or function
+// telling the minimal stacksize
+# define MIN_STACKSIZE  8 * 1024
+#else
+# define MIN_STACKSIZE  4 * 1024
+#endif
+
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace coroutines {
+namespace detail {
+
+inline
+SYSTEM_INFO system_info_()
+{
+    SYSTEM_INFO si;
+    ::GetSystemInfo( & si);
+    return si;
+}
+
+inline
+SYSTEM_INFO system_info()
+{
+    static SYSTEM_INFO si = system_info_();
+    return si;
+}
+
+inline
+std::size_t pagesize()
+{ return static_cast< std::size_t >( system_info().dwPageSize); }
+
+inline
+std::size_t page_count( std::size_t stacksize)
+{
+    return static_cast< std::size_t >(
+        std::ceil(
+            static_cast< float >( stacksize) / pagesize() ) );
+}
+
+class stack_allocator
+{
+public:
+    // Windows seams not to provide a limit for the stacksize
+    static bool is_stack_unbound()
+    { return true; }
+
+    static std::size_t default_stacksize()
+    {
+        std::size_t size = 64 * 1024; // 64 kB
+        if ( is_stack_unbound() )
+            return (std::max)( size, minimum_stacksize() );
+
+        BOOST_ASSERT( maximum_stacksize() >= minimum_stacksize() );
+        return maximum_stacksize() == minimum_stacksize()
+            ? minimum_stacksize()
+            : ( std::min)( size, maximum_stacksize() );
+    }
+
+    // because Windows seams not to provide a limit for minimum stacksize
+    static std::size_t minimum_stacksize()
+    { return MIN_STACKSIZE; }
+
+    // because Windows seams not to provide a limit for maximum stacksize
+    // maximum_stacksize() can never be called (pre-condition ! is_stack_unbound() )
+    static std::size_t maximum_stacksize()
+    {
+        BOOST_ASSERT( ! is_stack_unbound() );
+        return  1 * 1024 * 1024 * 1024; // 1GB
+    }
+
+    void * allocate( std::size_t size) const
+    {
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages( page_count( size) + 1); // add one guard page
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+
+        void * limit = ::VirtualAlloc( 0, size_, MEM_COMMIT, PAGE_READWRITE);
+        if ( ! limit) throw std::bad_alloc();
+
+        std::memset( limit, size_, '\0');
+
+        DWORD old_options;
+        const BOOL result = ::VirtualProtect(
+            limit, pagesize(), PAGE_READWRITE | PAGE_GUARD /*PAGE_NOACCESS*/, & old_options);
+        BOOST_ASSERT( FALSE != result);
+
+        return static_cast< char * >( limit) + size_;
+    }
+
+    void deallocate( void * vp, std::size_t size) const
+    {
+        BOOST_ASSERT( vp);
+        BOOST_ASSERT( minimum_stacksize() <= size);
+        BOOST_ASSERT( is_stack_unbound() || ( maximum_stacksize() >= size) );
+
+        const std::size_t pages = page_count( size) + 1;
+        const std::size_t size_ = pages * pagesize();
+        BOOST_ASSERT( 0 < size && 0 < size_);
+        void * limit = static_cast< char * >( vp) - size_;
+        ::VirtualFree( limit, 0, MEM_RELEASE);
+    }
+};
+
+}}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#  include BOOST_ABI_SUFFIX
+#endif
+
+//#endif
+
+#endif // BOOST_COROUTINES_DETAIL_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/coroutine/flags.hpp b/project/jni/boost/include/boost/coroutine/flags.hpp
new file mode 100644
index 000000000..a8194c60e
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/flags.hpp
@@ -0,0 +1,27 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_FLAGS_H
+#define BOOST_COROUTINES_FLAGS_H
+
+namespace boost {
+namespace coroutines {
+
+enum flag_unwind_t
+{
+    stack_unwind = 0,
+    no_stack_unwind
+};
+
+enum flag_fpu_t
+{
+    fpu_preserved = 0,
+    fpu_not_preserved
+};
+
+}}
+
+#endif // BOOST_COROUTINES_FLAGS_H
diff --git a/project/jni/boost/include/boost/coroutine/stack_allocator.hpp b/project/jni/boost/include/boost/coroutine/stack_allocator.hpp
new file mode 100644
index 000000000..6d8058342
--- /dev/null
+++ b/project/jni/boost/include/boost/coroutine/stack_allocator.hpp
@@ -0,0 +1,23 @@
+
+//          Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COROUTINES_STACK_ALLOCATOR_H
+#define BOOST_COROUTINES_STACK_ALLOCATOR_H
+
+#include 
+
+#if defined (BOOST_WINDOWS)
+#include 
+#else
+#include 
+#endif
+
+namespace boost {
+namespace coroutines {
+using detail::stack_allocator;
+}}
+
+#endif // BOOST_COROUTINES_STACK_ALLOCATOR_H
diff --git a/project/jni/boost/include/boost/date_time.hpp b/project/jni/boost/include/boost/date_time.hpp
index c9666222e..07715262c 100644
--- a/project/jni/boost/include/boost/date_time.hpp
+++ b/project/jni/boost/include/boost/date_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
  
  //  See www.boost.org/libs/date_time for documentation.
diff --git a/project/jni/boost/include/boost/date_time/adjust_functors.hpp b/project/jni/boost/include/boost/date_time/adjust_functors.hpp
index 7854ae4b7..dde8ca859 100644
--- a/project/jni/boost/include/boost/date_time/adjust_functors.hpp
+++ b/project/jni/boost/include/boost/date_time/adjust_functors.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/date.hpp"
diff --git a/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp b/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
index f8025828f..45e96d3af 100644
--- a/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
+++ b/project/jni/boost/include/boost/date_time/c_local_time_adjustor.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 /*! @file c_local_time_adjustor.hpp
diff --git a/project/jni/boost/include/boost/date_time/c_time.hpp b/project/jni/boost/include/boost/date_time/c_time.hpp
index f19e78576..f7e116b2d 100644
--- a/project/jni/boost/include/boost/date_time/c_time.hpp
+++ b/project/jni/boost/include/boost/date_time/c_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/compiler_config.hpp b/project/jni/boost/include/boost/date_time/compiler_config.hpp
index 304748f25..1aa1330f6 100644
--- a/project/jni/boost/include/boost/date_time/compiler_config.hpp
+++ b/project/jni/boost/include/boost/date_time/compiler_config.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2011-07-26 13:40:21 -0400 (Tue, 26 Jul 2011) $
+ * $Date: 2011-07-26 10:40:21 -0700 (Tue, 26 Jul 2011) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/constrained_value.hpp b/project/jni/boost/include/boost/date_time/constrained_value.hpp
index b273dd5aa..7338105e2 100644
--- a/project/jni/boost/include/boost/date_time/constrained_value.hpp
+++ b/project/jni/boost/include/boost/date_time/constrained_value.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date.hpp b/project/jni/boost/include/boost/date_time/date.hpp
index 1056fb6a7..f77ae29d5 100644
--- a/project/jni/boost/include/boost/date_time/date.hpp
+++ b/project/jni/boost/include/boost/date_time/date.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -191,8 +191,8 @@ namespace date_time {
       dates.  It is not exposed to users since that would require class
       users to understand the inner workings of the date class.
     */
-    explicit date(date_int_type days) : days_(days) {};
-    explicit date(date_rep_type days) : days_(days.as_number()) {};
+    explicit date(date_int_type days) : days_(days) {}
+    explicit date(date_rep_type days) : days_(days.as_number()) {}
     date_int_type days_;
 
   };
diff --git a/project/jni/boost/include/boost/date_time/date_clock_device.hpp b/project/jni/boost/include/boost/date_time/date_clock_device.hpp
index 6ccb26e25..6202f6c58 100644
--- a/project/jni/boost/include/boost/date_time/date_clock_device.hpp
+++ b/project/jni/boost/include/boost/date_time/date_clock_device.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/c_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_defs.hpp b/project/jni/boost/include/boost/date_time/date_defs.hpp
index bc25b56c0..ae7e4c5a0 100644
--- a/project/jni/boost/include/boost/date_time/date_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/date_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_duration.hpp b/project/jni/boost/include/boost/date_time/date_duration.hpp
index 3871aac0c..c57394457 100644
--- a/project/jni/boost/include/boost/date_time/date_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/date_duration.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_DURATION__
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -26,14 +26,14 @@ namespace date_time {
             , boost::subtractable1< date_duration< duration_rep_traits >
             , boost::dividable2< date_duration< duration_rep_traits >, int
             > > > > >
-  { 
+  {
   public:
     typedef typename duration_rep_traits::int_type duration_rep_type;
     typedef typename duration_rep_traits::impl_type duration_rep;
-    
+
     //! Construct from a day count
-    explicit date_duration(duration_rep day_count) : days_(day_count) {};
-    
+    explicit date_duration(duration_rep day_count) : days_(day_count) {}
+
     /*! construct from special_values - only works when
      * instantiated with duration_traits_adapted */
     date_duration(special_values sv) :
@@ -125,7 +125,7 @@ namespace date_time {
   {
     typedef long int_type;
     typedef long impl_type;
-    static int_type as_number(impl_type i) { return i; };
+    static int_type as_number(impl_type i) { return i; }
   };
 
   /*! Struct for instantiating date_duration WITH special values
@@ -135,9 +135,9 @@ namespace date_time {
   {
     typedef long int_type;
     typedef boost::date_time::int_adapter impl_type;
-    static int_type as_number(impl_type i) { return i.as_number(); };
+    static int_type as_number(impl_type i) { return i.as_number(); }
   };
-  
+
 
 } } //namspace date_time
 
diff --git a/project/jni/boost/include/boost/date_time/date_duration_types.hpp b/project/jni/boost/include/boost/date_time/date_duration_types.hpp
index 1512c0ef2..e44c59fff 100644
--- a/project/jni/boost/include/boost/date_time/date_duration_types.hpp
+++ b/project/jni/boost/include/boost/date_time/date_duration_types.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
                                                                                 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_facet.hpp b/project/jni/boost/include/boost/date_time/date_facet.hpp
index 3eda4c7d0..fc2ddc246 100644
--- a/project/jni/boost/include/boost/date_time/date_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/date_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author:  Martin Andrian, Jeff Garland, Bart Garst
- * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include 
@@ -208,7 +208,8 @@ namespace boost { namespace date_time {
       //  return do_put_special(next, a_ios, fill_char, d.as_special());
       //}
       //The following line of code required the date to support a to_tm function
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_mon = m - 1;
       return do_put_tm(next, a_ios, fill_char, dtm, m_month_format);
     }
@@ -219,7 +220,8 @@ namespace boost { namespace date_time {
                 char_type fill_char,
                 const day_type& day) const
     {
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_mday = day.as_number();
       char_type tmp[3] = {'%','d'};
       string_type temp_format(tmp);
@@ -235,7 +237,8 @@ namespace boost { namespace date_time {
       //  return do_put_special(next, a_ios, fill_char, d.as_special());
       //}
       //The following line of code required the date to support a to_tm function
-      std::tm dtm = {};
+      std::tm dtm;
+      std::memset(&dtm, 0, sizeof(dtm));
       dtm.tm_wday = dow;
       return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format);
     }
diff --git a/project/jni/boost/include/boost/date_time/date_format_simple.hpp b/project/jni/boost/include/boost/date_time/date_format_simple.hpp
index be21ce4a5..05119c441 100644
--- a/project/jni/boost/include/boost/date_time/date_format_simple.hpp
+++ b/project/jni/boost/include/boost/date_time/date_format_simple.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/parse_format_base.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_formatting.hpp b/project/jni/boost/include/boost/date_time/date_formatting.hpp
index f9721a3d8..06709bc5e 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/iso_format.hpp"
@@ -54,7 +54,9 @@ namespace date_time {
           os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
           break;
         }
-     
+        default:
+          break;
+          
       }
       return os;
     } // format_month
diff --git a/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp b/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
index 38fee07b9..5721473ba 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/iso_format.hpp"
diff --git a/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp b/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
index 4ac9c4e40..e3aec4967 100644
--- a/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
+++ b/project/jni/boost/include/boost/date_time/date_formatting_locales.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp b/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
index 88cd7e1ab..159cf36eb 100644
--- a/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generator_formatter.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_generator_parser.hpp b/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
index f11eb42d5..7cff9ca36 100644
--- a/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generator_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/date_generators.hpp b/project/jni/boost/include/boost/date_time/date_generators.hpp
index 1f1a34a66..6d3a4ac0b 100644
--- a/project/jni/boost/include/boost/date_time/date_generators.hpp
+++ b/project/jni/boost/include/boost/date_time/date_generators.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_GENERATORS_HPP__
 
 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
- * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * Author: Jeff Garland, Bart Garst
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 /*! @file date_generators.hpp
@@ -34,16 +34,16 @@ namespace date_time {
   public:
     typedef typename date_type::calendar_type calendar_type;
     typedef typename calendar_type::year_type        year_type;
-    year_based_generator() {};
-    virtual ~year_based_generator() {};
+    year_based_generator() {}
+    virtual ~year_based_generator() {}
     virtual date_type get_date(year_type y) const = 0;
     //! Returns a string for use in a POSIX time_zone string
     virtual std::string to_string() const =0;
   };
-  
+
   //! Generates a date by applying the year to the given month and day.
   /*!
-    Example usage: 
+    Example usage:
     @code
     partial_date pd(1, Jan);
     partial_date pd2(70);
@@ -123,9 +123,9 @@ namespace date_time {
      //months are equal
      return (day_ < rhs.day_);
    }
-   
+
    // added for streaming purposes
-   month_type month() const 
+   month_type month() const
    {
      return month_;
    }
@@ -135,15 +135,15 @@ namespace date_time {
    }
 
    //! Returns string suitable for use in POSIX time zone string
-   /*! Returns string formatted with up to 3 digits: 
-    * Jan-01 == "0" 
+   /*! Returns string formatted with up to 3 digits:
+    * Jan-01 == "0"
     * Feb-29 == "58"
     * Dec-31 == "365" */
    virtual std::string to_string() const
    {
      std::ostringstream ss;
      date_type d(2004, month_, day_);
-     unsigned short c = d.day_of_year();     
+     unsigned short c = d.day_of_year();
      c--; // numbered 0-365 while day_of_year is 1 based...
      ss << c;
      return ss.str();
@@ -161,7 +161,7 @@ namespace date_time {
   /*! Based on the idea in Cal. Calc. for finding holidays that are
    *  the 'first Monday of September'. When instantiated with
    *  'fifth' kday of month, the result will be the last kday of month
-   *  which can be the fourth or fifth depending on the structure of 
+   *  which can be the fourth or fifth depending on the structure of
    *  the month.
    *
    *  The algorithm here basically guesses for the first
@@ -169,8 +169,8 @@ namespace date_time {
    *  type.  That is, if the first of the month is a Tuesday
    *  and it needs Wenesday then we simply increment by a day
    *  and then we can add the length of a week until we get
-   *  to the 'nth kday'.  There are probably more efficient 
-   *  algorithms based on using a mod 7, but this one works 
+   *  to the 'nth kday'.  There are probably more efficient
+   *  algorithms based on using a mod 7, but this one works
    *  reasonably well for basic applications.
    *  \ingroup date_alg
    */
@@ -233,7 +233,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
      std::ostringstream ss;
-     ss << 'M' 
+     ss << 'M'
        << static_cast(month_) << '.'
        << static_cast(wn_) << '.'
        << static_cast(dow_);
@@ -244,7 +244,7 @@ namespace date_time {
     week_num wn_;
     day_of_week_type dow_;
   };
-  
+
   //! Useful generator functor for finding holidays and daylight savings
   /*! Similar to nth_kday_of_month, but requires less paramters
    *  \ingroup date_alg
@@ -290,7 +290,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
      std::ostringstream ss;
-     ss << 'M' 
+     ss << 'M'
        << static_cast(month_) << '.'
        << 1 << '.'
        << static_cast(dow_);
@@ -300,9 +300,9 @@ namespace date_time {
     month_type month_;
     day_of_week_type dow_;
   };
-  
-  
-  
+
+
+
   //! Calculate something like Last Sunday of January
   /*! Useful generator functor for finding holidays and daylight savings
    *  Get the last day of the month and then calculate the difference
@@ -351,7 +351,7 @@ namespace date_time {
     virtual std::string to_string() const
     {
       std::ostringstream ss;
-      ss << 'M' 
+      ss << 'M'
          << static_cast(month_) << '.'
          << 5 << '.'
          << static_cast(dow_);
@@ -361,8 +361,8 @@ namespace date_time {
     month_type month_;
     day_of_week_type dow_;
    };
-  
-  
+
+
   //! Calculate something like "First Sunday after Jan 1,2002
   /*! Date generator that takes a date and finds kday after
    *@code
@@ -400,7 +400,7 @@ namespace date_time {
   private:
     day_of_week_type dow_;
   };
-  
+
   //! Calculate something like "First Sunday before Jan 1,2002
   /*! Date generator that takes a date and finds kday after
    *@code
@@ -438,10 +438,10 @@ namespace date_time {
   private:
     day_of_week_type dow_;
   };
-  
+
   //! Calculates the number of days until the next weekday
   /*! Calculates the number of days until the next weekday.
-   * If the date given falls on a Sunday and the given weekday 
+   * If the date given falls on a Sunday and the given weekday
    * is Tuesday the result will be 2 days */
   template
   inline
@@ -458,8 +458,8 @@ namespace date_time {
 
   //! Calculates the number of days since the previous weekday
   /*! Calculates the number of days since the previous weekday
-   * If the date given falls on a Sunday and the given weekday 
-   * is Tuesday the result will be 5 days. The answer will be a positive 
+   * If the date given falls on a Sunday and the given weekday
+   * is Tuesday the result will be 5 days. The answer will be a positive
    * number because Tuesday is 5 days before Sunday, not -5 days before. */
   template
   inline
@@ -477,9 +477,9 @@ namespace date_time {
   }
 
   //! Generates a date object representing the date of the following weekday from the given date
-  /*! Generates a date object representing the date of the following 
-   * weekday from the given date. If the date given is 2004-May-9 
-   * (a Sunday) and the given weekday is Tuesday then the resulting date 
+  /*! Generates a date object representing the date of the following
+   * weekday from the given date. If the date given is 2004-May-9
+   * (a Sunday) and the given weekday is Tuesday then the resulting date
    * will be 2004-May-11. */
   template
   inline
@@ -489,9 +489,9 @@ namespace date_time {
   }
 
   //! Generates a date object representing the date of the previous weekday from the given date
-  /*! Generates a date object representing the date of the previous 
-   * weekday from the given date. If the date given is 2004-May-9 
-   * (a Sunday) and the given weekday is Tuesday then the resulting date 
+  /*! Generates a date object representing the date of the previous
+   * weekday from the given date. If the date given is 2004-May-9
+   * (a Sunday) and the given weekday is Tuesday then the resulting date
    * will be 2004-May-4. */
   template
   inline
diff --git a/project/jni/boost/include/boost/date_time/date_iterator.hpp b/project/jni/boost/include/boost/date_time/date_iterator.hpp
index 284dc749d..c8ec50eeb 100644
--- a/project/jni/boost/include/boost/date_time/date_iterator.hpp
+++ b/project/jni/boost/include/boost/date_time/date_iterator.hpp
@@ -2,11 +2,11 @@
 #define DATE_ITERATOR_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -32,7 +32,7 @@ namespace date_time {
   template
   class date_itr_base {
   // works, but benefit unclear at the moment
-  //   class date_itr_base : public std::iterator{
   public:
     typedef typename date_type::duration_type duration_type;
@@ -40,31 +40,31 @@ namespace date_time {
     typedef std::input_iterator_tag iterator_category;
 
     date_itr_base(date_type d) : current_(d) {}
-    virtual ~date_itr_base() {};
-    date_itr_base& operator++() 
+    virtual ~date_itr_base() {}
+    date_itr_base& operator++()
     {
       current_ = current_ + get_offset(current_);
       return *this;
     }
-    date_itr_base& operator--() 
+    date_itr_base& operator--()
     {
       current_ = current_ + get_neg_offset(current_);
       return *this;
     }
     virtual duration_type get_offset(const date_type& current) const=0;
     virtual duration_type get_neg_offset(const date_type& current) const=0;
-    date_type operator*() {return current_;};
-    date_type* operator->() {return ¤t_;};
+    date_type operator*() {return current_;}
+    date_type* operator->() {return ¤t_;}
     bool operator<  (const date_type& d) {return current_ < d;}
     bool operator<= (const date_type& d) {return current_ <= d;}
     bool operator>  (const date_type& d) {return current_ > d;}
     bool operator>= (const date_type& d) {return current_ >= d;}
     bool operator== (const date_type& d) {return current_ == d;}
-    bool operator!= (const date_type& d) {return current_ != d;}    
+    bool operator!= (const date_type& d) {return current_ != d;}
   private:
     date_type current_;
   };
-  
+
   //! Overrides the base date iterator providing hook for functors
   /*
    *  offset_functor
@@ -77,9 +77,9 @@ namespace date_time {
   class date_itr : public date_itr_base {
   public:
     typedef typename date_type::duration_type duration_type;
-    date_itr(date_type d, int factor=1) : 
-      date_itr_base(d), 
-      of_(factor) 
+    date_itr(date_type d, int factor=1) :
+      date_itr_base(d),
+      of_(factor)
     {}
   private:
     virtual duration_type get_offset(const date_type& current) const
@@ -92,9 +92,9 @@ namespace date_time {
     }
     offset_functor of_;
   };
-  
 
-  
+
+
 } } //namespace date_time
 
 
diff --git a/project/jni/boost/include/boost/date_time/date_names_put.hpp b/project/jni/boost/include/boost/date_time/date_names_put.hpp
index c6f0ce2a6..32aeb36f5 100644
--- a/project/jni/boost/include/boost/date_time/date_names_put.hpp
+++ b/project/jni/boost/include/boost/date_time/date_names_put.hpp
@@ -2,11 +2,11 @@
 #define DATE_TIME_DATE_NAMES_PUT_HPP___
 
 /* Copyright (c) 2002-2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
- * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * Author: Jeff Garland, Bart Garst
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -27,22 +27,22 @@ namespace date_time {
     //! Output facet base class for gregorian dates.
     /*! This class is a base class for date facets used to localize the
      *  names of months and the names of days in the week.
-     * 
+     *
      * Requirements of Config
-     *  - define an enumeration month_enum that enumerates the months. 
+     *  - define an enumeration month_enum that enumerates the months.
      *    The enumeration should be '1' based eg: Jan==1
      *  - define as_short_string and as_long_string
      *
      * (see langer & kreft p334).
-     * 
+     *
      */
     template >
     class date_names_put : public std::locale::facet
     {
     public:
-      date_names_put() {};
+      date_names_put() {}
       typedef OutputIterator iter_type;
       typedef typename Config::month_type month_type;
       typedef typename Config::month_enum month_enum;
@@ -118,7 +118,7 @@ namespace date_time {
         put_string(oitr, gm.as_short_string(c));
       }
       //! Default facet implementation uses month_type defaults
-      virtual void do_put_month_long(iter_type& oitr, 
+      virtual void do_put_month_long(iter_type& oitr,
                                      month_enum moy) const
       {
         month_type gm(moy);
@@ -160,7 +160,7 @@ namespace date_time {
         string_type s(separator); //put in '-'
         put_string(oitr, s);
       }
-      //! Default for date order 
+      //! Default for date order
       virtual ymd_order_spec do_date_order() const
       {
         return ymd_order_iso;
@@ -186,27 +186,27 @@ namespace date_time {
         }
       }
     };
-    
+
     template
-    const typename date_names_put::char_type 
-    date_names_put::default_special_value_names[3][17] = { 
+    const typename date_names_put::char_type
+    date_names_put::default_special_value_names[3][17] = {
       {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
       {'-','i','n','f','i','n','i','t','y'},
       {'+','i','n','f','i','n','i','t','y'} };
 
     template
-    const typename date_names_put::char_type 
-    date_names_put::separator[2] = 
+    const typename date_names_put::char_type
+    date_names_put::separator[2] =
       {'-', '\0'} ;
-    
 
-    //! Generate storage location for a std::locale::id 
+
+    //! Generate storage location for a std::locale::id
     template
     std::locale::id date_names_put::id;
 
     //! A date name output facet that takes an array of char* to define strings
     template >
     class all_date_names_put : public date_names_put
     {
@@ -230,29 +230,29 @@ namespace date_time {
         separator_char_[0] = separator_char;
         separator_char_[1] = '\0';
 
-      };
+      }
       typedef OutputIterator iter_type;
       typedef typename Config::month_enum month_enum;
       typedef typename Config::weekday_enum weekday_enum;
       typedef typename Config::special_value_enum special_value_enum;
 
-      const charT* const* get_short_month_names() const 
+      const charT* const* get_short_month_names() const
       {
         return month_short_names_;
       }
-      const charT* const* get_long_month_names() const 
+      const charT* const* get_long_month_names() const
       {
         return month_long_names_;
       }
-      const charT* const* get_special_value_names() const 
+      const charT* const* get_special_value_names() const
       {
         return special_value_names_;
       }
-      const charT* const* get_short_weekday_names()const  
+      const charT* const* get_short_weekday_names()const
       {
         return weekday_short_names_;
       }
-      const charT* const* get_long_weekday_names()const 
+      const charT* const* get_long_weekday_names()const
       {
         return weekday_long_names_;
       }
@@ -263,7 +263,7 @@ namespace date_time {
       {
         this->put_string(oitr, month_short_names_[moy-1]);
       }
-      //! Long month names 
+      //! Long month names
       virtual void do_put_month_long(iter_type& oitr, month_enum moy) const
       {
         this->put_string(oitr, month_long_names_[moy-1]);
@@ -310,7 +310,7 @@ namespace date_time {
       const charT* const* weekday_long_names_;
       charT separator_char_[2];
       ymd_order_spec order_spec_;
-      month_format_spec month_format_spec_;      
+      month_format_spec month_format_spec_;
     };
 
 } } //namespace boost::date_time
diff --git a/project/jni/boost/include/boost/date_time/date_parsing.hpp b/project/jni/boost/include/boost/date_time/date_parsing.hpp
index f361bc809..35ec8e43c 100644
--- a/project/jni/boost/include/boost/date_time/date_parsing.hpp
+++ b/project/jni/boost/include/boost/date_time/date_parsing.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include 
@@ -148,6 +148,7 @@ namespace date_time {
             day = boost::lexical_cast(*beg);
             break;
           }
+          default: break;
         } //switch
       }
       return date_type(year, month, day);
@@ -180,6 +181,7 @@ namespace date_time {
         case 0: y = i; break;
         case 1: m = i; break;
         case 2: d = i; break;
+        default:       break;
         }
         pos++;
       }
diff --git a/project/jni/boost/include/boost/date_time/dst_rules.hpp b/project/jni/boost/include/boost/date_time/dst_rules.hpp
index 20cb40b67..cf65c1622 100644
--- a/project/jni/boost/include/boost/date_time/dst_rules.hpp
+++ b/project/jni/boost/include/boost/date_time/dst_rules.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 /*! @file dst_rules.hpp
@@ -371,7 +371,7 @@ namespace boost {
         return is_not_in_dst;
       }
 
-      static bool is_dst_boundary_day(date_type d)
+      static bool is_dst_boundary_day(date_type /*d*/)
       {
         return false;
       }
diff --git a/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp b/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
index 6c4da1c3c..16c1fd636 100644
--- a/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
+++ b/project/jni/boost/include/boost/date_time/dst_transition_generators.hpp
@@ -18,7 +18,7 @@ namespace date_time {
     {
     public:
       typedef typename date_type::year_type year_type;
-      virtual ~dst_day_calc_rule() {};
+      virtual ~dst_day_calc_rule() {}
       virtual date_type start_day(year_type y) const=0;
       virtual std::string start_rule_as_string() const=0;
       virtual date_type end_day(year_type y) const=0;
diff --git a/project/jni/boost/include/boost/date_time/filetime_functions.hpp b/project/jni/boost/include/boost/date_time/filetime_functions.hpp
index 03f63f85d..3c7f13f38 100644
--- a/project/jni/boost/include/boost/date_time/filetime_functions.hpp
+++ b/project/jni/boost/include/boost/date_time/filetime_functions.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 /*! @file filetime_functions.hpp
diff --git a/project/jni/boost/include/boost/date_time/format_date_parser.hpp b/project/jni/boost/include/boost/date_time/format_date_parser.hpp
index a4a4d0dfb..0c3503f85 100644
--- a/project/jni/boost/include/boost/date_time/format_date_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/format_date_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 
@@ -256,7 +256,6 @@ class format_date_parser
     
     // skip leading whitespace
     while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } 
-    charT current_char = *sitr;
 
     short year(0), month(0), day(0), day_of_year(0);// wkday(0); 
     /* Initialized the following to their minimum values. These intermediate 
@@ -290,7 +289,6 @@ class format_date_parser
               }
               wkday = mr.current_match;
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -310,7 +308,6 @@ class format_date_parser
               }
               wkday = mr.current_match;
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -326,7 +323,6 @@ class format_date_parser
               }
               t_month = month_type(mr.current_match);
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -342,7 +338,6 @@ class format_date_parser
               }
               t_month = month_type(mr.current_match);
               if (mr.has_remaining()) {
-                current_char = mr.last_char();
                 use_current_char = true;
               }
               break;
@@ -438,7 +433,6 @@ class format_date_parser
         itr++;
         if (use_current_char) {
           use_current_char = false;
-          current_char = *sitr;
         }
         else {
           sitr++;
diff --git a/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp b/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
index c505bddf5..33f6856bf 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/conversion.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $
+ * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp b/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
index 786e79f2c..eda7dc34b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/formatters.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/compiler_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp b/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
index 4531ebec1..8dfd2d0c6 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/formatters_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
index 483ead501..e9c1852e0 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_calendar.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
index ad67c0ce2..860a407c9 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_date.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
index 92ea6ab07..4ea829fbe 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_day.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
index 36b22c2b7..2f8874d2b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
index fd7554201..a9c0c171b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_duration.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
index 3d1ce6218..8328ca303 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_duration_types.hpp
@@ -5,7 +5,7 @@
  * Subject to Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
index 9c3877ed0..9efc61951 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $
+ * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
index fc9c86148..b48a8a891 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_month.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
index e427a48a2..2cfad93c4 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_serialize.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-11-11 15:19:38 -0500 (Thu, 11 Nov 2010) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
@@ -22,6 +22,7 @@
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period)
+BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_year)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day)
 BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday)
@@ -87,7 +88,7 @@ void load(Archive & ar,
 
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 ::boost::gregorian::date* dp, 
                                 const unsigned int /*file_version*/)
 {
@@ -116,7 +117,7 @@ void load(Archive & ar, gregorian::date_duration & dd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_duration* dd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration* dd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(dd) gregorian::date_duration(gregorian::not_a_date_time);
@@ -142,7 +143,7 @@ void load(Archive & ar, gregorian::date_duration::duration_rep & dr, unsigned in
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_duration::duration_rep* dr, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration::duration_rep* dr, 
                                 const unsigned int /*file_version*/)
 {
   ::new(dr) gregorian::date_duration::duration_rep(0);
@@ -178,7 +179,7 @@ void load(Archive & ar, gregorian::date_period& dp, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::date_period* dp, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::date_period* dp, 
                                 const unsigned int /*file_version*/)
 {
   gregorian::date d(gregorian::not_a_date_time);
@@ -186,6 +187,32 @@ inline void load_construct_data(Archive & ar, gregorian::date_period* dp,
   ::new(dp) gregorian::date_period(d,dd);
 }
 
+/**** greg_year ****/
+
+//! Function to save gregorian::greg_year objects using serialization lib
+template
+void save(Archive & ar, const gregorian::greg_year& gy, 
+          unsigned int /*version*/)
+{
+  unsigned short us = gy;
+  ar & make_nvp("greg_year", us);
+}
+//! Function to load gregorian::greg_year objects using serialization lib
+template
+void load(Archive & ar, gregorian::greg_year& gy, unsigned int /*version*/)
+{
+  unsigned short us;
+  ar & make_nvp("greg_year", us);
+  gy = gregorian::greg_year(us);
+}
+//!override needed b/c no default constructor
+template
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_year* gy, 
+                                const unsigned int /*file_version*/)
+{
+  ::new(gy) gregorian::greg_year(1900);
+}
+
 /**** greg_month ****/
 
 //! Function to save gregorian::greg_month objects using serialization lib
@@ -206,7 +233,7 @@ void load(Archive & ar, gregorian::greg_month& gm, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_month* gm, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_month* gm, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gm) gregorian::greg_month(1);
@@ -232,7 +259,7 @@ void load(Archive & ar, gregorian::greg_day& gd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_day* gd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_day* gd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gd) gregorian::greg_day(1);
@@ -258,7 +285,7 @@ void load(Archive & ar, gregorian::greg_weekday& gd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::greg_weekday* gd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::greg_weekday* gd, 
                                 const unsigned int /*file_version*/)
 {
   ::new(gd) gregorian::greg_weekday(1);
@@ -296,7 +323,7 @@ void load(Archive & ar, gregorian::partial_date& pd, unsigned int /*version*/)
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, gregorian::partial_date* pd, 
+inline void load_construct_data(Archive & /*ar*/, gregorian::partial_date* pd, 
                                 const unsigned int /*file_version*/)
 {
   gregorian::greg_month gm(1);
@@ -339,7 +366,7 @@ void load(Archive & ar, gregorian::nth_kday_of_month& nkd, unsigned int /*versio
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::nth_kday_of_month* nkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -379,7 +406,7 @@ void load(Archive & ar, gregorian::first_kday_of_month& fkd, unsigned int /*vers
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_of_month* fkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -418,7 +445,7 @@ void load(Archive & ar, gregorian::last_kday_of_month& lkd, unsigned int /*versi
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::last_kday_of_month* lkd, 
                                 const unsigned int /*file_version*/)
 {
@@ -447,7 +474,7 @@ void load(Archive & ar, gregorian::first_kday_before& fkdb, unsigned int /*versi
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_before* fkdb, 
                                 const unsigned int /*file_version*/)
 {
@@ -476,7 +503,7 @@ void load(Archive & ar, gregorian::first_kday_after& fkda, unsigned int /*versio
 }
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 gregorian::first_kday_after* fkda, 
                                 const unsigned int /*file_version*/)
 {
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
index 9b566c440..ab68fcd19 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_weekday.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
index ef1735f42..322f40d0d 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_year.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/constrained_value.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp b/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
index 086e73df4..e7d441efe 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/greg_ymd.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/year_month_day.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
index bfafa1b03..becbc0681 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file gregorian.hpp
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
index 62a759f55..e6ba01fe5 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp b/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
index 0c74857a2..3f4b92fd8 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/gregorian_types.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file gregorian_types.hpp
diff --git a/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp b/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
index 95d4f23de..a2fa4e1da 100644
--- a/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian/parsers.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp b/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
index c27c09e76..b645aa49b 100644
--- a/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
+++ b/project/jni/boost/include/boost/date_time/gregorian_calendar.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp b/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
index 19622fe8e..af19394f3 100644
--- a/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
+++ b/project/jni/boost/include/boost/date_time/gregorian_calendar.ipp
@@ -3,7 +3,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #ifndef NO_BOOST_DATE_TIME_INLINE
diff --git a/project/jni/boost/include/boost/date_time/int_adapter.hpp b/project/jni/boost/include/boost/date_time/int_adapter.hpp
index fc98fc127..d1246e7b5 100644
--- a/project/jni/boost/include/boost/date_time/int_adapter.hpp
+++ b/project/jni/boost/include/boost/date_time/int_adapter.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/iso_format.hpp b/project/jni/boost/include/boost/date_time/iso_format.hpp
index 8262fa211..1f9e73d67 100644
--- a/project/jni/boost/include/boost/date_time/iso_format.hpp
+++ b/project/jni/boost/include/boost/date_time/iso_format.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/parse_format_base.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/conversion.hpp b/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
index 13e4d3eb5..a530de422 100644
--- a/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/conversion.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2009-06-04 01:24:49 -0700 (Thu, 04 Jun 2009) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp b/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
index a6c1d4205..84c59a3a0 100644
--- a/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/custom_time_zone.hpp
@@ -2,10 +2,10 @@
 #define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__
 
 /* Copyright (c) 2003-2005 CrystalClear Software, Inc.
- * Subject to the Boost Software License, Version 1.0. 
+ * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include "boost/date_time/time_zone_base.hpp"
@@ -34,8 +34,8 @@ namespace local_time {
     typedef typename base_type::stringstream_type stringstream_type;
     typedef date_time::time_zone_names_base time_zone_names;
     typedef CharT char_type;
-    
-    custom_time_zone_base(const time_zone_names& zone_names,   
+
+    custom_time_zone_base(const time_zone_names& zone_names,
                      const time_duration_type& utc_offset,
                      const dst_adjustment_offsets& dst_shift,
                      boost::shared_ptr calc_rule) :
@@ -43,8 +43,8 @@ namespace local_time {
       base_utc_offset_(utc_offset),
       dst_offsets_(dst_shift),
       dst_calc_rules_(calc_rule)
-    {};
-    virtual ~custom_time_zone_base() {};
+    {}
+    virtual ~custom_time_zone_base() {}
     virtual string_type dst_zone_abbrev() const
     {
       return zone_names_.dst_zone_abbrev();
diff --git a/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp b/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
index ee870227a..b4c325df0 100644
--- a/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/date_duration_operators.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/greg_duration_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp b/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
index 3d6cfbacf..d82731c08 100644
--- a/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp b/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
index 9c9f62340..96b291583 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_date_time.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -208,7 +208,7 @@ namespace local_time {
     }
 
     //! Simple destructor, releases time zone if last referrer
-    ~local_date_time_base() {};
+    ~local_date_time_base() {}
 
     //! Copy constructor
     local_date_time_base(const local_date_time_base& rhs) :
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
index f7d4cc68e..162cac5b3 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
index c161ff7e2..b5e3c3f1b 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time_io.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp b/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
index ed58b8018..5e04422e8 100644
--- a/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/local_time_types.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/local_time/local_date_time.hpp"
diff --git a/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp b/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
index 2a0199fca..ee1b553ee 100644
--- a/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/posix_time_zone.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-10 13:24:38 -0400 (Thu, 10 Jun 2010) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
@@ -115,7 +115,7 @@ namespace local_time{
         calc_rules(dst_begin, dst_end);
       }
     }
-    virtual ~posix_time_zone_base() {};
+    virtual ~posix_time_zone_base() {}
     //!String for the zone when not in daylight savings (eg: EST)
     virtual string_type std_zone_abbrev()const
     {
diff --git a/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp b/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
index 4cfca45c1..aceda9391 100644
--- a/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time/tz_database.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp b/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
index eea4d37ae..13251a2cf 100644
--- a/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
+++ b/project/jni/boost/include/boost/date_time/local_time_adjustor.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 /*! @file local_time_adjustor.hpp
diff --git a/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp b/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
index fd6d3c2fa..b56278ed2 100644
--- a/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/local_timezone_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include "boost/date_time/dst_rules.hpp"
diff --git a/project/jni/boost/include/boost/date_time/locale_config.hpp b/project/jni/boost/include/boost/date_time/locale_config.hpp
index d01e008fe..194d5dd37 100644
--- a/project/jni/boost/include/boost/date_time/locale_config.hpp
+++ b/project/jni/boost/include/boost/date_time/locale_config.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 // This file configures whether the library will support locales and hence
diff --git a/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp b/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
index 9396579d3..177811ee6 100644
--- a/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
+++ b/project/jni/boost/include/boost/date_time/microsec_time_clock.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-05-10 05:15:48 -0400 (Mon, 10 May 2010) $
+ * $Date: 2010-05-10 02:15:48 -0700 (Mon, 10 May 2010) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/parse_format_base.hpp b/project/jni/boost/include/boost/date_time/parse_format_base.hpp
index b17a5c8e7..087baf953 100644
--- a/project/jni/boost/include/boost/date_time/parse_format_base.hpp
+++ b/project/jni/boost/include/boost/date_time/parse_format_base.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/date_time/period.hpp b/project/jni/boost/include/boost/date_time/period.hpp
index c67bc36c6..3e34def32 100644
--- a/project/jni/boost/include/boost/date_time/period.hpp
+++ b/project/jni/boost/include/boost/date_time/period.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! \file period.hpp
diff --git a/project/jni/boost/include/boost/date_time/period_formatter.hpp b/project/jni/boost/include/boost/date_time/period_formatter.hpp
index 08082e10f..b6ddc8217 100644
--- a/project/jni/boost/include/boost/date_time/period_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/period_formatter.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -114,10 +114,10 @@ namespace boost { namespace date_time {
     {
       m_range_option = option;
     }
-    void delimiter_strings(const string_type& separator,
-                           const string_type& start_delim,
-                           const string_type& open_end_delim,
-                           const string_type& closed_end_delim)
+    void delimiter_strings(const string_type& ,
+                           const string_type& ,
+                           const string_type& ,
+                           const string_type& )
     {
       m_period_separator;
       m_period_start_delimeter;
diff --git a/project/jni/boost/include/boost/date_time/period_parser.hpp b/project/jni/boost/include/boost/date_time/period_parser.hpp
index 9cd57e18c..84b9d1378 100644
--- a/project/jni/boost/include/boost/date_time/period_parser.hpp
+++ b/project/jni/boost/include/boost/date_time/period_parser.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp b/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
index 3fb21d79e..83ccf6006 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/conversion.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $
+ * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp b/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
index e6899ba0a..6846a7781 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/date_duration_operators.hpp
@@ -6,7 +6,7 @@
  * (See accompanying file LICENSE_1_0.txt or 
  * http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/greg_duration_types.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
index 4e9294c42..3b85ff46f 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 /*!@file posix_time.hpp Global header file to get all of posix time types 
  */
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
index 60c3f7ee3..d0b76536e 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_config.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include  //for MCW 7.2 std::abs(long long)
@@ -81,7 +81,7 @@ namespace posix_time {
     {}
     //Give duration access to ticks constructor -- hide from users
     friend class date_time::time_duration;
-  private:
+  protected:
     explicit time_duration(impl_type tick_count) :
       date_time::time_duration(tick_count)
     {}
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
index db3b85fec..9778fd7f3 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_duration.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
index 9a80737a4..fb63a9165 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
index f5b20a8f8..fcc3fac1d 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file posix_time_pre133_operators.hpp
diff --git a/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp b/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
index 3d44e0ff0..13626e9ba 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/posix_time_system.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp b/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
index 2abc02d31..3f1cb0473 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/ptime.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/posix_time/posix_time_system.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
index 466331b0a..534b9525b 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_formatters.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
index d0e959e91..8d2ebdce5 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $
+ * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
index 8a352f6e2..3dc02b18a 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_parsers.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/gregorian/gregorian.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
index cb7bf07f4..11f812073 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_period.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/period.hpp"
diff --git a/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp b/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
index f096da441..c9038f19a 100644
--- a/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
+++ b/project/jni/boost/include/boost/date_time/posix_time/time_serialize.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $
  */
 
 #include "boost/date_time/posix_time/posix_time.hpp"
@@ -184,7 +184,7 @@ void load(Archive & ar,
 
 //!override needed b/c no default constructor
 template
-inline void load_construct_data(Archive & ar, 
+inline void load_construct_data(Archive & /*ar*/, 
                                 boost::posix_time::time_period* tp, 
                                 const unsigned int /*file_version*/)
 {
diff --git a/project/jni/boost/include/boost/date_time/special_defs.hpp b/project/jni/boost/include/boost/date_time/special_defs.hpp
index 56eb6fea1..661814ec1 100644
--- a/project/jni/boost/include/boost/date_time/special_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/special_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/date_time/special_values_formatter.hpp b/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
index 33542b6e4..53fe98452 100644
--- a/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
+++ b/project/jni/boost/include/boost/date_time/special_values_formatter.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/string_convert.hpp b/project/jni/boost/include/boost/date_time/string_convert.hpp
index 54a979c70..a3cc86c2d 100644
--- a/project/jni/boost/include/boost/date_time/string_convert.hpp
+++ b/project/jni/boost/include/boost/date_time/string_convert.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include "boost/date_time/compiler_config.hpp"
diff --git a/project/jni/boost/include/boost/date_time/string_parse_tree.hpp b/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
index 0d515ff82..d67bf6b7d 100644
--- a/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
+++ b/project/jni/boost/include/boost/date_time/string_parse_tree.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/strings_from_facet.hpp b/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
index d782c54fb..7c0765bf8 100644
--- a/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/strings_from_facet.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time.hpp b/project/jni/boost/include/boost/date_time/time.hpp
index 6a6cbe1f8..8b21144b6 100644
--- a/project/jni/boost/include/boost/date_time/time.hpp
+++ b/project/jni/boost/include/boost/date_time/time.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_clock.hpp b/project/jni/boost/include/boost/date_time/time_clock.hpp
index 1ea5d2e8b..9aa2ff0e3 100644
--- a/project/jni/boost/include/boost/date_time/time_clock.hpp
+++ b/project/jni/boost/include/boost/date_time/time_clock.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 /*! @file time_clock.hpp
diff --git a/project/jni/boost/include/boost/date_time/time_defs.hpp b/project/jni/boost/include/boost/date_time/time_defs.hpp
index 55fe42a59..d74631d5e 100644
--- a/project/jni/boost/include/boost/date_time/time_defs.hpp
+++ b/project/jni/boost/include/boost/date_time/time_defs.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_duration.hpp b/project/jni/boost/include/boost/date_time/time_duration.hpp
index 2fd259012..fc3660b7c 100644
--- a/project/jni/boost/include/boost/date_time/time_duration.hpp
+++ b/project/jni/boost/include/boost/date_time/time_duration.hpp
@@ -2,15 +2,16 @@
 #define DATE_TIME_TIME_DURATION_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -179,7 +180,7 @@ namespace date_time {
       return duration_type(ticks_);
     }
     //! Division operations on a duration with an integer.
-    duration_type operator/=(int divisor) 
+    duration_type operator/=(int divisor)
     {
       ticks_ = ticks_ / divisor;
       return duration_type(ticks_);
@@ -251,7 +252,7 @@ namespace date_time {
     }
 
   protected:
-    explicit time_duration(impl_type in) : ticks_(in) {};
+    explicit time_duration(impl_type in) : ticks_(in) {}
     impl_type ticks_;
   };
 
@@ -265,10 +266,20 @@ namespace date_time {
   class subsecond_duration : public base_duration
   {
   public:
+    typedef typename base_duration::impl_type impl_type;
     typedef typename base_duration::traits_type traits_type;
+
+  private:
+    // To avoid integer overflow we precompute the duration resolution conversion coefficient (ticket #3471)
+    BOOST_STATIC_ASSERT_MSG((traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second % frac_of_second : frac_of_second % traits_type::ticks_per_second) == 0,\
+      "The base duration resolution must be a multiple of the subsecond duration resolution");
+    BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second));
+
+  public:
     explicit subsecond_duration(boost::int64_t ss) :
-      base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second)
-    {}
+      base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio))
+    {
+    }
   };
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_facet.hpp b/project/jni/boost/include/boost/date_time/time_facet.hpp
index f6408b017..8346ca300 100644
--- a/project/jni/boost/include/boost/date_time/time_facet.hpp
+++ b/project/jni/boost/include/boost/date_time/time_facet.hpp
@@ -7,7 +7,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author:  Martin Andrian, Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp b/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
index 3537c103c..2d07d344e 100644
--- a/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
+++ b/project/jni/boost/include/boost/date_time/time_formatting_streams.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/time_iterator.hpp b/project/jni/boost/include/boost/date_time/time_iterator.hpp
index 2258a3308..4c33f39e9 100644
--- a/project/jni/boost/include/boost/date_time/time_iterator.hpp
+++ b/project/jni/boost/include/boost/date_time/time_iterator.hpp
@@ -2,50 +2,50 @@
 #define DATE_TIME_TIME_ITERATOR_HPP___
 
 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
 namespace boost {
 namespace date_time {
-  
+
 
   //! Simple time iterator skeleton class
   template
   class time_itr {
   public:
     typedef typename time_type::time_duration_type time_duration_type;
-    time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {};
-    time_itr& operator++() 
+    time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}
+    time_itr& operator++()
     {
       current_ = current_ + offset_;
       return *this;
     }
-    time_itr& operator--() 
+    time_itr& operator--()
     {
       current_ = current_ - offset_;
       return *this;
     }
-    time_type operator*() {return current_;};
-    time_type* operator->() {return ¤t_;};
-    bool operator<  (const time_type& t) {return current_ < t;};
-    bool operator<= (const time_type& t) {return current_ <= t;};
-    bool operator!=  (const time_type& t) {return current_ != t;};
-    bool operator== (const time_type& t) {return current_ == t;};
-    bool operator>  (const time_type& t) {return current_ > t;};
-    bool operator>= (const time_type& t) {return current_ >= t;};
-    
+    time_type operator*() {return current_;}
+    time_type* operator->() {return ¤t_;}
+    bool operator<  (const time_type& t) {return current_ < t;}
+    bool operator<= (const time_type& t) {return current_ <= t;}
+    bool operator!=  (const time_type& t) {return current_ != t;}
+    bool operator== (const time_type& t) {return current_ == t;}
+    bool operator>  (const time_type& t) {return current_ > t;}
+    bool operator>= (const time_type& t) {return current_ >= t;}
+
   private:
     time_type current_;
     time_duration_type offset_;
   };
-  
 
-  
+
+
 } }//namespace date_time
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_parsing.hpp b/project/jni/boost/include/boost/date_time/time_parsing.hpp
index dfccf6a1d..7b71de0da 100644
--- a/project/jni/boost/include/boost/date_time/time_parsing.hpp
+++ b/project/jni/boost/include/boost/date_time/time_parsing.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $
  */
 
 #include "boost/tokenizer.hpp"
@@ -116,6 +116,7 @@ namespace date_time {
         
         break;
       }
+      default: break;
       }//switch
       pos++;
     }
@@ -153,9 +154,10 @@ namespace date_time {
         std::string& first,
         std::string& second)
   {
-    int sep_pos = static_cast(s.find(sep));
+    std::string::size_type sep_pos = s.find(sep);
     first = s.substr(0,sep_pos);
-    second = s.substr(sep_pos+1);
+    if (sep_pos!=std::string::npos)
+        second = s.substr(sep_pos+1);
     return true;
   }
 
@@ -280,6 +282,7 @@ namespace date_time {
             
             break;
           }
+          default: break;
       };
       pos++;
     }
diff --git a/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp b/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
index 658f3d207..903830c76 100644
--- a/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
+++ b/project/jni/boost/include/boost/date_time/time_resolution_traits.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $
+ * $Date: 2009-06-06 04:25:55 -0700 (Sat, 06 Jun 2009) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_system_counted.hpp b/project/jni/boost/include/boost/date_time/time_system_counted.hpp
index fa883907e..5425f62af 100644
--- a/project/jni/boost/include/boost/date_time/time_system_counted.hpp
+++ b/project/jni/boost/include/boost/date_time/time_system_counted.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_system_split.hpp b/project/jni/boost/include/boost/date_time/time_system_split.hpp
index 08ea1ec2d..6fc4a336b 100644
--- a/project/jni/boost/include/boost/date_time/time_system_split.hpp
+++ b/project/jni/boost/include/boost/date_time/time_system_split.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $
+ * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $
  */
 
 
diff --git a/project/jni/boost/include/boost/date_time/time_zone_base.hpp b/project/jni/boost/include/boost/date_time/time_zone_base.hpp
index 0d3cb903e..f239d545a 100644
--- a/project/jni/boost/include/boost/date_time/time_zone_base.hpp
+++ b/project/jni/boost/include/boost/date_time/time_zone_base.hpp
@@ -2,10 +2,10 @@
 #define _DATE_TIME_TIME_ZONE_BASE__
 
 /* Copyright (c) 2003-2005 CrystalClear Software, Inc.
- * Subject to the Boost Software License, Version 1.0. 
+ * Subject to the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -26,9 +26,9 @@ namespace date_time {
    *  would be to convert from POSIX timezone strings.  Regardless of
    *  the construction technique, this is the interface that these
    *  time zone types must provide.
-   * 
+   *
    * Note that this class is intended to be used as a shared
-   * resource (hence the derivation from boost::counted_base.  
+   * resource (hence the derivation from boost::counted_base.
    */
   template
   class time_zone_base  {
@@ -39,8 +39,8 @@ namespace date_time {
     typedef typename time_type::date_type::year_type year_type;
     typedef typename time_type::time_duration_type time_duration_type;
 
-    time_zone_base() {};
-    virtual ~time_zone_base() {};
+    time_zone_base() {}
+    virtual ~time_zone_base() {}
     //!String for the timezone when in daylight savings (eg: EDT)
     virtual string_type dst_zone_abbrev() const=0;
     //!String for the zone when not in daylight savings (eg: EST)
@@ -61,9 +61,9 @@ namespace date_time {
     virtual time_duration_type dst_offset() const=0;
     //! Returns a POSIX time_zone string for this object
     virtual string_type to_posix_string() const =0;
-    
+
   private:
-    
+
   };
 
 
@@ -82,7 +82,7 @@ namespace date_time {
       dst_start_offset_(dst_start_offset),
       dst_end_offset_(dst_end_offset)
     {}
-    
+
     //! Amount DST adjusts the clock eg: plus one hour
     time_duration_type dst_adjust_;
     //! Time past midnight on start transition day that dst starts
diff --git a/project/jni/boost/include/boost/date_time/time_zone_names.hpp b/project/jni/boost/include/boost/date_time/time_zone_names.hpp
index 05260c716..a56502704 100644
--- a/project/jni/boost/include/boost/date_time/time_zone_names.hpp
+++ b/project/jni/boost/include/boost/date_time/time_zone_names.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/tz_db_base.hpp b/project/jni/boost/include/boost/date_time/tz_db_base.hpp
index c125b966c..a6d8ea9e0 100644
--- a/project/jni/boost/include/boost/date_time/tz_db_base.hpp
+++ b/project/jni/boost/include/boost/date_time/tz_db_base.hpp
@@ -5,7 +5,7 @@
  * Subject to the Boost Software License, Version 1.0. 
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
+ * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $
  */
 
 #include 
diff --git a/project/jni/boost/include/boost/date_time/wrapping_int.hpp b/project/jni/boost/include/boost/date_time/wrapping_int.hpp
index 969b078ac..e6f87d52c 100644
--- a/project/jni/boost/include/boost/date_time/wrapping_int.hpp
+++ b/project/jni/boost/include/boost/date_time/wrapping_int.hpp
@@ -2,11 +2,11 @@
 #define _DATE_TIME_WRAPPING_INT_HPP__
 
 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the 
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
- * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $
  */
 
 
@@ -16,15 +16,15 @@ namespace date_time {
 //! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type)
 /*! In composite date and time types this type is used to
  *  wrap at the day boundary.
- *  Ex: 
- *  A wrapping_int will roll over after nine, and 
+ *  Ex:
+ *  A wrapping_int will roll over after nine, and
  *  roll under below zero. This gives a range of [0,9]
  *
- * NOTE: it is strongly recommended that wrapping_int2 be used 
- * instead of wrapping_int as wrapping_int is to be depricated 
+ * NOTE: it is strongly recommended that wrapping_int2 be used
+ * instead of wrapping_int as wrapping_int is to be depricated
  * at some point soon.
  *
- * Also Note that warnings will occur if instantiated with an 
+ * Also Note that warnings will occur if instantiated with an
  * unsigned type. Only a signed type should be used!
  */
 template
@@ -34,17 +34,17 @@ public:
   //typedef overflow_type_ overflow_type;
   static int_type wrap_value() {return wrap_val;}
   //!Add, return true if wrapped
-  wrapping_int(int_type v) : value_(v) {};
+  wrapping_int(int_type v) : value_(v) {}
   //! Explicit converion method
   int_type as_int()   const   {return value_;}
   operator int_type() const   {return value_;}
   //!Add, return number of wraps performed
-  /*! The sign of the returned value will indicate which direction the 
+  /*! The sign of the returned value will indicate which direction the
    * wraps went. Ex: add a negative number and wrapping under could occur,
-   * this would be indicated by a negative return value. If wrapping over 
+   * this would be indicated by a negative return value. If wrapping over
    * took place, a positive value would be returned */
   template< typename IntT >
-  IntT add(IntT v) 
+  IntT add(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_val));
     IntT overflow = static_cast(v / (wrap_val));
@@ -53,12 +53,12 @@ public:
   }
   //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps)
   /*! The sign of the returned value will indicate which direction the
-   * wraps went (positive indicates wrap under, negative indicates wrap over). 
-   * Ex: subtract a negative number and wrapping over could 
-   * occur, this would be indicated by a negative return value. If 
+   * wraps went (positive indicates wrap under, negative indicates wrap over).
+   * Ex: subtract a negative number and wrapping over could
+   * occur, this would be indicated by a negative return value. If
    * wrapping under took place, a positive value would be returned. */
   template< typename IntT >
-  IntT subtract(IntT v) 
+  IntT subtract(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_val));
     IntT underflow = static_cast(-(v / (wrap_val)));
@@ -71,19 +71,19 @@ private:
   template< typename IntT >
   IntT calculate_wrap(IntT wrap)
   {
-    if ((value_) >= wrap_val) 
+    if ((value_) >= wrap_val)
     {
       ++wrap;
       value_ -= (wrap_val);
     }
-    else if(value_ < 0) 
+    else if(value_ < 0)
     {
       --wrap;
       value_ += (wrap_val);
     }
     return wrap;
   }
-                  
+
 };
 
 
@@ -113,12 +113,12 @@ public:
   int_type as_int()   const   {return value_;}
   operator int_type() const {return value_;}
   //!Add, return number of wraps performed
-  /*! The sign of the returned value will indicate which direction the 
+  /*! The sign of the returned value will indicate which direction the
    * wraps went. Ex: add a negative number and wrapping under could occur,
-   * this would be indicated by a negative return value. If wrapping over 
+   * this would be indicated by a negative return value. If wrapping over
    * took place, a positive value would be returned */
   template< typename IntT >
-  IntT add(IntT v) 
+  IntT add(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_max - wrap_min + 1));
     IntT overflow = static_cast(v / (wrap_max - wrap_min + 1));
@@ -127,30 +127,30 @@ public:
   }
   //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps)
   /*! The sign of the returned value will indicate which direction the
-   * wraps went. Ex: subtract a negative number and wrapping over could 
-   * occur, this would be indicated by a positive return value. If 
+   * wraps went. Ex: subtract a negative number and wrapping over could
+   * occur, this would be indicated by a positive return value. If
    * wrapping under took place, a negative value would be returned */
   template< typename IntT >
-  IntT subtract(IntT v) 
+  IntT subtract(IntT v)
   {
     int_type remainder = static_cast(v % (wrap_max - wrap_min + 1));
     IntT underflow = static_cast(-(v / (wrap_max - wrap_min + 1)));
     value_ = static_cast(value_ - remainder);
     return calculate_wrap(underflow);
   }
-            
+
 private:
   int_type value_;
 
   template< typename IntT >
   IntT calculate_wrap(IntT wrap)
   {
-    if ((value_) > wrap_max) 
+    if ((value_) > wrap_max)
     {
       ++wrap;
       value_ -= (wrap_max - wrap_min + 1);
     }
-    else if((value_) < wrap_min) 
+    else if((value_) < wrap_min)
     {
       --wrap;
       value_ += (wrap_max - wrap_min + 1);
diff --git a/project/jni/boost/include/boost/date_time/year_month_day.hpp b/project/jni/boost/include/boost/date_time/year_month_day.hpp
index 802ce42eb..9340e53f5 100644
--- a/project/jni/boost/include/boost/date_time/year_month_day.hpp
+++ b/project/jni/boost/include/boost/date_time/year_month_day.hpp
@@ -6,7 +6,7 @@
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland 
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $
  */
 
 namespace boost {
diff --git a/project/jni/boost/include/boost/detail/call_traits.hpp b/project/jni/boost/include/boost/detail/call_traits.hpp
index 6ad646ec6..36dea0003 100644
--- a/project/jni/boost/include/boost/detail/call_traits.hpp
+++ b/project/jni/boost/include/boost/detail/call_traits.hpp
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -43,20 +44,26 @@ struct ct_imp2
    typedef const T param_type;
 };
 
-template 
+template 
 struct ct_imp
 {
    typedef const T& param_type;
 };
 
-template 
-struct ct_imp
+template 
+struct ct_imp
 {
    typedef typename ct_imp2::param_type param_type;
 };
 
-template 
-struct ct_imp
+template 
+struct ct_imp
+{
+   typedef typename ct_imp2::param_type param_type;
+};
+
+template 
+struct ct_imp
 {
    typedef const T param_type;
 };
@@ -79,7 +86,8 @@ public:
    typedef typename boost::detail::ct_imp<
       T,
       ::boost::is_pointer::value,
-      ::boost::is_arithmetic::value
+      ::boost::is_arithmetic::value,
+      ::boost::is_enum::value
    >::param_type param_type;
 };
 
diff --git a/project/jni/boost/include/boost/detail/container_fwd.hpp b/project/jni/boost/include/boost/detail/container_fwd.hpp
index 7df7ccbb9..ef1749806 100644
--- a/project/jni/boost/include/boost/detail/container_fwd.hpp
+++ b/project/jni/boost/include/boost/detail/container_fwd.hpp
@@ -21,10 +21,17 @@
 // Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to      //
 // forward declare standard containers.                                       //
 //                                                                            //
+// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it //
+// normally doesn't.                                                          //
+//                                                                            //
+// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD.        //
+//                                                                            //
 ////////////////////////////////////////////////////////////////////////////////
 
 #if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
-#  if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#  if defined(BOOST_DETAIL_CONTAINER_FWD)
+     // Force forward declarations.
+#  elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
      // STLport
 #    define BOOST_DETAIL_NO_CONTAINER_FWD
 #  elif defined(__LIBCOMO__)
@@ -76,11 +83,6 @@
 #  endif
 #endif
 
-// BOOST_DETAIL_TEST_* macros are for testing only
-// and shouldn't be relied upon. But you can use
-// BOOST_DETAIL_NO_CONTAINER_FWD to prevent forward
-// declaration of containers.
-
 #if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
 
 #if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \
@@ -118,6 +120,7 @@ namespace std
     template  class basic_string;
 
 #if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+
     template  struct string_char_traits;
 #else
     template  struct char_traits;
diff --git a/project/jni/boost/include/boost/detail/interlocked.hpp b/project/jni/boost/include/boost/detail/interlocked.hpp
index 1802e3411..75e5a3061 100644
--- a/project/jni/boost/include/boost/detail/interlocked.hpp
+++ b/project/jni/boost/include/boost/detail/interlocked.hpp
@@ -33,6 +33,21 @@
 
 #elif defined(_WIN32_WCE)
 
+#if _WIN32_WCE >= 0x600
+
+extern "C" long __cdecl _InterlockedIncrement( long volatile * );
+extern "C" long __cdecl _InterlockedDecrement( long volatile * );
+extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
+extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
+extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+
+#else
 // under Windows CE we still have old-style Interlocked* functions
 
 extern "C" long __cdecl InterlockedIncrement( long* );
@@ -47,6 +62,8 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
 # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
 # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
 
+#endif
+
 # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
     ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
 # define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
diff --git a/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp b/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
index e695a2085..d266e0e33 100644
--- a/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
+++ b/project/jni/boost/include/boost/detail/scoped_enum_emulation.hpp
@@ -1,56 +1,337 @@
 //  scoped_enum_emulation.hpp  ---------------------------------------------------------//
 
 //  Copyright Beman Dawes, 2009
+//  Copyright (C) 2011-2012 Vicente J. Botet Escriba
+//  Copyright (C) 2012 Anthony Williams
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
-//  Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
-//  scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
-//  macro is used to detect feature support.
-//
-//  See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
-//  description of the scoped enum feature. Note that the committee changed the name
-//  from strongly typed enum to scoped enum.  
-//
-//  Caution: only the syntax is emulated; the semantics are not emulated and
-//  the syntax emulation doesn't include being able to specify the underlying
-//  representation type.
-//
-//  The emulation is via struct rather than namespace to allow use within classes.
-//  Thanks to Andrey Semashev for pointing that out.
-//
-//  Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
-//  Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
-//  Botet, and Daniel James. 
-//
-//  Sample usage:
-//
-//     BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
-//     ...
-//     BOOST_SCOPED_ENUM(algae) sample( algae::red );
-//     void foo( BOOST_SCOPED_ENUM(algae) color );
-//     ...
-//     sample = algae::green;
-//     foo( algae::cyan );
+/*
+[section:scoped_enums Scoped Enums]
+
+Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
+scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_CXX11_SCOPED_ENUMS
+macro is used to detect feature support.
+
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
+description of the scoped enum feature. Note that the committee changed the name
+from strongly typed enum to scoped enum.
+
+Some of the enumerations defined in the standard library are scoped enums.
+
+  enum class future_errc
+  {
+      broken_promise,
+      future_already_retrieved,
+      promise_already_satisfied,
+      no_state
+  };
+
+On compilers that don't support them, the library provides two emulations:
+
+[heading Strict]
+
+* Able to specify the underlying type.
+* explicit conversion to/from underlying type.
+* The wrapper is not a C++03 enum type.
+
+The user can declare  declare these types as
+
+  BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc)
+  {
+      broken_promise,
+      future_already_retrieved,
+      promise_already_satisfied,
+      no_state
+  }
+  BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
+
+These macros allows to use 'future_errc' in almost all the cases as an scoped enum.
+
+  future_errc err = future_errc::no_state;
+
+There are however some limitations:
+
+* The type is not a C++ enum, so 'is_enum' will be false_type.
+* The emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some macros.
+
+Instead of
+
+        switch (ev)
+        {
+        case future_errc::broken_promise:
+  // ...
+
+use
+
+        switch (boost::native_value(ev))
+        {
+        case future_errc::broken_promise:
+
+And instead of
+
+    #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+    template <>
+    struct BOOST_SYMBOL_VISIBLE is_error_code_enum : public true_type { };
+    #endif
+
+use
+
+    #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+    template <>
+    struct BOOST_SYMBOL_VISIBLE is_error_code_enum : public true_type { };
+    #endif
+
+
+Sample usage:
+
+     BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(algae, char) { green, red, cyan }; BOOST_SCOPED_ENUM_DECLARE_END(algae)
+     ...
+     algae sample( algae::red );
+     void foo( algae color );
+     ...
+     sample = algae::green;
+     foo( algae::cyan );
+
+ Light
+  Caution: only the syntax is emulated; the semantics are not emulated and
+  the syntax emulation doesn't include being able to specify the underlying
+  representation type.
+
+  The literal scoped emulation is via struct rather than namespace to allow use within classes.
+  Thanks to Andrey Semashev for pointing that out.
+  However the type is an real C++03 enum and so convertible implicitly to an int.
+
+  Sample usage:
+
+     BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
+     ...
+     BOOST_SCOPED_ENUM(algae) sample( algae::red );
+     void foo( BOOST_SCOPED_ENUM(algae) color );
+     ...
+     sample = algae::green;
+     foo( algae::cyan );
+
+  Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
+  Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vicente
+  Botet, and Daniel James.
+
+[endsect]
+*/
+
 
 #ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
 #define BOOST_SCOPED_ENUM_EMULATION_HPP
 
 #include 
+#include 
 
-#ifdef BOOST_NO_SCOPED_ENUMS
+namespace boost
+{
 
-# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
-# define BOOST_SCOPED_ENUM_END };
-# define BOOST_SCOPED_ENUM(name) name::enum_type
+#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+  /**
+   * Meta-function to get the underlying type of a scoped enum.
+   *
+   * Requires EnumType must be an enum type or the emulation of a scoped enum
+   */
+  template 
+  struct underlying_type
+  {
+    /**
+     * The member typedef type names the underlying type of EnumType. It is EnumType::underlying_type when the EnumType is an emulated scoped enum,
+     * std::underlying_type::type when the standard library std::underlying_type is provided.
+     *
+     * The user will need to specialize it when the compiler supports scoped enums but don't provides std::underlying_type.
+     */
+    typedef typename EnumType::underlying_type type;
+  };
+
+  /**
+   * Meta-function to get the native enum type associated to an enum class or its emulation.
+   */
+  template 
+  struct native_type
+  {
+    /**
+     * The member typedef type names the native enum type associated to the scoped enum,
+     * which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum.
+     */
+    typedef typename EnumType::enum_type type;
+  };
+
+  /**
+   * Casts a scoped enum to its underlying type.
+   *
+   * This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type.
+   * @param v A scoped enum.
+   * @returns The underlying type.
+   * @throws No-throws.
+   */
+  template 
+  UnderlyingType underlying_cast(EnumType v)
+  {
+    return v.get_underlying_value_();
+  }
+
+  /**
+   * Casts a scoped enum to its native enum type.
+   *
+   * This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can.
+   *
+   * EnumType the scoped enum type
+   *
+   * @param v A scoped enum.
+   * @returns The native enum value.
+   * @throws No-throws.
+   */
+  template 
+  inline
+  typename EnumType::enum_type native_value(EnumType e)
+  {
+    return e.native_value_();
+  }
+
+#else  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+  template 
+  struct underlying_type
+  {
+    //typedef typename std::underlying_type::type type;
+  };
+
+  template 
+  struct native_type
+  {
+    typedef EnumType type;
+  };
+
+  template 
+  UnderlyingType underlying_cast(EnumType v)
+  {
+    return static_cast(v);
+  }
+
+  template 
+  inline
+  EnumType native_value(EnumType e)
+  {
+    return e;
+ }
+
+#endif
+}
+
+
+#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+
+#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+
+#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
+     explicit operator underlying_type() const { return get_underlying_value_(); }
 
 #else
 
-# define BOOST_SCOPED_ENUM_START(name) enum class name
-# define BOOST_SCOPED_ENUM_END
-# define BOOST_SCOPED_ENUM(name) name
+#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR
 
 #endif
 
+/**
+ * Start a declaration of a scoped enum.
+ *
+ * @param EnumType The new scoped enum.
+ * @param UnderlyingType The underlying type.
+ */
+#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType)    \
+    struct EnumType {                                                   \
+        typedef UnderlyingType underlying_type;                         \
+        EnumType() BOOST_NOEXCEPT {}                                    \
+        explicit EnumType(underlying_type v) : v_(v) {}                 \
+        underlying_type get_underlying_value_() const { return v_; }               \
+        BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR                \
+    private:                                                            \
+        underlying_type v_;                                             \
+        typedef EnumType self_type;                                     \
+    public:                                                             \
+        enum enum_type
+
+#define BOOST_SCOPED_ENUM_DECLARE_END2() \
+        enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
+        operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); } \
+        friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
+        friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
+        friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
+        friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
+        friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
+        friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
+        friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
+        friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
+        friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
+        friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
+        friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
+        friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
+    };
+
+#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \
+    ; \
+    EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {}                 \
+    BOOST_SCOPED_ENUM_DECLARE_END2()
+
+/**
+ * Starts a declaration of a scoped enum with the default int underlying type.
+ *
+ * @param EnumType The new scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \
+  BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int)
+
+/**
+ * Name of the native enum type.
+ *
+ * @param NT The new scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type
+/**
+ * Forward declares an scoped enum.
+ *
+ * @param NT The scoped enum.
+ */
+#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType
+
+#else  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType
+#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType
+#define BOOST_SCOPED_ENUM_DECLARE_END2()
+#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ;
+
+#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType
+#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType
+
+#endif  // BOOST_NO_CXX11_SCOPED_ENUMS
+
+#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name)
+#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2()
+#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name)
+
+//#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
+//
+//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
+//# define BOOST_SCOPED_ENUM_END };
+//# define BOOST_SCOPED_ENUM(name) name::enum_type
+//
+//#else
+//
+//# define BOOST_SCOPED_ENUM_START(name) enum class name
+//# define BOOST_SCOPED_ENUM_END
+//# define BOOST_SCOPED_ENUM(name) name
+//
+//#endif
 #endif  // BOOST_SCOPED_ENUM_EMULATION_HPP
diff --git a/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp b/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp
new file mode 100644
index 000000000..064fdaf58
--- /dev/null
+++ b/project/jni/boost/include/boost/detail/utf8_codecvt_facet.ipp
@@ -0,0 +1,285 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// utf8_codecvt_facet.ipp
+
+// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
+// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). 
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Please see the comments in  to
+// learn how this file should be used.
+
+#include 
+
+#include  // for multi-byte converson routines
+#include 
+
+#include 
+#include 
+
+// If we don't have wstring, then Unicode support 
+// is not available anyway, so we don't need to even
+// compiler this file. This also fixes the problem
+// with mingw, which can compile this file, but will
+// generate link error when building DLL.
+#ifndef BOOST_NO_STD_WSTRING
+
+BOOST_UTF8_BEGIN_NAMESPACE
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// implementation for wchar_t
+
+// Translate incoming UTF-8 into UCS-4
+std::codecvt_base::result utf8_codecvt_facet::do_in(
+    std::mbstate_t& /*state*/, 
+    const char * from,
+    const char * from_end, 
+    const char * & from_next,
+    wchar_t * to, 
+    wchar_t * to_end, 
+    wchar_t * & to_next
+) const {
+    // Basic algorithm:  The first octet determines how many
+    // octets total make up the UCS-4 character.  The remaining
+    // "continuing octets" all begin with "10". To convert, subtract
+    // the amount that specifies the number of octets from the first
+    // octet.  Subtract 0x80 (1000 0000) from each continuing octet,
+    // then mash the whole lot together.  Note that each continuing
+    // octet only uses 6 bits as unique values, so only shift by
+    // multiples of 6 to combine.
+    while (from != from_end && to != to_end) {
+
+        // Error checking   on the first octet
+        if (invalid_leading_octet(*from)){
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        // The first octet is   adjusted by a value dependent upon 
+        // the number   of "continuing octets" encoding the character
+        const   int cont_octet_count = get_cont_octet_count(*from);
+        const   wchar_t octet1_modifier_table[] =   {
+            0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+        };
+
+        // The unsigned char conversion is necessary in case char is
+        // signed   (I learned this the hard way)
+        wchar_t ucs_result = 
+            (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count];
+
+        // Invariants   : 
+        //   1) At the start of the loop,   'i' continuing characters have been
+        //    processed 
+        //   2) *from   points to the next continuing character to be processed.
+        int i   = 0;
+        while(i != cont_octet_count && from != from_end) {
+
+            // Error checking on continuing characters
+            if (invalid_continuing_octet(*from)) {
+                from_next   = from;
+                to_next =   to;
+                return std::codecvt_base::error;
+            }
+
+            ucs_result *= (1 << 6); 
+
+            // each continuing character has an extra (10xxxxxx)b attached to 
+            // it that must be removed.
+            ucs_result += (unsigned char)(*from++) - 0x80;
+            ++i;
+        }
+
+        // If   the buffer ends with an incomplete unicode character...
+        if (from == from_end && i   != cont_octet_count) {
+            // rewind "from" to before the current character translation
+            from_next = from - (i+1); 
+            to_next = to;
+            return std::codecvt_base::partial;
+        }
+        *to++   = ucs_result;
+    }
+    from_next = from;
+    to_next = to;
+
+    // Were we done converting or did we run out of destination space?
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+std::codecvt_base::result utf8_codecvt_facet::do_out(
+    std::mbstate_t& /*state*/, 
+    const wchar_t *   from,
+    const wchar_t * from_end, 
+    const wchar_t * & from_next,
+    char * to, 
+    char * to_end, 
+    char * & to_next
+) const
+{
+    // RG - consider merging this table with the other one
+    const wchar_t octet1_modifier_table[] = {
+        0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+    };
+
+    wchar_t max_wchar = (std::numeric_limits::max)();
+    while (from != from_end && to != to_end) {
+
+        // Check for invalid UCS-4 character
+        if (*from  > max_wchar) {
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        int cont_octet_count = get_cont_octet_out_count(*from);
+
+        // RG  - comment this formula better
+        int shift_exponent = (cont_octet_count) *   6;
+
+        // Process the first character
+        *to++ = static_cast(octet1_modifier_table[cont_octet_count] +
+            (unsigned char)(*from / (1 << shift_exponent)));
+
+        // Process the continuation characters 
+        // Invariants: At   the start of the loop:
+        //   1) 'i' continuing octets   have been generated
+        //   2) '*to'   points to the next location to place an octet
+        //   3) shift_exponent is   6 more than needed for the next octet
+        int i   = 0;
+        while   (i != cont_octet_count && to != to_end) {
+            shift_exponent -= 6;
+            *to++ = static_cast(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6)));
+            ++i;
+        }
+        // If   we filled up the out buffer before encoding the character
+        if(to   == to_end && i != cont_octet_count) {
+            from_next = from;
+            to_next = to - (i+1);
+            return std::codecvt_base::partial;
+        }
+        ++from;
+    }
+    from_next = from;
+    to_next = to;
+    // Were we done or did we run out of destination space
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+// How many char objects can I process to get <= max_limit
+// wchar_t objects?
+int utf8_codecvt_facet::do_length(
+    BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
+    const char * from,
+    const char * from_end, 
+    std::size_t max_limit
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+) const throw()
+#else
+) const
+#endif
+{ 
+    // RG - this code is confusing!  I need a better way to express it.
+    // and test cases.
+
+    // Invariants:
+    // 1) last_octet_count has the size of the last measured character
+    // 2) char_count holds the number of characters shown to fit
+    // within the bounds so far (no greater than max_limit)
+    // 3) from_next points to the octet 'last_octet_count' before the
+    // last measured character.  
+    int last_octet_count=0;
+    std::size_t char_count = 0;
+    const char* from_next = from;
+    // Use "<" because the buffer may represent incomplete characters
+    while (from_next+last_octet_count <= from_end && char_count <= max_limit) {
+        from_next += last_octet_count;
+        last_octet_count = (get_octet_count(*from_next));
+        ++char_count;
+    }
+    return static_cast(from_next-from_end);
+}
+
+unsigned int utf8_codecvt_facet::get_octet_count(
+    unsigned char   lead_octet
+){
+    // if the 0-bit (MSB) is 0, then 1 character
+    if (lead_octet <= 0x7f) return 1;
+
+    // Otherwise the count number of consecutive 1 bits starting at MSB
+//    assert(0xc0 <= lead_octet && lead_octet <= 0xfd);
+
+    if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2;
+    else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
+    else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
+    else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
+    else return 6;
+}
+BOOST_UTF8_END_NAMESPACE
+
+namespace {
+template
+int get_cont_octet_out_count_impl(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+    return 2;
+}
+
+template<>
+int get_cont_octet_out_count_impl<4>(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+
+    // Note that the following code will generate warnings on some platforms
+    // where wchar_t is defined as UCS2.  The warnings are superfluous as the
+    // specialization is never instantitiated with such compilers, but this
+    // can cause problems if warnings are being treated as errors, so we guard
+    // against that.  Including  as we do
+    // should be enough to get WCHAR_MAX defined.
+#if !defined(WCHAR_MAX)
+#   error WCHAR_MAX not defined!
+#endif
+    // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
+#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
+    return 2;
+#elif WCHAR_MAX > 0x10000
+    
+   if (word < 0x10000) {
+        return 2;
+    }
+    if (word < 0x200000) {
+        return 3;
+    }
+    if (word < 0x4000000) {
+        return 4;
+    }
+    return 5;
+    
+#else
+    return 2;
+#endif
+}
+
+} // namespace anonymous
+
+BOOST_UTF8_BEGIN_NAMESPACE
+// How many "continuing octets" will be needed for this word
+// ==   total octets - 1.
+int utf8_codecvt_facet::get_cont_octet_out_count(
+    wchar_t word
+) const {
+    return get_cont_octet_out_count_impl(word);
+}
+BOOST_UTF8_END_NAMESPACE
+
+#endif
diff --git a/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp b/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
index f6a0b5903..ae9f031ef 100644
--- a/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
+++ b/project/jni/boost/include/boost/exception/detail/attribute_noreturn.hpp
@@ -9,7 +9,7 @@
 #if defined(_MSC_VER)
 #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
 #elif defined(__GNUC__)
-#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
+#define BOOST_ATTRIBUTE_NORETURN __attribute__((__noreturn__))
 #else
 #define BOOST_ATTRIBUTE_NORETURN
 #endif
diff --git a/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp b/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
index 883d313a9..a8d1aa79d 100644
--- a/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
+++ b/project/jni/boost/include/boost/exception/detail/error_info_impl.hpp
@@ -30,6 +30,7 @@ boost
 
             protected:
 
+            virtual
             ~error_info_base() throw()
                 {
                 }
diff --git a/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp b/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
index b6ccf7e18..5e5a2679b 100644
--- a/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
+++ b/project/jni/boost/include/boost/exception/detail/exception_ptr.hpp
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 namespace
 boost
@@ -457,7 +457,12 @@ boost
         BOOST_ASSERT(p);
         p.ptr_->rethrow();
         BOOST_ASSERT(0);
-        std::abort();
+        #if defined(UNDER_CE)
+            // some CE platforms don't define ::abort()
+            exit(-1);
+        #else
+            abort();
+        #endif
         }
 
     inline
diff --git a/project/jni/boost/include/boost/exception/error_info.hpp b/project/jni/boost/include/boost/exception/error_info.hpp
index 2e6832a33..03b3da8e3 100644
--- a/project/jni/boost/include/boost/exception/error_info.hpp
+++ b/project/jni/boost/include/boost/exception/error_info.hpp
@@ -3,4 +3,7 @@
 //Distributed under the Boost Software License, Version 1.0. (See accompanying
 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#ifndef UUID_EE7ECCA0433B11E1923E37064924019B
+#define UUID_EE7ECCA0433B11E1923E37064924019B
 namespace boost { template  class error_info; }
+#endif
diff --git a/project/jni/boost/include/boost/exception/exception.hpp b/project/jni/boost/include/boost/exception/exception.hpp
index 9cdfd5c6e..42d278712 100644
--- a/project/jni/boost/include/boost/exception/exception.hpp
+++ b/project/jni/boost/include/boost/exception/exception.hpp
@@ -310,6 +310,11 @@ boost
     namespace
     exception_detail
         {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility push (default)
+# endif
+#endif
         template 
         struct
         error_info_injector:
@@ -326,6 +331,11 @@ boost
                 {
                 }
             };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility pop
+# endif
+#endif
 
         struct large_size { char c[256]; };
         large_size dispatch_boost_exception( exception const * );
@@ -373,6 +383,11 @@ boost
     namespace
     exception_detail
         {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility push (default)
+# endif
+#endif
         class
         clone_base
             {
@@ -386,6 +401,11 @@ boost
                 {
                 }
             };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#  pragma GCC visibility pop
+# endif
+#endif
 
         inline
         void
@@ -410,8 +430,15 @@ boost
         class
         clone_impl:
             public T,
-            public clone_base
+            public virtual clone_base
             {
+            struct clone_tag { };
+            clone_impl( clone_impl const & x, clone_tag ):
+                T(x)
+                {
+                copy_boost_exception(this,&x);
+                }
+
             public:
 
             explicit
@@ -430,7 +457,7 @@ boost
             clone_base const *
             clone() const
                 {
-                return new clone_impl(*this);
+                return new clone_impl(*this,clone_tag());
                 }
 
             void
diff --git a/project/jni/boost/include/boost/exception/info.hpp b/project/jni/boost/include/boost/exception/info.hpp
index 553074622..7b56076d7 100644
--- a/project/jni/boost/include/boost/exception/info.hpp
+++ b/project/jni/boost/include/boost/exception/info.hpp
@@ -97,7 +97,7 @@ boost
                     {
                     shared_ptr const & p = i->second;
 #ifndef BOOST_NO_RTTI
-                    BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
+                    BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ );
 #endif
                     return p;
                     }
diff --git a/project/jni/boost/include/boost/exception/info_tuple.hpp b/project/jni/boost/include/boost/exception/info_tuple.hpp
index 34afe421b..bf1be15da 100644
--- a/project/jni/boost/include/boost/exception/info_tuple.hpp
+++ b/project/jni/boost/include/boost/exception/info_tuple.hpp
@@ -18,6 +18,30 @@
 namespace
 boost
     {
+    template <
+        class E >
+    inline
+    E const &
+    operator<<(
+        E const & x,
+        tuple< > const & v )
+        {
+        return x;
+        }
+
+    template <
+        class E,
+        class Tag1,class T1 >
+    inline
+    E const &
+    operator<<(
+        E const & x,
+        tuple<
+            error_info > const & v )
+        {
+        return x << v.template get<0>();
+        }
+
     template <
         class E,
         class Tag1,class T1,
diff --git a/project/jni/boost/include/boost/filesystem.hpp b/project/jni/boost/include/boost/filesystem.hpp
index d64d760c0..1a753026c 100644
--- a/project/jni/boost/include/boost/filesystem.hpp
+++ b/project/jni/boost/include/boost/filesystem.hpp
@@ -12,30 +12,9 @@
 #ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP
 #define BOOST_FILESYSTEM_FILESYSTEM_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-#  include 
-#  include 
-#  include 
-
-# else
-#  include 
-#  include 
-#  include 
-#  include 
-
-# endif
+#  include 
+#  include 
+#  include 
+#  include 
 
 #endif  // BOOST_FILESYSTEM_FILESYSTEM_HPP 
diff --git a/project/jni/boost/include/boost/filesystem/config.hpp b/project/jni/boost/include/boost/filesystem/config.hpp
index c813bf5c0..ca695f411 100644
--- a/project/jni/boost/include/boost/filesystem/config.hpp
+++ b/project/jni/boost/include/boost/filesystem/config.hpp
@@ -1,6 +1,6 @@
-//  boost/filesystem/config.hpp  -------------------------------------------------------//
+//  boost/filesystem/v3/config.hpp  ----------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2003
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
@@ -9,27 +9,101 @@
 
 //--------------------------------------------------------------------------------------// 
 
-#ifndef BOOST_FILESYSTEM_CONFIGX_HPP
-#define BOOST_FILESYSTEM_CONFIGX_HPP
+#ifndef BOOST_FILESYSTEM3_CONFIG_HPP
+#define BOOST_FILESYSTEM3_CONFIG_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
+#   error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
 # endif
 
 # if !defined(BOOST_FILESYSTEM_VERSION)
 #   define BOOST_FILESYSTEM_VERSION 3
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
 
-# else
-#  include 
+// This header implements separate compilation features as described in
+// http://www.boost.org/more/separate_compilation.html
 
+#include 
+#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
+#include  
+
+//  BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
+
+# ifdef BOOST_FILESYSTEM_SOURCE
+#   define BOOST_FILESYSTEM_DEPRECATED
 # endif
 
-#endif  // BOOST_FILESYSTEM_CONFIGX_HPP 
+//  throw an exception  ----------------------------------------------------------------//
+//
+//  Exceptions were originally thrown via boost::throw_exception().
+//  As throw_exception() became more complex, it caused user error reporting
+//  to be harder to interpret, since the exception reported became much more complex.
+//  The immediate fix was to throw directly, wrapped in a macro to make any later change
+//  easier.
+
+#define BOOST_FILESYSTEM_THROW(EX) throw EX
+
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
+# endif
+
+//  This header implements separate compilation features as described in
+//  http://www.boost.org/more/separate_compilation.html
+
+//  normalize macros  ------------------------------------------------------------------//
+
+#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) \
+  && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK)
+# define BOOST_FILESYSTEM_STATIC_LINK
+#endif
+
+#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK)
+# define BOOST_FILESYSTEM_DYN_LINK 
+#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
+# define BOOST_FILESYSTEM_STATIC_LINK 
+#endif
+
+#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK)
+# error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK
+#endif
+
+#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
+# define BOOST_FILESYSTEM_NO_LIB 
+#endif
+
+//  enable dynamic linking  ------------------------------------------------------------//
+
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
+# if defined(BOOST_FILESYSTEM_SOURCE)
+#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
+# else 
+#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
+# endif
+#else
+# define BOOST_FILESYSTEM_DECL
+#endif
+
+//  enable automatic library variant selection  ----------------------------------------// 
+
+#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
+  && !defined(BOOST_FILESYSTEM_NO_LIB)
+//
+// Set the name of our library, this will get undef'ed by auto_link.hpp
+// once it's done with it:
+//
+#define BOOST_LIB_NAME boost_filesystem
+//
+// If we're importing code from a dll, then tell auto_link.hpp about it:
+//
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
+#  define BOOST_DYN_LINK
+#endif
+//
+// And include the header that does the work:
+//
+#include 
+#endif  // auto-linking disabled
+
+#endif // BOOST_FILESYSTEM3_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/convenience.hpp b/project/jni/boost/include/boost/filesystem/convenience.hpp
index a132e17f0..f0bd98690 100644
--- a/project/jni/boost/include/boost/filesystem/convenience.hpp
+++ b/project/jni/boost/include/boost/filesystem/convenience.hpp
@@ -1,35 +1,58 @@
-//  boost/filesystem/convenience.hpp  --------------------------------------------------//
+//  boost/filesystem/convenience.hpp  ----------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes, 2002-2005
+//  Copyright Vladimir Prus, 2002
+//  Use, modification, and distribution is subject to the Boost Software
+//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
 
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
+//  See library home page at http://www.boost.org/libs/filesystem
 
-//  Library home page: http://www.boost.org/libs/filesystem
+//----------------------------------------------------------------------------// 
 
-//--------------------------------------------------------------------------------------// 
+#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
+#define BOOST_FILESYSTEM3_CONVENIENCE_HPP
 
-#ifndef BOOST_FILESYSTEM_CONVENIENCEX_HPP
-#define BOOST_FILESYSTEM_CONVENIENCEX_HPP
+#include 
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
+#include 
+#include 
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#include  // must be the last #include
 
-# else
-#  include 
+namespace boost
+{
+  namespace filesystem
+  {
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+
+    inline std::string extension(const path & p)
+    {
+      return p.extension().string();
+    }
+
+    inline std::string basename(const path & p)
+    {
+      return p.stem().string();
+    }
+
+    inline path change_extension( const path & p, const path & new_extension )
+    { 
+      path new_p( p );
+      new_p.replace_extension( new_extension );
+      return new_p;
+    }
 
 # endif
 
-#endif  // BOOST_FILESYSTEM_CONVENIENCEX_HPP 
+
+  } // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/exception.hpp b/project/jni/boost/include/boost/filesystem/exception.hpp
index 6ba8466d1..985cd8f71 100644
--- a/project/jni/boost/include/boost/filesystem/exception.hpp
+++ b/project/jni/boost/include/boost/filesystem/exception.hpp
@@ -1,35 +1,9 @@
-//  boost/filesystem/exception.hpp  ----------------------------------------------------//
+//  boost/filesystem/exception.hpp  -----------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2003
+//  Use, modification, and distribution is subject to the Boost Software
+//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
 
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP
-#define BOOST_FILESYSTEM_EXCEPTIONX_HPP
-
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
-
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-
-# else
-#  include 
-
-# endif
-
-#endif  // BOOST_FILESYSTEM_EXCEPTIONX_HPP 
+//  This header is no longer used. The contents have been moved to path.hpp.
+//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/fstream.hpp b/project/jni/boost/include/boost/filesystem/fstream.hpp
index e159e58ed..072723887 100644
--- a/project/jni/boost/include/boost/filesystem/fstream.hpp
+++ b/project/jni/boost/include/boost/filesystem/fstream.hpp
@@ -1,6 +1,6 @@
 //  boost/filesystem/fstream.hpp  ------------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2002
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
@@ -9,27 +9,174 @@
 
 //--------------------------------------------------------------------------------------// 
 
-#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP
-#define BOOST_FILESYSTEM_FSTREAMX_HPP
+#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP
+#define BOOST_FILESYSTEM3_FSTREAM_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
+#include 
+#include 
+#include 
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+#include  // must be the last #include
 
-# else
-#  include 
+//  on Windows, except for standard libaries known to have wchar_t overloads for
+//  file stream I/O, use path::string() to get a narrow character c_str()
+#if defined(BOOST_WINDOWS_API) \
+  && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
+  // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
+# define BOOST_FILESYSTEM_C_STR string().c_str()  // use narrow, since wide not available
+#else  // use the native c_str, which will be narrow on POSIX, wide on Windows
+# define BOOST_FILESYSTEM_C_STR c_str()
+#endif
 
-# endif
+namespace boost
+{
+namespace filesystem
+{
 
-#endif  // BOOST_FILESYSTEM_FSTREAMX_HPP 
+//--------------------------------------------------------------------------------------//
+//                                  basic_filebuf                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_filebuf : public std::basic_filebuf
+  {
+  private: // disallow copying
+    basic_filebuf(const basic_filebuf&);
+    const basic_filebuf& operator=(const basic_filebuf&);
+
+  public:
+    basic_filebuf() {}
+    virtual ~basic_filebuf() {}
+
+    basic_filebuf*
+      open(const path& p, std::ios_base::openmode mode) 
+    {
+      return std::basic_filebuf::open(p.BOOST_FILESYSTEM_C_STR, mode)
+        ? this : 0;
+    }
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                 basic_ifstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_ifstream : public std::basic_ifstream
+  {
+  private: // disallow copying
+    basic_ifstream(const basic_ifstream&);
+    const basic_ifstream& operator=(const basic_ifstream&);
+
+  public:
+    basic_ifstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_ifstream(const path& p)
+      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
+
+    basic_ifstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_ifstream() {}
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                 basic_ofstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_ofstream : public std::basic_ofstream
+  {
+  private: // disallow copying
+    basic_ofstream(const basic_ofstream&);
+    const basic_ofstream& operator=(const basic_ofstream&);
+
+  public:
+    basic_ofstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_ofstream(const path& p)
+      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
+
+    basic_ofstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_ofstream() {}
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                  basic_fstream                                       //
+//--------------------------------------------------------------------------------------//
+
+  template < class charT, class traits = std::char_traits >
+  class basic_fstream : public std::basic_fstream
+  {
+  private: // disallow copying
+    basic_fstream(const basic_fstream&);
+    const basic_fstream & operator=(const basic_fstream&);
+
+  public:
+    basic_fstream() {}
+
+    // use two signatures, rather than one signature with default second
+    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
+
+    explicit basic_fstream(const path& p)
+      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR,
+          std::ios_base::in | std::ios_base::out) {}
+
+    basic_fstream(const path& p, std::ios_base::openmode mode)
+      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
+
+    void open(const path& p)
+      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR,
+          std::ios_base::in | std::ios_base::out); }
+
+    void open(const path& p, std::ios_base::openmode mode)
+      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
+
+    virtual ~basic_fstream() {}
+
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                    typedefs                                          //
+//--------------------------------------------------------------------------------------//
+
+  typedef basic_filebuf filebuf;
+  typedef basic_ifstream ifstream;
+  typedef basic_ofstream ofstream;
+  typedef basic_fstream fstream;
+
+  typedef basic_filebuf wfilebuf;
+  typedef basic_ifstream wifstream;
+  typedef basic_ofstream wofstream;
+  typedef basic_fstream wfstream;
+  
+} // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif  // BOOST_FILESYSTEM3_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/operations.hpp b/project/jni/boost/include/boost/filesystem/operations.hpp
index db7b1235e..dc01b7d8b 100644
--- a/project/jni/boost/include/boost/filesystem/operations.hpp
+++ b/project/jni/boost/include/boost/filesystem/operations.hpp
@@ -1,35 +1,1096 @@
 //  boost/filesystem/operations.hpp  ---------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
-
+//  Copyright Beman Dawes 2002-2009
+//  Copyright Jan Langer 2002
+//  Copyright Dietmar Kuehl 2001                                        
+//  Copyright Vladimir Prus 2002
+   
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
 //  Library home page: http://www.boost.org/libs/filesystem
 
-//--------------------------------------------------------------------------------------// 
+//--------------------------------------------------------------------------------------//
 
-#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP
-#define BOOST_FILESYSTEM_OPERATIONSX_HPP
+#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP
+#define BOOST_FILESYSTEM3_OPERATIONS_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include  // for pair
+#include 
+#include 
+#include 
+
+#ifdef BOOST_WINDOWS_API
+#  include 
+#endif
+
+#include  // must be the last #include
+
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+  namespace filesystem
+  {
+
+//--------------------------------------------------------------------------------------//
+//                                     file_type                                        //
+//--------------------------------------------------------------------------------------//
+
+  enum file_type
+  { 
+    status_error,
+#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+    status_unknown = status_error,
+#   endif
+    file_not_found,
+    regular_file,
+    directory_file,
+    // the following may not apply to some operating systems or file systems
+    symlink_file,
+    block_file,
+    character_file,
+    fifo_file,
+    socket_file,
+    reparse_file,  // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
+    type_unknown,  // file does exist, but isn't one of the above types or
+                   // we don't have strong enough permission to find its type
+
+    _detail_directory_symlink  // internal use only; never exposed to users
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                       perms                                          //
+//--------------------------------------------------------------------------------------//
+
+  enum perms
+  {
+    no_perms = 0,       // file_not_found is no_perms rather than perms_not_known
+
+    // POSIX equivalent macros given in comments.
+    // Values are from POSIX and are given in octal per the POSIX standard.
+
+    // permission bits
+    
+    owner_read = 0400,  // S_IRUSR, Read permission, owner
+    owner_write = 0200, // S_IWUSR, Write permission, owner
+    owner_exe = 0100,   // S_IXUSR, Execute/search permission, owner
+    owner_all = 0700,   // S_IRWXU, Read, write, execute/search by owner
+
+    group_read = 040,   // S_IRGRP, Read permission, group
+    group_write = 020,  // S_IWGRP, Write permission, group
+    group_exe = 010,    // S_IXGRP, Execute/search permission, group
+    group_all = 070,    // S_IRWXG, Read, write, execute/search by group
+
+    others_read = 04,   // S_IROTH, Read permission, others
+    others_write = 02,  // S_IWOTH, Write permission, others
+    others_exe = 01,    // S_IXOTH, Execute/search permission, others
+    others_all = 07,    // S_IRWXO, Read, write, execute/search by others
+
+    all_all = owner_all|group_all|others_all,  // 0777
+
+    // other POSIX bits
+
+    set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
+    set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
+    sticky_bit     = 01000, // S_ISVTX,
+                            // (POSIX XSI) On directories, restricted deletion flag 
+	                          // (V7) 'sticky bit': save swapped text even after use 
+                            // (SunOS) On non-directories: don't cache this file
+                            // (SVID-v4.2) On directories: restricted deletion flag
+                            // Also see http://en.wikipedia.org/wiki/Sticky_bit
+
+    perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit,  // 07777
+
+    perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
+
+    // options for permissions() function
+
+    add_perms = 0x1000,     // adds the given permission bits to the current bits
+    remove_perms = 0x2000,  // removes the given permission bits from the current bits;
+                            // choose add_perms or remove_perms, not both; if neither add_perms
+                            // nor remove_perms is given, replace the current bits with
+                            // the given bits.
+
+    symlink_perms = 0x4000  // on POSIX, don't resolve symlinks; implied on Windows
+  };
+
+  BOOST_BITMASK(perms)
+
+//--------------------------------------------------------------------------------------//
+//                                    file_status                                       //
+//--------------------------------------------------------------------------------------//
+
+  class BOOST_FILESYSTEM_DECL file_status
+  {
+  public:
+             file_status()            : m_value(status_error), m_perms(perms_not_known) {}
+    explicit file_status(file_type v, perms prms = perms_not_known)
+                                      : m_value(v), m_perms(prms) {}
+
+    // observers
+    file_type  type() const                       { return m_value; }
+    perms      permissions() const                { return m_perms; } 
+
+    // modifiers
+    void       type(file_type v)                  { m_value = v; }
+    void       permissions(perms prms)            { m_perms = prms; }
+
+    bool operator==(const file_status& rhs) const { return type() == rhs.type() && 
+                                                    permissions() == rhs.permissions(); }
+    bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
+
+  private:
+    file_type   m_value;
+    enum perms  m_perms;
+  };
+
+  inline bool type_present(file_status f) { return f.type() != status_error; }
+  inline bool permissions_present(file_status f)
+                                          {return f.permissions() != perms_not_known;}
+  inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); }
+  inline bool exists(file_status f)       { return f.type() != status_error
+                                                && f.type() != file_not_found; }
+  inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
+  inline bool is_directory(file_status f) { return f.type() == directory_file; }
+  inline bool is_symlink(file_status f)   { return f.type() == symlink_file; }
+  inline bool is_other(file_status f)     { return exists(f) && !is_regular_file(f)
+                                                && !is_directory(f) && !is_symlink(f); }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline bool is_regular(file_status f)   { return f.type() == regular_file; }
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
+  struct space_info
+  {
+    // all values are byte counts
+    boost::uintmax_t capacity;
+    boost::uintmax_t free;      // <= capacity
+    boost::uintmax_t available; // <= free
+  };
 
-# else
-#  include 
+  BOOST_SCOPED_ENUM_START(copy_option)
+    {none, fail_if_exists = none, overwrite_if_exists};
+  BOOST_SCOPED_ENUM_END
 
+//--------------------------------------------------------------------------------------//
+//                             implementation details                                   //
+//--------------------------------------------------------------------------------------//
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL
+    file_status status(const path&p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    file_status symlink_status(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool is_empty(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path initial_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path canonical(const path& p, const path& base, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy(const path& from, const path& to, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_directory(const path& from, const path& to, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_file(const path& from, const path& to,
+                    BOOST_SCOPED_ENUM(copy_option) option,  // See ticket #2925
+                    system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool create_directories(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool create_directory(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_directory_symlink(const path& to, const path& from,
+                                  system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void create_symlink(const path& to, const path& from, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path current_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void current_path(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    std::time_t last_write_time(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void last_write_time(const path& p, const std::time_t new_time,
+                         system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void permissions(const path& p, perms prms, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path read_symlink(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+      // For standardization, if the committee doesn't like "remove", consider "eliminate"
+    bool remove(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    space_info space(const path& p, system::error_code* ec=0); 
+    BOOST_FILESYSTEM_DECL
+    path system_complete(const path& p, system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path temp_directory_path(system::error_code* ec=0);
+    BOOST_FILESYSTEM_DECL
+    path unique_path(const path& p, system::error_code* ec=0);
+  }  // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                             status query functions                                   //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  inline
+  file_status status(const path& p)    {return detail::status(p);}
+  inline 
+  file_status status(const path& p, system::error_code& ec)
+                                       {return detail::status(p, &ec);}
+  inline 
+  file_status symlink_status(const path& p) {return detail::symlink_status(p);}
+  inline
+  file_status symlink_status(const path& p, system::error_code& ec)
+                                       {return detail::symlink_status(p, &ec);}
+  inline 
+  bool exists(const path& p)           {return exists(detail::status(p));}
+  inline 
+  bool exists(const path& p, system::error_code& ec)
+                                       {return exists(detail::status(p, &ec));}
+  inline 
+  bool is_directory(const path& p)     {return is_directory(detail::status(p));}
+  inline 
+  bool is_directory(const path& p, system::error_code& ec)
+                                       {return is_directory(detail::status(p, &ec));}
+  inline 
+  bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
+  inline 
+  bool is_regular_file(const path& p, system::error_code& ec)
+                                       {return is_regular_file(detail::status(p, &ec));}
+  inline 
+  bool is_other(const path& p)         {return is_other(detail::status(p));}
+  inline 
+  bool is_other(const path& p, system::error_code& ec)
+                                       {return is_other(detail::status(p, &ec));}
+  inline
+  bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
+  inline 
+  bool is_symlink(const path& p, system::error_code& ec)
+                                       {return is_symlink(detail::symlink_status(p, &ec));}
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline
+  bool is_regular(const path& p)       {return is_regular(detail::status(p));}
+  inline
+  bool is_regular(const path& p, system::error_code& ec)
+                                       {return is_regular(detail::status(p, &ec));}
 # endif
 
-#endif  // BOOST_FILESYSTEM_OPERATIONSX_HPP 
+  inline
+  bool is_empty(const path& p)         {return detail::is_empty(p);}
+  inline
+  bool is_empty(const path& p, system::error_code& ec)
+                                       {return detail::is_empty(p, &ec);}
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                             operational functions                                    //
+//                  in alphabetical order, unless otherwise noted                       //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+ 
+  //  forward declarations
+  path current_path();  // fwd declaration
+  path initial_path();
+
+  BOOST_FILESYSTEM_DECL
+  path absolute(const path& p, const path& base=current_path());
+  //  If base.is_absolute(), throws nothing. Thus no need for ec argument
+
+  inline
+  path canonical(const path& p, const path& base=current_path())
+                                       {return detail::canonical(p, base);}
+  inline
+  path canonical(const path& p, system::error_code& ec)
+                                       {return detail::canonical(p, current_path(), &ec);}
+  inline
+  path canonical(const path& p, const path& base, system::error_code& ec)
+                                       {return detail::canonical(p, base, &ec);}
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline
+  path complete(const path& p)
+  {
+    return absolute(p, initial_path());
+  }
+
+  inline
+  path complete(const path& p, const path& base)
+  {
+    return absolute(p, base);
+  }
+# endif
+
+  inline
+  void copy(const path& from, const path& to) {detail::copy(from, to);}
+
+  inline
+  void copy(const path& from, const path& to, system::error_code& ec) 
+                                       {detail::copy(from, to, &ec);}
+  inline
+  void copy_directory(const path& from, const path& to)
+                                       {detail::copy_directory(from, to);}
+  inline
+  void copy_directory(const path& from, const path& to, system::error_code& ec)
+                                       {detail::copy_directory(from, to, &ec);}
+  inline
+  void copy_file(const path& from, const path& to,   // See ticket #2925
+                 BOOST_SCOPED_ENUM(copy_option) option)
+                                       {detail::copy_file(from, to, option);}
+  inline
+  void copy_file(const path& from, const path& to)
+                                       {detail::copy_file(from, to, copy_option::fail_if_exists);}
+  inline
+  void copy_file(const path& from, const path& to,   // See ticket #2925
+                 BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec)
+                                       {detail::copy_file(from, to, option, &ec);}
+  inline
+  void copy_file(const path& from, const path& to, system::error_code& ec)
+                                       {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);}
+  inline
+  void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}
+
+  inline
+  void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec)
+                                       {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
+  inline
+  bool create_directories(const path& p) {return detail::create_directories(p);}
+
+  inline
+  bool create_directories(const path& p, system::error_code& ec)
+                                       {return detail::create_directories(p, &ec);}
+  inline
+  bool create_directory(const path& p) {return detail::create_directory(p);}
+
+  inline
+  bool create_directory(const path& p, system::error_code& ec)
+                                       {return detail::create_directory(p, &ec);}
+  inline
+  void create_directory_symlink(const path& to, const path& from)
+                                       {detail::create_directory_symlink(to, from);}
+  inline
+  void create_directory_symlink(const path& to, const path& from, system::error_code& ec)
+                                       {detail::create_directory_symlink(to, from, &ec);}
+  inline
+  void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
+
+  inline
+  void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec)
+                                       {detail::create_hard_link(to, new_hard_link, &ec);}
+  inline
+  void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
+
+  inline
+  void create_symlink(const path& to, const path& new_symlink, system::error_code& ec)
+                                       {detail::create_symlink(to, new_symlink, &ec);}
+  inline
+  path current_path()                  {return detail::current_path();}
+
+  inline
+  path current_path(system::error_code& ec) {return detail::current_path(&ec);}
+
+  inline
+  void current_path(const path& p)     {detail::current_path(p);}
+
+  inline
+  void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);}
+
+  inline
+  bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
+
+  inline
+  bool equivalent(const path& p1, const path& p2, system::error_code& ec)
+                                       {return detail::equivalent(p1, p2, &ec);}
+  inline
+  boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
+
+  inline
+  boost::uintmax_t file_size(const path& p, system::error_code& ec)
+                                       {return detail::file_size(p, &ec);}
+  inline
+  boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
+
+  inline
+  boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
+                                       {return detail::hard_link_count(p, &ec);}
+  inline
+  path initial_path()                  {return detail::initial_path();}
+
+  inline
+  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
+
+  template 
+  path initial_path() {return initial_path();}
+  template 
+  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
+
+  inline
+  std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
+
+  inline
+  std::time_t last_write_time(const path& p, system::error_code& ec)
+                                       {return detail::last_write_time(p, &ec);}
+  inline
+  void last_write_time(const path& p, const std::time_t new_time)
+                                       {detail::last_write_time(p, new_time);}
+  inline
+  void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec)
+                                       {detail::last_write_time(p, new_time, &ec);}
+  inline
+  void permissions(const path& p, perms prms)
+                                       {detail::permissions(p, prms);}
+  inline
+  void permissions(const path& p, perms prms, system::error_code& ec)
+                                       {detail::permissions(p, prms, &ec);}
+
+  inline
+  path read_symlink(const path& p)     {return detail::read_symlink(p);}
+
+  inline
+  path read_symlink(const path& p, system::error_code& ec)
+                                       {return detail::read_symlink(p, &ec);}
+  inline
+    // For standardization, if the committee doesn't like "remove", consider "eliminate"
+  bool remove(const path& p)           {return detail::remove(p);}
+
+  inline
+  bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);}
+
+  inline
+  boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
+    
+  inline
+  boost::uintmax_t remove_all(const path& p, system::error_code& ec)
+                                       {return detail::remove_all(p, &ec);}
+  inline
+  void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
+
+  inline
+  void rename(const path& old_p, const path& new_p, system::error_code& ec)
+                                       {detail::rename(old_p, new_p, &ec);}
+  inline  // name suggested by Scott McMurray
+  void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
+
+  inline
+  void resize_file(const path& p, uintmax_t size, system::error_code& ec)
+                                       {detail::resize_file(p, size, &ec);}
+  inline
+  space_info space(const path& p)      {return detail::space(p);} 
+
+  inline
+  space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} 
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  inline bool symbolic_link_exists(const path& p)
+                                       { return is_symlink(symlink_status(p)); }
+# endif
+
+  inline
+  path system_complete(const path& p)  {return detail::system_complete(p);}
+
+  inline
+  path system_complete(const path& p, system::error_code& ec)
+                                       {return detail::system_complete(p, &ec);}
+  inline
+  path temp_directory_path()           {return detail::temp_directory_path();}
+
+  inline
+  path temp_directory_path(system::error_code& ec) 
+                                       {return detail::temp_directory_path(&ec);}
+  inline
+  path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
+                                       { return detail::unique_path(p); }
+  inline
+  path unique_path(const path& p, system::error_code& ec)
+                                       { return detail::unique_path(p, &ec); }
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                                 directory_entry                                      //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+//  GCC has a problem with a member function named path within a namespace or 
+//  sub-namespace that also has a class named path. The workaround is to always
+//  fully qualify the name path when it refers to the class name.
+
+class BOOST_FILESYSTEM_DECL directory_entry
+{
+public:
+
+  // compiler generated copy constructor, copy assignment, and destructor apply
+
+  directory_entry() {}
+  explicit directory_entry(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st=file_status())
+    : m_path(p), m_status(st), m_symlink_status(symlink_st)
+    {}
+
+  void assign(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st = file_status())
+    { m_path = p; m_status = st; m_symlink_status = symlink_st; }
+
+  void replace_filename(const boost::filesystem::path& p,
+    file_status st = file_status(), file_status symlink_st = file_status())
+  {
+    m_path.remove_filename();
+    m_path /= p;
+    m_status = st;
+    m_symlink_status = symlink_st;
+  }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  void replace_leaf(const boost::filesystem::path& p,
+    file_status st, file_status symlink_st)
+      { replace_filename(p, st, symlink_st); }
+# endif
+
+  const boost::filesystem::path&  path() const               {return m_path;}
+  file_status   status() const                               {return m_get_status();}
+  file_status   status(system::error_code& ec) const         {return m_get_status(&ec);}
+  file_status   symlink_status() const                       {return m_get_symlink_status();}
+  file_status   symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
+
+  bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} 
+  bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} 
+  bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} 
+  bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} 
+  bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} 
+  bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} 
+
+private:
+  boost::filesystem::path   m_path;
+  mutable file_status       m_status;           // stat()-like
+  mutable file_status       m_symlink_status;   // lstat()-like
+
+  file_status m_get_status(system::error_code* ec=0) const;
+  file_status m_get_symlink_status(system::error_code* ec=0) const;
+}; // directory_entry
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                            directory_iterator helpers                                //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+class directory_iterator;
+
+namespace detail
+{
+  BOOST_FILESYSTEM_DECL
+    system::error_code dir_itr_close(// never throws()
+    void *& handle
+#   if     defined(BOOST_POSIX_API)
+    , void *& buffer
+#   endif
+  ); 
+
+  struct dir_itr_imp
+  {
+    directory_entry  dir_entry;
+    void*            handle;
+
+#   ifdef BOOST_POSIX_API
+    void*            buffer;  // see dir_itr_increment implementation
+#   endif
+
+    dir_itr_imp() : handle(0)
+#   ifdef BOOST_POSIX_API
+      , buffer(0)
+#   endif
+    {}
+
+    ~dir_itr_imp() // never throws
+    {
+      dir_itr_close(handle
+#       if defined(BOOST_POSIX_API)
+         , buffer
+#       endif
+    );
+    }
+  };
+
+  // see path::iterator: comment below
+  BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it,
+    const path& p, system::error_code* ec);
+  BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it,
+    system::error_code* ec);
+
+}  // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                                directory_iterator                                    //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  class directory_iterator
+    : public boost::iterator_facade< directory_iterator,
+                                     directory_entry,
+                                     boost::single_pass_traversal_tag >
+  {
+  public:
+
+    directory_iterator(){}  // creates the "end" iterator
+
+    // iterator_facade derived classes don't seem to like implementations in
+    // separate translation unit dll's, so forward to detail functions
+    explicit directory_iterator(const path& p)
+        : m_imp(new detail::dir_itr_imp)
+          { detail::directory_iterator_construct(*this, p, 0); }
+
+    directory_iterator(const path& p, system::error_code& ec)
+        : m_imp(new detail::dir_itr_imp)
+          { detail::directory_iterator_construct(*this, p, &ec); }
+
+   ~directory_iterator() {} // never throws
+
+    directory_iterator& increment(system::error_code& ec)
+    { 
+      detail::directory_iterator_increment(*this, &ec);
+      return *this;
+    }
+
+  private:
+    friend struct detail::dir_itr_imp;
+    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it,
+      const path& p, system::error_code* ec);
+    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
+      system::error_code* ec);
+
+    // shared_ptr provides shallow-copy semantics required for InputIterators.
+    // m_imp.get()==0 indicates the end iterator.
+    boost::shared_ptr< detail::dir_itr_imp >  m_imp;
+
+    friend class boost::iterator_core_access;
+
+    boost::iterator_facade<
+      directory_iterator,
+      directory_entry,
+      boost::single_pass_traversal_tag >::reference dereference() const 
+    {
+      BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
+      return m_imp->dir_entry;
+    }
+
+    void increment() { detail::directory_iterator_increment(*this, 0); }
+
+    bool equal(const directory_iterator& rhs) const
+      { return m_imp == rhs.m_imp; }
+  };
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                      recursive_directory_iterator helpers                            //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  BOOST_SCOPED_ENUM_START(symlink_option)
+  {
+    none,
+    no_recurse = none,         // don't follow directory symlinks (default behavior)
+    recurse,                   // follow directory symlinks
+    _detail_no_push = recurse << 1  // internal use only
+  };
+  BOOST_SCOPED_ENUM_END
+
+  BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option))
+
+  namespace detail
+  {
+    struct recur_dir_itr_imp
+    {
+      typedef directory_iterator element_type;
+      std::stack< element_type, std::vector< element_type > > m_stack;
+      int  m_level;
+      BOOST_SCOPED_ENUM(symlink_option) m_options;
+
+      recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {}
+
+      void increment(system::error_code* ec);  // ec == 0 means throw on error
+
+      void pop();
+
+    };
+
+    //  Implementation is inline to avoid dynamic linking difficulties with m_stack:
+    //  Microsoft warning C4251, m_stack needs to have dll-interface to be used by
+    //  clients of struct 'boost::filesystem::detail::recur_dir_itr_imp'
+
+    inline
+    void recur_dir_itr_imp::increment(system::error_code* ec)
+    // ec == 0 means throw on error
+    {
+      if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
+        m_options &= ~symlink_option::_detail_no_push;
+
+      else
+      {
+        // Logic for following predicate was contributed by Daniel Aarno to handle cyclic
+        // symlinks correctly and efficiently, fixing ticket #5652.
+        //   if (((m_options & symlink_option::recurse) == symlink_option::recurse
+        //         || !is_symlink(m_stack.top()->symlink_status()))
+        //       && is_directory(m_stack.top()->status())) ...
+        // The predicate code has since been rewritten to pass error_code arguments,
+        // per ticket #5653.
+        bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
+                       || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
+                                   : !is_symlink(m_stack.top()->symlink_status(*ec)));
+        if (ec != 0 && *ec)
+          return;
+        bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
+                                            : is_directory(m_stack.top()->status(*ec)));
+        if (ec != 0 && *ec)
+          return;
+
+        if (and_pred)
+        {
+          if (ec == 0)
+            m_stack.push(directory_iterator(m_stack.top()->path()));
+          else
+          {
+            m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
+            if (*ec)
+              return;
+          }
+          if (m_stack.top() != directory_iterator())
+          {
+            ++m_level;
+            return;
+          }
+          m_stack.pop();
+        }
+      }
+
+      while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
+      {
+        m_stack.pop();
+        --m_level;
+      }
+    }
+
+    inline
+    void recur_dir_itr_imp::pop()
+    {
+      BOOST_ASSERT_MSG(m_level > 0,
+        "pop() on recursive_directory_iterator with level < 1");
+
+      do
+      {
+        m_stack.pop();
+        --m_level;
+      }
+      while (!m_stack.empty() && ++m_stack.top() == directory_iterator());
+    }
+  } // namespace detail
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                           recursive_directory_iterator                               //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+  class recursive_directory_iterator
+    : public boost::iterator_facade<
+        recursive_directory_iterator,
+        directory_entry,
+        boost::single_pass_traversal_tag >
+  {
+  public:
+
+    recursive_directory_iterator(){}  // creates the "end" iterator
+
+    explicit recursive_directory_iterator(const path& dir_path,
+      BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none)
+      : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = opt;
+      m_imp->m_stack.push(directory_iterator(dir_path));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator(const path& dir_path,
+      BOOST_SCOPED_ENUM(symlink_option) opt,
+      system::error_code & ec)
+    : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = opt;
+      m_imp->m_stack.push(directory_iterator(dir_path, ec));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator(const path& dir_path,
+      system::error_code & ec)
+    : m_imp(new detail::recur_dir_itr_imp)
+    {
+      m_imp->m_options = symlink_option::none;
+      m_imp->m_stack.push(directory_iterator(dir_path, ec));
+      if (m_imp->m_stack.top() == directory_iterator())
+        { m_imp.reset (); }
+    }
+
+    recursive_directory_iterator& increment(system::error_code& ec)
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "increment() on end recursive_directory_iterator");
+      m_imp->increment(&ec);
+      if (m_imp->m_stack.empty())
+        m_imp.reset(); // done, so make end iterator
+      return *this;
+    }
+
+    int level() const
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "level() on end recursive_directory_iterator");
+      return m_imp->m_level;
+    }
+
+    bool no_push_pending() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "is_no_push_requested() on end recursive_directory_iterator");
+      return (m_imp->m_options & symlink_option::_detail_no_push)
+        == symlink_option::_detail_no_push;
+    }
+
+#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+    bool no_push_request() const { return no_push_pending(); }
+#   endif
+
+    void pop()
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "pop() on end recursive_directory_iterator");
+      m_imp->pop();
+      if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
+    }
+
+    void no_push(bool value=true)
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "no_push() on end recursive_directory_iterator");
+      if (value)
+        m_imp->m_options |= symlink_option::_detail_no_push;
+      else
+        m_imp->m_options &= ~symlink_option::_detail_no_push;
+    }
+
+    file_status status() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "status() on end recursive_directory_iterator");
+      return m_imp->m_stack.top()->status();
+    }
+
+    file_status symlink_status() const
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "symlink_status() on end recursive_directory_iterator");
+      return m_imp->m_stack.top()->symlink_status();
+    }
+
+  private:
+
+    // shared_ptr provides shallow-copy semantics required for InputIterators.
+    // m_imp.get()==0 indicates the end iterator.
+    boost::shared_ptr< detail::recur_dir_itr_imp >  m_imp;
+
+    friend class boost::iterator_core_access;
+
+    boost::iterator_facade< 
+      recursive_directory_iterator,
+      directory_entry,
+      boost::single_pass_traversal_tag >::reference
+    dereference() const 
+    {
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "dereference of end recursive_directory_iterator");
+      return *m_imp->m_stack.top();
+    }
+
+    void increment()
+    { 
+      BOOST_ASSERT_MSG(m_imp.get(),
+        "increment of end recursive_directory_iterator");
+      m_imp->increment(0);
+      if (m_imp->m_stack.empty())
+        m_imp.reset(); // done, so make end iterator
+    }
+
+    bool equal(const recursive_directory_iterator& rhs) const
+      { return m_imp == rhs.m_imp; }
+
+  };
+
+# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+  typedef recursive_directory_iterator wrecursive_directory_iterator;
+# endif
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                            class filesystem_error                                    //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+  
+  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
+  {
+  // see http://www.boost.org/more/error_handling.html for design rationale
+
+  // all functions are inline to avoid issues with crossing dll boundaries
+
+  public:
+    // compiler generates copy constructor and copy assignment
+
+    filesystem_error(
+      const std::string & what_arg, system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+
+    filesystem_error(
+      const std::string & what_arg, const path& path1_arg,
+      system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+        m_imp_ptr->m_path1 = path1_arg;
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+    
+    filesystem_error(
+      const std::string & what_arg, const path& path1_arg,
+      const path& path2_arg, system::error_code ec)
+      : system::system_error(ec, what_arg)
+    {
+      try
+      {
+        m_imp_ptr.reset(new m_imp);
+        m_imp_ptr->m_path1 = path1_arg;
+        m_imp_ptr->m_path2 = path2_arg;
+      }
+      catch (...) { m_imp_ptr.reset(); }
+    }
+
+    ~filesystem_error() throw() {}
+
+    const path& path1() const
+    {
+      static const path empty_path;
+      return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
+    }
+    const path& path2() const
+    {
+      static const path empty_path;
+      return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
+    }
+
+    const char* what() const throw()
+    {
+      if (!m_imp_ptr.get())
+        return system::system_error::what();
+
+      try
+      {
+        if (m_imp_ptr->m_what.empty())
+        {
+          m_imp_ptr->m_what = system::system_error::what();
+          if (!m_imp_ptr->m_path1.empty())
+          {
+            m_imp_ptr->m_what += ": \"";
+            m_imp_ptr->m_what += m_imp_ptr->m_path1.string();
+            m_imp_ptr->m_what += "\"";
+          }
+          if (!m_imp_ptr->m_path2.empty())
+          {
+            m_imp_ptr->m_what += ", \"";
+            m_imp_ptr->m_what += m_imp_ptr->m_path2.string();
+            m_imp_ptr->m_what += "\"";
+          }
+        }
+        return m_imp_ptr->m_what.c_str();
+      }
+      catch (...)
+      {
+        return system::system_error::what();
+      }
+    }
+
+  private:
+    struct m_imp
+    {
+      path         m_path1; // may be empty()
+      path         m_path2; // may be empty()
+      std::string  m_what;  // not built until needed
+    };
+    boost::shared_ptr m_imp_ptr;
+  };
+
+//  test helper  -----------------------------------------------------------------------//
+
+//  Not part of the documented interface since false positives are possible;
+//  there is no law that says that an OS that has large stat.st_size
+//  actually supports large file sizes.
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
+  }
+
+  } // namespace filesystem
+} // namespace boost
+
+#include  // pops abi_prefix.hpp pragmas
+#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/path.hpp b/project/jni/boost/include/boost/filesystem/path.hpp
index 3bed7d2c8..2dd1b00ea 100644
--- a/project/jni/boost/include/boost/filesystem/path.hpp
+++ b/project/jni/boost/include/boost/filesystem/path.hpp
@@ -1,35 +1,758 @@
-//  boost/filesystem/path.hpp  ---------------------------------------------------------//
+//  filesystem path.hpp  ---------------------------------------------------------------//
 
-//  Copyright Beman Dawes 2010
+//  Copyright Beman Dawes 2002-2005, 2009
+//  Copyright Vladimir Prus 2002
 
 //  Distributed under the Boost Software License, Version 1.0.
 //  See http://www.boost.org/LICENSE_1_0.txt
 
 //  Library home page: http://www.boost.org/libs/filesystem
 
-//--------------------------------------------------------------------------------------// 
+//  path::stem(), extension(), and replace_extension() are based on
+//  basename(), extension(), and change_extension() from the original
+//  filesystem/convenience.hpp header by Vladimir Prus.
 
-#ifndef BOOST_FILESYSTEM_PATHX_HPP
-#define BOOST_FILESYSTEM_PATHX_HPP
+#ifndef BOOST_FILESYSTEM_PATH_HPP
+#define BOOST_FILESYSTEM_PATH_HPP
 
-#include   // for , in case
-                             //  BOOST_FILESYSTEM_VERSION defined there
+#include 
 
-# if defined(BOOST_FILESYSTEM_VERSION) \
-  && BOOST_FILESYSTEM_VERSION != 2  && BOOST_FILESYSTEM_VERSION != 3
-#   error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
+# if defined( BOOST_NO_STD_WSTRING )
+#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
+#include 
+#include   // includes 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include  // must be the last #include
+
+namespace boost
+{
+namespace filesystem
+{
+  //------------------------------------------------------------------------------------//
+  //                                                                                    //
+  //                                    class path                                      //
+  //                                                                                    //
+  //------------------------------------------------------------------------------------//
+
+  class BOOST_FILESYSTEM_DECL path
+  {
+  public:
+
+    //  value_type is the character type used by the operating system API to
+    //  represent paths.
+
+# ifdef BOOST_WINDOWS_API
+    typedef wchar_t                        value_type;
+    BOOST_STATIC_CONSTEXPR value_type      preferred_separator = L'\\';
+# else 
+    typedef char                           value_type;
+    BOOST_STATIC_CONSTEXPR value_type      preferred_separator = '/';
+# endif
+    typedef std::basic_string  string_type;  
+    typedef std::codecvt   codecvt_type;
+
+
+    //  ----- character encoding conversions -----
+
+    //  Following the principle of least astonishment, path input arguments
+    //  passed to or obtained from the operating system via objects of
+    //  class path behave as if they were directly passed to or
+    //  obtained from the O/S API, unless conversion is explicitly requested.
+    //
+    //  POSIX specfies that path strings are passed unchanged to and from the
+    //  API. Note that this is different from the POSIX command line utilities,
+    //  which convert according to a locale.
+    //
+    //  Thus for POSIX, char strings do not undergo conversion.  wchar_t strings
+    //  are converted to/from char using the path locale or, if a conversion
+    //  argument is given, using a conversion object modeled on
+    //  std::wstring_convert.
+    //
+    //  The path locale, which is global to the thread, can be changed by the
+    //  imbue() function. It is initialized to an implementation defined locale.
+    //  
+    //  For Windows, wchar_t strings do not undergo conversion. char strings
+    //  are converted using the "ANSI" or "OEM" code pages, as determined by
+    //  the AreFileApisANSI() function, or, if a conversion argument is given,
+    //  using a conversion object modeled on std::wstring_convert.
+    //
+    //  See m_pathname comments for further important rationale.
+
+    //  TODO: rules needed for operating systems that use / or .
+    //  differently, or format directory paths differently from file paths. 
+    //
+    //  **********************************************************************************
+    //
+    //  More work needed: How to handle an operating system that may have
+    //  slash characters or dot characters in valid filenames, either because
+    //  it doesn't follow the POSIX standard, or because it allows MBCS
+    //  filename encodings that may contain slash or dot characters. For
+    //  example, ISO/IEC 2022 (JIS) encoding which allows switching to
+    //  JIS x0208-1983 encoding. A valid filename in this set of encodings is
+    //  0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU]
+    //                                             ^^^^
+    //  Note that 0x2F is the ASCII slash character
+    //
+    //  **********************************************************************************
+
+    //  Supported source arguments: half-open iterator range, container, c-array,
+    //  and single pointer to null terminated string.
+
+    //  All source arguments except pointers to null terminated byte strings support
+    //  multi-byte character strings which may have embedded nulls. Embedded null
+    //  support is required for some Asian languages on Windows.
+
+    //  [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used
+    //  because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults
+    //  correctly in templates.
+
+    //  -----  constructors  -----
+
+    path(){}                                          
+
+    path(const path& p) : m_pathname(p.m_pathname) {}
+
+    template 
+    path(Source const& source,
+      typename boost::enable_if::type> >::type* =0)
+    {
+      path_traits::dispatch(source, m_pathname, codecvt());
+    }
+
+    //  Overloads for the operating system API's native character type. Rationale:
+    //    - Avoids use of codecvt() for native value_type strings. This limits the
+    //      impact of locale("") initialization failures on POSIX systems to programs
+    //      that actually depend on locale(""). It further ensures that exceptions thrown
+    //      as a result of such failues occur after main() has started, so can be caught.
+    //      This is a partial resolution of tickets 4688, 5100, and 5289.
+    //    - A slight optimization for a common use case, particularly on POSIX since
+    //      value_type is char and that is the most common useage.
+    path(const value_type* s) : m_pathname(s) {}
+    path(const std::basic_string& s) : m_pathname(s) {}
+
+    template 
+    path(Source const& source, const codecvt_type& cvt)
+    //  see [defaults] note above explaining why codecvt() default arguments are not used
+    {
+      path_traits::dispatch(source, m_pathname, cvt);
+    }
+
+    template 
+    path(InputIterator begin, InputIterator end)
+    { 
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt());
+      }
+    }
+
+    template 
+    path(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      }
+    }
+
+    //  -----  assignments  -----
+
+    path& operator=(const path& p)
+    {
+      m_pathname = p.m_pathname;
+      return *this;
+    }
+
+    path& operator=(const value_type* ptr)  // required in case ptr overlaps *this
+    {
+      m_pathname = ptr;
+      return *this;
+    }
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator=(Source const& source)
+    {
+      m_pathname.clear();
+      path_traits::dispatch(source, m_pathname, codecvt());
+      return *this;
+    }
+
+    path& assign(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
+    {
+      m_pathname = ptr;
+      return *this;
+    }
+
+    template 
+    path& assign(Source const& source, const codecvt_type& cvt)
+    {
+      m_pathname.clear();
+      path_traits::dispatch(source, m_pathname, cvt);
+      return *this;
+    }
+
+    template 
+    path& assign(InputIterator begin, InputIterator end)
+    {
+      return assign(begin, end, codecvt());
+    }
+
+    template 
+    path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      m_pathname.clear();
+      if (begin != end)
+      {
+        std::basic_string::value_type>
+          s(begin, end);
+        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      }
+      return *this;
+    }
+
+    //  -----  concatenation  -----
+
+    path& operator+=(const path& p)         {m_pathname += p.m_pathname; return *this;}
+    path& operator+=(const string_type& s)  {m_pathname += s; return *this;}
+    path& operator+=(const value_type* ptr) {m_pathname += ptr; return *this;}
+    path& operator+=(value_type c)          {m_pathname += c; return *this;}
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator+=(Source const& source)
+    {
+      return concat(source, codecvt());
+    }
+
+    template 
+      typename boost::enable_if, path&>::type
+    operator+=(CharT c)
+    {
+      CharT tmp[2];
+      tmp[0] = c;
+      tmp[1] = 0;
+      return concat(tmp, codecvt());
+    }
+
+    template 
+    path& concat(Source const& source, const codecvt_type& cvt)
+    {
+      path_traits::dispatch(source, m_pathname, cvt);
+      return *this;
+    }
+
+    template 
+    path& concat(InputIterator begin, InputIterator end)
+    { 
+      return concat(begin, end, codecvt());
+    }
+
+    template 
+    path& concat(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+    { 
+      if (begin == end)
+        return *this;
+      std::basic_string::value_type>
+        s(begin, end);
+      path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+      return *this;
+    }
+
+    //  -----  appends  -----
+
+    //  if a separator is added, it is the preferred separator for the platform;
+    //  slash for POSIX, backslash for Windows
+
+    path& operator/=(const path& p);
+
+    path& operator/=(const value_type* ptr);
+
+    template 
+      typename boost::enable_if::type>, path&>::type
+    operator/=(Source const& source)
+    {
+      return append(source, codecvt());
+    }
+
+    path& append(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
+    {
+      this->operator/=(ptr);
+      return *this;
+    }
+
+    template 
+    path& append(Source const& source, const codecvt_type& cvt);
+
+    template 
+    path& append(InputIterator begin, InputIterator end)
+    { 
+      return append(begin, end, codecvt());
+    }
+
+    template 
+    path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
+
+    //  -----  modifiers  -----
+
+    void   clear()             { m_pathname.clear(); }
+    path&  make_preferred()
+#   ifdef BOOST_POSIX_API
+      { return *this; }  // POSIX no effect
+#   else // BOOST_WINDOWS_API
+      ;  // change slashes to backslashes
+#   endif
+    path&  remove_filename();
+    path&  replace_extension(const path& new_extension = path());
+    void   swap(path& rhs)     { m_pathname.swap(rhs.m_pathname); }
+
+    //  -----  observers  -----
+  
+    //  For operating systems that format file paths differently than directory
+    //  paths, return values from observers are formatted as file names unless there
+    //  is a trailing separator, in which case returns are formatted as directory
+    //  paths. POSIX and Windows make no such distinction.
+
+    //  Implementations are permitted to return const values or const references.
+
+    //  The string or path returned by an observer are specified as being formatted
+    //  as "native" or "generic".
+    //
+    //  For POSIX, these are all the same format; slashes and backslashes are as input and
+    //  are not modified.
+    //
+    //  For Windows,   native:    as input; slashes and backslashes are not modified;
+    //                            this is the format of the internally stored string.
+    //                 generic:   backslashes are converted to slashes
+
+    //  -----  native format observers  -----
+
+    const string_type&  native() const { return m_pathname; }          // Throws: nothing
+    const value_type*   c_str() const  { return m_pathname.c_str(); }  // Throws: nothing
+
+    template 
+    String string() const;
+
+    template 
+    String string(const codecvt_type& cvt) const;
+
+#   ifdef BOOST_WINDOWS_API
+    const std::string string() const { return string(codecvt()); } 
+    const std::string string(const codecvt_type& cvt) const
+    { 
+      std::string tmp;
+      if (!m_pathname.empty())
+        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
+          tmp, cvt);
+      return tmp;
+    }
+    
+    //  string_type is std::wstring, so there is no conversion
+    const std::wstring&  wstring() const { return m_pathname; }
+    const std::wstring&  wstring(const codecvt_type&) const { return m_pathname; }
+
+#   else   // BOOST_POSIX_API
+    //  string_type is std::string, so there is no conversion
+    const std::string&  string() const { return m_pathname; }
+    const std::string&  string(const codecvt_type&) const { return m_pathname; }
+
+    const std::wstring  wstring() const { return wstring(codecvt()); }
+    const std::wstring  wstring(const codecvt_type& cvt) const
+    { 
+      std::wstring tmp;
+      if (!m_pathname.empty())
+        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
+          tmp, cvt);
+      return tmp;
+    }
+
+#   endif
+
+    //  -----  generic format observers  -----
+
+    template 
+    String generic_string() const;
+
+    template 
+    String generic_string(const codecvt_type& cvt) const;
+
+#   ifdef BOOST_WINDOWS_API
+    const std::string   generic_string() const { return generic_string(codecvt()); } 
+    const std::string   generic_string(const codecvt_type& cvt) const; 
+    const std::wstring  generic_wstring() const;
+    const std::wstring  generic_wstring(const codecvt_type&) const { return generic_wstring(); };
+
+#   else // BOOST_POSIX_API
+    //  On POSIX-like systems, the generic format is the same as the native format
+    const std::string&  generic_string() const  { return m_pathname; }
+    const std::string&  generic_string(const codecvt_type&) const  { return m_pathname; }
+    const std::wstring  generic_wstring() const { return wstring(codecvt()); }
+    const std::wstring  generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); }
+
+#   endif
+
+    //  -----  compare  -----
+
+    int compare(const path& p) const BOOST_NOEXCEPT;  // generic, lexicographical
+    int compare(const std::string& s) const { return compare(path(s)); }
+    int compare(const value_type* s) const  { return compare(path(s)); }
+
+    //  -----  decomposition  -----
+
+    path  root_path() const; 
+    path  root_name() const;         // returns 0 or 1 element path
+                                     // even on POSIX, root_name() is non-empty() for network paths
+    path  root_directory() const;    // returns 0 or 1 element path
+    path  relative_path() const;
+    path  parent_path() const;
+    path  filename() const;          // returns 0 or 1 element path
+    path  stem() const;              // returns 0 or 1 element path
+    path  extension() const;         // returns 0 or 1 element path
+
+    //  -----  query  -----
+
+    bool empty() const               { return m_pathname.empty(); } // name consistent with std containers
+    bool has_root_path() const       { return has_root_directory() || has_root_name(); }
+    bool has_root_name() const       { return !root_name().empty(); }
+    bool has_root_directory() const  { return !root_directory().empty(); }
+    bool has_relative_path() const   { return !relative_path().empty(); }
+    bool has_parent_path() const     { return !parent_path().empty(); }
+    bool has_filename() const        { return !m_pathname.empty(); }
+    bool has_stem() const            { return !stem().empty(); }
+    bool has_extension() const       { return !extension().empty(); }
+    bool is_absolute() const
+    {
+#     ifdef BOOST_WINDOWS_API
+      return has_root_name() && has_root_directory();
+#     else
+      return has_root_directory();
+#     endif
+    }
+    bool is_relative() const         { return !is_absolute(); } 
+
+    //  -----  iterators  -----
+
+    class iterator;
+    typedef iterator const_iterator;
+
+    iterator begin() const;
+    iterator end() const;
+
+    //  -----  static member functions  -----
+
+    static std::locale  imbue(const std::locale& loc);
+    static const        codecvt_type& codecvt();
+
+    //  -----  deprecated functions  -----
+
+# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+#   error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
 # endif
 
-#if BOOST_FILESYSTEM_VERSION == 2
-#  include 
-
-# else
-#  include 
-
+# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+    //  recently deprecated functions supplied by default
+    path&  normalize()              { return m_normalize(); }
+    path&  remove_leaf()            { return remove_filename(); }
+    path   leaf() const             { return filename(); }
+    path   branch_path() const      { return parent_path(); }
+    bool   has_leaf() const         { return !m_pathname.empty(); }
+    bool   has_branch_path() const  { return !parent_path().empty(); }
+    bool   is_complete() const      { return is_absolute(); }
 # endif
 
-#endif  // BOOST_FILESYSTEM_PATHX_HPP 
+# if defined(BOOST_FILESYSTEM_DEPRECATED)
+    //  deprecated functions with enough signature or semantic changes that they are
+    //  not supplied by default 
+    const std::string file_string() const               { return string(); }
+    const std::string directory_string() const          { return string(); }
+    const std::string native_file_string() const        { return string(); }
+    const std::string native_directory_string() const   { return string(); }
+    const string_type external_file_string() const      { return native(); }
+    const string_type external_directory_string() const { return native(); }
+
+    //  older functions no longer supported
+    //typedef bool (*name_check)(const std::string & name);
+    //basic_path(const string_type& str, name_check) { operator/=(str); }
+    //basic_path(const typename string_type::value_type* s, name_check)
+    //  { operator/=(s);}
+    //static bool default_name_check_writable() { return false; } 
+    //static void default_name_check(name_check) {}
+    //static name_check default_name_check() { return 0; }
+    //basic_path& canonize();
+# endif
+
+//--------------------------------------------------------------------------------------//
+//                            class path private members                                //
+//--------------------------------------------------------------------------------------//
+
+  private:
+#   if defined(_MSC_VER)
+#     pragma warning(push) // Save warning settings
+#     pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
+#   endif                            // needs to have dll-interface...
+/*
+      m_pathname has the type, encoding, and format required by the native
+      operating system. Thus for POSIX and Windows there is no conversion for
+      passing m_pathname.c_str() to the O/S API or when obtaining a path from the
+      O/S API. POSIX encoding is unspecified other than for dot and slash
+      characters; POSIX just treats paths as a sequence of bytes. Windows
+      encoding is UCS-2 or UTF-16 depending on the version.
+*/
+    string_type  m_pathname;  // Windows: as input; backslashes NOT converted to slashes,
+                              // slashes NOT converted to backslashes
+#   if defined(_MSC_VER)
+#     pragma warning(pop) // restore warning settings.
+#   endif 
+
+    string_type::size_type m_append_separator_if_needed();
+    //  Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0.
+    //  Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
+
+    void m_erase_redundant_separator(string_type::size_type sep_pos);
+    string_type::size_type m_parent_path_end() const;
+
+    path& m_normalize();
+
+    // Was qualified; como433beta8 reports:
+    //    warning #427-D: qualified name is not allowed in member declaration 
+    friend class iterator;
+    friend bool operator<(const path& lhs, const path& rhs);
+
+    // see path::iterator::increment/decrement comment below
+    static void m_path_iterator_increment(path::iterator & it);
+    static void m_path_iterator_decrement(path::iterator & it);
+
+  };  // class path
+
+  namespace detail
+  {
+    BOOST_FILESYSTEM_DECL
+      int lex_compare(path::iterator first1, path::iterator last1,
+        path::iterator first2, path::iterator last2);
+  }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+  typedef path wpath;
+# endif
+
+  //------------------------------------------------------------------------------------//
+  //                             class path::iterator                                   //
+  //------------------------------------------------------------------------------------//
+ 
+  class path::iterator
+    : public boost::iterator_facade<
+      path::iterator,
+      path const,
+      boost::bidirectional_traversal_tag >
+  {
+  private:
+    friend class boost::iterator_core_access;
+    friend class boost::filesystem::path;
+    friend void m_path_iterator_increment(path::iterator & it);
+    friend void m_path_iterator_decrement(path::iterator & it);
+
+    const path& dereference() const { return m_element; }
+
+    bool equal(const iterator & rhs) const
+    {
+      return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos;
+    }
+
+    // iterator_facade derived classes don't seem to like implementations in
+    // separate translation unit dll's, so forward to class path static members
+    void increment() { m_path_iterator_increment(*this); }
+    void decrement() { m_path_iterator_decrement(*this); }
+
+    path                    m_element;   // current element
+    const path*             m_path_ptr;  // path being iterated over
+    string_type::size_type  m_pos;       // position of m_element in
+                                         // m_path_ptr->m_pathname.
+                                         // if m_element is implicit dot, m_pos is the
+                                         // position of the last separator in the path.
+                                         // end() iterator is indicated by 
+                                         // m_pos == m_path_ptr->m_pathname.size()
+  }; // path::iterator
+
+  //------------------------------------------------------------------------------------//
+  //                                                                                    //
+  //                              non-member functions                                  //
+  //                                                                                    //
+  //------------------------------------------------------------------------------------//
+
+  //  std::lexicographical_compare would infinately recurse because path iterators
+  //  yield paths, so provide a path aware version
+  inline bool lexicographical_compare(path::iterator first1, path::iterator last1,
+    path::iterator first2, path::iterator last2)
+    { return detail::lex_compare(first1, last1, first2, last2) < 0; }
+  
+  inline bool operator==(const path& lhs, const path& rhs)              {return lhs.compare(rhs) == 0;}
+  inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;} 
+  inline bool operator==(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) == 0;}
+  inline bool operator==(const path& lhs, const path::value_type* rhs)  {return lhs.compare(rhs) == 0;}
+  inline bool operator==(const path::value_type* lhs, const path& rhs)  {return rhs.compare(lhs) == 0;}
+  
+  inline bool operator!=(const path& lhs, const path& rhs)              {return lhs.compare(rhs) != 0;}
+  inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;} 
+  inline bool operator!=(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) != 0;}
+  inline bool operator!=(const path& lhs, const path::value_type* rhs)  {return lhs.compare(rhs) != 0;}
+  inline bool operator!=(const path::value_type* lhs, const path& rhs)  {return rhs.compare(lhs) != 0;}
+
+  // TODO: why do == and != have additional overloads, but the others don't?
+
+  inline bool operator<(const path& lhs, const path& rhs)  {return lhs.compare(rhs) < 0;}
+  inline bool operator<=(const path& lhs, const path& rhs) {return !(rhs < lhs);}
+  inline bool operator> (const path& lhs, const path& rhs) {return rhs < lhs;}
+  inline bool operator>=(const path& lhs, const path& rhs) {return !(lhs < rhs);}
+
+  inline std::size_t hash_value(const path& x)
+  {
+# ifdef BOOST_WINDOWS_API
+    std::size_t seed = 0;
+    for(const path::value_type* it = x.c_str(); *it; ++it)
+      hash_combine(seed, *it == '/' ? L'\\' : *it);
+    return seed;
+# else   // BOOST_POSIX_API
+    return hash_range(x.native().begin(), x.native().end());
+# endif
+  }
+
+  inline void swap(path& lhs, path& rhs)                   { lhs.swap(rhs); }
+
+  inline path operator/(const path& lhs, const path& rhs)  { return path(lhs) /= rhs; }
+
+  //  inserters and extractors
+  //    use boost::io::quoted() to handle spaces in paths
+  //    use '&' as escape character to ease use for Windows paths
+
+  template 
+  inline std::basic_ostream&
+  operator<<(std::basic_ostream& os, const path& p)
+  {
+    return os
+      << boost::io::quoted(p.template string >(), static_cast('&'));
+  }
+  
+  template 
+  inline std::basic_istream&
+  operator>>(std::basic_istream& is, path& p)
+  {
+    std::basic_string str;
+    is >> boost::io::quoted(str, static_cast('&'));
+    p = str;
+    return is;
+  }
+  
+  //  name_checks
+
+  //  These functions are holdovers from version 1. It isn't clear they have much
+  //  usefulness, or how to generalize them for later versions.
+
+  BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
+  BOOST_FILESYSTEM_DECL bool native(const std::string & name);
+ 
+//--------------------------------------------------------------------------------------//
+//                     class path member template implementation                        //
+//--------------------------------------------------------------------------------------//
+
+  template 
+  path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt)
+  { 
+    if (begin == end)
+      return *this;
+    string_type::size_type sep_pos(m_append_separator_if_needed());
+    std::basic_string::value_type>
+      s(begin, end);
+    path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
+    if (sep_pos)
+      m_erase_redundant_separator(sep_pos);
+    return *this;
+  }
+
+  template 
+  path& path::append(Source const& source, const codecvt_type& cvt)
+  {
+    if (path_traits::empty(source))
+      return *this;
+    string_type::size_type sep_pos(m_append_separator_if_needed());
+    path_traits::dispatch(source, m_pathname, cvt);
+    if (sep_pos)
+      m_erase_redundant_separator(sep_pos);
+    return *this;
+  }
+
+//--------------------------------------------------------------------------------------//
+//                     class path member template specializations                       //
+//--------------------------------------------------------------------------------------//
+
+  template <> inline
+  std::string path::string() const
+    { return string(); }
+
+  template <> inline
+  std::wstring path::string() const
+    { return wstring(); }
+
+  template <> inline
+  std::string path::string(const codecvt_type& cvt) const
+    { return string(cvt); }
+
+  template <> inline
+  std::wstring path::string(const codecvt_type& cvt) const
+    { return wstring(cvt); }
+
+  template <> inline
+  std::string path::generic_string() const
+    { return generic_string(); }
+
+  template <> inline
+  std::wstring path::generic_string() const
+    { return generic_wstring(); }
+
+  template <> inline
+  std::string path::generic_string(const codecvt_type& cvt) const
+    { return generic_string(cvt); }
+
+  template <> inline
+  std::wstring path::generic_string(const codecvt_type& cvt) const
+    { return generic_wstring(cvt); }
+
+
+}  // namespace filesystem
+}  // namespace boost
+
+//----------------------------------------------------------------------------//
+
+#include  // pops abi_prefix.hpp pragmas
+
+#endif  // BOOST_FILESYSTEM_PATH_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/path_traits.hpp b/project/jni/boost/include/boost/filesystem/path_traits.hpp
similarity index 95%
rename from project/jni/boost/include/boost/filesystem/v3/path_traits.hpp
rename to project/jni/boost/include/boost/filesystem/path_traits.hpp
index 13f1b2095..a6a250557 100644
--- a/project/jni/boost/include/boost/filesystem/v3/path_traits.hpp
+++ b/project/jni/boost/include/boost/filesystem/path_traits.hpp
@@ -16,7 +16,7 @@
 #   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
 # endif
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,7 +32,7 @@
 
 #include  // must be the last #include
 
-namespace boost { namespace filesystem3 {
+namespace boost { namespace filesystem {
 
   BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category();
   //  uses std::codecvt_base::result used for error codes:
@@ -85,8 +85,8 @@ namespace path_traits {
   }
 
   template  inline
-     bool empty(T (&)[N])
-       { return N <= 1; }
+     bool empty(T (&x)[N])
+       { return !x[0]; }
 
   // value types differ  ---------------------------------------------------------------//
   //
@@ -230,18 +230,6 @@ namespace path_traits {
 
 }}} // namespace boost::filesystem::path_traits
 
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::codecvt_error_category;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
 #include  // pops abi_prefix.hpp pragmas
 
 #endif  // BOOST_FILESYSTEM_PATH_TRAITS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/config.hpp b/project/jni/boost/include/boost/filesystem/v2/config.hpp
deleted file mode 100644
index 7116de5c5..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/config.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//  boost/filesystem/v2/config.hpp  ------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying
-//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_CONFIG_HPP
-#define BOOST_FILESYSTEM2_CONFIG_HPP
-
-# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 2
-#   error Compiling Filesystem version 2 file with BOOST_FILESYSTEM_VERSION defined != 2
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 2
-# endif
-
-#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
-
-//  ability to change namespace aids path_table.cpp  ------------------------// 
-#ifndef BOOST_FILESYSTEM2_NAMESPACE
-# define BOOST_FILESYSTEM2_NAMESPACE filesystem2
-#endif
-
-#include 
-#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
-#include  
-
-//  BOOST_POSIX_PATH or BOOST_WINDOWS_PATH specify which path syntax to recognise
-
-# if defined(BOOST_WINDOWS_API) && defined(BOOST_POSIX_PATH)
-#   error builds with Windows API do not support BOOST_POSIX_PATH
-# endif
-
-# if !defined(_WIN32) && !defined(__CYGWIN__) && defined(BOOST_WINDOWS_PATH)
-#   error builds on non-Windows platforms do not support BOOST_WINDOWS_PATH
-# endif
-
-# if defined(BOOST_WINDOWS_PATH) && defined(BOOST_POSIX_PATH)
-#   error both BOOST_WINDOWS_PATH and BOOST_POSIX_PATH are defined
-# elif !defined(BOOST_WINDOWS_PATH) && !defined(BOOST_POSIX_PATH)
-#   if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__CYGWIN__))
-#     define BOOST_WINDOWS_PATH
-#   else
-#     define BOOST_POSIX_PATH
-#   endif
-# endif
-
-//  throw an exception  ----------------------------------------------------------------//
-//
-//  Exceptions were originally thrown via boost::throw_exception().
-//  As throw_exception() became more complex, it caused user error reporting
-//  to be harder to interpret, since the exception reported became much more complex.
-//  The immediate fix was to throw directly, wrapped in a macro to make any later change
-//  easier.
-
-#define BOOST_FILESYSTEM_THROW(EX) throw EX
-
-//  narrow support only for badly broken compilers or libraries  -------------//
-
-# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610)
-#   define BOOST_FILESYSTEM2_NARROW_ONLY
-# endif
-
-// This header implements separate compilation features as described in
-// http://www.boost.org/more/separate_compilation.html
-
-//  enable dynamic linking ---------------------------------------------------//
-
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-# if defined(BOOST_FILESYSTEM_SOURCE)
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
-# else 
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
-# endif
-#else
-# define BOOST_FILESYSTEM_DECL
-#endif
-
-//  enable automatic library variant selection  ------------------------------// 
-
-#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
-  && !defined(BOOST_FILESYSTEM_NO_LIB)
-//
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_filesystem
-//
-// If we're importing code from a dll, then tell auto_link.hpp about it:
-//
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-#  define BOOST_DYN_LINK
-#endif
-//
-// And include the header that does the work:
-//
-#include 
-#endif  // auto-linking disabled
-
-#endif // BOOST_FILESYSTEM2_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/convenience.hpp b/project/jni/boost/include/boost/filesystem/v2/convenience.hpp
deleted file mode 100644
index 30b6adee7..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/convenience.hpp
+++ /dev/null
@@ -1,339 +0,0 @@
-//  boost/filesystem/convenience.hpp  ----------------------------------------//
-
-//  Copyright Beman Dawes, 2002-2005
-//  Copyright Vladimir Prus, 2002
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP
-#define BOOST_FILESYSTEM2_CONVENIENCE_HPP
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) \
-      template typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_FS_FUNC_STRING BOOST_FS_FUNC(typename Path::string_type)
-#   define BOOST_FS_TYPENAME typename
-# else
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE 
-    typedef boost::filesystem::path Path;
-#   define BOOST_FS_FUNC_STRING inline std::string
-#   define BOOST_FS_TYPENAME
-# endif
-
-namespace boost
-{
-  namespace filesystem2
-  {
-
-    BOOST_FS_FUNC(bool) create_directories(const Path& ph)
-    {
-         if (ph.empty() || exists(ph))
-         {
-           if ( !ph.empty() && !is_directory(ph) )
-               boost::throw_exception( basic_filesystem_error(
-                 "boost::filesystem::create_directories", ph,
-                 make_error_code( boost::system::errc::file_exists ) ) );
-           return false;
-         }
-
-         // First create branch, by calling ourself recursively
-         create_directories(ph.parent_path());
-         // Now that parent's path exists, create the directory
-         create_directory(ph);
-         return true;
-     }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    BOOST_FS_FUNC_STRING extension(const Path& ph)
-    {
-      typedef BOOST_FS_TYPENAME Path::string_type string_type;
-      string_type filename = ph.filename();
-
-      BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
-      if (n != string_type::npos)
-        return filename.substr(n);
-      else
-        return string_type();
-    }
-
-    BOOST_FS_FUNC_STRING basename(const Path& ph)
-    {
-      typedef BOOST_FS_TYPENAME Path::string_type string_type;
-      string_type filename = ph.filename();
-      BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.');
-      return filename.substr(0, n);
-    }
-
-
-    BOOST_FS_FUNC(Path) change_extension( const Path & ph,
-      const BOOST_FS_TYPENAME Path::string_type & new_extension )
-    {
-#   if !defined(_STLPORT_VERSION)
-      return ph.parent_path() / (basename(ph) + new_extension); 
-#   else
-      typedef BOOST_FS_TYPENAME Path::string_type string_type; 
-      string_type filename = basename(ph) + new_extension; 
-      return ph.parent_path() / filename;
-#   endif
-    } 
-# endif
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    // "do-the-right-thing" overloads  ---------------------------------------//
-
-    inline bool create_directories(const path& ph)
-      { return create_directories(ph); }
-    inline bool create_directories(const wpath& ph)
-      { return create_directories(ph); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline std::string extension(const path& ph)
-      { return extension(ph); }
-    inline std::wstring extension(const wpath& ph)
-      { return extension(ph); }
-
-    inline std::string basename(const path& ph)
-      { return basename( ph ); }
-    inline std::wstring basename(const wpath& ph)
-      { return basename( ph ); }
-
-    inline path change_extension( const path & ph, const std::string& new_ex )
-      { return change_extension( ph, new_ex ); }
-    inline wpath change_extension( const wpath & ph, const std::wstring& new_ex )
-      { return change_extension( ph, new_ex ); }
-# endif
-
-# endif
-
-
-    //  basic_recursive_directory_iterator helpers  --------------------------//
-
-    namespace detail
-    {
-      template< class Path >
-      struct recur_dir_itr_imp
-      {
-        typedef basic_directory_iterator< Path > element_type;
-        std::stack< element_type, std::vector< element_type > > m_stack;
-        int  m_level;
-        bool m_no_push;
-        bool m_no_throw;
-
-        recur_dir_itr_imp() : m_level(0), m_no_push(false), m_no_throw(false) {}
-      };
-
-    } // namespace detail
-
-    //  basic_recursive_directory_iterator  ----------------------------------//
-
-    template< class Path >
-    class basic_recursive_directory_iterator
-      : public boost::iterator_facade<
-          basic_recursive_directory_iterator,
-          basic_directory_entry,
-          boost::single_pass_traversal_tag >
-    {
-    public:
-      typedef Path path_type;
-
-      basic_recursive_directory_iterator(){}  // creates the "end" iterator
-
-      explicit basic_recursive_directory_iterator( const Path & dir_path );
-      basic_recursive_directory_iterator( const Path & dir_path,
-        system::error_code & ec );
-
-      int level() const { return m_imp->m_level; }
-
-      void pop();
-      void no_push()
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to no_push() on end iterator" );
-        m_imp->m_no_push = true;
-      }
-
-      file_status status() const
-      {
-        BOOST_ASSERT( m_imp.get()
-          && "attempt to call status() on end recursive_iterator" );
-        return m_imp->m_stack.top()->status();
-      }
-
-      file_status symlink_status() const
-      {
-        BOOST_ASSERT( m_imp.get()
-          && "attempt to call symlink_status() on end recursive_iterator" );
-        return m_imp->m_stack.top()->symlink_status();
-      }
-
-    private:
-
-      // shared_ptr provides shallow-copy semantics required for InputIterators.
-      // m_imp.get()==0 indicates the end iterator.
-      boost::shared_ptr< detail::recur_dir_itr_imp< Path > >  m_imp;
-
-      friend class boost::iterator_core_access;
-
-      typename boost::iterator_facade< 
-        basic_recursive_directory_iterator,
-        basic_directory_entry,
-        boost::single_pass_traversal_tag >::reference
-      dereference() const 
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" );
-        return *m_imp->m_stack.top();
-      }
-
-      void increment();
-
-      bool equal( const basic_recursive_directory_iterator & rhs ) const
-        { return m_imp == rhs.m_imp; }
-
-    };
-
-    typedef basic_recursive_directory_iterator recursive_directory_iterator;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_recursive_directory_iterator wrecursive_directory_iterator;
-# endif
-
-    //  basic_recursive_directory_iterator implementation  -------------------//
-
-    //  constructors
-    template
-    basic_recursive_directory_iterator::
-      basic_recursive_directory_iterator( const Path & dir_path )
-      : m_imp( new detail::recur_dir_itr_imp )
-    {
-      m_imp->m_stack.push( basic_directory_iterator( dir_path ) );
-      if ( m_imp->m_stack.top () == basic_directory_iterator() )
-        { m_imp.reset (); }
-    }
-
-    template
-    basic_recursive_directory_iterator::
-      basic_recursive_directory_iterator( const Path & dir_path,
-        system::error_code & ec )
-      : m_imp( new detail::recur_dir_itr_imp )
-    {
-      m_imp->m_no_throw = true;
-      m_imp->m_stack.push( basic_directory_iterator( dir_path, ec ) );
-      if ( m_imp->m_stack.top () == basic_directory_iterator() )
-        { m_imp.reset (); }
-    }
-
-    //  increment
-    template
-    void basic_recursive_directory_iterator::increment()
-    {
-      BOOST_ASSERT( m_imp.get() && "increment on end iterator" );
-      
-      static const basic_directory_iterator end_itr;
-
-      if ( m_imp->m_no_push )
-        { m_imp->m_no_push = false; }
-      else if ( is_directory( m_imp->m_stack.top()->status() ) )
-      {
-        system::error_code ec;
-#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
-        if( m_imp->m_no_throw ) {
-            m_imp->m_stack.push(
-                basic_directory_iterator( *m_imp->m_stack.top(), ec )
-            );
-        }
-        else {
-            m_imp->m_stack.push(
-                basic_directory_iterator( *m_imp->m_stack.top() )
-            );
-        }
-#else
-        m_imp->m_stack.push(
-          m_imp->m_no_throw
-            ? basic_directory_iterator( *m_imp->m_stack.top(), ec )
-            : basic_directory_iterator( *m_imp->m_stack.top() ) );
-#endif
-        if ( m_imp->m_stack.top() != end_itr )
-        {
-          ++m_imp->m_level;
-          return;
-        }
-        m_imp->m_stack.pop();
-      }
-
-      while ( !m_imp->m_stack.empty()
-        && ++m_imp->m_stack.top() == end_itr )
-      {
-        m_imp->m_stack.pop();
-        --m_imp->m_level;
-      }
-
-      if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator
-    }
-
-    //  pop
-    template
-    void basic_recursive_directory_iterator::pop()
-    {
-      BOOST_ASSERT( m_imp.get() && "pop on end iterator" );
-      BOOST_ASSERT( m_imp->m_level > 0 && "pop with level < 1" );
-
-      static const basic_directory_iterator end_itr;
-
-      do
-      {
-        m_imp->m_stack.pop();
-        --m_imp->m_level;
-      }
-      while ( !m_imp->m_stack.empty()
-        && ++m_imp->m_stack.top() == end_itr );
-
-      if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator
-    }
-
-  } // namespace filesystem2
-} // namespace boost
-
-#undef BOOST_FS_FUNC_STRING
-#undef BOOST_FS_FUNC
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::create_directories;
-    using filesystem2::basic_recursive_directory_iterator;
-    using filesystem2::recursive_directory_iterator;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem2::extension;
-    using filesystem2::basename;
-    using filesystem2::change_extension;
-# endif
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wrecursive_directory_iterator;
-# endif
-
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM2_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/exception.hpp b/project/jni/boost/include/boost/filesystem/v2/exception.hpp
deleted file mode 100644
index edea663b1..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/exception.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-//  boost/filesystem/exception.hpp  -------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  This header is no long used. The contents have been moved to path.hpp.
-//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/v2/fstream.hpp b/project/jni/boost/include/boost/filesystem/v2/fstream.hpp
deleted file mode 100644
index 887d59d3a..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/fstream.hpp
+++ /dev/null
@@ -1,613 +0,0 @@
-//  boost/filesystem/fstream.hpp  --------------------------------------------//
-
-//  Copyright Beman Dawes 2002.
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP
-#define BOOST_FILESYSTEM2_FSTREAM_HPP
-
-#include 
-#include  // for 8.3 hack (see below)
-#include 
-#include 
-
-#include 
-#include 
-
-#include  // must be the last #include
-
-// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for
-// various compiler problems. They have been removed to ease development of the
-// basic i18n functionality. Once the new interface is stable, the workarounds
-// will be reinstated for any compilers that otherwise can support the rest of
-// the library after internationalization.
-
-namespace boost
-{
-  namespace filesystem2
-  {
-    namespace detail
-    {
-#   if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-#     if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405
-      // The 8.3 hack:
-      // C++98 does not supply a wchar_t open, so try to get an equivalent
-      // narrow char name based on the short, so-called 8.3, name.
-      // Not needed for Dinkumware 405 and later as they do supply wchar_t open.
-      BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph,
-        std::ios_base::openmode mode ); // true if succeeds
-      BOOST_FILESYSTEM_DECL std::string narrow_path_api(
-        const std::wstring & ph ); // return is empty if fails
-
-      inline std::string path_proxy( const std::wstring & file_ph,
-        std::ios_base::openmode mode )
-      // Return a non-existant path if cannot supply narrow short path.
-      // An empty path doesn't work because some Dinkumware versions
-      // assert the path is non-empty.  
-      {
-        std::string narrow_ph;
-        bool created_file( false );
-        if ( !exists( file_ph )
-          && (mode & std::ios_base::out) != 0
-          && create_file_api( file_ph, mode ) )
-        {
-          created_file = true;
-        }
-        narrow_ph = narrow_path_api( file_ph );
-        if ( narrow_ph.empty() )
-        {
-          if ( created_file ) remove_api( file_ph );
-          narrow_ph = "\x01";
-        }
-        return narrow_ph;
-      }
-#     else
-      // Dinkumware 405 and later does supply wchar_t functions
-      inline const std::wstring & path_proxy( const std::wstring & file_ph,
-        std::ios_base::openmode )
-        { return file_ph; }
-#     endif
-#   endif 
-
-      inline const std::string & path_proxy( const std::string & file_ph,
-        std::ios_base::openmode )
-        { return file_ph; }
-
-    } // namespace detail
-
-    template < class charT, class traits = std::char_traits >
-    class basic_filebuf : public std::basic_filebuf
-    {
-    private: // disallow copying
-      basic_filebuf( const basic_filebuf & );
-      const basic_filebuf & operator=( const basic_filebuf & ); 
-    public:
-      basic_filebuf() {}
-      virtual ~basic_filebuf() {}
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-      template
-      typename boost::enable_if,
-        basic_filebuf *>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-
-      basic_filebuf *
-      open( const wpath & file_ph, std::ios_base::openmode mode );
-#   endif
-
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      basic_filebuf *
-      open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_ifstream : public std::basic_ifstream
-    {
-    private: // disallow copying
-      basic_ifstream( const basic_ifstream & );
-      const basic_ifstream & operator=( const basic_ifstream & ); 
-    public:
-      basic_ifstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-      template
-      explicit basic_ifstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-
-      template
-      basic_ifstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-
-      explicit basic_ifstream( const wpath & file_ph );
-      basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-#   endif
-
-      explicit basic_ifstream( const path & file_ph );
-      basic_ifstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_ifstream() {}
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_ofstream : public std::basic_ofstream
-    {
-    private: // disallow copying
-      basic_ofstream( const basic_ofstream & );
-      const basic_ofstream & operator=( const basic_ofstream & ); 
-    public:
-      basic_ofstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-      template
-      explicit basic_ofstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-      explicit basic_ofstream( const wpath & file_ph );
-
-      template
-      basic_ofstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-      basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-      void open( const wpath & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-
-#   endif
-
-      explicit basic_ofstream( const path & file_ph );
-      basic_ofstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_ofstream() {}
-    };
-
-    template < class charT, class traits = std::char_traits >
-    class basic_fstream : public std::basic_fstream
-    {
-    private: // disallow copying
-      basic_fstream( const basic_fstream & );
-      const basic_fstream & operator=( const basic_fstream & ); 
-    public:
-      basic_fstream() {}
-
-      // use two signatures, rather than one signature with default second
-      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-      template
-      explicit basic_fstream( const Path & file_ph,
-        typename boost::enable_if >::type* dummy = 0 );
-      explicit basic_fstream( const wpath & file_ph );
-
-      template
-      basic_fstream( const Path & file_ph, std::ios_base::openmode mode,
-        typename boost::enable_if >::type* dummy = 0 );
-      basic_fstream( const wpath & file_ph, std::ios_base::openmode mode );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph );
-      void open( const wpath & file_ph );
-
-      template
-      typename boost::enable_if, void>::type
-      open( const Path & file_ph, std::ios_base::openmode mode );
-      void open( const wpath & file_ph, std::ios_base::openmode mode );
-
-#   endif
-
-      explicit basic_fstream( const path & file_ph );
-      basic_fstream( const path & file_ph, std::ios_base::openmode mode );
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-      void open( const path & file_ph );
-      void open( const path & file_ph, std::ios_base::openmode mode );
-#   endif
-      virtual ~basic_fstream() {}
-
-    };
- 
-    typedef basic_filebuf filebuf;
-    typedef basic_ifstream ifstream;
-    typedef basic_ofstream ofstream;
-    typedef basic_fstream fstream;
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_filebuf wfilebuf;
-    typedef basic_ifstream wifstream;
-    typedef basic_fstream wfstream;
-    typedef basic_ofstream wofstream;
-# endif
-    
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-//  basic_filebuf definitions  -----------------------------------------------//
-
-    template 
-    template
-    typename boost::enable_if,
-      basic_filebuf *>::type
-    basic_filebuf::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return (std::basic_filebuf::open( detail::path_proxy(
-        file_ph.external_file_string(), mode ).c_str(), mode )
-          == 0) ? 0 : this;
-    }
-
-    template 
-    basic_filebuf *
-    basic_filebuf::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return this->BOOST_NESTED_TEMPLATE open( file_ph, mode );
-    }
-
-//  basic_ifstream definitions  ----------------------------------------------//
-
-    template  template
-    basic_ifstream::basic_ifstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const wpath & file_ph )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in ) {}
-    
-    template  template
-    basic_ifstream::basic_ifstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ifstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ifstream::open( const Path & file_ph )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in );
-    }
-
-    template 
-    void basic_ifstream::open( const wpath & file_ph )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in ).c_str(), std::ios_base::in );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ifstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-    
-    template 
-    void basic_ifstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-//  basic_ofstream definitions  ----------------------------------------------//
-
-    template  template
-    basic_ofstream::basic_ofstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const wpath & file_ph )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out ) {}
-
-    template  template
-    basic_ofstream::basic_ofstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ofstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ofstream::open( const Path & file_ph )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out );
-    }
-    
-    template 
-    void basic_ofstream::open( const wpath & file_ph )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::out ).c_str(), std::ios_base::out );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_ofstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-    template 
-    void basic_ofstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-//  basic_fstream definitions  -----------------------------------------------//
-
-    template  template
-    basic_fstream::basic_fstream(const Path & file_ph,
-      typename boost::enable_if >::type* )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-    template 
-    basic_fstream::basic_fstream( const wpath & file_ph )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-    template  template
-    basic_fstream::basic_fstream( const Path & file_ph,
-      std::ios_base::openmode mode,
-      typename boost::enable_if >::type* )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-    
-    template 
-    basic_fstream::basic_fstream( const wpath & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_fstream(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode ) {}
-      
-    template  template
-    typename boost::enable_if, void>::type
-    basic_fstream::open( const Path & file_ph )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out );
-    }
-
-    template 
-    void basic_fstream::open( const wpath & file_ph )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          std::ios_base::in|std::ios_base::out ).c_str(),
-          std::ios_base::in|std::ios_base::out );
-    }
-    
-    template  template
-    typename boost::enable_if, void>::type
-    basic_fstream::open( const Path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-    template 
-    void basic_fstream::open( const wpath & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        detail::path_proxy( file_ph.external_file_string(),
-          mode ).c_str(), mode );
-    }
-
-# endif
-
-#  if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    basic_filebuf *
-    basic_filebuf::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      return std::basic_filebuf::open(
-        file_ph.file_string().c_str(), mode ) == 0 ? 0 : this;
-    }
-#  endif
-
-    template 
-    basic_ifstream::basic_ifstream( const path & file_ph )
-      : std::basic_ifstream(
-          file_ph.file_string().c_str(), std::ios_base::in ) {}
-
-    template 
-    basic_ifstream::basic_ifstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ifstream(
-          file_ph.file_string().c_str(), mode ) {}
-    
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_ifstream::open( const path & file_ph )
-    {
-      std::basic_ifstream::open(
-        file_ph.file_string().c_str(), std::ios_base::in );
-    }
-    
-    template 
-    void basic_ifstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ifstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-
-    template 
-    basic_ofstream::basic_ofstream( const path & file_ph )
-      : std::basic_ofstream(
-          file_ph.file_string().c_str(), std::ios_base::out ) {}
-
-    template 
-    basic_ofstream::basic_ofstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_ofstream(
-          file_ph.file_string().c_str(), mode ) {}
-    
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_ofstream::open( const path & file_ph )
-    {
-      std::basic_ofstream::open(
-        file_ph.file_string().c_str(), std::ios_base::out );
-    }
-    
-    template 
-    void basic_ofstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_ofstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-
-    template 
-    basic_fstream::basic_fstream( const path & file_ph )
-      : std::basic_fstream(
-          file_ph.file_string().c_str(),
-          std::ios_base::in|std::ios_base::out ) {}
-
-
-    template 
-    basic_fstream::basic_fstream( const path & file_ph,
-      std::ios_base::openmode mode )
-      : std::basic_fstream(
-          file_ph.file_string().c_str(), mode ) {}
-
-#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
-    template 
-    void basic_fstream::open( const path & file_ph )
-    {
-      std::basic_fstream::open(
-        file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out );
-    }
-
-    template 
-    void basic_fstream::open( const path & file_ph,
-      std::ios_base::openmode mode )
-    {
-      std::basic_fstream::open(
-        file_ph.file_string().c_str(), mode );
-    }
-#   endif
-  } // namespace filesystem2
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wfilebuf;
-    using filesystem2::wifstream;
-    using filesystem2::wfstream;
-    using filesystem2::wofstream;
-# endif
-    using filesystem2::filebuf;
-    using filesystem2::ifstream;
-    using filesystem2::ofstream;
-    using filesystem2::fstream;
-    using filesystem2::basic_filebuf;
-    using filesystem2::basic_ifstream;
-    using filesystem2::basic_ofstream;
-    using filesystem2::basic_fstream;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif  // BOOST_FILESYSTEM2_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/operations.hpp b/project/jni/boost/include/boost/filesystem/v2/operations.hpp
deleted file mode 100644
index 57c406daa..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/operations.hpp
+++ /dev/null
@@ -1,1245 +0,0 @@
-//  boost/filesystem/operations.hpp  -----------------------------------------//
-
-//  Copyright 2002-2005 Beman Dawes
-//  Copyright 2002 Jan Langer
-//  Copyright 2001 Dietmar Kuehl                                        
-//  
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying
-//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP
-#define BOOST_FILESYSTEM2_OPERATIONS_HPP
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for pair
-#include 
-
-#ifdef BOOST_WINDOWS_API
-#  include 
-#  if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0500
-#    define BOOST_FS_HARD_LINK // Default for Windows 2K or later 
-#  endif
-#endif
-
-#include  // must be the last #include
-
-# ifdef BOOST_NO_STDC_NAMESPACE
-    namespace std { using ::time_t; }
-# endif
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem2
-  {
-
-// typedef boost::filesystem::path Path; needs to be in namespace boost::filesystem
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) \
-      template typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \
-      template inline typename boost::enable_if, \
-      BOOST_FS_TYPE>::type
-#   define BOOST_FS_TYPENAME typename
-# else
-#   define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE
-#   define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE
-    typedef boost::filesystem2::path Path;
-#   define BOOST_FS_TYPENAME
-# endif
-
-    template class basic_directory_iterator;
-
-    // BOOST_FILESYSTEM2_NARROW_ONLY needs this:
-    typedef basic_directory_iterator directory_iterator;
-
-    template class basic_directory_entry;
-
-    enum file_type
-    { 
-      status_unknown,
-      file_not_found,
-      regular_file,
-      directory_file,
-      // the following will never be reported by some operating or file systems
-      symlink_file,
-      block_file,
-      character_file,
-      fifo_file,
-      socket_file,
-      type_unknown // file does exist, but isn't one of the above types or
-                   // we don't have strong enough permission to find its type
-    };
-
-    class file_status
-    {
-    public:
-      explicit file_status( file_type v = status_unknown ) : m_value(v) {}
-
-      void type( file_type v )  { m_value = v; }
-      file_type type() const    { return m_value; }
-
-    private:
-      // the internal representation is unspecified so that additional state
-      // information such as permissions can be added in the future; this
-      // implementation just uses status_type as the internal representation
-
-      file_type m_value;
-    };
-
-    inline bool status_known( file_status f ) { return f.type() != status_unknown; }
-    inline bool exists( file_status f )       { return f.type() != status_unknown && f.type() != file_not_found; }
-    inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
-    inline bool is_directory( file_status f ) { return f.type() == directory_file; }
-    inline bool is_symlink( file_status f )   { return f.type() == symlink_file; }
-    inline bool is_other( file_status f )     { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool is_regular( file_status f )   { return f.type() == regular_file; }
-# endif
-
-    struct space_info
-    {
-      // all values are byte counts
-      boost::uintmax_t capacity;
-      boost::uintmax_t free;      // <= capacity
-      boost::uintmax_t available; // <= free
-    };
-
-    namespace detail
-    {
-      typedef std::pair< system::error_code, bool >
-        query_pair;
-
-      typedef std::pair< system::error_code, boost::uintmax_t >
-        uintmax_pair;
-
-      typedef std::pair< system::error_code, std::time_t >
-        time_pair;
-
-      typedef std::pair< system::error_code, space_info >
-        space_pair;
-
-      template< class Path >
-      struct directory_pair
-      {
-        typedef std::pair< system::error_code,
-          typename Path::external_string_type > type;
-      };
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      BOOST_FILESYSTEM_DECL bool
-        symbolic_link_exists_api( const std::string & ); // deprecated
-#   endif
-
-      BOOST_FILESYSTEM_DECL file_status
-        status_api( const std::string & ph, system::error_code & ec );
-#   ifndef BOOST_WINDOWS_API
-      BOOST_FILESYSTEM_DECL file_status
-        symlink_status_api( const std::string & ph, system::error_code & ec );
-#   endif
-      BOOST_FILESYSTEM_DECL query_pair
-        is_empty_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        equivalent_api( const std::string & ph1, const std::string & ph2 );
-      BOOST_FILESYSTEM_DECL uintmax_pair
-        file_size_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL space_pair
-        space_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL time_pair 
-        last_write_time_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        last_write_time_api( const std::string & ph, std::time_t new_value );
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_current_path_api( std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        set_current_path_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        create_directory_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_hard_link_api( const std::string & to_ph,
-          const std::string & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_symlink_api( const std::string & to_ph,
-          const std::string & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        remove_api( const std::string & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        rename_api( const std::string & from, const std::string & to );
-      BOOST_FILESYSTEM_DECL system::error_code
-        copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists );
-
-#   if defined(BOOST_WINDOWS_API)
-      
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_full_path_name_api( const std::string & ph, std::string & target );
-
-#     if !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-
-      BOOST_FILESYSTEM_DECL  boost::filesystem2::file_status
-        status_api( const std::wstring & ph, system::error_code & ec );
-      BOOST_FILESYSTEM_DECL query_pair 
-        is_empty_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        equivalent_api( const std::wstring & ph1, const std::wstring & ph2 );
-      BOOST_FILESYSTEM_DECL uintmax_pair 
-        file_size_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL space_pair 
-        space_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        get_full_path_name_api( const std::wstring & ph, std::wstring & target );
-      BOOST_FILESYSTEM_DECL time_pair 
-        last_write_time_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        last_write_time_api( const std::wstring & ph, std::time_t new_value );
-      BOOST_FILESYSTEM_DECL system::error_code 
-        get_current_path_api( std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code 
-        set_current_path_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL query_pair
-        create_directory_api( const std::wstring & ph );
-# ifdef BOOST_FS_HARD_LINK
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_hard_link_api( const std::wstring & existing_ph,
-          const std::wstring & new_ph );
-# endif
-      BOOST_FILESYSTEM_DECL system::error_code
-        create_symlink_api( const std::wstring & to_ph,
-          const std::wstring & from_ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        remove_api( const std::wstring & ph );
-      BOOST_FILESYSTEM_DECL system::error_code
-        rename_api( const std::wstring & from, const std::wstring & to );
-      BOOST_FILESYSTEM_DECL system::error_code
-        copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists );
-
-#     endif
-#   endif
-
-      template
-      bool remove_aux( const Path & ph, file_status f );
-
-      template
-      unsigned long remove_all_aux( const Path & ph, file_status f );
-
-    } // namespace detail
-
-//  operations functions  ----------------------------------------------------//
-
-    //  The non-template overloads enable automatic conversion from std and
-    //  C-style strings. See basic_path constructors. The enable_if for the
-    //  templates implements the famous "do-the-right-thing" rule.
-
-//  query functions  ---------------------------------------------------------//
-
-    BOOST_INLINE_FS_FUNC(file_status)
-    status( const Path & ph, system::error_code & ec )
-      { return detail::status_api( ph.external_file_string(), ec ); }
-
-    BOOST_FS_FUNC(file_status)
-    status( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-        "boost::filesystem::status", ph, ec ) );
-      return result;
-    }
-
-    BOOST_INLINE_FS_FUNC(file_status)
-    symlink_status( const Path & ph, system::error_code & ec )
-#   ifdef BOOST_WINDOWS_API
-      { return detail::status_api( ph.external_file_string(), ec ); }
-#   else
-      { return detail::symlink_status_api( ph.external_file_string(), ec ); }
-#   endif
-
-    BOOST_FS_FUNC(file_status)
-    symlink_status( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( symlink_status( ph, ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-        "boost::filesystem::symlink_status", ph, ec ) );
-      return result;
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool symbolic_link_exists( const path & ph )
-      { return is_symlink( symlink_status(ph) ); }
-# endif
-
-    BOOST_FS_FUNC(bool) exists( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::exists", ph, ec ) );
-      return exists( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_directory( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_directory", ph, ec ) );
-      return is_directory( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_regular_file( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_regular_file", ph, ec ) );
-      return is_regular_file( result );
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    BOOST_FS_FUNC(bool) is_regular( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_regular", ph, ec ) );
-      return is_regular( result );
-    }
-# endif
-
-    BOOST_FS_FUNC(bool) is_other( const Path & ph )
-    { 
-      system::error_code ec;
-      file_status result( detail::status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_other", ph, ec ) );
-      return is_other( result );
-    }
-
-    BOOST_FS_FUNC(bool) is_symlink(
-#   ifdef BOOST_WINDOWS_API
-      const Path & )
-    {
-      return false;
-#   else
-      const Path & ph)
-    {
-      system::error_code ec;
-      file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_symlink", ph, ec ) );
-      return is_symlink( result );
-#   endif
-    }
-
-    // VC++ 7.0 and earlier has a serious namespace bug that causes a clash
-    // between boost::filesystem2::is_empty and the unrelated type trait
-    // boost::is_empty.
-
-# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300
-    BOOST_FS_FUNC(bool) is_empty( const Path & ph )
-# else
-    BOOST_FS_FUNC(bool) _is_empty( const Path & ph )
-# endif
-    {
-      detail::query_pair result(
-        detail::is_empty_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::is_empty", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(bool) equivalent( const Path & ph1, const Path & ph2 )
-    {
-      detail::query_pair result( detail::equivalent_api(
-        ph1.external_file_string(), ph2.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::equivalent", ph1, ph2, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(boost::uintmax_t) file_size( const Path & ph )
-    {
-      detail::uintmax_pair result
-        ( detail::file_size_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::file_size", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(space_info) space( const Path & ph )
-    {
-      detail::space_pair result
-        ( detail::space_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::space", ph, result.first ) );
-      return result.second;
-    }
-
-    BOOST_FS_FUNC(std::time_t) last_write_time( const Path & ph )
-    {
-      detail::time_pair result
-        ( detail::last_write_time_api( ph.external_file_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::last_write_time", ph, result.first ) );
-      return result.second;
-    }
-
-
-//  operations  --------------------------------------------------------------//
-
-    BOOST_FS_FUNC(bool) create_directory( const Path & dir_ph )
-    {
-      detail::query_pair result(
-        detail::create_directory_api( dir_ph.external_directory_string() ) );
-      if ( result.first )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_directory",
-          dir_ph, result.first ) );
-      return result.second;
-    }
-
-#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    BOOST_FS_FUNC(void)
-    create_hard_link( const Path & to_ph, const Path & from_ph )
-    {
-      system::error_code ec( 
-        detail::create_hard_link_api(
-          to_ph.external_file_string(),
-          from_ph.external_file_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_hard_link",
-          to_ph, from_ph, ec ) );
-    }
-
-    BOOST_FS_FUNC(system::error_code)
-    create_hard_link( const Path & to_ph, const Path & from_ph,
-      system::error_code & ec )
-    {
-      ec = detail::create_hard_link_api(
-            to_ph.external_file_string(),
-            from_ph.external_file_string() );
-      return ec;
-    }
-#endif
-
-    BOOST_FS_FUNC(void)
-    create_symlink( const Path & to_ph, const Path & from_ph )
-    {
-      system::error_code ec( 
-        detail::create_symlink_api(
-          to_ph.external_file_string(),
-          from_ph.external_file_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::create_symlink",
-          to_ph, from_ph, ec ) );
-    }
-
-    BOOST_FS_FUNC(system::error_code)
-    create_symlink( const Path & to_ph, const Path & from_ph,
-      system::error_code & ec )
-    {
-      ec = detail::create_symlink_api(
-             to_ph.external_file_string(),
-             from_ph.external_file_string() );
-      return ec;
-    }
-
-    BOOST_FS_FUNC(bool) remove( const Path & ph )
-    {
-      system::error_code ec;
-      file_status f = symlink_status( ph, ec );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::remove", ph, ec ) );
-      return detail::remove_aux( ph, f );
-    }
-
-    BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph )
-    {
-      system::error_code ec;
-      file_status f = symlink_status( ph, ec );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::remove_all", ph, ec ) );
-      return exists( f ) ? detail::remove_all_aux( ph, f ) : 0;
-    }
-
-    BOOST_FS_FUNC(void) rename( const Path & from_path, const Path & to_path )
-    {
-      system::error_code ec( detail::rename_api(
-        from_path.external_directory_string(),
-        to_path.external_directory_string() ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::rename",
-          from_path, to_path, ec ) );
-    }
-
-    BOOST_SCOPED_ENUM_START(copy_option)
-      { fail_if_exists, overwrite_if_exists };
-    BOOST_SCOPED_ENUM_END
-
-    BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path,
-      BOOST_SCOPED_ENUM(copy_option) option = copy_option::fail_if_exists )
-    {
-      system::error_code ec( detail::copy_file_api(
-        from_path.external_directory_string(),
-        to_path.external_directory_string(), option == copy_option::fail_if_exists ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::copy_file",
-          from_path, to_path, ec ) );
-    }
-
-    template< class Path >
-    Path current_path()
-    {
-      typename Path::external_string_type ph;
-      system::error_code ec( detail::get_current_path_api( ph ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::current_path", ec ) );
-      return Path( Path::traits_type::to_internal( ph ) );
-    }
-
-    BOOST_FS_FUNC(void) current_path( const Path & ph )
-    {
-      system::error_code ec( detail::set_current_path_api(
-        ph.external_directory_string() ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::current_path", ph, ec ) );
-    }
-
-    template< class Path >
-    const Path & initial_path()
-    {
-      static Path init_path;
-      if ( init_path.empty() ) init_path = current_path();
-      return init_path;
-    }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    // legacy support
-    inline path current_path()  // overload supports pre-i18n apps
-      { return current_path(); }
-    inline const path & initial_path() // overload supports pre-i18n apps
-      { return initial_path(); }
-# endif
-
-    BOOST_FS_FUNC(Path) system_complete( const Path & ph )
-    {
-# ifdef BOOST_WINDOWS_API
-      if ( ph.empty() ) return ph;
-      BOOST_FS_TYPENAME Path::external_string_type sys_ph;
-      system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(),
-              sys_ph ) );
-      if ( ec )
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-            "boost::filesystem::system_complete", ph, ec ) );
-      return Path( Path::traits_type::to_internal( sys_ph ) );
-# else
-      return (ph.empty() || ph.is_complete())
-        ? ph : current_path() / ph;
-# endif
-    }
-
-    BOOST_FS_FUNC(Path)
-    complete( const Path & ph,
-      const Path & base/* = initial_path() */)
-    {
-      BOOST_ASSERT( base.is_complete()
-        && (ph.is_complete() || !ph.has_root_name())
-        && "boost::filesystem::complete() precondition not met" );
-#   ifdef BOOST_WINDOWS_PATH
-      if (ph.empty() || ph.is_complete()) return ph;
-      if ( !ph.has_root_name() )
-        return ph.has_root_directory()
-          ? Path( base.root_name() ) / ph
-          : base / ph;
-      return base / ph;
-#   else
-      return (ph.empty() || ph.is_complete()) ? ph : base / ph;
-#   endif
-    }
-
-    // VC++ 7.1 had trouble with default arguments, so separate one argument
-    // signatures are provided as workarounds; the effect is the same.
-    BOOST_FS_FUNC(Path) complete( const Path & ph )
-      { return complete( ph, initial_path() ); }
-
-    BOOST_FS_FUNC(void)
-    last_write_time( const Path & ph, const std::time_t new_time )
-    {
-      system::error_code ec( detail::last_write_time_api( ph.external_file_string(),
-          new_time ) );
-      if ( ec )
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-          "boost::filesystem::last_write_time", ph, ec ) );
-    }
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    // "do-the-right-thing" overloads  ---------------------------------------//
-
-    inline file_status status( const path & ph )
-      { return status( ph ); }
-    inline file_status status( const wpath & ph )
-      { return status( ph ); }
-
-    inline file_status status( const path & ph, system::error_code & ec )
-      { return status( ph, ec ); }
-    inline file_status status( const wpath & ph, system::error_code & ec )
-      { return status( ph, ec ); }
-
-    inline file_status symlink_status( const path & ph )
-      { return symlink_status( ph ); }
-    inline file_status symlink_status( const wpath & ph )
-      { return symlink_status( ph ); }
-
-    inline file_status symlink_status( const path & ph, system::error_code & ec )
-      { return symlink_status( ph, ec ); }
-    inline file_status symlink_status( const wpath & ph, system::error_code & ec )
-      { return symlink_status( ph, ec ); }
-
-    inline bool exists( const path & ph ) { return exists( ph ); }
-    inline bool exists( const wpath & ph ) { return exists( ph ); }
-
-    inline bool is_directory( const path & ph )
-      { return is_directory( ph ); }
-    inline bool is_directory( const wpath & ph )
-      { return is_directory( ph ); }
- 
-    inline bool is_regular_file( const path & ph )
-      { return is_regular_file( ph ); }
-    inline bool is_regular_file( const wpath & ph )
-      { return is_regular_file( ph ); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    inline bool is_regular( const path & ph )
-      { return is_regular( ph ); }
-    inline bool is_regular( const wpath & ph )
-      { return is_regular( ph ); }
-# endif
-
-    inline bool is_other( const path & ph )
-      { return is_other( ph ); }
-    inline bool is_other( const wpath & ph )
-      { return is_other( ph ); }
-
-    inline bool is_symlink( const path & ph )
-      { return is_symlink( ph ); }
-    inline bool is_symlink( const wpath & ph )
-      { return is_symlink( ph ); }
-
-    inline bool is_empty( const path & ph )
-      { return boost::filesystem2::is_empty( ph ); }
-    inline bool is_empty( const wpath & ph )
-      { return boost::filesystem2::is_empty( ph ); }
-
-    inline bool equivalent( const path & ph1, const path & ph2 )
-      { return equivalent( ph1, ph2 ); }
-    inline bool equivalent( const wpath & ph1, const wpath & ph2 )
-      { return equivalent( ph1, ph2 ); }
-
-    inline boost::uintmax_t file_size( const path & ph )
-      { return file_size( ph ); }
-    inline boost::uintmax_t file_size( const wpath & ph )
-      { return file_size( ph ); }
-
-    inline space_info space( const path & ph )
-      { return space( ph ); }
-    inline space_info space( const wpath & ph )
-      { return space( ph ); }
-
-    inline std::time_t last_write_time( const path & ph )
-      { return last_write_time( ph ); }
-    inline std::time_t last_write_time( const wpath & ph )
-      { return last_write_time( ph ); }
-
-    inline bool create_directory( const path & dir_ph )
-      { return create_directory( dir_ph ); }
-    inline bool create_directory( const wpath & dir_ph )
-      { return create_directory( dir_ph ); }
-
-#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    inline void create_hard_link( const path & to_ph,
-      const path & from_ph )
-      { return create_hard_link( to_ph, from_ph ); }
-    inline void create_hard_link( const wpath & to_ph,
-      const wpath & from_ph )
-      { return create_hard_link( to_ph, from_ph ); }
-
-    inline system::error_code create_hard_link( const path & to_ph,
-      const path & from_ph, system::error_code & ec )
-      { return create_hard_link( to_ph, from_ph, ec ); }
-    inline system::error_code create_hard_link( const wpath & to_ph,
-      const wpath & from_ph, system::error_code & ec )
-      { return create_hard_link( to_ph, from_ph, ec ); }
-#endif
-    
-    inline void create_symlink( const path & to_ph,
-      const path & from_ph )
-      { return create_symlink( to_ph, from_ph ); }
-    inline void create_symlink( const wpath & to_ph,
-      const wpath & from_ph )
-      { return create_symlink( to_ph, from_ph ); }
-
-    inline system::error_code create_symlink( const path & to_ph,
-      const path & from_ph, system::error_code & ec )
-      { return create_symlink( to_ph, from_ph, ec ); }
-    inline system::error_code create_symlink( const wpath & to_ph,
-      const wpath & from_ph, system::error_code & ec )
-      { return create_symlink( to_ph, from_ph, ec ); }
-
-    inline bool remove( const path & ph )
-      { return remove( ph ); }
-    inline bool remove( const wpath & ph )
-      { return remove( ph ); }
-
-    inline unsigned long remove_all( const path & ph )
-      { return remove_all( ph ); }
-    inline unsigned long remove_all( const wpath & ph )
-      { return remove_all( ph ); }
-
-    inline void rename( const path & from_path, const path & to_path )
-      { return rename( from_path, to_path ); }
-    inline void rename( const wpath & from_path, const wpath & to_path )
-      { return rename( from_path, to_path ); }
-
-    inline void copy_file( const path & from_path, const path & to_path )
-      { return copy_file( from_path, to_path ); }
-    inline void copy_file( const wpath & from_path, const wpath & to_path )
-      { return copy_file( from_path, to_path ); }
-
-    inline path system_complete( const path & ph )
-      { return system_complete( ph ); }
-    inline wpath system_complete( const wpath & ph )
-      { return system_complete( ph ); }
-
-    inline path complete( const path & ph,
-      const path & base/* = initial_path()*/ )
-      { return complete( ph, base ); }
-    inline wpath complete( const wpath & ph,
-      const wpath & base/* = initial_path()*/ )
-      { return complete( ph, base ); }
-
-    inline path complete( const path & ph )
-      { return complete( ph, initial_path() ); }
-    inline wpath complete( const wpath & ph )
-      { return complete( ph, initial_path() ); }
-
-    inline void last_write_time( const path & ph, const std::time_t new_time )
-      { last_write_time( ph, new_time ); }
-    inline void last_write_time( const wpath & ph, const std::time_t new_time )
-      { last_write_time( ph, new_time ); }
-
-    inline void current_path( const path & ph )
-      { current_path( ph ); }
-    inline void current_path( const wpath & ph )
-      { current_path( ph ); }
-
-# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    namespace detail
-    {
-      template
-      bool remove_aux( const Path & ph, file_status f )
-      {
-        if ( exists( f ) )
-        {
-          system::error_code ec = remove_api( ph.external_file_string() );
-          if ( ec )
-            BOOST_FILESYSTEM_THROW( basic_filesystem_error(
-              "boost::filesystem::remove", ph, ec ) );
-          return true;
-        }
-        return false;
-      }
-
-      template
-      unsigned long remove_all_aux( const Path & ph, file_status f )
-      {
-        static const boost::filesystem2::basic_directory_iterator end_itr;
-        unsigned long count = 1;
-        if ( !boost::filesystem2::is_symlink( f ) // don't recurse symbolic links
-          && boost::filesystem2::is_directory( f ) )
-        {
-          for ( boost::filesystem2::basic_directory_iterator itr( ph );
-                itr != end_itr; ++itr )
-          {
-            boost::system::error_code ec;
-            boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec );
-            if ( ec )
-              BOOST_FILESYSTEM_THROW( basic_filesystem_error( 
-                "boost::filesystem:remove_all", ph, ec ) );
-            count += remove_all_aux( itr->path(), fn );
-          }
-        }
-        remove_aux( ph, f );
-        return count;
-      }
-
-//  test helper  -------------------------------------------------------------//
-
-    // not part of the documented interface because false positives are possible;
-    // there is no law that says that an OS that has large stat.st_size
-    // actually supports large file sizes.
-      BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
-
-//  directory_iterator helpers  ----------------------------------------------//
-
-//    forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class
-//    basic_directory_iterator, and so avoid iterator_facade DLL template
-//    problems. They also overload to the proper external path character type.
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_first( void *& handle,
-#if       defined(BOOST_POSIX_API)
-            void *& buffer,
-#endif
-          const std::string & dir_path,
-          std::string & target, file_status & fs, file_status & symlink_fs );
-      // eof: return==0 && handle==0
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_increment( void *& handle,
-#if       defined(BOOST_POSIX_API)
-            void *& buffer,
-#endif
-          std::string & target, file_status & fs, file_status & symlink_fs );
-      // eof: return==0 && handle==0
-
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_close( void *& handle
-#if       defined(BOOST_POSIX_API)
-            , void *& buffer
-#endif
-          );
-      // Effects: none if handle==0, otherwise close handle, set handle=0
-
-#     if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY)
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_first( void *& handle, const std::wstring & ph,
-          std::wstring & target, file_status & fs, file_status & symlink_fs );
-      BOOST_FILESYSTEM_DECL system::error_code
-        dir_itr_increment( void *& handle, std::wstring & target,
-          file_status & fs, file_status & symlink_fs );
-#     endif
-
-      template< class Path >
-      class dir_itr_imp
-      {
-      public:  
-        basic_directory_entry m_directory_entry;
-        void *        m_handle;
-#       ifdef BOOST_POSIX_API
-          void *      m_buffer;  // see dir_itr_increment implementation
-#       endif
-        dir_itr_imp() : m_handle(0)
-#       ifdef BOOST_POSIX_API
-          , m_buffer(0)
-#       endif
-        {}
-
-        ~dir_itr_imp() { dir_itr_close( m_handle
-#if       defined(BOOST_POSIX_API)
-            , m_buffer
-#endif
-          ); }
-      };
-
-      BOOST_FILESYSTEM_DECL system::error_code not_found_error();
-
-    } // namespace detail
-
-//  basic_directory_iterator  ------------------------------------------------//
-
-    template< class Path >
-    class basic_directory_iterator
-      : public boost::iterator_facade<
-          basic_directory_iterator,
-          basic_directory_entry,
-          boost::single_pass_traversal_tag >
-    {
-    public:
-      typedef Path path_type;
-
-      basic_directory_iterator(){}  // creates the "end" iterator
-
-      explicit basic_directory_iterator( const Path & dir_path );
-      basic_directory_iterator( const Path & dir_path, system::error_code & ec );
-
-    private:
-
-      // shared_ptr provides shallow-copy semantics required for InputIterators.
-      // m_imp.get()==0 indicates the end iterator.
-      boost::shared_ptr< detail::dir_itr_imp< Path > >  m_imp;
-
-      friend class boost::iterator_core_access;
-
-      typename boost::iterator_facade<
-        basic_directory_iterator,
-        basic_directory_entry,
-        boost::single_pass_traversal_tag >::reference dereference() const 
-      {
-        BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" );
-        return m_imp->m_directory_entry;
-      }
-
-      void increment();
-
-      bool equal( const basic_directory_iterator & rhs ) const
-        { return m_imp == rhs.m_imp; }
-
-      system::error_code m_init( const Path & dir_path );
-    };
-
-    typedef basic_directory_iterator< path > directory_iterator;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_directory_iterator< wpath > wdirectory_iterator;
-# endif
-
-    //  basic_directory_iterator implementation  ---------------------------//
-
-    template
-    system::error_code basic_directory_iterator::m_init(
-      const Path & dir_path )
-    {
-      if ( dir_path.empty() )
-      {
-        m_imp.reset();
-        return detail::not_found_error();
-      }
-      typename Path::external_string_type name;
-      file_status fs, symlink_fs;
-      system::error_code ec( detail::dir_itr_first( m_imp->m_handle,
-#if   defined(BOOST_POSIX_API)
-        m_imp->m_buffer,
-#endif
-        dir_path.external_directory_string(),
-        name, fs, symlink_fs ) );
-
-      if ( ec )
-      {
-        m_imp.reset();
-        return ec;
-      }
-      
-      if ( m_imp->m_handle == 0 ) m_imp.reset(); // eof, so make end iterator
-      else // not eof
-      {
-        m_imp->m_directory_entry.assign( dir_path
-          / Path::traits_type::to_internal( name ), fs, symlink_fs );
-        if ( name[0] == dot::value // dot or dot-dot
-          && (name.size() == 1
-            || (name[1] == dot::value
-              && name.size() == 2)) )
-          {  increment(); }
-      }
-      return boost::system::error_code();
-    }
-
-    template
-    basic_directory_iterator::basic_directory_iterator(
-      const Path & dir_path )
-      : m_imp( new detail::dir_itr_imp )
-    {
-      system::error_code ec( m_init(dir_path) );
-      if ( ec )
-      {
-        BOOST_FILESYSTEM_THROW( basic_filesystem_error( 
-          "boost::filesystem::basic_directory_iterator constructor",
-          dir_path, ec ) );
-      }
-    }
-
-    template
-    basic_directory_iterator::basic_directory_iterator(
-      const Path & dir_path, system::error_code & ec )
-      : m_imp( new detail::dir_itr_imp )
-    {
-      ec = m_init(dir_path);
-    }
-
-    template
-    void basic_directory_iterator::increment()
-    {
-      BOOST_ASSERT( m_imp.get() && "attempt to increment end iterator" );
-      BOOST_ASSERT( m_imp->m_handle != 0 && "internal program error" );
-      
-      typename Path::external_string_type name;
-      file_status fs, symlink_fs;
-      system::error_code ec;
-
-      for (;;)
-      {
-        ec = detail::dir_itr_increment( m_imp->m_handle,
-#if     defined(BOOST_POSIX_API)
-          m_imp->m_buffer,
-#endif
-          name, fs, symlink_fs );
-        if ( ec )
-        {
-          BOOST_FILESYSTEM_THROW( basic_filesystem_error(  
-            "boost::filesystem::basic_directory_iterator increment",
-            m_imp->m_directory_entry.path().parent_path(), ec ) );
-        }
-        if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end
-        if ( !(name[0] == dot::value // !(dot or dot-dot)
-          && (name.size() == 1
-            || (name[1] == dot::value
-              && name.size() == 2))) )
-        {
-          m_imp->m_directory_entry.replace_filename(
-            Path::traits_type::to_internal( name ), fs, symlink_fs );
-          return;
-        }
-      }
-    }
-
-    //  basic_directory_entry  -----------------------------------------------//
-    
-    template
-    class basic_directory_entry
-    {
-    public:
-      typedef Path path_type;
-      typedef typename Path::string_type string_type;
-
-      // compiler generated copy-ctor, copy assignment, and destructor apply
-
-      basic_directory_entry() {}
-      explicit basic_directory_entry( const path_type & p,
-        file_status st = file_status(), file_status symlink_st=file_status() )
-        : m_path(p), m_status(st), m_symlink_status(symlink_st)
-        {}
-
-      void assign( const path_type & p,
-        file_status st, file_status symlink_st )
-        { m_path = p; m_status = st; m_symlink_status = symlink_st; }
-
-      void replace_filename( const string_type & s,
-        file_status st, file_status symlink_st )
-      {
-        m_path.remove_filename();
-        m_path /= s;
-        m_status = st;
-        m_symlink_status = symlink_st;
-      }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      void replace_leaf( const string_type & s,
-        file_status st, file_status symlink_st )
-          { replace_filename( s, st, symlink_st ); }
-#   endif
-
-      const Path &  path() const { return m_path; }
-      file_status   status() const;
-      file_status   status( system::error_code & ec ) const;
-      file_status   symlink_status() const;
-      file_status   symlink_status( system::error_code & ec ) const;
-
-      // conversion simplifies the most common use of basic_directory_entry
-      operator const path_type &() const { return m_path; }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      // deprecated functions preserve common use cases in legacy code
-      typename Path::string_type filename() const
-      {
-        return path().filename();
-      }
-      typename Path::string_type leaf() const
-      {
-        return path().filename();
-      }
-      typename Path::string_type string() const
-      {
-        return path().string();
-      }
-#   endif
-
-    private:
-      path_type             m_path;
-      mutable file_status  m_status;           // stat()-like
-      mutable file_status  m_symlink_status;   // lstat()-like
-        // note: m_symlink_status is not used by Windows implementation
-
-    }; // basic_directory_status
-
-    typedef basic_directory_entry directory_entry;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_directory_entry wdirectory_entry;
-# endif
-
-    //  basic_directory_entry implementation  --------------------------------//
-
-    template
-    file_status
-    basic_directory_entry::status() const
-    {
-      if ( !status_known( m_status ) )
-      {
-#     ifndef BOOST_WINDOWS_API
-        if ( status_known( m_symlink_status )
-          && !is_symlink( m_symlink_status ) )
-          { m_status = m_symlink_status; }
-        else { m_status = boost::filesystem2::status( m_path ); }
-#     else
-        m_status = boost::filesystem2::status( m_path );
-#     endif
-      }
-      return m_status;
-    }
-
-    template
-    file_status
-    basic_directory_entry::status( system::error_code & ec ) const
-    {
-      if ( !status_known( m_status ) )
-      {
-#     ifndef BOOST_WINDOWS_API
-        if ( status_known( m_symlink_status )
-          && !is_symlink( m_symlink_status ) )
-          { ec = boost::system::error_code();; m_status = m_symlink_status; }
-        else { m_status = boost::filesystem2::status( m_path, ec ); }
-#     else
-        m_status = boost::filesystem2::status( m_path, ec );
-#     endif
-      }
-      else ec = boost::system::error_code();;
-      return m_status;
-    }
-
-    template
-    file_status
-    basic_directory_entry::symlink_status() const
-    {
-#   ifndef BOOST_WINDOWS_API
-      if ( !status_known( m_symlink_status ) )
-        { m_symlink_status = boost::filesystem2::symlink_status( m_path ); }
-      return m_symlink_status;
-#   else
-      return status();
-#   endif
-    }
-
-    template
-    file_status
-    basic_directory_entry::symlink_status( system::error_code & ec ) const
-    {
-#   ifndef BOOST_WINDOWS_API
-      if ( !status_known( m_symlink_status ) )
-        { m_symlink_status = boost::filesystem2::symlink_status( m_path, ec ); }
-      else ec = boost::system::error_code();;
-      return m_symlink_status;
-#   else
-      return status( ec );
-#   endif
-    }
-  } // namespace filesystem2
-} // namespace boost
-
-#undef BOOST_FS_FUNC
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::basic_directory_entry;
-    using filesystem2::basic_directory_iterator;
-    using filesystem2::block_file;
-    using filesystem2::character_file;
-    using filesystem2::complete;
-    using filesystem2::copy_file;
-    using filesystem2::copy_option;
-    using filesystem2::create_directory;
-# if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK)
-    using filesystem2::create_hard_link;
-# endif
-    using filesystem2::create_symlink;
-    using filesystem2::current_path;
-    using filesystem2::directory_entry;
-    using filesystem2::directory_file;
-    using filesystem2::directory_iterator;
-    using filesystem2::equivalent;
-    using filesystem2::exists;
-    using filesystem2::fifo_file;
-    using filesystem2::file_not_found;
-    using filesystem2::file_size;
-    using filesystem2::file_status;
-    using filesystem2::file_type;
-    using filesystem2::initial_path;
-    using filesystem2::is_directory;
-    using filesystem2::is_directory;
-    using filesystem2::is_empty;
-    using filesystem2::is_other;
-    using filesystem2::is_regular_file;
-    using filesystem2::is_symlink;
-    using filesystem2::last_write_time;
-    using filesystem2::regular_file;
-    using filesystem2::remove;
-    using filesystem2::remove_all;
-    using filesystem2::rename;
-    using filesystem2::socket_file;
-    using filesystem2::space;
-    using filesystem2::space_info;
-    using filesystem2::status;
-    using filesystem2::status_known;
-    using filesystem2::symlink_file;
-    using filesystem2::symlink_status;
-    using filesystem2::system_complete;
-    using filesystem2::type_unknown;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem2::is_regular;
-    using filesystem2::symbolic_link_exists;
-# endif
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wdirectory_iterator;
-    using filesystem2::wdirectory_entry;
-# endif
-    namespace detail
-    {
-      using filesystem2::detail::not_found_error;
-      using filesystem2::detail::possible_large_file_size_support;
-    }
-  }
-}
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM2_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v2/path.hpp b/project/jni/boost/include/boost/filesystem/v2/path.hpp
deleted file mode 100644
index 615b89cd3..000000000
--- a/project/jni/boost/include/boost/filesystem/v2/path.hpp
+++ /dev/null
@@ -1,1571 +0,0 @@
-//  boost/filesystem/path.hpp  -----------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2005
-//  Copyright Vladimir Prus 2002
-
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying
-//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//  basic_path's stem(), extension(), and replace_extension() are based on
-//  basename(), extension(), and change_extension() from the original
-//  filesystem/convenience.hpp header by Vladimir Prus.
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM2_PATH_HPP
-#define BOOST_FILESYSTEM2_PATH_HPP
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for lexicographical_compare
-#include     // needed by basic_path inserter and extractor
-#include 
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#   include 
-# endif
-
-#include  // must be the last #include
-
-namespace boost
-{
-  namespace BOOST_FILESYSTEM2_NAMESPACE
-  {
-    template class basic_path;
-
-    struct path_traits;
-    typedef basic_path< std::string, path_traits > path;
-
-    struct path_traits
-    {
-      typedef std::string internal_string_type;
-      typedef std::string external_string_type;
-      static external_string_type to_external( const path &,
-        const internal_string_type & src ) { return src; }
-      static internal_string_type to_internal(
-        const external_string_type & src ) { return src; }
-    };
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    struct BOOST_FILESYSTEM_DECL wpath_traits;
-    
-    typedef basic_path< std::wstring, wpath_traits > wpath;
-
-    struct BOOST_FILESYSTEM_DECL wpath_traits
-    {
-      typedef std::wstring internal_string_type;
-# ifdef BOOST_WINDOWS_API
-      typedef std::wstring external_string_type;
-      static external_string_type to_external( const wpath &,
-        const internal_string_type & src ) { return src; }
-      static internal_string_type to_internal(
-        const external_string_type & src ) { return src; }
-# else
-      typedef std::string external_string_type;
-      static external_string_type to_external( const wpath & ph,
-        const internal_string_type & src );
-      static internal_string_type to_internal(
-        const external_string_type & src );
-# endif
-      static void imbue( const std::locale & loc );
-      static bool imbue( const std::locale & loc, const std::nothrow_t & );
-    };
-
-# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-
-    //  path traits  ---------------------------------------------------------//
-
-    template struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = false ); };
-    template<> struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = true ); };
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct is_basic_path
-      { BOOST_STATIC_CONSTANT( bool, value = true ); };
-# endif
-
-    // These only have to be specialized if Path::string_type::value_type
-    // is not convertible from char, although specializations may eliminate
-    // compiler warnings. See ticket 2543.
-    template struct slash
-      { BOOST_STATIC_CONSTANT( char, value = '/' ); };
-
-    template struct dot
-      { BOOST_STATIC_CONSTANT( char, value = '.' ); };
-
-    template struct colon
-      { BOOST_STATIC_CONSTANT( char, value = ':' ); };
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct slash
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'/' ); };
-    template<> struct dot
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'.' ); };
-    template<> struct colon
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L':' ); };
-# endif
-
-# ifdef BOOST_WINDOWS_PATH
-    template struct path_alt_separator
-      { BOOST_STATIC_CONSTANT( char, value = '\\' ); };
-#   ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    template<> struct path_alt_separator
-      { BOOST_STATIC_CONSTANT( wchar_t, value = L'\\' ); };
-#   endif
-# endif
-
-    //  workaround for VC++ 7.0 and earlier issues with nested classes
-    namespace detail
-    {
-      template
-      class iterator_helper
-      {
-      public:
-        typedef typename Path::iterator iterator;
-        static void do_increment( iterator & ph );
-        static void do_decrement( iterator & ph );
-      };
-    }
-
-    //  basic_path  ----------------------------------------------------------//
-  
-    template
-    class basic_path
-    {
-    // invariant: m_path valid according to the portable generic path grammar
-
-      // validate template arguments
-// TODO: get these working
-//      BOOST_STATIC_ASSERT( ::boost::is_same::value );
-//      BOOST_STATIC_ASSERT( ::boost::is_same::value || ::boost::is_same::value );
-
-    public:
-      // compiler generates copy constructor and copy assignment
-
-      typedef basic_path path_type;
-      typedef String string_type;
-      typedef typename String::value_type value_type;
-      typedef Traits traits_type;
-      typedef typename Traits::external_string_type external_string_type; 
-
-      // constructors/destructor
-      basic_path() {}
-      basic_path( const string_type & s ) { operator/=( s ); }
-      basic_path( const value_type * s )  { operator/=( s ); }
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path( InputIterator first, InputIterator last )
-            { append( first, last ); }
-#     endif
-     ~basic_path() {}
-
-      // assignments
-      basic_path & operator=( const string_type & s )
-      {
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-        operator/=( s ); 
-        return *this;
-      }
-      basic_path & operator=( const value_type * s )
-      { 
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-        operator/=( s ); 
-        return *this;
-      }
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path & assign( InputIterator first, InputIterator last )
-            { m_path.clear(); append( first, last ); return *this; }
-#     endif
-
-      // modifiers
-      basic_path & operator/=( const basic_path & rhs )  { return operator /=( rhs.string().c_str() ); }
-      basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); }
-      basic_path & operator/=( const value_type * s );
-#     ifndef BOOST_NO_MEMBER_TEMPLATES
-        template 
-          basic_path & append( InputIterator first, InputIterator last );
-#     endif
-      
-      void clear()
-      { 
-#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
-        m_path.clear();
-#     else
-        m_path.erase( m_path.begin(), m_path.end() );
-#     endif
-      }
-
-      void swap( basic_path & rhs )
-      {
-        m_path.swap( rhs.m_path );
-#       ifdef BOOST_CYGWIN_PATH
-          std::swap( m_cygwin_root, rhs.m_cygwin_root );
-#       endif
-      }
-
-      basic_path & remove_filename();
-      basic_path & replace_extension( const string_type & new_extension = string_type() );
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      basic_path & remove_leaf() { return remove_filename(); }
-# endif
-
-      // observers
-      const string_type & string() const         { return m_path; }
-      const string_type file_string() const;
-      const string_type directory_string() const { return file_string(); }
-
-      const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); }
-      const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); }
-
-      basic_path   root_path() const;
-      string_type  root_name() const;
-      string_type  root_directory() const;
-      basic_path   relative_path() const;
-      basic_path   parent_path() const;
-      string_type  filename() const;
-      string_type  stem() const;
-      string_type  extension() const;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-      string_type  leaf() const            { return filename(); }
-      basic_path   branch_path() const     { return parent_path(); }
-      bool         has_leaf() const        { return !m_path.empty(); }
-      bool         has_branch_path() const { return !parent_path().empty(); }
-# endif
-
-      bool empty() const               { return m_path.empty(); } // name consistent with std containers
-      bool is_complete() const;
-      bool has_root_path() const;
-      bool has_root_name() const;
-      bool has_root_directory() const;
-      bool has_relative_path() const   { return !relative_path().empty(); }
-      bool has_filename() const        { return !m_path.empty(); }
-      bool has_parent_path() const     { return !parent_path().empty(); }
-
-      // iterators
-      class iterator : public boost::iterator_facade<
-        iterator,
-        string_type const,
-        boost::bidirectional_traversal_tag >
-      {
-      private:
-        friend class boost::iterator_core_access;
-        friend class boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path;
-
-        const string_type & dereference() const
-          { return m_name; }
-        bool equal( const iterator & rhs ) const
-          { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; }
-
-        friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper;
-
-        void increment()
-        { 
-          boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper::do_increment(
-            *this );
-        }
-        void decrement()
-        { 
-          boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper::do_decrement(
-            *this );
-        }
-
-        string_type             m_name;     // current element
-        const basic_path *      m_path_ptr; // path being iterated over
-        typename string_type::size_type  m_pos;  // position of name in
-                                            // path_ptr->string(). The
-                                            // end() iterator is indicated by 
-                                            // pos == path_ptr->m_path.size()
-      }; // iterator
-
-      typedef iterator const_iterator;
-
-      iterator begin() const;
-      iterator end() const;
-
-    private:
-      // Note: This is an implementation for POSIX and Windows, where there
-      // are only minor differences between generic and native path grammars.
-      // Private members might be quite different in other implementations,
-      // particularly where there were wide differences between portable and
-      // native path formats, or between file_string() and
-      // directory_string() formats, or simply that the implementation
-      // was willing expend additional memory to achieve greater speed for
-      // some operations at the expense of other operations.
-
-      string_type  m_path; // invariant: portable path grammar
-                           // on Windows, backslashes converted to slashes
-
-#   ifdef BOOST_CYGWIN_PATH
-      bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization
-                          // done by append
-#   endif  
-
-      void m_append_separator_if_needed();
-      void m_append( value_type value ); // converts Windows alt_separator
-
-      // Was qualified; como433beta8 reports:
-      //    warning #427-D: qualified name is not allowed in member declaration 
-      friend class iterator;
-      friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper;
-
-      // Deprecated features ease transition for existing code. Don't use these
-      // in new code.
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    public:
-      typedef bool (*name_check)( const std::string & name );
-      basic_path( const string_type & str, name_check ) { operator/=( str ); }
-      basic_path( const typename string_type::value_type * s, name_check )
-        { operator/=( s );}
-      string_type native_file_string() const { return file_string(); }
-      string_type native_directory_string() const { return directory_string(); }
-      static bool default_name_check_writable() { return false; } 
-      static void default_name_check( name_check ) {}
-      static name_check default_name_check() { return 0; }
-      basic_path & canonize();
-      basic_path & normalize();
-# endif
-    };
-
-  //  basic_path non-member functions  ---------------------------------------//
-
-    template< class String, class Traits >
-    inline void swap( basic_path & lhs,
-               basic_path & rhs ) { lhs.swap( rhs ); }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs, const basic_path & rhs )
-    {
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs )
-    {
-      basic_path tmp( lhs );
-      return std::lexicographical_compare(
-        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs )
-    {
-      basic_path tmp( lhs );
-      return std::lexicographical_compare(
-        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-    {
-      basic_path tmp( rhs );
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
-    }
-
-    template< class String, class Traits >
-    bool operator<( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-    {
-      basic_path tmp( rhs );
-      return std::lexicographical_compare(
-        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
-    }
-
-    //  operator == uses hand-written compare rather than !(lhs < rhs) && !(rhs < lhs)
-    //  because the result is the same yet the direct compare is much more efficient
-    //  than lexicographical_compare, which would also be called twice.
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-    {
-      typedef typename
-        boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-      const typename path_type::string_type::value_type * l (lhs.string().c_str());
-      while ( (*l == *rhs
-#      ifdef BOOST_WINDOWS_PATH
-        || (*l == path_alt_separator::value && *rhs == slash::value) 
-            || (*l == slash::value && *rhs == path_alt_separator::value)
-#      endif
-        ) && *l ) { ++l; ++rhs; }
-      return *l == *rhs
-#      ifdef BOOST_WINDOWS_PATH
-        || (*l == path_alt_separator::value && *rhs == slash::value) 
-          || (*l == slash::value && *rhs == path_alt_separator::value)
-#      endif
-        ;  
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                            const basic_path & rhs )
-    { 
-      return lhs == rhs.string().c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs )
-    {
-      return rhs == lhs;
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs )
-    {
-      return rhs == lhs.c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator==( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-    {
-      return lhs == rhs.c_str();
-    }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const basic_path & rhs )
-        { return !(lhs == rhs); }
-    
-    template< class String, class Traits >
-    inline bool operator!=( const typename basic_path::string_type::value_type * lhs,
-        const basic_path & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const typename basic_path::string_type & lhs,
-      const basic_path & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const typename basic_path::string_type::value_type * rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator!=( const basic_path & lhs,
-      const typename basic_path::string_type & rhs )
-        { return !(lhs == rhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs, const basic_path & rhs ) { return rhs < lhs; }
-    
-    template< class String, class Traits >
-    inline bool operator>( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return rhs < basic_path(lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return rhs < basic_path(lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return basic_path(rhs) < lhs; }
-
-    template< class String, class Traits >
-    inline bool operator>( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return basic_path(rhs) < lhs; }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs, const basic_path & rhs ) { return !(rhs < lhs); }
-    
-    template< class String, class Traits >
-    inline bool operator<=( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return !(rhs < basic_path(lhs)); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return !(rhs < basic_path(lhs)); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return !(basic_path(rhs) < lhs); }
-
-    template< class String, class Traits >
-    inline bool operator<=( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return !(basic_path(rhs) < lhs); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs, const basic_path & rhs ) { return !(lhs < rhs); }
-    
-    template< class String, class Traits >
-    inline bool operator>=( const typename basic_path::string_type::value_type * lhs,
-                    const basic_path & rhs ) { return !(lhs < basic_path(rhs)); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const typename basic_path::string_type & lhs,
-                    const basic_path & rhs ) { return !(lhs < basic_path(rhs)); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs,
-                    const typename basic_path::string_type::value_type * rhs )
-                    { return !(basic_path(lhs) < rhs); }
-
-    template< class String, class Traits >
-    inline bool operator>=( const basic_path & lhs,
-                    const typename basic_path::string_type & rhs )
-                    { return !(basic_path(lhs) < rhs); }
-
-    // operator /
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs,
-      const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs,
-      const typename String::value_type * rhs )
-      { return basic_path( lhs ) /=
-          basic_path( rhs ); }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const basic_path & lhs, const String & rhs )
-      { return basic_path( lhs ) /=
-          basic_path( rhs ); }
-
-    template< class String, class Traits >
-    inline basic_path operator/( 
-      const typename String::value_type * lhs,
-      const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-
-    template< class String, class Traits >
-    inline basic_path operator/(
-      const String & lhs, const basic_path & rhs )
-      { return basic_path( lhs ) /= rhs; }
-   
-    //  inserters and extractors  --------------------------------------------//
-
-// bypass VC++ 7.0 and earlier, and broken Borland compilers
-# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, < 0x610)
-    template< class Path >
-    std::basic_ostream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type > &
-      operator<<
-      ( std::basic_ostream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type >& os, const Path & ph )
-    {
-      os << ph.string();
-      return os;
-    }
-
-    template< class Path >
-    std::basic_istream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type > &
-      operator>>
-      ( std::basic_istream< typename Path::string_type::value_type,
-      typename Path::string_type::traits_type >& is, Path & ph )
-    {
-      typename Path::string_type str;
-      std::getline(is, str);  // See ticket 3863
-      ph = str;
-      return is;
-    }
-# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-    template< class String, class Traits >
-    std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
-      BOOST_DEDUCED_TYPENAME String::traits_type > &
-      operator<<
-      ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
-          BOOST_DEDUCED_TYPENAME String::traits_type >& os, 
-        const basic_path< String, Traits > & ph )
-    {
-      os << ph.string();
-      return os;
-    }
-
-    template< class String, class Traits >
-    std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, 
-      BOOST_DEDUCED_TYPENAME String::traits_type > &
-      operator>>
-      ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type,
-          BOOST_DEDUCED_TYPENAME String::traits_type> & is,
-        basic_path< String, Traits > & ph )
-    {
-      String str;
-      std::getline(is, str);  // See ticket 3863
-      ph = str;
-      return is;
-    }
-# endif
-
-    //  basic_filesystem_error helpers  --------------------------------------//
-
-    //  Originally choice of implementation was done via specialization of
-    //  basic_filesystem_error::what(). Several compilers (GCC, aCC, etc.)
-    //  couldn't handle that, so the choice is now accomplished by overloading.
-
-    namespace detail
-    {
-      // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure!
-      inline
-      const char * what( const char * sys_err_what,
-        const path & path1_arg, const path & path2_arg, std::string & target )
-      {
-        try
-        {
-          if ( target.empty() )
-          {
-            target = sys_err_what;
-            if ( !path1_arg.empty() )
-            {
-              target += ": \"";
-              target += path1_arg.file_string();
-              target += "\"";
-            }
-            if ( !path2_arg.empty() )
-            {
-              target += ", \"";
-              target += path2_arg.file_string();
-              target += "\"";
-            }
-          }
-          return target.c_str();
-        }
-        catch (...)
-        {
-          return sys_err_what;
-        }
-      }
-
-      template
-      const char * what( const char * sys_err_what,
-        const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ )
-      {
-        return sys_err_what;
-      }
-    }
-
-    //  basic_filesystem_error  ----------------------------------------------//
-
-    template
-    class basic_filesystem_error : public system::system_error
-    {
-    // see http://www.boost.org/more/error_handling.html for design rationale
-    public:
-      // compiler generates copy constructor and copy assignment
-
-      typedef Path path_type;
-
-      basic_filesystem_error( const std::string & what_arg,
-        system::error_code ec );
-
-      basic_filesystem_error( const std::string & what_arg,
-        const path_type & path1_arg, system::error_code ec );
-
-      basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg,
-        const path_type & path2_arg, system::error_code ec );
-
-      ~basic_filesystem_error() throw() {}
-
-      const path_type & path1() const
-      {
-        static const path_type empty_path;
-        return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
-      }
-      const path_type & path2() const
-      {
-        static const path_type empty_path;
-        return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
-      }
-
-      const char * what() const throw()
-      { 
-        if ( !m_imp_ptr.get() )
-          return system::system_error::what();
-        return detail::what( system::system_error::what(), m_imp_ptr->m_path1,
-          m_imp_ptr->m_path2, m_imp_ptr->m_what );  
-      }
-
-    private:
-      struct m_imp
-      {
-        path_type                 m_path1; // may be empty()
-        path_type                 m_path2; // may be empty()
-        std::string               m_what;  // not built until needed
-      };
-      boost::shared_ptr m_imp_ptr;
-    };
-
-    typedef basic_filesystem_error filesystem_error;
-
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    typedef basic_filesystem_error wfilesystem_error;
-# endif
-
-  //  path::name_checks  -----------------------------------------------------//
-
-    BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name );
-    BOOST_FILESYSTEM_DECL bool native( const std::string & name );
-    inline bool no_check( const std::string & )
-      { return true; }
-
-// implementation  -----------------------------------------------------------//
-
-    namespace detail
-    {
-
-      //  is_separator helper ------------------------------------------------//
-
-      template
-      inline  bool is_separator( typename Path::string_type::value_type c )
-      {
-        return c == slash::value
-#     ifdef BOOST_WINDOWS_PATH
-          || c == path_alt_separator::value
-#     endif
-          ;
-      }
-
-      // filename_pos helper  ----------------------------------------------------//
-
-      template
-      typename String::size_type filename_pos(
-        const String & str, // precondition: portable generic path grammar
-        typename String::size_type end_pos ) // end_pos is past-the-end position
-      // return 0 if str itself is filename (or empty)
-      {
-        typedef typename
-          boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-        // case: "//"
-        if ( end_pos == 2 
-          && str[0] == slash::value
-          && str[1] == slash::value ) return 0;
-
-        // case: ends in "/"
-        if ( end_pos && str[end_pos-1] == slash::value )
-          return end_pos-1;
-        
-        // set pos to start of last element
-        typename String::size_type pos(
-          str.find_last_of( slash::value, end_pos-1 ) );
-#       ifdef BOOST_WINDOWS_PATH
-        if ( pos == String::npos )
-          pos = str.find_last_of( path_alt_separator::value, end_pos-1 );
-        if ( pos == String::npos )
-          pos = str.find_last_of( colon::value, end_pos-2 );
-#       endif
-
-        return ( pos == String::npos // path itself must be a filename (or empty)
-          || (pos == 1 && str[0] == slash::value) ) // or net
-            ? 0 // so filename is entire string
-            : pos + 1; // or starts after delimiter
-      }
-
-      // first_element helper  -----------------------------------------------//
-      //   sets pos and len of first element, excluding extra separators
-      //   if src.empty(), sets pos,len, to 0,0.
-
-      template
-        void first_element(
-          const String & src, // precondition: portable generic path grammar
-          typename String::size_type & element_pos,
-          typename String::size_type & element_size,
-#       if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1
-          typename String::size_type size = String::npos
-#       else
-          typename String::size_type size = -1
-#       endif
-          )
-      {
-        if ( size == String::npos ) size = src.size();
-        element_pos = 0;
-        element_size = 0;
-        if ( src.empty() ) return;
-
-        typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-        typename String::size_type cur(0);
-        
-        // deal with // [network]
-        if ( size >= 2 && src[0] == slash::value
-          && src[1] == slash::value
-          && (size == 2
-            || src[2] != slash::value) )
-        { 
-          cur += 2;
-          element_size += 2;
-        }
-
-        // leading (not non-network) separator
-        else if ( src[0] == slash::value )
-        {
-          ++element_size;
-          // bypass extra leading separators
-          while ( cur+1 < size
-            && src[cur+1] == slash::value )
-          {
-            ++cur;
-            ++element_pos;
-          }
-          return;
-        }
-
-        // at this point, we have either a plain name, a network name,
-        // or (on Windows only) a device name
-
-        // find the end
-        while ( cur < size
-#         ifdef BOOST_WINDOWS_PATH
-          && src[cur] != colon::value
-#         endif
-          && src[cur] != slash::value )
-        {
-          ++cur;
-          ++element_size;
-        }
-
-#       ifdef BOOST_WINDOWS_PATH
-        if ( cur == size ) return;
-        // include device delimiter
-        if ( src[cur] == colon::value )
-          { ++element_size; }
-#       endif
-
-        return;
-      }
-
-      // root_directory_start helper  ----------------------------------------//
-
-      template
-      typename String::size_type root_directory_start(
-        const String & s, // precondition: portable generic path grammar
-        typename String::size_type size )
-      // return npos if no root_directory found
-      {
-        typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path path_type;
-
-#     ifdef BOOST_WINDOWS_PATH
-        // case "c:/"
-        if ( size > 2
-          && s[1] == colon::value
-          && s[2] == slash::value ) return 2;
-#     endif
-
-        // case "//"
-        if ( size == 2
-          && s[0] == slash::value
-          && s[1] == slash::value ) return String::npos;
-
-        // case "//net {/}"
-        if ( size > 3
-          && s[0] == slash::value
-          && s[1] == slash::value
-          && s[2] != slash::value )
-        {
-          typename String::size_type pos(
-            s.find( slash::value, 2 ) );
-          return pos < size ? pos : String::npos;
-        }
-        
-        // case "/"
-        if ( size > 0 && s[0] == slash::value ) return 0;
-
-        return String::npos;
-      }
-
-      // is_non_root_slash helper  -------------------------------------------//
-
-      template
-      bool is_non_root_slash( const String & str,
-        typename String::size_type pos ) // pos is position of the slash
-      {
-        typedef typename
-          boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path
-            path_type;
-
-        BOOST_ASSERT( !str.empty() && str[pos] == slash::value
-          && "precondition violation" );
-
-        // subsequent logic expects pos to be for leftmost slash of a set
-        while ( pos > 0 && str[pos-1] == slash::value )
-          --pos;
-
-        return  pos != 0
-          && (pos <= 2 || str[1] != slash::value
-            || str.find( slash::value, 2 ) != pos)
-#       ifdef BOOST_WINDOWS_PATH
-          && (pos !=2 || str[1] != colon::value)
-#       endif
-            ;
-      }
-    } // namespace detail
-
-    // decomposition functions  ----------------------------------------------//
-
-    template
-    String basic_path::filename() const
-    {
-      typename String::size_type end_pos(
-        detail::filename_pos( m_path, m_path.size() ) );
-      return (m_path.size()
-                && end_pos
-                && m_path[end_pos] == slash::value
-                && detail::is_non_root_slash< String, Traits >(m_path, end_pos))
-        ? String( 1, dot::value )
-        : m_path.substr( end_pos );
-    }
-
-    template
-    String basic_path::stem() const
-    {
-      string_type name = filename();
-      typename string_type::size_type n = name.rfind(dot::value);
-      return name.substr(0, n);
-    }
-
-    template
-    String basic_path::extension() const
-    {
-      string_type name = filename();
-      typename string_type::size_type n = name.rfind(dot::value);
-      if (n != string_type::npos)
-        return name.substr(n);
-      else
-        return string_type();
-    }
-
-    template
-    basic_path basic_path::parent_path() const
-    {
-      typename String::size_type end_pos(
-        detail::filename_pos( m_path, m_path.size() ) );
-
-      bool filename_was_separator( m_path.size()
-        && m_path[end_pos] == slash::value );
-
-      // skip separators unless root directory
-      typename string_type::size_type root_dir_pos( detail::root_directory_start
-        ( m_path, end_pos ) );
-      for ( ; 
-        end_pos > 0
-        && (end_pos-1) != root_dir_pos
-        && m_path[end_pos-1] == slash::value
-        ;
-        --end_pos ) {}
-
-     return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
-       ? path_type()
-       : path_type( m_path.substr( 0, end_pos ) );
-    }
-
-    template
-    basic_path basic_path::relative_path() const
-    {
-      iterator itr( begin() );
-      for ( ; itr.m_pos != m_path.size()
-          && (itr.m_name[0] == slash::value
-#     ifdef BOOST_WINDOWS_PATH
-          || itr.m_name[itr.m_name.size()-1]
-            == colon::value
-#     endif
-             ); ++itr ) {}
-
-      return basic_path( m_path.substr( itr.m_pos ) );
-    }
-
-    template
-    String basic_path::root_name() const
-    {
-      iterator itr( begin() );
-
-      return ( itr.m_pos != m_path.size()
-        && (
-            ( itr.m_name.size() > 1
-              && itr.m_name[0] == slash::value
-              && itr.m_name[1] == slash::value
-            )
-#     ifdef BOOST_WINDOWS_PATH
-          || itr.m_name[itr.m_name.size()-1]
-            == colon::value
-#     endif
-           ) )
-        ? *itr
-        : String();
-    }
-
-    template
-    String basic_path::root_directory() const
-    {
-      typename string_type::size_type start(
-        detail::root_directory_start( m_path, m_path.size() ) );
-
-      return start == string_type::npos
-        ? string_type()
-        : m_path.substr( start, 1 );
-    }
-
-    template
-    basic_path basic_path::root_path() const
-    {
-      // even on POSIX, root_name() is non-empty() on network paths
-      return basic_path( root_name() ) /= root_directory();
-    }
-
-    // path query functions  -------------------------------------------------//
-
-    template
-    inline bool basic_path::is_complete() const
-    {
-#   ifdef BOOST_WINDOWS_PATH
-      return has_root_name() && has_root_directory();
-#   else
-      return has_root_directory();
-#   endif
-    }
-
-    template
-    inline bool basic_path::has_root_path() const
-    {
-      return !root_path().empty();
-    }
-
-    template
-    inline bool basic_path::has_root_name() const
-    {
-      return !root_name().empty();
-    }
-
-    template
-    inline bool basic_path::has_root_directory() const
-    {
-      return !root_directory().empty();
-    }
-
-    // append  ---------------------------------------------------------------//
-
-    template
-    void basic_path::m_append_separator_if_needed()
-    // requires: !empty()
-    {
-      if (
-#       ifdef BOOST_WINDOWS_PATH
-        *(m_path.end()-1) != colon::value && 
-#       endif
-        *(m_path.end()-1) != slash::value )
-      {
-        m_path += slash::value;
-      }
-    }
-      
-    template
-    void basic_path::m_append( value_type value )
-    {
-#   ifdef BOOST_CYGWIN_PATH
-      if ( m_path.empty() ) m_cygwin_root = (value == slash::value);
-#   endif
-
-#   ifdef BOOST_WINDOWS_PATH
-      // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/')
-      m_path += ( value == path_alt_separator::value
-        ? slash::value
-        : value );
-#   else
-      m_path += value;
-#   endif
-    }
-    
-    // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers,
-    // the append() member template could replace this code.
-    template
-    basic_path & basic_path::operator /=
-      ( const value_type * next_p )
-    {
-      // ignore escape sequence on POSIX or Windows
-      if ( *next_p == slash::value
-        && *(next_p+1) == slash::value
-        && *(next_p+2) == colon::value ) next_p += 3;
-      
-      // append slash::value if needed
-      if ( !empty() && *next_p != 0
-        && !detail::is_separator( *next_p ) )
-      { m_append_separator_if_needed(); }
-
-      for ( ; *next_p != 0; ++next_p ) m_append( *next_p );
-      return *this;
-    }
-
-# ifndef BOOST_NO_MEMBER_TEMPLATES
-    template template 
-      basic_path & basic_path::append(
-        InputIterator first, InputIterator last )
-    {
-      // append slash::value if needed
-      if ( !empty() && first != last
-        && !detail::is_separator( *first ) )
-      { m_append_separator_if_needed(); }
-
-      // song-and-dance to avoid violating InputIterator requirements
-      // (which prohibit lookahead) in detecting a possible escape sequence
-      // (escape sequences are simply ignored on POSIX and Windows)
-      bool was_escape_sequence(true);
-      std::size_t append_count(0);
-      typename String::size_type initial_pos( m_path.size() );
-
-      for ( ; first != last && *first; ++first )
-      {
-        if ( append_count == 0 && *first != slash::value )
-          was_escape_sequence = false;
-        if ( append_count == 1 && *first != slash::value )
-          was_escape_sequence = false;
-        if ( append_count == 2 && *first != colon::value )
-          was_escape_sequence = false;
-        m_append( *first );
-        ++append_count;
-      }
-
-      // erase escape sequence if any
-      if ( was_escape_sequence && append_count >= 3 )
-        m_path.erase( initial_pos, 3 );
-
-      return *this;
-    }
-# endif
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    // canonize  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::canonize()
-    {
-      static const typename string_type::value_type dot_str[]
-        = { dot::value, 0 };
-
-      if ( m_path.empty() ) return *this;
-        
-      path_type temp;
-
-      for ( iterator itr( begin() ); itr != end(); ++itr )
-      {
-        temp /= *itr;
-      };
-
-      if ( temp.empty() ) temp /= dot_str;
-      m_path = temp.m_path;
-      return *this;
-    }
-
-    // normalize  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::normalize()
-    {
-      static const typename string_type::value_type dot_str[]
-        = { dot::value, 0 };
-
-      if ( m_path.empty() ) return *this;
-        
-      path_type temp;
-      iterator start( begin() );
-      iterator last( end() );
-      iterator stop( last-- );
-      for ( iterator itr( start ); itr != stop; ++itr )
-      {
-        // ignore "." except at start and last
-        if ( itr->size() == 1
-          && (*itr)[0] == dot::value
-          && itr != start
-          && itr != last ) continue;
-
-        // ignore a name and following ".."
-        if ( !temp.empty()
-          && itr->size() == 2
-          && (*itr)[0] == dot::value
-          && (*itr)[1] == dot::value ) // dot dot
-        {
-          string_type lf( temp.filename() );  
-          if ( lf.size() > 0  
-            && (lf.size() != 1
-              || (lf[0] != dot::value
-                && lf[0] != slash::value))
-            && (lf.size() != 2 
-              || (lf[0] != dot::value
-                && lf[1] != dot::value
-#             ifdef BOOST_WINDOWS_PATH
-                && lf[1] != colon::value
-#             endif
-                 )
-               )
-            )
-          {
-            temp.remove_filename();
-            // if not root directory, must also remove "/" if any
-            if ( temp.m_path.size() > 0
-              && temp.m_path[temp.m_path.size()-1]
-                == slash::value )
-            {
-              typename string_type::size_type rds(
-                detail::root_directory_start( temp.m_path,
-                  temp.m_path.size() ) );
-              if ( rds == string_type::npos
-                || rds != temp.m_path.size()-1 ) 
-                { temp.m_path.erase( temp.m_path.size()-1 ); }
-            }
-
-            iterator next( itr );
-            if ( temp.empty() && ++next != stop
-              && next == last && *last == dot_str ) temp /= dot_str;
-            continue;
-          }
-        }
-
-        temp /= *itr;
-      };
-
-      if ( temp.empty() ) temp /= dot_str;
-      m_path = temp.m_path;
-      return *this;
-    }
-
-# endif
-
-    // modifiers  ------------------------------------------------------------//
-
-    template
-    basic_path & basic_path::remove_filename()
-    {
-      m_path.erase(
-        detail::filename_pos( m_path, m_path.size() ) );
-      return *this;
-    }
-
-    template
-    basic_path &
-    basic_path::replace_extension( const string_type & new_ext )
-    {
-      // erase existing extension if any
-      string_type old_ext = extension();
-      if ( !old_ext.empty() )
-        m_path.erase( m_path.size() - old_ext.size() );
-
-      if ( !new_ext.empty() && new_ext[0] != dot::value )
-        m_path += dot::value;
-
-      m_path += new_ext;
-
-      return *this;
-    }
-
-
-    // path conversion functions  --------------------------------------------//
-
-    template
-    const String
-    basic_path::file_string() const
-    {
-#   ifdef BOOST_WINDOWS_PATH
-      // for Windows, use the alternate separator, and bypass extra 
-      // root separators
-
-      typename string_type::size_type root_dir_start(
-        detail::root_directory_start( m_path, m_path.size() ) );
-      bool in_root( root_dir_start != string_type::npos );
-      String s;
-      for ( typename string_type::size_type pos( 0 );
-        pos != m_path.size(); ++pos )
-      {
-        // special case // [net]
-        if ( pos == 0 && m_path.size() > 1
-          && m_path[0] == slash::value
-          && m_path[1] == slash::value
-          && ( m_path.size() == 2 
-            || !detail::is_separator( m_path[2] )
-             ) )
-        {
-          ++pos;
-          s += path_alt_separator::value;
-          s += path_alt_separator::value;
-          continue;
-        }   
-
-        // bypass extra root separators
-        if ( in_root )
-        { 
-          if ( s.size() > 0
-            && s[s.size()-1] == path_alt_separator::value
-            && m_path[pos] == slash::value
-            ) continue;
-        }
-
-        if ( m_path[pos] == slash::value )
-          s += path_alt_separator::value;
-        else
-          s += m_path[pos];
-
-        if ( pos > root_dir_start
-          && m_path[pos] == slash::value )
-          { in_root = false; }
-      }
-#   ifdef BOOST_CYGWIN_PATH
-      if ( m_cygwin_root ) s[0] = slash::value;
-#   endif
-      return s;
-#   else
-      return m_path;
-#   endif
-    }
-
-    // iterator functions  ---------------------------------------------------//
-
-    template
-    typename basic_path::iterator basic_path::begin() const
-    {
-      iterator itr;
-      itr.m_path_ptr = this;
-      typename string_type::size_type element_size;
-      detail::first_element( m_path, itr.m_pos, element_size );
-      itr.m_name = m_path.substr( itr.m_pos, element_size );
-      return itr;
-    }
-
-    template
-    typename basic_path::iterator basic_path::end() const
-      {
-        iterator itr;
-        itr.m_path_ptr = this;
-        itr.m_pos = m_path.size();
-        return itr;
-      }
-
-    namespace detail
-    {
-      //  do_increment  ------------------------------------------------------//
-
-      template
-      void iterator_helper::do_increment( iterator & itr )
-      {
-        typedef typename Path::string_type string_type;
-        typedef typename Path::traits_type traits_type;
-
-        BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
-
-        bool was_net( itr.m_name.size() > 2
-          && itr.m_name[0] == slash::value
-          && itr.m_name[1] == slash::value
-          && itr.m_name[2] != slash::value );
-
-        // increment to position past current element
-        itr.m_pos += itr.m_name.size();
-
-        // if end reached, create end iterator
-        if ( itr.m_pos == itr.m_path_ptr->m_path.size() )
-        {
-          itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() 
-          return;
-        }
-
-        // process separator (Windows drive spec is only case not a separator)
-        if ( itr.m_path_ptr->m_path[itr.m_pos] == slash::value )
-        {
-          // detect root directory
-          if ( was_net
-  #       ifdef BOOST_WINDOWS_PATH
-            // case "c:/"
-            || itr.m_name[itr.m_name.size()-1] == colon::value
-  #       endif
-             )
-          {
-            itr.m_name = slash::value;
-            return;
-          }
-
-          // bypass separators
-          while ( itr.m_pos != itr.m_path_ptr->m_path.size()
-            && itr.m_path_ptr->m_path[itr.m_pos] == slash::value )
-            { ++itr.m_pos; }
-
-          // detect trailing separator, and treat it as ".", per POSIX spec
-          if ( itr.m_pos == itr.m_path_ptr->m_path.size()
-            && detail::is_non_root_slash< string_type, traits_type >(
-                itr.m_path_ptr->m_path, itr.m_pos-1 ) ) 
-          {
-            --itr.m_pos;
-            itr.m_name = dot::value;
-            return;
-          }
-        }
-
-        // get next element
-        typename string_type::size_type end_pos(
-          itr.m_path_ptr->m_path.find( slash::value, itr.m_pos ) );
-        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
-      } 
-
-      //  do_decrement  ------------------------------------------------------//
-
-      template
-      void iterator_helper::do_decrement( iterator & itr )
-      {                                                                                
-        BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()"  );
-
-        typedef typename Path::string_type string_type;
-        typedef typename Path::traits_type traits_type;
-
-        typename string_type::size_type end_pos( itr.m_pos );
-
-        typename string_type::size_type root_dir_pos(
-          detail::root_directory_start(
-            itr.m_path_ptr->m_path, end_pos ) );
-
-        // if at end and there was a trailing non-root '/', return "."
-        if ( itr.m_pos == itr.m_path_ptr->m_path.size()
-          && itr.m_path_ptr->m_path.size() > 1
-          && itr.m_path_ptr->m_path[itr.m_pos-1] == slash::value
-          && detail::is_non_root_slash< string_type, traits_type >(
-               itr.m_path_ptr->m_path, itr.m_pos-1 ) 
-           )
-        {
-          --itr.m_pos;
-            itr.m_name = dot::value;
-            return;
-        }
-
-        // skip separators unless root directory
-        for ( 
-          ; 
-          end_pos > 0
-          && (end_pos-1) != root_dir_pos
-          && itr.m_path_ptr->m_path[end_pos-1] == slash::value
-          ;
-          --end_pos ) {}
-
-        itr.m_pos = detail::filename_pos
-            ( itr.m_path_ptr->m_path, end_pos );
-        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
-      }
-    } // namespace detail
-
-    //  basic_filesystem_error implementation --------------------------------//
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, const path_type & path1_arg,
-      system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-        m_imp_ptr->m_path1 = path1_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    template
-    basic_filesystem_error::basic_filesystem_error(
-      const std::string & what_arg, const path_type & path1_arg,
-      const path_type & path2_arg, system::error_code ec )
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset( new m_imp );
-        m_imp_ptr->m_path1 = path1_arg;
-        m_imp_ptr->m_path2 = path2_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-  } // namespace BOOST_FILESYSTEM2_NAMESPACE
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem2::basic_path;
-    using filesystem2::path_traits;
-
-    using filesystem2::slash;
-    using filesystem2::dot;
-    using filesystem2::colon;
-
-    using filesystem2::path;
-# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-    using filesystem2::wpath_traits;
-    using filesystem2::wpath;
-    using filesystem2::wfilesystem_error;
-# endif
-    using filesystem2::basic_filesystem_error;
-    using filesystem2::filesystem_error;
-    using filesystem2::portable_posix_name;
-    using filesystem2::windows_name;
-    using filesystem2::portable_name;
-    using filesystem2::portable_directory_name;
-    using filesystem2::portable_file_name;
-    using filesystem2::native;
-    using filesystem2::no_check;
-    using filesystem2::swap;
-    using filesystem2::operator<;
-    using filesystem2::operator==;
-    using filesystem2::operator!=;
-    using filesystem2::operator>;
-    using filesystem2::operator<=;
-    using filesystem2::operator>=;
-    using filesystem2::operator/;
-    using filesystem2::operator<<;
-    using filesystem2::operator>>;
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-
-#endif // BOOST_FILESYSTEM2_PATH_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/config.hpp b/project/jni/boost/include/boost/filesystem/v3/config.hpp
deleted file mode 100644
index 13fc308db..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/config.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-//  boost/filesystem/v3/config.hpp  ----------------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_CONFIG_HPP
-#define BOOST_FILESYSTEM3_CONFIG_HPP
-
-# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
-#   error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
-# endif
-
-# if !defined(BOOST_FILESYSTEM_VERSION)
-#   define BOOST_FILESYSTEM_VERSION 3
-# endif
-
-#define BOOST_FILESYSTEM_I18N  // aid users wishing to compile several versions
-
-// This header implements separate compilation features as described in
-// http://www.boost.org/more/separate_compilation.html
-
-#include 
-#include   // for BOOST_POSIX_API or BOOST_WINDOWS_API
-#include  
-
-//  BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
-
-# ifdef BOOST_FILESYSTEM_SOURCE
-#   define BOOST_FILESYSTEM_DEPRECATED
-# endif
-
-//  throw an exception  ----------------------------------------------------------------//
-//
-//  Exceptions were originally thrown via boost::throw_exception().
-//  As throw_exception() became more complex, it caused user error reporting
-//  to be harder to interpret, since the exception reported became much more complex.
-//  The immediate fix was to throw directly, wrapped in a macro to make any later change
-//  easier.
-
-#define BOOST_FILESYSTEM_THROW(EX) throw EX
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-//  enable dynamic linking -------------------------------------------------------------//
-
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-# if defined(BOOST_FILESYSTEM_SOURCE)
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
-# else 
-#   define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
-# endif
-#else
-# define BOOST_FILESYSTEM_DECL
-#endif
-
-//  enable automatic library variant selection  ----------------------------------------// 
-
-#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \
-  && !defined(BOOST_FILESYSTEM_NO_LIB)
-//
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_filesystem
-//
-// If we're importing code from a dll, then tell auto_link.hpp about it:
-//
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
-#  define BOOST_DYN_LINK
-#endif
-//
-// And include the header that does the work:
-//
-#include 
-#endif  // auto-linking disabled
-
-#endif // BOOST_FILESYSTEM3_CONFIG_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/convenience.hpp b/project/jni/boost/include/boost/filesystem/v3/convenience.hpp
deleted file mode 100644
index 1a1f9435f..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/convenience.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//  boost/filesystem/convenience.hpp  ----------------------------------------//
-
-//  Copyright Beman Dawes, 2002-2005
-//  Copyright Vladimir Prus, 2002
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  See library home page at http://www.boost.org/libs/filesystem
-
-//----------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
-#define BOOST_FILESYSTEM3_CONVENIENCE_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-
-#include  // must be the last #include
-
-namespace boost
-{
-  namespace filesystem3
-  {
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-
-    inline std::string extension(const path & p)
-    {
-      return p.extension().string();
-    }
-
-    inline std::string basename(const path & p)
-    {
-      return p.stem().string();
-    }
-
-    inline path change_extension( const path & p, const path & new_extension )
-    { 
-      path new_p( p );
-      new_p.replace_extension( new_extension );
-      return new_p;
-    }
-
-# endif
-
-
-  } // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::extension;
-    using filesystem3::basename;
-    using filesystem3::change_extension;
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/exception.hpp b/project/jni/boost/include/boost/filesystem/v3/exception.hpp
deleted file mode 100644
index 985cd8f71..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/exception.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-//  boost/filesystem/exception.hpp  -----------------------------------------------------//
-
-//  Copyright Beman Dawes 2003
-//  Use, modification, and distribution is subject to the Boost Software
-//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-//  http://www.boost.org/LICENSE_1_0.txt)
-
-//  This header is no longer used. The contents have been moved to path.hpp.
-//  It is provided so that user code #includes do not have to be changed.
diff --git a/project/jni/boost/include/boost/filesystem/v3/fstream.hpp b/project/jni/boost/include/boost/filesystem/v3/fstream.hpp
deleted file mode 100644
index 60a2a3b2b..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/fstream.hpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//  boost/filesystem/fstream.hpp  ------------------------------------------------------//
-
-//  Copyright Beman Dawes 2002
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------// 
-
-#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP
-#define BOOST_FILESYSTEM3_FSTREAM_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-//  on Windows, except for standard libaries known to have wchar_t overloads for
-//  file stream I/O, use path::string() to get a narrow character c_str()
-#if defined(BOOST_WINDOWS_API) \
-  && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
-  // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
-# define BOOST_FILESYSTEM_C_STR string().c_str()  // use narrow, since wide not available
-#else  // use the native c_str, which will be narrow on POSIX, wide on Windows
-# define BOOST_FILESYSTEM_C_STR c_str()
-#endif
-
-namespace boost
-{
-namespace filesystem3
-{
-
-//--------------------------------------------------------------------------------------//
-//                                  basic_filebuf                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_filebuf : public std::basic_filebuf
-  {
-  private: // disallow copying
-    basic_filebuf(const basic_filebuf&);
-    const basic_filebuf& operator=(const basic_filebuf&);
-
-  public:
-    basic_filebuf() {}
-    virtual ~basic_filebuf() {}
-
-    basic_filebuf*
-      open(const path& p, std::ios_base::openmode mode) 
-    {
-      return std::basic_filebuf::open(p.BOOST_FILESYSTEM_C_STR, mode)
-        ? this : 0;
-    }
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                 basic_ifstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_ifstream : public std::basic_ifstream
-  {
-  private: // disallow copying
-    basic_ifstream(const basic_ifstream&);
-    const basic_ifstream& operator=(const basic_ifstream&);
-
-  public:
-    basic_ifstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_ifstream(const path& p)
-      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
-
-    basic_ifstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_ifstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_ifstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_ifstream() {}
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                 basic_ofstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_ofstream : public std::basic_ofstream
-  {
-  private: // disallow copying
-    basic_ofstream(const basic_ofstream&);
-    const basic_ofstream& operator=(const basic_ofstream&);
-
-  public:
-    basic_ofstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_ofstream(const path& p)
-      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
-
-    basic_ofstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_ofstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_ofstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_ofstream() {}
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                  basic_fstream                                       //
-//--------------------------------------------------------------------------------------//
-
-  template < class charT, class traits = std::char_traits >
-  class basic_fstream : public std::basic_fstream
-  {
-  private: // disallow copying
-    basic_fstream(const basic_fstream&);
-    const basic_fstream & operator=(const basic_fstream&);
-
-  public:
-    basic_fstream() {}
-
-    // use two signatures, rather than one signature with default second
-    // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
-
-    explicit basic_fstream(const path& p)
-      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR,
-          std::ios_base::in | std::ios_base::out) {}
-
-    basic_fstream(const path& p, std::ios_base::openmode mode)
-      : std::basic_fstream(p.BOOST_FILESYSTEM_C_STR, mode) {}
-
-    void open(const path& p)
-      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR,
-          std::ios_base::in | std::ios_base::out); }
-
-    void open(const path& p, std::ios_base::openmode mode)
-      { std::basic_fstream::open(p.BOOST_FILESYSTEM_C_STR, mode); }
-
-    virtual ~basic_fstream() {}
-
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                    typedefs                                          //
-//--------------------------------------------------------------------------------------//
-
-  typedef basic_filebuf filebuf;
-  typedef basic_ifstream ifstream;
-  typedef basic_ofstream ofstream;
-  typedef basic_fstream fstream;
-
-  typedef basic_filebuf wfilebuf;
-  typedef basic_ifstream wifstream;
-  typedef basic_ofstream wofstream;
-  typedef basic_fstream wfstream;
-  
-} // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::filebuf;
-    using filesystem3::ifstream;
-    using filesystem3::ofstream;
-    using filesystem3::fstream;
-    using filesystem3::wfilebuf;
-    using filesystem3::wifstream;
-    using filesystem3::wfstream;
-    using filesystem3::wofstream;
-    using filesystem3::basic_filebuf;
-    using filesystem3::basic_ifstream;
-    using filesystem3::basic_ofstream;
-    using filesystem3::basic_fstream;
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-# endif
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-#endif  // BOOST_FILESYSTEM3_FSTREAM_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/operations.hpp b/project/jni/boost/include/boost/filesystem/v3/operations.hpp
deleted file mode 100644
index ace3bc8f1..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/operations.hpp
+++ /dev/null
@@ -1,1199 +0,0 @@
-//  boost/filesystem/operations.hpp  ---------------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2009
-//  Copyright Jan Langer 2002
-//  Copyright Dietmar Kuehl 2001                                        
-//  Copyright Vladimir Prus 2002
-   
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//--------------------------------------------------------------------------------------//
-
-#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP
-#define BOOST_FILESYSTEM3_OPERATIONS_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include  // for pair
-#include 
-#include 
-#include 
-
-#ifdef BOOST_WINDOWS_API
-#  include 
-#endif
-
-#include  // must be the last #include
-
-//--------------------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem3
-  {
-
-//--------------------------------------------------------------------------------------//
-//                                     file_type                                        //
-//--------------------------------------------------------------------------------------//
-
-  enum file_type
-  { 
-    status_error,
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    status_unknown = status_error,
-#   endif
-    file_not_found,
-    regular_file,
-    directory_file,
-    // the following may not apply to some operating systems or file systems
-    symlink_file,
-    block_file,
-    character_file,
-    fifo_file,
-    socket_file,
-    reparse_file,  // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
-    type_unknown,  // file does exist, but isn't one of the above types or
-                   // we don't have strong enough permission to find its type
-
-    _detail_directory_symlink  // internal use only; never exposed to users
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                       perms                                          //
-//--------------------------------------------------------------------------------------//
-
-  enum perms
-  {
-    no_perms = 0,       // file_not_found is no_perms rather than perms_not_known
-
-    // POSIX equivalent macros given in comments.
-    // Values are from POSIX and are given in octal per the POSIX standard.
-
-    // permission bits
-    
-    owner_read = 0400,  // S_IRUSR, Read permission, owner
-    owner_write = 0200, // S_IWUSR, Write permission, owner
-    owner_exe = 0100,   // S_IXUSR, Execute/search permission, owner
-    owner_all = 0700,   // S_IRWXU, Read, write, execute/search by owner
-
-    group_read = 040,   // S_IRGRP, Read permission, group
-    group_write = 020,  // S_IWGRP, Write permission, group
-    group_exe = 010,    // S_IXGRP, Execute/search permission, group
-    group_all = 070,    // S_IRWXG, Read, write, execute/search by group
-
-    others_read = 04,   // S_IROTH, Read permission, others
-    others_write = 02,  // S_IWOTH, Write permission, others
-    others_exe = 01,    // S_IXOTH, Execute/search permission, others
-    others_all = 07,    // S_IRWXO, Read, write, execute/search by others
-
-    all_all = owner_all|group_all|others_all,  // 0777
-
-    // other POSIX bits
-
-    set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
-    set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
-    sticky_bit     = 01000, // S_ISVTX,
-                            // (POSIX XSI) On directories, restricted deletion flag 
-	                          // (V7) 'sticky bit': save swapped text even after use 
-                            // (SunOS) On non-directories: don't cache this file
-                            // (SVID-v4.2) On directories: restricted deletion flag
-                            // Also see http://en.wikipedia.org/wiki/Sticky_bit
-
-    perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit,  // 07777
-
-    perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
-
-    // options for permissions() function
-
-    add_perms = 0x1000,     // adds the given permission bits to the current bits
-    remove_perms = 0x2000,  // removes the given permission bits from the current bits;
-                            // choose add_perms or remove_perms, not both; if neither add_perms
-                            // nor remove_perms is given, replace the current bits with
-                            // the given bits.
-
-    symlink_perms = 0x4000  // on POSIX, don't resolve symlinks; implied on Windows
-  };
-
-  BOOST_BITMASK(perms)
-
-//--------------------------------------------------------------------------------------//
-//                                    file_status                                       //
-//--------------------------------------------------------------------------------------//
-
-  class BOOST_FILESYSTEM_DECL file_status
-  {
-  public:
-             file_status()            : m_value(status_error), m_perms(perms_not_known) {}
-    explicit file_status(file_type v, perms prms = perms_not_known)
-                                      : m_value(v), m_perms(prms) {}
-
-    // observers
-    file_type  type() const                       { return m_value; }
-    perms      permissions() const                { return m_perms; } 
-
-    // modifiers
-    void       type(file_type v)                  { m_value = v; }
-    void       permissions(perms prms)            { m_perms = prms; }
-
-    bool operator==(const file_status& rhs) const { return type() == rhs.type() && 
-                                                    permissions() == rhs.permissions(); }
-    bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
-
-  private:
-    file_type   m_value;
-    enum perms  m_perms;
-  };
-
-  inline bool type_present(file_status f) { return f.type() != status_error; }
-  inline bool permissions_present(file_status f)
-                                          {return f.permissions() != perms_not_known;}
-  inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); }
-  inline bool exists(file_status f)       { return f.type() != status_error
-                                                && f.type() != file_not_found; }
-  inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
-  inline bool is_directory(file_status f) { return f.type() == directory_file; }
-  inline bool is_symlink(file_status f)   { return f.type() == symlink_file; }
-  inline bool is_other(file_status f)     { return exists(f) && !is_regular_file(f)
-                                                && !is_directory(f) && !is_symlink(f); }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline bool is_regular(file_status f)   { return f.type() == regular_file; }
-# endif
-
-  struct space_info
-  {
-    // all values are byte counts
-    boost::uintmax_t capacity;
-    boost::uintmax_t free;      // <= capacity
-    boost::uintmax_t available; // <= free
-  };
-
-  BOOST_SCOPED_ENUM_START(copy_option)
-    {none, fail_if_exists = none, overwrite_if_exists};
-  BOOST_SCOPED_ENUM_END
-
-//--------------------------------------------------------------------------------------//
-//                             implementation details                                   //
-//--------------------------------------------------------------------------------------//
-
-  namespace detail
-  {
-    BOOST_FILESYSTEM_DECL
-    file_status status(const path&p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    file_status symlink_status(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool is_empty(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path initial_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path canonical(const path& p, const path& base, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy(const path& from, const path& to, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_directory(const path& from, const path& to, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_file(const path& from, const path& to,
-                    BOOST_SCOPED_ENUM(copy_option) option,  // See ticket #2925
-                    system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool create_directories(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool create_directory(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_directory_symlink(const path& to, const path& from,
-                                  system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void create_symlink(const path& to, const path& from, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path current_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void current_path(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    std::time_t last_write_time(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void last_write_time(const path& p, const std::time_t new_time,
-                         system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void permissions(const path& p, perms prms, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path read_symlink(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-      // For standardization, if the committee doesn't like "remove", consider "eliminate"
-    bool remove(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    space_info space(const path& p, system::error_code* ec=0); 
-    BOOST_FILESYSTEM_DECL
-    path system_complete(const path& p, system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path temp_directory_path(system::error_code* ec=0);
-    BOOST_FILESYSTEM_DECL
-    path unique_path(const path& p, system::error_code* ec=0);
-  }  // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                             status query functions                                   //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  inline
-  file_status status(const path& p)    {return detail::status(p);}
-  inline 
-  file_status status(const path& p, system::error_code& ec)
-                                       {return detail::status(p, &ec);}
-  inline 
-  file_status symlink_status(const path& p) {return detail::symlink_status(p);}
-  inline
-  file_status symlink_status(const path& p, system::error_code& ec)
-                                       {return detail::symlink_status(p, &ec);}
-  inline 
-  bool exists(const path& p)           {return exists(detail::status(p));}
-  inline 
-  bool exists(const path& p, system::error_code& ec)
-                                       {return exists(detail::status(p, &ec));}
-  inline 
-  bool is_directory(const path& p)     {return is_directory(detail::status(p));}
-  inline 
-  bool is_directory(const path& p, system::error_code& ec)
-                                       {return is_directory(detail::status(p, &ec));}
-  inline 
-  bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
-  inline 
-  bool is_regular_file(const path& p, system::error_code& ec)
-                                       {return is_regular_file(detail::status(p, &ec));}
-  inline 
-  bool is_other(const path& p)         {return is_other(detail::status(p));}
-  inline 
-  bool is_other(const path& p, system::error_code& ec)
-                                       {return is_other(detail::status(p, &ec));}
-  inline
-  bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
-  inline 
-  bool is_symlink(const path& p, system::error_code& ec)
-                                       {return is_symlink(detail::symlink_status(p, &ec));}
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline
-  bool is_regular(const path& p)       {return is_regular(detail::status(p));}
-  inline
-  bool is_regular(const path& p, system::error_code& ec)
-                                       {return is_regular(detail::status(p, &ec));}
-# endif
-
-  inline
-  bool is_empty(const path& p)         {return detail::is_empty(p);}
-  inline
-  bool is_empty(const path& p, system::error_code& ec)
-                                       {return detail::is_empty(p, &ec);}
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                             operational functions                                    //
-//                  in alphabetical order, unless otherwise noted                       //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
- 
-  //  forward declarations
-  path current_path();  // fwd declaration
-  path initial_path();
-
-  BOOST_FILESYSTEM_DECL
-  path absolute(const path& p, const path& base=current_path());
-  //  If base.is_absolute(), throws nothing. Thus no need for ec argument
-
-  inline
-  path canonical(const path& p, const path& base=current_path())
-                                       {return detail::canonical(p, base);}
-  inline
-  path canonical(const path& p, system::error_code& ec)
-                                       {return detail::canonical(p, current_path(), &ec);}
-  inline
-  path canonical(const path& p, const path& base, system::error_code& ec)
-                                       {return detail::canonical(p, base, &ec);}
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline
-  path complete(const path& p)
-  {
-    return absolute(p, initial_path());
-  }
-
-  inline
-  path complete(const path& p, const path& base)
-  {
-    return absolute(p, base);
-  }
-# endif
-
-  inline
-  void copy(const path& from, const path& to) {detail::copy(from, to);}
-
-  inline
-  void copy(const path& from, const path& to, system::error_code& ec) 
-                                       {detail::copy(from, to, &ec);}
-  inline
-  void copy_directory(const path& from, const path& to)
-                                       {detail::copy_directory(from, to);}
-  inline
-  void copy_directory(const path& from, const path& to, system::error_code& ec)
-                                       {detail::copy_directory(from, to, &ec);}
-  inline
-  void copy_file(const path& from, const path& to,   // See ticket #2925
-                 BOOST_SCOPED_ENUM(copy_option) option)
-                                       {detail::copy_file(from, to, option);}
-  inline
-  void copy_file(const path& from, const path& to)
-                                       {detail::copy_file(from, to, copy_option::fail_if_exists);}
-  inline
-  void copy_file(const path& from, const path& to,   // See ticket #2925
-                 BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec)
-                                       {detail::copy_file(from, to, option, &ec);}
-  inline
-  void copy_file(const path& from, const path& to, system::error_code& ec)
-                                       {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);}
-  inline
-  void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}
-
-  inline
-  void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec)
-                                       {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
-  inline
-  bool create_directories(const path& p) {return detail::create_directories(p);}
-
-  inline
-  bool create_directories(const path& p, system::error_code& ec)
-                                       {return detail::create_directories(p, &ec);}
-  inline
-  bool create_directory(const path& p) {return detail::create_directory(p);}
-
-  inline
-  bool create_directory(const path& p, system::error_code& ec)
-                                       {return detail::create_directory(p, &ec);}
-  inline
-  void create_directory_symlink(const path& to, const path& from)
-                                       {detail::create_directory_symlink(to, from);}
-  inline
-  void create_directory_symlink(const path& to, const path& from, system::error_code& ec)
-                                       {detail::create_directory_symlink(to, from, &ec);}
-  inline
-  void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
-
-  inline
-  void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec)
-                                       {detail::create_hard_link(to, new_hard_link, &ec);}
-  inline
-  void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
-
-  inline
-  void create_symlink(const path& to, const path& new_symlink, system::error_code& ec)
-                                       {detail::create_symlink(to, new_symlink, &ec);}
-  inline
-  path current_path()                  {return detail::current_path();}
-
-  inline
-  path current_path(system::error_code& ec) {return detail::current_path(&ec);}
-
-  inline
-  void current_path(const path& p)     {detail::current_path(p);}
-
-  inline
-  void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);}
-
-  inline
-  bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
-
-  inline
-  bool equivalent(const path& p1, const path& p2, system::error_code& ec)
-                                       {return detail::equivalent(p1, p2, &ec);}
-  inline
-  boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
-
-  inline
-  boost::uintmax_t file_size(const path& p, system::error_code& ec)
-                                       {return detail::file_size(p, &ec);}
-  inline
-  boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
-
-  inline
-  boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
-                                       {return detail::hard_link_count(p, &ec);}
-  inline
-  path initial_path()                  {return detail::initial_path();}
-
-  inline
-  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-
-  template 
-  path initial_path() {return initial_path();}
-  template 
-  path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-
-  inline
-  std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
-
-  inline
-  std::time_t last_write_time(const path& p, system::error_code& ec)
-                                       {return detail::last_write_time(p, &ec);}
-  inline
-  void last_write_time(const path& p, const std::time_t new_time)
-                                       {detail::last_write_time(p, new_time);}
-  inline
-  void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec)
-                                       {detail::last_write_time(p, new_time, &ec);}
-  inline
-  void permissions(const path& p, perms prms)
-                                       {detail::permissions(p, prms);}
-  inline
-  void permissions(const path& p, perms prms, system::error_code& ec)
-                                       {detail::permissions(p, prms, &ec);}
-
-  inline
-  path read_symlink(const path& p)     {return detail::read_symlink(p);}
-
-  inline
-  path read_symlink(const path& p, system::error_code& ec)
-                                       {return detail::read_symlink(p, &ec);}
-  inline
-    // For standardization, if the committee doesn't like "remove", consider "eliminate"
-  bool remove(const path& p)           {return detail::remove(p);}
-
-  inline
-  bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);}
-
-  inline
-  boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
-    
-  inline
-  boost::uintmax_t remove_all(const path& p, system::error_code& ec)
-                                       {return detail::remove_all(p, &ec);}
-  inline
-  void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
-
-  inline
-  void rename(const path& old_p, const path& new_p, system::error_code& ec)
-                                       {detail::rename(old_p, new_p, &ec);}
-  inline  // name suggested by Scott McMurray
-  void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
-
-  inline
-  void resize_file(const path& p, uintmax_t size, system::error_code& ec)
-                                       {detail::resize_file(p, size, &ec);}
-  inline
-  space_info space(const path& p)      {return detail::space(p);} 
-
-  inline
-  space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} 
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  inline bool symbolic_link_exists(const path& p)
-                                       { return is_symlink(symlink_status(p)); }
-# endif
-
-  inline
-  path system_complete(const path& p)  {return detail::system_complete(p);}
-
-  inline
-  path system_complete(const path& p, system::error_code& ec)
-                                       {return detail::system_complete(p, &ec);}
-  inline
-  path temp_directory_path()           {return detail::temp_directory_path();}
-
-  inline
-  path temp_directory_path(system::error_code& ec) 
-                                       {return detail::temp_directory_path(&ec);}
-  inline
-  path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
-                                       { return detail::unique_path(p); }
-  inline
-  path unique_path(const path& p, system::error_code& ec)
-                                       { return detail::unique_path(p, &ec); }
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                                 directory_entry                                      //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-//  GCC has a problem with a member function named path within a namespace or 
-//  sub-namespace that also has a class named path. The workaround is to always
-//  fully qualify the name path when it refers to the class name.
-
-class BOOST_FILESYSTEM_DECL directory_entry
-{
-public:
-
-  // compiler generated copy constructor, copy assignment, and destructor apply
-
-  directory_entry() {}
-  explicit directory_entry(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st=file_status())
-    : m_path(p), m_status(st), m_symlink_status(symlink_st)
-    {}
-
-  void assign(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st = file_status())
-    { m_path = p; m_status = st; m_symlink_status = symlink_st; }
-
-  void replace_filename(const boost::filesystem::path& p,
-    file_status st = file_status(), file_status symlink_st = file_status())
-  {
-    m_path.remove_filename();
-    m_path /= p;
-    m_status = st;
-    m_symlink_status = symlink_st;
-  }
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  void replace_leaf(const boost::filesystem::path& p,
-    file_status st, file_status symlink_st)
-      { replace_filename(p, st, symlink_st); }
-# endif
-
-  const boost::filesystem::path&  path() const               {return m_path;}
-  file_status   status() const                               {return m_get_status();}
-  file_status   status(system::error_code& ec) const         {return m_get_status(&ec);}
-  file_status   symlink_status() const                       {return m_get_symlink_status();}
-  file_status   symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
-
-  bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} 
-  bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} 
-  bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} 
-  bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} 
-  bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} 
-  bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} 
-
-private:
-  boost::filesystem::path   m_path;
-  mutable file_status       m_status;           // stat()-like
-  mutable file_status       m_symlink_status;   // lstat()-like
-
-  file_status m_get_status(system::error_code* ec=0) const;
-  file_status m_get_symlink_status(system::error_code* ec=0) const;
-}; // directory_entry
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                            directory_iterator helpers                                //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-class directory_iterator;
-
-namespace detail
-{
-  BOOST_FILESYSTEM_DECL
-    system::error_code dir_itr_close(// never throws()
-    void *& handle
-#   if     defined(BOOST_POSIX_API)
-    , void *& buffer
-#   endif
-  ); 
-
-  struct dir_itr_imp
-  {
-    directory_entry  dir_entry;
-    void*            handle;
-
-#   ifdef BOOST_POSIX_API
-    void*            buffer;  // see dir_itr_increment implementation
-#   endif
-
-    dir_itr_imp() : handle(0)
-#   ifdef BOOST_POSIX_API
-      , buffer(0)
-#   endif
-    {}
-
-    ~dir_itr_imp() // never throws
-    {
-      dir_itr_close(handle
-#       if defined(BOOST_POSIX_API)
-         , buffer
-#       endif
-    );
-    }
-  };
-
-  // see path::iterator: comment below
-  BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it,
-    const path& p, system::error_code* ec);
-  BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it,
-    system::error_code* ec);
-
-}  // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                                directory_iterator                                    //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  class directory_iterator
-    : public boost::iterator_facade< directory_iterator,
-                                     directory_entry,
-                                     boost::single_pass_traversal_tag >
-  {
-  public:
-
-    directory_iterator(){}  // creates the "end" iterator
-
-    // iterator_facade derived classes don't seem to like implementations in
-    // separate translation unit dll's, so forward to detail functions
-    explicit directory_iterator(const path& p)
-        : m_imp(new detail::dir_itr_imp)
-          { detail::directory_iterator_construct(*this, p, 0); }
-
-    directory_iterator(const path& p, system::error_code& ec)
-        : m_imp(new detail::dir_itr_imp)
-          { detail::directory_iterator_construct(*this, p, &ec); }
-
-   ~directory_iterator() {} // never throws
-
-    directory_iterator& increment(system::error_code& ec)
-    { 
-      detail::directory_iterator_increment(*this, &ec);
-      return *this;
-    }
-
-  private:
-    friend struct detail::dir_itr_imp;
-    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it,
-      const path& p, system::error_code* ec);
-    friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
-      system::error_code* ec);
-
-    // shared_ptr provides shallow-copy semantics required for InputIterators.
-    // m_imp.get()==0 indicates the end iterator.
-    boost::shared_ptr< detail::dir_itr_imp >  m_imp;
-
-    friend class boost::iterator_core_access;
-
-    boost::iterator_facade<
-      directory_iterator,
-      directory_entry,
-      boost::single_pass_traversal_tag >::reference dereference() const 
-    {
-      BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
-      return m_imp->dir_entry;
-    }
-
-    void increment() { detail::directory_iterator_increment(*this, 0); }
-
-    bool equal(const directory_iterator& rhs) const
-      { return m_imp == rhs.m_imp; }
-  };
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                      recursive_directory_iterator helpers                            //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  BOOST_SCOPED_ENUM_START(symlink_option)
-  {
-    none,
-    no_recurse = none,         // don't follow directory symlinks (default behavior)
-    recurse,                   // follow directory symlinks
-    _detail_no_push = recurse << 1  // internal use only
-  };
-  BOOST_SCOPED_ENUM_END
-
-  BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option))
-
-  namespace detail
-  {
-    struct recur_dir_itr_imp
-    {
-      typedef directory_iterator element_type;
-      std::stack< element_type, std::vector< element_type > > m_stack;
-      int  m_level;
-      BOOST_SCOPED_ENUM(symlink_option) m_options;
-
-      recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {}
-
-      void increment(system::error_code* ec);  // ec == 0 means throw on error
-
-      void pop();
-
-    };
-
-    //  Implementation is inline to avoid dynamic linking difficulties with m_stack:
-    //  Microsoft warning C4251, m_stack needs to have dll-interface to be used by
-    //  clients of struct 'boost::filesystem::detail::recur_dir_itr_imp'
-
-    inline
-    void recur_dir_itr_imp::increment(system::error_code* ec)
-    // ec == 0 means throw on error
-    {
-      if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
-        m_options &= ~symlink_option::_detail_no_push;
-
-      else
-      {
-        // Logic for following predicate was contributed by Daniel Aarno to handle cyclic
-        // symlinks correctly and efficiently, fixing ticket #5652.
-        //   if (((m_options & symlink_option::recurse) == symlink_option::recurse
-        //         || !is_symlink(m_stack.top()->symlink_status()))
-        //       && is_directory(m_stack.top()->status())) ...
-        // The predicate code has since been rewritten to pass error_code arguments,
-        // per ticket #5653.
-        bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
-                       || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
-                                   : !is_symlink(m_stack.top()->symlink_status(*ec)));
-        if (ec != 0 && *ec)
-          return;
-        bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
-                                            : is_directory(m_stack.top()->status(*ec)));
-        if (ec != 0 && *ec)
-          return;
-
-        if (and_pred)
-        {
-          if (ec == 0)
-            m_stack.push(directory_iterator(m_stack.top()->path()));
-          else
-          {
-            m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
-            if (*ec)
-              return;
-          }
-          if (m_stack.top() != directory_iterator())
-          {
-            ++m_level;
-            return;
-          }
-          m_stack.pop();
-        }
-      }
-
-      while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
-      {
-        m_stack.pop();
-        --m_level;
-      }
-    }
-
-    inline
-    void recur_dir_itr_imp::pop()
-    {
-      BOOST_ASSERT_MSG(m_level > 0,
-        "pop() on recursive_directory_iterator with level < 1");
-
-      do
-      {
-        m_stack.pop();
-        --m_level;
-      }
-      while (!m_stack.empty() && ++m_stack.top() == directory_iterator());
-    }
-  } // namespace detail
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                           recursive_directory_iterator                               //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-
-  class recursive_directory_iterator
-    : public boost::iterator_facade<
-        recursive_directory_iterator,
-        directory_entry,
-        boost::single_pass_traversal_tag >
-  {
-  public:
-
-    recursive_directory_iterator(){}  // creates the "end" iterator
-
-    explicit recursive_directory_iterator(const path& dir_path,
-      BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none)
-      : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = opt;
-      m_imp->m_stack.push(directory_iterator(dir_path));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator(const path& dir_path,
-      BOOST_SCOPED_ENUM(symlink_option) opt,
-      system::error_code & ec)
-    : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = opt;
-      m_imp->m_stack.push(directory_iterator(dir_path, ec));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator(const path& dir_path,
-      system::error_code & ec)
-    : m_imp(new detail::recur_dir_itr_imp)
-    {
-      m_imp->m_options = symlink_option::none;
-      m_imp->m_stack.push(directory_iterator(dir_path, ec));
-      if (m_imp->m_stack.top() == directory_iterator())
-        { m_imp.reset (); }
-    }
-
-    recursive_directory_iterator& increment(system::error_code& ec)
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "increment() on end recursive_directory_iterator");
-      m_imp->increment(&ec);
-      if (m_imp->m_stack.empty())
-        m_imp.reset(); // done, so make end iterator
-      return *this;
-    }
-
-    int level() const
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "level() on end recursive_directory_iterator");
-      return m_imp->m_level;
-    }
-
-    bool no_push_pending() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "is_no_push_requested() on end recursive_directory_iterator");
-      return (m_imp->m_options & symlink_option::_detail_no_push)
-        == symlink_option::_detail_no_push;
-    }
-
-#   ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    bool no_push_request() const { return no_push_pending(); }
-#   endif
-
-    void pop()
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "pop() on end recursive_directory_iterator");
-      m_imp->pop();
-      if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
-    }
-
-    void no_push(bool value=true)
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "no_push() on end recursive_directory_iterator");
-      if (value)
-        m_imp->m_options |= symlink_option::_detail_no_push;
-      else
-        m_imp->m_options &= ~symlink_option::_detail_no_push;
-    }
-
-    file_status status() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "status() on end recursive_directory_iterator");
-      return m_imp->m_stack.top()->status();
-    }
-
-    file_status symlink_status() const
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "symlink_status() on end recursive_directory_iterator");
-      return m_imp->m_stack.top()->symlink_status();
-    }
-
-  private:
-
-    // shared_ptr provides shallow-copy semantics required for InputIterators.
-    // m_imp.get()==0 indicates the end iterator.
-    boost::shared_ptr< detail::recur_dir_itr_imp >  m_imp;
-
-    friend class boost::iterator_core_access;
-
-    boost::iterator_facade< 
-      recursive_directory_iterator,
-      directory_entry,
-      boost::single_pass_traversal_tag >::reference
-    dereference() const 
-    {
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "dereference of end recursive_directory_iterator");
-      return *m_imp->m_stack.top();
-    }
-
-    void increment()
-    { 
-      BOOST_ASSERT_MSG(m_imp.get(),
-        "increment of end recursive_directory_iterator");
-      m_imp->increment(0);
-      if (m_imp->m_stack.empty())
-        m_imp.reset(); // done, so make end iterator
-    }
-
-    bool equal(const recursive_directory_iterator& rhs) const
-      { return m_imp == rhs.m_imp; }
-
-  };
-
-# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-  typedef recursive_directory_iterator wrecursive_directory_iterator;
-# endif
-
-//--------------------------------------------------------------------------------------//
-//                                                                                      //
-//                            class filesystem_error                                    //
-//                                                                                      //
-//--------------------------------------------------------------------------------------//
-  
-  class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
-  {
-  // see http://www.boost.org/more/error_handling.html for design rationale
-
-  // all functions are inline to avoid issues with crossing dll boundaries
-
-  public:
-    // compiler generates copy constructor and copy assignment
-
-    filesystem_error(
-      const std::string & what_arg, system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    filesystem_error(
-      const std::string & what_arg, const path& path1_arg,
-      system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-        m_imp_ptr->m_path1 = path1_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-    
-    filesystem_error(
-      const std::string & what_arg, const path& path1_arg,
-      const path& path2_arg, system::error_code ec)
-      : system::system_error(ec, what_arg)
-    {
-      try
-      {
-        m_imp_ptr.reset(new m_imp);
-        m_imp_ptr->m_path1 = path1_arg;
-        m_imp_ptr->m_path2 = path2_arg;
-      }
-      catch (...) { m_imp_ptr.reset(); }
-    }
-
-    ~filesystem_error() throw() {}
-
-    const path& path1() const
-    {
-      static const path empty_path;
-      return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
-    }
-    const path& path2() const
-    {
-      static const path empty_path;
-      return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
-    }
-
-    const char* what() const throw()
-    {
-      if (!m_imp_ptr.get())
-        return system::system_error::what();
-
-      try
-      {
-        if (m_imp_ptr->m_what.empty())
-        {
-          m_imp_ptr->m_what = system::system_error::what();
-          if (!m_imp_ptr->m_path1.empty())
-          {
-            m_imp_ptr->m_what += ": \"";
-            m_imp_ptr->m_what += m_imp_ptr->m_path1.string();
-            m_imp_ptr->m_what += "\"";
-          }
-          if (!m_imp_ptr->m_path2.empty())
-          {
-            m_imp_ptr->m_what += ", \"";
-            m_imp_ptr->m_what += m_imp_ptr->m_path2.string();
-            m_imp_ptr->m_what += "\"";
-          }
-        }
-        return m_imp_ptr->m_what.c_str();
-      }
-      catch (...)
-      {
-        return system::system_error::what();
-      }
-    }
-
-  private:
-    struct m_imp
-    {
-      path         m_path1; // may be empty()
-      path         m_path2; // may be empty()
-      std::string  m_what;  // not built until needed
-    };
-    boost::shared_ptr m_imp_ptr;
-  };
-
-//  test helper  -----------------------------------------------------------------------//
-
-//  Not part of the documented interface since false positives are possible;
-//  there is no law that says that an OS that has large stat.st_size
-//  actually supports large file sizes.
-
-  namespace detail
-  {
-    BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
-  }
-
-  } // namespace filesystem3
-} // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    // permissions
-    using filesystem3::no_perms;
-    using filesystem3::owner_read;
-    using filesystem3::owner_write;
-    using filesystem3::owner_exe;
-    using filesystem3::owner_all;
-    using filesystem3::group_read;
-    using filesystem3::group_write;
-    using filesystem3::group_exe;
-    using filesystem3::group_all;
-    using filesystem3::others_read;
-    using filesystem3::others_write;
-    using filesystem3::others_exe;
-    using filesystem3::others_all;
-    using filesystem3::all_all;
-    using filesystem3::set_uid_on_exe;
-    using filesystem3::set_gid_on_exe;
-    using filesystem3::sticky_bit;
-    using filesystem3::perms_mask;
-    using filesystem3::perms_not_known;
-    using filesystem3::add_perms;
-    using filesystem3::remove_perms;
-    using filesystem3::symlink_perms;
-
-    using filesystem3::absolute;
-    using filesystem3::block_file;
-    using filesystem3::canonical;
-    using filesystem3::character_file;
-//    using filesystem3::copy;
-    using filesystem3::copy_file;
-    using filesystem3::copy_option;
-    using filesystem3::copy_symlink;
-    using filesystem3::create_directories;
-    using filesystem3::create_directory;
-    using filesystem3::create_hard_link;
-    using filesystem3::create_symlink;
-    using filesystem3::create_directory_symlink;
-    using filesystem3::current_path;
-    using filesystem3::directory_entry;
-    using filesystem3::directory_file;
-    using filesystem3::directory_iterator;
-    using filesystem3::equivalent;
-    using filesystem3::exists;
-    using filesystem3::fifo_file;
-    using filesystem3::file_not_found;
-    using filesystem3::file_size;
-    using filesystem3::file_status;
-    using filesystem3::file_type;
-    using filesystem3::filesystem_error;
-    using filesystem3::hard_link_count;
-    using filesystem3::initial_path;
-    using filesystem3::is_directory;
-    using filesystem3::is_directory;
-    using filesystem3::is_empty;
-    using filesystem3::is_other;
-    using filesystem3::is_regular_file;
-    using filesystem3::is_symlink;
-    using filesystem3::last_write_time;
-    using filesystem3::permissions;
-    using filesystem3::permissions_present;
-    using filesystem3::perms;
-    using filesystem3::read_symlink;
-    using filesystem3::recursive_directory_iterator;
-    using filesystem3::regular_file;
-    using filesystem3::reparse_file;
-    using filesystem3::remove;
-    using filesystem3::remove_all;
-    using filesystem3::rename;
-    using filesystem3::resize_file;
-    using filesystem3::socket_file;
-    using filesystem3::space;
-    using filesystem3::space_info;
-    using filesystem3::status;
-    using filesystem3::status_error;
-    using filesystem3::status_known;
-    using filesystem3::symlink_file;
-    using filesystem3::symlink_option;
-    using filesystem3::symlink_status;
-    using filesystem3::system_complete;
-    using filesystem3::temp_directory_path;
-    using filesystem3::type_present;
-    using filesystem3::type_unknown;
-    using filesystem3::unique_path;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::is_regular;
-    using filesystem3::status_unknown;
-    using filesystem3::symbolic_link_exists;
-    //using filesystem3::wdirectory_iterator;
-    //using filesystem3::wdirectory_entry;
-# endif
-    namespace detail
-    {
-      using filesystem3::detail::possible_large_file_size_support;
-    }
-  }
-}
-
-#include  // pops abi_prefix.hpp pragmas
-#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP
diff --git a/project/jni/boost/include/boost/filesystem/v3/path.hpp b/project/jni/boost/include/boost/filesystem/v3/path.hpp
deleted file mode 100644
index c483671d0..000000000
--- a/project/jni/boost/include/boost/filesystem/v3/path.hpp
+++ /dev/null
@@ -1,760 +0,0 @@
-//  filesystem path.hpp  ---------------------------------------------------------------//
-
-//  Copyright Beman Dawes 2002-2005, 2009
-//  Copyright Vladimir Prus 2002
-
-//  Distributed under the Boost Software License, Version 1.0.
-//  See http://www.boost.org/LICENSE_1_0.txt
-
-//  Library home page: http://www.boost.org/libs/filesystem
-
-//  path::stem(), extension(), and replace_extension() are based on
-//  basename(), extension(), and change_extension() from the original
-//  filesystem/convenience.hpp header by Vladimir Prus.
-
-#ifndef BOOST_FILESYSTEM_PATH_HPP
-#define BOOST_FILESYSTEM_PATH_HPP
-
-#include 
-
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
-#include 
-#include   // includes 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include  // must be the last #include
-
-namespace boost
-{
-namespace filesystem3
-{
-  //------------------------------------------------------------------------------------//
-  //                                                                                    //
-  //                                    class path                                      //
-  //                                                                                    //
-  //------------------------------------------------------------------------------------//
-
-  class BOOST_FILESYSTEM_DECL path
-  {
-  public:
-
-    //  value_type is the character type used by the operating system API to
-    //  represent paths.
-
-#   ifdef BOOST_WINDOWS_API
-    typedef wchar_t                                     value_type;
-#   else 
-    typedef char                                        value_type;
-#   endif
-    typedef std::basic_string               string_type;  
-    typedef std::codecvt codecvt_type;
-
-
-    //  ----- character encoding conversions -----
-
-    //  Following the principle of least astonishment, path input arguments
-    //  passed to or obtained from the operating system via objects of
-    //  class path behave as if they were directly passed to or
-    //  obtained from the O/S API, unless conversion is explicitly requested.
-    //
-    //  POSIX specfies that path strings are passed unchanged to and from the
-    //  API. Note that this is different from the POSIX command line utilities,
-    //  which convert according to a locale.
-    //
-    //  Thus for POSIX, char strings do not undergo conversion.  wchar_t strings
-    //  are converted to/from char using the path locale or, if a conversion
-    //  argument is given, using a conversion object modeled on
-    //  std::wstring_convert.
-    //
-    //  The path locale, which is global to the thread, can be changed by the
-    //  imbue() function. It is initialized to an implementation defined locale.
-    //  
-    //  For Windows, wchar_t strings do not undergo conversion. char strings
-    //  are converted using the "ANSI" or "OEM" code pages, as determined by
-    //  the AreFileApisANSI() function, or, if a conversion argument is given,
-    //  using a conversion object modeled on std::wstring_convert.
-    //
-    //  See m_pathname comments for further important rationale.
-
-    //  TODO: rules needed for operating systems that use / or .
-    //  differently, or format directory paths differently from file paths. 
-    //
-    //  **********************************************************************************
-    //
-    //  More work needed: How to handle an operating system that may have
-    //  slash characters or dot characters in valid filenames, either because
-    //  it doesn't follow the POSIX standard, or because it allows MBCS
-    //  filename encodings that may contain slash or dot characters. For
-    //  example, ISO/IEC 2022 (JIS) encoding which allows switching to
-    //  JIS x0208-1983 encoding. A valid filename in this set of encodings is
-    //  0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU]
-    //                                             ^^^^
-    //  Note that 0x2F is the ASCII slash character
-    //
-    //  **********************************************************************************
-
-    //  Supported source arguments: half-open iterator range, container, c-array,
-    //  and single pointer to null terminated string.
-
-    //  All source arguments except pointers to null terminated byte strings support
-    //  multi-byte character strings which may have embedded nulls. Embedded null
-    //  support is required for some Asian languages on Windows.
-
-    //  [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used
-    //  because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults
-    //  correctly in templates.
-
-    //  -----  constructors  -----
-
-    path(){}                                          
-
-    path(const path& p) : m_pathname(p.m_pathname) {}
-
-    template 
-    path(Source const& source,
-      typename boost::enable_if::type> >::type* =0)
-    {
-      path_traits::dispatch(source, m_pathname, codecvt());
-    }
-
-    //  Overloads for the operating system API's native character type. Rationale:
-    //    - Avoids use of codecvt() for native value_type strings. This limits the
-    //      impact of locale("") initialization failures on POSIX systems to programs
-    //      that actually depend on locale(""). It further ensures that exceptions thrown
-    //      as a result of such failues occur after main() has started, so can be caught.
-    //      This is a partial resolution of tickets 4688, 5100, and 5289.
-    //    - A slight optimization for a common use case, particularly on POSIX since
-    //      value_type is char and that is the most common useage.
-    path(const value_type* s) : m_pathname(s) {}
-    path(const std::basic_string& s) : m_pathname(s) {}
-
-    template 
-    path(Source const& source, const codecvt_type& cvt)
-    //  see [defaults] note above explaining why codecvt() default arguments are not used
-    {
-      path_traits::dispatch(source, m_pathname, cvt);
-    }
-
-    template 
-    path(InputIterator begin, InputIterator end)
-    { 
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt());
-      }
-    }
-
-    template 
-    path(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-    { 
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-      }
-    }
-
-    //  -----  assignments  -----
-
-    path& operator=(const path& p)
-    {
-      m_pathname = p.m_pathname;
-      return *this;
-    }
-
-    path& operator=(const value_type* ptr)  // required in case ptr overlaps *this
-    {
-      m_pathname = ptr;
-      return *this;
-    }
-
-    template 
-      typename boost::enable_if::type>, path&>::type
-    operator=(Source const& source)
-    {
-      m_pathname.clear();
-      path_traits::dispatch(source, m_pathname, codecvt());
-      return *this;
-    }
-
-    path& assign(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
-    {
-      m_pathname = ptr;
-      return *this;
-    }
-
-    template 
-    path& assign(Source const& source, const codecvt_type& cvt)
-    {
-      m_pathname.clear();
-      path_traits::dispatch(source, m_pathname, cvt);
-      return *this;
-    }
-
-    template 
-    path& assign(InputIterator begin, InputIterator end)
-    {
-      return assign(begin, end, codecvt());
-    }
-
-    template 
-    path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-    { 
-      m_pathname.clear();
-      if (begin != end)
-      {
-        std::basic_string::value_type>
-          s(begin, end);
-        path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-      }
-      return *this;
-    }
-
-    //  -----  appends  -----
-
-    //  if a separator is added, it is the preferred separator for the platform;
-    //  slash for POSIX, backslash for Windows
-
-    path& operator/=(const path& p);
-
-    path& operator/=(const value_type* ptr);
-
-    template 
-      typename boost::enable_if::type>, path&>::type
-    operator/=(Source const& source)
-    {
-      return append(source, codecvt());
-    }
-
-    path& append(const value_type* ptr, const codecvt_type&)  // required in case ptr overlaps *this
-    {
-      this->operator/=(ptr);
-      return *this;
-    }
-
-    template 
-    path& append(Source const& source, const codecvt_type& cvt);
-
-    template 
-    path& append(InputIterator begin, InputIterator end)
-    { 
-      return append(begin, end, codecvt());
-    }
-
-    template 
-    path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
-
-    //  -----  modifiers  -----
-
-    void   clear()             { m_pathname.clear(); }
-    path&  make_preferred()
-#   ifdef BOOST_POSIX_API
-      { return *this; }  // POSIX no effect
-#   else // BOOST_WINDOWS_API
-      ;  // change slashes to backslashes
-#   endif
-    path&  remove_filename();
-    path&  replace_extension(const path& new_extension = path());
-    void   swap(path& rhs)     { m_pathname.swap(rhs.m_pathname); }
-
-    //  -----  observers  -----
-  
-    //  For operating systems that format file paths differently than directory
-    //  paths, return values from observers are formatted as file names unless there
-    //  is a trailing separator, in which case returns are formatted as directory
-    //  paths. POSIX and Windows make no such distinction.
-
-    //  Implementations are permitted to return const values or const references.
-
-    //  The string or path returned by an observer are specified as being formatted
-    //  as "native" or "generic".
-    //
-    //  For POSIX, these are all the same format; slashes and backslashes are as input and
-    //  are not modified.
-    //
-    //  For Windows,   native:    as input; slashes and backslashes are not modified;
-    //                            this is the format of the internally stored string.
-    //                 generic:   backslashes are converted to slashes
-
-    //  -----  native format observers  -----
-
-    const string_type&  native() const { return m_pathname; }          // Throws: nothing
-    const value_type*   c_str() const  { return m_pathname.c_str(); }  // Throws: nothing
-
-    template 
-    String string() const;
-
-    template 
-    String string(const codecvt_type& cvt) const;
-
-#   ifdef BOOST_WINDOWS_API
-    const std::string string() const { return string(codecvt()); } 
-    const std::string string(const codecvt_type& cvt) const
-    { 
-      std::string tmp;
-      if (!m_pathname.empty())
-        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
-          tmp, cvt);
-      return tmp;
-    }
-    
-    //  string_type is std::wstring, so there is no conversion
-    const std::wstring&  wstring() const { return m_pathname; }
-    const std::wstring&  wstring(const codecvt_type&) const { return m_pathname; }
-
-#   else   // BOOST_POSIX_API
-    //  string_type is std::string, so there is no conversion
-    const std::string&  string() const { return m_pathname; }
-    const std::string&  string(const codecvt_type&) const { return m_pathname; }
-
-    const std::wstring  wstring() const { return wstring(codecvt()); }
-    const std::wstring  wstring(const codecvt_type& cvt) const
-    { 
-      std::wstring tmp;
-      if (!m_pathname.empty())
-        path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
-          tmp, cvt);
-      return tmp;
-    }
-
-#   endif
-
-    //  -----  generic format observers  -----
-
-    template 
-    String generic_string() const;
-
-    template 
-    String generic_string(const codecvt_type& cvt) const;
-
-#   ifdef BOOST_WINDOWS_API
-    const std::string   generic_string() const { return generic_string(codecvt()); } 
-    const std::string   generic_string(const codecvt_type& cvt) const; 
-    const std::wstring  generic_wstring() const;
-    const std::wstring  generic_wstring(const codecvt_type&) const { return generic_wstring(); };
-
-#   else // BOOST_POSIX_API
-    //  On POSIX-like systems, the generic format is the same as the native format
-    const std::string&  generic_string() const  { return m_pathname; }
-    const std::string&  generic_string(const codecvt_type&) const  { return m_pathname; }
-    const std::wstring  generic_wstring() const { return wstring(codecvt()); }
-    const std::wstring  generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); }
-
-#   endif
-
-    //  -----  decomposition  -----
-
-    path  root_path() const; 
-    path  root_name() const;         // returns 0 or 1 element path
-                                     // even on POSIX, root_name() is non-empty() for network paths
-    path  root_directory() const;    // returns 0 or 1 element path
-    path  relative_path() const;
-    path  parent_path() const;
-    path  filename() const;          // returns 0 or 1 element path
-    path  stem() const;              // returns 0 or 1 element path
-    path  extension() const;         // returns 0 or 1 element path
-
-    //  -----  query  -----
-
-    bool empty() const               { return m_pathname.empty(); } // name consistent with std containers
-    bool has_root_path() const       { return has_root_directory() || has_root_name(); }
-    bool has_root_name() const       { return !root_name().empty(); }
-    bool has_root_directory() const  { return !root_directory().empty(); }
-    bool has_relative_path() const   { return !relative_path().empty(); }
-    bool has_parent_path() const     { return !parent_path().empty(); }
-    bool has_filename() const        { return !m_pathname.empty(); }
-    bool has_stem() const            { return !stem().empty(); }
-    bool has_extension() const       { return !extension().empty(); }
-    bool is_absolute() const
-    {
-#     ifdef BOOST_WINDOWS_API
-      return has_root_name() && has_root_directory();
-#     else
-      return has_root_directory();
-#     endif
-    }
-    bool is_relative() const         { return !is_absolute(); } 
-
-    //  -----  iterators  -----
-
-    class iterator;
-    typedef iterator const_iterator;
-
-    iterator begin() const;
-    iterator end() const;
-
-    //  -----  static members  -----
-
-    //  -----  imbue  -----
-
-    static std::locale imbue(const std::locale& loc);
-
-    //  -----  codecvt  -----
-
-    static const codecvt_type& codecvt()
-    {
-      return *wchar_t_codecvt_facet();
-    }
-
-    //  -----  deprecated functions  -----
-
-# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-#   error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
-# endif
-
-# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
-    //  recently deprecated functions supplied by default
-    path&  normalize()              { return m_normalize(); }
-    path&  remove_leaf()            { return remove_filename(); }
-    path   leaf() const             { return filename(); }
-    path   branch_path() const      { return parent_path(); }
-    bool   has_leaf() const         { return !m_pathname.empty(); }
-    bool   has_branch_path() const  { return !parent_path().empty(); }
-    bool   is_complete() const      { return is_absolute(); }
-# endif
-
-# if defined(BOOST_FILESYSTEM_DEPRECATED)
-    //  deprecated functions with enough signature or semantic changes that they are
-    //  not supplied by default 
-    const std::string file_string() const               { return string(); }
-    const std::string directory_string() const          { return string(); }
-    const std::string native_file_string() const        { return string(); }
-    const std::string native_directory_string() const   { return string(); }
-    const string_type external_file_string() const      { return native(); }
-    const string_type external_directory_string() const { return native(); }
-
-    //  older functions no longer supported
-    //typedef bool (*name_check)(const std::string & name);
-    //basic_path(const string_type& str, name_check) { operator/=(str); }
-    //basic_path(const typename string_type::value_type* s, name_check)
-    //  { operator/=(s);}
-    //static bool default_name_check_writable() { return false; } 
-    //static void default_name_check(name_check) {}
-    //static name_check default_name_check() { return 0; }
-    //basic_path& canonize();
-# endif
-
-//--------------------------------------------------------------------------------------//
-//                            class path private members                                //
-//--------------------------------------------------------------------------------------//
-
-  private:
-#   if defined(_MSC_VER)
-#     pragma warning(push) // Save warning settings
-#     pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
-#   endif                            // needs to have dll-interface...
-/*
-      m_pathname has the type, encoding, and format required by the native
-      operating system. Thus for POSIX and Windows there is no conversion for
-      passing m_pathname.c_str() to the O/S API or when obtaining a path from the
-      O/S API. POSIX encoding is unspecified other than for dot and slash
-      characters; POSIX just treats paths as a sequence of bytes. Windows
-      encoding is UCS-2 or UTF-16 depending on the version.
-*/
-    string_type  m_pathname;  // Windows: as input; backslashes NOT converted to slashes,
-                              // slashes NOT converted to backslashes
-#   if defined(_MSC_VER)
-#     pragma warning(pop) // restore warning settings.
-#   endif 
-
-    string_type::size_type m_append_separator_if_needed();
-    //  Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0.
-    //  Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
-
-    void m_erase_redundant_separator(string_type::size_type sep_pos);
-    string_type::size_type m_parent_path_end() const;
-
-    path& m_normalize();
-
-    // Was qualified; como433beta8 reports:
-    //    warning #427-D: qualified name is not allowed in member declaration 
-    friend class iterator;
-    friend bool operator<(const path& lhs, const path& rhs);
-
-    // see path::iterator::increment/decrement comment below
-    static void m_path_iterator_increment(path::iterator & it);
-    static void m_path_iterator_decrement(path::iterator & it);
-
-    static const codecvt_type *&  wchar_t_codecvt_facet();
-
-  };  // class path
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-  typedef path wpath;
-# endif
-
-  //------------------------------------------------------------------------------------//
-  //                             class path::iterator                                   //
-  //------------------------------------------------------------------------------------//
- 
-  class path::iterator
-    : public boost::iterator_facade<
-      path::iterator,
-      path const,
-      boost::bidirectional_traversal_tag >
-  {
-  private:
-    friend class boost::iterator_core_access;
-    friend class boost::filesystem3::path;
-    friend void m_path_iterator_increment(path::iterator & it);
-    friend void m_path_iterator_decrement(path::iterator & it);
-
-    const path& dereference() const { return m_element; }
-
-    bool equal(const iterator & rhs) const
-    {
-      return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos;
-    }
-
-    // iterator_facade derived classes don't seem to like implementations in
-    // separate translation unit dll's, so forward to class path static members
-    void increment() { m_path_iterator_increment(*this); }
-    void decrement() { m_path_iterator_decrement(*this); }
-
-    path                    m_element;   // current element
-    const path *            m_path_ptr;  // path being iterated over
-    string_type::size_type  m_pos;       // position of name in
-                                         // m_path_ptr->m_pathname. The
-                                         // end() iterator is indicated by 
-                                         // m_pos == m_path_ptr->m_pathname.size()
-  }; // path::iterator
-
-  //------------------------------------------------------------------------------------//
-  //                                                                                    //
-  //                              non-member functions                                  //
-  //                                                                                    //
-  //------------------------------------------------------------------------------------//
-
-  //  std::lexicographical_compare would infinately recurse because path iterators
-  //  yield paths, so provide a path aware version
-  inline bool lexicographical_compare(path::iterator first1, path::iterator last1,
-    path::iterator first2, path::iterator last2)
-  {
-    for (; first1 != last1 && first2 != last2 ; ++first1, ++first2)
-    {
-      if (first1->native() < first2->native()) return true;
-      if (first2->native() < first1->native()) return false;
-    }
-    return first1 == last1 && first2 != last2;
-  }
-  
-  inline bool operator<(const path& lhs, const path& rhs)
-  {
-    return lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
-  }
-
-  inline bool operator<=(const path& lhs, const path& rhs) { return !(rhs < lhs); }
-  inline bool operator> (const path& lhs, const path& rhs) { return rhs < lhs; }
-  inline bool operator>=(const path& lhs, const path& rhs) { return !(lhs < rhs);  }
-
-  // equality operators act as if comparing generic format strings, to achieve the
-  // effect of lexicographical_compare element by element compare.
-  // operator==() efficiency is a concern; a user reported the original version 2
-  // !(lhs < rhs) && !(rhs < lhs) implementation caused a serious performance problem
-  // for a map of 10,000 paths.
-
-# ifdef BOOST_WINDOWS_API
-  inline bool operator==(const path& lhs, const path::value_type* rhs)
-  {
-    const path::value_type* l(lhs.c_str());
-    while ((*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'))
-      && *l) { ++l; ++rhs; }
-    return *l == *rhs;
-  }
-  inline bool operator==(const path& lhs, const path& rhs)              { return lhs == rhs.c_str(); }
-  inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs == rhs.c_str(); }
-  inline bool operator==(const path::string_type& lhs, const path& rhs) { return rhs == lhs.c_str(); }
-  inline bool operator==(const path::value_type* lhs, const path& rhs)  { return rhs == lhs; }
-
-  inline std::size_t hash_value(const path& x)
-  {
-    std::size_t seed = 0;
-    for(const path::value_type* it = x.c_str(); *it; ++it)
-      hash_combine(seed, *it == '/' ? L'\\' : *it);
-    return seed;
-  }
-# else   // BOOST_POSIX_API
-  inline bool operator==(const path& lhs, const path& rhs)              { return lhs.native() == rhs.native(); }
-  inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs.native() == rhs; }
-  inline bool operator==(const path& lhs, const path::value_type* rhs)  { return lhs.native() == rhs; }
-  inline bool operator==(const path::string_type& lhs, const path& rhs) { return lhs == rhs.native(); }
-  inline bool operator==(const path::value_type* lhs, const path& rhs)  { return lhs == rhs.native(); }
-
-  inline std::size_t hash_value(const path& x)
-  {
-    return hash_range(x.native().begin(), x.native().end());
-  }
-# endif
-
-  inline bool operator!=(const path& lhs, const path& rhs)              { return !(lhs == rhs); }
-  inline bool operator!=(const path& lhs, const path::string_type& rhs) { return !(lhs == rhs); }
-  inline bool operator!=(const path& lhs, const path::value_type* rhs)  { return !(lhs == rhs); }
-  inline bool operator!=(const path::string_type& lhs, const path& rhs) { return !(lhs == rhs); }
-  inline bool operator!=(const path::value_type* lhs, const path& rhs)  { return !(lhs == rhs); }
-
-  inline void swap(path& lhs, path& rhs)                   { lhs.swap(rhs); }
-
-  inline path operator/(const path& lhs, const path& rhs)  { return path(lhs) /= rhs; }
-
-  //  inserters and extractors
-  //    use boost::io::quoted() to handle spaces in paths
-  //    use '&' as escape character to ease use for Windows paths
-
-  template 
-  inline std::basic_ostream&
-  operator<<(std::basic_ostream& os, const path& p)
-  {
-    return os
-      << boost::io::quoted(p.template string >(), static_cast('&'));
-  }
-  
-  template 
-  inline std::basic_istream&
-  operator>>(std::basic_istream& is, path& p)
-  {
-    std::basic_string str;
-    is >> boost::io::quoted(str, static_cast('&'));
-    p = str;
-    return is;
-  }
-  
-  //  name_checks
-
-  //  These functions are holdovers from version 1. It isn't clear they have much
-  //  usefulness, or how to generalize them for later versions.
-
-  BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
-  BOOST_FILESYSTEM_DECL bool native(const std::string & name);
- 
-//--------------------------------------------------------------------------------------//
-//                     class path member template implementation                        //
-//--------------------------------------------------------------------------------------//
-
-  template 
-  path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt)
-  { 
-    if (begin == end)
-      return *this;
-    string_type::size_type sep_pos(m_append_separator_if_needed());
-    std::basic_string::value_type>
-      s(begin, end);
-    path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt);
-    if (sep_pos)
-      m_erase_redundant_separator(sep_pos);
-    return *this;
-  }
-
-  template 
-  path& path::append(Source const& source, const codecvt_type& cvt)
-  {
-    if (path_traits::empty(source))
-      return *this;
-      string_type::size_type sep_pos(m_append_separator_if_needed());
-      path_traits::dispatch(source, m_pathname, cvt);
-      if (sep_pos)
-        m_erase_redundant_separator(sep_pos);
-    return *this;
-  }
-
-//--------------------------------------------------------------------------------------//
-//                     class path member template specializations                       //
-//--------------------------------------------------------------------------------------//
-
-  template <> inline
-  std::string path::string() const
-    { return string(); }
-
-  template <> inline
-  std::wstring path::string() const
-    { return wstring(); }
-
-  template <> inline
-  std::string path::string(const codecvt_type& cvt) const
-    { return string(cvt); }
-
-  template <> inline
-  std::wstring path::string(const codecvt_type& cvt) const
-    { return wstring(cvt); }
-
-  template <> inline
-  std::string path::generic_string() const
-    { return generic_string(); }
-
-  template <> inline
-  std::wstring path::generic_string() const
-    { return generic_wstring(); }
-
-  template <> inline
-  std::string path::generic_string(const codecvt_type& cvt) const
-    { return generic_string(cvt); }
-
-  template <> inline
-  std::wstring path::generic_string(const codecvt_type& cvt) const
-    { return generic_wstring(cvt); }
-
-
-}  // namespace filesystem3
-}  // namespace boost
-
-//----------------------------------------------------------------------------//
-
-namespace boost
-{
-  namespace filesystem
-  {
-    using filesystem3::path;
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-    using filesystem3::wpath;
-# endif
-    using filesystem3::lexicographical_compare;
-    using filesystem3::portable_posix_name;
-    using filesystem3::windows_name;
-    using filesystem3::portable_name;
-    using filesystem3::portable_directory_name;
-    using filesystem3::portable_file_name;
-    using filesystem3::native;
-    using filesystem3::swap;
-    using filesystem3::operator<;
-    using filesystem3::operator==;
-    using filesystem3::operator!=;
-    using filesystem3::operator>;
-    using filesystem3::operator<=;
-    using filesystem3::operator>=;
-    using filesystem3::operator/;
-    using filesystem3::operator<<;
-    using filesystem3::operator>>;
-  }
-}
-
-//----------------------------------------------------------------------------//
-
-#include  // pops abi_prefix.hpp pragmas
-
-#endif  // BOOST_FILESYSTEM_PATH_HPP
diff --git a/project/jni/boost/include/boost/foreach.hpp b/project/jni/boost/include/boost/foreach.hpp
index ccfc101b8..33b59202d 100644
--- a/project/jni/boost/include/boost/foreach.hpp
+++ b/project/jni/boost/include/boost/foreach.hpp
@@ -31,7 +31,7 @@
 #include 
 
 // Some compilers let us detect even const-qualified rvalues at compile-time
-#if !defined(BOOST_NO_RVALUE_REFERENCES)                                                         \
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)                                                   \
  || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_)                                 \
  || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) &&       \
                                                                   !defined(BOOST_CLANG))         \
@@ -165,7 +165,7 @@ namespace foreach
 //   this one works on legacy compilers. Overload boost_foreach_is_lightweight_proxy
 //   at the global namespace for your type.
 template
-inline boost::BOOST_FOREACH::is_lightweight_proxy *
+inline boost::foreach::is_lightweight_proxy *
 boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; }
 
 template
@@ -190,7 +190,7 @@ boost_foreach_is_lightweight_proxy(T **&, boost::foreach::tag) { return 0; }
 //   this one works on legacy compilers. Overload boost_foreach_is_noncopyable
 //   at the global namespace for your type.
 template
-inline boost::BOOST_FOREACH::is_noncopyable *
+inline boost::foreach::is_noncopyable *
 boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; }
 
 namespace boost
@@ -228,7 +228,7 @@ template
 inline boost::mpl::true_ *is_const_(T const &) { return 0; }
 #endif
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
 template
 inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; }
 
@@ -437,7 +437,6 @@ inline T (*&to_ptr(T (&)[N]))[N]
     static T (*t)[N] = 0;
     return t;
 }
-#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 // derefof
@@ -454,8 +453,13 @@ inline T &derefof(T *t)
     );
 }
 
+# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T)
+#else
+# define BOOST_FOREACH_DEREFOF(T) (*T)
+#endif
+
 #if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION)                                  \
- && !defined(BOOST_NO_RVALUE_REFERENCES)
+ && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
 ///////////////////////////////////////////////////////////////////////////////
 // Rvalue references makes it drop-dead simple to detect at compile time
 // whether an expression is an rvalue.
@@ -465,7 +469,7 @@ inline T &derefof(T *t)
     boost::foreach_detail_::is_rvalue_((COL), 0)
 
 #elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION)                                \
- && defined(BOOST_NO_RVALUE_REFERENCES)
+ && defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
 ///////////////////////////////////////////////////////////////////////////////
 // Detect at compile-time whether an expression yields an rvalue or
 // an lvalue. This is rather non-standard, but some popular compilers
@@ -667,7 +671,7 @@ begin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::begin(derefof(auto_any_cast(col)))));
+        iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -707,7 +711,7 @@ end(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::end(derefof(auto_any_cast(col)))));
+        iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -786,7 +790,7 @@ rbegin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::rbegin(derefof(auto_any_cast(col)))));
+        iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -829,7 +833,7 @@ rend(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue
     typedef BOOST_DEDUCED_TYPENAME type2type::type type;
     typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator;
     return auto_any::type>(
-        iterator(boost::rend(derefof(auto_any_cast(col)))));
+        iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast(col))))));
 }
 
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -955,7 +959,7 @@ rderef(auto_any_t cur, type2type *)
     (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL))
 
 // The rvalue/lvalue-ness of the collection expression is determined dynamically, unless
-// type type is an array or is noncopyable or is non-const, in which case we know it's an lvalue.
+// the type is an array or is noncopyable or is non-const, in which case we know it's an lvalue.
 // If the type happens to be a lightweight proxy, always make a copy.
 # define BOOST_FOREACH_SHOULD_COPY(COL)                                                         \
     (boost::foreach_detail_::should_copy_impl(                                                  \
diff --git a/project/jni/boost/include/boost/foreach_fwd.hpp b/project/jni/boost/include/boost/foreach_fwd.hpp
index 8b246c78e..4e0bb370c 100644
--- a/project/jni/boost/include/boost/foreach_fwd.hpp
+++ b/project/jni/boost/include/boost/foreach_fwd.hpp
@@ -14,8 +14,6 @@
 #ifndef BOOST_FOREACH_FWD_HPP
 #define BOOST_FOREACH_FWD_HPP
 
-#include  // for std::pair
-
 // This must be at global scope, hence the uglified name
 enum boost_foreach_argument_dependent_lookup_hack
 {
@@ -27,9 +25,6 @@ namespace boost
 
 namespace foreach
 {
-    template
-    std::pair in_range(T begin, T end);
-
     ///////////////////////////////////////////////////////////////////////////////
     // boost::foreach::tag
     //
@@ -51,24 +46,6 @@ namespace foreach
 
 } // namespace foreach
 
-// Workaround for unfortunate https://svn.boost.org/trac/boost/ticket/6131
-namespace BOOST_FOREACH
-{
-    using foreach::in_range;
-    using foreach::tag;
-
-    template
-    struct is_lightweight_proxy
-      : foreach::is_lightweight_proxy
-    {};
-
-    template
-    struct is_noncopyable
-      : foreach::is_noncopyable
-    {};
-
-} // namespace BOOST_FOREACH
-
 } // namespace boost
 
 #endif
diff --git a/project/jni/boost/include/boost/function/function_template.hpp b/project/jni/boost/include/boost/function/function_template.hpp
index bf139a095..73ed72ef4 100644
--- a/project/jni/boost/include/boost/function/function_template.hpp
+++ b/project/jni/boost/include/boost/function/function_template.hpp
@@ -677,7 +677,7 @@ namespace boost {
 
     vtable_type* get_vtable() const {
       return reinterpret_cast(
-               reinterpret_cast(vtable) & ~static_cast(0x01));
+               reinterpret_cast(vtable) & ~static_cast(0x01));
     }
 
     struct clear_type {};
@@ -748,7 +748,14 @@ namespace boost {
     {
       this->assign_to_own(f);
     }
-
+    
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base()
+    {
+      this->move_assign(f);
+    }
+#endif
+    
     ~BOOST_FUNCTION_FUNCTION() { clear(); }
 
     result_type operator()(BOOST_FUNCTION_PARMS) const
@@ -830,6 +837,26 @@ namespace boost {
       BOOST_CATCH_END
       return *this;
     }
+    
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+    // Move assignment from another BOOST_FUNCTION_FUNCTION
+    BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f)
+    {
+      
+      if (&f == this)
+        return *this;
+
+      this->clear();
+      BOOST_TRY {
+        this->move_assign(f);
+      } BOOST_CATCH (...) {
+        vtable = 0;
+        BOOST_RETHROW;
+      }
+      BOOST_CATCH_END
+      return *this;
+    }
+#endif
 
     void swap(BOOST_FUNCTION_FUNCTION& other)
     {
@@ -1063,12 +1090,26 @@ public:
 
   function(const base_type& f) : base_type(static_cast(f)){}
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  // Move constructors
+  function(self_type&& f): base_type(static_cast(f)){}
+  function(base_type&& f): base_type(static_cast(f)){}
+#endif
+  
   self_type& operator=(const self_type& f)
   {
     self_type(f).swap(*this);
     return *this;
   }
 
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  self_type& operator=(self_type&& f)
+  {
+    self_type(static_cast(f)).swap(*this);
+    return *this;
+  }
+#endif  
+
   template
 #ifndef BOOST_NO_SFINAE
   typename enable_if_c<
@@ -1097,6 +1138,14 @@ public:
     self_type(f).swap(*this);
     return *this;
   }
+  
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  self_type& operator=(base_type&& f)
+  {
+    self_type(static_cast(f)).swap(*this);
+    return *this;
+  }
+#endif 
 };
 
 #undef BOOST_FUNCTION_PARTIAL_SPEC
diff --git a/project/jni/boost/include/boost/functional/detail/container_fwd.hpp b/project/jni/boost/include/boost/functional/detail/container_fwd.hpp
deleted file mode 100644
index 9a69d155b..000000000
--- a/project/jni/boost/include/boost/functional/detail/container_fwd.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-// Copyright 2005-2008 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// Forwarding header for container_fwd.hpp's new location.
-// This header is deprecated, I'll be adding a warning in a future release,
-// then converting it to an error and finally removing this header completely.
-
-#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)
-#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#include 
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp b/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
index ae03ff091..4b8374d47 100644
--- a/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
+++ b/project/jni/boost/include/boost/functional/hash/detail/float_functions.hpp
@@ -13,6 +13,94 @@
 # pragma once
 #endif
 
+// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have
+// sufficiently good floating point support to not require any
+// workarounds.
+//
+// When set to 0, the library tries to automatically
+// use the best available implementation. This normally works well, but
+// breaks when ambiguities are created by odd namespacing of the functions.
+//
+// Note that if this is set to 0, the library should still take full
+// advantage of the platform's floating point support.
+
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__LIBCOMO__)
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
+// Rogue Wave library:
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(_LIBCPP_VERSION)
+// libc++
+#   define BOOST_HASH_CONFORMANT_FLOATS 1
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+// GNU libstdc++ 3
+#   if defined(__GNUC__) && __GNUC__ >= 4
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#elif defined(__STL_CONFIG_H)
+// generic SGI STL
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__MSL_CPP__)
+// MSL standard lib:
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__IBMCPP__)
+// VACPP std lib (probably conformant for much earlier version).
+#   if __IBMCPP__ >= 1210
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#elif defined(MSIPL_COMPILE_H)
+// Modena C++ standard library
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+// Dinkumware Library (this has to appear after any possible replacement libraries):
+#   if _CPPLIB_VER >= 405
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#else
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#endif
+
+#if BOOST_HASH_CONFORMANT_FLOATS
+
+// The standard library is known to be compliant, so don't use the
+// configuration mechanism.
+
+namespace boost {
+    namespace hash_detail {
+        template 
+        struct call_ldexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int y) const {
+                return std::ldexp(x, y);
+            }
+        };
+
+        template 
+        struct call_frexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int* y) const {
+                return std::frexp(x, y);
+            }
+        };
+
+        template 
+        struct select_hash_type
+        {
+            typedef Float type;
+        };
+    }
+}
+
+#else // BOOST_HASH_CONFORMANT_FLOATS == 0
+
 // The C++ standard requires that the C float functions are overloarded
 // for float, double and long double in the std namespace, but some of the older
 // library implementations don't support this. On some that don't, the C99
@@ -243,4 +331,6 @@ namespace boost
     }
 }
 
+#endif // BOOST_HASH_CONFORMANT_FLOATS
+
 #endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
index ea1bc25f4..a98cd700f 100644
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
+++ b/project/jni/boost/include/boost/functional/hash/detail/hash_float.hpp
@@ -1,5 +1,5 @@
 
-// Copyright 2005-2009 Daniel James.
+// Copyright 2005-2012 Daniel James.
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -13,21 +13,19 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 
-// Include hash implementation for the current platform.
-
-// Cygwn
-#if defined(__CYGWIN__)
-#  if defined(__i386__) || defined(_M_IX86)
-#    include 
-#  else
-#    include 
-#  endif
-#else
-#  include 
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC >= 1400
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
+                              // not satisfy test. Loop body not executed
+#endif
 #endif
 
 // Can we use fpclassify?
@@ -50,6 +48,159 @@
 #  define BOOST_HASH_USE_FPCLASSIFY 0
 #endif
 
+namespace boost
+{
+    namespace hash_detail
+    {
+        inline void hash_float_combine(std::size_t& seed, std::size_t value)
+        {
+            seed ^= value + (seed<<6) + (seed>>2);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Binary hash function
+        //
+        // Only used for floats with known iec559 floats, and certain values in
+        // numeric_limits
+
+        inline std::size_t hash_binary(char* ptr, std::size_t length)
+        {
+            std::size_t seed = 0;
+
+            if (length >= sizeof(std::size_t)) {
+                seed = *(std::size_t*) ptr;
+                length -= sizeof(std::size_t);
+                ptr += sizeof(std::size_t);
+
+                while(length >= sizeof(std::size_t)) {
+                    std::size_t buffer = 0;
+                    std::memcpy(&buffer, ptr, sizeof(std::size_t));
+                    hash_float_combine(seed, buffer);
+                    length -= sizeof(std::size_t);
+                    ptr += sizeof(std::size_t);
+                }
+            }
+
+            if (length > 0) {
+                std::size_t buffer = 0;
+                std::memcpy(&buffer, ptr, length);
+                hash_float_combine(seed, buffer);
+            }
+
+            return seed;
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 24 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 128,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 4);
+        }
+
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 53 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 1024,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 8);
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 64 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 10);
+        }
+
+        template 
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME boost::enable_if_c<
+                std::numeric_limits::is_iec559 &&
+                std::numeric_limits::digits == 113 &&
+                std::numeric_limits::radix == 2 &&
+                std::numeric_limits::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 16);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Portable hash function
+        //
+        // Used as a fallback when the binary hash function isn't supported.
+
+        template 
+        inline std::size_t float_hash_impl2(T v)
+        {
+            boost::hash_detail::call_frexp frexp;
+            boost::hash_detail::call_ldexp ldexp;
+
+            int exp = 0;
+
+            v = frexp(v, &exp);
+
+            // A postive value is easier to hash, so combine the
+            // sign with the exponent and use the absolute value.
+            if(v < 0) {
+                v = -v;
+                exp += limits::max_exponent -
+                    limits::min_exponent;
+            }
+
+            v = ldexp(v, limits::digits);
+            std::size_t seed = static_cast(v);
+            v -= static_cast(seed);
+
+            // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
+            std::size_t const length
+                = (limits::digits *
+                        boost::static_log2::radix>::value
+                        + limits::digits - 1)
+                / limits::digits;
+
+            for(std::size_t i = 0; i != length; ++i)
+            {
+                v = ldexp(v, limits::digits);
+                std::size_t part = static_cast(v);
+                v -= static_cast(part);
+                hash_float_combine(seed, part);
+            }
+
+            hash_float_combine(seed, exp);
+
+            return seed;
+        }
+
+#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC)
+        template 
+        inline std::size_t float_hash_impl(T v, ...)
+        {
+            typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type;
+            return float_hash_impl2(static_cast(v));
+        }
+#endif
+    }
+}
+
 #if BOOST_HASH_USE_FPCLASSIFY
 
 #include 
@@ -61,8 +212,15 @@ namespace boost
         template 
         inline std::size_t float_hash_value(T v)
         {
+#if defined(fpclassify)
+            switch (fpclassify(v))
+#elif BOOST_HASH_CONFORMANT_FLOATS
+            switch (std::fpclassify(v))
+#else
             using namespace std;
-            switch (fpclassify(v)) {
+            switch (fpclassify(v))
+#endif
+            {
             case FP_ZERO:
                 return 0;
             case FP_INFINITE:
@@ -71,7 +229,7 @@ namespace boost
                 return (std::size_t)(-3);
             case FP_NORMAL:
             case FP_SUBNORMAL:
-                return float_hash_impl(v);
+                return float_hash_impl(v, 0);
             default:
                 BOOST_ASSERT(0);
                 return 0;
@@ -86,10 +244,24 @@ namespace boost
 {
     namespace hash_detail
     {
+        template 
+        inline bool is_zero(T v)
+        {
+#if !defined(__GNUC__)
+            return v == 0;
+#else
+            // GCC's '-Wfloat-equal' will complain about comparing
+            // v to 0, but because it disables warnings for system
+            // headers it won't complain if you use std::equal_to to
+            // compare with 0. Resulting in this silliness:
+            return std::equal_to()(v, 0);
+#endif
+        }
+
         template 
         inline std::size_t float_hash_value(T v)
         {
-            return v == 0 ? 0 : float_hash_impl(v);
+            return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0);
         }
     }
 }
@@ -98,4 +270,8 @@ namespace boost
 
 #undef BOOST_HASH_USE_FPCLASSIFY
 
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
 #endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp
deleted file mode 100644
index 1278c2f62..000000000
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float_generic.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-// Copyright 2005-2009 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// A general purpose hash function for non-zero floating point values.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
-
-#include 
-#include 
-#include 
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-#if defined(BOOST_MSVC)
-#pragma warning(push)
-#if BOOST_MSVC >= 1400
-#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
-                              // not satisfy test. Loop body not executed 
-#endif
-#endif
-
-namespace boost
-{
-    namespace hash_detail
-    {
-        inline void hash_float_combine(std::size_t& seed, std::size_t value)
-        {
-            seed ^= value + (seed<<6) + (seed>>2);
-        }
-
-        template 
-        inline std::size_t float_hash_impl2(T v)
-        {
-            boost::hash_detail::call_frexp frexp;
-            boost::hash_detail::call_ldexp ldexp;
-        
-            int exp = 0;
-
-            v = frexp(v, &exp);
-
-            // A postive value is easier to hash, so combine the
-            // sign with the exponent and use the absolute value.
-            if(v < 0) {
-                v = -v;
-                exp += limits::max_exponent -
-                    limits::min_exponent;
-            }
-
-            v = ldexp(v, limits::digits);
-            std::size_t seed = static_cast(v);
-            v -= static_cast(seed);
-
-            // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
-            std::size_t const length
-                = (limits::digits *
-                        boost::static_log2::radix>::value
-                        + limits::digits - 1)
-                / limits::digits;
-
-            for(std::size_t i = 0; i != length; ++i)
-            {
-                v = ldexp(v, limits::digits);
-                std::size_t part = static_cast(v);
-                v -= static_cast(part);
-                hash_float_combine(seed, part);
-            }
-
-            hash_float_combine(seed, exp);
-
-            return seed;
-        }
-
-        template 
-        inline std::size_t float_hash_impl(T v)
-        {
-            typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type;
-            return float_hash_impl2(static_cast(v));
-        }
-    }
-}
-
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp b/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp
deleted file mode 100644
index b39bb0d08..000000000
--- a/project/jni/boost/include/boost/functional/hash/detail/hash_float_x86.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// Copyright 2005-2009 Daniel James.
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// A non-portable hash function form non-zero floats on x86.
-//
-// Even if you're on an x86 platform, this might not work if their floating
-// point isn't set up as this expects. So this should only be used if it's
-// absolutely certain that it will work.
-
-#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
-#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
-
-#include 
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-namespace boost
-{
-    namespace hash_detail
-    {
-        inline void hash_float_combine(std::size_t& seed, std::size_t value)
-        {
-            seed ^= value + (seed<<6) + (seed>>2);
-        }
-
-        inline std::size_t float_hash_impl(float v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr;
-            return seed;
-        }
-
-        inline std::size_t float_hash_impl(double v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr++;
-            hash_float_combine(seed, *ptr);
-            return seed;
-        }
-
-        inline std::size_t float_hash_impl(long double v)
-        {
-            boost::uint32_t* ptr = (boost::uint32_t*)&v;
-            std::size_t seed = *ptr++;
-            hash_float_combine(seed, *ptr++);
-            hash_float_combine(seed, *(boost::uint16_t*)ptr);
-            return seed;
-        }
-    }
-}
-
-#endif
diff --git a/project/jni/boost/include/boost/functional/hash/extensions.hpp b/project/jni/boost/include/boost/functional/hash/extensions.hpp
index 3c587a3bf..998c08e46 100644
--- a/project/jni/boost/include/boost/functional/hash/extensions.hpp
+++ b/project/jni/boost/include/boost/functional/hash/extensions.hpp
@@ -15,6 +15,22 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+#   include 
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+#   include 
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
+#   include 
+#endif
 
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
 # pragma once
@@ -54,51 +70,51 @@ namespace boost
     std::size_t hash_value(std::pair const& v)
     {
         std::size_t seed = 0;
-        hash_combine(seed, v.first);
-        hash_combine(seed, v.second);
+        boost::hash_combine(seed, v.first);
+        boost::hash_combine(seed, v.second);
         return seed;
     }
 
     template 
     std::size_t hash_value(std::vector const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::list const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::deque const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::set const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::multiset const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::map const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
     std::size_t hash_value(std::multimap const& v)
     {
-        return hash_range(v.begin(), v.end());
+        return boost::hash_range(v.begin(), v.end());
     }
 
     template 
@@ -110,6 +126,83 @@ namespace boost
         return seed;
     }
 
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+    template 
+    std::size_t hash_value(std::array const& v)
+    {
+        return boost::hash_range(v.begin(), v.end());
+    }
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+    namespace hash_detail {
+        template 
+        inline typename boost::enable_if_c<(I == std::tuple_size::value),
+                void>::type
+            hash_combine_tuple(std::size_t&, T const&)
+        {
+        }
+
+        template 
+        inline typename boost::enable_if_c<(I < std::tuple_size::value),
+                void>::type
+            hash_combine_tuple(std::size_t& seed, T const& v)
+        {
+            boost::hash_combine(seed, std::get(v));
+            boost::hash_detail::hash_combine_tuple(seed, v);
+        }
+
+        template 
+        inline std::size_t hash_tuple(T const& v)
+        {
+            std::size_t seed = 0;
+            boost::hash_detail::hash_combine_tuple<0>(seed, v);
+            return seed;
+        }
+    }
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+    template 
+    inline std::size_t hash_value(std::tuple const& v)
+    {
+        return boost::hash_detail::hash_tuple(v);
+    }
+#else
+
+    inline std::size_t hash_value(std::tuple<> const& v)
+    {
+        return boost::hash_detail::hash_tuple(v);
+    }
+
+#   define BOOST_HASH_TUPLE_F(z, n, _)                                      \
+    template<                                                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)                            \
+    >                                                                       \
+    inline std::size_t hash_value(std::tuple<                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, A)                                     \
+    > const& v)                                                             \
+    {                                                                       \
+        return boost::hash_detail::hash_tuple(v);                           \
+    }
+
+    BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _)
+#   undef BOOST_HASH_TUPLE_F
+#endif
+
+#endif
+
+#if !defined(BOOST_NO_CXX11_SMART_PTR)
+    template 
+    inline std::size_t hash_value(std::shared_ptr const& x) {
+        return boost::hash_value(x.get());
+    }
+
+    template 
+    inline std::size_t hash_value(std::unique_ptr const& x) {
+        return boost::hash_value(x.get());
+    }
+#endif
+
     //
     // call_hash_impl
     //
diff --git a/project/jni/boost/include/boost/functional/hash/hash.hpp b/project/jni/boost/include/boost/functional/hash/hash.hpp
index 51ec8608c..aa4e49f8a 100644
--- a/project/jni/boost/include/boost/functional/hash/hash.hpp
+++ b/project/jni/boost/include/boost/functional/hash/hash.hpp
@@ -15,16 +15,15 @@
 #include 
 #include 
 #include 
-
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
-#include 
-#endif
+#include 
+#include 
+#include 
 
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 #include 
 #endif
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
 #include 
 #endif
 
@@ -37,38 +36,82 @@
 
 namespace boost
 {
-#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
+    namespace hash_detail
+    {
+        struct enable_hash_value { typedef std::size_t type; };
 
-    // If you get a static assertion here, it's because hash_value
-    // isn't declared for your type.
-    template 
-    std::size_t hash_value(T const&) {
-        BOOST_STATIC_ASSERT((T*) 0 && false);
-        return 0;
-    }
+        template  struct basic_numbers {};
+        template  struct long_numbers;
+        template  struct ulong_numbers;
+        template  struct float_numbers {};
 
-#endif
-
-    std::size_t hash_value(bool);
-    std::size_t hash_value(char);
-    std::size_t hash_value(unsigned char);
-    std::size_t hash_value(signed char);
-    std::size_t hash_value(short);
-    std::size_t hash_value(unsigned short);
-    std::size_t hash_value(int);
-    std::size_t hash_value(unsigned int);
-    std::size_t hash_value(long);
-    std::size_t hash_value(unsigned long);
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
 
 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
-    std::size_t hash_value(wchar_t);
+        template <> struct basic_numbers :
+            boost::hash_detail::enable_hash_value {};
 #endif
-    
+
+        // long_numbers is defined like this to allow for separate
+        // specialization for long_long and int128_type, in case
+        // they conflict.
+        template  struct long_numbers2 {};
+        template  struct ulong_numbers2 {};
+        template  struct long_numbers : long_numbers2 {};
+        template  struct ulong_numbers : ulong_numbers2 {};
+
 #if !defined(BOOST_NO_LONG_LONG)
-    std::size_t hash_value(boost::long_long_type);
-    std::size_t hash_value(boost::ulong_long_type);
+        template <> struct long_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers :
+            boost::hash_detail::enable_hash_value {};
 #endif
 
+#if defined(BOOST_HAS_INT128)
+        template <> struct long_numbers2 :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers2 :
+            boost::hash_detail::enable_hash_value {};
+#endif
+
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers :
+            boost::hash_detail::enable_hash_value {};
+    }
+
+    template 
+    typename boost::hash_detail::basic_numbers::type hash_value(T);
+    template 
+    typename boost::hash_detail::long_numbers::type hash_value(T);
+    template 
+    typename boost::hash_detail::ulong_numbers::type hash_value(T);
+
+    template 
+    typename boost::enable_if, std::size_t>::type
+        hash_value(T);
+
 #if !BOOST_WORKAROUND(__DMC__, <= 0x848)
     template  std::size_t hash_value(T* const&);
 #else
@@ -83,15 +126,14 @@ namespace boost
     std::size_t hash_value(T (&x)[N]);
 #endif
 
-    std::size_t hash_value(float v);
-    std::size_t hash_value(double v);
-    std::size_t hash_value(long double v);
-
     template 
     std::size_t hash_value(
         std::basic_string, A> const&);
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+    template 
+    typename boost::hash_detail::float_numbers::type hash_value(T);
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
     std::size_t hash_value(std::type_index);
 #endif
 
@@ -141,74 +183,30 @@ namespace boost
         }
     }
 
-    inline std::size_t hash_value(bool v)
+    template 
+    typename boost::hash_detail::basic_numbers::type hash_value(T v)
     {
         return static_cast(v);
     }
 
-    inline std::size_t hash_value(char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(signed char v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(short v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned short v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(int v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned int v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(long v)
-    {
-        return static_cast(v);
-    }
-
-    inline std::size_t hash_value(unsigned long v)
-    {
-        return static_cast(v);
-    }
-
-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
-    inline std::size_t hash_value(wchar_t v)
-    {
-        return static_cast(v);
-    }
-#endif
-
-#if !defined(BOOST_NO_LONG_LONG)
-    inline std::size_t hash_value(boost::long_long_type v)
+    template 
+    typename boost::hash_detail::long_numbers::type hash_value(T v)
     {
         return hash_detail::hash_value_signed(v);
     }
 
-    inline std::size_t hash_value(boost::ulong_long_type v)
+    template 
+    typename boost::hash_detail::ulong_numbers::type hash_value(T v)
     {
         return hash_detail::hash_value_unsigned(v);
     }
-#endif
+
+    template 
+    typename boost::enable_if, std::size_t>::type
+        hash_value(T v)
+    {
+        return static_cast(v);
+    }
 
     // Implementation by Alberto Barbati and Dave Harris.
 #if !BOOST_WORKAROUND(__DMC__, <= 0x848)
@@ -324,22 +322,13 @@ namespace boost
         return hash_range(v.begin(), v.end());
     }
 
-    inline std::size_t hash_value(float v)
+    template 
+    typename boost::hash_detail::float_numbers::type hash_value(T v)
     {
         return boost::hash_detail::float_hash_value(v);
     }
 
-    inline std::size_t hash_value(double v)
-    {
-        return boost::hash_detail::float_hash_value(v);
-    }
-
-    inline std::size_t hash_value(long double v)
-    {
-        return boost::hash_detail::float_hash_value(v);
-    }
-
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
     inline std::size_t hash_value(std::type_index v)
     {
         return v.hash_code();
@@ -450,7 +439,12 @@ namespace boost
     BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
 #endif
 
-#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
+#if defined(BOOST_HAS_INT128)
+    BOOST_HASH_SPECIALIZE(boost::int128_type)
+    BOOST_HASH_SPECIALIZE(boost::uint128_type)
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
     BOOST_HASH_SPECIALIZE(std::type_index)
 #endif
 
diff --git a/project/jni/boost/include/boost/functional/overloaded_function.hpp b/project/jni/boost/include/boost/functional/overloaded_function.hpp
new file mode 100644
index 000000000..83fe4b384
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function.hpp
@@ -0,0 +1,311 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef DOXYGEN // Doxygen documentation only.
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+
+#define BOOST_FUNCTIONAL_f_type(z, n, unused) \
+    BOOST_PP_CAT(F, n)
+
+#define BOOST_FUNCTIONAL_f_arg(z, n, unused) \
+    BOOST_PP_CAT(f, n)
+
+#define BOOST_FUNCTIONAL_f_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_f_type(z, n, ~) \
+
+#define BOOST_FUNCTIONAL_f_tparam_dflt(z, n, is_tspec) \
+    BOOST_FUNCTIONAL_f_tparam(z, n, ~) \
+    /* overload requires at least 2 functors so F0 and F1 not optional */ \
+    BOOST_PP_EXPR_IIF(BOOST_PP_AND(BOOST_PP_NOT(is_tspec), \
+            BOOST_PP_GREATER(n, 1)), \
+        = void \
+    )
+
+#define BOOST_FUNCTIONAL_f_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_f_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_f_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_type(z, n, unused) \
+    BOOST_PP_CAT(G, n)
+
+#define BOOST_FUNCTIONAL_g_arg(z, n, unused) \
+    BOOST_PP_CAT(g, n)
+
+#define BOOST_FUNCTIONAL_g_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_g_type(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_g_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_g_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base(z, n, unused) \
+    ::boost::overloaded_function_detail::base< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >
+
+#define BOOST_FUNCTIONAL_inherit(z, n, unused) \
+    public BOOST_FUNCTIONAL_base(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base_init(z, n, unused) \
+    BOOST_FUNCTIONAL_base(z, n, ~)(BOOST_FUNCTIONAL_g_arg(z, n, ~))
+
+#define BOOST_FUNCTIONAL_using_operator_call(z, n, unused) \
+    using BOOST_FUNCTIONAL_base(z, n, ~)::operator();
+
+#define BOOST_FUNCTIONAL_function_type(z, n, unused) \
+    typename ::boost::overloaded_function_detail::function_type< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >::type
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+            /* at least 2 func to overload so start from 2 to MAX */ \
+            /* (cannot iterate [0, MAX-2) because error on Sun) */ \
+            (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+            "boost/functional/overloaded_function.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over function arity.
+
+#undef BOOST_FUNCTIONAL_f_type
+#undef BOOST_FUNCTIONAL_f_arg
+#undef BOOST_FUNCTIONAL_f_tparam
+#undef BOOST_FUNCTIONAL_f_arg_decl
+#undef BOOST_FUNCTIONAL_f_tparam_dflt
+#undef BOOST_FUNCTIONAL_g_type
+#undef BOOST_FUNCTIONAL_g_arg
+#undef BOOST_FUNCTIONAL_g_tparam
+#undef BOOST_FUNCTIONAL_g_arg_decl
+#undef BOOST_FUNCTIONAL_base
+#undef BOOST_FUNCTIONAL_inherit
+#undef BOOST_FUNCTIONAL_base_init
+#undef BOOST_FUNCTIONAL_using_operator_call
+#undef BOOST_FUNCTIONAL_function_type
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_overloads \
+        /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \
+        /* (add 2 because iteration started from 2 to MAX) */ \
+        BOOST_PP_ADD(2, BOOST_PP_SUB( \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+                BOOST_PP_FRAME_ITERATION(1)))
+#   define BOOST_FUNCTIONAL_is_tspec \
+        /* if template specialization */ \
+        BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX)
+
+// For type-of emulation: This must be included at this pp iteration level.
+#   include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+namespace boost {
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt,
+            BOOST_FUNCTIONAL_is_tspec)
+>
+class overloaded_function
+    // Template specialization.
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), <)
+    BOOST_PP_IIF(BOOST_FUNCTIONAL_is_tspec,
+        BOOST_PP_ENUM
+    ,
+        BOOST_PP_TUPLE_EAT(3)
+    )(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_type, ~)
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), >)
+    // Bases (overloads >= 2 so always at least 2 bases).
+    : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+            BOOST_FUNCTIONAL_inherit, ~)
+{
+public:
+    template<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_g_tparam, ~)
+    > /* implicit */ inline overloaded_function(
+            BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_g_arg_decl, ~))
+            // Overloads >= 2 so always at least 2 bases to initialize.
+            : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_base_init, ~)
+    {}
+
+    BOOST_PP_REPEAT(BOOST_FUNCTIONAL_overloads, 
+            BOOST_FUNCTIONAL_using_operator_call, ~)
+};
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam, ~)
+>
+overloaded_function<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_function_type, ~)
+> make_overloaded_function(
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg_decl, ~)
+) {
+    return overloaded_function<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                BOOST_FUNCTIONAL_function_type, ~)
+    >(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~));
+}
+
+} // namespace
+
+// For type-of emulation: Register overloaded function type (for _AUTO, etc).
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::overloaded_function,
+    BOOST_FUNCTIONAL_overloads)
+
+#   undef BOOST_FUNCTIONAL_overloads
+#   undef BOOST_FUNCTIONAL_is_tspec
+#endif // iteration
+
+// DOCUMENTATION //
+
+#else // DOXYGEN
+
+/** @file
+@brief Overload distinct function pointers, function references, and
+monomorphic function objects into a single function object.
+*/
+
+namespace boost {
+
+/**
+@brief Function object to overload functions with distinct signatures.
+
+This function object aggregates together calls to functions of all the
+specified function types F1, F2, etc which must have distinct
+function signatures from one another.
+
+@Params
+@Param{Fi,
+Each function type must be specified using the following syntax (which is
+Boost.Function's preferred syntax):
+@code
+    result_type (argument1_type\, argumgnet2_type\, ...)
+@endcode
+}
+@EndParams
+
+In some cases, the @RefFunc{make_overloaded_function} function template can be
+useful to construct an overloaded function object without explicitly
+specifying the function types.
+
+At least two distinct function types must be specified (because there is
+nothing to overload between one or zero functions).
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+The maximum number of function parameters for each of the specified function
+types is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX}
+configuration macro.
+
+@See @RefSect{tutorial, Tutorial} section, @RefFunc{make_overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX},
+Boost.Function.
+*/
+template
+class overloaded_function {
+public:
+    /**
+    @brief Construct the overloaded function object.
+
+    Any function pointer, function reference, and monomorphic function object
+    that can be converted to a boost::function function object can be
+    specified as parameter.
+
+    @Note Unfortunately, it is not possible to support polymorphic function
+    objects (as explained here).
+    */
+    overloaded_function(const boost::function&,
+            const boost::function&, ...);
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 1st template parameter.
+
+    This will in turn invoke the call operator of the 1st function passed to
+    the constructor.
+    */
+    typename boost::function_traits::result_type operator()(
+            typename boost::function_traits::arg1_type,
+            typename boost::function_traits::arg2_type,
+            ...) const;
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 2nd template parameter.
+
+    This will in turn invoke the call operator of the 2nd function passed to
+    the constructor.
+
+    @Note Similar call operators are present for all specified function types
+    F1, F2, etc (even if not exhaustively listed by this
+    documentation).
+    */
+    typename boost::function_traits::result_type operator()(
+            typename boost::function_traits::arg1_type,
+            typename boost::function_traits::arg2_type,
+            ...) const;
+};
+
+/**
+@brief Make an overloaded function object without explicitly specifying the
+function types.
+
+This function template creates and returns an @RefClass{overloaded_function}
+object that overloads all the specified functions f1, f2, etc.
+
+The function types are internally determined from the template parameter types
+so they do not need to be explicitly specified.
+Therefore, this function template usually has a more concise syntax when
+compared with @RefClass{overloaded_function}.
+This is especially useful when the explicit type of the returned
+@RefClass{overloaded_function} object does not need to be known (e.g., when
+used with Boost.Typeof's BOOST_AUTO, C++11 auto, or when the
+overloaded function object is handled using a function template parameter, see
+the @RefSect{tutorial, Tutorial} section).
+
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+
+@Note In this documentation, __function_type__ is a placeholder for a
+symbol that is specific to the implementation of this library.
+
+@See @RefSect{tutorial, Tutorial} section, @RefClass{overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}.
+*/
+template
+overloaded_function<
+    __function_type__, __function_type__, ...
+> make_overloaded_function(F1 f1, F2 f2, ...);
+
+} // namespace
+
+#endif // DOXYGEN
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/config.hpp b/project/jni/boost/include/boost/functional/overloaded_function/config.hpp
new file mode 100644
index 000000000..2f5d9e132
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/config.hpp
@@ -0,0 +1,50 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+
+/** @file
+@brief Change the compile-time configuration of this library.
+*/
+
+/**
+@brief Specify the maximum number of arguments of the functions being
+overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When specified by the user, this macro must be a non-negative integer number.
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{boost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 5
+#endif
+
+/**
+@brief Specify the maximum number of functions that can be overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When defined by the user, this macro must be an integer number greater or
+equal than 2 (because at least two distinct functions need to be specified in
+order to define an overload).
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{boost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX 5
+#endif
+#if BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX < 2
+#   error "maximum overload macro cannot be less than 2"
+#endif
+
+#endif // #include guard
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp b/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp
new file mode 100644
index 000000000..8fd9a0a2c
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/detail/base.hpp
@@ -0,0 +1,86 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+#       include 
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_PP_CAT(A, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \
+    BOOST_PP_CAT(a, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_f \
+    R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \
+            BOOST_FUNCTIONAL_DETAIL_arg_type, ~))
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace boost { namespace overloaded_function_detail {
+
+template
+class base {}; // Empty template cannot be used directly (only its spec).
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+                (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \
+                "boost/functional/overloaded_function/detail/base.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over funciton arity.
+
+} } // namespace
+
+#undef BOOST_FUNCTIONAL_DETAIL_arg_type
+#undef BOOST_FUNCTIONAL_DETAIL_arg_name
+#undef BOOST_FUNCTIONAL_DETAIL_arg_tparam
+#undef BOOST_FUNCTIONAL_DETAIL_arg
+#undef BOOST_FUNCTIONAL_DETAIL_f
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1)
+
+template<
+    typename R
+    BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity)
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~)
+>
+class base< BOOST_FUNCTIONAL_DETAIL_f > {
+public:
+    /* implicit */ inline base(
+            // This requires specified type to be implicitly convertible to
+            // a boost::function<> functor.
+            boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f)
+    {}
+
+    inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg, ~)) const {
+        return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+                BOOST_FUNCTIONAL_DETAIL_arg_name, ~));
+    }
+
+private:
+    boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_;
+};
+
+#   undef BOOST_FUNCTIONAL_DETAIL_arity
+#endif // iteration
+
diff --git a/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp b/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp
new file mode 100644
index 000000000..0c28607b8
--- /dev/null
+++ b/project/jni/boost/include/boost/functional/overloaded_function/detail/function_type.hpp
@@ -0,0 +1,85 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace boost { namespace overloaded_function_detail {
+
+// Requires: F is a monomorphic functor (i.e., has non-template `operator()`).
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+// It does not assume F typedef result_type, arg1_type, ... but needs typeof.
+template
+class functor_type {
+    // NOTE: clang does not accept extra parenthesis `&(...)`.
+    typedef BOOST_TYPEOF_TPL(&F::operator()) call_ptr;
+public:
+    typedef
+        typename boost::function_types::function_type<
+            typename boost::mpl::push_front<
+                  typename boost::mpl::pop_front< // Remove functor type (1st).
+                    typename boost::function_types::parameter_types<
+                            call_ptr>::type
+                  >::type
+                , typename boost::function_types::result_type::type
+            >::type
+        >::type
+    type;
+};
+
+// NOTE: When using boost::function in Boost.Typeof emulation mode, the user
+// has to register boost::functionN instead of boost::function in oder to
+// do TYPEOF(F::operator()). That is confusing, so boost::function is handled
+// separately so it does not require any Boost.Typeof registration at all.
+template
+struct functor_type< boost::function > {
+    typedef F type;
+};
+
+// Requires: F is a function type, pointer, reference, or monomorphic functor.
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+template
+struct function_type {
+    typedef
+        typename boost::mpl::if_,
+            boost::mpl::identity
+        ,
+            typename boost::mpl::if_,
+                boost::remove_pointer
+            ,
+                typename boost::mpl::if_,
+                    boost::remove_reference
+                , // Else, requires that F is a functor.
+                    functor_type
+                >::type
+            >::type
+        >::type
+    ::type type;
+};
+
+} } // namespace
+
+#endif // #include guard
+
diff --git a/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp b/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
index 50c40cf34..2f4db4dd0 100644
--- a/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/adt/detail/extension.hpp
@@ -12,13 +12,28 @@
 
 #include 
 #include 
+#include 
+#include 
 
-namespace boost { namespace fusion { namespace detail
-{
+namespace boost { namespace fusion
+{ 
+    namespace detail
+    {
     template 
     struct get_identity
       : remove_const::type>
     {};
-}}}
+    }
+    
+    namespace extension
+    {
+        // Overload as_const() to unwrap adt_attribute_proxy.
+        template 
+        typename adt_attribute_proxy::type as_const(const adt_attribute_proxy& proxy)
+        {
+            return proxy.get();
+        }
+    }
+}}
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
index 2f09719ca..400f366e9 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/detail/at_impl.hpp
@@ -9,7 +9,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -29,13 +29,13 @@ namespace boost { namespace fusion
             struct apply
             {
                 typedef typename remove_const::type seq_type;
-                typedef std::tuple_element element;
+                typedef typename std::tuple_element::type element;
 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , fusion::detail::cref_result
-                      , fusion::detail::ref_result
+                      , typename fusion::detail::cref_result::type
+                      , typename fusion::detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
index 4998e21d1..082018a44 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -48,12 +48,12 @@ namespace boost { namespace fusion
         template 
         struct deref
         {
-            typedef value_of element;
+            typedef typename value_of::type element;
             typedef typename
-                mpl::eval_if<
+                mpl::if_<
                     is_const
-                  , fusion::detail::cref_result
-                  , fusion::detail::ref_result
+                  , typename fusion::detail::cref_result::type
+                  , typename fusion::detail::ref_result::type
                 >::type
             type;
 
diff --git a/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp b/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
index 10e2e1814..6d7b4d6fb 100644
--- a/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/std_tuple/tag_of.hpp
@@ -10,12 +10,6 @@
 #include 
 #include 
 
-namespace std
-{
-    template 
-    class tuple;
-}
-
 namespace boost { namespace fusion
 {
     struct std_tuple_tag;
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct.hpp b/project/jni/boost/include/boost/fusion/adapted/struct.hpp
index acc12e692..e51b514b0 100644
--- a/project/jni/boost/include/boost/fusion/adapted/struct.hpp
+++ b/project/jni/boost/include/boost/fusion/adapted/struct.hpp
@@ -16,5 +16,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp
new file mode 100644
index 000000000..9dc5b44cc
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/adapted/struct/define_struct_inline.hpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_STRUCT_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+#include 
+
+#define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(                                  \
+    TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES)                                      \
+                                                                                \
+    BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL(                                 \
+        TEMPLATE_PARAMS_SEQ,                                                    \
+        NAME,                                                                   \
+        ATTRIBUTES)
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE(NAME, ATTRIBUTES)                     \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES)                    \
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
new file mode 100644
index 000000000..7bc5fe08a
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
@@ -0,0 +1,412 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE)        \
+    BOOST_PP_COMMA_IF(N) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)()
+
+#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST(ATTRIBUTES_SEQ)                     \
+            : BOOST_PP_SEQ_FOR_EACH_I(                                          \
+              BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY,                        \
+              ~,                                                                \
+              ATTRIBUTES_SEQ)                                                   \
+
+#define BOOST_FUSION_IGNORE_1(ARG1)
+#define BOOST_FUSION_IGNORE_2(ARG1, ARG2)
+
+#define BOOST_FUSION_MAKE_COPY_CONSTRUCTOR(NAME, ATTRIBUTES_SEQ)                \
+    NAME(BOOST_PP_SEQ_FOR_EACH_I(                                               \
+            BOOST_FUSION_MAKE_CONST_REF_PARAM,                                  \
+            ~,                                                                  \
+            ATTRIBUTES_SEQ))                                                    \
+        : BOOST_PP_SEQ_FOR_EACH_I(                                              \
+              BOOST_FUSION_MAKE_INIT_LIST_ENTRY,                                \
+              ~,                                                                \
+              ATTRIBUTES_SEQ)                                                   \
+    {                                                                           \
+    }                                                                           \
+
+#define BOOST_FUSION_MAKE_CONST_REF_PARAM(R, DATA, N, ATTRIBUTE)                \
+    BOOST_PP_COMMA_IF(N)                                                        \
+    BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) const&                                 \
+    BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
+
+#define BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(NAME) NAME(NAME)
+
+#define BOOST_FUSION_MAKE_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE)                \
+    BOOST_PP_COMMA_IF(N)                                                        \
+    BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE))
+
+#define BOOST_FUSION_ITERATOR_NAME(NAME)                                        \
+    BOOST_PP_CAT(boost_fusion_detail_, BOOST_PP_CAT(NAME, _iterator))
+
+// Note: all template parameter names need to be uglified, otherwise they might
+//       shadow a template parameter of the struct when used with
+//       BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE
+
+#define BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS(Z, N, NAME)                   \
+    template                                   \
+    struct value_of<                                                            \
+               BOOST_FUSION_ITERATOR_NAME(NAME)      \
+           >                                                                    \
+        : boost::mpl::identity<                                                 \
+              typename boost_fusion_detail_Sq::t##N##_type                      \
+          >                                                                     \
+    {                                                                           \
+    };
+
+#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC(                                  \
+    SPEC_TYPE, CALL_ARG_TYPE, TYPE_QUAL, ATTRIBUTE, N)                          \
+                                                                                \
+    template                                   \
+    struct deref >                                                \
+    {                                                                           \
+        typedef typename boost_fusion_detail_Sq::t##N##_type TYPE_QUAL& type;   \
+        static type call(CALL_ARG_TYPE, N> const& iter)                         \
+        {                                                                       \
+            return iter.seq_.BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);              \
+        }                                                                       \
+    };
+
+#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS(R, NAME, N, ATTRIBUTE)           \
+    BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC(                                      \
+        BOOST_FUSION_ITERATOR_NAME(NAME)                                  \
+    struct value_at >               \
+    {                                                                           \
+        typedef typename boost_fusion_detail_Sq::t##N##_type type;              \
+    };
+
+#define BOOST_FUSION_MAKE_AT_SPECS(R, DATA, N, ATTRIBUTE)                       \
+    template                                   \
+    struct at >                     \
+    {                                                                           \
+        typedef typename boost::mpl::if_<                                       \
+            boost::is_const,                            \
+            typename boost_fusion_detail_Sq::t##N##_type const&,                \
+            typename boost_fusion_detail_Sq::t##N##_type&                       \
+        >::type type;                                                           \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return sq. BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);                    \
+        }                                                                       \
+    };
+
+#define BOOST_FUSION_MAKE_TYPEDEF(R, DATA, N, ATTRIBUTE)                        \
+    typedef BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) t##N##_type;
+
+#define BOOST_FUSION_MAKE_DATA_MEMBER(R, DATA, N, ATTRIBUTE)                    \
+    BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);
+
+// Note: We can't nest the iterator inside the struct because we run into
+//       a MSVC10 bug involving partial specializations of nested templates.
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES)                \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)                \
+    struct NAME : boost::fusion::sequence_facade<                               \
+                      NAME,                                                     \
+                      boost::fusion::random_access_traversal_tag                \
+                  >                                                             \
+    {                                                                           \
+        BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    };
+
+#define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL(                             \
+    TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES)                                      \
+                                                                                \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)                \
+                                                                                \
+    template <                                                                  \
+        BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL(                  \
+            (0)TEMPLATE_PARAMS_SEQ)                                             \
+    >                                                                           \
+    struct NAME : boost::fusion::sequence_facade<                               \
+                      NAME<                                                     \
+                          BOOST_PP_SEQ_ENUM(TEMPLATE_PARAMS_SEQ)                \
+                      >,                                                        \
+                      boost::fusion::random_access_traversal_tag                \
+                  >                                                             \
+    {                                                                           \
+        BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    };
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES)             \
+    BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(                                    \
+        NAME,                                                                   \
+        BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
+
+// Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
+//       ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
+//       sequence produces warnings on MSVC.
+#define BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(NAME, ATTRIBUTES_SEQ)           \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL(                        \
+        NAME,                                                                   \
+        ATTRIBUTES_SEQ,                                                         \
+        BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES)            \
+    BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(                                   \
+        NAME,                                                                   \
+        BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
+
+#define BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(NAME, ATTRIBUTES_SEQ)          \
+    BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL(                       \
+        NAME,                                                                   \
+        ATTRIBUTES_SEQ,                                                         \
+        BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL(                   \
+    NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE)                                  \
+                                                                                \
+    template                           \
+    struct BOOST_FUSION_ITERATOR_NAME(NAME)                                     \
+        : boost::fusion::iterator_facade<                                       \
+              BOOST_FUSION_ITERATOR_NAME(NAME),     \
+              boost::fusion::random_access_traversal_tag                        \
+          >                                                                     \
+    {                                                                           \
+        typedef boost::mpl::int_ index;                                      \
+        typedef boost_fusion_detail_Seq sequence_type;                          \
+                                                                                \
+        BOOST_FUSION_ITERATOR_NAME(NAME)(boost_fusion_detail_Seq& seq)          \
+            : seq_(seq) {}                                                      \
+                                                                                \
+        boost_fusion_detail_Seq& seq_;                                          \
+                                                                                \
+        template  struct value_of;              \
+        BOOST_PP_REPEAT(                                                        \
+            ATTRIBUTES_SEQ_SIZE,                                                \
+            BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS,                          \
+            NAME)                                                               \
+                                                                                \
+        template  struct deref;                 \
+        BOOST_PP_SEQ_FOR_EACH_I(                                                \
+            BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS,                             \
+            NAME,                                                               \
+            ATTRIBUTES_SEQ)                                                     \
+                                                                                \
+        template                               \
+        struct next                                                             \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value + 1                        \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template                               \
+        struct prior                                                            \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value - 1                        \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template <                                                              \
+            typename boost_fusion_detail_It1,                                   \
+            typename boost_fusion_detail_It2                                    \
+        >                                                                       \
+        struct distance                                                         \
+        {                                                                       \
+            typedef typename boost::mpl::minus<                                 \
+                typename boost_fusion_detail_It2::index,                        \
+                typename boost_fusion_detail_It1::index                         \
+            >::type type;                                                       \
+                                                                                \
+             static type call(boost_fusion_detail_It1 const& it1,               \
+                              boost_fusion_detail_It2 const& it2)               \
+            {                                                                   \
+                return type();                                                  \
+            }                                                                   \
+        };                                                                      \
+                                                                                \
+        template <                                                              \
+            typename boost_fusion_detail_It,                                    \
+            typename boost_fusion_detail_M                                      \
+        >                                                                       \
+        struct advance                                                          \
+        {                                                                       \
+            typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                           \
+                typename boost_fusion_detail_It::sequence_type,                 \
+                boost_fusion_detail_It::index::value                            \
+                    + boost_fusion_detail_M::value                              \
+            > type;                                                             \
+                                                                                \
+            static type call(boost_fusion_detail_It const& it)                  \
+            {                                                                   \
+                return type(it.seq_);                                           \
+            }                                                                   \
+        };                                                                      \
+    };
+
+
+#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL(                    \
+    NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE)                                  \
+                                                                                \
+    /* Note: second BOOST_PP_IF is necessary to avoid MSVC warning when */      \
+    /*       calling BOOST_FUSION_IGNORE_1 with no arguments.           */      \
+    NAME()                                                                      \
+        BOOST_PP_IF(                                                            \
+            ATTRIBUTES_SEQ_SIZE,                                                \
+            BOOST_FUSION_MAKE_DEFAULT_INIT_LIST,                                \
+            BOOST_FUSION_IGNORE_1)                                              \
+                (BOOST_PP_IF(                                                   \
+                    ATTRIBUTES_SEQ_SIZE,                                        \
+                    ATTRIBUTES_SEQ,                                             \
+                    0))                                                         \
+    {                                                                           \
+    }                                                                           \
+                                                                                \
+    BOOST_PP_IF(                                                                \
+        ATTRIBUTES_SEQ_SIZE,                                                    \
+        BOOST_FUSION_MAKE_COPY_CONSTRUCTOR,                                     \
+        BOOST_FUSION_IGNORE_2)                                                  \
+            (NAME, ATTRIBUTES_SEQ)                                              \
+                                                                                \
+    template                                  \
+    NAME(const boost_fusion_detail_Seq& rhs)                                    \
+    {                                                                           \
+        boost::fusion::copy(rhs, *this);                                        \
+    }                                                                           \
+                                                                                \
+    template                                  \
+    NAME& operator=(const boost_fusion_detail_Seq& rhs)                         \
+    {                                                                           \
+        boost::fusion::copy(rhs, *this);                                        \
+        return *this;                                                           \
+    }                                                                           \
+                                                                                \
+    template                                   \
+    struct begin                                                                \
+    {                                                                           \
+        typedef BOOST_FUSION_ITERATOR_NAME(NAME)     \
+             type;                                                              \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return type(sq);                                                    \
+        }                                                                       \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct end                                                                  \
+    {                                                                           \
+        typedef BOOST_FUSION_ITERATOR_NAME(NAME)<                               \
+            boost_fusion_detail_Sq,                                             \
+            ATTRIBUTES_SEQ_SIZE                                                 \
+        > type;                                                                 \
+                                                                                \
+        static type call(boost_fusion_detail_Sq& sq)                            \
+        {                                                                       \
+            return type(sq);                                                    \
+        }                                                                       \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct size : boost::mpl::int_                         \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    template                                   \
+    struct empty : boost::mpl::bool_                  \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    template <                                                                  \
+        typename boost_fusion_detail_Sq,                                        \
+        typename boost_fusion_detail_N                                          \
+    >                                                                           \
+    struct value_at : value_at<                                                 \
+                          boost_fusion_detail_Sq,                               \
+                          boost::mpl::int_        \
+                      >                                                         \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    BOOST_PP_REPEAT(                                                            \
+        ATTRIBUTES_SEQ_SIZE,                                                    \
+        BOOST_FUSION_MAKE_VALUE_AT_SPECS,                                       \
+        ~)                                                                      \
+                                                                                \
+    template <                                                                  \
+        typename boost_fusion_detail_Sq,                                        \
+        typename boost_fusion_detail_N                                          \
+    >                                                                           \
+    struct at : at<                                                             \
+                    boost_fusion_detail_Sq,                                     \
+                    boost::mpl::int_              \
+                >                                                               \
+    {                                                                           \
+    };                                                                          \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_AT_SPECS, ~, ATTRIBUTES_SEQ)      \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_MAKE_TYPEDEF, ~, ATTRIBUTES_SEQ)       \
+                                                                                \
+    BOOST_PP_SEQ_FOR_EACH_I(                                                    \
+        BOOST_FUSION_MAKE_DATA_MEMBER,                                          \
+        ~,                                                                      \
+        ATTRIBUTES_SEQ)
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp b/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
index 2720627c4..fd866468e 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/auxiliary/copy.hpp
@@ -11,8 +11,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 
 #if defined (BOOST_MSVC)
 #  pragma warning(push)
@@ -54,7 +57,15 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if_c<
+            type_traits::ice_and<
+                traits::is_sequence::value
+              , traits::is_sequence::value
+            >::value,
+            void
+        >::type
     copy(Seq1 const& src, Seq2& dest)
     {
         BOOST_STATIC_ASSERT(
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
index a8d6a357a..4b676dea6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp
@@ -9,6 +9,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,14 +25,24 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::accumulate::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence& seq, State const& state, F f)
     {
         return fusion::fold(seq, state, f);
     }
 
     template 
-    inline typename result_of::accumulate::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence const& seq, State const& state, F f)
     {
         return fusion::fold(seq, state, f);
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
index 9c0bd115f..a4ca316c1 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/accumulate_fwd.hpp
@@ -7,6 +7,9 @@
 #if !defined(BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED)
 #define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED
 
+#include 
+#include 
+
 namespace boost { namespace fusion
 {
     namespace result_of
@@ -16,11 +19,19 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::accumulate::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence& seq, State const& state, F f);
 
     template 
-    typename result_of::accumulate::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::accumulate
+        >::type
     accumulate(Sequence const& seq, State const& state, F f);
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
index d368338a0..c89a7ddad 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp
@@ -116,7 +116,7 @@ namespace boost { namespace fusion
         {
             template
             static Result
-            call(State const& state,It0 const& it0, F)
+            call(State const& state,It0 const&, F)
             {
                 return static_cast(state);
             }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
index 71730abf0..48a413446 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp
@@ -115,7 +115,7 @@ namespace boost { namespace fusion
         {
             template
             static Result
-            call(State const& state,It0 const& it0, F)
+            call(State const& state,It0 const&, F)
             {
                 return static_cast(state);
             }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
index ab8b8f0e8..17cde34a4 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each.hpp
@@ -11,6 +11,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,14 +26,24 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence& seq, F const& f)
     {
         detail::for_each(seq, f, typename traits::is_segmented::type());
     }
 
     template 
-    inline void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence const& seq, F const& f)
     {
         detail::for_each(seq, f, typename traits::is_segmented::type());
diff --git a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
index 544915d94..b757873e6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/iteration/for_each_fwd.hpp
@@ -7,6 +7,9 @@
 #if !defined(BOOST_FUSION_FOR_EACH_FWD_HPP_INCLUDED)
 #define BOOST_FUSION_FOR_EACH_FWD_HPP_INCLUDED
 
+#include 
+#include 
+
 namespace boost { namespace fusion
 {
     namespace result_of
@@ -16,11 +19,21 @@ namespace boost { namespace fusion
     }
 
     template 
-    void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence& seq, F const& f);
 
     template 
-    void
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , void
+        >::type
     for_each(Sequence const& seq, F const& f);
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
index ade58671a..048871632 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/count.hpp
@@ -10,6 +10,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline int
+    inline
+    typename
+        enable_if<
+            traits::is_sequence
+          , int
+        >::type
     count(Sequence const& seq, T const& x)
     {
         detail::count_compare f(x);
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
index 51112cf0d..792979733 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/count_if.hpp
@@ -10,6 +10,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -23,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline int
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , int
+        >::type
     count_if(Sequence const& seq, F f)
     {
         return detail::count_if(
diff --git a/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp b/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
index 42409d5a1..5f6b85772 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/query/detail/any.hpp
@@ -109,7 +109,7 @@ namespace detail
     struct unrolled_any<0>
     {
         template 
-        static bool call(It const& it, F f)
+        static bool call(It const&, F)
         {
             return false;
         }
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
index 304ed4c51..6ad737fd1 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/erase.hpp
@@ -16,6 +16,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -53,18 +56,38 @@ namespace boost { namespace fusion
             }
         };
 
+        struct use_default;
+        
+        template 
+        struct fusion_default_help
+          : mpl::if_<
+                is_same
+              , Default
+              , T
+            >
+        {
+        };
+        
         template <
             typename Sequence
           , typename First
-          , typename Last = typename compute_erase_last::type>
+          , typename Last = use_default>
         struct erase
         {
             typedef typename result_of::begin::type seq_first_type;
             typedef typename result_of::end::type seq_last_type;
             BOOST_STATIC_ASSERT((!result_of::equal_to::value));
 
-            typedef typename convert_iterator::type first_type;
-            typedef typename convert_iterator::type last_type;
+            typedef First FirstType;
+            typedef typename 
+                fusion_default_help<
+                    Last 
+                  , typename compute_erase_last::type
+                >::type
+            LastType;
+            
+            typedef typename convert_iterator::type first_type;
+            typedef typename convert_iterator::type last_type;
             typedef iterator_range left_type;
             typedef iterator_range right_type;
             typedef joint_view type;
@@ -72,7 +95,11 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::erase::type
+    typename 
+        lazy_enable_if<
+            traits::is_sequence
+          , typename result_of::erase 
+        >::type
     erase(Sequence const& seq, First const& first)
     {
         typedef result_of::erase result_of;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
index ac5bca38a..2052fc01a 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/insert.hpp
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -38,8 +40,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::insert<
-        Sequence const, Position, T>::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::insert
+        >::type
     insert(Sequence const& seq, Position const& pos, T const& x)
     {
         typedef result_of::insert<
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
index 00a01a806..9afe538ab 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_back.hpp
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,7 +26,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::push_back::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_back
+        >::type
     push_back(Sequence const& seq, T const& x)
     {
         typedef typename result_of::push_back push_back;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
index d08ad2798..abe7faade 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/push_front.hpp
@@ -10,6 +10,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -24,7 +26,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::push_front::type
+    inline 
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_front
+        >::type
     push_front(Sequence const& seq, T const& x)
     {
         typedef typename result_of::push_front push_front;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
index bfe186e5a..a92e6e373 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace.hpp
@@ -9,6 +9,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -22,7 +24,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::replace::type
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , typename result_of::replace::type
+        >::type
     replace(Sequence const& seq, T const& old_value, T const& new_value)
     {
         typedef typename result_of::replace::type result;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
index 29913436e..39b9009a7 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -24,7 +25,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline typename result_of::replace_if::type
+    inline 
+    typename 
+        enable_if<
+            traits::is_sequence
+          , typename result_of::replace_if::type
+        >::type
     replace_if(Sequence const& seq, F pred, T const& new_value)
     {
         typedef typename result_of::replace_if::type result;
diff --git a/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp b/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
index 23c4fe653..923b90fc6 100644
--- a/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
+++ b/project/jni/boost/include/boost/fusion/algorithm/transformation/reverse.hpp
@@ -8,6 +8,8 @@
 #define FUSION_REVERSE_07212005_1230
 
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -21,7 +23,12 @@ namespace boost { namespace fusion
     }
 
     template 
-    inline reverse_view
+    inline 
+    typename
+        enable_if<
+            traits::is_sequence
+          , reverse_view
+        >::type
     reverse(Sequence const& view)
     {
         return reverse_view(view);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
index ef8345f7d..738e05bbd 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/back_extended_deque.hpp
@@ -1,36 +1,47 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209)
 #define BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209
 
-#include 
 #include 
-#include 
+
 #include 
 #include 
+#include 
 
-#include 
-#include 
-
-namespace boost { namespace fusion {
-    template
+namespace boost { namespace fusion
+{
+    template 
     struct back_extended_deque
-        : detail::keyed_element,
-          sequence_base >
+      : detail::keyed_element
+      , sequence_base >
     {
         typedef detail::keyed_element base;
         typedef typename Deque::next_down next_down;
-        typedef mpl::int_ >::value> next_up;
-        typedef mpl::plus::type, mpl::int_<1> > size;
+        typedef mpl::int_<(Deque::next_up::value + 1)> next_up;
+        typedef mpl::int_<(result_of::size::value + 1)> size;
 
-        back_extended_deque(Deque const& deque, typename add_reference::type>::type t)
-            : base(t, deque)
+        template 
+        back_extended_deque(Deque const& deque, Arg const& val)
+          : base(val, deque)
         {}
+
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        back_extended_deque(Deque const& deque, Arg& val)
+          : base(val, deque)
+        {}
+#else
+        template 
+        back_extended_deque(Deque const& deque, Arg&& val)
+          : base(std::forward(val), deque)
+        {}
+#endif
     };
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/convert.hpp b/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
index 0f8ea6576..1910cb84f 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/convert.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -21,7 +21,9 @@ namespace boost { namespace fusion
         template 
         struct as_deque
         {
-            typedef typename detail::as_deque::value> gen;
+            typedef typename
+                detail::as_deque::value>
+            gen;
             typedef typename gen::
                 template apply::type>::type
             type;
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
index 97238f4ad..56ae290e0 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,20 +8,26 @@
 #if !defined(BOOST_FUSION_DEQUE_26112006_1649)
 #define BOOST_FUSION_DEQUE_26112006_1649
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 
+///////////////////////////////////////////////////////////////////////////////
+// With variadics, we will use the PP version version
+///////////////////////////////////////////////////////////////////////////////
+#if defined(BOOST_NO_VARIADIC_TEMPLATES)
+# include 
+#else
+# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#   define BOOST_FUSION_HAS_VARIADIC_DEQUE
+# endif
+
+///////////////////////////////////////////////////////////////////////////////
+// C++11 variadic interface
+///////////////////////////////////////////////////////////////////////////////
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -29,93 +35,129 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
-#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
-#include 
-#else
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
-#endif
-
-/*=============================================================================
-    Copyright (c) 2001-2011 Joel de Guzman
-
-    Distributed under the Boost Software License, Version 1.0. (See accompanying
-    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-    This is an auto-generated file. Do not edit!
-==============================================================================*/
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 1)
-#endif
-
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    template
-    struct deque
-        :
-        detail::deque_keyed_values::type,
-        sequence_base >
+    template 
+    struct deque : detail::nil_keyed_element
     {
         typedef deque_tag fusion_tag;
         typedef bidirectional_traversal_tag category;
-        typedef typename detail::deque_keyed_values::type base;
-        typedef typename detail::deque_initial_size::type size;
-        typedef mpl::int_ next_up;
-        typedef mpl::int_<
-            mpl::if_ >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
+        typedef mpl::int_<0> size;
+        typedef mpl::int_<0> next_up;
+        typedef mpl::int_<0> next_down;
         typedef mpl::false_ is_view;
 
-#include 
+        template 
+        deque(Sequence const&,
+            typename enable_if<
+                mpl::and_<
+                    traits::is_sequence
+                  , result_of::empty>>::type* /*dummy*/ = 0)
+        {}
+
+        deque() {}
+    };
+
+    template 
+    struct deque
+      : detail::deque_keyed_values::type
+      , sequence_base>
+    {
+        typedef deque_tag fusion_tag;
+        typedef bidirectional_traversal_tag category;
+        typedef typename detail::deque_keyed_values::type base;
+        typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
+        typedef mpl::int_ next_up;
+        typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down;
+        typedef mpl::false_ is_view;
 
         deque()
-            {}
+        {}
 
-        explicit deque(typename add_reference::type>::type t0)
-            : base(t0, detail::nil_keyed_element())
-            {}
+        template 
+        deque(deque const& seq)
+          : base(seq)
+        {}
 
-        template
-            deque(deque const& seq)
-            : base(seq)
-            {}
+        template 
+        deque(deque& seq)
+          : base(seq)
+        {}
 
-        template
-            deque(Sequence const& seq, typename disable_if >::type* /*dummy*/ = 0)
-            : base(base::from_iterator(fusion::begin(seq)))
-            {}
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque(deque&& seq)
+          : base(std::forward>(seq))
+        {}
+#endif
 
-        template 
-        deque&
-        operator=(deque const& rhs)
+        deque(deque const& seq)
+          : base(seq)
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        deque(deque&& seq)
+          : base(std::forward(seq))
+        {}
+#endif
+
+        explicit deque(Head const& head, Tail const&... tail)
+          : base(detail::deque_keyed_values::construct(head, tail...))
+        {}
+
+        template 
+        explicit deque(Head_ const& head, Tail_ const&... tail)
+          : base(detail::deque_keyed_values::construct(head, tail...))
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        explicit deque(Head_&& head, Tail_&&... tail)
+          : base(detail::deque_keyed_values
+                ::forward_(std::forward(head), std::forward(tail)...))
+        {}
+#endif
+
+        template 
+        explicit deque(Sequence const& seq
+          , typename disable_if >::type* /*dummy*/ = 0)
+          : base(base::from_iterator(fusion::begin(seq)))
+        {}
+
+        template 
+        deque& operator=(deque const& rhs)
         {
             base::operator=(rhs);
             return *this;
         }
 
         template 
-        deque&
-        operator=(T const& rhs)
+        deque& operator=(T const& rhs)
         {
             base::operator=(rhs);
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque& operator=(T&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            return *this;
+        }
+#endif
+
     };
 }}
 
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(output: null)
 #endif
-
-#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
-
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
index 7f9a1f9b7..fc1f9cbde 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque_fwd.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2007 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,43 +8,28 @@
 #if !defined(FUSION_DEQUE_FORWARD_02092007_0749)
 #define FUSION_DEQUE_FORWARD_02092007_0749
 
-#include 
-#include 
+#include 
 
-#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
-#include 
+///////////////////////////////////////////////////////////////////////////////
+// With no decltype and variadics, we will use the C++03 version
+///////////////////////////////////////////////////////////////////////////////
+#if (defined(BOOST_NO_DECLTYPE)             \
+  || defined(BOOST_NO_VARIADIC_TEMPLATES)   \
+  || defined(BOOST_NO_RVALUE_REFERENCES))
+# include 
 #else
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR "_fwd.hpp")
-#endif
-
-/*=============================================================================
-    Copyright (c) 2001-2011 Joel de Guzman
-
-    Distributed under the Boost Software License, Version 1.0. (See accompanying
-    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-    This is an auto-generated file. Do not edit!
-==============================================================================*/
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 1)
-#endif
+# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#   define BOOST_FUSION_HAS_VARIADIC_DEQUE
+# endif
 
+///////////////////////////////////////////////////////////////////////////////
+// C++11 interface
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace fusion
 {
-    struct void_;
-
-    template<
-        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
-            FUSION_MAX_DEQUE_SIZE, typename T, void_)>
+    template 
     struct deque;
 }}
 
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(output: null)
 #endif
-
-#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
-
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp b/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
index 3cb02f08f..d3e5f31eb 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/deque_iterator.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_ITERATOR_26112006_2154)
@@ -12,13 +12,13 @@
 #include 
 #include 
 #include 
-#include  
+#include 
 
 namespace boost { namespace fusion {
 
     struct bidirectional_traversal_tag;
 
-    template
+    template 
     struct deque_iterator
         : iterator_facade, bidirectional_traversal_tag>
     {
@@ -84,7 +84,7 @@ namespace boost { namespace fusion {
             typedef typename
                 mpl::minus<
                     typename I2::index, typename I1::index
-                >::type 
+                >::type
             type;
 
             static type
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
index bc9ae8461..906f4fb65 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/as_deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
index dc09d31b7..0684dcf19 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/at_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017)
@@ -19,15 +19,15 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct at_impl;
-        
+
         template<>
         struct at_impl
         {
@@ -37,15 +37,21 @@ namespace boost { namespace fusion {
                 typedef typename Sequence::next_up next_up;
                 typedef typename Sequence::next_down next_down;
                 BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-                
-                typedef mpl::plus > offset;
-                typedef mpl::int_::value> adjusted_index;
-                typedef typename detail::keyed_element_value_at::type element_type;
-                typedef typename add_reference<
-                    typename mpl::eval_if<
-                    is_const,
-                    add_const,
-                    mpl::identity >::type>::type type;
+
+                static int const offset = next_down::value + 1;
+                typedef mpl::int_<(N::value + offset)> adjusted_index;
+                typedef typename
+                    detail::keyed_element_value_at::type
+                element_type;
+
+                typedef typename
+                    add_reference<
+                      typename mpl::eval_if<
+                      is_const,
+                      add_const,
+                      mpl::identity >::type
+                    >::type
+                type;
 
                 static type call(Sequence& seq)
                 {
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
index 8c02b9ac8..1447868a3 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct begin_impl;
-        
+
         template<>
         struct begin_impl
         {
             template
             struct apply
             {
-                typedef typename mpl::if_<
-                    mpl::equal_to,
-                    deque_iterator,
-                    deque_iterator<
-                    Sequence, mpl::plus >::value> >::type type;
-                
+                typedef typename
+                    mpl::if_c<
+                        (Sequence::next_down::value == Sequence::next_up::value)
+                      , deque_iterator
+                      , deque_iterator
+                    >::type
+                type;
+
                 static type call(Sequence& seq)
                 {
                     return type(seq);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
index 9693d95d1..1401ef1ac 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -28,7 +28,7 @@ namespace boost { namespace fusion
             template 
             struct apply
             {
-                typedef typename detail::as_deque::value> gen;
+                typedef detail::as_deque::value> gen;
                 typedef typename gen::
                     template apply::type>::type
                 type;
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
index 38d5e6430..44d279f62 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
@@ -1,14 +1,20 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_PP_IS_ITERATING)
 #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#define FUSION_DEQUE_FORWARD_CTOR_FORWARD(z, n, _)    std::forward(t##n)
+
 #include 
 #include 
 #include 
@@ -18,14 +24,22 @@
 #define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_DEQUE_FORWARD_CTOR_FORWARD
 #endif
 #else
 
 #define N BOOST_PP_ITERATION()
 
 deque(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
-    : base(detail::deque_keyed_values::call(BOOST_PP_ENUM_PARAMS(N, t)))
+    : base(detail::deque_keyed_values::construct(BOOST_PP_ENUM_PARAMS(N, t)))
 {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
+    : base(detail::deque_keyed_values::
+		forward_(BOOST_PP_ENUM(N, FUSION_DEQUE_FORWARD_CTOR_FORWARD, _)))
+{}
+#endif
+
 #undef N
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
index 738221ce2..21075ef47 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
 #include 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
index d96f16a0c..d457516fc 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,21 +9,30 @@
 #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
+#include 
 #include 
 
+#define FUSION_DEQUE_KEYED_VALUES_FORWARD(z, n, _)    \
+   std::forward(BOOST_PP_CAT(t, n))
+
 #define BOOST_PP_FILENAME_1 \
     
 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_DEQUE_KEYED_VALUES_FORWARD
 #endif
 #else
 
 #define N BOOST_PP_ITERATION()
 
-        static type call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
+        static type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference::type>::type t))
         {
             return type(t0,
                         deque_keyed_values_impl<
@@ -34,5 +43,16 @@
                         >::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
         }
 
+        static type forward_(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
+        {
+            return type(std::forward(t0),
+                        deque_keyed_values_impl<
+                        next_index
+        #if N > 1
+                        , BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
+        #endif
+                        >::forward_(BOOST_PP_ENUM_SHIFTED(N, FUSION_DEQUE_KEYED_VALUES_FORWARD, _)));
+        }
+
 #undef N
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
index 0727e00f5..8037689ab 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/end_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_END_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct end_impl;
-        
+
         template<>
         struct end_impl
         {
             template
             struct apply
             {
-                typedef typename mpl::if_<
-                    mpl::equal_to,
-                    deque_iterator,
-                    deque_iterator<
-                    Sequence, Sequence::next_up::value> >::type type;
-                
+                typedef typename
+                    mpl::if_c<
+                        (Sequence::next_down::value == Sequence::next_up::value)
+                      , deque_iterator
+                      , deque_iterator
+                    >::type
+                type;
+
                 static type call(Sequence& seq)
                 {
                     return type(seq);
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
index ff88ed6f2..b4718be41 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/is_sequence_impl.hpp
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2010 Christopher Schmidt
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
@@ -14,18 +14,16 @@ namespace boost { namespace fusion
 {
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct is_sequence_impl;
-        
+
         template<>
         struct is_sequence_impl
         {
             template
-            struct apply
-              : mpl::true_
-            {};
+            struct apply : mpl::true_ {};
         };
     }
 }}
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
index 1b5e34687..e5bdc2abd 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp
@@ -1,47 +1,45 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
 #define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
 
-#include 
-#include 
-
+#include 
 #include 
 #include 
 
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
     struct fusion_sequence_tag;
+}}
 
-namespace detail {
-
+namespace boost { namespace fusion { namespace detail
+{
     struct nil_keyed_element
     {
         typedef fusion_sequence_tag tag;
         void get();
 
         template
-        static nil_keyed_element 
+        static nil_keyed_element
         from_iterator(It const&)
         {
             return nil_keyed_element();
         }
     };
 
-    template
-    struct keyed_element
-        : Rest
+    template 
+    struct keyed_element : Rest
     {
         typedef Rest base;
         typedef fusion_sequence_tag tag;
         using Rest::get;
 
-        template
+        template 
         static keyed_element
         from_iterator(It const& it)
         {
@@ -49,30 +47,65 @@ namespace detail {
                 *it, base::from_iterator(fusion::next(it)));
         }
 
-        template
-        keyed_element(keyed_element const& rhs)
-            : Rest(rhs.get_base()), value_(rhs.value_)
+        keyed_element(keyed_element const& rhs)
+          : Rest(rhs.get_base()), value_(rhs.value_)
         {}
 
-        Rest const get_base() const
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element(keyed_element&& rhs)
+          : Rest(std::forward(rhs.forward_base()))
+          , value_(std::forward(rhs.value_))
+        {}
+#endif
+
+        template 
+        keyed_element(keyed_element const& rhs)
+          : Rest(rhs.get_base()), value_(rhs.value_)
+        {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#endif
+
+        Rest& get_base()
         {
             return *this;
         }
 
-        typename add_reference::type>::type get(Key) const
+        Rest const& get_base() const
+        {
+            return *this;
+        }
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        Rest&& forward_base()
+        {
+            return std::forward(*static_cast(this));
+        }
+#endif
+
+        typename cref_result::type get(Key) const
         {
             return value_;
         }
 
-        typename add_reference::type get(Key)
+        typename ref_result::type get(Key)
         {
             return value_;
         }
 
-        keyed_element(typename add_reference::type>::type value, Rest const& rest)
+        keyed_element(
+            typename detail::call_param::type value
+          , Rest const& rest)
             : Rest(rest), value_(value)
         {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element(Value&& value, Rest&& rest)
+            : Rest(std::forward(rest))
+            , value_(std::forward(value))
+        {}
+#endif
+
         keyed_element()
             : Rest(), value_()
         {}
@@ -92,12 +125,21 @@ namespace detail {
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        keyed_element& operator=(keyed_element&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            value_ = std::forward(rhs.value_);
+            return *this;
+        }
+#endif
+
         Value value_;
     };
 
     template
     struct keyed_element_value_at
-        : keyed_element_value_at
+      : keyed_element_value_at
     {};
 
     template
@@ -105,7 +147,6 @@ namespace detail {
     {
         typedef Value type;
     };
-
 }}}
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp
new file mode 100644
index 000000000..7913b67ba
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque.hpp
@@ -0,0 +1,156 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2006 Dan Marsden
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
+#define BOOST_PP_FUSION_DEQUE_26112006_1649
+
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include 
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
+#endif
+
+/*=============================================================================
+    Copyright (c) 2001-2011 Joel de Guzman
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+    This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion {
+
+    struct deque_tag;
+
+    template
+    struct deque
+        :
+        detail::deque_keyed_values::type,
+        sequence_base >
+    {
+        typedef deque_tag fusion_tag;
+        typedef bidirectional_traversal_tag category;
+        typedef typename detail::deque_keyed_values::type base;
+        typedef typename detail::deque_initial_size::type size;
+        typedef mpl::int_ next_up;
+        typedef mpl::int_<
+            mpl::if_ >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
+        typedef mpl::false_ is_view;
+
+#include 
+
+        deque()
+            {}
+
+        explicit deque(typename add_reference::type>::type t0)
+            : base(t0, detail::nil_keyed_element())
+            {}
+
+        explicit deque(deque const& rhs)
+            : base(rhs)
+            {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        explicit deque(T0&& t0)
+            : base(std::forward(t0), detail::nil_keyed_element())
+            {}
+
+        explicit deque(deque&& rhs)
+            : base(std::forward(rhs))
+            {}
+#endif
+
+        template
+        deque(deque const& seq)
+            : base(seq)
+            {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template
+        deque(deque&& seq)
+            : base(std::forward>(seq))
+            {}
+#endif
+
+        template
+        deque(Sequence const& seq, typename disable_if >::type* /*dummy*/ = 0)
+            : base(base::from_iterator(fusion::begin(seq)))
+            {}
+
+        template 
+        deque&
+        operator=(deque const& rhs)
+        {
+            base::operator=(rhs);
+            return *this;
+        }
+
+        template 
+        deque&
+        operator=(T const& rhs)
+        {
+            base::operator=(rhs);
+            return *this;
+        }
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        deque&
+        operator=(T&& rhs)
+        {
+            base::operator=(std::forward(rhs));
+            return *this;
+        }
+#endif
+
+    };
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp
new file mode 100644
index 000000000..354cfccdc
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_fwd.hpp
@@ -0,0 +1,54 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2007 Dan Marsden
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(FUSION_PP_DEQUE_FORWARD_02092007_0749)
+#define FUSION_PP_DEQUE_FORWARD_02092007_0749
+
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include 
+#include 
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include 
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR "_fwd.hpp")
+#endif
+
+/*=============================================================================
+    Copyright (c) 2001-2011 Joel de Guzman
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+    This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion
+{
+    struct void_;
+
+    template<
+        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+            FUSION_MAX_DEQUE_SIZE, typename T, void_)>
+    struct deque;
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
similarity index 93%
rename from project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp
rename to project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
index 898bc46b9..a7c4939a3 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 #include 
 
@@ -68,6 +72,11 @@ namespace boost { namespace fusion { namespace detail
         {
             return type();
         }
+
+        static type forward_()
+        {
+            return type();
+        }
     };
 
     template
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
index 64dbe5e16..cba31a3e0 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp
@@ -1,8 +1,8 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See accompanying 
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 #if !defined(BOOST_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756)
@@ -13,15 +13,15 @@
 #include 
 #include 
 
-namespace boost { namespace fusion { 
-
+namespace boost { namespace fusion
+{
     struct deque_tag;
 
-    namespace extension 
+    namespace extension
     {
         template
         struct value_at_impl;
-        
+
         template<>
         struct value_at_impl
         {
@@ -31,10 +31,12 @@ namespace boost { namespace fusion {
                 typedef typename Sequence::next_up next_up;
                 typedef typename Sequence::next_down next_down;
                 BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-                
-                typedef mpl::plus > offset;
-                typedef mpl::int_::value> adjusted_index;
-                typedef typename detail::keyed_element_value_at::type type;
+
+                static int const offset = next_down::value + 1;
+                typedef mpl::int_<(N::value + offset)> adjusted_index;
+                typedef typename
+                    detail::keyed_element_value_at::type
+                type;
             };
         };
     }
diff --git a/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp b/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp
new file mode 100644
index 000000000..aae26a5b3
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+    Copyright (c) 2005-2012 Joel de Guzman
+    Copyright (c) 2005-2006 Dan Marsden
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901)
+#define BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901
+
+#include 
+#include 
+#include 
+#include 
+
+namespace boost { namespace fusion { namespace detail
+{
+    template
+    struct keyed_element;
+
+    template 
+    struct deque_keyed_values_impl;
+
+    template 
+    struct deque_keyed_values_impl
+    {
+        typedef mpl::int_<(N::value + 1)> next_index;
+        typedef typename deque_keyed_values_impl::type tail;
+        typedef keyed_element type;
+
+        static type construct(
+          typename detail::call_param::type head
+        , typename detail::call_param::type... tail)
+        {
+            return type(
+                head
+              , deque_keyed_values_impl::construct(tail...)
+            );
+        }
+
+        template 
+        static type forward_(Head_&& head, Tail_&&... tail)
+        {
+            return type(
+                std::forward(head)
+              , deque_keyed_values_impl::
+                  forward_(std::forward(tail)...)
+            );
+        }
+    };
+
+    struct nil_keyed_element;
+
+    template 
+    struct deque_keyed_values_impl
+    {
+        typedef nil_keyed_element type;
+        static type construct() { return type(); }
+        static type forward_() { return type(); }
+    };
+
+    template 
+    struct deque_keyed_values
+      : deque_keyed_values_impl, Elements...> {};
+}}}
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp b/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
index 7a7f9cee2..2f3654ede 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/front_extended_deque.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,32 +8,39 @@
 #if !defined(BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209)
 #define BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209
 
-#include 
 #include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
 #include 
+#include 
+#include 
 
 namespace boost { namespace fusion
 {
-    template
+    template 
     struct front_extended_deque
-        : detail::keyed_element,
-          sequence_base >
+      : detail::keyed_element
+      , sequence_base >
     {
         typedef detail::keyed_element base;
-        typedef mpl::int_ >::value> next_down;
+        typedef mpl::int_<(Deque::next_down::value - 1)> next_down;
         typedef typename Deque::next_up next_up;
-        typedef mpl::plus::type, mpl::int_<1> > size;
+        typedef mpl::int_<(result_of::size::value + 1)> size;
 
-        front_extended_deque(Deque const& deque, typename add_reference::type>::type t)
-            : base(t, deque)
+        template 
+        front_extended_deque(Deque const& deque, Arg const& val)
+          : base(val, deque)
         {}
+
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+        template 
+        front_extended_deque(Deque const& deque, Arg& val)
+          : base(val, deque)
+        {}
+#else
+        template 
+        front_extended_deque(Deque const& deque, Arg&& val)
+          : base(std::forward(val), deque)
+        {}
+#endif
     };
 }}
 
diff --git a/project/jni/boost/include/boost/fusion/container/deque/limits.hpp b/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
index 891d41ed0..7892ba1a8 100644
--- a/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
+++ b/project/jni/boost/include/boost/fusion/container/deque/limits.hpp
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2005-2011 Joel de Guzman
+    Copyright (c) 2005-2012 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
 #if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
 #define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
 
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
 #include 
 
 #if !defined(FUSION_MAX_DEQUE_SIZE)
diff --git a/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
index 145f8aa53..757463928 100644
--- a/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/list/detail/at_impl.hpp
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 namespace boost { namespace fusion
@@ -93,15 +93,15 @@ namespace boost { namespace fusion
             template 
             struct apply
             {
-                typedef detail::cons_deref<
-                    typename detail::cons_advance::type>
+                typedef typename detail::cons_deref<
+                    typename detail::cons_advance::type>::type
                 element;
 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , detail::cref_result
-                      , detail::ref_result
+                      , typename detail::cref_result::type
+                      , typename detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
index f871bee08..025c1724a 100644
--- a/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/map/detail/at_impl.hpp
@@ -28,7 +28,9 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename 
+                    mpl::at::type 
+                element;
                 typedef typename detail::ref_result::type type;
     
                 static type
@@ -39,9 +41,11 @@ namespace boost { namespace fusion
             };
 
             template 
-            struct apply 
+            struct apply
             {
-                typedef mpl::at element;
+                typedef typename 
+                    mpl::at::type 
+                element;
                 typedef typename detail::cref_result::type type;
     
                 static type
diff --git a/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp b/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
index 07087a39a..8304c898e 100644
--- a/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/map/detail/deref_data_impl.hpp
@@ -12,8 +12,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 namespace boost { namespace fusion { namespace extension
 {
@@ -29,10 +28,10 @@ namespace boost { namespace fusion { namespace extension
             typedef typename result_of::value_of::type::second_type data;
 
             typedef typename
-                mpl::eval_if<
+                mpl::if_<
                     is_const
-                  , detail::cref_result >
-                  , detail::ref_result >
+                  , typename detail::cref_result::type
+                  , typename detail::ref_result::type
                 >::type
             type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
index 0a006dc33..0017d9c81 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/at_impl.hpp
@@ -27,7 +27,7 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename mpl::at::type element;
                 typedef typename detail::ref_result::type type;
     
                 static type
@@ -40,7 +40,7 @@ namespace boost { namespace fusion
             template 
             struct apply 
             {
-                typedef mpl::at element;
+                typedef typename mpl::at::type element;
                 typedef typename detail::cref_result::type type;
     
                 static type
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
index 1d9ac4a83..8c5fb9420 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion
 {
@@ -29,14 +30,14 @@ namespace boost { namespace fusion
                 typedef typename Iterator::vector vector;
                 typedef typename Iterator::index index;
                 typedef typename mpl::at<
-                    typename vector::types, index> 
+                    typename vector::types, index>::type
                 element;
                 
                 typedef typename
-                    mpl::eval_if<
+                    mpl::if_<
                         is_const
-                      , fusion::detail::cref_result
-                      , fusion::detail::ref_result
+                      , typename fusion::detail::cref_result::type
+                      , typename fusion::detail::ref_result::type
                     >::type
                 type;
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
index d6258f60a..8ef9947de 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector10.hpp
@@ -34,6 +34,15 @@ namespace boost { namespace fusion
             
             return vector_data1(*i0);
         }
+        template 
+        static vector_data1
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            
+            return vector_data1(*i0);
+        }
         T0 m0;
     };
     template 
@@ -64,6 +73,12 @@ namespace boost { namespace fusion
           , typename boost::disable_if >::type* = 0
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector1(
+            Sequence& seq
+          , typename boost::disable_if >::type* = 0
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector1&
         operator=(vector1 const& vec)
@@ -121,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0);
             return vector_data2(*i0 , *i1);
         }
+        template 
+        static vector_data2
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0);
+            return vector_data2(*i0 , *i1);
+        }
         T0 m0; T1 m1;
     };
     template 
@@ -149,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector2(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector2&
         operator=(vector2 const& vec)
@@ -206,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1);
             return vector_data3(*i0 , *i1 , *i2);
         }
+        template 
+        static vector_data3
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1);
+            return vector_data3(*i0 , *i1 , *i2);
+        }
         T0 m0; T1 m1; T2 m2;
     };
     template 
@@ -234,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector3(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector3&
         operator=(vector3 const& vec)
@@ -291,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2);
             return vector_data4(*i0 , *i1 , *i2 , *i3);
         }
+        template 
+        static vector_data4
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2);
+            return vector_data4(*i0 , *i1 , *i2 , *i3);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3;
     };
     template 
@@ -319,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector4(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector4&
         operator=(vector4 const& vec)
@@ -376,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3);
             return vector_data5(*i0 , *i1 , *i2 , *i3 , *i4);
         }
+        template 
+        static vector_data5
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3);
+            return vector_data5(*i0 , *i1 , *i2 , *i3 , *i4);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4;
     };
     template 
@@ -404,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector5(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector5&
         operator=(vector5 const& vec)
@@ -461,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4);
             return vector_data6(*i0 , *i1 , *i2 , *i3 , *i4 , *i5);
         }
+        template 
+        static vector_data6
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4);
+            return vector_data6(*i0 , *i1 , *i2 , *i3 , *i4 , *i5);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5;
     };
     template 
@@ -489,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector6(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector6&
         operator=(vector6 const& vec)
@@ -546,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5);
             return vector_data7(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6);
         }
+        template 
+        static vector_data7
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5);
+            return vector_data7(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6;
     };
     template 
@@ -574,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector7(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector7&
         operator=(vector7 const& vec)
@@ -631,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6);
             return vector_data8(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7);
         }
+        template 
+        static vector_data8
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6);
+            return vector_data8(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7;
     };
     template 
@@ -659,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector8(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector8&
         operator=(vector8 const& vec)
@@ -716,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7);
             return vector_data9(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8);
         }
+        template 
+        static vector_data9
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7);
+            return vector_data9(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8;
     };
     template 
@@ -744,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector9(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector9&
         operator=(vector9 const& vec)
@@ -801,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8);
             return vector_data10(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9);
         }
+        template 
+        static vector_data10
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8);
+            return vector_data10(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9;
     };
     template 
@@ -829,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector10(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector10&
         operator=(vector10 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
index a409b2e7a..151acbbdc 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector20.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9);
             return vector_data11(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10);
         }
+        template 
+        static vector_data11
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9);
+            return vector_data11(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector11(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector11&
         operator=(vector11 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10);
             return vector_data12(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11);
         }
+        template 
+        static vector_data12
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10);
+            return vector_data12(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector12(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector12&
         operator=(vector12 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11);
             return vector_data13(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12);
         }
+        template 
+        static vector_data13
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11);
+            return vector_data13(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector13(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector13&
         operator=(vector13 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12);
             return vector_data14(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13);
         }
+        template 
+        static vector_data14
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12);
+            return vector_data14(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector14(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector14&
         operator=(vector14 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13);
             return vector_data15(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14);
         }
+        template 
+        static vector_data15
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13);
+            return vector_data15(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector15(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector15&
         operator=(vector15 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14);
             return vector_data16(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15);
         }
+        template 
+        static vector_data16
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14);
+            return vector_data16(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector16(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector16&
         operator=(vector16 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15);
             return vector_data17(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16);
         }
+        template 
+        static vector_data17
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15);
+            return vector_data17(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector17(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector17&
         operator=(vector17 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16);
             return vector_data18(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17);
         }
+        template 
+        static vector_data18
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16);
+            return vector_data18(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector18(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector18&
         operator=(vector18 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17);
             return vector_data19(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18);
         }
+        template 
+        static vector_data19
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17);
+            return vector_data19(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector19(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector19&
         operator=(vector19 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18);
             return vector_data20(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19);
         }
+        template 
+        static vector_data20
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18);
+            return vector_data20(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector20(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector20&
         operator=(vector20 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
index 032ff9d29..3810091bc 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector30.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19);
             return vector_data21(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20);
         }
+        template 
+        static vector_data21
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19);
+            return vector_data21(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector21(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector21&
         operator=(vector21 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20);
             return vector_data22(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21);
         }
+        template 
+        static vector_data22
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20);
+            return vector_data22(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector22(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector22&
         operator=(vector22 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21);
             return vector_data23(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22);
         }
+        template 
+        static vector_data23
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21);
+            return vector_data23(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector23(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector23&
         operator=(vector23 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22);
             return vector_data24(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23);
         }
+        template 
+        static vector_data24
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22);
+            return vector_data24(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector24(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector24&
         operator=(vector24 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23);
             return vector_data25(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24);
         }
+        template 
+        static vector_data25
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23);
+            return vector_data25(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector25(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector25&
         operator=(vector25 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24);
             return vector_data26(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25);
         }
+        template 
+        static vector_data26
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24);
+            return vector_data26(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector26(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector26&
         operator=(vector26 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25);
             return vector_data27(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26);
         }
+        template 
+        static vector_data27
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25);
+            return vector_data27(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector27(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector27&
         operator=(vector27 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26);
             return vector_data28(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27);
         }
+        template 
+        static vector_data28
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26);
+            return vector_data28(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector28(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector28&
         operator=(vector28 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27);
             return vector_data29(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28);
         }
+        template 
+        static vector_data29
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27);
+            return vector_data29(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector29(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector29&
         operator=(vector29 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28);
             return vector_data30(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29);
         }
+        template 
+        static vector_data30
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28);
+            return vector_data30(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector30(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector30&
         operator=(vector30 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
index 1b5fa58d9..07fac8dcf 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector40.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29);
             return vector_data31(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30);
         }
+        template 
+        static vector_data31
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29);
+            return vector_data31(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector31(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector31&
         operator=(vector31 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30);
             return vector_data32(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31);
         }
+        template 
+        static vector_data32
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30);
+            return vector_data32(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector32(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector32&
         operator=(vector32 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31);
             return vector_data33(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32);
         }
+        template 
+        static vector_data33
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31);
+            return vector_data33(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector33(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector33&
         operator=(vector33 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32);
             return vector_data34(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33);
         }
+        template 
+        static vector_data34
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32);
+            return vector_data34(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector34(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector34&
         operator=(vector34 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33);
             return vector_data35(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34);
         }
+        template 
+        static vector_data35
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33);
+            return vector_data35(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector35(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector35&
         operator=(vector35 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34);
             return vector_data36(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35);
         }
+        template 
+        static vector_data36
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34);
+            return vector_data36(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector36(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector36&
         operator=(vector36 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35);
             return vector_data37(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36);
         }
+        template 
+        static vector_data37
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35);
+            return vector_data37(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector37(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector37&
         operator=(vector37 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36);
             return vector_data38(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37);
         }
+        template 
+        static vector_data38
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36);
+            return vector_data38(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector38(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector38&
         operator=(vector38 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37);
             return vector_data39(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38);
         }
+        template 
+        static vector_data39
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37);
+            return vector_data39(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector39(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector39&
         operator=(vector39 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38);
             return vector_data40(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39);
         }
+        template 
+        static vector_data40
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38);
+            return vector_data40(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector40(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector40&
         operator=(vector40 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
index ba6c1771f..7ef9402e6 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/preprocessed/vector50.hpp
@@ -37,6 +37,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39);
             return vector_data41(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40);
         }
+        template 
+        static vector_data41
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39);
+            return vector_data41(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40;
     };
     template 
@@ -65,6 +74,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector41(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector41&
         operator=(vector41 const& vec)
@@ -122,6 +136,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40);
             return vector_data42(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41);
         }
+        template 
+        static vector_data42
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40);
+            return vector_data42(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41;
     };
     template 
@@ -150,6 +173,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector42(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector42&
         operator=(vector42 const& vec)
@@ -207,6 +235,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41);
             return vector_data43(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42);
         }
+        template 
+        static vector_data43
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41);
+            return vector_data43(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42;
     };
     template 
@@ -235,6 +272,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector43(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector43&
         operator=(vector43 const& vec)
@@ -292,6 +334,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42);
             return vector_data44(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43);
         }
+        template 
+        static vector_data44
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42);
+            return vector_data44(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43;
     };
     template 
@@ -320,6 +371,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector44(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector44&
         operator=(vector44 const& vec)
@@ -377,6 +433,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43);
             return vector_data45(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44);
         }
+        template 
+        static vector_data45
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43);
+            return vector_data45(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44;
     };
     template 
@@ -405,6 +470,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector45(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector45&
         operator=(vector45 const& vec)
@@ -462,6 +532,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44);
             return vector_data46(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45);
         }
+        template 
+        static vector_data46
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44);
+            return vector_data46(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45;
     };
     template 
@@ -490,6 +569,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector46(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector46&
         operator=(vector46 const& vec)
@@ -547,6 +631,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45);
             return vector_data47(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46);
         }
+        template 
+        static vector_data47
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45);
+            return vector_data47(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46;
     };
     template 
@@ -575,6 +668,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector47(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector47&
         operator=(vector47 const& vec)
@@ -632,6 +730,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46);
             return vector_data48(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47);
         }
+        template 
+        static vector_data48
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46);
+            return vector_data48(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47;
     };
     template 
@@ -660,6 +767,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector48(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector48&
         operator=(vector48 const& vec)
@@ -717,6 +829,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47);
             return vector_data49(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48);
         }
+        template 
+        static vector_data49
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47);
+            return vector_data49(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47; T48 m48;
     };
     template 
@@ -745,6 +866,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector49(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector49&
         operator=(vector49 const& vec)
@@ -802,6 +928,15 @@ namespace boost { namespace fusion
             typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47); typedef typename result_of::next< I48>::type I49; I49 i49 = fusion::next(i48);
             return vector_data50(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48 , *i49);
         }
+        template 
+        static vector_data50
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            typedef typename result_of::next< I0>::type I1; I1 i1 = fusion::next(i0); typedef typename result_of::next< I1>::type I2; I2 i2 = fusion::next(i1); typedef typename result_of::next< I2>::type I3; I3 i3 = fusion::next(i2); typedef typename result_of::next< I3>::type I4; I4 i4 = fusion::next(i3); typedef typename result_of::next< I4>::type I5; I5 i5 = fusion::next(i4); typedef typename result_of::next< I5>::type I6; I6 i6 = fusion::next(i5); typedef typename result_of::next< I6>::type I7; I7 i7 = fusion::next(i6); typedef typename result_of::next< I7>::type I8; I8 i8 = fusion::next(i7); typedef typename result_of::next< I8>::type I9; I9 i9 = fusion::next(i8); typedef typename result_of::next< I9>::type I10; I10 i10 = fusion::next(i9); typedef typename result_of::next< I10>::type I11; I11 i11 = fusion::next(i10); typedef typename result_of::next< I11>::type I12; I12 i12 = fusion::next(i11); typedef typename result_of::next< I12>::type I13; I13 i13 = fusion::next(i12); typedef typename result_of::next< I13>::type I14; I14 i14 = fusion::next(i13); typedef typename result_of::next< I14>::type I15; I15 i15 = fusion::next(i14); typedef typename result_of::next< I15>::type I16; I16 i16 = fusion::next(i15); typedef typename result_of::next< I16>::type I17; I17 i17 = fusion::next(i16); typedef typename result_of::next< I17>::type I18; I18 i18 = fusion::next(i17); typedef typename result_of::next< I18>::type I19; I19 i19 = fusion::next(i18); typedef typename result_of::next< I19>::type I20; I20 i20 = fusion::next(i19); typedef typename result_of::next< I20>::type I21; I21 i21 = fusion::next(i20); typedef typename result_of::next< I21>::type I22; I22 i22 = fusion::next(i21); typedef typename result_of::next< I22>::type I23; I23 i23 = fusion::next(i22); typedef typename result_of::next< I23>::type I24; I24 i24 = fusion::next(i23); typedef typename result_of::next< I24>::type I25; I25 i25 = fusion::next(i24); typedef typename result_of::next< I25>::type I26; I26 i26 = fusion::next(i25); typedef typename result_of::next< I26>::type I27; I27 i27 = fusion::next(i26); typedef typename result_of::next< I27>::type I28; I28 i28 = fusion::next(i27); typedef typename result_of::next< I28>::type I29; I29 i29 = fusion::next(i28); typedef typename result_of::next< I29>::type I30; I30 i30 = fusion::next(i29); typedef typename result_of::next< I30>::type I31; I31 i31 = fusion::next(i30); typedef typename result_of::next< I31>::type I32; I32 i32 = fusion::next(i31); typedef typename result_of::next< I32>::type I33; I33 i33 = fusion::next(i32); typedef typename result_of::next< I33>::type I34; I34 i34 = fusion::next(i33); typedef typename result_of::next< I34>::type I35; I35 i35 = fusion::next(i34); typedef typename result_of::next< I35>::type I36; I36 i36 = fusion::next(i35); typedef typename result_of::next< I36>::type I37; I37 i37 = fusion::next(i36); typedef typename result_of::next< I37>::type I38; I38 i38 = fusion::next(i37); typedef typename result_of::next< I38>::type I39; I39 i39 = fusion::next(i38); typedef typename result_of::next< I39>::type I40; I40 i40 = fusion::next(i39); typedef typename result_of::next< I40>::type I41; I41 i41 = fusion::next(i40); typedef typename result_of::next< I41>::type I42; I42 i42 = fusion::next(i41); typedef typename result_of::next< I42>::type I43; I43 i43 = fusion::next(i42); typedef typename result_of::next< I43>::type I44; I44 i44 = fusion::next(i43); typedef typename result_of::next< I44>::type I45; I45 i45 = fusion::next(i44); typedef typename result_of::next< I45>::type I46; I46 i46 = fusion::next(i45); typedef typename result_of::next< I46>::type I47; I47 i47 = fusion::next(i46); typedef typename result_of::next< I47>::type I48; I48 i48 = fusion::next(i47); typedef typename result_of::next< I48>::type I49; I49 i49 = fusion::next(i48);
+            return vector_data50(*i0 , *i1 , *i2 , *i3 , *i4 , *i5 , *i6 , *i7 , *i8 , *i9 , *i10 , *i11 , *i12 , *i13 , *i14 , *i15 , *i16 , *i17 , *i18 , *i19 , *i20 , *i21 , *i22 , *i23 , *i24 , *i25 , *i26 , *i27 , *i28 , *i29 , *i30 , *i31 , *i32 , *i33 , *i34 , *i35 , *i36 , *i37 , *i38 , *i39 , *i40 , *i41 , *i42 , *i43 , *i44 , *i45 , *i46 , *i47 , *i48 , *i49);
+        }
         T0 m0; T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; T9 m9; T10 m10; T11 m11; T12 m12; T13 m13; T14 m14; T15 m15; T16 m16; T17 m17; T18 m18; T19 m19; T20 m20; T21 m21; T22 m22; T23 m23; T24 m24; T25 m25; T26 m26; T27 m27; T28 m28; T29 m29; T30 m30; T31 m31; T32 m32; T33 m33; T34 m34; T35 m35; T36 m36; T37 m37; T38 m38; T39 m39; T40 m40; T41 m41; T42 m42; T43 m43; T44 m44; T45 m45; T46 m46; T47 m47; T48 m48; T49 m49;
     };
     template 
@@ -830,6 +965,11 @@ namespace boost { namespace fusion
             Sequence const& seq
             )
             : base_type(base_type::init_from_sequence(seq)) {}
+        template 
+        vector50(
+            Sequence& seq
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
         template 
         vector50&
         operator=(vector50 const& vec)
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
index 92f7aa6c2..c41d5b297 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp
@@ -12,11 +12,14 @@
 #include 
 #include 
 
+#define FUSION_FORWARD_CTOR_MOVE(z, n, _)    std::move(_##n)
+
 #define BOOST_PP_FILENAME_1 \
     
 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
 #include BOOST_PP_ITERATE()
 
+#undef FUSION_FORWARD_CTOR_MOVE
 #endif
 #else // defined(BOOST_PP_IS_ITERATING)
 ///////////////////////////////////////////////////////////////////////////////
@@ -34,6 +37,14 @@
         N, typename detail::call_param::type _))
         : vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if N == 1
+    explicit
+#endif
+    vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+        : vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {}
+#endif
+
 #undef N
 #endif // defined(BOOST_PP_IS_ITERATING)
 
diff --git a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
index 431774b37..539b47fa9 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/detail/vector_n.hpp
@@ -9,24 +9,31 @@
 #if !defined(FUSION_MACRO_05042005)
 #define FUSION_MACRO_05042005
 
-#define FUSION_MEMBER_DEFAULT_INIT(z, n, _)     m##n()
-#define FUSION_MEMBER_INIT(z, n, _)             m##n(_##n)
-#define FUSION_COPY_INIT(z, n, _)               m##n(other.m##n)
-#define FUSION_MEMBER_DECL(z, n, _)             T##n m##n;
+#define FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT(z, n, _)   m##n()
+#define FUSION_VECTOR_MEMBER_MEMBER_INIT(z, n, _)           m##n(_##n)
+#define FUSION_VECTOR_MEMBER_COPY_INIT(z, n, _)             m##n(other.m##n)
+#define FUSION_VECTOR_MEMBER_FWD(z, n, _)                   m##n(std::forward(other.m##n))
+#define FUSION_VECTOR_ARG_FWD(z, n, _)                      m##n(std::forward(_##n))
+#define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _)           T##n m##n;
+#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _)               std::forward(_##n)
 
-#define FUSION_MEMBER_ASSIGN(z, n, _)                                           \
+#define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _)                             \
     this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
 
-#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _)                                     \
+#define FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN(z, n, _)                       \
     this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
 
-#define FUSION_AT_IMPL(z, n, _)                                                 \
+#define FUSION_VECTOR_MEMBER_MEMBER_FORWARD(z, n, _)                            \
+    this->BOOST_PP_CAT(m, n) = std::forward<                                    \
+        BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
+
+#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _)                                   \
     typename add_reference::type                                          \
         at_impl(mpl::int_) { return this->m##n; }                            \
     typename add_reference::type>::type                \
         at_impl(mpl::int_) const { return this->m##n; }
 
-#define FUSION_ITER_DECL_VAR(z, n, _)                                           \
+#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _)                             \
     typedef typename result_of::next<                                           \
         BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n);             \
     BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n)                                       \
@@ -40,21 +47,32 @@
     struct BOOST_PP_CAT(vector_data, N)
     {
         BOOST_PP_CAT(vector_data, N)()
-            : BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT, _) {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {}
+#endif
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_ENUM_BINARY_PARAMS(
                 N, typename detail::call_param::type _))
-            : BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {}
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_CAT(vector_data, N) const& other)
-            : BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {}
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_COPY_INIT, _) {}
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector_data, N)(
+            BOOST_PP_CAT(vector_data, N)&& other)
+            : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FWD, _) {}
+#endif
 
         BOOST_PP_CAT(vector_data, N)&
         operator=(BOOST_PP_CAT(vector_data, N) const& vec)
         {
-            BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -64,11 +82,21 @@
         {
             typedef typename result_of::begin::type I0;
             I0 i0 = fusion::begin(seq);
-            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
             return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
         }
 
-        BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
+        template 
+        static BOOST_PP_CAT(vector_data, N)
+        init_from_sequence(Sequence& seq)
+        {
+            typedef typename result_of::begin::type I0;
+            I0 i0 = fusion::begin(seq);
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
+            return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
+        }
+
+        BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_DECL, _)
     };
 
     template 
@@ -95,6 +123,19 @@
                 N, typename detail::call_param::type _))
             : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if (N == 1)
+        explicit
+#endif
+        BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
+            : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {}
+#endif
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
+            : base_type(std::forward(rhs)) {}
+#endif
+
         template 
         BOOST_PP_CAT(vector, N)(
             BOOST_PP_CAT(vector, N) const& vec)
@@ -109,11 +150,20 @@
             )
             : base_type(base_type::init_from_sequence(seq)) {}
 
+        template 
+        BOOST_PP_CAT(vector, N)(
+            Sequence& seq
+#if (N == 1)
+          , typename boost::disable_if >::type* /*dummy*/ = 0
+#endif
+            )
+            : base_type(base_type::init_from_sequence(seq)) {}
+
         template 
         BOOST_PP_CAT(vector, N)&
         operator=(BOOST_PP_CAT(vector, N) const& vec)
         {
-            BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -123,12 +173,21 @@
         {
             typedef typename result_of::begin::type I0;
             I0 i0 = fusion::begin(seq);
-            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
-            BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _)
+            BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN, _)
             return *this;
         }
 
-        BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        BOOST_PP_CAT(vector, N)&
+        operator=(BOOST_PP_CAT(vector, N)&& vec)
+        {
+            BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_FORWARD, _)
+            return *this;
+        }
+#endif
+
+        BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
 
         template
         typename add_reference::type>::type
@@ -147,3 +206,4 @@
 
 #undef N
 
+
diff --git a/project/jni/boost/include/boost/fusion/container/vector/vector.hpp b/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
index 6563bc933..36c1b7ac9 100644
--- a/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
+++ b/project/jni/boost/include/boost/fusion/container/vector/vector.hpp
@@ -106,6 +106,11 @@ namespace boost { namespace fusion
         vector(vector const& rhs)
             : vec(rhs.vec) {}
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        vector(vector&& rhs)
+            : vec(std::forward(rhs.vec)) {}
+#endif
+
         template 
         vector(Sequence const& rhs)
             : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
@@ -135,6 +140,23 @@ namespace boost { namespace fusion
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+        vector&
+        operator=(vector&& rhs)
+        {
+            vec = std::forward(rhs.vec);
+            return *this;
+        }
+
+        template 
+        vector&
+        operator=(T&& rhs)
+        {
+            vec = std::forward(rhs);
+            return *this;
+        }
+#endif
+
         template 
         typename add_reference<
             typename mpl::at_c::type
diff --git a/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp b/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
index b0d02bc47..facd5c542 100644
--- a/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/adapter/unfused.hpp
@@ -100,6 +100,7 @@ namespace boost { namespace fusion
 
 namespace boost 
 {
+#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_DECLTYPE)
     template
     struct result_of< boost::fusion::unfused const () >
     {
@@ -110,6 +111,17 @@ namespace boost
     {
         typedef typename boost::fusion::unfused::call_0_result type;
     };
+#endif
+    template
+    struct tr1_result_of< boost::fusion::unfused const () >
+    {
+        typedef typename boost::fusion::unfused::call_const_0_result type;
+    };
+    template
+    struct tr1_result_of< boost::fusion::unfused() >
+    {
+        typedef typename boost::fusion::unfused::call_0_result type;
+    };
 }
 
 #define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED
diff --git a/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp b/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
index 0f19f28f0..923c6876c 100644
--- a/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp
@@ -80,6 +80,7 @@ namespace boost { namespace fusion
 
 namespace boost 
 {
+#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_DECLTYPE)
     template
     struct result_of< boost::fusion::unfused_typed const () >
         : boost::fusion::unfused_typed::template result< 
@@ -90,6 +91,17 @@ namespace boost
         : boost::fusion::unfused_typed::template result< 
             boost::fusion::unfused_typed () >
     { };
+#endif
+    template
+    struct tr1_result_of< boost::fusion::unfused_typed const () >
+        : boost::fusion::unfused_typed::template result< 
+            boost::fusion::unfused_typed const () >
+    { };
+    template
+    struct tr1_result_of< boost::fusion::unfused_typed() >
+        : boost::fusion::unfused_typed::template result< 
+            boost::fusion::unfused_typed () >
+    { };
 }
 
 
diff --git a/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp b/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
index 085beb7ed..1a4917027 100644
--- a/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
+++ b/project/jni/boost/include/boost/fusion/functional/invocation/invoke.hpp
@@ -57,13 +57,13 @@ namespace boost { namespace fusion
         template  struct invoke;
     }
 
-    template 
-    inline typename result_of::invoke::type
-    invoke(Function, Sequence &);
+    //~ template 
+    //~ inline typename result_of::invoke::type
+    //~ invoke(Function, Sequence &);
 
-    template 
-    inline typename result_of::invoke::type
-    invoke(Function, Sequence const &);
+    //~ template 
+    //~ inline typename result_of::invoke::type
+    //~ invoke(Function, Sequence const &);
 
     //----- ---- --- -- - -  -   -
 
@@ -85,6 +85,9 @@ namespace boost { namespace fusion
         template 
         struct invoke_data_member;
 
+        template 
+        struct invoke_fn_ptr;
+
         template 
         struct invoke_mem_fn;
 
@@ -95,10 +98,10 @@ namespace boost { namespace fusion
         template 
         struct invoke_nonmember_builtin
         // use same implementation as for function objects but...
-            : invoke_impl< // ...work around boost::result_of bugs
+            : invoke_fn_ptr< // ...work around boost::result_of bugs
                 typename mpl::eval_if< ft::is_function,
                     boost::add_reference, boost::remove_cv >::type,
-                Sequence, N, false, RandomAccess >
+                Sequence, N, RandomAccess >
         { };
 
         template 
@@ -199,6 +202,35 @@ namespace boost { namespace fusion
                     Function(BOOST_PP_ENUM(N,M,~)) >::type result_type;
 #undef M
 
+#if N > 0
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & s)
+            {
+#define M(z,j,data) fusion::at_c(s)
+                return f( BOOST_PP_ENUM(N,M,~) );
+            }
+
+#else
+            template 
+            static inline result_type
+            call(F & f, Sequence & /*s*/)
+            {
+                return f();
+            }
+
+#endif
+
+        };
+
+        template 
+        struct invoke_fn_ptr
+        {
+        public:
+
+            typedef typename ft::result_type::type result_type;
+
 #if N > 0
 
             template 
@@ -278,6 +310,39 @@ namespace boost { namespace fusion
                 return f();
             }
 
+#endif
+
+        };
+
+        template 
+        struct invoke_fn_ptr
+        {
+        private:
+            typedef invoke_param_types seq;
+        public:
+
+            typedef typename ft::result_type::type result_type;
+
+#if N > 0
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & s)
+            {
+                typename seq::I0 i0 = fusion::begin(s);
+                BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
+                return f( BOOST_PP_ENUM_PARAMS(N,*i) );
+            }
+
+#else
+
+            template 
+            static inline result_type
+            call(F & f, Sequence & /*s*/)
+            {
+                return f();
+            }
+
 #endif
 
         };
diff --git a/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp b/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp
new file mode 100644
index 000000000..141ad4e2d
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/include/define_struct_inline.hpp
@@ -0,0 +1,13 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_INCLUDE_DEFINE_STRUCT_INLINE_HPP
+#define BOOST_FUSION_INCLUDE_DEFINE_STRUCT_INLINE_HPP
+
+#include 
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/include/repetetive_view.hpp b/project/jni/boost/include/boost/fusion/include/repetitive_view.hpp
similarity index 100%
rename from project/jni/boost/include/boost/fusion/include/repetetive_view.hpp
rename to project/jni/boost/include/boost/fusion/include/repetitive_view.hpp
diff --git a/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp b/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
index 680562694..9077f8fa0 100644
--- a/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
+++ b/project/jni/boost/include/boost/fusion/iterator/iterator_adapter.hpp
@@ -23,8 +23,8 @@ namespace boost { namespace fusion
         iterator_base_type;
         iterator_base_type iterator_base;
 
-        iterator_adapter(iterator_base_type const& iterator_base)
-            : iterator_base(iterator_base) {}
+        iterator_adapter(iterator_base_type const& iterator_base_)
+            : iterator_base(iterator_base_) {}
 
         // default implementation
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
index 3e15e63ae..56cfe1b24 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a == *b
+            return extension::as_const(*a) == extension::as_const(*b)
                 && call(fusion::next(a), fusion::next(b));
         }
 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
index b4c4b087a..e61287765 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a > *b ||
-                (!(*b > *a) && call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) > extension::as_const(*b) ||
+                (!(extension::as_const(*b) > extension::as_const(*a)) && 
+                 call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
index f3eccd5d5..6d91e27bb 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a >= *b
-                && (!(*b >= *a) || call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) >= extension::as_const(*b)
+                && (!(extension::as_const(*b) >= extension::as_const(*a)) || 
+                    call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
index 4957d7bfa..1342bb142 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a < *b ||
-                (!(*b < *a) && call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) < extension::as_const(*b) ||
+                (!(extension::as_const(*b) < extension::as_const(*a)) && 
+                 call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
index 08fe9ec38..5683849a2 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,8 +33,9 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a <= *b
-                && (!(*b <= *a) || call(fusion::next(a), fusion::next(b)));
+            return extension::as_const(*a) <= extension::as_const(*b)
+                && (!(extension::as_const(*b) <= extension::as_const(*a)) || 
+                    call(fusion::next(a), fusion::next(b)));
         }
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
index ac54dfb7d..77c235089 100644
--- a/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace boost { namespace fusion { namespace detail
 {
@@ -32,7 +33,7 @@ namespace boost { namespace fusion { namespace detail
         static bool
         call(I1 const& a, I2 const& b, mpl::false_)
         {
-            return *a != *b
+            return extension::as_const(*a) != extension::as_const(*b)
                 || call(fusion::next(a), fusion::next(b));
         }
 
diff --git a/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp b/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
index 1ff05bad0..9e0969a97 100644
--- a/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
+++ b/project/jni/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp
@@ -68,7 +68,7 @@ namespace boost { namespace fusion
 
     template 
     inline typename result_of::has_key::type
-    has_key(Sequence const& seq)
+    has_key(Sequence const&)
     {
         typedef typename result_of::has_key::type result;
         return result();
diff --git a/project/jni/boost/include/boost/fusion/support.hpp b/project/jni/boost/include/boost/fusion/support.hpp
index 765b777d9..50bf924f9 100644
--- a/project/jni/boost/include/boost/fusion/support.hpp
+++ b/project/jni/boost/include/boost/fusion/support.hpp
@@ -19,5 +19,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif
diff --git a/project/jni/boost/include/boost/fusion/support/as_const.hpp b/project/jni/boost/include/boost/fusion/support/as_const.hpp
new file mode 100644
index 000000000..bb2a96a65
--- /dev/null
+++ b/project/jni/boost/include/boost/fusion/support/as_const.hpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+    Copyright (c) 2012 Nathan Ridge
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#ifndef BOOST_FUSION_SUPPORT_AS_CONST_HPP
+#define BOOST_FUSION_SUPPORT_AS_CONST_HPP
+
+namespace boost { namespace fusion { namespace extension
+{
+    // A customization point that allows certain wrappers around
+    // Fusion sequence elements (e.g. adt_attribute_proxy) to be
+    // unwrapped in contexts where the element only needs to be
+    // read. The library wraps accesses to Fusion elements in
+    // such contexts with calls to this function. Users can
+    // specialize this function for their own wrappers.
+    template 
+    const T& as_const(const T& obj)
+    {
+        return obj;
+    }
+
+}}}
+
+#endif
diff --git a/project/jni/boost/include/boost/fusion/support/detail/access.hpp b/project/jni/boost/include/boost/fusion/support/detail/access.hpp
index 03c9c3191..ced7cea18 100644
--- a/project/jni/boost/include/boost/fusion/support/detail/access.hpp
+++ b/project/jni/boost/include/boost/fusion/support/detail/access.hpp
@@ -15,7 +15,7 @@ namespace boost { namespace fusion { namespace detail
     template 
     struct ref_result
     {
-        typedef typename add_reference::type type;
+        typedef typename add_reference::type type;
     };
 
     template 
@@ -23,7 +23,7 @@ namespace boost { namespace fusion { namespace detail
     {
         typedef typename 
             add_reference<
-                typename add_const::type
+                typename add_const::type
             >::type 
         type;
     };
diff --git a/project/jni/boost/include/boost/fusion/support/is_segmented.hpp b/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
index ba571dc53..6e62eac43 100644
--- a/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_segmented.hpp
@@ -7,6 +7,7 @@
 #if !defined(FUSION_IS_SEGMENTED_03202006_0015)
 #define FUSION_IS_SEGMENTED_03202006_0015
 
+#include 
 #include 
 
 namespace boost { namespace fusion 
@@ -41,8 +42,10 @@ namespace boost { namespace fusion
     {
         template 
         struct is_segmented
-          : extension::is_segmented_impl::type>::
-                template apply
+          : mpl::bool_<
+                (bool)extension::is_segmented_impl::type>::
+                    template apply::type::value
+            >
         {
         };
     }
diff --git a/project/jni/boost/include/boost/fusion/support/is_sequence.hpp b/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
index 2f0ee4333..184bbbb6d 100644
--- a/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_sequence.hpp
@@ -59,9 +59,11 @@ namespace boost { namespace fusion
     {
         template 
         struct is_sequence
-          : extension::is_sequence_impl<
+          : mpl::bool_<
+                (bool)extension::is_sequence_impl<
                 typename fusion::detail::tag_of::type
-            >::template apply
+                >::template apply::type::value
+            >
         {};
 
         template 
diff --git a/project/jni/boost/include/boost/fusion/support/is_view.hpp b/project/jni/boost/include/boost/fusion/support/is_view.hpp
index dbcc93a9b..4ec9e0652 100644
--- a/project/jni/boost/include/boost/fusion/support/is_view.hpp
+++ b/project/jni/boost/include/boost/fusion/support/is_view.hpp
@@ -7,6 +7,7 @@
 #if !defined(FUSION_IS_VIEW_03202006_0015)
 #define FUSION_IS_VIEW_03202006_0015
 
+#include 
 #include 
 #include 
 
@@ -54,8 +55,10 @@ namespace boost { namespace fusion
     {
         template 
         struct is_view :
-            extension::is_view_impl::type>::
-                template apply::type
+            mpl::bool_<
+                (bool)extension::is_view_impl::type>::
+                    template apply::type::value
+            >
         {};
     }
 }}
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
index 53306dabf..6abb03368 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
index ec01d4b7f..234936c58 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
index 02fd8f7fe..5898c6b97 100644
--- a/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
+++ b/project/jni/boost/include/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
@@ -18,4 +18,4 @@
 #include 
 #else
 #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
diff --git a/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp b/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
index 489d95538..9bf459c4e 100644
--- a/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
+++ b/project/jni/boost/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 //  Invariants:
 //  - Each segmented iterator has a stack
@@ -45,11 +47,19 @@ namespace boost { namespace fusion
     }
 
     template 
-    typename result_of::push_back::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_back
+        >::type
     push_back(Sequence const& seq, T const& x);
 
     template 
-    typename result_of::push_front::type
+    typename
+        lazy_enable_if<
+            traits::is_sequence
+          , result_of::push_front
+        >::type
     push_front(Sequence const& seq, T const& x);
 }}
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/area.hpp b/project/jni/boost/include/boost/geometry/algorithms/area.hpp
index 919ab66fe..514134e0f 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/area.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/area.hpp
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -26,6 +28,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -49,41 +52,33 @@ namespace boost { namespace geometry
 namespace detail { namespace area
 {
 
-template
 struct box_area
 {
-    typedef typename coordinate_type::type return_type;
-
-    static inline return_type apply(Box const& box, Strategy const&)
+    template 
+    static inline typename coordinate_type::type
+    apply(Box const& box, Strategy const&)
     {
         // Currently only works for 2D Cartesian boxes
         assert_dimension();
 
-        return_type const dx = get(box)
-                - get(box);
-        return_type const dy = get(box)
-                - get(box);
-
-        return dx * dy;
+        return (get(box) - get(box))
+             * (get(box) - get(box));
     }
 };
 
 
 template
 <
-    typename Ring,
     iterate_direction Direction,
-    closure_selector Closure,
-    typename Strategy
+    closure_selector Closure
 >
 struct ring_area
 {
-    BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy) );
-
-    typedef typename Strategy::return_type type;
-
-    static inline type apply(Ring const& ring, Strategy const& strategy)
+    template 
+    static inline typename Strategy::return_type
+    apply(Ring const& ring, Strategy const& strategy)
     {
+        BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy) );
         assert_dimension();
 
         // Ignore warning (because using static method sometimes) on strategy
@@ -92,10 +87,10 @@ struct ring_area
         // An open ring has at least three points,
         // A closed ring has at least four points,
         // if not, there is no (zero) area
-        if (boost::size(ring)
+        if (int(boost::size(ring))
                 < core_detail::closure::minimum_ring_size::value)
         {
-            return type();
+            return typename Strategy::return_type();
         }
 
         typedef typename reversible_view::type rview_type;
@@ -136,71 +131,75 @@ namespace dispatch
 template
 <
     typename Geometry,
-    typename Strategy = typename strategy::area::services::default_strategy
-                                 <
-                                     typename cs_tag
-                                     <
-                                         typename point_type::type
-                                     >::type,
-                                     typename point_type::type
-                                 >::type,
     typename Tag = typename tag::type
 >
-struct area
-    : detail::calculate_null
-        <
-            typename Strategy::return_type,
-            Geometry,
-            Strategy
-        > {};
+struct area : detail::calculate_null
+{
+    template 
+    static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy)
+    {
+        return calculate_null::apply(geometry, strategy);
+    }
+};
 
 
-template
-<
-    typename Geometry,
-    typename Strategy
->
-struct area
-    : detail::area::box_area
+template 
+struct area, void>
+{
+    template 
+    struct visitor: boost::static_visitor
+    {
+        Strategy const& m_strategy;
+
+        visitor(Strategy const& strategy): m_strategy(strategy) {}
+
+        template 
+        typename Strategy::return_type operator()(Geometry const& geometry) const
+        {
+            return dispatch::area::apply(geometry, m_strategy);
+        }
+    };
+
+    template 
+    static inline typename Strategy::return_type
+    apply(Variant const& variant_geometry, Strategy const& strategy)
+    {
+        return boost::apply_visitor(visitor(strategy), variant_geometry);
+    }
+};
+
+
+template 
+struct area : detail::area::box_area
 {};
 
 
-template
-<
-    typename Ring,
-    typename Strategy
->
-struct area
+template 
+struct area
     : detail::area::ring_area
         <
-            Ring,
             order_as_direction::value>::value,
-            geometry::closure::value,
-            Strategy
+            geometry::closure::value
         >
 {};
 
 
-template
-<
-    typename Polygon,
-    typename Strategy
->
-struct area
-    : detail::calculate_polygon_sum
-        <
+template 
+struct area : detail::calculate_polygon_sum
+{
+    template 
+    static inline typename Strategy::return_type apply(Polygon const& polygon, Strategy const& strategy)
+    {
+        return calculate_polygon_sum::apply<
             typename Strategy::return_type,
-            Polygon,
-            Strategy,
             detail::area::ring_area
                 <
-                    typename ring_type::type,
                     order_as_direction::value>::value,
-                    geometry::closure::value,
-                    Strategy
+                    geometry::closure::value
                 >
-        >
-{};
+            >(polygon, strategy);
+    }
+};
 
 
 } // namespace dispatch
@@ -243,10 +242,7 @@ inline typename default_area_result::type area(Geometry const& geometr
 
     // detail::throw_on_empty_input(geometry);
         
-    return dispatch::area
-        <
-            Geometry
-        >::apply(geometry, strategy_type());
+    return dispatch::area::apply(geometry, strategy_type());
 }
 
 /*!
@@ -281,11 +277,7 @@ inline typename Strategy::return_type area(
 
     // detail::throw_on_empty_input(geometry);
     
-    return dispatch::area
-        <
-            Geometry,
-            Strategy
-        >::apply(geometry, strategy);
+    return dispatch::area::apply(geometry, strategy);
 }
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp b/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
index e22e36add..2edce0a09 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/buffer.hpp
@@ -20,6 +20,7 @@
 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,15 +76,23 @@ inline void buffer_box(BoxIn const& box_in, T const& distance, BoxOut& box_out)
 namespace dispatch
 {
 
-template 
-struct buffer {};
+template
+<
+    typename Input,
+    typename Output,
+    typename TagIn = typename tag::type,
+    typename TagOut = typename tag::type
+>
+struct buffer: not_implemented
+{};
 
 
-template 
-struct buffer
+template 
+struct buffer
 {
-    static inline void apply(BoxIn const& box_in, T const& distance,
-                T const& , BoxIn& box_out)
+    template 
+    static inline void apply(BoxIn const& box_in, Distance const& distance,
+                Distance const& , BoxIn& box_out)
     {
         detail::buffer::buffer_box(box_in, distance, box_out);
     }
@@ -122,10 +131,7 @@ inline void buffer(Input const& geometry_in, Output& geometry_out,
 
     dispatch::buffer
         <
-            typename tag::type,
-            typename tag::type,
             Input,
-            Distance,
             Output
         >::apply(geometry_in, distance, chord_length, geometry_out);
 }
@@ -152,10 +158,7 @@ Output return_buffer(Input const& geometry, T const& distance, T const& chord_le
 
     dispatch::buffer
         <
-            typename tag::type,
-            typename tag::type,
             Input,
-            T,
             Output
         >::apply(geometry, distance, chord_length, geometry_out);
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp b/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
index 69ad9fe82..9be51f409 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/centroid.hpp
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,9 +78,9 @@ public:
 namespace detail { namespace centroid
 {
 
-template
 struct centroid_point
 {
+    template
     static inline void apply(Point const& point, PointCentroid& centroid,
             Strategy const&)
     {
@@ -127,9 +128,9 @@ struct centroid_box_calculator
 };
 
 
-template
 struct centroid_box
 {
+    template
     static inline void apply(Box const& box, Point& centroid,
             Strategy const&)
     {
@@ -173,9 +174,10 @@ inline bool range_ok(Range const& range, Point& centroid)
 /*!
     \brief Calculate the centroid of a ring.
 */
-template
+template 
 struct centroid_range_state
 {
+    template
     static inline void apply(Ring const& ring,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
@@ -196,21 +198,17 @@ struct centroid_range_state
     }
 };
 
-template
+template 
 struct centroid_range
 {
+    template
     static inline void apply(Range const& range, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(range, centroid))
         {
             typename Strategy::state_type state;
-            centroid_range_state
-                <
-                    Range,
-                    Closure,
-                    Strategy
-                >::apply(range, strategy, state);
+            centroid_range_state::apply(range, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -222,20 +220,14 @@ struct centroid_range
     \note Because outer ring is clockwise, inners are counter clockwise,
     triangle approach is OK and works for polygons with rings.
 */
-template
 struct centroid_polygon_state
 {
-    typedef typename ring_type::type ring_type;
-
+    template
     static inline void apply(Polygon const& poly,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
-        typedef centroid_range_state
-            <
-                ring_type,
-                geometry::closure::value,
-                Strategy
-            > per_ring;
+        typedef typename ring_type::type ring_type;
+        typedef centroid_range_state::value> per_ring;
 
         per_ring::apply(exterior_ring(poly), strategy, state);
 
@@ -248,20 +240,16 @@ struct centroid_polygon_state
     }
 };
 
-template
 struct centroid_polygon
 {
+    template
     static inline void apply(Polygon const& poly, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(exterior_ring(poly), centroid))
         {
             typename Strategy::state_type state;
-            centroid_polygon_state
-                <
-                    Polygon,
-                    Strategy
-                >::apply(poly, strategy, state);
+            centroid_polygon_state::apply(poly, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -278,58 +266,35 @@ namespace dispatch
 
 template
 <
-    typename Tag,
     typename Geometry,
-    typename Point,
-    typename Strategy
+    typename Tag = typename tag::type
 >
-struct centroid {};
-
-template
-<
-    typename Geometry,
-    typename Point,
-    typename Strategy
->
-struct centroid
-    : detail::centroid::centroid_point
+struct centroid: not_implemented
 {};
 
-template
-<
-    typename Box,
-    typename Point,
-    typename Strategy
->
-struct centroid
-    : detail::centroid::centroid_box
+template 
+struct centroid
+    : detail::centroid::centroid_point
 {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_range
-        <
-            Ring,
-            Point,
-            geometry::closure::value,
-            Strategy
-        >
+template 
+struct centroid
+    : detail::centroid::centroid_box
 {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_range
-        <
-            Linestring,
-            Point,
-            closed,
-            Strategy
-        >
+template 
+struct centroid
+    : detail::centroid::centroid_range::value>
+{};
+
+template 
+struct centroid
+    : detail::centroid::centroid_range
  {};
 
-template 
-struct centroid
-    : detail::centroid::centroid_polygon
+template 
+struct centroid
+    : detail::centroid::centroid_polygon
  {};
 
 } // namespace dispatch
@@ -365,13 +330,7 @@ inline void centroid(Geometry const& geometry, Point& c,
 
     // Call dispatch apply method. That one returns true if centroid
     // should be taken from state.
-    dispatch::centroid
-        <
-            typename tag::type,
-            Geometry,
-            Point,
-            Strategy
-        >::apply(geometry, c, strategy);
+    dispatch::centroid::apply(geometry, c, strategy);
 }
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp b/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
index 56b87c8c1..d31efe9e4 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/convex_hull.hpp
@@ -40,18 +40,13 @@ namespace boost { namespace geometry
 namespace detail { namespace convex_hull
 {
 
-template
-<
-    typename Geometry,
-    order_selector Order,
-    typename Strategy
->
+template 
 struct hull_insert
 {
 
     // Member template function (to avoid inconvenient declaration
     // of output-iterator-type, from hull_to_geometry)
-    template 
+    template 
     static inline OutputIterator apply(Geometry const& geometry,
             OutputIterator out, Strategy const& strategy)
     {
@@ -63,22 +58,15 @@ struct hull_insert
     }
 };
 
-template
-<
-    typename Geometry,
-    typename Strategy
->
 struct hull_to_geometry
 {
-    template 
+    template 
     static inline void apply(Geometry const& geometry, OutputGeometry& out,
             Strategy const& strategy)
     {
         hull_insert
             <
-                Geometry,
-                geometry::point_order::value,
-                Strategy
+                geometry::point_order::value
             >::apply(geometry,
                 std::back_inserter(
                     // Handle linestring, ring and polygon the same:
@@ -113,21 +101,16 @@ namespace dispatch
 template
 <
     typename Geometry,
-    typename Strategy = typename detail::convex_hull::default_strategy::type,
     typename Tag = typename tag::type
 >
 struct convex_hull
-    : detail::convex_hull::hull_to_geometry
+    : detail::convex_hull::hull_to_geometry
 {};
 
-template
-<
-    typename Box,
-    typename Strategy
->
-struct convex_hull
+template 
+struct convex_hull
 {
-    template 
+    template 
     static inline void apply(Box const& box, OutputGeometry& out,
             Strategy const& )
     {
@@ -149,13 +132,9 @@ struct convex_hull
 
 
 
-template
-<
-    order_selector Order,
-    typename Geometry, typename Strategy
->
+template 
 struct convex_hull_insert
-    : detail::convex_hull::hull_insert
+    : detail::convex_hull::hull_insert
 {};
 
 
@@ -181,11 +160,7 @@ inline void convex_hull(Geometry const& geometry,
         return;
     }
 
-    dispatch::convex_hull
-        <
-            Geometry,
-            Strategy
-        >::apply(geometry, out, strategy);
+    dispatch::convex_hull::apply(geometry, out, strategy);
 }
 
 
@@ -232,8 +207,7 @@ inline OutputIterator convex_hull_insert(Geometry const& geometry,
 
     return dispatch::convex_hull_insert
         <
-            geometry::point_order::value,
-            Geometry, Strategy
+            geometry::point_order::value
         >::apply(geometry, out, strategy);
 }
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/correct.hpp b/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
index 583e395f8..39249e7de 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/correct.hpp
@@ -119,10 +119,8 @@ struct correct_ring
 
     typedef detail::area::ring_area
             <
-                Ring,
                 order_as_direction::value>::value,
-                geometry::closure::value,
-                strategy_type
+                geometry::closure::value
             > ring_area_type;
 
 
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
index 4b48d62fc..3ebca8350 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_null.hpp
@@ -21,9 +21,9 @@ namespace boost { namespace geometry
 namespace detail
 {
 
-template
 struct calculate_null
 {
+    template
     static inline ReturnType apply(Geometry const& , Strategy const&)
     {
         return ReturnType();
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
index 2ad349080..dd0399bb1 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/calculate_sum.hpp
@@ -26,16 +26,9 @@ namespace detail
 {
 
 
-template
-<
-    typename ReturnType,
-    typename Polygon,
-    typename Strategy,
-    typename Policy
->
 class calculate_polygon_sum
 {
-    template 
+    template 
     static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
     {
         ReturnType sum = ReturnType();
@@ -47,10 +40,11 @@ class calculate_polygon_sum
     }
 
 public :
+    template 
     static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
     {
         return Policy::apply(exterior_ring(poly), strategy)
-            + sum_interior_rings(interior_rings(poly), strategy)
+            + sum_interior_rings(interior_rings(poly), strategy)
             ;
     }
 };
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
index 2ced5b1ce..e944e5169 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/disjoint.hpp
@@ -26,6 +26,7 @@
 #include 
 #include 
 
+#include 
 
 #include 
 
@@ -165,6 +166,19 @@ struct box_box
 };
 
 
+template
+<
+    typename Geometry1, typename Geometry2
+>
+struct reverse_covered_by
+{
+    static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
+    {
+        return ! geometry::covered_by(geometry1, geometry2);
+    }
+};
+
+
 
 /*!
     \brief Internal utility function to detect of boxes are disjoint
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
index b10017c20..7cb01fa9b 100644
--- a/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/for_each_range.hpp
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 
 
 namespace boost { namespace geometry
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp
new file mode 100644
index 000000000..d23f1e4c2
--- /dev/null
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/get_left_turns.hpp
@@ -0,0 +1,371 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
+
+#include 
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+// TODO: move this to /util/
+template 
+static inline std::pair ordered_pair(T const& first, T const& second)
+{
+    return first < second ? std::make_pair(first, second) : std::make_pair(second, first);
+}
+
+template 
+inline void debug_left_turn(AngleInfo const& ai, AngleInfo const& previous)
+{
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+    std::cout << "Angle: " << (ai.incoming ? "i" : "o") 
+        << " " << si(ai.seg_id) 
+        << " " << (math::r2d * (ai.angle) )
+        << " turn: " << ai.turn_index << "[" << ai.operation_index << "]"
+        ;
+
+    if (ai.turn_index != previous.turn_index
+        || ai.operation_index != previous.operation_index)
+    {
+        std::cout << " diff: " << math::r2d * math::abs(previous.angle - ai.angle);
+    }
+    std::cout << std::endl;
+#endif
+}
+
+template 
+inline void debug_left_turn(std::string const& caption, AngleInfo const& ai, AngleInfo const& previous,
+            int code = -99, int code2 = -99, int code3 = -99, int code4 = -99)
+{
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+    std::cout << " " << caption
+            << " turn: " << ai.turn_index << "[" << ai.operation_index << "]"
+            << " " << si(ai.seg_id) 
+            << " " << (ai.incoming ? "i" : "o") 
+            << " " << (math::r2d * (ai.angle) )
+            << " turn: " << previous.turn_index << "[" << previous.operation_index << "]"
+            << " " << si(previous.seg_id) 
+            << " " << (previous.incoming ? "i" : "o") 
+            << " " << (math::r2d * (previous.angle) )
+            ;
+
+    if (code != -99)
+    {
+        std::cout << " code: " << code << " , " << code2 << " , " << code3 << " , " << code4;
+    }
+    std::cout << std::endl;
+#endif
+}
+
+
+template 
+inline bool include_operation(Operation const& op, 
+                segment_identifier const& outgoing_seg_id,
+                segment_identifier const& incoming_seg_id)
+{
+    return op.seg_id == outgoing_seg_id
+        && op.other_id == incoming_seg_id
+        && (op.operation == detail::overlay::operation_union
+            ||op.operation == detail::overlay::operation_continue)
+            ;
+}
+
+template 
+inline bool process_include(segment_identifier const& outgoing_seg_id, segment_identifier const& incoming_seg_id,
+                int turn_index, Turn& turn,
+                std::set& keep_indices, int priority)
+{
+    bool result = false;
+    for (int i = 0; i < 2; i++)
+    {
+        if (include_operation(turn.operations[i], outgoing_seg_id, incoming_seg_id))
+        {
+            turn.operations[i].include_in_occupation_map = true;
+            if (priority > turn.priority)
+            {
+                turn.priority = priority;
+            }
+            keep_indices.insert(turn_index);
+            result = true;
+        }
+    }
+    return result;
+}
+
+template 
+inline bool include_left_turn_of_all(
+                AngleInfo const& outgoing, AngleInfo const& incoming,
+                Turns& turns, TurnSegmentIndices const& turn_segment_indices,
+                std::set& keep_indices, int priority)
+{
+    segment_identifier const& outgoing_seg_id = turns[outgoing.turn_index].operations[outgoing.operation_index].seg_id;
+    segment_identifier const& incoming_seg_id = turns[incoming.turn_index].operations[incoming.operation_index].seg_id;
+
+    if (outgoing.turn_index == incoming.turn_index)
+    {
+        return process_include(outgoing_seg_id, incoming_seg_id, outgoing.turn_index, turns[outgoing.turn_index], keep_indices, priority);
+    }
+
+    bool result = false;
+    std::pair pair = ordered_pair(outgoing_seg_id, incoming_seg_id);
+    typename boost::range_iterator::type it = turn_segment_indices.find(pair);
+    if (it != turn_segment_indices.end())
+    {
+        for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
+        {
+            if (process_include(outgoing_seg_id, incoming_seg_id, *sit, turns[*sit], keep_indices, priority))
+            {
+                result = true;
+            }
+        }
+    }
+    return result;
+}
+
+template 
+inline bool corresponds(Turn const& turn, segment_identifier const& seg_id)
+{
+    return turn.operations[Index].operation == detail::overlay::operation_union
+        && turn.operations[Index].seg_id == seg_id;
+}
+
+
+template 
+inline bool prefer_by_other(Turns const& turns,
+            TurnSegmentIndices const& turn_segment_indices,
+            std::set& indices)
+{
+    std::map map;
+    for (std::set::const_iterator sit = indices.begin();
+        sit != indices.end();
+        ++sit)
+    {
+        map[turns[*sit].operations[0].seg_id]++;
+        map[turns[*sit].operations[1].seg_id]++;
+    }
+
+    std::set segment_occuring_once;
+    for (std::map::const_iterator mit = map.begin(); 
+        mit != map.end();++mit)
+    {
+        if (mit->second == 1)
+        {
+            segment_occuring_once.insert(mit->first);
+        }
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER
+        std::cout << si(mit->first) << " " << mit->second << std::endl;
+#endif
+    }
+
+    if (segment_occuring_once.size() == 2)
+    {
+        // Try to find within all turns a turn with these two segments
+
+        std::set::const_iterator soo_it = segment_occuring_once.begin();
+        segment_identifier front = *soo_it;
+        soo_it++;
+        segment_identifier back = *soo_it;
+
+        std::pair pair = ordered_pair(front, back);
+
+        typename boost::range_iterator::type it = turn_segment_indices.find(pair);
+        if (it != turn_segment_indices.end())
+        {
+            // debug_turns_by_indices("Found", it->second);
+            // Check which is the union/continue
+            segment_identifier good;
+            for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
+            {
+                if (turns[*sit].operations[0].operation == detail::overlay::operation_union)
+                {
+                    good = turns[*sit].operations[0].seg_id;
+                }
+                else if (turns[*sit].operations[1].operation == detail::overlay::operation_union)
+                {
+                    good = turns[*sit].operations[1].seg_id;
+                }
+            }
+
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER
+            std::cout << "Good: " << si(good) << std::endl;
+#endif
+
+            // Find in indexes-to-keep this segment with the union. Discard the other one
+            std::set ok_indices;
+            for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+            {
+                if (corresponds<0>(turns[*sit], good) || corresponds<1>(turns[*sit], good))
+                {
+                    ok_indices.insert(*sit);
+                }
+            }
+            if (ok_indices.size() > 0 && ok_indices.size() < indices.size())
+            {
+                indices = ok_indices;
+                std::cout << "^";
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
+template 
+inline void prefer_by_priority(Turns const& turns, std::set& indices)
+{
+    // Find max prio
+    int min_prio = 1024, max_prio = 0;
+    for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+    {
+        if (turns[*sit].priority > max_prio)
+        {
+            max_prio = turns[*sit].priority;
+        }
+        if (turns[*sit].priority < min_prio)
+        {
+            min_prio = turns[*sit].priority;
+        }
+    }
+
+    if (min_prio == max_prio)
+    {
+        return;
+    }
+
+    // Only keep indices with high prio
+    std::set ok_indices;
+    for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
+    {
+        if (turns[*sit].priority >= max_prio)
+        {
+            ok_indices.insert(*sit);
+        }
+    }
+    if (ok_indices.size() > 0 && ok_indices.size() < indices.size())
+    {
+        indices = ok_indices;
+        std::cout << "%";
+    }
+}
+
+template 
+inline void calculate_left_turns(Angles const& angles, 
+                Turns& turns, TurnSegmentIndices const& turn_segment_indices,
+                std::set& keep_indices)
+{
+    bool debug_indicate_size = false;
+
+    typedef typename strategy::side::services::default_strategy
+        <
+            typename cs_tag::type
+        >::type side_strategy;
+
+    std::size_t i = 0;
+    std::size_t n = boost::size(angles);
+
+    typedef geometry::ever_circling_range_iterator circling_iterator;
+    circling_iterator cit(angles);
+
+    debug_left_turn(*cit, *cit);
+    for(circling_iterator prev = cit++; i < n; prev = cit++, i++)
+    {
+        debug_left_turn(*cit, *prev);
+
+        bool const include = ! geometry::math::equals(prev->angle, cit->angle)
+            && ! prev->incoming
+            && cit->incoming;
+
+        if (include)
+        {
+            // Go back to possibly include more same left outgoing angles:
+            // Because we check on side too we can take a large "epsilon"
+            circling_iterator back = prev - 1;
+
+            typename AngleInfo::angle_type eps = 0.00001;
+            int b = 1;
+            for(std::size_t d = 0; 
+                    math::abs(prev->angle - back->angle) < eps 
+                        && ! back->incoming 
+                        && d < n;
+                d++)
+            {
+                --back;
+                ++b;
+            }
+
+            // Same but forward to possibly include more incoming angles
+            int f = 1;
+            circling_iterator forward = cit + 1;
+            for(std::size_t d = 0;
+                    math::abs(cit->angle - forward->angle) < eps 
+                        && forward->incoming 
+                        && d < n;
+                    d++)
+            {
+                ++forward;
+                ++f;
+            }
+
+#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+            std::cout << "HANDLE " << b << "/" << f << " ANGLES" << std::endl;
+#endif
+            for(circling_iterator bit = prev; bit != back; --bit)
+            {
+                int code = side_strategy::apply(bit->direction_point, prev->intersection_point, prev->direction_point);
+                int code2 = side_strategy::apply(prev->direction_point, bit->intersection_point, bit->direction_point);
+                for(circling_iterator fit = cit; fit != forward; ++fit)
+                {
+                    int code3 = side_strategy::apply(fit->direction_point, cit->intersection_point, cit->direction_point);
+                    int code4 = side_strategy::apply(cit->direction_point, fit->intersection_point, fit->direction_point);
+
+                    int priority = 2;
+                    if (code == -1 && code2 == 1)
+                    {
+                        // This segment is lying right of the other one.
+                        // Cannot ignore it (because of robustness, see a.o. #rt_p21 from unit test).
+                        // But if we find more we can prefer later by priority
+                        // (a.o. necessary for #rt_o2 from unit test)
+                        priority = 1;
+                    }
+
+                    bool included = include_left_turn_of_all(*bit, *fit, turns, turn_segment_indices, keep_indices, priority);
+                    debug_left_turn(included ? "KEEP" : "SKIP", *fit, *bit, code, code2, code3, code4);
+                }
+            }
+        }
+    }
+
+    if (debug_indicate_size)
+    {
+        std::cout << " size=" << keep_indices.size();
+    }
+
+    if (keep_indices.size() >= 2)
+    {
+        prefer_by_other(turns, turn_segment_indices, keep_indices);
+    }
+    if (keep_indices.size() >= 2)
+    {
+            prefer_by_priority(turns, keep_indices);
+    }
+}
+
+} // namespace detail
+#endif // DOXYGEN_NO_DETAIL
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_LEFT_TURNS_HPP
diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp
new file mode 100644
index 000000000..6d15f2dd6
--- /dev/null
+++ b/project/jni/boost/include/boost/geometry/algorithms/detail/occupation_info.hpp
@@ -0,0 +1,329 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP
+
+#if ! defined(NDEBUG)
+//  #define BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+#endif
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+template 
+class relaxed_less
+{
+    typedef typename geometry::coordinate_type

::type coordinate_type; + + coordinate_type epsilon; + +public : + + inline relaxed_less() + { + // TODO: adapt for ttmath, and maybe build the map in another way + // (e.g. exact constellations of segment-id's), maybe adaptive. + epsilon = std::numeric_limits::epsilon() * 100.0; + } + + inline bool operator()(P const& a, P const& b) const + { + coordinate_type const dx = math::abs(geometry::get<0>(a) - geometry::get<0>(b)); + coordinate_type const dy = math::abs(geometry::get<1>(a) - geometry::get<1>(b)); + + + if (dx < epsilon && dy < epsilon) + { + return false; + } + if (dx < epsilon) + { + return geometry::get<1>(a) < geometry::get<1>(b); + } + + return geometry::get<0>(a) < geometry::get<0>(b); + } + + inline bool equals(P const& a, P const& b) const + { + typedef typename geometry::coordinate_type

::type coordinate_type; + + coordinate_type const dx = math::abs(geometry::get<0>(a) - geometry::get<0>(b)); + coordinate_type const dy = math::abs(geometry::get<1>(a) - geometry::get<1>(b)); + + return dx < epsilon && dy < epsilon; + }; +}; + + +template +inline T calculate_angle(P1 const& from_point, P2 const& to_point) +{ + typedef P1 vector_type; + vector_type v = from_point; + geometry::subtract_point(v, to_point); + return atan2(geometry::get<1>(v), geometry::get<0>(v)); +} + +template +inline Iterator advance_circular(Iterator it, Vector const& vector, segment_identifier& seg_id, bool forward = true) +{ + int const increment = forward ? 1 : -1; + if (it == boost::begin(vector) && increment < 0) + { + it = boost::end(vector); + seg_id.segment_index = boost::size(vector); + } + it += increment; + seg_id.segment_index += increment; + if (it == boost::end(vector)) + { + seg_id.segment_index = 0; + it = boost::begin(vector); + } + return it; +} + +template +struct angle_info +{ + typedef T angle_type; + typedef Point point_type; + + segment_identifier seg_id; + int turn_index; + int operation_index; + Point intersection_point; + Point direction_point; + T angle; + bool incoming; +}; + +template +class occupation_info +{ + typedef std::vector collection_type; + + struct angle_sort + { + inline bool operator()(AngleInfo const& left, AngleInfo const& right) const + { + // In this case we can compare even double using equals + // return geometry::math::equals(left.angle, right.angle) + return left.angle == right.angle + ? int(left.incoming) < int(right.incoming) + : left.angle < right.angle + ; + } + }; + +public : + collection_type angles; +private : + bool m_occupied; + bool m_calculated; + + inline bool is_occupied() + { + if (boost::size(angles) <= 1) + { + return false; + } + + std::sort(angles.begin(), angles.end(), angle_sort()); + + typedef geometry::closing_iterator closing_iterator; + closing_iterator vit(angles); + closing_iterator end(angles, true); + + closing_iterator prev = vit++; + for( ; vit != end; prev = vit++) + { + if (! geometry::math::equals(prev->angle, vit->angle) + && ! prev->incoming + && vit->incoming) + { + return false; + } + } + return true; + } + +public : + inline occupation_info() + : m_occupied(false) + , m_calculated(false) + {} + + template + inline void add(PointC const& map_point, Point1 const& direction_point, Point2 const& intersection_point, + int turn_index, int operation_index, + segment_identifier const& seg_id, bool incoming) + { + //std::cout << "-> adding angle " << geometry::wkt(direction_point) << " .. " << geometry::wkt(intersection_point) << " " << int(incoming) << std::endl; + if (geometry::equals(direction_point, intersection_point)) + { + //std::cout << "EQUAL! Skipping" << std::endl; + return; + } + + AngleInfo info; + info.incoming = incoming; + info.angle = calculate_angle(direction_point, map_point); + info.seg_id = seg_id; + info.turn_index = turn_index; + info.operation_index = operation_index; + info.intersection_point = intersection_point; + info.direction_point = direction_point; + angles.push_back(info); + + m_calculated = false; + } + + inline bool occupied() + { + if (! m_calculated) + { + m_occupied = is_occupied(); + m_calculated = true; + } + return m_occupied; + } + + template + inline void get_left_turns( + Turns& turns, TurnSegmentIndices const& turn_segment_indices, + std::set& keep_indices) + { + std::sort(angles.begin(), angles.end(), angle_sort()); + calculate_left_turns(angles, turns, turn_segment_indices, keep_indices); + } +}; + + +template +inline void add_incoming_and_outgoing_angles(Point const& map_point, Point const& intersection_point, + Ring const& ring, + int turn_index, + int operation_index, + segment_identifier seg_id, + Info& info) +{ + typedef typename boost::range_iterator + < + Ring const + >::type iterator_type; + + int const n = boost::size(ring); + if (seg_id.segment_index >= n || seg_id.segment_index < 0) + { + return; + } + + segment_identifier real_seg_id = seg_id; + iterator_type it = boost::begin(ring) + seg_id.segment_index; + + // TODO: if we use turn-info ("to", "middle"), we know if to advance without resorting to equals + relaxed_less comparator; + + if (comparator.equals(intersection_point, *it)) + { + // It should be equal only once. But otherwise we skip it (in "add") + it = advance_circular(it, ring, seg_id, false); + } + + info.add(map_point, *it, intersection_point, turn_index, operation_index, real_seg_id, true); + + if (comparator.equals(intersection_point, *it)) + { + it = advance_circular(it, ring, real_seg_id); + } + else + { + // Don't upgrade the ID + it = advance_circular(it, ring, seg_id); + } + for (int defensive_check = 0; + comparator.equals(intersection_point, *it) && defensive_check < n; + defensive_check++) + { + it = advance_circular(it, ring, real_seg_id); + } + + info.add(map_point, *it, intersection_point, turn_index, operation_index, real_seg_id, false); +} + + +// Map in two senses of the word: it is a std::map where the key is a point. +// Per point an "occupation_info" record is kept +// Used for the buffer (but will also be used for intersections/unions having complex self-tangencies) +template +class occupation_map +{ +public : + typedef std::map > map_type; + + map_type map; + std::set turn_indices; + + inline OccupationInfo& find_or_insert(Point const& point, Point& mapped_point) + { + typename map_type::iterator it = map.find(point); + if (it == boost::end(map)) + { + std::pair pair + = map.insert(std::make_pair(point, OccupationInfo())); + it = pair.first; + } + mapped_point = it->first; + return it->second; + } + + inline bool contains(Point const& point) const + { + typename map_type::const_iterator it = map.find(point); + return it != boost::end(map); + } + + inline bool contains_turn_index(int index) const + { + return turn_indices.count(index) > 0; + } + + inline void insert_turn_index(int index) + { + turn_indices.insert(index); + } +}; + + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp index eb3e60e48..5ff0b57d6 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ADD_RINGS_HPP +#include +#include #include #include @@ -73,6 +75,21 @@ inline OutputIterator add_rings(SelectionMap const& map, OutputIterator out) { typedef typename SelectionMap::const_iterator iterator; + typedef typename SelectionMap::mapped_type property_type; + typedef typename property_type::area_type area_type; + + area_type const zero = 0; + std::size_t const min_num_points = core_detail::closure::minimum_ring_size + < + geometry::closure + < + typename boost::range_value + < + RingCollection const + >::type + >::value + >::value; + for (iterator it = boost::begin(map); it != boost::end(map); @@ -99,7 +116,15 @@ inline OutputIterator add_rings(SelectionMap const& map, *child_it, mit->second.reversed, true); } } - *out++ = result; + + // Only add rings if they satisfy minimal requirements. + // This cannot be done earlier (during traversal), not + // everything is figured out yet (sum of positive/negative rings) + if (geometry::num_points(result) >= min_num_points + && math::larger(geometry::area(result), zero)) + { + *out++ = result; + } } } return out; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp index 133530563..5063f49eb 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp @@ -130,7 +130,7 @@ struct assign_visitor return; } - if (outer.real_area > 0) + if (math::larger(outer.real_area, 0)) { if (inner.real_area < 0 || m_check_for_orientation) { @@ -317,13 +317,14 @@ template > inline void assign_parents(Geometry const& geometry, RingCollection const& collection, - RingMap& ring_map) + RingMap& ring_map, + bool check_for_orientation) { // Call it with an empty geometry // (ring_map should be empty for source_id==1) Geometry empty; - assign_parents(geometry, empty, collection, ring_map, true); + assign_parents(geometry, empty, collection, ring_map, check_for_orientation); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp index 3e6a8897f..2003d2350 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp @@ -32,9 +32,18 @@ struct calculate_distance_policy { static bool const include_no_turn = false; static bool const include_degenerate = false; + static bool const include_opposite = false; - template - static inline void apply(Info& info, Point1 const& p1, Point2 const& p2) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& info, Point1 const& p1, Point2 const& p2, + IntersectionInfo const&, DirInfo const&) { info.operations[0].enriched.distance = geometry::comparable_distance(info.point, p1); diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp index 05bd721e7..51955b515 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp @@ -77,12 +77,23 @@ struct convert_ring } else { - interior_rings(destination).resize( - interior_rings(destination).size() + 1); - geometry::convert(source, interior_rings(destination).back()); - if (reverse) + // Avoid adding interior rings which are invalid + // because of its number of points: + std::size_t const min_num_points + = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >::value; + + if (geometry::num_points(source) >= min_num_points) { - boost::reverse(interior_rings(destination).back()); + interior_rings(destination).resize( + interior_rings(destination).size() + 1); + geometry::convert(source, interior_rings(destination).back()); + if (reverse) + { + boost::reverse(interior_rings(destination).back()); + } } } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index 379444428..5e18d0453 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -55,14 +55,14 @@ struct copy_segment_point_range if (second) { index++; - if (index >= boost::size(range)) + if (index >= int(boost::size(range))) { index = 0; } } // Exception? - if (index >= boost::size(range)) + if (index >= int(boost::size(range))) { return false; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index b0183a3ac..805f3923e 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -78,7 +78,7 @@ struct copy_segments_ring int const from_index = seg_id.segment_index + 1; // Sanity check - BOOST_ASSERT(from_index < boost::size(view)); + BOOST_ASSERT(from_index < int(boost::size(view))); ec_iterator it(boost::begin(view), boost::end(view), boost::begin(view) + from_index); @@ -89,7 +89,7 @@ struct copy_segments_ring typedef typename boost::range_difference::type size_type; size_type const count = from_index <= to_index ? to_index - from_index + 1 - : boost::size(view) - from_index + to_index + 1; + : int(boost::size(view)) - from_index + to_index + 1; for (size_type i = 0; i < count; ++i, ++it) { @@ -117,7 +117,7 @@ struct copy_segments_linestring int const from_index = seg_id.segment_index + 1; // Sanity check - if (from_index > to_index || from_index < 0 || to_index >= boost::size(ls)) + if (from_index > to_index || from_index < 0 || to_index >= int(boost::size(ls))) { return; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp index 0bec81694..0cc34255c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp @@ -28,6 +28,7 @@ inline char method_char(detail::overlay::method_type const& method) case method_touch_interior : return 'm'; case method_collinear : return 'c'; case method_equal : return 'e'; + case method_error : return '!'; default : return '?'; } } @@ -42,6 +43,7 @@ inline char operation_char(detail::overlay::operation_type const& operation) case operation_intersection : return 'i'; case operation_blocked : return 'x'; case operation_continue : return 'c'; + case operation_opposite : return 'o'; default : return '?'; } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp index 087092a5f..b110cc960 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/follow.hpp @@ -279,12 +279,12 @@ class follow { // In case of turn point at the same location, we want to have continue/blocked LAST // because that should be followed (intersection) or skipped (difference). - // By chance the enumeration is ordered like that but we keep the safe way here. inline int operation_order(Turn const& turn) const { operation_type const& operation = turn.operations[0].operation; switch(operation) { + case operation_opposite : return 0; case operation_none : return 0; case operation_union : return 1; case operation_intersection : return 2; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp index ad4766550..c2c698057 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp @@ -83,7 +83,7 @@ struct get_ring BOOST_ASSERT ( id.ring_index >= -1 - && id.ring_index < boost::size(interior_rings(polygon)) + && id.ring_index < int(boost::size(interior_rings(polygon))) ); return id.ring_index < 0 ? exterior_ring(polygon) diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index 663d70d9a..b8320d9b7 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -250,9 +250,15 @@ struct touch : public base_turn_handler int const side_pk_q2 = SideStrategy::apply(qj, qk, pk); int const side_pk_p = SideStrategy::apply(pi, pj, pk); int const side_qk_q = SideStrategy::apply(qi, qj, qk); + + bool const both_continue = side_pk_p == 0 && side_qk_q == 0; + bool const robustness_issue_in_continue = both_continue && side_pk_q2 != 0; + bool const q_turns_left = side_qk_q == 1; bool const block_q = side_qk_p1 == 0 - && ! same(side_qi_p1, side_qk_q); + && ! same(side_qi_p1, side_qk_q) + && ! robustness_issue_in_continue + ; // If Pk at same side as Qi/Qk // (the "or" is for collinear case) @@ -278,7 +284,7 @@ struct touch : public base_turn_handler if (side_pk_q1 == 0) { ti.operations[0].operation = operation_blocked; - // Q turns right -> union (both independant), + // Q turns right -> union (both independent), // Q turns left -> intersection ti.operations[1].operation = block_q ? operation_blocked : q_turns_left ? operation_intersection @@ -463,6 +469,45 @@ struct equal : public base_turn_handler }; +template +< + typename TurnInfo, + typename AssignPolicy +> +struct equal_opposite : public base_turn_handler +{ + template + < + typename Point1, + typename Point2, + typename OutputIterator, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Point1 const& pi, Point2 const& qi, + /* by value: */ TurnInfo tp, + OutputIterator& out, + IntersectionInfo const& intersection_info, + DirInfo const& dir_info) + { + // For equal-opposite segments, normally don't do anything. + if (AssignPolicy::include_opposite) + { + tp.method = method_equal; + for (int i = 0; i < 2; i++) + { + tp.operations[i].operation = operation_opposite; + } + for (unsigned int i = 0; i < intersection_info.count; i++) + { + geometry::convert(intersection_info.intersections[i], tp.point); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); + *out++ = tp; + } + } + } +}; + template < typename TurnInfo, @@ -494,6 +539,13 @@ struct collinear : public base_turn_handler - if P arrives and P turns right: intersection for P - if Q arrives and Q turns left: union for Q (=intersection for P) - if Q arrives and Q turns right: intersection for Q (=union for P) + + ROBUSTNESS: p and q are collinear, so you would expect + that side qk//p1 == pk//q1. But that is not always the case + in near-epsilon ranges. Then decision logic is different. + If p arrives, q is further, so the angle qk//p1 is (normally) + more precise than pk//p1 + */ template < @@ -516,12 +568,18 @@ struct collinear : public base_turn_handler // Should not be 0, this is checked before BOOST_ASSERT(arrival != 0); + int const side_p = SideStrategy::apply(pi, pj, pk); + int const side_q = SideStrategy::apply(qi, qj, qk); + // If p arrives, use p, else use q int const side_p_or_q = arrival == 1 - ? SideStrategy::apply(pi, pj, pk) - : SideStrategy::apply(qi, qj, qk) + ? side_p + : side_q ; + int const side_pk = SideStrategy::apply(qi, qj, pk); + int const side_qk = SideStrategy::apply(pi, pj, qk); + // See comments above, // resulting in a strange sort of mathematic rule here: // The arrival-info multiplied by the relevant side @@ -529,7 +587,15 @@ struct collinear : public base_turn_handler int const product = arrival * side_p_or_q; - if(product == 0) + // Robustness: side_p is supposed to be equal to side_pk (because p/q are collinear) + // and side_q to side_qk + bool const robustness_issue = side_pk != side_p || side_qk != side_q; + + if (robustness_issue) + { + handle_robustness(ti, arrival, side_p, side_q, side_pk, side_qk); + } + else if(product == 0) { both(ti, operation_continue); } @@ -538,6 +604,38 @@ struct collinear : public base_turn_handler ui_else_iu(product == 1, ti); } } + + static inline void handle_robustness(TurnInfo& ti, int arrival, + int side_p, int side_q, int side_pk, int side_qk) + { + // We take the longer one, i.e. if q arrives in p (arrival == -1), + // then p exceeds q and we should take p for a union... + + bool use_p_for_union = arrival == -1; + + // ... unless one of the sides consistently directs to the other side + int const consistent_side_p = side_p == side_pk ? side_p : 0; + int const consistent_side_q = side_q == side_qk ? side_q : 0; + if (arrival == -1 && (consistent_side_p == -1 || consistent_side_q == 1)) + { + use_p_for_union = false; + } + if (arrival == 1 && (consistent_side_p == 1 || consistent_side_q == -1)) + { + use_p_for_union = true; + } + + //std::cout << "ROBUSTNESS -> Collinear " + // << " arr: " << arrival + // << " dir: " << side_p << " " << side_q + // << " rev: " << side_pk << " " << side_qk + // << " cst: " << cside_p << " " << cside_q + // << std::boolalpha << " " << use_p_for_union + // << std::endl; + + ui_else_iu(use_p_for_union, ti); + } + }; template @@ -583,6 +681,7 @@ private : TurnInfo& tp, IntersectionInfo const& intersection_info) { int const side_rk_r = SideStrategy::apply(ri, rj, rk); + operation_type blocked = operation_blocked; switch(side_rk_r) { @@ -596,15 +695,24 @@ private : break; case 0 : // No turn on opposite collinear: block, do not traverse - // But this "xx" is ignored here, it is useless to include - // two operation blocked, so the whole point does not need + // But this "xx" is usually ignored, it is useless to include + // two operations blocked, so the whole point does not need // to be generated. // So return false to indicate nothing is to be done. - return false; + if (AssignPolicy::include_opposite) + { + tp.operations[Index].operation = operation_opposite; + blocked = operation_opposite; + } + else + { + return false; + } + break; } // The other direction is always blocked when collinear opposite - tp.operations[1 - Index].operation = operation_blocked; + tp.operations[1 - Index].operation = blocked; // If P arrives within Q, set info on P (which is done above, index=0), // this turn-info belongs to the second intersection point, index=1 @@ -633,32 +741,45 @@ public: IntersectionInfo const& intersection_info, DirInfo const& dir_info) { - /* - std::cout << "arrivals: " - << dir_info.arrival[0] - << "/" << dir_info.arrival[1] - << std::endl; - */ - TurnInfo tp = tp_model; tp.method = method_collinear; - // If P arrives within Q, there is a turn dependant on P + // If P arrives within Q, there is a turn dependent on P if (dir_info.arrival[0] == 1 && set_tp<0>(pi, pj, pk, tp, intersection_info)) { - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); *out++ = tp; } - // If Q arrives within P, there is a turn dependant on Q + // If Q arrives within P, there is a turn dependent on Q if (dir_info.arrival[1] == 1 && set_tp<1>(qi, qj, qk, tp, intersection_info)) { - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); *out++ = tp; } + + if (AssignPolicy::include_opposite) + { + // Handle cases not yet handled above + if ((dir_info.arrival[1] == -1 && dir_info.arrival[0] == 0) + || (dir_info.arrival[0] == -1 && dir_info.arrival[1] == 0)) + { + for (int i = 0; i < 2; i++) + { + tp.operations[i].operation = operation_opposite; + } + for (unsigned int i = 0; i < intersection_info.count; i++) + { + geometry::convert(intersection_info.intersections[i], tp.point); + AssignPolicy::apply(tp, pi, qi, intersection_info, dir_info); + *out++ = tp; + } + } + } + } }; @@ -722,9 +843,17 @@ struct assign_null_policy { static bool const include_no_turn = false; static bool const include_degenerate = false; + static bool const include_opposite = false; - template - static inline void apply(Info& , Point1 const& , Point2 const& ) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& , Point1 const& , Point2 const&, IntersectionInfo const&, DirInfo const&) {} }; @@ -763,8 +892,9 @@ struct get_turn_info typedef typename si::segment_intersection_strategy_type strategy; - - + // Intersect pi-pj with qi-qj + // The points pk and qk are only used do determine more information + // about the turn. template static inline OutputIterator apply( Point1 const& pi, Point1 const& pj, Point1 const& pk, @@ -796,7 +926,7 @@ struct get_turn_info { only_convert::apply(tp, result.template get<0>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -824,7 +954,7 @@ struct get_turn_info policy::template apply<1>(qi, qj, qk, pi, pj, pk, tp, result.template get<0>(), result.template get<1>()); } - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -838,7 +968,7 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -853,7 +983,7 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } break; @@ -871,10 +1001,18 @@ struct get_turn_info policy::apply(pi, pj, pk, qi, qj, qk, tp, result.template get<0>(), result.template get<1>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } - // If they ARE opposite, don't do anything. + else + { + equal_opposite + < + TurnInfo, + AssignPolicy + >::apply(pi, qi, + tp, out, result.template get<0>(), result.template get<1>()); + } } break; case 'c' : @@ -906,7 +1044,7 @@ struct get_turn_info tp, result.template get<0>(), result.template get<1>()); } - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } else @@ -927,7 +1065,7 @@ struct get_turn_info if (AssignPolicy::include_degenerate) { only_convert::apply(tp, result.template get<0>()); - AssignPolicy::apply(tp, pi, qi); + AssignPolicy::apply(tp, pi, qi, result.template get<0>(), result.template get<1>()); *out++ = tp; } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 5740a8b7b..26629043c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -495,7 +495,7 @@ struct get_turns_cs int source_id1, Range const& range, int source_id2, Box const& box, Turns& turns, - InterruptPolicy& , + InterruptPolicy& interrupt_policy, int multi_index = -1, int ring_index = -1) { if (boost::size(range) <= 1) @@ -557,7 +557,7 @@ struct get_turns_cs get_turns_with_box(seg_id, source_id2, *prev, *it, *next, bp[0], bp[1], bp[2], bp[3], - turns); + turns, interrupt_policy); // Future performance enhancement: // return if told by the interrupt policy } @@ -596,7 +596,8 @@ private: box_point_type const& bp2, box_point_type const& bp3, // Output - Turns& turns) + Turns& turns, + InterruptPolicy& interrupt_policy) { // Depending on code some relations can be left out @@ -622,6 +623,12 @@ private: ti.operations[1].seg_id = segment_identifier(source_id2, -1, -1, 3); TurnPolicy::apply(rp0, rp1, rp2, bp3, bp0, bp1, ti, std::back_inserter(turns)); + + if (InterruptPolicy::enabled) + { + interrupt_policy.apply(turns); + } + } }; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp index 1e878ca52..84ec16f23 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp @@ -252,6 +252,32 @@ private : : order == 1; } + inline bool consider_ix_ix(Indexed const& left, Indexed const& right + , std::string const& // header + ) const + { + // Take first intersection, then blocked. + if (left.subject.operation == operation_intersection + && right.subject.operation == operation_blocked) + { + return true; + } + else if (left.subject.operation == operation_blocked + && right.subject.operation == operation_intersection) + { + return false; + } + + // Default case, should not occur + +#ifdef BOOST_GEOMETRY_DEBUG_ENRICH + std::cout << "ix/ix unhandled" << std::endl; +#endif + //debug_consider(0, left, right, header, false, "-> return", ret); + + return left.index < right.index; + } + inline bool consider_iu_iu(Indexed const& left, Indexed const& right, std::string const& header) const @@ -446,6 +472,11 @@ public : { return consider_iu_iu(left, right, "iu/iu"); } + else if (m_turn_points[left.index].combination(operation_intersection, operation_blocked) + && m_turn_points[right.index].combination(operation_intersection, operation_blocked)) + { + return consider_ix_ix(left, right, "ix/ix"); + } else if (m_turn_points[left.index].both(operation_intersection) && m_turn_points[right.index].both(operation_intersection)) { @@ -493,7 +524,7 @@ public : << "/" << operation_char(m_turn_points[right.index].operations[0].operation) << operation_char(m_turn_points[right.index].operations[1].operation) << " " << " Take " << left.index << " < " << right.index - << std::cout; + << std::endl; #endif return default_order; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index 8bca790d7..f0307eaf8 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -41,14 +41,14 @@ namespace boost { namespace geometry namespace detail { namespace intersection { -template -< - typename Segment1, typename Segment2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_segment_segment_point { + template + < + typename Segment1, typename Segment2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Segment1 const& segment1, Segment2 const& segment2, OutputIterator out, Strategy const& ) @@ -77,14 +77,14 @@ struct intersection_segment_segment_point } }; -template -< - typename Linestring1, typename Linestring2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_linestring_linestring_point { + template + < + typename Linestring1, typename Linestring2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Linestring1 const& linestring1, Linestring2 const& linestring2, OutputIterator out, Strategy const& ) @@ -112,22 +112,12 @@ struct intersection_linestring_linestring_point */ template < - typename LineString, typename Areal, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_linestring_with_areal { - typedef detail::overlay::follow - < - LineStringOut, - LineString, - Areal, - OverlayType - > follower; - #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW) template static inline void debug_follow(Turn const& turn, Operation op, @@ -145,6 +135,11 @@ struct intersection_of_linestring_with_areal } #endif + template + < + typename LineString, typename Areal, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(LineString const& linestring, Areal const& areal, OutputIterator out, Strategy const& ) @@ -154,6 +149,14 @@ struct intersection_of_linestring_with_areal return out; } + typedef detail::overlay::follow + < + LineStringOut, + LineString, + Areal, + OverlayType + > follower; + typedef typename point_type::type point_type; typedef detail::overlay::traversal_turn_info turn_info; @@ -220,18 +223,22 @@ namespace dispatch template < - // tag dispatching: - typename TagIn1, typename TagIn2, typename TagOut, - // orientation - // metafunction finetuning helpers: - bool Areal1, bool Areal2, bool ArealOut, // real types typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + // orientation + bool Reverse1 = detail::overlay::do_reverse::value>::value, + bool Reverse2 = detail::overlay::do_reverse::value>::value, + bool ReverseOut = detail::overlay::do_reverse::value>::value, + // tag dispatching: + typename TagIn1 = typename geometry::tag::type, + typename TagIn2 = typename geometry::tag::type, + typename TagOut = typename geometry::tag::type, + // metafunction finetuning helpers: + bool Areal1 = geometry::is_areal::value, + bool Areal2 = geometry::is_areal::value, + bool ArealOut = geometry::is_areal::value > struct intersection_insert { @@ -245,122 +252,103 @@ struct intersection_insert template < - typename TagIn1, typename TagIn2, typename TagOut, typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename TagIn1, typename TagIn2, typename TagOut > struct intersection_insert < - TagIn1, TagIn2, TagOut, - true, true, true, Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + TagIn1, TagIn2, TagOut, + true, true, true > : detail::overlay::overlay - + {}; // Any areal type with box: template < - typename TagIn, typename TagOut, typename Geometry, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename TagIn, typename TagOut > struct intersection_insert < - TagIn, box_tag, TagOut, - true, true, true, Geometry, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + TagIn, box_tag, TagOut, + true, true, true > : detail::overlay::overlay - + {}; template < typename Segment1, typename Segment2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - segment_tag, segment_tag, point_tag, - false, false, false, Segment1, Segment2, + GeometryOut, + OverlayType, Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - OverlayType, Strategy - > : detail::intersection::intersection_segment_segment_point - < - Segment1, Segment2, - OutputIterator, GeometryOut, - Strategy - > + segment_tag, segment_tag, point_tag, + false, false, false + > : detail::intersection::intersection_segment_segment_point {}; template < typename Linestring1, typename Linestring2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, linestring_tag, point_tag, - false, false, false, Linestring1, Linestring2, + GeometryOut, + OverlayType, Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - OverlayType, Strategy - > : detail::intersection::intersection_linestring_linestring_point - < - Linestring1, Linestring2, - OutputIterator, GeometryOut, - Strategy - > + linestring_tag, linestring_tag, point_tag, + false, false, false + > : detail::intersection::intersection_linestring_linestring_point {}; template < typename Linestring, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, box_tag, linestring_tag, - false, true, false, Linestring, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + linestring_tag, box_tag, linestring_tag, + false, true, false > { + template static inline OutputIterator apply(Linestring const& linestring, Box const& box, OutputIterator out, Strategy const& ) { @@ -375,27 +363,23 @@ struct intersection_insert template < typename Linestring, typename Polygon, - bool ReverseLinestring, bool ReversePolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReversePolygon, bool ReverseOut > struct intersection_insert < - linestring_tag, polygon_tag, linestring_tag, - false, true, false, Linestring, Polygon, - ReverseLinestring, ReversePolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReversePolygon, ReverseOut, + linestring_tag, polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, Polygon, ReversePolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -403,49 +387,44 @@ struct intersection_insert template < typename Linestring, typename Ring, - bool ReverseLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - linestring_tag, ring_tag, linestring_tag, - false, true, false, Linestring, Ring, - ReverseLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReverseRing, ReverseOut, + linestring_tag, ring_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, Ring, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; template < typename Segment, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - segment_tag, box_tag, linestring_tag, - false, true, false, Segment, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + segment_tag, box_tag, linestring_tag, + false, true, false > { + template static inline OutputIterator apply(Segment const& segment, Box const& box, OutputIterator out, Strategy const& ) { @@ -460,25 +439,24 @@ struct intersection_insert template < - typename Tag1, typename Tag2, - bool Areal1, bool Areal2, typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename PointOut, + typename PointOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut, + typename Tag1, typename Tag2, + bool Areal1, bool Areal2 > struct intersection_insert < - Tag1, Tag2, point_tag, - Areal1, Areal2, false, Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, PointOut, + PointOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + Tag1, Tag2, point_tag, + Areal1, Areal2, false > { + template static inline OutputIterator apply(Geometry1 const& geometry1, Geometry2 const& geometry2, OutputIterator out, Strategy const& ) { @@ -504,29 +482,22 @@ struct intersection_insert template < - typename GeometryTag1, typename GeometryTag2, typename GeometryTag3, - bool Areal1, bool Areal2, bool ArealOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename Geometry1, typename Geometry2, typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert_reversed { + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, OutputIterator out, Strategy const& strategy) { return intersection_insert < - GeometryTag2, GeometryTag1, GeometryTag3, - Areal2, Areal1, ArealOut, - Geometry2, Geometry1, - Reverse2, Reverse1, ReverseOut, - OutputIterator, GeometryOut, + Geometry2, Geometry1, GeometryOut, OverlayType, - Strategy + Reverse2, Reverse1, ReverseOut >::apply(g2, g1, out, strategy); } }; @@ -561,35 +532,20 @@ inline OutputIterator insert(Geometry1 const& geometry1, geometry::reverse_dispatch::type::value, geometry::dispatch::intersection_insert_reversed < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, + GeometryOut, + OverlayType, overlay::do_reverse::value>::value, overlay::do_reverse::value, ReverseSecond>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - OverlayType, - Strategy + overlay::do_reverse::value>::value >, geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, ReverseSecond>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, ReverseSecond>::value > >::type::apply(geometry1, geometry2, out, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp index ab5b6d123..8b89d39c5 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/overlay.hpp @@ -134,12 +134,12 @@ template < typename Geometry1, typename Geometry2, bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, - overlay_type Direction, - typename Strategy + typename GeometryOut, + overlay_type Direction > struct overlay { + template static inline OutputIterator apply( Geometry1 const& geometry1, Geometry2 const& geometry2, OutputIterator out, @@ -233,7 +233,7 @@ std::cout << "traverse" << std::endl; std::cout << "map_turns: " << timer.elapsed() << std::endl; #endif - typedef ring_properties::type> properties; + typedef ring_properties::type> properties; std::map selected; select_rings(geometry1, geometry2, map, selected, ! turn_points.empty()); diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp index 12daafa0c..02dd01d6c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/traverse.hpp @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include #include #include @@ -233,6 +235,7 @@ public : detail::overlay::operation_type operation, Turns& turns, Rings& rings) { + typedef typename boost::range_value::type ring_type; typedef typename boost::range_iterator::type turn_iterator; typedef typename boost::range_value::type turn_type; typedef typename boost::range_iterator @@ -240,6 +243,12 @@ public : typename turn_type::container_type >::type turn_operation_iterator_type; + std::size_t const min_num_points + = core_detail::closure::minimum_ring_size + < + geometry::closure::value + >::value; + std::size_t size_at_start = boost::size(rings); typename Backtrack::state_type state; @@ -267,7 +276,7 @@ public : { set_visited_for_continue(*it, *iit); - typename boost::range_value::type current_output; + ring_type current_output; detail::overlay::append_no_duplicates(current_output, it->point, true); @@ -376,7 +385,10 @@ public : { iit->visited.set_finished(); detail::overlay::debug_traverse(*current, *iit, "->Finished"); - rings.push_back(current_output); + if (geometry::num_points(current_output) >= min_num_points) + { + rings.push_back(current_output); + } } } } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp index aa6b428f1..89a60b21a 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp @@ -28,7 +28,8 @@ enum operation_type operation_union, operation_intersection, operation_blocked, - operation_continue + operation_continue, + operation_opposite }; @@ -102,6 +103,12 @@ struct turn_info { return has12(type, type); } + + inline bool has(operation_type type) const + { + return this->operations[0].operation == type + || this->operations[1].operation == type; + } inline bool combination(operation_type type1, operation_type type2) const { @@ -114,10 +121,13 @@ struct turn_info { return both(operation_blocked); } + inline bool opposite() const + { + return both(operation_opposite); + } inline bool any_blocked() const { - return this->operations[0].operation == operation_blocked - || this->operations[1].operation == operation_blocked; + return has(operation_blocked); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp index 7a7de2cdd..45ff52ccb 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/partition.hpp @@ -153,12 +153,12 @@ class partition_one_collection static inline void next_level(Box const& box, InputCollection const& collection, index_vector_type const& input, - int level, int min_elements, + int level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { if (boost::size(input) > 0) { - if (boost::size(input) > min_elements && level < 100) + if (std::size_t(boost::size(input)) > min_elements && level < 100) { sub_divide::apply(box, collection, input, level + 1, min_elements, policy, box_policy); @@ -176,7 +176,7 @@ public : InputCollection const& collection, index_vector_type const& input, int level, - int min_elements, + std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); @@ -230,13 +230,13 @@ class partition_two_collections index_vector_type const& input1, InputCollection const& collection2, index_vector_type const& input2, - int level, int min_elements, + int level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { if (boost::size(input1) > 0 && boost::size(input2) > 0) { - if (boost::size(input1) > min_elements - && boost::size(input2) > min_elements + if (std::size_t(boost::size(input1)) > min_elements + && std::size_t(boost::size(input2)) > min_elements && level < 100) { sub_divide::apply(box, collection1, input1, collection2, @@ -257,7 +257,7 @@ public : InputCollection const& collection1, index_vector_type const& input1, InputCollection const& collection2, index_vector_type const& input2, int level, - int min_elements, + std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); @@ -335,11 +335,11 @@ public : template static inline void apply(InputCollection const& collection, VisitPolicy& visitor, - int min_elements = 16, + std::size_t min_elements = 16, VisitBoxPolicy box_visitor = visit_no_policy() ) { - if (boost::size(collection) > min_elements) + if (std::size_t(boost::size(collection)) > min_elements) { index_vector_type index_vector; Box total; @@ -377,12 +377,12 @@ public : static inline void apply(InputCollection const& collection1, InputCollection const& collection2, VisitPolicy& visitor, - int min_elements = 16, + std::size_t min_elements = 16, VisitBoxPolicy box_visitor = visit_no_policy() ) { - if (boost::size(collection1) > min_elements - && boost::size(collection2) > min_elements) + if (std::size_t(boost::size(collection1)) > min_elements + && std::size_t(boost::size(collection2)) > min_elements) { index_vector_type index_vector1, index_vector2; Box total; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp index 33177924a..b7e15ba3f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/point_on_border.hpp @@ -25,6 +25,7 @@ #include #include +#include #include @@ -50,7 +51,8 @@ struct get_point template struct midpoint_helper { - static inline bool apply(Point& p, Point const& p1, Point const& p2) + template + static inline bool apply(Point& p, InputPoint const& p1, InputPoint const& p2) { typename coordinate_type::type const two = 2; set(p, @@ -63,7 +65,8 @@ struct midpoint_helper template struct midpoint_helper { - static inline bool apply(Point& , Point const& , Point const& ) + template + static inline bool apply(Point& , InputPoint const& , InputPoint const& ) { return true; } @@ -102,7 +105,7 @@ struct point_on_range if (n > 0) { - point = *boost::begin(range); + geometry::detail::conversion::convert_point_to_point(*boost::begin(range), point); return true; } return false; diff --git a/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 36bcbdd6e..a6e6837fe 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -254,7 +254,7 @@ struct sectionalize_part Range const& range, ring_identifier ring_id) { - if (boost::size(range) <= index) + if (int(boost::size(range)) <= index) { return; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/difference.hpp b/project/jni/boost/include/boost/geometry/algorithms/difference.hpp index 480dd928d..2f32b344c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/difference.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/difference.hpp @@ -56,19 +56,11 @@ inline OutputIterator difference_insert(Geometry1 const& geometry1, return geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, true>::value >::apply(geometry1, geometry2, out, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp b/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp index f36b8dbdd..b2de6e01d 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/disjoint.hpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -44,15 +45,57 @@ namespace boost { namespace geometry namespace detail { namespace disjoint { +template +struct check_each_ring_for_within +{ + bool has_within; + Geometry const& m_geometry; + + inline check_each_ring_for_within(Geometry const& g) + : has_within(false) + , m_geometry(g) + {} + + template + inline void apply(Range const& range) + { + typename geometry::point_type::type p; + geometry::point_on_border(p, range); + if (geometry::within(p, m_geometry)) + { + has_within = true; + } + } +}; + +template +inline bool rings_containing(FirstGeometry const& geometry1, + SecondGeometry const& geometry2) +{ + check_each_ring_for_within checker(geometry1); + geometry::detail::for_each_range(geometry2, checker); + return checker.has_within; +} + + struct assign_disjoint_policy { // We want to include all points: static bool const include_no_turn = true; static bool const include_degenerate = true; + static bool const include_opposite = true; // We don't assign extra info: - template - static inline void apply(Info& , Point1 const& , Point2 const& ) + template + < + typename Info, + typename Point1, + typename Point2, + typename IntersectionInfo, + typename DirInfo + > + static inline void apply(Info& , Point1 const& , Point2 const&, + IntersectionInfo const&, DirInfo const&) {} }; @@ -107,8 +150,6 @@ struct disjoint_segment } }; - - template struct general_areal { @@ -119,20 +160,10 @@ struct general_areal return false; } - typedef typename geometry::point_type::type point_type; - // If there is no intersection of segments, they might located // inside each other - point_type p1; - geometry::point_on_border(p1, geometry1); - if (geometry::within(p1, geometry2)) - { - return false; - } - - typename geometry::point_type::type p2; - geometry::point_on_border(p2, geometry2); - if (geometry::within(p2, geometry1)) + if (rings_containing(geometry1, geometry2) + || rings_containing(geometry2, geometry1)) { return false; } @@ -153,68 +184,82 @@ namespace dispatch template < - typename GeometryTag1, typename GeometryTag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + std::size_t DimensionCount = dimension::type::value, + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type, + bool Reverse = reverse_dispatch::type::value > struct disjoint : detail::disjoint::general_areal {}; -template -struct disjoint - : detail::disjoint::point_point -{}; - - -template -struct disjoint - : detail::disjoint::box_box -{}; - - -template -struct disjoint - : detail::disjoint::point_box -{}; - -template -struct disjoint - : detail::disjoint::disjoint_linear -{}; - -template -struct disjoint - : detail::disjoint::disjoint_segment -{}; - -template -struct disjoint - : detail::disjoint::disjoint_linear -{}; - - +// If reversal is needed, perform it template < - typename GeometryTag1, typename GeometryTag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + std::size_t DimensionCount, + typename Tag1, typename Tag2 > -struct disjoint_reversed +struct disjoint + : disjoint { static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) { return disjoint < - GeometryTag2, GeometryTag1, Geometry2, Geometry1, - DimensionCount + DimensionCount, + Tag2, Tag1 >::apply(g2, g1); } }; +template +struct disjoint + : detail::disjoint::point_point +{}; + + +template +struct disjoint + : detail::disjoint::box_box +{}; + + +template +struct disjoint + : detail::disjoint::point_box +{}; + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +template +struct disjoint + : detail::disjoint::disjoint_linear +{}; + +template +struct disjoint + : detail::disjoint::disjoint_segment +{}; + +template +struct disjoint + : detail::disjoint::disjoint_linear +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -241,26 +286,7 @@ inline bool disjoint(Geometry1 const& geometry1, Geometry2 const >(); - return boost::mpl::if_c - < - reverse_dispatch::type::value, - dispatch::disjoint_reversed - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - >, - dispatch::disjoint - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - > - >::type::apply(geometry1, geometry2); + return dispatch::disjoint::apply(geometry1, geometry2); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/distance.hpp b/project/jni/boost/include/boost/geometry/algorithms/distance.hpp index eca3b03c7..c5a65ba15 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/distance.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/distance.hpp @@ -130,7 +130,7 @@ struct point_to_range // check if other segments are closer for (++prev, ++it; it != boost::end(view); ++prev, ++it) { - return_type const ds = ps_strategy.apply(point, *prev, *it); + return_type const ds = eps_strategy.apply(point, *prev, *it); if (geometry::math::equals(ds, zero)) { return ds; @@ -369,7 +369,10 @@ struct distance < segment_tag, Point, - typename point_type::type + typename point_type::type, + typename cs_tag::type, + typename cs_tag::type>::type, + Strategy >::type ps_strategy_type; return detail::distance::point_to_range diff --git a/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp b/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp index da34f6a78..ee88fe888 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/envelope.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP #define BOOST_GEOMETRY_ALGORITHMS_ENVELOPE_HPP -#include #include #include #include #include +#include #include #include #include @@ -35,9 +35,9 @@ namespace detail { namespace envelope /// Calculate envelope of an 2D or 3D segment -template struct envelope_expand_one { + template static inline void apply(Geometry const& geometry, Box& mbr) { assign_inverse(mbr); @@ -63,10 +63,10 @@ inline void envelope_range_additional(Range const& range, Box& mbr) /// Generic range dispatching struct -template struct envelope_range { /// Calculate envelope of range using a strategy + template static inline void apply(Range const& range, Box& mbr) { assign_inverse(mbr); @@ -82,122 +82,54 @@ namespace dispatch { -// Note, the strategy is for future use (less/greater -> compare spherical -// using other methods), defaults are OK for now. -// However, they are already in the template methods - template < - typename Tag1, typename Tag2, - typename Geometry, typename Box, - typename StrategyLess, typename StrategyGreater + typename Geometry, + typename Tag = typename tag::type > -struct envelope -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +struct envelope: not_implemented +{}; -template -< - typename Point, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - point_tag, box_tag, - Point, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename BoxIn, typename BoxOut, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - box_tag, box_tag, - BoxIn, BoxOut, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename Segment, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - segment_tag, box_tag, - Segment, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_expand_one +template +struct envelope + : detail::envelope::envelope_expand_one {}; -template -< - typename Linestring, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - linestring_tag, box_tag, - Linestring, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Ring, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - ring_tag, box_tag, - Ring, Box, - StrategyLess, StrategyGreater - > - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Polygon, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - < - polygon_tag, box_tag, - Polygon, Box, - StrategyLess, StrategyGreater - > +template +struct envelope + : detail::envelope::envelope_range { + template static inline void apply(Polygon const& poly, Box& mbr) { // For polygon, inspecting outer ring is sufficient - - detail::envelope::envelope_range - < - typename ring_type::type, - Box - >::apply(exterior_ring(poly), mbr); + detail::envelope::envelope_range::apply(exterior_ring(poly), mbr); } }; @@ -228,12 +160,7 @@ inline void envelope(Geometry const& geometry, Box& mbr) concept::check(); concept::check(); - dispatch::envelope - < - typename tag::type, typename tag::type, - Geometry, Box, - void, void - >::apply(geometry, mbr); + dispatch::envelope::apply(geometry, mbr); } @@ -259,12 +186,7 @@ inline Box return_envelope(Geometry const& geometry) concept::check(); Box mbr; - dispatch::envelope - < - typename tag::type, typename tag::type, - Geometry, Box, - void, void - >::apply(geometry, mbr); + dispatch::envelope::apply(geometry, mbr); return mbr; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/equals.hpp b/project/jni/boost/include/boost/geometry/algorithms/equals.hpp index 6b094f76d..d9502bb3f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/equals.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/equals.hpp @@ -18,8 +18,6 @@ #include #include -#include -#include #include #include @@ -30,6 +28,7 @@ #include #include +#include // For trivial checks #include @@ -51,13 +50,12 @@ namespace detail { namespace equals template < - typename Box1, - typename Box2, std::size_t Dimension, std::size_t DimensionCount > struct box_box { + template static inline bool apply(Box1 const& box1, Box2 const& box2) { if (!geometry::math::equals(get(box1), get(box2)) @@ -65,13 +63,14 @@ struct box_box { return false; } - return box_box::apply(box1, box2); + return box_box::apply(box1, box2); } }; -template -struct box_box +template +struct box_box { + template static inline bool apply(Box1 const& , Box2 const& ) { return true; @@ -103,9 +102,10 @@ struct length_check }; -template +template struct equals_by_collection { + template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2) { if (! TrivialCheck::apply(geometry1, geometry2)) @@ -152,17 +152,42 @@ namespace dispatch template < - typename Tag1, typename Tag2, typename Geometry1, typename Geometry2, - std::size_t DimensionCount + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type, + std::size_t DimensionCount = dimension::type::value, + bool Reverse = reverse_dispatch::type::value > -struct equals +struct equals: not_implemented {}; -template -struct equals +// If reversal is needed, perform it +template +< + typename Geometry1, typename Geometry2, + typename Tag1, typename Tag2, + std::size_t DimensionCount +> +struct equals + : equals +{ + static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) + { + return equals + < + Geometry2, Geometry1, + Tag2, Tag1, + DimensionCount, + false + >::apply(g2, g1); + } +}; + + +template +struct equals : geometry::detail::not_ < P1, @@ -172,93 +197,48 @@ struct equals {}; -template -struct equals - : detail::equals::box_box +template +struct equals + : detail::equals::box_box<0, DimensionCount> {}; -template -struct equals - : detail::equals::equals_by_collection - < - Ring1, Ring2, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon1, Polygon2, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - LineString1, LineString2, - detail::equals::length_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon, Ring, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Ring, Box, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -struct equals - : detail::equals::equals_by_collection - < - Polygon, Box, - detail::equals::area_check - > +template +struct equals + : detail::equals::equals_by_collection {}; -template -< - typename Tag1, typename Tag2, - typename Geometry1, - typename Geometry2, - std::size_t DimensionCount -> -struct equals_reversed -{ - static inline bool apply(Geometry1 const& g1, Geometry2 const& g2) - { - return equals - < - Tag2, Tag1, - Geometry2, Geometry1, - DimensionCount - >::apply(g2, g1); - } -}; - - } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -289,26 +269,7 @@ inline bool equals(Geometry1 const& geometry1, Geometry2 const& geometry2) Geometry2 const >(); - return boost::mpl::if_c - < - reverse_dispatch::type::value, - dispatch::equals_reversed - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - >, - dispatch::equals - < - typename tag::type, - typename tag::type, - Geometry1, - Geometry2, - dimension::type::value - > - >::type::apply(geometry1, geometry2); + return dispatch::equals::apply(geometry1, geometry2); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/expand.hpp b/project/jni/boost/include/boost/geometry/algorithms/expand.hpp index da7442b59..2e1531bf0 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/expand.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/expand.hpp @@ -19,6 +19,7 @@ #include +#include #include #include @@ -38,26 +39,26 @@ namespace detail { namespace expand template < - typename Box, typename Point, typename StrategyLess, typename StrategyGreater, std::size_t Dimension, std::size_t DimensionCount > struct point_loop { - typedef typename strategy::compare::detail::select_strategy - < - StrategyLess, 1, Point, Dimension - >::type less_type; - - typedef typename strategy::compare::detail::select_strategy - < - StrategyGreater, -1, Point, Dimension - >::type greater_type; - - typedef typename select_coordinate_type::type coordinate_type; - + template static inline void apply(Box& box, Point const& source) { + typedef typename strategy::compare::detail::select_strategy + < + StrategyLess, 1, Point, Dimension + >::type less_type; + + typedef typename strategy::compare::detail::select_strategy + < + StrategyGreater, -1, Point, Dimension + >::type greater_type; + + typedef typename select_coordinate_type::type coordinate_type; + less_type less; greater_type greater; @@ -75,7 +76,6 @@ struct point_loop point_loop < - Box, Point, StrategyLess, StrategyGreater, Dimension + 1, DimensionCount >::apply(box, source); @@ -85,49 +85,47 @@ struct point_loop template < - typename Box, typename Point, typename StrategyLess, typename StrategyGreater, std::size_t DimensionCount > struct point_loop < - Box, Point, StrategyLess, StrategyGreater, DimensionCount, DimensionCount > { + template static inline void apply(Box&, Point const&) {} }; template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater, std::size_t Index, std::size_t Dimension, std::size_t DimensionCount > struct indexed_loop { - typedef typename strategy::compare::detail::select_strategy - < - StrategyLess, 1, Box, Dimension - >::type less_type; - - typedef typename strategy::compare::detail::select_strategy - < - StrategyGreater, -1, Box, Dimension - >::type greater_type; - - typedef typename select_coordinate_type - < - Box, - Geometry - >::type coordinate_type; - - + template static inline void apply(Box& box, Geometry const& source) { + typedef typename strategy::compare::detail::select_strategy + < + StrategyLess, 1, Box, Dimension + >::type less_type; + + typedef typename strategy::compare::detail::select_strategy + < + StrategyGreater, -1, Box, Dimension + >::type greater_type; + + typedef typename select_coordinate_type + < + Box, + Geometry + >::type coordinate_type; + less_type less; greater_type greater; @@ -145,7 +143,6 @@ struct indexed_loop indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, Index, Dimension + 1, DimensionCount >::apply(box, source); @@ -155,17 +152,16 @@ struct indexed_loop template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater, std::size_t Index, std::size_t DimensionCount > struct indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, Index, DimensionCount, DimensionCount > { + template static inline void apply(Box&, Geometry const&) {} }; @@ -174,23 +170,21 @@ struct indexed_loop // Changes a box such that the other box is also contained by the box template < - typename Box, typename Geometry, typename StrategyLess, typename StrategyGreater > struct expand_indexed { + template static inline void apply(Box& box, Geometry const& geometry) { indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, 0, 0, dimension::type::value >::apply(box, geometry); indexed_loop < - Box, Geometry, StrategyLess, StrategyGreater, 1, 0, dimension::type::value >::apply(box, geometry); @@ -206,11 +200,13 @@ namespace dispatch template < - typename Tag, - typename BoxOut, typename Geometry, - typename StrategyLess, typename StrategyGreater + typename GeometryOut, typename Geometry, + typename StrategyLess = strategy::compare::default_strategy, + typename StrategyGreater = strategy::compare::default_strategy, + typename TagOut = typename tag::type, + typename Tag = typename tag::type > -struct expand +struct expand: not_implemented {}; @@ -220,10 +216,9 @@ template typename BoxOut, typename Point, typename StrategyLess, typename StrategyGreater > -struct expand +struct expand : detail::expand::point_loop < - BoxOut, Point, StrategyLess, StrategyGreater, 0, dimension::type::value > @@ -236,9 +231,8 @@ template typename BoxOut, typename BoxIn, typename StrategyLess, typename StrategyGreater > -struct expand - : detail::expand::expand_indexed - +struct expand + : detail::expand::expand_indexed {}; template @@ -246,9 +240,8 @@ template typename Box, typename Segment, typename StrategyLess, typename StrategyGreater > -struct expand - : detail::expand::expand_indexed - +struct expand + : detail::expand::expand_indexed {}; @@ -279,13 +272,7 @@ inline void expand(Box& box, Geometry const& geometry, { concept::check_concepts_and_equal_dimensions(); - dispatch::expand - < - typename tag::type, - Box, - Geometry, - StrategyLess, StrategyGreater - >::apply(box, geometry); + dispatch::expand::apply(box, geometry); } ***/ @@ -305,13 +292,7 @@ inline void expand(Box& box, Geometry const& geometry) { concept::check_concepts_and_equal_dimensions(); - dispatch::expand - < - typename tag::type, - Box, Geometry, - strategy::compare::default_strategy, - strategy::compare::default_strategy - >::apply(box, geometry); + dispatch::expand::apply(box, geometry); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp b/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp index 671f26a70..06a400cf6 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/for_each.hpp @@ -18,8 +18,10 @@ #include #include +#include #include +#include #include #include #include @@ -39,53 +41,55 @@ namespace detail { namespace for_each { -template struct fe_point_per_point { - static inline Functor apply( - typename add_const_if_c::type& point, Functor f) + template + static inline void apply(Point& point, Functor& f) { f(point); - return f; } }; -template struct fe_point_per_segment { - static inline Functor apply( - typename add_const_if_c::type& , Functor f) + template + static inline void apply(Point& , Functor& f) { // TODO: if non-const, we should extract the points from the segment // and call the functor on those two points - return f; } }; -template struct fe_range_per_point { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + template + static inline void apply(Range& range, Functor& f) { - return (std::for_each(boost::begin(range), boost::end(range), f)); + // The previous implementation called the std library: + // return (std::for_each(boost::begin(range), boost::end(range), f)); + // But that is not accepted for capturing lambda's. + // It needs to do it like that to return the state of Functor f (f is passed by value in std::for_each). + + // So we now loop manually. + + for (typename boost::range_iterator::type it = boost::begin(range); it != boost::end(range); ++it) + { + f(*it); + } } }; -template struct fe_range_per_segment { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + template + static inline void apply(Range& range, Functor& f) { typedef typename add_const_if_c < - IsConst, + is_const::value, typename point_type::type >::type point_type; @@ -97,65 +101,41 @@ struct fe_range_per_segment f(s); previous = it++; } - - return f; } }; -template struct fe_polygon_per_point { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + template + static inline void apply(Polygon& poly, Functor& f) { - typedef fe_range_per_point - < - typename ring_type::type, - Functor, - IsConst - > per_ring; + fe_range_per_point::apply(exterior_ring(poly), f); - f = per_ring::apply(exterior_ring(poly), f); - - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - f = per_ring::apply(*it, f); + fe_range_per_point::apply(*it, f); } - - return f; } }; -template struct fe_polygon_per_segment { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + template + static inline void apply(Polygon& poly, Functor& f) { - typedef fe_range_per_segment - < - typename ring_type::type, - Functor, - IsConst - > per_ring; + fe_range_per_segment::apply(exterior_ring(poly), f); - f = per_ring::apply(exterior_ring(poly), f); - - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - f = per_ring::apply(*it, f); + fe_range_per_segment::apply(*it, f); } - - return f; } }; @@ -171,68 +151,66 @@ namespace dispatch template < - typename Tag, typename Geometry, - typename Functor, - bool IsConst + typename Tag = typename tag_cast::type, multi_tag>::type > -struct for_each_point {}; - - -template -struct for_each_point - : detail::for_each::fe_point_per_point +struct for_each_point: not_implemented {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_point_per_point {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point {}; -template -struct for_each_point - : detail::for_each::fe_polygon_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point +{}; + + +template +struct for_each_point + : detail::for_each::fe_polygon_per_point {}; template < - typename Tag, typename Geometry, - typename Functor, - bool IsConst + typename Tag = typename tag_cast::type, multi_tag>::type > -struct for_each_segment {}; +struct for_each_segment: not_implemented +{}; -template -struct for_each_segment - : detail::for_each::fe_point_per_segment +template +struct for_each_segment + : detail::for_each::fe_point_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_polygon_per_segment +template +struct for_each_segment + : detail::for_each::fe_polygon_per_segment {}; @@ -240,35 +218,6 @@ struct for_each_segment #endif // DOXYGEN_NO_DISPATCH -/*! -\brief \brf_for_each{point} -\details \det_for_each{point} -\ingroup for_each -\param geometry \param_geometry -\param f \par_for_each_f{const point} -\tparam Geometry \tparam_geometry -\tparam Functor \tparam_functor - -\qbk{distinguish,const version} -\qbk{[include reference/algorithms/for_each_point.qbk]} -\qbk{[heading Example]} -\qbk{[for_each_point_const] [for_each_point_const_output]} -*/ -template -inline Functor for_each_point(Geometry const& geometry, Functor f) -{ - concept::check(); - - return dispatch::for_each_point - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - true - >::apply(geometry, f); -} - - /*! \brief \brf_for_each{point} \details \det_for_each{point} @@ -281,48 +230,15 @@ inline Functor for_each_point(Geometry const& geometry, Functor f) \qbk{[include reference/algorithms/for_each_point.qbk]} \qbk{[heading Example]} \qbk{[for_each_point] [for_each_point_output]} +\qbk{[for_each_point_const] [for_each_point_const_output]} */ template inline Functor for_each_point(Geometry& geometry, Functor f) { concept::check(); - return dispatch::for_each_point - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - false - >::apply(geometry, f); -} - - -/*! -\brief \brf_for_each{segment} -\details \det_for_each{segment} -\ingroup for_each -\param geometry \param_geometry -\param f \par_for_each_f{const segment} -\tparam Geometry \tparam_geometry -\tparam Functor \tparam_functor - -\qbk{distinguish,const version} -\qbk{[include reference/algorithms/for_each_segment.qbk]} -\qbk{[heading Example]} -\qbk{[for_each_segment_const] [for_each_segment_const_output]} -*/ -template -inline Functor for_each_segment(Geometry const& geometry, Functor f) -{ - concept::check(); - - return dispatch::for_each_segment - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - true - >::apply(geometry, f); + dispatch::for_each_point::apply(geometry, f); + return f; } @@ -336,19 +252,16 @@ inline Functor for_each_segment(Geometry const& geometry, Functor f) \tparam Functor \tparam_functor \qbk{[include reference/algorithms/for_each_segment.qbk]} +\qbk{[heading Example]} +\qbk{[for_each_segment_const] [for_each_segment_const_output]} */ template inline Functor for_each_segment(Geometry& geometry, Functor f) { concept::check(); - return dispatch::for_each_segment - < - typename tag_cast::type, multi_tag>::type, - Geometry, - Functor, - false - >::apply(geometry, f); + dispatch::for_each_segment::apply(geometry, f); + return f; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp b/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp index 8d3dd68b3..3125752db 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/intersection.hpp @@ -22,15 +22,14 @@ namespace boost { namespace geometry namespace detail { namespace intersection { -template -< - typename Box1, typename Box2, - typename BoxOut, - typename Strategy, - std::size_t Dimension, std::size_t DimensionCount -> +template struct intersection_box_box { + template + < + typename Box1, typename Box2, typename BoxOut, + typename Strategy + > static inline bool apply(Box1 const& box1, Box2 const& box2, BoxOut& box_out, Strategy const& strategy) @@ -50,23 +49,19 @@ struct intersection_box_box set(box_out, min1 < min2 ? min2 : min1); set(box_out, max1 > max2 ? max2 : max1); - return intersection_box_box - < - Box1, Box2, BoxOut, Strategy, - Dimension + 1, DimensionCount - >::apply(box1, box2, box_out, strategy); + return intersection_box_box + ::apply(box1, box2, box_out, strategy); } }; -template -< - typename Box1, typename Box2, - typename BoxOut, - typename Strategy, - std::size_t DimensionCount -> -struct intersection_box_box +template +struct intersection_box_box { + template + < + typename Box1, typename Box2, typename BoxOut, + typename Strategy + > static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&) { return true; @@ -86,15 +81,14 @@ namespace dispatch // By default, all is forwarded to the intersection_insert-dispatcher template < - typename Tag1, typename Tag2, typename TagOut, typename Geometry1, typename Geometry2, - typename GeometryOut, - typename Strategy + typename Tag1 = typename geometry::tag::type, + typename Tag2 = typename geometry::tag::type, + bool Reverse = reverse_dispatch::type::value > struct intersection { - typedef std::back_insert_iterator output_iterator; - + template static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, GeometryOut& geometry_out, @@ -104,17 +98,8 @@ struct intersection intersection_insert < - Tag1, Tag2, typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - detail::overlay::do_reverse::value, false>::value, - detail::overlay::do_reverse::value, false>::value, - detail::overlay::do_reverse::value>::value, - output_iterator, OneOut, - overlay_intersection, - Strategy + Geometry1, Geometry2, OneOut, + overlay_intersection >::apply(geometry1, geometry2, std::back_inserter(geometry_out), strategy); return true; @@ -123,50 +108,50 @@ struct intersection }; +// If reversal is needed, perform it template < - typename Box1, typename Box2, - typename BoxOut, - typename Strategy + typename Geometry1, typename Geometry2, + typename Tag1, typename Tag2 > struct intersection - < - box_tag, box_tag, box_tag, - Box1, Box2, BoxOut, - Strategy - > : public detail::intersection::intersection_box_box - < - Box1, Box2, BoxOut, - Strategy, - 0, geometry::dimension::value - > -{}; - - -template < - typename Tag1, typename Tag2, typename TagOut, - typename Geometry1, typename Geometry2, - typename GeometryOut, - typename Strategy + Geometry1, Geometry2, + Tag1, Tag2, + true > -struct intersection_reversed + : intersection { - static inline bool apply(Geometry1 const& geometry1, - Geometry2 const& geometry2, - GeometryOut& geometry_out, - Strategy const& strategy) + template + static inline bool apply( + Geometry1 const& g1, + Geometry2 const& g2, + GeometryOut& out, + Strategy const& strategy) { - return intersection - < - Tag2, Tag1, TagOut, - Geometry2, Geometry1, - GeometryOut, Strategy - >::apply(geometry2, geometry1, geometry_out, strategy); + return intersection< + Geometry2, Geometry1, + Tag2, Tag1, + false + >::apply(g2, g1, out, strategy); } }; +template +< + typename Box1, typename Box2, bool Reverse +> +struct intersection + < + Box1, Box2, + box_tag, box_tag, + Reverse + > : public detail::intersection::intersection_box_box + < + 0, geometry::dimension::value + > +{}; } // namespace dispatch @@ -210,24 +195,10 @@ inline bool intersection(Geometry1 const& geometry1, > strategy; - return boost::mpl::if_c - < - geometry::reverse_dispatch::type::value, - dispatch::intersection_reversed - < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - Geometry1, Geometry2, GeometryOut, strategy - >, - dispatch::intersection - < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - Geometry1, Geometry2, GeometryOut, strategy - > - >::type::apply(geometry1, geometry2, geometry_out, strategy()); + return dispatch::intersection< + Geometry1, + Geometry2 + >::apply(geometry1, geometry2, geometry_out, strategy()); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/length.hpp b/project/jni/boost/include/boost/geometry/algorithms/length.hpp index de53a39e8..b537186a3 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/length.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/length.hpp @@ -43,9 +43,10 @@ namespace detail { namespace length { -template +template struct segment_length { + template static inline typename default_length_result::type apply( Segment const& segment, Strategy const& strategy) { @@ -63,11 +64,12 @@ struct segment_length \note for_each could be used here, now that point_type is changed by boost range iterator */ -template +template struct range_length { typedef typename default_length_result::type return_type; + template static inline return_type apply( Range const& range, Strategy const& strategy) { @@ -106,28 +108,31 @@ namespace dispatch { -template +template ::type> struct length : detail::calculate_null - < - typename default_length_result::type, - Geometry, - Strategy - > -{}; +{ + typedef typename default_length_result::type return_type; + + template + static inline return_type apply(Geometry const& geometry, Strategy const& strategy) + { + return calculate_null::apply(geometry, strategy); + } +}; -template -struct length - : detail::length::range_length +template +struct length + : detail::length::range_length {}; // RING: length is currently 0; it might be argued that it is the "perimeter" -template -struct length - : detail::length::segment_length +template +struct length + : detail::length::segment_length {}; @@ -159,12 +164,7 @@ inline typename default_length_result::type length( point_tag, typename point_type::type >::type strategy_type; - return dispatch::length - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, strategy_type()); + return dispatch::length::apply(geometry, strategy_type()); } @@ -190,12 +190,7 @@ inline typename default_length_result::type length( // detail::throw_on_empty_input(geometry); - return dispatch::length - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, strategy); + return dispatch::length::apply(geometry, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp index 20f35e90d..58afe4b97 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_geometries.hpp @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -35,19 +35,22 @@ namespace dispatch { -template -struct num_geometries -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +template +< + typename Geometry, + typename Tag = typename tag_cast + < + typename tag::type, + single_tag, + multi_tag + >::type +> +struct num_geometries: not_implemented +{}; template -struct num_geometries +struct num_geometries { static inline std::size_t apply(Geometry const&) { @@ -76,16 +79,7 @@ inline std::size_t num_geometries(Geometry const& geometry) { concept::check(); - return dispatch::num_geometries - < - typename tag_cast - < - typename tag::type, - single_tag, - multi_tag - >::type, - Geometry - >::apply(geometry); + return dispatch::num_geometries::apply(geometry); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp index 2149f4657..e815f5981 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_interior_rings.hpp @@ -32,7 +32,7 @@ namespace dispatch { -template +template ::type> struct num_interior_rings { static inline std::size_t apply(Geometry const& ) @@ -44,7 +44,7 @@ struct num_interior_rings template -struct num_interior_rings +struct num_interior_rings { static inline std::size_t apply(Polygon const& polygon) { @@ -74,11 +74,7 @@ struct num_interior_rings template inline std::size_t num_interior_rings(Geometry const& geometry) { - return dispatch::num_interior_rings - < - typename tag::type, - Geometry - >::apply(geometry); + return dispatch::num_interior_rings::apply(geometry); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp b/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp index c480068f4..e5a7aef6d 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/num_points.hpp @@ -16,7 +16,6 @@ #include -#include #include #include @@ -27,6 +26,7 @@ #include #include +#include #include @@ -38,9 +38,9 @@ namespace detail { namespace num_points { -template struct range_count { + template static inline std::size_t apply(Range const& range, bool add_for_open) { std::size_t n = boost::size(range); @@ -60,30 +60,31 @@ struct range_count } }; -template +template struct other_count { + template static inline std::size_t apply(Geometry const&, bool) { return D; } }; -template -struct polygon_count +struct polygon_count: private range_count { + template static inline std::size_t apply(Polygon const& poly, bool add_for_open) { typedef typename geometry::ring_type::type ring_type; - std::size_t n = range_count::apply( + std::size_t n = range_count::apply( exterior_ring(poly), add_for_open); typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - n += range_count::apply(*it, add_for_open); + n += range_count::apply(*it, add_for_open); } return n; @@ -98,44 +99,42 @@ struct polygon_count namespace dispatch { -template -struct num_points -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; - -template -struct num_points - : detail::num_points::other_count +template +< + typename Geometry, + typename Tag = typename tag_cast::type, multi_tag>::type +> +struct num_points: not_implemented {}; template -struct num_points - : detail::num_points::other_count +struct num_points + : detail::num_points::other_count<1> {}; template -struct num_points - : detail::num_points::other_count +struct num_points + : detail::num_points::other_count<4> {}; template -struct num_points - : detail::num_points::range_count +struct num_points + : detail::num_points::other_count<2> {}; template -struct num_points - : detail::num_points::range_count +struct num_points + : detail::num_points::range_count {}; template -struct num_points - : detail::num_points::polygon_count +struct num_points + : detail::num_points::range_count +{}; + +template +struct num_points + : detail::num_points::polygon_count {}; } // namespace dispatch @@ -158,11 +157,7 @@ inline std::size_t num_points(Geometry const& geometry, bool add_for_open = fals { concept::check(); - return dispatch::num_points - < - typename tag_cast::type, multi_tag>::type, - Geometry - >::apply(geometry, add_for_open); + return dispatch::num_points::apply(geometry, add_for_open); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp b/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp index 2f854b4fd..d417a4b1f 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/overlaps.hpp @@ -17,10 +17,10 @@ #include -#include - #include +#include + #include namespace boost { namespace geometry @@ -32,13 +32,12 @@ namespace detail { namespace overlaps template < - typename Box1, - typename Box2, std::size_t Dimension, std::size_t DimensionCount > struct box_box_loop { + template static inline void apply(Box1 const& b1, Box2 const& b2, bool& overlaps, bool& one_in_two, bool& two_in_one) { @@ -84,8 +83,6 @@ struct box_box_loop box_box_loop < - Box1, - Box2, Dimension + 1, DimensionCount >::apply(b1, b2, overlaps, one_in_two, two_in_one); @@ -94,24 +91,19 @@ struct box_box_loop template < - typename Box1, - typename Box2, std::size_t DimensionCount > -struct box_box_loop +struct box_box_loop { + template static inline void apply(Box1 const& , Box2 const&, bool&, bool&, bool&) { } }; -template -< - typename Box1, - typename Box2 -> struct box_box { + template static inline bool apply(Box1 const& b1, Box2 const& b2) { bool overlaps = true; @@ -119,8 +111,6 @@ struct box_box bool within2 = true; box_box_loop < - Box1, - Box2, 0, dimension::type::value >::apply(b1, b2, overlaps, within1, within2); @@ -148,24 +138,18 @@ namespace dispatch template < - typename Tag1, - typename Tag2, typename Geometry1, - typename Geometry2 + typename Geometry2, + typename Tag1 = typename tag::type, + typename Tag2 = typename tag::type > -struct overlaps -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE - , (types) - ); -}; +struct overlaps: not_implemented +{}; template -struct overlaps - : detail::overlaps::box_box +struct overlaps + : detail::overlaps::box_box {}; @@ -190,8 +174,6 @@ inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2) return dispatch::overlaps < - typename tag::type, - typename tag::type, Geometry1, Geometry2 >::apply(geometry1, geometry2); diff --git a/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp b/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp index adeb0b05b..b70517e3e 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/perimeter.hpp @@ -33,40 +33,43 @@ namespace dispatch { // Default perimeter is 0.0, specializations implement calculated values -template +template ::type> struct perimeter : detail::calculate_null - < - typename default_length_result::type, - Geometry, - Strategy - > -{}; +{ + typedef typename default_length_result::type return_type; -template -struct perimeter + template + static inline return_type apply(Geometry const& geometry, Strategy const& strategy) + { + return calculate_null::apply(geometry, strategy); + } +}; + +template +struct perimeter : detail::length::range_length < Geometry, - Strategy, closure::value > {}; -template -struct perimeter - : detail::calculate_polygon_sum - < - typename default_length_result::type, - Polygon, - Strategy, - detail::length::range_length +template +struct perimeter : detail::calculate_polygon_sum +{ + typedef typename default_length_result::type return_type; + typedef detail::length::range_length < typename ring_type::type, - Strategy, closure::value - > - > -{}; + > policy; + + template + static inline return_type apply(Polygon const& polygon, Strategy const& strategy) + { + return calculate_polygon_sum::apply(polygon, strategy); + } +}; // box,n-sphere: to be implemented @@ -100,12 +103,7 @@ inline typename default_length_result::type perimeter( // detail::throw_on_empty_input(geometry); - return dispatch::perimeter - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, strategy_type()); + return dispatch::perimeter::apply(geometry, strategy_type()); } /*! @@ -130,12 +128,7 @@ inline typename default_length_result::type perimeter( // detail::throw_on_empty_input(geometry); - return dispatch::perimeter - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, strategy); + return dispatch::perimeter::apply(geometry, strategy); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp b/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp index bf0ef2d9a..1e1168a5a 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/reverse.hpp @@ -32,9 +32,9 @@ namespace detail { namespace reverse { -template struct range_reverse { + template static inline void apply(Range& range) { std::reverse(boost::begin(range), boost::end(range)); @@ -42,21 +42,20 @@ struct range_reverse }; -template -struct polygon_reverse +struct polygon_reverse: private range_reverse { + template static inline void apply(Polygon& polygon) { typedef typename geometry::ring_type::type ring_type; - typedef range_reverse per_range; - per_range::apply(exterior_ring(polygon)); + range_reverse::apply(exterior_ring(polygon)); typename interior_return_type::type rings = interior_rings(polygon); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - per_range::apply(*it); + range_reverse::apply(*it); } } }; @@ -71,11 +70,7 @@ namespace dispatch { -template -< - typename Tag, - typename Geometry -> +template ::type> struct reverse { static inline void apply(Geometry&) @@ -84,20 +79,20 @@ struct reverse template -struct reverse - : detail::reverse::range_reverse +struct reverse + : detail::reverse::range_reverse {}; template -struct reverse - : detail::reverse::range_reverse +struct reverse + : detail::reverse::range_reverse {}; template -struct reverse - : detail::reverse::polygon_reverse +struct reverse + : detail::reverse::polygon_reverse {}; @@ -121,11 +116,7 @@ inline void reverse(Geometry& geometry) { concept::check(); - dispatch::reverse - < - typename tag::type, - Geometry - >::apply(geometry); + dispatch::reverse::apply(geometry); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp b/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp index 225321d30..7e3aca401 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/simplify.hpp @@ -33,6 +33,7 @@ #include #include +#include #include @@ -43,12 +44,11 @@ namespace boost { namespace geometry namespace detail { namespace simplify { -template struct simplify_range_insert { - template + template static inline void apply(Range const& range, OutputIterator out, - Distance const& max_distance, Strategy const& strategy) + Distance const& max_distance, Strategy const& strategy) { if (boost::size(range) <= 2 || max_distance < 0) { @@ -62,12 +62,11 @@ struct simplify_range_insert }; -template struct simplify_copy { - template + template static inline void apply(Range const& range, Range& out, - Distance const& , Strategy const& ) + Distance const& , Strategy const& ) { std::copy ( @@ -77,10 +76,10 @@ struct simplify_copy }; -template +template struct simplify_range { - template + template static inline void apply(Range const& range, Range& out, Distance const& max_distance, Strategy const& strategy) { @@ -101,14 +100,11 @@ struct simplify_range if (boost::size(range) <= int(Minimum) || max_distance < 0.0) { - simplify_copy::apply - ( - range, out, max_distance, strategy - ); + simplify_copy::apply(range, out, max_distance, strategy); } else { - simplify_range_insert::apply + simplify_range_insert::apply ( range, std::back_inserter(out), max_distance, strategy ); @@ -116,10 +112,9 @@ struct simplify_range } }; -template struct simplify_polygon { - template + template static inline void apply(Polygon const& poly_in, Polygon& poly_out, Distance const& max_distance, Strategy const& strategy) { @@ -133,9 +128,9 @@ struct simplify_polygon // Note that if there are inner rings, and distance is too large, // they might intersect with the outer ring in the output, // while it didn't in the input. - simplify_range::apply(exterior_ring(poly_in), - exterior_ring(poly_out), - max_distance, strategy); + simplify_range::apply(exterior_ring(poly_in), + exterior_ring(poly_out), + max_distance, strategy); traits::resize < @@ -154,8 +149,7 @@ struct simplify_polygon it_in != boost::end(rings_in); ++it_in, ++it_out) { - simplify_range::apply(*it_in, - *it_out, max_distance, strategy); + simplify_range::apply(*it_in, *it_out, max_distance, strategy); } } }; @@ -169,15 +163,18 @@ struct simplify_polygon namespace dispatch { -template -struct simplify -{ -}; +template +< + typename Geometry, + typename Tag = typename tag::type +> +struct simplify: not_implemented +{}; -template -struct simplify +template +struct simplify { - template + template static inline void apply(Point const& point, Point& out, Distance const& , Strategy const& ) { @@ -186,22 +183,15 @@ struct simplify }; -template -struct simplify - : detail::simplify::simplify_range - < - Linestring, - Strategy, - 2 - > +template +struct simplify + : detail::simplify::simplify_range<2> {}; -template -struct simplify +template +struct simplify : detail::simplify::simplify_range < - Ring, - Strategy, core_detail::closure::minimum_ring_size < geometry::closure::value @@ -209,38 +199,29 @@ struct simplify > {}; -template -struct simplify +template +struct simplify : detail::simplify::simplify_polygon - < - Polygon, - Strategy - > {}; -template -struct simplify_insert -{ -}; - - -template -struct simplify_insert - : detail::simplify::simplify_range_insert - < - Linestring, - Strategy - > +template +< + typename Geometry, + typename Tag = typename tag::type +> +struct simplify_insert: not_implemented {}; -template -struct simplify_insert + +template +struct simplify_insert + : detail::simplify::simplify_range_insert +{}; + +template +struct simplify_insert : detail::simplify::simplify_range_insert - < - Ring, - Strategy - > {}; @@ -275,12 +256,7 @@ inline void simplify(Geometry const& geometry, Geometry& out, geometry::clear(out); - dispatch::simplify - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, out, max_distance, strategy); + dispatch::simplify::apply(geometry, out, max_distance, strategy); } @@ -348,12 +324,7 @@ inline void simplify_insert(Geometry const& geometry, OutputIterator out, concept::check(); BOOST_CONCEPT_ASSERT( (geometry::concept::SimplifyStrategy) ); - dispatch::simplify_insert - < - typename tag::type, - Geometry, - Strategy - >::apply(geometry, out, max_distance, strategy); + dispatch::simplify_insert::apply(geometry, out, max_distance, strategy); } /*! @@ -387,12 +358,7 @@ inline void simplify_insert(Geometry const& geometry, OutputIterator out, point_type, ds_strategy_type > strategy_type; - dispatch::simplify_insert - < - typename tag::type, - Geometry, - strategy_type - >::apply(geometry, out, max_distance, strategy_type()); + dispatch::simplify_insert::apply(geometry, out, max_distance, strategy_type()); } }} // namespace detail::simplify diff --git a/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp b/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp index 6394576de..28affc43c 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/sym_difference.hpp @@ -59,35 +59,20 @@ inline OutputIterator sym_difference_insert(Geometry1 const& geometry1, out = geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry1, Geometry2, - geometry::detail::overlay::do_reverse::value>::value, - geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, + GeometryOut, overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value, + geometry::detail::overlay::do_reverse::value, true>::value >::apply(geometry1, geometry2, out, strategy); out = geometry::dispatch::intersection_insert < - typename geometry::tag::type, - typename geometry::tag::type, - typename geometry::tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, Geometry2, Geometry1, + GeometryOut, + overlay_difference, geometry::detail::overlay::do_reverse::value>::value, geometry::detail::overlay::do_reverse::value, true>::value, - geometry::detail::overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - overlay_difference, - Strategy + geometry::detail::overlay::do_reverse::value>::value >::apply(geometry2, geometry1, out, strategy); return out; } diff --git a/project/jni/boost/include/boost/geometry/algorithms/touches.hpp b/project/jni/boost/include/boost/geometry/algorithms/touches.hpp new file mode 100644 index 000000000..7d424af42 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/algorithms/touches.hpp @@ -0,0 +1,181 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP +#define BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP + + +#include + +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace geometry +{ + +namespace detail { namespace touches +{ + +template +inline bool ok_for_touch(Turn const& turn) +{ + return turn.both(detail::overlay::operation_union) + || turn.both(detail::overlay::operation_blocked) + || turn.combination(detail::overlay::operation_union, detail::overlay::operation_blocked) + ; +} + +template +inline bool has_only_turns(Turns const& turns) +{ + bool has_touch = false; + typedef typename boost::range_iterator::type iterator_type; + for (iterator_type it = boost::begin(turns); it != boost::end(turns); ++it) + { + if (it->has(detail::overlay::operation_intersection)) + { + return false; + } + + switch(it->method) + { + case detail::overlay::method_crosses: + return false; + case detail::overlay::method_equal: + // Segment spatially equal means: at the right side + // the polygon internally overlaps. So return false. + return false; + case detail::overlay::method_touch: + case detail::overlay::method_touch_interior: + case detail::overlay::method_collinear: + if (ok_for_touch(*it)) + { + has_touch = true; + } + else + { + return false; + } + break; + case detail::overlay::method_none : + case detail::overlay::method_disjoint : + case detail::overlay::method_error : + break; + } + } + return has_touch; +} + +}} + +/*! +\brief \brief_check{has at least one touching point (self-tangency)} +\note This function can be called for one geometry (self-tangency) and + also for two geometries (touch) +\ingroup touches +\tparam Geometry \tparam_geometry +\param geometry \param_geometry +\return \return_check{is self-touching} + +\qbk{distinguish,one geometry} +\qbk{[def __one_parameter__]} +\qbk{[include reference/algorithms/touches.qbk]} +*/ +template +inline bool touches(Geometry const& geometry) +{ + concept::check(); + + typedef detail::overlay::turn_info + < + typename geometry::point_type::type + > turn_info; + + typedef detail::overlay::get_turn_info + < + typename point_type::type, + typename point_type::type, + turn_info, + detail::overlay::assign_null_policy + > policy_type; + + std::deque turns; + detail::self_get_turn_points::no_interrupt_policy policy; + detail::self_get_turn_points::get_turns + < + Geometry, + std::deque, + policy_type, + detail::self_get_turn_points::no_interrupt_policy + >::apply(geometry, turns, policy); + + return detail::touches::has_only_turns(turns); +} + + +/*! +\brief \brief_check2{have at least one touching point (tangent - non overlapping)} +\ingroup touches +\tparam Geometry1 \tparam_geometry +\tparam Geometry2 \tparam_geometry +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\return \return_check2{touch each other} + +\qbk{distinguish,two geometries} +\qbk{[include reference/algorithms/touches.qbk]} + */ +template +inline bool touches(Geometry1 const& geometry1, Geometry2 const& geometry2) +{ + concept::check(); + concept::check(); + + + typedef detail::overlay::turn_info + < + typename geometry::point_type::type + > turn_info; + + typedef detail::overlay::get_turn_info + < + typename point_type::type, + typename point_type::type, + turn_info, + detail::overlay::assign_null_policy + > policy_type; + + std::deque turns; + detail::get_turns::no_interrupt_policy policy; + boost::geometry::get_turns + < + false, false, + detail::overlay::assign_null_policy + >(geometry1, geometry2, turns, policy); + + return detail::touches::has_only_turns(turns) + && ! geometry::detail::disjoint::rings_containing(geometry1, geometry2) + && ! geometry::detail::disjoint::rings_containing(geometry2, geometry1) + ; +} + + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_TOUCHES_HPP diff --git a/project/jni/boost/include/boost/geometry/algorithms/transform.hpp b/project/jni/boost/include/boost/geometry/algorithms/transform.hpp index 22b45dc77..52d195fe8 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/transform.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/transform.hpp @@ -41,9 +41,9 @@ namespace boost { namespace geometry namespace detail { namespace transform { -template struct transform_point { + template static inline bool apply(Point1 const& p1, Point2& p2, Strategy const& strategy) { @@ -52,9 +52,9 @@ struct transform_point }; -template struct transform_box { + template static inline bool apply(Box1 const& b1, Box2& b2, Strategy const& strategy) { @@ -91,9 +91,9 @@ struct transform_box } }; -template struct transform_box_or_segment { + template static inline bool apply(Geometry1 const& source, Geometry2& target, Strategy const& strategy) { @@ -133,12 +133,7 @@ inline bool transform_range_out(Range const& range, it != boost::end(range); ++it) { - if (! transform_point - < - typename point_type::type, - PointOut, - Strategy - >::apply(*it, point_out, strategy)) + if (! transform_point::apply(*it, point_out, strategy)) { return false; } @@ -148,9 +143,9 @@ inline bool transform_range_out(Range const& range, } -template struct transform_polygon { + template static inline bool apply(Polygon1 const& poly1, Polygon2& poly2, Strategy const& strategy) { @@ -211,9 +206,9 @@ struct select_strategy >::type type; }; -template struct transform_range { + template static inline bool apply(Range1 const& range1, Range2& range2, Strategy const& strategy) { @@ -236,50 +231,50 @@ namespace dispatch template < - typename Tag1, typename Tag2, typename Geometry1, typename Geometry2, - typename Strategy + typename Tag1 = typename tag_cast::type, multi_tag>::type, + typename Tag2 = typename tag_cast::type, multi_tag>::type > struct transform {}; -template -struct transform - : detail::transform::transform_point +template +struct transform + : detail::transform::transform_point { }; -template +template struct transform < - linestring_tag, linestring_tag, - Linestring1, Linestring2, Strategy + Linestring1, Linestring2, + linestring_tag, linestring_tag > - : detail::transform::transform_range + : detail::transform::transform_range { }; -template -struct transform - : detail::transform::transform_range +template +struct transform + : detail::transform::transform_range { }; -template -struct transform - : detail::transform::transform_polygon +template +struct transform + : detail::transform::transform_polygon { }; -template -struct transform - : detail::transform::transform_box +template +struct transform + : detail::transform::transform_box { }; -template -struct transform - : detail::transform::transform_box_or_segment +template +struct transform + : detail::transform::transform_box_or_segment { }; @@ -310,14 +305,7 @@ inline bool transform(Geometry1 const& geometry1, Geometry2& geometry2, concept::check(); concept::check(); - typedef dispatch::transform - < - typename tag_cast::type, multi_tag>::type, - typename tag_cast::type, multi_tag>::type, - Geometry1, - Geometry2, - Strategy - > transform_type; + typedef dispatch::transform transform_type; return transform_type::apply(geometry1, geometry2, strategy); } diff --git a/project/jni/boost/include/boost/geometry/algorithms/union.hpp b/project/jni/boost/include/boost/geometry/algorithms/union.hpp index 28d8e5dc0..479f556a1 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/union.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/union.hpp @@ -10,14 +10,13 @@ #define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP -#include - #include #include #include #include #include +#include #include @@ -30,78 +29,70 @@ namespace dispatch template < - // tag dispatching: - typename TagIn1, typename TagIn2, typename TagOut, - // metafunction finetuning helpers: - bool Areal1, bool Areal2, bool ArealOut, - // real types - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, - typename GeometryOut, - typename Strategy + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1 = typename tag::type, + typename TagIn2 = typename tag::type, + typename TagOut = typename tag::type, + bool Areal1 = geometry::is_areal::value, + bool Areal2 = geometry::is_areal::value, + bool ArealOut = geometry::is_areal::value, + bool Reverse1 = detail::overlay::do_reverse::value>::value, + bool Reverse2 = detail::overlay::do_reverse::value>::value, + bool ReverseOut = detail::overlay::do_reverse::value>::value, + bool Reverse = geometry::reverse_dispatch::type::value > -struct union_insert -{ - BOOST_MPL_ASSERT_MSG - ( - false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPES - , (types) - ); -}; - - -template -< - typename TagIn1, typename TagIn2, typename TagOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, - typename GeometryOut, - typename Strategy -> -struct union_insert - < - TagIn1, TagIn2, TagOut, - true, true, true, - Geometry1, Geometry2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, - Strategy - > : detail::overlay::overlay - +struct union_insert: not_implemented {}; +// If reversal is needed, perform it first template < - typename GeometryTag1, typename GeometryTag2, typename GeometryTag3, - bool Areal1, bool Areal2, bool ArealOut, - typename Geometry1, typename Geometry2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, - typename Strategy + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1, typename TagIn2, typename TagOut, + bool Reverse1, bool Reverse2, bool ReverseOut > -struct union_insert_reversed +struct union_insert + < + Geometry1, Geometry2, GeometryOut, + TagIn1, TagIn2, TagOut, + true, true, true, + Reverse1, Reverse2, ReverseOut, + true + >: union_insert { + template static inline OutputIterator apply(Geometry1 const& g1, Geometry2 const& g2, OutputIterator out, Strategy const& strategy) { return union_insert < - GeometryTag2, GeometryTag1, GeometryTag3, - Areal2, Areal1, ArealOut, - Geometry2, Geometry1, - Reverse2, Reverse1, ReverseOut, - OutputIterator, GeometryOut, - Strategy + Geometry2, Geometry1, GeometryOut >::apply(g2, g1, out, strategy); } }; +template +< + typename Geometry1, typename Geometry2, typename GeometryOut, + typename TagIn1, typename TagIn2, typename TagOut, + bool Reverse1, bool Reverse2, bool ReverseOut +> +struct union_insert + < + Geometry1, Geometry2, GeometryOut, + TagIn1, TagIn2, TagOut, + true, true, true, + Reverse1, Reverse2, ReverseOut, + false + > : detail::overlay::overlay + +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -121,40 +112,10 @@ inline OutputIterator insert(Geometry1 const& geometry1, OutputIterator out, Strategy const& strategy) { - return boost::mpl::if_c - < - geometry::reverse_dispatch::type::value, - dispatch::union_insert_reversed - < - typename tag::type, - typename tag::type, - typename tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - Strategy - >, - dispatch::union_insert - < - typename tag::type, - typename tag::type, - typename tag::type, - geometry::is_areal::value, - geometry::is_areal::value, - geometry::is_areal::value, - Geometry1, Geometry2, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - overlay::do_reverse::value>::value, - OutputIterator, GeometryOut, - Strategy - > - >::type::apply(geometry1, geometry2, out, strategy); + return dispatch::union_insert + < + Geometry1, Geometry2, GeometryOut + >::apply(geometry1, geometry2, out, strategy); } /*! diff --git a/project/jni/boost/include/boost/geometry/algorithms/unique.hpp b/project/jni/boost/include/boost/geometry/algorithms/unique.hpp index 3bbf479f9..e11dc13c4 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/unique.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/unique.hpp @@ -34,9 +34,9 @@ namespace detail { namespace unique { -template struct range_unique { + template static inline void apply(Range& range, ComparePolicy const& policy) { typename boost::range_iterator::type it @@ -52,21 +52,20 @@ struct range_unique }; -template struct polygon_unique { + template static inline void apply(Polygon& polygon, ComparePolicy const& policy) { typedef typename geometry::ring_type::type ring_type; - typedef range_unique per_range; - per_range::apply(exterior_ring(polygon), policy); + range_unique::apply(exterior_ring(polygon), policy); typename interior_return_type::type rings = interior_rings(polygon); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { - per_range::apply(*it, policy); + range_unique::apply(*it, policy); } } }; @@ -85,32 +84,32 @@ namespace dispatch template < - typename Tag, typename Geometry, - typename ComparePolicy + typename Tag = typename tag::type > struct unique { + template static inline void apply(Geometry&, ComparePolicy const& ) {} }; -template -struct unique - : detail::unique::range_unique +template +struct unique + : detail::unique::range_unique {}; -template -struct unique - : detail::unique::range_unique +template +struct unique + : detail::unique::range_unique {}; -template -struct unique - : detail::unique::polygon_unique +template +struct unique + : detail::unique::polygon_unique {}; @@ -139,12 +138,7 @@ inline void unique(Geometry& geometry) > policy; - dispatch::unique - < - typename tag::type, - Geometry, - policy - >::apply(geometry, policy()); + dispatch::unique::apply(geometry, policy()); } }} // namespace boost::geometry diff --git a/project/jni/boost/include/boost/geometry/algorithms/within.hpp b/project/jni/boost/include/boost/geometry/algorithms/within.hpp index 0e0cb68d5..f1f0993d7 100644 --- a/project/jni/boost/include/boost/geometry/algorithms/within.hpp +++ b/project/jni/boost/include/boost/geometry/algorithms/within.hpp @@ -65,7 +65,7 @@ struct point_in_ring static inline int apply(Point const& point, Ring const& ring, Strategy const& strategy) { - if (boost::size(ring) + if (int(boost::size(ring)) < core_detail::closure::minimum_ring_size::value) { return -1; diff --git a/project/jni/boost/include/boost/geometry/core/access.hpp b/project/jni/boost/include/boost/geometry/core/access.hpp index a463b8cdc..cdc8ff9cf 100644 --- a/project/jni/boost/include/boost/geometry/core/access.hpp +++ b/project/jni/boost/include/boost/geometry/core/access.hpp @@ -18,12 +18,13 @@ #include #include -#include #include +#include #include #include #include +#include namespace boost { namespace geometry @@ -79,6 +80,52 @@ struct indexed_access {}; } // namespace traits +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + +template +< + typename Geometry, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access_non_pointer +{ + static inline CoordinateType get(Geometry const& geometry) + { + return traits::indexed_access::get(geometry); + } + static inline void set(Geometry& b, CoordinateType const& value) + { + traits::indexed_access::set(b, value); + } +}; + +template +< + typename Geometry, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access_pointer +{ + static inline CoordinateType get(Geometry const* geometry) + { + return traits::indexed_access::type, Index, Dimension>::get(*geometry); + } + static inline void set(Geometry* geometry, CoordinateType const& value) + { + traits::indexed_access::type, Index, Dimension>::set(*geometry, value); + } +}; + + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + #ifndef DOXYGEN_NO_DISPATCH namespace core_dispatch @@ -89,7 +136,9 @@ template typename Tag, typename Geometry, typename - CoordinateType, std::size_t Dimension + CoordinateType, + std::size_t Dimension, + typename IsPointer > struct access { @@ -103,7 +152,8 @@ template typename Geometry, typename CoordinateType, std::size_t Index, - std::size_t Dimension + std::size_t Dimension, + typename IsPointer > struct indexed_access { @@ -112,7 +162,7 @@ struct indexed_access }; template -struct access +struct access { static inline CoordinateType get(Point const& point) { @@ -124,6 +174,20 @@ struct access } }; +template +struct access +{ + static inline CoordinateType get(Point const* point) + { + return traits::access::type, Dimension>::get(*point); + } + static inline void set(Point* p, CoordinateType const& value) + { + traits::access::type, Dimension>::set(*p, value); + } +}; + + template < typename Box, @@ -131,17 +195,21 @@ template std::size_t Index, std::size_t Dimension > -struct indexed_access -{ - static inline CoordinateType get(Box const& box) - { - return traits::indexed_access::get(box); - } - static inline void set(Box& b, CoordinateType const& value) - { - traits::indexed_access::set(b, value); - } -}; +struct indexed_access + : detail::indexed_access_non_pointer +{}; + +template +< + typename Box, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access + : detail::indexed_access_pointer +{}; + template < @@ -150,17 +218,21 @@ template std::size_t Index, std::size_t Dimension > -struct indexed_access -{ - static inline CoordinateType get(Segment const& segment) - { - return traits::indexed_access::get(segment); - } - static inline void set(Segment& segment, CoordinateType const& value) - { - traits::indexed_access::set(segment, value); - } -}; +struct indexed_access + : detail::indexed_access_non_pointer +{}; + + +template +< + typename Segment, + typename CoordinateType, + std::size_t Index, + std::size_t Dimension +> +struct indexed_access + : detail::indexed_access_pointer +{}; } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH @@ -199,14 +271,13 @@ inline typename coordinate_type::type get(Geometry const& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::access < typename tag::type, - ncg_type, - typename coordinate_type::type, - Dimension + typename geometry::util::bare_type::type, + typename coordinate_type::type, + Dimension, + typename boost::is_pointer::type > coord_access_type; return coord_access_type::get(geometry); @@ -234,14 +305,13 @@ inline void set(Geometry& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::access < typename tag::type, - ncg_type, - typename coordinate_type::type, - Dimension + typename geometry::util::bare_type::type, + typename coordinate_type::type, + Dimension, + typename boost::is_pointer::type > coord_access_type; coord_access_type::set(geometry, value); @@ -269,15 +339,14 @@ inline typename coordinate_type::type get(Geometry const& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::indexed_access < typename tag::type, - ncg_type, - typename coordinate_type::type, + typename geometry::util::bare_type::type, + typename coordinate_type::type, Index, - Dimension + Dimension, + typename boost::is_pointer::type > coord_access_type; return coord_access_type::get(geometry); @@ -306,14 +375,14 @@ inline void set(Geometry& geometry { boost::ignore_unused_variable_warning(dummy); - typedef typename boost::remove_const::type ncg_type; - typedef core_dispatch::indexed_access < - typename tag::type, ncg_type, - typename coordinate_type::type, + typename tag::type, + typename geometry::util::bare_type::type, + typename coordinate_type::type, Index, - Dimension + Dimension, + typename boost::is_pointer::type > coord_access_type; coord_access_type::set(geometry, value); diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp index 84c11e2a5..2f3c91460 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_dimension.hpp @@ -20,9 +20,9 @@ #include #include #include -#include #include +#include namespace boost { namespace geometry { @@ -58,7 +58,7 @@ template struct dimension : dimension::type> {}; template -struct dimension : traits::dimension

{}; +struct dimension : traits::dimension::type> {}; } // namespace core_dispatch #endif @@ -75,7 +75,7 @@ struct dimension : core_dispatch::dimension < typename tag::type, - typename boost::remove_const::type + typename geometry::util::bare_type::type > {}; diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp index c23b8af15..01e5ad1dd 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_system.hpp @@ -16,8 +16,9 @@ #include -#include + #include +#include namespace boost { namespace geometry @@ -61,10 +62,13 @@ namespace core_dispatch }; - template - struct coordinate_system + template + struct coordinate_system { - typedef typename traits::coordinate_system

::type type; + typedef typename traits::coordinate_system + < + typename geometry::util::bare_type::type + >::type type; }; @@ -82,11 +86,10 @@ namespace core_dispatch template struct coordinate_system { - typedef typename boost::remove_const::type ncg; typedef typename core_dispatch::coordinate_system < typename tag::type, - ncg + typename geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp b/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp index 0f901d3f1..d17f66ab7 100644 --- a/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp +++ b/project/jni/boost/include/boost/geometry/core/coordinate_type.hpp @@ -16,9 +16,10 @@ #include -#include +#include #include +#include #include @@ -63,12 +64,17 @@ struct coordinate_type template struct coordinate_type { - typedef typename traits::coordinate_type::type type; + typedef typename traits::coordinate_type + < + typename geometry::util::bare_type::type + >::type type; }; + } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH + /*! \brief \brief_meta{type, coordinate type (int\, float\, double\, etc), \meta_point_type} \tparam Geometry \tparam_geometry @@ -79,11 +85,11 @@ struct coordinate_type template struct coordinate_type { - typedef typename core_dispatch::coordinate_type - < - typename tag::type, - typename boost::remove_const::type - >::type type; + typedef typename core_dispatch::coordinate_type + < + typename tag::type, + typename geometry::util::bare_type::type + >::type type; }; template diff --git a/project/jni/boost/include/boost/geometry/core/point_type.hpp b/project/jni/boost/include/boost/geometry/core/point_type.hpp index f49a43c56..e148c84a5 100644 --- a/project/jni/boost/include/boost/geometry/core/point_type.hpp +++ b/project/jni/boost/include/boost/geometry/core/point_type.hpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace boost { namespace geometry { @@ -115,11 +116,10 @@ struct point_type template struct point_type { - typedef typename boost::remove_const::type ncg; typedef typename core_dispatch::point_type < typename tag::type, - ncg + typename boost::geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/core/tag.hpp b/project/jni/boost/include/boost/geometry/core/tag.hpp index 5a99c9707..4c790fdc9 100644 --- a/project/jni/boost/include/boost/geometry/core/tag.hpp +++ b/project/jni/boost/include/boost/geometry/core/tag.hpp @@ -16,9 +16,9 @@ #include -#include #include +#include namespace boost { namespace geometry @@ -47,6 +47,7 @@ struct tag } // namespace traits + /*! \brief \brief_meta{type, tag, \meta_geometry_type} \details With Boost.Geometry, tags are the driving force of the tag dispatching @@ -61,7 +62,7 @@ struct tag { typedef typename traits::tag < - typename boost::remove_const::type + typename geometry::util::bare_type::type >::type type; }; diff --git a/project/jni/boost/include/boost/geometry/geometries/variant.hpp b/project/jni/boost/include/boost/geometry/geometries/variant.hpp new file mode 100644 index 000000000..9db11d5a8 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/geometries/variant.hpp @@ -0,0 +1,34 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP +#define BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP + + +#include + + +namespace boost { namespace geometry { + + +template +struct point_type > + : point_type +{}; + + +} // namespace geometry +} // namespace boost + + +#endif // BOOST_GEOMETRY_GEOMETRIES_VARIANT_GEOMETRY_HPP diff --git a/project/jni/boost/include/boost/geometry/geometry.hpp b/project/jni/boost/include/boost/geometry/geometry.hpp index 22d08e2a4..b696b652c 100644 --- a/project/jni/boost/include/boost/geometry/geometry.hpp +++ b/project/jni/boost/include/boost/geometry/geometry.hpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp b/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp index 03921096e..566669e26 100644 --- a/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp +++ b/project/jni/boost/include/boost/geometry/iterators/ever_circling_iterator.hpp @@ -95,67 +95,115 @@ private: bool m_skip_first; }; - - template -class ever_circling_range_iterator - : public boost::iterator_adaptor - < - ever_circling_range_iterator, - typename boost::range_iterator::type - > +struct ever_circling_range_iterator + : public boost::iterator_facade + < + ever_circling_range_iterator, + typename boost::range_value::type const, + boost::random_access_traversal_tag + > { -public : - typedef typename boost::range_iterator::type iterator_type; + /// Constructor including the range it is based on + explicit inline ever_circling_range_iterator(Range& range) + : m_range(&range) + , m_iterator(boost::begin(range)) + , m_size(boost::size(range)) + , m_index(0) + {} - explicit inline ever_circling_range_iterator(Range& range, - bool skip_first = false) - : m_range(range) - , m_skip_first(skip_first) + /// Default constructor + explicit inline ever_circling_range_iterator() + : m_range(NULL) + , m_size(0) + , m_index(0) + {} + + inline ever_circling_range_iterator& operator=(ever_circling_range_iterator const& source) { - this->base_reference() = boost::begin(m_range); + m_range = source.m_range; + m_iterator = source.m_iterator; + m_size = source.m_size; + m_index = source.m_index; + return *this; } - explicit inline ever_circling_range_iterator(Range& range, iterator_type start, - bool skip_first = false) - : m_range(range) - , m_skip_first(skip_first) - { - this->base_reference() = start; - } - - /// Navigate to a certain position, should be in [start .. end], if at end - /// it will circle again. - inline void moveto(iterator_type it) - { - this->base_reference() = it; - check_end(); - } + typedef std::ptrdiff_t difference_type; private: - friend class boost::iterator_core_access; - inline void increment(bool possibly_skip = true) + inline typename boost::range_value::type const& dereference() const { - (this->base_reference())++; - check_end(possibly_skip); + return *m_iterator; } - inline void check_end(bool possibly_skip = true) + inline difference_type distance_to(ever_circling_range_iterator const& other) const { - if (this->base_reference() == boost::end(m_range)) + return other.m_index - this->m_index; + } + + inline bool equal(ever_circling_range_iterator const& other) const + { + return this->m_range == other.m_range + && this->m_index == other.m_index; + } + + inline void increment() + { + ++m_index; + if (m_index >= 0 && m_index < m_size) { - this->base_reference() = boost::begin(m_range); - if (m_skip_first && possibly_skip) - { - increment(false); - } + ++m_iterator; + } + else + { + update_iterator(); } } - Range& m_range; - bool m_skip_first; + inline void decrement() + { + --m_index; + if (m_index >= 0 && m_index < m_size) + { + --m_iterator; + } + else + { + update_iterator(); + } + } + + inline void advance(difference_type n) + { + if (m_index >= 0 && m_index < m_size + && m_index + n >= 0 && m_index + n < m_size) + { + m_index += n; + m_iterator += n; + } + else + { + m_index += n; + update_iterator(); + } + } + + inline void update_iterator() + { + while (m_index < 0) + { + m_index += m_size; + } + m_index = m_index % m_size; + this->m_iterator = boost::begin(*m_range) + m_index; + } + + Range* m_range; + typename boost::range_iterator::type m_iterator; + difference_type m_size; + difference_type m_index; }; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp index 669568635..7d0206109 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/area.hpp @@ -30,21 +30,20 @@ namespace boost { namespace geometry #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { -template -struct area - : detail::multi_sum - < - typename Strategy::return_type, - MultiGeometry, - Strategy, - area - < - typename boost::range_value::type, - Strategy, - polygon_tag - > - > -{}; +template +struct area : detail::multi_sum +{ + template + static inline typename Strategy::return_type + apply(MultiGeometry const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename Strategy::return_type, + area::type> + >(multi, strategy); + } +}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp index 855ed22fd..e990f4eff 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/centroid.hpp @@ -35,13 +35,9 @@ namespace detail { namespace centroid \brief Building block of a multi-point, to be used as Policy in the more generec centroid_multi */ -template -< - typename Point, - typename Strategy -> struct centroid_multi_point_state { + template static inline void apply(Point const& point, Strategy const& strategy, typename Strategy::state_type& state) { @@ -59,15 +55,10 @@ struct centroid_multi_point_state detail::centroid::centroid_multi */ -template -< - typename Multi, - typename Point, - typename Strategy, - typename Policy -> +template struct centroid_multi { + template static inline void apply(Multi const& multi, Point& centroid, Strategy const& strategy) { @@ -104,65 +95,28 @@ struct centroid_multi namespace dispatch { -template -< - typename MultiLinestring, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiLinestring, - Point, - Strategy, - detail::centroid::centroid_range_state - < - typename boost::range_value::type, - closed, - Strategy - > + detail::centroid::centroid_range_state > {}; -template -< - typename MultiPolygon, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiPolygon, - Point, - Strategy, detail::centroid::centroid_polygon_state - < - typename boost::range_value::type, - Strategy - > > {}; -template -< - typename MultiPoint, - typename Point, - typename Strategy -> -struct centroid +template +struct centroid : detail::centroid::centroid_multi < - MultiPoint, - Point, - Strategy, detail::centroid::centroid_multi_point_state - < - typename boost::range_value::type, - Strategy - > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp index a47685ceb..704c3e6a9 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp @@ -23,15 +23,9 @@ namespace boost { namespace geometry namespace detail { -template -< - typename ReturnType, - typename MultiGeometry, - typename Strategy, - typename Policy -> struct multi_sum { + template static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy) { ReturnType sum = ReturnType(); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp index 1093a8456..72be5ddbf 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp @@ -42,7 +42,7 @@ struct copy_segment_point_multi BOOST_ASSERT ( seg_id.multi_index >= 0 - && seg_id.multi_index < boost::size(multi) + && seg_id.multi_index < int(boost::size(multi)) ); // Call the single-version diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp index a234e240d..f474b12fd 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp @@ -44,7 +44,7 @@ struct copy_segments_multi BOOST_ASSERT ( seg_id.multi_index >= 0 - && seg_id.multi_index < boost::size(multi_geometry) + && seg_id.multi_index < int(boost::size(multi_geometry)) ); // Call the single-version diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp index 8cdd7ed97..e23acf99b 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp @@ -35,7 +35,7 @@ struct get_ring BOOST_ASSERT ( id.multi_index >= 0 - && id.multi_index < boost::size(multi_polygon) + && id.multi_index < int(boost::size(multi_polygon)) ); return get_ring::apply(id, multi_polygon[id.multi_index]); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp index 04d76422c..ac462ed4c 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp @@ -31,13 +31,13 @@ namespace detail { namespace point_on_border template < - typename MultiGeometry, typename Point, + typename MultiGeometry, typename Policy > struct point_on_multi { - static inline bool apply(MultiGeometry const& multi, Point& point) + static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) { // Take a point on the first multi-geometry // (i.e. the first that is not empty) @@ -48,7 +48,7 @@ struct point_on_multi it != boost::end(multi); ++it) { - if (Policy::apply(*it, point)) + if (Policy::apply(point, *it, midpoint)) { return true; } @@ -69,16 +69,16 @@ namespace dispatch { -template -struct point_on_border +template +struct point_on_border : detail::point_on_border::point_on_multi < - Multi, Point, + Multi, detail::point_on_border::point_on_polygon < - typename boost::range_value::type, - Point + Point, + typename boost::range_value::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index cf4bf5d83..28a4805ed 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -46,7 +46,7 @@ struct full_section_multi BOOST_ASSERT ( section.ring_id.multi_index >= 0 - && section.ring_id.multi_index < boost::size(multi) + && section.ring_id.multi_index < int(boost::size(multi)) ); return Policy::apply(multi[section.ring_id.multi_index], section); diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp new file mode 100644 index 000000000..7d1bed794 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/disjoint.hpp @@ -0,0 +1,41 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2012 Bruno Lalande, Paris, France. +// Copyright (c) 2012 Mateusz Loskot, London, UK. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP +#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP + + +#include +#include + + +namespace boost { namespace geometry +{ + + +#ifndef DOXYGEN_NO_DISPATCH +namespace dispatch +{ + +template +struct disjoint + : detail::disjoint::reverse_covered_by +{}; + +} // namespace dispatch + + +#endif // DOXYGEN_NO_DISPATCH + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DISJOINT_HPP diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp index 1876b5f91..026fc71e6 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/envelope.hpp @@ -34,9 +34,9 @@ namespace detail { namespace envelope { -template struct envelope_multi_linestring { + template static inline void apply(MultiLinestring const& mp, Box& mbr) { assign_inverse(mbr); @@ -52,9 +52,9 @@ struct envelope_multi_linestring // version for multi_polygon: outer ring's of all polygons -template struct envelope_multi_polygon { + template static inline void apply(MultiPolygon const& mp, Box& mbr) { assign_inverse(mbr); @@ -78,32 +78,20 @@ struct envelope_multi_polygon namespace dispatch { -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_range +template +struct envelope + : detail::envelope::envelope_range {}; -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_multi_linestring +template +struct envelope + : detail::envelope::envelope_multi_linestring {}; -template -< - typename Multi, typename Box, - typename StrategyLess, typename StrategyGreater -> -struct envelope - : detail::envelope::envelope_multi_polygon +template +struct envelope + : detail::envelope::envelope_multi_polygon {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp index a307ebae8..8c47672d9 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/equals.hpp @@ -29,33 +29,27 @@ namespace dispatch { -template +template struct equals < - multi_polygon_tag, multi_polygon_tag, MultiPolygon1, MultiPolygon2, - 2 + multi_polygon_tag, multi_polygon_tag, + 2, + Reverse > - : detail::equals::equals_by_collection - < - MultiPolygon1, MultiPolygon2, - detail::equals::area_check - > + : detail::equals::equals_by_collection {}; -template +template struct equals < - polygon_tag, multi_polygon_tag, Polygon, MultiPolygon, - 2 + polygon_tag, multi_polygon_tag, + 2, + Reverse > - : detail::equals::equals_by_collection - < - Polygon, MultiPolygon, - detail::equals::area_check - > + : detail::equals::equals_by_collection {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp index 1be38e0a7..adf12dbba 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/for_each.hpp @@ -36,24 +36,16 @@ namespace detail { namespace for_each // Implementation of multi, for both point and segment, // just calling the single version. -template -< - typename MultiGeometry, - typename Functor, - bool IsConst, - typename Policy -> +template struct for_each_multi { - static inline Functor apply( - typename add_const_if_c::type& multi, - Functor f) + template + static inline void apply(MultiGeometry& multi, Functor& f) { for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it) { - f = Policy::apply(*it, f); + Policy::apply(*it, f); } - return f; } }; @@ -66,55 +58,35 @@ struct for_each_multi namespace dispatch { -template -< - typename MultiGeometry, - typename Functor, - bool IsConst -> -struct for_each_point +template +struct for_each_point : detail::for_each::for_each_multi < - MultiGeometry, - Functor, - IsConst, // Specify the dispatch of the single-version as policy for_each_point < - typename single_tag_of + typename add_const_if_c < - typename tag::type - >::type, - typename boost::range_value::type, - Functor, - IsConst + is_const::value, + typename boost::range_value::type + >::type > > {}; -template -< - typename MultiGeometry, - typename Functor, - bool IsConst -> -struct for_each_segment +template +struct for_each_segment : detail::for_each::for_each_multi < - MultiGeometry, - Functor, - IsConst, // Specify the dispatch of the single-version as policy for_each_segment < - typename single_tag_of + typename add_const_if_c < - typename tag::type - >::type, - typename boost::range_value::type, - Functor, - IsConst + is_const::value, + typename boost::range_value::type + >::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp index 31e74a79b..0027a4e15 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/intersection.hpp @@ -36,14 +36,14 @@ namespace detail { namespace intersection { -template -< - typename MultiLinestring1, typename MultiLinestring2, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_multi_linestring_multi_linestring_point { + template + < + typename MultiLinestring1, typename MultiLinestring2, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring1 const& ml1, MultiLinestring2 const& ml2, OutputIterator out, Strategy const& strategy) @@ -64,12 +64,8 @@ struct intersection_multi_linestring_multi_linestring_point it2 != boost::end(ml2); ++it2) { - out = intersection_linestring_linestring_point - < - typename boost::range_value::type, - typename boost::range_value::type, - OutputIterator, PointOut, Strategy - >::apply(*it1, *it2, out, strategy); + out = intersection_linestring_linestring_point + ::apply(*it1, *it2, out, strategy); } } @@ -78,14 +74,14 @@ struct intersection_multi_linestring_multi_linestring_point }; -template -< - typename Linestring, typename MultiLinestring, - typename OutputIterator, typename PointOut, - typename Strategy -> +template struct intersection_linestring_multi_linestring_point { + template + < + typename Linestring, typename MultiLinestring, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Linestring const& linestring, MultiLinestring const& ml, OutputIterator out, Strategy const& strategy) @@ -97,12 +93,8 @@ struct intersection_linestring_multi_linestring_point it != boost::end(ml); ++it) { - out = intersection_linestring_linestring_point - < - Linestring, - typename boost::range_value::type, - OutputIterator, PointOut, Strategy - >::apply(linestring, *it, out, strategy); + out = intersection_linestring_linestring_point + ::apply(linestring, *it, out, strategy); } return out; @@ -114,14 +106,17 @@ struct intersection_linestring_multi_linestring_point // is second (above) or first (below) argument, it is not trivial to merge them. template < - typename MultiLinestring, typename Areal, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_multi_linestring_with_areal { + template + < + typename MultiLinestring, typename Areal, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal, OutputIterator out, Strategy const& strategy) @@ -135,9 +130,7 @@ struct intersection_of_multi_linestring_with_areal { out = intersection_of_linestring_with_areal < - typename boost::range_value::type, - Areal, ReverseAreal, - OutputIterator, LineStringOut, OverlayType, Strategy + ReverseAreal, LineStringOut, OverlayType >::apply(*it, areal, out, strategy); } @@ -149,38 +142,38 @@ struct intersection_of_multi_linestring_with_areal // This one calls the one above with reversed arguments template < - typename Areal, typename MultiLinestring, bool ReverseAreal, - typename OutputIterator, typename LineStringOut, - overlay_type OverlayType, - typename Strategy + typename LineStringOut, + overlay_type OverlayType > struct intersection_of_areal_with_multi_linestring { + template + < + typename Areal, typename MultiLinestring, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml, OutputIterator out, Strategy const& strategy) { return intersection_of_multi_linestring_with_areal < - MultiLinestring, Areal, ReverseAreal, - OutputIterator, LineStringOut, - OverlayType, - Strategy + ReverseAreal, LineStringOut, OverlayType >::apply(ml, areal, out, strategy); } }; -template -< - typename MultiLinestring, typename Box, - typename OutputIterator, typename LinestringOut, - typename Strategy -> +template struct clip_multi_linestring { + template + < + typename MultiLinestring, typename Box, + typename OutputIterator, typename Strategy + > static inline OutputIterator apply(MultiLinestring const& multi_linestring, Box const& box, OutputIterator out, Strategy const& ) { @@ -211,25 +204,21 @@ namespace dispatch template < typename MultiLinestring1, typename MultiLinestring2, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, multi_linestring_tag, point_tag, - false, false, false, MultiLinestring1, MultiLinestring2, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + multi_linestring_tag, multi_linestring_tag, point_tag, + false, false, false > : detail::intersection::intersection_multi_linestring_multi_linestring_point < - MultiLinestring1, MultiLinestring2, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -237,25 +226,21 @@ struct intersection_insert template < typename Linestring, typename MultiLinestring, - typename OutputIterator, typename GeometryOut, - bool Reverse1, bool Reverse2, bool ReverseOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - linestring_tag, multi_linestring_tag, point_tag, - false, false, false, Linestring, MultiLinestring, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + linestring_tag, multi_linestring_tag, point_tag, + false, false, false > : detail::intersection::intersection_linestring_multi_linestring_point < - Linestring, MultiLinestring, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -263,25 +248,21 @@ struct intersection_insert template < typename MultiLinestring, typename Box, - bool Reverse1, bool Reverse2, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool Reverse1, bool Reverse2, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, box_tag, linestring_tag, - false, true, false, MultiLinestring, Box, - Reverse1, Reverse2, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + Reverse1, Reverse2, ReverseOut, + multi_linestring_tag, box_tag, linestring_tag, + false, true, false > : detail::intersection::clip_multi_linestring < - MultiLinestring, Box, - OutputIterator, GeometryOut, - Strategy + GeometryOut > {}; @@ -289,27 +270,23 @@ struct intersection_insert template < typename Linestring, typename MultiPolygon, - bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut > struct intersection_insert < - linestring_tag, multi_polygon_tag, linestring_tag, - false, true, false, Linestring, MultiPolygon, - ReverseLinestring, ReverseMultiPolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseLinestring, ReverseMultiPolygon, ReverseOut, + linestring_tag, multi_polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_linestring_with_areal < - Linestring, MultiPolygon, ReverseMultiPolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -319,27 +296,23 @@ struct intersection_insert template < typename Polygon, typename MultiLinestring, - bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut > struct intersection_insert < - polygon_tag, multi_linestring_tag, linestring_tag, - true, false, false, Polygon, MultiLinestring, - ReversePolygon, ReverseMultiLinestring, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReversePolygon, ReverseMultiLinestring, ReverseOut, + polygon_tag, multi_linestring_tag, linestring_tag, + true, false, false > : detail::intersection::intersection_of_areal_with_multi_linestring < - Polygon, MultiLinestring, ReversePolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -347,54 +320,46 @@ struct intersection_insert template < typename MultiLinestring, typename Ring, - bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, ring_tag, linestring_tag, - false, true, false, MultiLinestring, Ring, - ReverseMultiLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseRing, ReverseOut, + multi_linestring_tag, ring_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, Ring, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; template < typename MultiLinestring, typename Polygon, - bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, polygon_tag, linestring_tag, - false, true, false, MultiLinestring, Polygon, - ReverseMultiLinestring, ReverseRing, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseRing, ReverseOut, + multi_linestring_tag, polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, Polygon, ReverseRing, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; @@ -403,27 +368,23 @@ struct intersection_insert template < typename MultiLinestring, typename MultiPolygon, - bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut, - typename OutputIterator, typename GeometryOut, + typename GeometryOut, overlay_type OverlayType, - typename Strategy + bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut > struct intersection_insert < - multi_linestring_tag, multi_polygon_tag, linestring_tag, - false, true, false, MultiLinestring, MultiPolygon, - ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut, - OutputIterator, GeometryOut, + GeometryOut, OverlayType, - Strategy + ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut, + multi_linestring_tag, multi_polygon_tag, linestring_tag, + false, true, false > : detail::intersection::intersection_of_multi_linestring_with_areal < - MultiLinestring, MultiPolygon, ReverseMultiPolygon, - OutputIterator, GeometryOut, - OverlayType, - Strategy + GeometryOut, + OverlayType > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp index 51ff9ef3c..ef5fb3c97 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/length.hpp @@ -30,21 +30,25 @@ namespace boost { namespace geometry namespace dispatch { -template -struct length - : detail::multi_sum - < - typename default_length_result::type, - MultiLinestring, - Strategy, - detail::length::range_length - < - typename boost::range_value::type, - Strategy, - closed // no need to close it explicitly - > - > -{}; +template +struct length : detail::multi_sum +{ + template + static inline typename default_length_result::type + apply(MultiLinestring const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename default_length_result::type, + detail::length::range_length + < + typename boost::range_value::type, + closed // no need to close it explicitly + > + >(multi, strategy); + + } +}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp index 213339a18..cc59655be 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_geometries.hpp @@ -32,7 +32,7 @@ namespace dispatch { template -struct num_geometries +struct num_geometries { static inline std::size_t apply(MultiGeometry const& multi_geometry) { diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp index 87b0bdea9..8390fe77a 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_interior_rings.hpp @@ -34,7 +34,7 @@ namespace dispatch template -struct num_interior_rings +struct num_interior_rings { static inline std::size_t apply(MultiPolygon const& multi_polygon) { diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp index 5ea53854e..1cc82b2f0 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/num_points.hpp @@ -30,9 +30,9 @@ namespace detail { namespace num_points { -template struct multi_count { + template static inline size_t apply(MultiGeometry const& geometry, bool add_for_open) { typedef typename boost::range_value::type geometry_type; @@ -46,11 +46,7 @@ struct multi_count it != boost::end(geometry); ++it) { - n += dispatch::num_points - < - typename tag::type, - geometry_type - >::apply(*it, add_for_open); + n += dispatch::num_points::apply(*it, add_for_open); } return n; } @@ -67,8 +63,8 @@ namespace dispatch template -struct num_points - : detail::num_points::multi_count {}; +struct num_points + : detail::num_points::multi_count {}; } // namespace dispatch diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp index 147f6fcc3..6a13f90e3 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/perimeter.hpp @@ -30,21 +30,20 @@ namespace boost { namespace geometry #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { -template -struct perimeter - : detail::multi_sum - < - typename default_length_result::type, - MultiPolygon, - Strategy, - perimeter - < - polygon_tag, - typename boost::range_value::type, - Strategy - > - > -{}; +template +struct perimeter : detail::multi_sum +{ + template + static inline typename default_length_result::type + apply(MultiPolygon const& multi, Strategy const& strategy) + { + return multi_sum::apply + < + typename default_length_result::type, + perimeter::type> + >(multi, strategy); + } +}; } // namespace dispatch #endif diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp index f8a9442ac..910f1e3d1 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/reverse.hpp @@ -34,27 +34,21 @@ namespace dispatch template -struct reverse +struct reverse : detail::multi_modify < Geometry, detail::reverse::range_reverse - < - typename boost::range_value::type - > > {}; template -struct reverse +struct reverse : detail::multi_modify < Geometry, detail::reverse::polygon_reverse - < - typename boost::range_value::type - > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp index dc3c7b593..1706c69f4 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/simplify.hpp @@ -31,9 +31,10 @@ namespace boost { namespace geometry namespace detail { namespace simplify { -template +template struct simplify_multi { + template static inline void apply(MultiGeometry const& multi, MultiGeometry& out, double max_distance, Strategy const& strategy) { @@ -63,47 +64,21 @@ struct simplify_multi namespace dispatch { -template -struct simplify +template +struct simplify : detail::simplify::simplify_copy - < - MultiPoint, - Strategy - > - {}; -template -struct simplify - : detail::simplify::simplify_multi - < - MultiLinestring, - Strategy, - detail::simplify::simplify_range - < - typename boost::range_value::type, - Strategy, - 2 - > - > - +template +struct simplify + : detail::simplify::simplify_multi > {}; -template -struct simplify - : detail::simplify::simplify_multi - < - MultiPolygon, - Strategy, - detail::simplify::simplify_polygon - < - typename boost::range_value::type, - Strategy - > - > - +template +struct simplify + : detail::simplify::simplify_multi {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp index 09926778f..110e96958 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/transform.hpp @@ -31,10 +31,10 @@ namespace detail { namespace transform /*! \brief Is able to transform any multi-geometry, calling the single-version as policy */ -template +template struct transform_multi { - template + template static inline bool apply(Multi1 const& multi1, Multi2& multi2, S const& strategy) { traits::resize::apply(multi2, boost::size(multi1)); @@ -65,30 +65,18 @@ struct transform_multi namespace dispatch { -template +template struct transform < - multi_tag, multi_tag, Multi1, Multi2, - Strategy + multi_tag, multi_tag > : detail::transform::transform_multi < - Multi1, - Multi2, transform < - typename single_tag_of - < - typename tag::type - >::type, - typename single_tag_of - < - typename tag::type - >::type, typename boost::range_value::type, - typename boost::range_value::type, - Strategy + typename boost::range_value::type > > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp b/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp index 5067e71f3..bda2234a6 100644 --- a/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp +++ b/project/jni/boost/include/boost/geometry/multi/algorithms/unique.hpp @@ -30,9 +30,10 @@ namespace detail { namespace unique { -template +template struct multi_unique { + template static inline void apply(MultiGeometry& multi, ComparePolicy const& compare) { for (typename boost::range_iterator::type @@ -62,33 +63,15 @@ namespace dispatch // possible for multi-points as well, removing points at the same location. -template -struct unique - : detail::unique::multi_unique - < - MultiLineString, - ComparePolicy, - detail::unique::range_unique - < - typename boost::range_value::type, - ComparePolicy - > - > +template +struct unique + : detail::unique::multi_unique {}; -template -struct unique - : detail::unique::multi_unique - < - MultiPolygon, - ComparePolicy, - detail::unique::polygon_unique - < - typename boost::range_value::type, - ComparePolicy - > - > +template +struct unique + : detail::unique::multi_unique {}; diff --git a/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp b/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp index 3c75fd804..218ddf999 100644 --- a/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp +++ b/project/jni/boost/include/boost/geometry/multi/io/wkt/read.hpp @@ -58,6 +58,69 @@ struct multi_parser handle_close_parenthesis(it, tokens.end(), wkt); } + + check_end(it, tokens.end(), wkt); + } +}; + +template +struct noparenthesis_point_parser +{ + static inline void apply(tokenizer::iterator& it, tokenizer::iterator end, + std::string const& wkt, P& point) + { + parsing_assigner::value>::apply(it, end, point, wkt); + } +}; + +template +struct multi_point_parser +{ + static inline void apply(std::string const& wkt, MultiGeometry& geometry) + { + traits::clear::apply(geometry); + + tokenizer tokens(wkt, boost::char_separator(" ", ",()")); + tokenizer::iterator it; + + if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) + { + handle_open_parenthesis(it, tokens.end(), wkt); + + // If first point definition starts with "(" then parse points as (x y) + // otherwise as "x y" + bool using_brackets = (it != tokens.end() && *it == "("); + + while(it != tokens.end() && *it != ")") + { + traits::resize::apply(geometry, boost::size(geometry) + 1); + + if (using_brackets) + { + point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, geometry.back()); + } + else + { + noparenthesis_point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, geometry.back()); + } + + if (it != tokens.end() && *it == ",") + { + // Skip "," after point is parsed + ++it; + } + } + + handle_close_parenthesis(it, tokens.end(), wkt); + } + + check_end(it, tokens.end(), wkt); } }; @@ -69,10 +132,9 @@ namespace dispatch template struct read_wkt - : detail::wkt::multi_parser + : detail::wkt::multi_point_parser < MultiGeometry, - detail::wkt::point_parser, detail::wkt::prefix_multipoint > {}; diff --git a/project/jni/boost/include/boost/geometry/multi/multi.hpp b/project/jni/boost/include/boost/geometry/multi/multi.hpp index db33a9dd0..df10392cb 100644 --- a/project/jni/boost/include/boost/geometry/multi/multi.hpp +++ b/project/jni/boost/include/boost/geometry/multi/multi.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp b/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp index 9090d8b51..cfbaf7dd1 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/direction.hpp @@ -126,7 +126,9 @@ struct segments_direction typedef typename select_most_precise::type rtype; + template static inline return_type segments_intersect(side_info const& sides, + R const&, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, S1 const& s1, S2 const& s2) diff --git a/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp b/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp index afd1dde50..d7d519905 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/intersection_points.hpp @@ -36,56 +36,33 @@ struct segments_intersection_points typedef ReturnType return_type; typedef S1 segment_type1; typedef S2 segment_type2; + typedef typename select_calculation_type < S1, S2, CalculationType >::type coordinate_type; + template static inline return_type segments_intersect(side_info const&, + R const& r, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, S1 const& s1, S2 const& s2) { - return_type result; typedef typename geometry::coordinate_type < typename return_type::point_type - >::type coordinate_type; + >::type return_coordinate_type; - // Get the same type, but at least a double (also used for divisions) - typedef typename select_most_precise - < - coordinate_type, double - >::type promoted_type; - - promoted_type const s1x = get<0, 0>(s1); - promoted_type const s1y = get<0, 1>(s1); - - // Calculate other determinants - Cramers rule - promoted_type const wx = get<0, 0>(s1) - get<0, 0>(s2); - promoted_type const wy = get<0, 1>(s1) - get<0, 1>(s2); - promoted_type const d = detail::determinant(dx1, dy1, dx2, dy2); - promoted_type const da = detail::determinant(dx2, dy2, wx, wy); - - // r: ratio 0-1 where intersection divides A/B - promoted_type r = da / d; - promoted_type const zero = promoted_type(); - promoted_type const one = 1; - // Handle robustness issues - if (r < zero) - { - r = zero; - } - else if (r > one) - { - r = one; - } + coordinate_type const s1x = get<0, 0>(s1); + coordinate_type const s1y = get<0, 1>(s1); + return_type result; result.count = 1; set<0>(result.intersections[0], - boost::numeric_cast(s1x + r * promoted_type(dx1))); + boost::numeric_cast(R(s1x) + r * R(dx1))); set<1>(result.intersections[0], - boost::numeric_cast(s1y + r * promoted_type(dy1))); + boost::numeric_cast(R(s1y) + r * R(dy1))); return result; } diff --git a/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp b/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp index 853a8a26a..f6713c44c 100644 --- a/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp +++ b/project/jni/boost/include/boost/geometry/policies/relate/tupled.hpp @@ -49,16 +49,18 @@ struct segments_tupled // Get the same type, but at least a double typedef typename select_most_precise::type rtype; + template static inline return_type segments_intersect(side_info const& sides, + R const& r, coordinate_type const& dx1, coordinate_type const& dy1, coordinate_type const& dx2, coordinate_type const& dy2, segment_type1 const& s1, segment_type2 const& s2) { return boost::make_tuple ( - Policy1::segments_intersect(sides, + Policy1::segments_intersect(sides, r, dx1, dy1, dx2, dy2, s1, s2), - Policy2::segments_intersect(sides, + Policy2::segments_intersect(sides, r, dx1, dy1, dx2, dy2, s1, s2) ); } diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index 2bf7b7767..564010f0a 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -41,21 +41,17 @@ namespace strategy { namespace intersection namespace detail { -template -struct segment_arrange +template +static inline void segment_arrange(Segment const& s, T& s_1, T& s_2, bool& swapped) { - template - static inline void apply(Segment const& s, T& s_1, T& s_2, bool& swapped) + s_1 = get<0, Dimension>(s); + s_2 = get<1, Dimension>(s); + if (s_1 > s_2) { - s_1 = get<0, Dimension>(s); - s_2 = get<1, Dimension>(s); - if (s_1 > s_2) - { - std::swap(s_1, s_2); - swapped = true; - } + std::swap(s_1, s_2); + swapped = true; } -}; +} template inline typename geometry::point_type::type get_from_index( @@ -121,34 +117,36 @@ struct relate_cartesian_segments coordinate_type const& dx_a, coordinate_type const& dy_a, coordinate_type const& dx_b, coordinate_type const& dy_b) { - // 1) Handle "disjoint", common case. - // per dimension, 2 cases: a_1----------a_2 b_1-------b_2 or B left of A - coordinate_type ax_1, ax_2, bx_1, bx_2; - bool ax_swapped = false, bx_swapped = false; - detail::segment_arrange::apply(a, ax_1, ax_2, ax_swapped); - detail::segment_arrange::apply(b, bx_1, bx_2, bx_swapped); - if (ax_2 < bx_1 || ax_1 > bx_2) - { - return Policy::disjoint(); - } - - // 1b) In Y-dimension - coordinate_type ay_1, ay_2, by_1, by_2; - bool ay_swapped = false, by_swapped = false; - detail::segment_arrange::apply(a, ay_1, ay_2, ay_swapped); - detail::segment_arrange::apply(b, by_1, by_2, by_swapped); - if (ay_2 < by_1 || ay_1 > by_2) - { - return Policy::disjoint(); - } - typedef side::side_by_triangle side; side_info sides; - // 2) Calculate sides - // Note: Do NOT yet calculate the determinant here, but use the SIDE strategy. - // Determinant calculation is not robust; side (orient) can be made robust - // (and is much robuster even without measures) + coordinate_type const zero = 0; + bool const a_is_point = math::equals(dx_a, zero) && math::equals(dy_a, zero); + bool const b_is_point = math::equals(dx_b, zero) && math::equals(dy_b, zero); + + if(a_is_point && b_is_point) + { + if(math::equals(get<1,0>(a), get<1,0>(b)) && math::equals(get<1,1>(a), get<1,1>(b))) + { + Policy::degenerate(a, true); + } + else + { + return Policy::disjoint(); + } + } + + bool collinear_use_first = math::abs(dx_a) + math::abs(dx_b) >= math::abs(dy_a) + math::abs(dy_b); + + sides.set<0> + ( + side::apply(detail::get_from_index<0>(b) + , detail::get_from_index<1>(b) + , detail::get_from_index<0>(a)), + side::apply(detail::get_from_index<0>(b) + , detail::get_from_index<1>(b) + , detail::get_from_index<1>(a)) + ); sides.set<1> ( side::apply(detail::get_from_index<0>(a) @@ -159,115 +157,368 @@ struct relate_cartesian_segments , detail::get_from_index<1>(b)) ); - if (sides.same<1>()) + bool collinear = sides.collinear(); + + robustness_verify_collinear(a, b, a_is_point, b_is_point, sides, collinear); + robustness_verify_meeting(a, b, sides, collinear, collinear_use_first); + + if (sides.same<0>() || sides.same<1>()) { // Both points are at same side of other segment, we can leave - return Policy::disjoint(); - } - - // 2b) For other segment - sides.set<0> - ( - side::apply(detail::get_from_index<0>(b) - , detail::get_from_index<1>(b) - , detail::get_from_index<0>(a)), - side::apply(detail::get_from_index<0>(b) - , detail::get_from_index<1>(b) - , detail::get_from_index<1>(a)) - ); - - if (sides.same<0>()) - { - return Policy::disjoint(); + if (robustness_verify_same_side(a, b, sides)) + { + return Policy::disjoint(); + } } // Degenerate cases: segments of single point, lying on other segment, non disjoint - coordinate_type const zero = 0; - if (math::equals(dx_a, zero) && math::equals(dy_a, zero)) + if (a_is_point) { return Policy::degenerate(a, true); } - if (math::equals(dx_b, zero) && math::equals(dy_b, zero)) + if (b_is_point) { return Policy::degenerate(b, false); } - bool collinear = sides.collinear(); - - // Get the same type, but at least a double (also used for divisions) typedef typename select_most_precise < coordinate_type, double >::type promoted_type; - // Calculate the determinant/2D cross product - // (Note, because we only check on zero, - // the order a/b does not care) - promoted_type const d = geometry::detail::determinant - < - promoted_type - >(dx_a, dy_a, dx_b, dy_b); - - // Determinant d should be nonzero. - // If it is zero, we have an robustness issue here, - // (and besides that we cannot divide by it) - promoted_type const pt_zero = promoted_type(); - if(math::equals(d, pt_zero) && ! collinear) + // r: ratio 0-1 where intersection divides A/B + // (only calculated for non-collinear segments) + promoted_type r; + if (! collinear) { -#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION - std::cout << "Determinant zero? Type : " - << typeid(coordinate_type).name() - << std::endl; + // Calculate determinants - Cramers rule + coordinate_type const wx = get<0, 0>(a) - get<0, 0>(b); + coordinate_type const wy = get<0, 1>(a) - get<0, 1>(b); + coordinate_type const d = geometry::detail::determinant(dx_a, dy_a, dx_b, dy_b); + coordinate_type const da = geometry::detail::determinant(dx_b, dy_b, wx, wy); - std::cout << " dx_a : " << dx_a << std::endl; - std::cout << " dy_a : " << dy_a << std::endl; - std::cout << " dx_b : " << dx_b << std::endl; - std::cout << " dy_b : " << dy_b << std::endl; - - std::cout << " side a <-> b.first : " << sides.get<0,0>() << std::endl; - std::cout << " side a <-> b.second: " << sides.get<0,1>() << std::endl; - std::cout << " side b <-> a.first : " << sides.get<1,0>() << std::endl; - std::cout << " side b <-> a.second: " << sides.get<1,1>() << std::endl; -#endif - - if (sides.as_collinear()) + coordinate_type const zero = coordinate_type(); + if (math::equals(d, zero)) { + // This is still a collinear case (because of FP imprecision this can occur here) + // sides.debug(); sides.set<0>(0,0); sides.set<1>(0,0); collinear = true; } else { - return Policy::error("Determinant zero!"); + r = promoted_type(da) / promoted_type(d); + + if (! robustness_verify_r(a, b, r)) + { + return Policy::disjoint(); + } + + robustness_handle_meeting(a, b, sides, dx_a, dy_a, wx, wy, d, r); + + if (robustness_verify_disjoint_at_one_collinear(a, b, sides)) + { + return Policy::disjoint(); + } + } } if(collinear) { - // Segments are collinear. We'll find out how. - if (math::equals(dx_b, zero)) + if (collinear_use_first) { - // Vertical -> Check y-direction - return relate_collinear(a, b, - ay_1, ay_2, by_1, by_2, - ay_swapped, by_swapped); + return relate_collinear<0>(a, b); } else { - // Check x-direction - return relate_collinear(a, b, - ax_1, ax_2, bx_1, bx_2, - ax_swapped, bx_swapped); + // Y direction contains larger segments (maybe dx is zero) + return relate_collinear<1>(a, b); } } - return Policy::segments_intersect(sides, + return Policy::segments_intersect(sides, r, dx_a, dy_a, dx_b, dy_b, a, b); } private : + + // Ratio should lie between 0 and 1 + // Also these three conditions might be of FP imprecision, the segments were actually (nearly) collinear + template + static inline bool robustness_verify_r( + segment_type1 const& a, segment_type2 const& b, + T& r) + { + T const zero = 0; + T const one = 1; + if (r < zero || r > one) + { + if (verify_disjoint<0>(a, b) || verify_disjoint<1>(a, b)) + { + // Can still be disjoint (even if not one is left or right from another) + // This is e.g. in case #snake4 of buffer test. + return false; + } + + //std::cout << "ROBUSTNESS: correction of r " << r << std::endl; + // sides.debug(); + + // ROBUSTNESS: the r value can in epsilon-cases much larger than 1, while (with perfect arithmetic) + // it should be one. It can be 1.14 or even 1.98049 or 2 (while still intersecting) + + // If segments are crossing (we can see that with the sides) + // and one is inside the other, there must be an intersection point. + // We correct for that. + // This is (only) in case #ggl_list_20110820_christophe in unit tests + + // If segments are touching (two sides zero), of course they should intersect + // This is (only) in case #buffer_rt_i in the unit tests) + + // If one touches in the middle, they also should intersect (#buffer_rt_j) + + // Note that even for ttmath r is occasionally > 1, e.g. 1.0000000000000000000000036191231203575 + + if (r > one) + { + r = one; + } + else if (r < zero) + { + r = zero; + } + } + return true; + } + + static inline void robustness_verify_collinear( + segment_type1 const& a, segment_type2 const& b, + bool a_is_point, bool b_is_point, + side_info& sides, + bool& collinear) + { + if ((sides.zero<0>() && ! b_is_point && ! sides.zero<1>()) || (sides.zero<1>() && ! a_is_point && ! sides.zero<0>())) + { + // If one of the segments is collinear, the other must be as well. + // So handle it as collinear. + // (In float/double epsilon margins it can easily occur that one or two of them are -1/1) + // sides.debug(); + sides.set<0>(0,0); + sides.set<1>(0,0); + collinear = true; + } + } + + static inline void robustness_verify_meeting( + segment_type1 const& a, segment_type2 const& b, + side_info& sides, + bool& collinear, bool& collinear_use_first) + { + if (sides.meeting()) + { + // If two segments meet each other at their segment-points, two sides are zero, + // the other two are not (unless collinear but we don't mean those here). + // However, in near-epsilon ranges it can happen that two sides are zero + // but they do not meet at their segment-points. + // In that case they are nearly collinear and handled as such. + if (! point_equals + ( + select(sides.zero_index<0>(), a), + select(sides.zero_index<1>(), b) + ) + ) + { + sides.set<0>(0,0); + sides.set<1>(0,0); + collinear = true; + + if (collinear_use_first && analyse_equal<0>(a, b)) + { + collinear_use_first = false; + } + else if (! collinear_use_first && analyse_equal<1>(a, b)) + { + collinear_use_first = true; + } + + } + } + } + + // Verifies and if necessary correct missed touch because of robustness + // This is the case at multi_polygon_buffer unittest #rt_m + static inline bool robustness_verify_same_side( + segment_type1 const& a, segment_type2 const& b, + side_info& sides) + { + int corrected = 0; + if (sides.one_touching<0>()) + { + if (point_equals( + select(sides.zero_index<0>(), a), + select(0, b) + )) + { + sides.correct_to_zero<1, 0>(); + corrected = 1; + } + if (point_equals + ( + select(sides.zero_index<0>(), a), + select(1, b) + )) + { + sides.correct_to_zero<1, 1>(); + corrected = 2; + } + } + else if (sides.one_touching<1>()) + { + if (point_equals( + select(sides.zero_index<1>(), b), + select(0, a) + )) + { + sides.correct_to_zero<0, 0>(); + corrected = 3; + } + if (point_equals + ( + select(sides.zero_index<1>(), b), + select(1, a) + )) + { + sides.correct_to_zero<0, 1>(); + corrected = 4; + } + } + + return corrected == 0; + } + + static inline bool robustness_verify_disjoint_at_one_collinear( + segment_type1 const& a, segment_type2 const& b, + side_info const& sides) + { + if (sides.one_of_all_zero()) + { + if (verify_disjoint<0>(a, b) || verify_disjoint<1>(a, b)) + { + return true; + } + } + return false; + } + + + // If r is one, or zero, segments should meet and their endpoints. + // Robustness issue: check if this is really the case. + // It turns out to be no problem, see buffer test #rt_s1 (and there are many cases generated) + // It generates an "ends in the middle" situation which is correct. + template + static inline void robustness_handle_meeting(segment_type1 const& a, segment_type2 const& b, + side_info& sides, + T const& dx_a, T const& dy_a, T const& wx, T const& wy, + T const& d, R const& r) + { + return; + + T const db = geometry::detail::determinant(dx_a, dy_a, wx, wy); + + R const zero = 0; + R const one = 1; + if (math::equals(r, zero) || math::equals(r, one)) + { + R rb = db / d; + if (rb <= 0 || rb >= 1 || math::equals(rb, 0) || math::equals(rb, 1)) + { + if (sides.one_zero<0>() && ! sides.one_zero<1>()) // or vice versa + { +#if defined(BOOST_GEOMETRY_COUNT_INTERSECTION_EQUAL) + extern int g_count_intersection_equal; + g_count_intersection_equal++; +#endif + sides.debug(); + std::cout << "E r=" << r << " r.b=" << rb << " "; + } + } + } + } + + template + static inline bool verify_disjoint(segment_type1 const& a, + segment_type2 const& b) + { + coordinate_type a_1, a_2, b_1, b_2; + bool a_swapped = false, b_swapped = false; + detail::segment_arrange(a, a_1, a_2, a_swapped); + detail::segment_arrange(b, b_1, b_2, b_swapped); + return math::smaller(a_2, b_1) || math::larger(a_1, b_2); + } + + template + static inline typename point_type::type select(int index, Segment const& segment) + { + return index == 0 + ? detail::get_from_index<0>(segment) + : detail::get_from_index<1>(segment) + ; + } + + // We cannot use geometry::equals here. Besides that this will be changed + // to compare segment-coordinate-values directly (not necessary to retrieve point first) + template + static inline bool point_equals(Point1 const& point1, Point2 const& point2) + { + return math::equals(get<0>(point1), get<0>(point2)) + && math::equals(get<1>(point1), get<1>(point2)) + ; + } + + // We cannot use geometry::equals here. Besides that this will be changed + // to compare segment-coordinate-values directly (not necessary to retrieve point first) + template + static inline bool point_equality(Point1 const& point1, Point2 const& point2, + bool& equals_0, bool& equals_1) + { + equals_0 = math::equals(get<0>(point1), get<0>(point2)); + equals_1 = math::equals(get<1>(point1), get<1>(point2)); + return equals_0 && equals_1; + } + + template + static inline bool analyse_equal(segment_type1 const& a, segment_type2 const& b) + { + coordinate_type const a_1 = geometry::get<0, Dimension>(a); + coordinate_type const a_2 = geometry::get<1, Dimension>(a); + coordinate_type const b_1 = geometry::get<0, Dimension>(b); + coordinate_type const b_2 = geometry::get<1, Dimension>(b); + return math::equals(a_1, b_1) + || math::equals(a_2, b_1) + || math::equals(a_1, b_2) + || math::equals(a_2, b_2) + ; + } + + template + static inline return_type relate_collinear(segment_type1 const& a, + segment_type2 const& b) + { + coordinate_type a_1, a_2, b_1, b_2; + bool a_swapped = false, b_swapped = false; + detail::segment_arrange(a, a_1, a_2, a_swapped); + detail::segment_arrange(b, b_1, b_2, b_swapped); + if (math::smaller(a_2, b_1) || math::larger(a_1, b_2)) + //if (a_2 < b_1 || a_1 > b_2) + { + return Policy::disjoint(); + } + return relate_collinear(a, b, a_1, a_2, b_1, b_2, a_swapped, b_swapped); + } + /// Relate segments known collinear static inline return_type relate_collinear(segment_type1 const& a , segment_type2 const& b @@ -296,25 +547,28 @@ private : // Handle "equal", in polygon neighbourhood comparisons a common case - // Check if segments are equal... - bool const a1_eq_b1 = math::equals(get<0, 0>(a), get<0, 0>(b)) - && math::equals(get<0, 1>(a), get<0, 1>(b)); - bool const a2_eq_b2 = math::equals(get<1, 0>(a), get<1, 0>(b)) - && math::equals(get<1, 1>(a), get<1, 1>(b)); - if (a1_eq_b1 && a2_eq_b2) + bool const opposite = a_swapped ^ b_swapped; + bool const both_swapped = a_swapped && b_swapped; + + // Check if segments are equal or opposite equal... + bool const swapped_a1_eq_b1 = math::equals(a_1, b_1); + bool const swapped_a2_eq_b2 = math::equals(a_2, b_2); + + if (swapped_a1_eq_b1 && swapped_a2_eq_b2) { - return Policy::segment_equal(a, false); + return Policy::segment_equal(a, opposite); } - // ... or opposite equal - bool const a1_eq_b2 = math::equals(get<0, 0>(a), get<1, 0>(b)) - && math::equals(get<0, 1>(a), get<1, 1>(b)); - bool const a2_eq_b1 = math::equals(get<1, 0>(a), get<0, 0>(b)) - && math::equals(get<1, 1>(a), get<0, 1>(b)); - if (a1_eq_b2 && a2_eq_b1) - { - return Policy::segment_equal(a, true); - } + bool const swapped_a2_eq_b1 = math::equals(a_2, b_1); + bool const swapped_a1_eq_b2 = math::equals(a_1, b_2); + + bool const a1_eq_b1 = both_swapped ? swapped_a2_eq_b2 : a_swapped ? swapped_a2_eq_b1 : b_swapped ? swapped_a1_eq_b2 : swapped_a1_eq_b1; + bool const a2_eq_b2 = both_swapped ? swapped_a1_eq_b1 : a_swapped ? swapped_a1_eq_b2 : b_swapped ? swapped_a2_eq_b1 : swapped_a2_eq_b2; + + bool const a1_eq_b2 = both_swapped ? swapped_a2_eq_b1 : a_swapped ? swapped_a2_eq_b2 : b_swapped ? swapped_a1_eq_b1 : swapped_a1_eq_b2; + bool const a2_eq_b1 = both_swapped ? swapped_a1_eq_b2 : a_swapped ? swapped_a1_eq_b1 : b_swapped ? swapped_a2_eq_b2 : swapped_a2_eq_b1; + + // The rest below will return one or two intersections. @@ -322,7 +576,7 @@ private : // For IM it is important to know which relates to which. So this information is given, // without performance penalties to intersection calculation - bool const has_common_points = a1_eq_b1 || a1_eq_b2 || a2_eq_b1 || a2_eq_b2; + bool const has_common_points = swapped_a1_eq_b1 || swapped_a1_eq_b2 || swapped_a2_eq_b1 || swapped_a2_eq_b2; // "Touch" -> one intersection point -> one but not two common points @@ -342,7 +596,7 @@ private : // #4: a2<----a1 b1--->b2 (no arrival at all) // Where the arranged forms have two forms: // a_1-----a_2/b_1-------b_2 or reverse (B left of A) - if (has_common_points && (math::equals(a_2, b_1) || math::equals(b_2, a_1))) + if ((swapped_a2_eq_b1 || swapped_a1_eq_b2) && ! swapped_a1_eq_b1 && ! swapped_a2_eq_b2) { if (a2_eq_b1) return Policy::collinear_touch(get<1, 0>(a), get<1, 1>(a), 0, -1); if (a1_eq_b2) return Policy::collinear_touch(get<0, 0>(a), get<0, 1>(a), -1, 0); @@ -402,7 +656,6 @@ private : if (a1_eq_b1) return Policy::collinear_interior_boundary_intersect(a_in_b ? a : b, a_in_b, arrival_a, -arrival_a, false); } - bool const opposite = a_swapped ^ b_swapped; // "Inside", a completely within b or b completely within a @@ -464,7 +717,6 @@ private : the picture might seem wrong but it (supposed to be) is right. */ - bool const both_swapped = a_swapped && b_swapped; if (b_1 < a_2 && a_2 < b_2) { // Left column, from bottom to top @@ -486,7 +738,7 @@ private : ; } // Nothing should goes through. If any we have made an error - // Robustness: it can occur here... + // std::cout << "Robustness issue, non-logical behaviour" << std::endl; return Policy::error("Robustness issue, non-logical behaviour"); } }; diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp index e704a3310..13d416844 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp @@ -75,23 +75,27 @@ template class projected_point { public : - typedef typename strategy::distance::services::return_type::type calculation_type; - -private : - // The three typedefs below are necessary to calculate distances // from segments defined in integer coordinates. // Integer coordinates can still result in FP distances. // There is a division, which must be represented in FP. // So promote. - typedef typename promote_floating_point::type fp_type; + typedef typename promote_floating_point + < + typename strategy::distance::services::return_type + < + Strategy + >::type + >::type calculation_type; + +private : // A projected point of points in Integer coordinates must be able to be // represented in FP. typedef model::point < - fp_type, + calculation_type, dimension::value, typename coordinate_system::type > fp_point_type; @@ -139,19 +143,19 @@ public : boost::ignore_unused_variable_warning(strategy); calculation_type const zero = calculation_type(); - fp_type const c1 = dot_product(w, v); + calculation_type const c1 = dot_product(w, v); if (c1 <= zero) { return strategy.apply(p, p1); } - fp_type const c2 = dot_product(v, v); + calculation_type const c2 = dot_product(v, v); if (c2 <= c1) { return strategy.apply(p, p2); } // See above, c1 > 0 AND c2 > c1 so: c2 != 0 - fp_type const b = c1 / c2; + calculation_type const b = c1 / c2; fp_strategy_type fp_strategy = strategy::distance::services::get_similar diff --git a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index 51d272266..c62cf749e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -42,8 +42,8 @@ struct compute_pythagoras { static inline T apply(Point1 const& p1, Point2 const& p2) { - T const c1 = boost::numeric_cast(get(p2)); - T const c2 = boost::numeric_cast(get(p1)); + T const c1 = boost::numeric_cast(get(p1)); + T const c2 = boost::numeric_cast(get(p2)); T const d = c1 - c2; return d * d + compute_pythagoras::apply(p1, p2); } diff --git a/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp b/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp index a878b26c8..a5aae7703 100644 --- a/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/covered_by.hpp @@ -53,7 +53,7 @@ struct default_strategy { BOOST_MPL_ASSERT_MSG ( - false, NOT_IMPLEMENTED_FOR_THIS_TYPES + false, NOT_IMPLEMENTED_FOR_THESE_TYPES , (types) ); }; diff --git a/project/jni/boost/include/boost/geometry/strategies/side_info.hpp b/project/jni/boost/include/boost/geometry/strategies/side_info.hpp index 3fc43b8d9..f3a9da0df 100644 --- a/project/jni/boost/include/boost/geometry/strategies/side_info.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/side_info.hpp @@ -44,6 +44,19 @@ public : sides[Which].second = second; } + template + inline void correct_to_zero() + { + if (Index == 0) + { + sides[Which].first = 0; + } + else + { + sides[Which].second = 0; + } + } + template inline int get() const { @@ -67,21 +80,81 @@ public : && sides[1].second == 0; } - // If one of the segments is collinear, the other must be as well. - // So handle it as collinear. - // (In floating point margins it can occur that one of them is 1!) - inline bool as_collinear() const + inline bool crossing() const { - return sides[0].first * sides[0].second == 0 - || sides[1].first * sides[1].second == 0; + return sides[0].first * sides[0].second == -1 + && sides[1].first * sides[1].second == -1; } + inline bool touching() const + { + return (sides[0].first * sides[1].first == -1 + && sides[0].second == 0 && sides[1].second == 0) + || (sides[1].first * sides[0].first == -1 + && sides[1].second == 0 && sides[0].second == 0); + } + + template + inline bool one_touching() const + { + // This is normally a situation which can't occur: + // If one is completely left or right, the other cannot touch + return one_zero() + && sides[1 - Which].first * sides[1 - Which].second == 1; + } + + inline bool meeting() const + { + // Two of them (in each segment) zero, two not + return one_zero<0>() && one_zero<1>(); + } + + template + inline bool zero() const + { + return sides[Which].first == 0 && sides[Which].second == 0; + } + + template + inline bool one_zero() const + { + return (sides[Which].first == 0 && sides[Which].second != 0) + || (sides[Which].first != 0 && sides[Which].second == 0); + } + + inline bool one_of_all_zero() const + { + int const sum = std::abs(sides[0].first) + + std::abs(sides[0].second) + + std::abs(sides[1].first) + + std::abs(sides[1].second); + return sum == 3; + } + + + template + inline int zero_index() const + { + return sides[Which].first == 0 ? 0 : 1; + } + + + inline void debug() const + { + std::cout << sides[0].first << " " + << sides[0].second << " " + << sides[1].first << " " + << sides[1].second + << std::endl; + } + + inline void reverse() { std::swap(sides[0], sides[1]); } -private : +//private : std::pair sides[2]; }; diff --git a/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp b/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp index ba589223e..7b353020e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/spherical/distance_cross_track.hpp @@ -101,23 +101,56 @@ public : { // http://williams.best.vwh.net/avform.htm#XTE return_type d1 = m_strategy.apply(sp1, p); + return_type d3 = m_strategy.apply(sp1, sp2); + + if (geometry::math::equals(d3, 0.0)) + { + // "Degenerate" segment, return either d1 or d2 + return d1; + } - // Actually, calculation of d2 not necessary if we know that the projected point is on the great circle... return_type d2 = m_strategy.apply(sp2, p); return_type crs_AD = course(sp1, p); return_type crs_AB = course(sp1, sp2); - return_type XTD = m_radius * geometry::math::abs(asin(sin(d1 / m_radius) * sin(crs_AD - crs_AB))); + return_type crs_BA = crs_AB - geometry::math::pi(); + return_type crs_BD = course(sp2, p); + return_type d_crs1 = crs_AD - crs_AB; + return_type d_crs2 = crs_BD - crs_BA; + + // d1, d2, d3 are in principle not needed, only the sign matters + return_type projection1 = cos( d_crs1 ) * d1 / d3; + return_type projection2 = cos( d_crs2 ) * d2 / d3; #ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK -std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl; -std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl; -std::cout << "XTD: " << XTD << " d1: " << d1 << " d2: " << d2 << std::endl; + std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl; + std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl; + std::cout << "Course " << dsv(sp2) << " to " << dsv(p) << " " << crs_BD * geometry::math::r2d << std::endl; + std::cout << "Projection AD-AB " << projection1 << " : " << d_crs1 * geometry::math::r2d << std::endl; + std::cout << "Projection BD-BA " << projection2 << " : " << d_crs2 * geometry::math::r2d << std::endl; #endif + if(projection1 > 0.0 && projection2 > 0.0) + { + return_type XTD = m_radius * geometry::math::abs( asin( sin( d1 / m_radius ) * sin( d_crs1 ) )); - // Return shortest distance, either to projected point on segment sp1-sp2, or to sp1, or to sp2 - return return_type((std::min)((std::min)(d1, d2), XTD)); + #ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK + std::cout << "Projection ON the segment" << std::endl; + std::cout << "XTD: " << XTD << " d1: " << d1 << " d2: " << d2 << std::endl; +#endif + + // Return shortest distance, projected point on segment sp1-sp2 + return return_type(XTD); + } + else + { +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK + std::cout << "Projection OUTSIDE the segment" << std::endl; +#endif + + // Return shortest distance, project either on point sp1 or sp2 + return return_type( (std::min)( d1 , d2 ) ); + } } inline return_type radius() const { return m_radius; } diff --git a/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp b/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp index 7a1f06016..61a408c61 100644 --- a/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/strategy_transform.hpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include #include #include @@ -251,6 +253,23 @@ namespace detail return false; } + template + inline bool cartesian_to_spherical_equatorial3(T x, T y, T z, P& p) + { + assert_dimension(); + + // http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_Cartesian_coordinates + T const r = sqrt(x * x + y * y + z * z); + set<2>(p, r); + set_from_radian<0>(p, atan2(y, x)); + if (r > 0.0) + { + set_from_radian<1>(p, asin(z / r)); + return true; + } + return false; + } + } // namespace detail #endif // DOXYGEN_NO_DETAIL @@ -361,6 +380,16 @@ struct from_cartesian_3_to_spherical_polar_3 } }; +template +struct from_cartesian_3_to_spherical_equatorial_3 +{ + inline bool apply(P1 const& p1, P2& p2) const + { + assert_dimension(); + return detail::cartesian_to_spherical_equatorial3(get<0>(p1), get<1>(p1), get<2>(p1), p2); + } +}; + #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS namespace services @@ -454,6 +483,11 @@ struct default_strategy type; }; +template +struct default_strategy +{ + typedef from_cartesian_3_to_spherical_equatorial_3 type; +}; } // namespace services diff --git a/project/jni/boost/include/boost/geometry/strategies/within.hpp b/project/jni/boost/include/boost/geometry/strategies/within.hpp index 0852a22d2..d625bc40e 100644 --- a/project/jni/boost/include/boost/geometry/strategies/within.hpp +++ b/project/jni/boost/include/boost/geometry/strategies/within.hpp @@ -52,7 +52,7 @@ struct default_strategy { BOOST_MPL_ASSERT_MSG ( - false, NOT_IMPLEMENTED_FOR_THIS_TYPES + false, NOT_IMPLEMENTED_FOR_THESE_TYPES , (types) ); }; diff --git a/project/jni/boost/include/boost/geometry/util/bare_type.hpp b/project/jni/boost/include/boost/geometry/util/bare_type.hpp new file mode 100644 index 000000000..1b49de643 --- /dev/null +++ b/project/jni/boost/include/boost/geometry/util/bare_type.hpp @@ -0,0 +1,38 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2012 Bruno Lalande, Paris, France. +// Copyright (c) 2012 Mateusz Loskot, London, UK. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP +#define BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP + +#include + + +namespace boost { namespace geometry +{ + +namespace util +{ + +template +struct bare_type +{ + typedef typename boost::remove_const + < + typename boost::remove_pointer::type + >::type type; +}; + + +} // namespace util + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_UTIL_BARE_TYPE_HPP diff --git a/project/jni/boost/include/boost/geometry/util/math.hpp b/project/jni/boost/include/boost/geometry/util/math.hpp index edfa961b1..95cbdf2ce 100644 --- a/project/jni/boost/include/boost/geometry/util/math.hpp +++ b/project/jni/boost/include/boost/geometry/util/math.hpp @@ -44,11 +44,43 @@ struct equals template struct equals { + static inline Type get_max(Type const& a, Type const& b, Type const& c) + { + return (std::max)((std::max)(a, b), c); + } + static inline bool apply(Type const& a, Type const& b) { + if (a == b) + { + return true; + } + // See http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.17, // FUTURE: replace by some boost tool or boost::test::close_at_tolerance - return std::abs(a - b) <= std::numeric_limits::epsilon() * std::abs(a); + return std::abs(a - b) <= std::numeric_limits::epsilon() * get_max(std::abs(a), std::abs(b), 1.0); + } +}; + +template +struct smaller +{ + static inline bool apply(Type const& a, Type const& b) + { + return a < b; + } +}; + +template +struct smaller +{ + static inline bool apply(Type const& a, Type const& b) + { + if (equals::apply(a, b)) + { + return false; + } + return a < b; } }; @@ -116,6 +148,28 @@ inline bool equals_with_epsilon(T1 const& a, T2 const& b) >::apply(a, b); } +template +inline bool smaller(T1 const& a, T2 const& b) +{ + typedef typename select_most_precise::type select_type; + return detail::smaller + < + select_type, + boost::is_floating_point::type::value + >::apply(a, b); +} + +template +inline bool larger(T1 const& a, T2 const& b) +{ + typedef typename select_most_precise::type select_type; + return detail::smaller + < + select_type, + boost::is_floating_point::type::value + >::apply(b, a); +} + double const d2r = geometry::math::pi() / 180.0; diff --git a/project/jni/boost/include/boost/get_pointer.hpp b/project/jni/boost/include/boost/get_pointer.hpp index a0cd5c0b1..b27b98a60 100644 --- a/project/jni/boost/include/boost/get_pointer.hpp +++ b/project/jni/boost/include/boost/get_pointer.hpp @@ -3,13 +3,15 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef GET_POINTER_DWA20021219_HPP -# define GET_POINTER_DWA20021219_HPP +#define GET_POINTER_DWA20021219_HPP + +#include // In order to avoid circular dependencies with Boost.TR1 // we make sure that our include of doesn't try to // pull in the TR1 headers: that's why we use this header // rather than including directly: -# include // std::auto_ptr +#include // std::auto_ptr namespace boost { @@ -27,6 +29,19 @@ template T * get_pointer(std::auto_ptr const& p) return p.get(); } +#if !defined( BOOST_NO_CXX11_SMART_PTR ) + +template T * get_pointer( std::unique_ptr const& p ) +{ + return p.get(); +} + +template T * get_pointer( std::shared_ptr const& p ) +{ + return p.get(); +} + +#endif } // namespace boost diff --git a/project/jni/boost/include/boost/graph/adj_list_serialize.hpp b/project/jni/boost/include/boost/graph/adj_list_serialize.hpp index c1ff4111d..01db50282 100644 --- a/project/jni/boost/include/boost/graph/adj_list_serialize.hpp +++ b/project/jni/boost/include/boost/graph/adj_list_serialize.hpp @@ -61,6 +61,8 @@ inline void save( ar << serialization::make_nvp("v" , indices[target(e,graph)]); ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } + + ar << serialization::make_nvp("graph_property", get_property(graph, graph_all_t()) ); } @@ -95,6 +97,7 @@ inline void load( boost::tie(e,inserted) = add_edge(verts[u], verts[v], graph); ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } + ar >> serialization::make_nvp("graph_property", get_property(graph, graph_all_t()) ); } template diff --git a/project/jni/boost/include/boost/graph/adjacency_list.hpp b/project/jni/boost/include/boost/graph/adjacency_list.hpp index 5034fec5a..6738fa22c 100644 --- a/project/jni/boost/include/boost/graph/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_list.hpp @@ -51,11 +51,6 @@ namespace boost { // adjacency_list, and the container_gen traits class which is used // to map the selectors to the container type used to implement the // graph. - // - // The main container_gen traits class uses partial specialization, - // so we also include a workaround. - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #if !defined BOOST_NO_SLIST struct slistS {}; @@ -130,93 +125,6 @@ namespace boost { typedef boost::unordered_multiset type; }; -#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#if !defined BOOST_NO_SLIST - struct slistS { - template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::slist type; }; - }; -#endif - - struct vecS { - template - struct bind_ { typedef std::vector type; }; - }; - - struct listS { - template - struct bind_ { typedef std::list type; }; - }; - - struct setS { - template - struct bind_ { typedef std::set > type; }; - }; - - - struct mapS { - template - struct bind_ { typedef std::set > type; }; - }; - - struct multisetS { - template - struct bind_ { typedef std::multiset > type; }; - }; - - struct multimapS { - template - struct bind_ { typedef std::multiset > type; }; - }; - - struct hash_setS { - template - struct bind_ { typedef boost::unordered_set type; }; - }; - - struct hash_mapS { - template - struct bind_ { typedef boost::unordered_set type; }; - }; - - struct hash_multisetS { - template - struct bind_ { typedef boost::unordered_multiset type; }; - }; - - struct hash_multimapS { - template - struct bind_ { typedef boost::unordered_multiset type; }; - }; - - template struct container_selector { - typedef vecS type; - }; - -#define BOOST_CONTAINER_SELECTOR(NAME) \ - template <> struct container_selector { \ - typedef NAME type; \ - } - - BOOST_CONTAINER_SELECTOR(vecS); - BOOST_CONTAINER_SELECTOR(listS); - BOOST_CONTAINER_SELECTOR(mapS); - BOOST_CONTAINER_SELECTOR(setS); - BOOST_CONTAINER_SELECTOR(multisetS); - BOOST_CONTAINER_SELECTOR(hash_mapS); -#if !defined BOOST_NO_SLIST - BOOST_CONTAINER_SELECTOR(slistS); -#endif - - template - struct container_gen { - typedef typename container_selector::type Select; - typedef typename Select:: template bind_::type type; - }; - -#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template struct parallel_edge_traits { }; @@ -280,6 +188,7 @@ namespace boost { } // namespace detail + template struct is_distributed_selector: mpl::false_ {}; //=========================================================================== @@ -354,13 +263,7 @@ namespace boost { adjacency_list, VertexListS, OutEdgeListS, DirectedS, -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typename detail::retag_property_list::type, - typename detail::retag_property_list::type, -#else VertexProperty, EdgeProperty, -#endif GraphProperty, EdgeListS>::type, // Support for named vertices public graph::maybe_named_graph< @@ -371,25 +274,14 @@ namespace boost { VertexProperty> { public: -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; -#else typedef GraphProperty graph_property_type; - typedef no_graph_bundle graph_bundled; + typedef typename lookup_one_property::type graph_bundled; typedef VertexProperty vertex_property_type; - typedef no_vertex_bundle vertex_bundled; + typedef typename lookup_one_property::type vertex_bundled; typedef EdgeProperty edge_property_type; - typedef no_edge_bundle edge_bundled; -#endif + typedef typename lookup_one_property::type edge_bundled; private: typedef adjacency_list self; @@ -502,20 +394,20 @@ namespace boost { #define ADJLIST adjacency_list template - inline void set_property(ADJLIST& g, Tag, Value const& value) { - get_property_value(*g.m_property, Tag()) = value; + inline void set_property(ADJLIST& g, Tag tag, Value const& value) { + get_property_value(*g.m_property, tag) = value; } template inline typename graph_property::type& - get_property(ADJLIST& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST& g, Tag tag) { + return get_property_value(*g.m_property, tag); } template inline typename graph_property::type const& - get_property(ADJLIST const& g, Tag) { - return get_property_value(*g.m_property, Tag()); + get_property(ADJLIST const& g, Tag tag) { + return get_property_value(*g.m_property, tag); } // dwa 09/25/00 - needed to be more explicit so reverse_graph would work. @@ -545,58 +437,6 @@ namespace boost { return e.m_target; } - // Support for bundled properties -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - inline - typename property_map, T Bundle::*>::type - get(T Bundle::* p, adjacency_list& g) - { - typedef typename property_map, T Bundle::*>::type - result_type; - return result_type(&g, p); - } - - template - inline - typename property_map, T Bundle::*>::const_type - get(T Bundle::* p, adjacency_list const & g) - { - typedef typename property_map, T Bundle::*>::const_type - result_type; - return result_type(&g, p); - } - - template - inline T - get(T Bundle::* p, adjacency_list const & g, const Key& key) - { - return get(get(p, g), key); - } - - template - inline void - put(T Bundle::* p, adjacency_list& g, const Key& key, const T& value) - { - put(get(p, g), key, value); - } - -#endif - // Mutability Traits template struct graph_mutability_traits { diff --git a/project/jni/boost/include/boost/graph/adjacency_list_io.hpp b/project/jni/boost/include/boost/graph/adjacency_list_io.hpp index 91b0b465d..aaba8a43c 100644 --- a/project/jni/boost/include/boost/graph/adjacency_list_io.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_list_io.hpp @@ -40,7 +40,7 @@ namespace boost { template std::istream& operator >> ( std::istream& in, property& p ) { - in >> p.m_value >> *(static_cast(&p)); // houpla !! + in >> p.m_value >> p.m_base; // houpla !! return in; } @@ -65,7 +65,7 @@ template void get ( property& p, const V& v, Stag s ) { - get( *(static_cast(&p)),v,s ); + get( p.m_base,v,s ); } template @@ -82,7 +82,7 @@ void getSubset ( property& p, const property& s ) { get( p, s.m_value, Stag() ); - getSubset( p, Snext(s) ); + getSubset( p, s.m_base ); } template PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { - typename property_map::type ps = get(Tag(), *graph); + typename property_map::const_type ps = get(Tag(), *graph); out << ps[ v ] <<" "; PropertyPrinter print(*graph); print(out, v); @@ -248,7 +248,7 @@ struct PropertyPrinter > template PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { - typename property_map::type ps = get(Tag(), *graph); + typename property_map::const_type ps = get(Tag(), *graph); out << ps[ v ] <<" "; PropertyPrinter print(*graph); print(out, v); diff --git a/project/jni/boost/include/boost/graph/adjacency_matrix.hpp b/project/jni/boost/include/boost/graph/adjacency_matrix.hpp index 47d8d5f28..65cf27a57 100644 --- a/project/jni/boost/include/boost/graph/adjacency_matrix.hpp +++ b/project/jni/boost/include/boost/graph/adjacency_matrix.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,10 @@ #include #include #include -#include +#include +#include +#include +#include namespace boost { @@ -484,25 +488,14 @@ namespace boost { BOOST_STATIC_ASSERT(!(is_same::value)); #endif -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; -#else typedef GraphProperty graph_property_type; - typedef no_graph_bundle graph_bundled; + typedef typename lookup_one_property::type graph_bundled; typedef VertexProperty vertex_property_type; - typedef no_vertex_bundle vertex_bundled; + typedef typename lookup_one_property::type vertex_bundled; typedef EdgeProperty edge_property_type; - typedef no_edge_bundle edge_bundled; -#endif + typedef typename lookup_one_property::type edge_bundled; public: // should be private typedef typename mpl::if_::type, @@ -640,16 +633,16 @@ namespace boost { #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) - { return get(vertex_bundle, *this)[v]; } + { return get(vertex_bundle, *this, v); } const vertex_bundled& operator[](vertex_descriptor v) const - { return get(vertex_bundle, *this)[v]; } + { return get(vertex_bundle, *this, v); } edge_bundled& operator[](edge_descriptor e) - { return get(edge_bundle, *this)[e]; } + { return get(edge_bundle, *this, e); } const edge_bundled& operator[](edge_descriptor e) const - { return get(edge_bundle, *this)[e]; } + { return get(edge_bundle, *this, e); } graph_bundled& operator[](graph_bundle_t) { return get_property(*this); } @@ -1035,256 +1028,194 @@ namespace boost { //========================================================================= // Functions required by the PropertyGraph concept + template + struct adj_mat_pm_helper; + + template + struct adj_mat_pm_helper { + typedef typename graph_traits >::vertex_descriptor arg_type; + typedef typed_identity_property_map vi_map_type; + typedef iterator_property_map::iterator, vi_map_type> all_map_type; + typedef iterator_property_map::const_iterator, vi_map_type> all_map_const_type; + typedef transform_value_property_map< + detail::lookup_one_property_f, + all_map_type> + type; + typedef transform_value_property_map< + detail::lookup_one_property_f, + all_map_const_type> + const_type; + typedef typename property_traits::reference single_nonconst_type; + typedef typename property_traits::reference single_const_type; + + static type get_nonconst(adjacency_matrix& g, Prop prop) { + return type(prop, all_map_type(g.m_vertex_properties.begin(), vi_map_type())); + } + + static const_type get_const(const adjacency_matrix& g, Prop prop) { + return const_type(prop, all_map_const_type(g.m_vertex_properties.begin(), vi_map_type())); + } + + static single_nonconst_type get_nonconst_one(adjacency_matrix& g, Prop prop, arg_type v) { + return lookup_one_property::lookup(g.m_vertex_properties[v], prop); + } + + static single_const_type get_const_one(const adjacency_matrix& g, Prop prop, arg_type v) { + return lookup_one_property::lookup(g.m_vertex_properties[v], prop); + } + }; + + template + struct adj_mat_pm_helper { + typedef typename graph_traits >::edge_descriptor edge_descriptor; + + template + struct lookup_property_from_edge { + Tag tag; + lookup_property_from_edge(Tag tag): tag(tag) {} + typedef typename boost::mpl::if_::type ep_type_nonref; + typedef ep_type_nonref& ep_type; + typedef typename lookup_one_property::type& result_type; + result_type operator()(edge_descriptor e) const { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + }; + + typedef function_property_map< + lookup_property_from_edge, + typename graph_traits >::edge_descriptor> type; + typedef function_property_map< + lookup_property_from_edge, + typename graph_traits >::edge_descriptor> const_type; + typedef edge_descriptor arg_type; + typedef typename lookup_property_from_edge::result_type single_nonconst_type; + typedef typename lookup_property_from_edge::result_type single_const_type; + + static type get_nonconst(adjacency_matrix& g, Tag tag) { + return type(tag); + } + + static const_type get_const(const adjacency_matrix& g, Tag tag) { + return const_type(tag); + } + + static single_nonconst_type get_nonconst_one(adjacency_matrix& g, Tag tag, edge_descriptor e) { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + + static single_const_type get_const_one(const adjacency_matrix& g, Tag tag, edge_descriptor e) { + return lookup_one_property::lookup(*static_cast(e.get_property()), tag); + } + }; + + template + struct property_map, Tag> + : adj_mat_pm_helper, Tag>::type> {}; + + template + typename property_map, Tag>::type + get(Tag tag, adjacency_matrix& g) { + return property_map, Tag>::get_nonconst(g, tag); + } + + template + typename property_map, Tag>::const_type + get(Tag tag, const adjacency_matrix& g) { + return property_map, Tag>::get_const(g, tag); + } + + template + typename property_map, Tag>::single_nonconst_type + get(Tag tag, adjacency_matrix& g, typename property_map, Tag>::arg_type a) { + return property_map, Tag>::get_nonconst_one(g, tag, a); + } + + template + typename property_map, Tag>::single_const_type + get(Tag tag, const adjacency_matrix& g, typename property_map, Tag>::arg_type a) { + return property_map, Tag>::get_const_one(g, tag, a); + } + + template + void + put(Tag tag, + adjacency_matrix& g, + typename property_map, Tag>::arg_type a, + typename property_map, Tag>::single_const_type val) { + property_map, Tag>::get_nonconst_one(g, tag, a) = val; + } + // O(1) template inline void - set_property(adjacency_matrix& g, Tag, const Value& value) + set_property(adjacency_matrix& g, Tag tag, const Value& value) { - get_property_value(g.m_property, Tag()) = value; + get_property_value(g.m_property, tag) = value; } template inline typename graph_property, Tag>::type& - get_property(adjacency_matrix& g, Tag) + get_property(adjacency_matrix& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template inline const typename graph_property, Tag>::type& - get_property(const adjacency_matrix& g, Tag) + get_property(const adjacency_matrix& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } //========================================================================= // Vertex Property Map - template - class adj_matrix_vertex_property_map - : public put_get_helper > - { - public: - typedef T value_type; - typedef R reference; - typedef Vertex key_type; - typedef boost::lvalue_property_map_tag category; - adj_matrix_vertex_property_map() { } - adj_matrix_vertex_property_map(GraphPtr g) : m_g(g) { } - inline reference operator[](key_type v) const { - return get_property_value(m_g->m_vertex_properties[v], Tag()); - } - GraphPtr m_g; + template + struct property_map, vertex_index_t> { + typedef typename adjacency_matrix::vertex_descriptor Vertex; + typedef typed_identity_property_map type; + typedef type const_type; }; - template - struct adj_matrix_vertex_id_map - : public boost::put_get_helper > - { - typedef Vertex value_type; - typedef Vertex reference; - typedef Vertex key_type; - typedef boost::readable_property_map_tag category; - adj_matrix_vertex_id_map() { } - template - inline adj_matrix_vertex_id_map(const Graph&) { } - inline value_type operator[](key_type v) const { return v; } - }; - - namespace detail { - - struct adj_matrix_any_vertex_pa { - template - struct bind_ { - typedef typename property_value::type Value; - typedef typename boost::graph_traits::vertex_descriptor Vertex; - - typedef adj_matrix_vertex_property_map type; - typedef adj_matrix_vertex_property_map const_type; - }; - }; - struct adj_matrix_id_vertex_pa { - template - struct bind_ { - typedef typename Graph::vertex_descriptor Vertex; - typedef adj_matrix_vertex_id_map type; - typedef adj_matrix_vertex_id_map const_type; - }; - }; - - template - struct adj_matrix_choose_vertex_pa_helper { - typedef adj_matrix_any_vertex_pa type; - }; - template <> - struct adj_matrix_choose_vertex_pa_helper { - typedef adj_matrix_id_vertex_pa type; - }; - - template - struct adj_matrix_choose_vertex_pa { - typedef typename adj_matrix_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; - - struct adj_matrix_vertex_property_selector { - template - struct bind_ { - typedef adj_matrix_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; - }; - - } // namespace detail - - template <> - struct vertex_property_selector { - typedef detail::adj_matrix_vertex_property_selector type; - }; - - //========================================================================= - // Edge Property Map - - - template - class adj_matrix_edge_property_map - : public put_get_helper > - { - public: - typedef T value_type; - typedef R reference; - typedef detail::matrix_edge_desc_impl key_type; - typedef boost::lvalue_property_map_tag category; - inline reference operator[](key_type e) const { - Property& p = *(Property*)e.get_property(); - return get_property_value(p, Tag()); - } - }; - struct adj_matrix_edge_property_selector { - template - struct bind_ { - typedef typename property_value::type T; - typedef typename Graph::vertex_descriptor Vertex; - typedef adj_matrix_edge_property_map type; - typedef adj_matrix_edge_property_map const_type; - }; - }; - template <> - struct edge_property_selector { - typedef adj_matrix_edge_property_selector type; - }; - - //========================================================================= - // Functions required by PropertyGraph - - namespace detail { - - template - typename boost::property_map, - Property>::type - get_dispatch(adjacency_matrix& g, Property, - vertex_property_tag) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map, - Property>::type PA; - return PA(&g); - } - template - typename boost::property_map, - Property>::type - get_dispatch(adjacency_matrix&, Property, - edge_property_tag) - { - typedef typename boost::property_map, - Property>::type PA; - return PA(); - } - template - typename boost::property_map, - Property>::const_type - get_dispatch(const adjacency_matrix& g, Property, - vertex_property_tag) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map, - Property>::const_type PA; - return PA(&g); - } - template - typename boost::property_map, - Property>::const_type - get_dispatch(const adjacency_matrix&, Property, - edge_property_tag) - { - typedef typename boost::property_map, - Property>::const_type PA; - return PA(); - } - - } // namespace detail - - template - inline - typename property_map, Property>::type - get(Property p, adjacency_matrix& g) - { - typedef typename property_kind::type Kind; - return detail::get_dispatch(g, p, Kind()); + template + typename property_map, vertex_index_t>::const_type + get(vertex_index_t, adjacency_matrix&) { + return typename property_map, vertex_index_t>::const_type(); } - template - inline - typename property_map, Property>::const_type - get(Property p, const adjacency_matrix& g) - { - typedef typename property_kind::type Kind; - return detail::get_dispatch(g, p, Kind()); + template + typename adjacency_matrix::vertex_descriptor + get(vertex_index_t, + adjacency_matrix&, + typename adjacency_matrix::vertex_descriptor v) { + return v; } - template - inline - typename property_traits< - typename property_map, Property>::const_type - >::value_type - get(Property p, const adjacency_matrix& g, - const Key& key) - { - return get(get(p, g), key); + template + typename property_map, vertex_index_t>::const_type + get(vertex_index_t, const adjacency_matrix&) { + return typename property_map, vertex_index_t>::const_type(); } - template - inline void - put(Property p, adjacency_matrix& g, - const Key& key, const Value& value) - { - typedef adjacency_matrix Graph; - typedef typename boost::property_map::type Map; - Map pmap = get(p, g); - put(pmap, key, value); + template + typename adjacency_matrix::vertex_descriptor + get(vertex_index_t, + const adjacency_matrix&, + typename adjacency_matrix::vertex_descriptor v) { + return v; } //========================================================================= @@ -1298,63 +1229,10 @@ namespace boost { return n; } - // Support for bundled properties -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - inline - typename property_map, - T Bundle::*>::type - get(T Bundle::* p, adjacency_matrix& g) - { - typedef typename property_map, - T Bundle::*>::type - result_type; - return result_type(&g, p); - } - - template - inline - typename property_map, - T Bundle::*>::const_type - get(T Bundle::* p, adjacency_matrix const & g) - { - typedef typename property_map, - T Bundle::*>::const_type - result_type; - return result_type(&g, p); - } - - template - inline T - get(T Bundle::* p, adjacency_matrix const & g, - const Key& key) - { - return get(get(p, g), key); - } - - template - inline void - put(T Bundle::* p, adjacency_matrix& g, - const Key& key, const T& value) - { - put(get(p, g), key, value); - } - -#endif - -#define ADJMAT_PARAMS \ - typename D, typename VP, typename EP, typename GP, typename A -#define ADJMAT adjacency_matrix -template -struct graph_mutability_traits { - typedef mutable_edge_property_graph_tag category; +template +struct graph_mutability_traits > { + typedef mutable_edge_property_graph_tag category; }; -#undef ADJMAT_PARAMS -#undef ADJMAT } // namespace boost diff --git a/project/jni/boost/include/boost/graph/astar_search.hpp b/project/jni/boost/include/boost/graph/astar_search.hpp index 316e70639..7d6da7c3c 100644 --- a/project/jni/boost/include/boost/graph/astar_search.hpp +++ b/project/jni/boost/include/boost/graph/astar_search.hpp @@ -22,9 +22,12 @@ #include #include #include +#include #include +#include #include #include +#include #include namespace boost { @@ -158,8 +161,10 @@ namespace boost { template void tree_edge(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { m_vis.edge_relaxed(e, g); @@ -173,8 +178,10 @@ namespace boost { template void gray_target(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { put(m_cost, target(e, g), @@ -189,8 +196,10 @@ namespace boost { template void black_target(Edge e, const Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); + using boost::get; + bool m_decreased = + relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); if(m_decreased) { m_vis.edge_relaxed(e, g); @@ -216,7 +225,6 @@ namespace boost { ColorMap m_color; BinaryFunction m_combine; BinaryPredicate m_compare; - bool m_decreased; C m_zero; }; @@ -260,6 +268,77 @@ namespace boost { breadth_first_visit(g, s, Q, bfs_vis, color); } + namespace graph_detail { + template + struct select1st { + typedef std::pair argument_type; + typedef A result_type; + A operator()(const std::pair& p) const {return p.first;} + }; + } + + template + inline void + astar_search_no_init_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + CompareFunction compare, CombineFunction combine, + CostInf /*inf*/, CostZero zero) + { + typedef typename graph_traits::vertex_descriptor + Vertex; + typedef typename property_traits::value_type Distance; + typedef d_ary_heap_indirect< + std::pair, + 4, + null_property_map, std::size_t>, + function_property_map, std::pair >, + CompareFunction> + MutableQueue; + MutableQueue Q( + make_function_property_map >(graph_detail::select1st()), + null_property_map, std::size_t>(), + compare); + + vis.discover_vertex(s, g); + Q.push(std::make_pair(get(cost, s), s)); + while (!Q.empty()) { + Vertex v; + Distance v_rank; + boost::tie(v_rank, v) = Q.top(); + Q.pop(); + vis.examine_vertex(v, g); + BGL_FORALL_OUTEDGES_T(v, e, g, VertexListGraph) { + Vertex w = target(e, g); + vis.examine_edge(e, g); + Distance e_weight = get(weight, e); + if (compare(e_weight, zero)) + BOOST_THROW_EXCEPTION(negative_edge()); + bool decreased = + relax(e, g, weight, predecessor, distance, + combine, compare); + Distance w_d = combine(get(distance, v), e_weight); + if (decreased) { + vis.edge_relaxed(e, g); + Distance w_rank = combine(get(distance, w), h(w)); + put(cost, w, w_rank); + vis.discover_vertex(w, g); + Q.push(std::make_pair(w_rank, w)); + } else { + vis.edge_not_relaxed(e, g); + } + } + vis.finish_vertex(v, g); + } + } // Non-named parameter interface template + inline void + astar_search_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + CompareFunction compare, CombineFunction combine, + CostInf inf, CostZero zero) + { + + typename graph_traits::vertex_iterator ui, ui_end; + for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(cost, *ui, inf); + put(predecessor, *ui, *ui); + vis.initialize_vertex(*ui, g); + } + put(distance, s, zero); + put(cost, s, h(s)); + + astar_search_no_init_tree + (g, s, h, vis, predecessor, cost, distance, weight, + compare, combine, inf, zero); + + } + // Named parameter interfaces template + void + astar_search_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, const bgl_named_params& params) + { + using namespace boost::graph::keywords; + typedef bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + + // Distance type is the value type of the distance map if there is one, + // otherwise the value type of the weight map. + typedef + typename detail::override_const_property_result< + arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type + weight_map_type; + typedef typename boost::property_traits::value_type W; + typedef + typename detail::map_maker::map_type + distance_map_type; + typedef typename boost::property_traits::value_type D; + const D inf = arg_pack[_distance_inf | (std::numeric_limits::max)()]; + + astar_search_tree + (g, s, h, + arg_pack[_visitor | make_astar_visitor(null_visitor())], + arg_pack[_predecessor_map | dummy_property_map()], + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::make_property_map_from_arg_pack_gen(W())(g, arg_pack), + detail::override_const_property(arg_pack, _weight_map, g, edge_weight), + arg_pack[_distance_compare | std::less()], + arg_pack[_distance_combine | closed_plus(inf)], + inf, + arg_pack[_distance_zero | D()]); + } + template @@ -367,8 +520,39 @@ namespace boost { detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), detail::override_const_property(arg_pack, _weight_map, g, edge_weight), - detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index), detail::make_color_map_from_arg_pack(g, arg_pack), + detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index), + arg_pack[_distance_compare | std::less()], + arg_pack[_distance_combine | closed_plus(inf)], + inf, + arg_pack[_distance_zero | D()]); + } + + template + void + astar_search_no_init_tree + (const VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, const bgl_named_params& params) + { + using namespace boost::graph::keywords; + typedef bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + typedef + typename detail::override_const_property_result< + arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type + weight_map_type; + typedef typename boost::property_traits::value_type D; + const D inf = arg_pack[_distance_inf | (std::numeric_limits::max)()]; + astar_search_no_init_tree + (g, s, h, + arg_pack[_visitor | make_astar_visitor(null_visitor())], + arg_pack[_predecessor_map | dummy_property_map()], + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::make_property_map_from_arg_pack_gen(D())(g, arg_pack), + detail::override_const_property(arg_pack, _weight_map, g, edge_weight), arg_pack[_distance_compare | std::less()], arg_pack[_distance_combine | closed_plus(inf)], inf, diff --git a/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp b/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp index c80ebe7c7..e102d9220 100644 --- a/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp +++ b/project/jni/boost/include/boost/graph/bellman_ford_shortest_paths.hpp @@ -171,7 +171,7 @@ namespace boost { bool bellman_dispatch2 (VertexAndEdgeListGraph& g, - detail::error_property_not_found, + param_not_found, Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance, const bgl_named_params& params) { diff --git a/project/jni/boost/include/boost/graph/betweenness_centrality.hpp b/project/jni/boost/include/boost/graph/betweenness_centrality.hpp index 052f0633c..a4de17533 100644 --- a/project/jni/boost/include/boost/graph/betweenness_centrality.hpp +++ b/project/jni/boost/include/boost/graph/betweenness_centrality.hpp @@ -498,14 +498,14 @@ namespace detail { namespace graph { }; template<> - struct brandes_betweenness_centrality_dispatch1 + struct brandes_betweenness_centrality_dispatch1 { template static void run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, - error_property_not_found) + param_not_found) { brandes_betweenness_centrality_dispatch2(g, centrality, edge_centrality_map, vertex_index); @@ -532,7 +532,7 @@ brandes_betweenness_centrality(const Graph& g, { typedef bgl_named_params named_params; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew; detail::graph::brandes_betweenness_centrality_dispatch1::run( g, choose_param(get_param(params, vertex_centrality), diff --git a/project/jni/boost/include/boost/graph/biconnected_components.hpp b/project/jni/boost/include/boost/graph/biconnected_components.hpp index 9586f9a21..1669f6952 100644 --- a/project/jni/boost/include/boost/graph/biconnected_components.hpp +++ b/project/jni/boost/include/boost/graph/biconnected_components.hpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace boost { @@ -28,17 +29,23 @@ namespace boost { template struct biconnected_components_visitor : public dfs_visitor<> { biconnected_components_visitor - (ComponentMap comp, std::size_t& c, DiscoverTimeMap dtm, + (ComponentMap comp, std::size_t& c, + std::size_t& children_of_root, DiscoverTimeMap dtm, std::size_t& dfs_time, LowPointMap lowpt, PredecessorMap pred, - OutputIterator out, Stack& S, DFSVisitor vis) - : comp(comp), c(c), children_of_root(0), dtm(dtm), - dfs_time(dfs_time), lowpt(lowpt), - pred(pred), out(out), S(S), vis(vis) { } + OutputIterator out, Stack& S, + ArticulationVector& is_articulation_point, IndexMap index_map, + DFSVisitor vis) + : comp(comp), c(c), children_of_root(children_of_root), + dtm(dtm), dfs_time(dfs_time), lowpt(lowpt), + pred(pred), out(out), S(S), + is_articulation_point(is_articulation_point), + index_map(index_map), vis(vis) { } template void initialize_vertex(const Vertex& u, Graph& g) @@ -89,8 +96,7 @@ namespace boost typename boost::graph_traits::vertex_descriptor src = source(e, g); typename boost::graph_traits::vertex_descriptor tgt = target(e, g); - if ( ( tgt != get(pred, src) || get(pred, src) == src ) && - get(dtm, tgt) < get(dtm, src) ) { + if ( tgt != get(pred, src) ) { S.push(e); put(lowpt, src, min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, src), @@ -111,40 +117,41 @@ namespace boost BOOST_USING_STD_MIN(); Vertex parent = get(pred, u); if (parent == u) { // Root of tree is special - if (children_of_root >= 2) { - *out++ = u; - } - return; - } - put(lowpt, parent, - min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, parent), + is_articulation_point[get(index_map, u)] = (children_of_root > 1); + } else { + put(lowpt, parent, + min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, parent), get(lowpt, u))); - if ( get(lowpt, u) >= get(dtm, parent) ) { - if ( get(pred, parent) != parent ) { - *out++ = parent; - } - while ( get(dtm, source(S.top(), g)) >= get(dtm, u) ) { + if ( get(lowpt, u) >= get(dtm, parent) ) { + is_articulation_point[get(index_map, parent)] = true; + while ( get(dtm, source(S.top(), g)) >= get(dtm, u) ) { + put(comp, S.top(), c); + S.pop(); + } + BOOST_ASSERT (source(S.top(), g) == parent); + BOOST_ASSERT (target(S.top(), g) == u); put(comp, S.top(), c); S.pop(); + ++c; } - assert (source(S.top(), g) == parent); - assert (target(S.top(), g) == u); - put(comp, S.top(), c); - S.pop(); - ++c; + } + if ( is_articulation_point[get(index_map, u)] ) { + *out++ = u; } vis.finish_vertex(u, g); } ComponentMap comp; std::size_t& c; - std::size_t children_of_root; + std::size_t& children_of_root; DiscoverTimeMap dtm; std::size_t& dfs_time; LowPointMap lowpt; PredecessorMap pred; OutputIterator out; Stack& S; + ArticulationVector& is_articulation_point; + IndexMap index_map; DFSVisitor vis; }; @@ -168,14 +175,16 @@ namespace boost vertex_t> )); std::size_t num_components = 0; + std::size_t children_of_root; std::size_t dfs_time = 0; - std::stack S; + std::stack S; + std::vector is_articulation_point(num_vertices(g)); - biconnected_components_visitor, - DFSVisitor> - vis(comp, num_components, dtm, dfs_time, lowpt, pred, out, - S, dfs_vis); + biconnected_components_visitor, + std::vector, VertexIndexMap, DFSVisitor> + vis(comp, num_components, children_of_root, dtm, dfs_time, + lowpt, pred, out, S, is_articulation_point, index_map, dfs_vis); depth_first_search(g, visitor(vis).vertex_index_map(index_map)); @@ -201,7 +210,7 @@ namespace boost }; template <> - struct bicomp_dispatch3 + struct bicomp_dispatch3 { template& params, - error_property_not_found) + param_not_found) { typedef typename graph_traits::vertex_descriptor vertex_t; std::vector pred(num_vertices(g)); @@ -235,8 +244,7 @@ namespace boost DiscoverTimeMap dtm, const bgl_named_params& params, LowPointMap lowpt) { - typedef typename property_value< bgl_named_params, - vertex_predecessor_t>::type dispatch_type; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch3::apply (g, comp, out, index_map, dtm, lowpt, params, @@ -246,7 +254,7 @@ namespace boost template <> - struct bicomp_dispatch2 + struct bicomp_dispatch2 { template apply (const Graph& g, ComponentMap comp, OutputIterator out, VertexIndexMap index_map, DiscoverTimeMap dtm, const bgl_named_params& params, - error_property_not_found) + param_not_found) { typedef typename graph_traits::vertices_size_type vertices_size_type; std::vector lowpt(num_vertices(g)); vertices_size_type vst(0); - typedef typename property_value< bgl_named_params, - vertex_predecessor_t>::type dispatch_type; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch3::apply (g, comp, out, index_map, dtm, @@ -280,8 +287,7 @@ namespace boost ComponentMap comp, OutputIterator out, VertexIndexMap index_map, const bgl_named_params& params, DiscoverTimeMap dtm) { - typedef typename property_value< bgl_named_params, - vertex_lowpoint_t>::type dispatch_type; + typedef typename get_param_type< vertex_lowpoint_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch2::apply (g, comp, out, index_map, dtm, params, @@ -290,21 +296,20 @@ namespace boost }; template <> - struct bicomp_dispatch1 + struct bicomp_dispatch1 { template static std::pair apply(const Graph& g, ComponentMap comp, OutputIterator out, VertexIndexMap index_map, - const bgl_named_params& params, error_property_not_found) + const bgl_named_params& params, param_not_found) { typedef typename graph_traits::vertices_size_type vertices_size_type; std::vector discover_time(num_vertices(g)); vertices_size_type vst(0); - typedef typename property_value< bgl_named_params, - vertex_lowpoint_t>::type dispatch_type; + typedef typename get_param_type< vertex_lowpoint_t, bgl_named_params >::type dispatch_type; return bicomp_dispatch2::apply (g, comp, out, index_map, @@ -321,14 +326,14 @@ namespace boost biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out, DiscoverTimeMap dtm, LowPointMap lowpt) { - typedef detail::error_property_not_found dispatch_type; + typedef param_not_found dispatch_type; return detail::bicomp_dispatch3::apply (g, comp, out, get(vertex_index, g), dtm, lowpt, bgl_named_params(0), - detail::error_property_not_found()); + param_not_found()); } template & params) { - typedef typename property_value< bgl_named_params, - vertex_discover_time_t>::type dispatch_type; + typedef typename get_param_type< vertex_discover_time_t, bgl_named_params >::type dispatch_type; return detail::bicomp_dispatch1::apply(g, comp, out, choose_const_pmap(get_param(params, vertex_index), g, vertex_index), diff --git a/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp b/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp index 0834c6316..1edc1323e 100644 --- a/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp +++ b/project/jni/boost/include/boost/graph/boykov_kolmogorov_max_flow.hpp @@ -442,11 +442,11 @@ class bk_max_flow { for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ edge_descriptor in_edge = get(m_rev_edge_map, *ei); vertex_descriptor other_node = source(in_edge, m_g); - if(get_tree(other_node) == tColorTraits::black() && has_parent(other_node)){ + if(get_tree(other_node) == tColorTraits::black() && other_node != m_source){ if(get(m_res_cap_map, in_edge) > 0){ add_active_node(other_node); } - if(source(get_edge_to_parent(other_node), m_g) == current_node){ + if(has_parent(other_node) && source(get_edge_to_parent(other_node), m_g) == current_node){ //we are the parent of that node //it has to find a new parent, too set_no_parent(other_node); @@ -483,11 +483,11 @@ class bk_max_flow { for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ const edge_descriptor out_edge = *ei; const vertex_descriptor other_node = target(out_edge, m_g); - if(get_tree(other_node) == tColorTraits::white() && has_parent(other_node)){ + if(get_tree(other_node) == tColorTraits::white() && other_node != m_sink){ if(get(m_res_cap_map, out_edge) > 0){ add_active_node(other_node); } - if(target(get_edge_to_parent(other_node), m_g) == current_node){ + if(has_parent(other_node) && target(get_edge_to_parent(other_node), m_g) == current_node){ //we were it's parent, so it has to find a new one, too set_no_parent(other_node); m_child_orphans.push(other_node); @@ -526,6 +526,9 @@ class bk_max_flow { inline void add_active_node(vertex_descriptor v){ BOOST_ASSERT(get_tree(v) != tColorTraits::gray()); if(get(m_in_active_list_map, v)){ + if (m_last_grow_vertex == v) { + m_last_grow_vertex = graph_traits::null_vertex(); + } return; } else{ put(m_in_active_list_map, v, true); diff --git a/project/jni/boost/include/boost/graph/breadth_first_search.hpp b/project/jni/boost/include/boost/graph/breadth_first_search.hpp index f65e47572..18bc24f5c 100644 --- a/project/jni/boost/include/boost/graph/breadth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/breadth_first_search.hpp @@ -53,11 +53,12 @@ namespace boost { }; + // Multiple-source version template + class ColorMap, class SourceIterator> void breadth_first_visit (const IncidenceGraph& g, - typename graph_traits::vertex_descriptor s, + SourceIterator sources_begin, SourceIterator sources_end, Buffer& Q, BFSVisitor vis, ColorMap color) { BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept )); @@ -70,8 +71,11 @@ namespace boost { typedef color_traits Color; typename GTraits::out_edge_iterator ei, ei_end; - put(color, s, Color::gray()); vis.discover_vertex(s, g); - Q.push(s); + for (; sources_begin != sources_end; ++sources_begin) { + Vertex s = *sources_begin; + put(color, s, Color::gray()); vis.discover_vertex(s, g); + Q.push(s); + } while (! Q.empty()) { Vertex u = Q.top(); Q.pop(); vis.examine_vertex(u, g); for (boost::tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { @@ -89,12 +93,25 @@ namespace boost { } // end while } // breadth_first_visit + // Single-source version + template + void breadth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + typename graph_traits::vertex_descriptor sources[1] = {s}; + breadth_first_visit(g, sources, sources + 1, Q, vis, color); + } - template void breadth_first_search (const VertexListGraph& g, - typename graph_traits::vertex_descriptor s, + SourceIterator sources_begin, SourceIterator sources_end, Buffer& Q, BFSVisitor vis, ColorMap color) { // Initialization @@ -105,7 +122,18 @@ namespace boost { vis.initialize_vertex(*i, g); put(color, *i, Color::white()); } - breadth_first_visit(g, s, Q, vis, color); + breadth_first_visit(g, sources_begin, sources_end, Q, vis, color); + } + + template + void breadth_first_search + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + typename graph_traits::vertex_descriptor sources[1] = {s}; + breadth_first_search(g, sources, sources + 1, Q, vis, color); } namespace graph { struct bfs_visitor_event_not_overridden {}; } @@ -270,13 +298,13 @@ namespace boost { }; template <> - struct bfs_dispatch { + struct bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { null_visitor null_vis; @@ -294,7 +322,7 @@ namespace boost { } // namespace detail - +#if 1 // Named Parameter Variant template void breadth_first_search @@ -307,11 +335,11 @@ namespace boost { // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } +#endif // This version does not initialize colors, user has to. @@ -343,6 +371,33 @@ namespace boost { ); } + namespace graph { + namespace detail { + template + struct breadth_first_search_impl { + typedef void result_type; + template + void operator()(const Graph& g, const Source& source, const ArgPack& arg_pack) { + using namespace boost::graph::keywords; + typename boost::graph_traits::vertex_descriptor sources[1] = {source}; + boost::queue::vertex_descriptor> Q; + boost::breadth_first_search(g, + &sources[0], + &sources[1], + boost::unwrap_ref(arg_pack[_buffer | boost::ref(Q)]), + arg_pack[_visitor | make_bfs_visitor(null_visitor())], + boost::detail::make_color_map_from_arg_pack(g, arg_pack)); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(breadth_first_search, 2, 4) + } + +#if 0 + // Named Parameter Variant + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(breadth_first_search, 2) +#endif + } // namespace boost #ifdef BOOST_GRAPH_USE_MPI diff --git a/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp b/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp index 1466dfe5f..b663cf95f 100644 --- a/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp +++ b/project/jni/boost/include/boost/graph/bron_kerbosch_all_cliques.hpp @@ -224,7 +224,7 @@ namespace detail // otherwise, iterate over candidates and and test // for maxmimal cliquiness. - typename Container::iterator i, j, end = cands.end(); + typename Container::iterator i, j; for(i = cands.begin(); i != cands.end(); ) { Vertex candidate = *i; @@ -270,7 +270,6 @@ bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min) { BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept )); BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); - BOOST_CONCEPT_ASSERT(( VertexIndexGraphConcept )); BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); // Structural requirement only typedef typename graph_traits::vertex_descriptor Vertex; typedef typename graph_traits::vertex_iterator VertexIterator; diff --git a/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp b/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp index ef6ae5c9c..4d026986c 100644 --- a/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp +++ b/project/jni/boost/include/boost/graph/chrobak_payne_drawing.hpp @@ -13,7 +13,6 @@ #include #include #include -#include //for next and prior #include #include diff --git a/project/jni/boost/include/boost/graph/clustering_coefficient.hpp b/project/jni/boost/include/boost/graph/clustering_coefficient.hpp index dad4695a7..5345ed999 100644 --- a/project/jni/boost/include/boost/graph/clustering_coefficient.hpp +++ b/project/jni/boost/include/boost/graph/clustering_coefficient.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP #define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp b/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp index caa27a906..33c267254 100644 --- a/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp +++ b/project/jni/boost/include/boost/graph/compressed_sparse_row_graph.hpp @@ -37,16 +37,15 @@ #include #include #include +#include #include +#include #include #include #include -#include - -#ifdef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -# error The Compressed Sparse Row graph only supports bundled properties. -# error You will need a compiler that conforms better to the C++ standard. -#endif +#include +#include +#include namespace boost { @@ -139,7 +138,7 @@ namespace detail { typedef boost::iterator_facade, T, std::random_access_iterator_tag, const T&> base_type; T saved_value; const T& dereference() const {return saved_value;} - bool equal(default_construct_iterator i) const {return true;} + bool equal(default_construct_iterator /*i*/) const {return true;} void increment() {} void decrement() {} void advance(typename base_type::difference_type) {} @@ -195,8 +194,8 @@ class compressed_sparse_row_graph::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProperty graph_property_type; + typedef typename lookup_one_property::type graph_bundled; typedef detail::compressed_sparse_row_structure forward_type; @@ -746,8 +745,8 @@ class compressed_sparse_row_graph::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProperty graph_property_type; + typedef typename lookup_one_property::type graph_bundled; // typedef GraphProperty graph_property_type; typedef detail::compressed_sparse_row_structure forward_type; @@ -933,6 +932,7 @@ class compressed_sparse_row_graph - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); - } - - template - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, typed_identity_property_map()); - } - - // Add edges from a sorted (smallest sources first) range of pairs - template - void - add_edges_sorted_internal( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator()); - } - - template - void - add_edges_sorted_internal_global( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator(), global_to_local); - } - - template - void - add_edges_sorted_internal_global( - BidirectionalIteratorOrig first_sorted, - BidirectionalIteratorOrig last_sorted, - EPIterOrig ep_iter_sorted, - const GlobalToLocal& global_to_local) { - m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); - } - - // Add edges from a range of (source, target) pairs that are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - const GlobalToLocal& global_to_local) { - typedef compressed_sparse_row_graph Graph; - typedef typename boost::graph_traits::vertex_descriptor vertex_t; - typedef typename boost::graph_traits::vertices_size_type vertex_num; - typedef typename boost::graph_traits::edges_size_type edge_num; - typedef std::vector > edge_vector_t; - edge_vector_t new_edges(first, last); - if (new_edges.empty()) return; - std::sort(new_edges.begin(), new_edges.end()); - this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); - } - - template - inline void - add_edges_internal(InputIterator first, InputIterator last) { - this->add_edges_internal(first, last, typed_identity_property_map()); - } - - // Add edges from a range of (source, target) pairs and edge properties that - // are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - EPIterator ep_iter, EPIterator ep_iter_end, - const GlobalToLocal& global_to_local) { - typedef compressed_sparse_row_graph Graph; - typedef typename boost::graph_traits::vertex_descriptor vertex_t; - typedef typename boost::graph_traits::vertices_size_type vertex_num; - typedef typename boost::graph_traits::edges_size_type edge_num; - typedef std::pair vertex_pair; - typedef std::vector< - boost::tuple > - edge_vector_t; - edge_vector_t new_edges - (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), - boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); - if (new_edges.empty()) return; - std::sort(new_edges.begin(), new_edges.end(), - boost::detail::compare_first< - std::less >()); - m_forward.add_edges_sorted_internal - (boost::make_transform_iterator( - new_edges.begin(), - boost::detail::my_tuple_get_class<0, vertex_pair>()), - boost::make_transform_iterator( - new_edges.end(), - boost::detail::my_tuple_get_class<0, vertex_pair>()), - boost::make_transform_iterator( - new_edges.begin(), - boost::detail::my_tuple_get_class - <1, edge_bundled>()), - global_to_local); - } - - // Add edges from a range of (source, target) pairs and edge properties that - // are unsorted - template - inline void - add_edges_internal(InputIterator first, InputIterator last, - EPIterator ep_iter, EPIterator ep_iter_end) { - this->add_edges_internal(first, last, ep_iter, ep_iter_end, typed_identity_property_map()); + set_up_backward_property_links(); } using inherited_vertex_properties::operator[]; @@ -1134,7 +1017,6 @@ add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_ Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); EdgeIndex numedges = g.m_forward.m_rowstart.back(); g.m_forward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); - g.m_backward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); g.vertex_properties().resize(num_vertices(g)); return old_num_verts_plus_one - 1; } @@ -1383,56 +1265,148 @@ edges(const BOOST_CSR_GRAPH_TYPE& g) // Graph properties template inline void -set_property(BOOST_CSR_GRAPH_TYPE& g, Tag, const Value& value) +set_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag, const Value& value) { - get_property_value(g.m_property, Tag()) = value; + get_property_value(g.m_property, tag) = value; } template inline typename graph_property::type& -get_property(BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); } template inline const typename graph_property::type& -get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag) +get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag tag) { - return get_property_value(g.m_property, Tag()); + return get_property_value(g.m_property, tag); +} + +template +struct csr_property_map_helper {}; +// Kind == void for invalid property tags, so we can use that to SFINAE out + +template +struct csr_property_map_helper { + typedef vertex_all_t all_tag; + typedef typename property_traits::type>::key_type key_type; + typedef VertexProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +template +struct csr_property_map_helper { + typedef edge_all_t all_tag; + typedef typename property_traits::type>::key_type key_type; + typedef EdgeProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +template +struct csr_property_map_helper { + typedef graph_all_t all_tag; + typedef BOOST_CSR_GRAPH_TYPE* key_type; + typedef GraphProperty plist_type; + typedef typename property_map::type all_type; + typedef typename property_map::const_type all_const_type; + typedef transform_value_property_map, all_type> type; + typedef transform_value_property_map, all_const_type> const_type; +}; + +// disable_if isn't truly necessary but required to avoid ambiguity with specializations below +template +struct property_map >::type>: + csr_property_map_helper< + BOOST_CSR_GRAPH_TYPE, + Tag, + typename detail::property_kind_from_graph + ::type> {}; + +template +typename property_map::type +get(Tag tag, BOOST_CSR_GRAPH_TYPE& g) { + return typename property_map::type(tag, get(typename property_map::all_tag(), g)); +} + +template +typename property_map::const_type +get(Tag tag, const BOOST_CSR_GRAPH_TYPE& g) { + return typename property_map::const_type(tag, get(typename property_map::all_tag(), g)); +} + +template +typename property_traits::type>::reference +get(Tag tag, BOOST_CSR_GRAPH_TYPE& g, typename property_map::key_type k) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::type outer_pm; + return lookup_one_property::value_type, Tag>::lookup(get(all_tag(), g, k), tag); +} + +template +typename property_traits::const_type>::reference +get(Tag tag, const BOOST_CSR_GRAPH_TYPE& g, typename property_map::key_type k) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::const_type outer_pm; + return lookup_one_property::value_type, Tag>::lookup(get(all_tag(), g, k), tag); +} + +template +void +put(Tag tag, + BOOST_CSR_GRAPH_TYPE& g, + typename property_map::key_type k, + typename lookup_one_property::plist_type, Tag>::type val) { + typedef typename property_map::all_tag all_tag; + typedef typename property_map::type outer_pm; + lookup_one_property::plist_type, Tag>::lookup(get(all_tag(), g, k), tag) = val; } template -struct property_map +struct property_map >::type> { typedef typed_identity_property_map type; typedef type const_type; }; template -struct property_map +struct property_map >::type> { typedef detail::csr_edge_index_map type; typedef type const_type; }; template -struct property_map +struct property_map >::type> { typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::vertex_map_type type; typedef typename BOOST_CSR_GRAPH_TYPE::inherited_vertex_properties::const_vertex_map_type const_type; }; template -struct property_map +struct property_map >::type> { typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::edge_map_type type; typedef typename BOOST_CSR_GRAPH_TYPE::forward_type::inherited_edge_properties::const_edge_map_type const_type; }; +template +struct property_map >::type> +{ + typedef boost::ref_property_map type; + typedef boost::ref_property_map const_type; +}; + template inline typed_identity_property_map get(vertex_index_t, const BOOST_CSR_GRAPH_TYPE&) @@ -1448,6 +1422,21 @@ get(vertex_index_t, return v; } +template +inline typed_identity_property_map +get(vertex_index_t, BOOST_CSR_GRAPH_TYPE&) +{ + return typed_identity_property_map(); +} + +template +inline Vertex +get(vertex_index_t, + BOOST_CSR_GRAPH_TYPE&, Vertex v) +{ + return v; +} + template inline typename property_map::const_type get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&) @@ -1466,125 +1455,144 @@ get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&, } template -inline typename property_map::type -get(vertex_bundle_t, BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(edge_index_t, BOOST_CSR_GRAPH_TYPE&) +{ + typedef typename property_map::const_type + result_type; + return result_type(); +} + +template +inline EdgeIndex +get(edge_index_t, BOOST_CSR_GRAPH_TYPE&, + typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e) +{ + return e.idx; +} + +template +inline typename property_map::type +get(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g) { return g.get_vertex_bundle(get(vertex_index, g)); } template -inline typename property_map::const_type -get(vertex_bundle_t, const BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(vertex_all_t, const BOOST_CSR_GRAPH_TYPE& g) { return g.get_vertex_bundle(get(vertex_index, g)); } template inline VertexProperty& -get(vertex_bundle_t, +get(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g, Vertex v) { - return get(vertex_bundle, g)[v]; + return get(vertex_all, g)[v]; } template inline const VertexProperty& -get(vertex_bundle_t, +get(vertex_all_t, const BOOST_CSR_GRAPH_TYPE& g, Vertex v) { - return get(vertex_bundle, g)[v]; + return get(vertex_all, g)[v]; } template inline void -put(vertex_bundle_t, +put(vertex_all_t, BOOST_CSR_GRAPH_TYPE& g, Vertex v, const VertexProperty& val) { - put(get(vertex_bundle, g), v, val); + put(get(vertex_all, g), v, val); } template -inline typename property_map::type -get(edge_bundle_t, BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::type +get(edge_all_t, BOOST_CSR_GRAPH_TYPE& g) { return g.m_forward.get_edge_bundle(get(edge_index, g)); } template -inline typename property_map::const_type -get(edge_bundle_t, const BOOST_CSR_GRAPH_TYPE& g) +inline typename property_map::const_type +get(edge_all_t, const BOOST_CSR_GRAPH_TYPE& g) { return g.m_forward.get_edge_bundle(get(edge_index, g)); } template inline EdgeProperty& -get(edge_bundle_t, +get(edge_all_t, BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e) { - return get(edge_bundle, g)[e]; + return get(edge_all, g)[e]; } template inline const EdgeProperty& -get(edge_bundle_t, +get(edge_all_t, const BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e) { - return get(edge_bundle, g)[e]; + return get(edge_all, g)[e]; } template inline void -put(edge_bundle_t, +put(edge_all_t, BOOST_CSR_GRAPH_TYPE& g, const typename BOOST_CSR_GRAPH_TYPE::edge_descriptor& e, const EdgeProperty& val) { - put(get(edge_bundle, g), e, val); + put(get(edge_all, g), e, val); } -template -inline -typename property_map::type -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g) +template +inline typename property_map::type +get(graph_all_t, BOOST_CSR_GRAPH_TYPE& g) { - typedef typename property_map::type - result_type; - return result_type(&g, p); + return typename property_map::type(g.m_property); } -template -inline -typename property_map::const_type -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g) +template +inline typename property_map::const_type +get(graph_all_t, const BOOST_CSR_GRAPH_TYPE& g) { - typedef typename property_map::const_type - result_type; - return result_type(&g, p); + return typename property_map::const_type(g.m_property); } -template -inline T -get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g, - const Key& key) +template +inline GraphProperty& +get(graph_all_t, + BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*) { - return get(get(p, g), key); + return g.m_property; } -template +template +inline const GraphProperty& +get(graph_all_t, + const BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*) +{ + return g.m_property; +} + +template inline void -put(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g, - const Key& key, const T& value) +put(graph_all_t, + BOOST_CSR_GRAPH_TYPE& g, + BOOST_CSR_GRAPH_TYPE*, + const GraphProperty& val) { - put(get(p, g), key, value); + g.m_property = val; } #undef BOOST_CSR_GRAPH_TYPE diff --git a/project/jni/boost/include/boost/graph/copy.hpp b/project/jni/boost/include/boost/graph/copy.hpp index 0dc6c664a..21bb0fb01 100644 --- a/project/jni/boost/include/boost/graph/copy.hpp +++ b/project/jni/boost/include/boost/graph/copy.hpp @@ -280,7 +280,7 @@ namespace boost { typedef choose_copier_parameter type; }; template <> - struct choose_edge_copy { + struct choose_edge_copy { typedef choose_default_edge_copier type; }; template @@ -314,7 +314,7 @@ namespace boost { typedef choose_copier_parameter type; }; template <> - struct choose_vertex_copy { + struct choose_vertex_copy { typedef choose_default_vertex_copier type; }; template diff --git a/project/jni/boost/include/boost/graph/core_numbers.hpp b/project/jni/boost/include/boost/graph/core_numbers.hpp index 3db59c72b..33764c4f4 100644 --- a/project/jni/boost/include/boost/graph/core_numbers.hpp +++ b/project/jni/boost/include/boost/graph/core_numbers.hpp @@ -11,8 +11,7 @@ #ifndef BOOST_GRAPH_CORE_NUMBERS_HPP #define BOOST_GRAPH_CORE_NUMBERS_HPP -#include -#include +#include #include #include #include @@ -159,7 +158,8 @@ namespace boost { if (get(c,u) > v_cn) { // remove the edge put(c,u,get(c,u)-get(wm,*oi)); - Q.update(u); + if (Q.contains(u)) + Q.update(u); } } vis.finish_vertex(v,g); @@ -175,13 +175,14 @@ namespace boost { { typedef typename property_traits::value_type D; typedef std::less Cmp; - typedef indirect_cmp IndirectCmp; - IndirectCmp icmp(c, Cmp()); // build the mutable queue typedef typename graph_traits::vertex_descriptor vertex; - typedef mutable_queue, IndirectCmp, - IndexMap> MutableQueue; - MutableQueue Q(num_vertices(g), icmp, im); + std::vector index_in_heap_data(num_vertices(g)); + typedef iterator_property_map::iterator, IndexMap> + index_in_heap_map_type; + index_in_heap_map_type index_in_heap_map(index_in_heap_data.begin(), im); + typedef d_ary_heap_indirect MutableQueue; + MutableQueue Q(c, index_in_heap_map, Cmp()); typename graph_traits::vertex_iterator vi,vi_end; for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { Q.push(*vi); diff --git a/project/jni/boost/include/boost/graph/depth_first_search.hpp b/project/jni/boost/include/boost/graph/depth_first_search.hpp index d38ad603d..34d73a2fd 100644 --- a/project/jni/boost/include/boost/graph/depth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/depth_first_search.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -198,7 +199,7 @@ namespace boost { put(color, u, Color::white()); vis.initialize_vertex(u, g); } - if (start_vertex != implicit_cast(*vertices(g).first)){ vis.start_vertex(start_vertex, g); + if (start_vertex != detail::get_default_starting_vertex(g)){ vis.start_vertex(start_vertex, g); detail::depth_first_visit_impl(g, start_vertex, vis, color, detail::nontruth2()); } @@ -221,7 +222,7 @@ namespace boost { if (verts.first == verts.second) return; - depth_first_search(g, vis, color, *verts.first); + depth_first_search(g, vis, color, detail::get_default_starting_vertex(g)); } template @@ -282,27 +283,27 @@ namespace boost { } typedef dfs_visitor<> default_dfs_visitor; - // Named Parameter Variant - template - void - depth_first_search(const VertexListGraph& g, - const bgl_named_params& params) - { - typedef typename boost::graph_traits::vertex_iterator vi; - std::pair verts = vertices(g); - if (verts.first == verts.second) - return; - using namespace boost::graph::keywords; - typedef bgl_named_params params_type; - BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) - depth_first_search - (g, - arg_pack[_visitor | make_dfs_visitor(null_visitor())], - boost::detail::make_color_map_from_arg_pack(g, arg_pack), - arg_pack[_root_vertex | *vertices(g).first] - ); + // Boost.Parameter named parameter variant + namespace graph { + namespace detail { + template + struct depth_first_search_impl { + typedef void result_type; + template + void operator()(const Graph& g, const ArgPack& arg_pack) const { + using namespace boost::graph::keywords; + boost::depth_first_search(g, + arg_pack[_visitor | make_dfs_visitor(null_visitor())], + boost::detail::make_color_map_from_arg_pack(g, arg_pack), + arg_pack[_root_vertex || boost::detail::get_default_starting_vertex_t(g)]); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(depth_first_search, 1, 4) } + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(depth_first_search, 1) + template void depth_first_visit (const IncidenceGraph& g, diff --git a/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp b/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp index 100c44ba7..619593675 100644 --- a/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/detail/adjacency_list.hpp @@ -37,11 +37,6 @@ #include #include -// Symbol truncation problems with MSVC, trying to shorten names. -#define stored_edge se_ -#define stored_edge_property sep_ -#define stored_edge_iter sei_ - /* Outline for this file: @@ -67,11 +62,6 @@ */ -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -# define Graph Graph_ -#endif - namespace boost { namespace detail { @@ -319,14 +309,16 @@ namespace boost { public: typedef Property property_type; inline stored_ra_edge_iter() { } - inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), - EdgeVec* edge_vec = 0) + inline explicit stored_ra_edge_iter(Vertex v) // Only used for comparisons + : stored_edge(v), m_i(0), m_vec(0){ } + inline stored_ra_edge_iter(Vertex v, Iter i, EdgeVec* edge_vec) : stored_edge(v), m_i(i - edge_vec->begin()), m_vec(edge_vec){ } - inline Property& get_property() { return (*m_vec)[m_i].get_property(); } + inline Property& get_property() { BOOST_ASSERT ((m_vec != 0)); return (*m_vec)[m_i].get_property(); } inline const Property& get_property() const { + BOOST_ASSERT ((m_vec != 0)); return (*m_vec)[m_i].get_property(); } - inline Iter get_iter() const { return m_vec->begin() + m_i; } + inline Iter get_iter() const { BOOST_ASSERT ((m_vec != 0)); return m_vec->begin() + m_i; } protected: std::size_t m_i; EdgeVec* m_vec; @@ -727,8 +719,10 @@ namespace boost { typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == &p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -736,10 +730,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == &p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -760,8 +754,10 @@ namespace boost { no_property* p = (no_property*)e.get_property(); typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); + typename Config::EdgeIter edge_iter_to_erase; for (; out_i != out_el.end(); ++out_i) if (&(*out_i).get_property() == p) { + edge_iter_to_erase = (*out_i).get_iter(); out_el.erase(out_i); break; } @@ -769,10 +765,10 @@ namespace boost { typename Config::OutEdgeList::iterator in_i = in_el.begin(); for (; in_i != in_el.end(); ++in_i) if (&(*in_i).get_property() == p) { - g.m_edges.erase((*in_i).get_iter()); in_el.erase(in_i); - return; + break; } + g.m_edges.erase(edge_iter_to_erase); } }; @@ -811,6 +807,7 @@ namespace boost { typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end(); + BOOST_ASSERT ((i != end)); if (i != end) { g.m_edges.erase((*i).get_iter()); el.erase(i); @@ -991,24 +988,12 @@ namespace boost { typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast(g_); - typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator - ei = el.begin(), ei_end = el.end(); - for (; ei != ei_end; /* Increment below */ ) { - bool is_self_loop = (*ei).get_target() == u; - // Don't erase from our own incidence list in the case of a self-loop - // since we're clearing it anyway. - if (!is_self_loop) { - detail::erase_from_incidence_list - (g.out_edge_list((*ei).get_target()), u, Cat()); - typename Config::OutEdgeList::iterator ei_copy = ei; - ++ei; - if (!is_self_loop) g.m_edges.erase((*ei_copy).get_iter()); - } else { - ++ei; - } + while (true) { + typename Config::out_edge_iterator ei, ei_end; + boost::tie(ei, ei_end) = out_edges(u, g); + if (ei == ei_end) break; + remove_edge(*ei, g); } - g.out_edge_list(u).clear(); } // O(1) for allow_parallel_edge_tag // O(log(E/V)) for disallow_parallel_edge_tag @@ -1511,10 +1496,16 @@ namespace boost { typedef typename Config::edges_size_type edges_size_type; typedef typename Config::degree_size_type degree_size_type; typedef typename Config::StoredEdge StoredEdge; + typedef typename Config::vertex_property_type vertex_property_type; typedef typename Config::edge_property_type edge_property_type; + typedef typename Config::graph_property_type graph_property_type; typedef typename Config::global_edgelist_selector global_edgelist_selector; + + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; + typedef typename lookup_one_property::type graph_bundled; }; template @@ -1645,43 +1636,43 @@ namespace boost { inline typename boost::property_map::type - get_dispatch(adj_list_helper&, Property, + get_dispatch(adj_list_helper&, Property p, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; - return PA(); + return PA(p); } template inline typename boost::property_map::const_type - get_dispatch(const adj_list_helper&, Property, + get_dispatch(const adj_list_helper&, Property p, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::const_type PA; - return PA(); + return PA(p); } template inline typename boost::property_map::type - get_dispatch(adj_list_helper& g, Property, + get_dispatch(adj_list_helper& g, Property p, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; - return PA(&static_cast(g)); + return PA(&static_cast(g), p); } template inline typename boost::property_map::const_type - get_dispatch(const adj_list_helper& g, Property, + get_dispatch(const adj_list_helper& g, Property p, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::const_type PA; const Graph& cg = static_cast(g); - return PA(&cg); + return PA(&cg, p); } } // namespace detail @@ -1691,7 +1682,7 @@ namespace boost { inline typename boost::property_map::type get(Property p, adj_list_helper& g) { - typedef typename property_kind::type Kind; + typedef typename detail::property_kind_from_graph, Property>::type Kind; return detail::get_dispatch(g, p, Kind()); } template @@ -1699,7 +1690,7 @@ namespace boost { typename boost::property_map::const_type get(Property p, const adj_list_helper& g) { - typedef typename property_kind::type Kind; + typedef typename detail::property_kind_from_graph, Property>::type Kind; return detail::get_dispatch(g, p, Kind()); } @@ -2427,15 +2418,15 @@ namespace boost { typedef Reference reference; typedef typename Graph::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - inline adj_list_vertex_property_map() { } - inline adj_list_vertex_property_map(const Graph*) { } + inline adj_list_vertex_property_map(const Graph* = 0, Tag tag = Tag()): m_tag(tag) { } inline Reference operator[](key_type v) const { StoredVertex* sv = (StoredVertex*)v; - return get_property_value(sv->m_property, Tag()); + return get_property_value(sv->m_property, m_tag); } inline Reference operator()(key_type v) const { return this->operator[](v); } + Tag m_tag; }; template @@ -2449,8 +2440,7 @@ namespace boost { typedef PropRef reference; typedef typename Graph::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - inline adj_list_vertex_all_properties_map() { } - inline adj_list_vertex_all_properties_map(const Graph*) { } + inline adj_list_vertex_all_properties_map(const Graph* = 0, vertex_all_t = vertex_all_t()) { } inline PropRef operator[](key_type v) const { StoredVertex* sv = (StoredVertex*)v; return sv->m_property; @@ -2473,15 +2463,15 @@ namespace boost { typedef Reference reference; typedef typename boost::graph_traits::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - vec_adj_list_vertex_property_map() { } - vec_adj_list_vertex_property_map(GraphPtr g) : m_g(g) { } + vec_adj_list_vertex_property_map(GraphPtr g = 0, Tag tag = Tag()) : m_g(g), m_tag(tag) { } inline Reference operator[](key_type v) const { - return get_property_value(m_g->m_vertices[v].m_property, Tag()); + return get_property_value(m_g->m_vertices[v].m_property, m_tag); } inline Reference operator()(key_type v) const { return this->operator[](v); } GraphPtr m_g; + Tag m_tag; }; template @@ -2495,8 +2485,7 @@ namespace boost { typedef PropertyRef reference; typedef typename boost::graph_traits::vertex_descriptor key_type; typedef boost::lvalue_property_map_tag category; - vec_adj_list_vertex_all_properties_map() { } - vec_adj_list_vertex_all_properties_map(GraphPtr g) : m_g(g) { } + vec_adj_list_vertex_all_properties_map(GraphPtr g = 0, vertex_all_t = vertex_all_t()) : m_g(g) { } inline PropertyRef operator[](key_type v) const { return m_g->m_vertices[v].m_property; } @@ -2542,7 +2531,7 @@ namespace boost { typedef boost::readable_property_map_tag category; inline vec_adj_list_vertex_id_map() { } template - inline vec_adj_list_vertex_id_map(const Graph&) { } + inline vec_adj_list_vertex_id_map(const Graph&, vertex_index_t) { } inline value_type operator[](key_type v) const { return v; } inline value_type operator()(key_type v) const { return v; } }; @@ -2579,21 +2568,14 @@ namespace boost { }; }; namespace detail { - template - struct adj_list_choose_vertex_pa_helper { - typedef adj_list_any_vertex_pa type; - }; - template <> - struct adj_list_choose_vertex_pa_helper { - typedef adj_list_all_vertex_pa type; - }; template - struct adj_list_choose_vertex_pa { - typedef typename adj_list_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct adj_list_choose_vertex_pa + : boost::mpl::if_< + boost::is_same, + adj_list_all_vertex_pa, + adj_list_any_vertex_pa>::type + ::template bind_ + {}; template @@ -2609,12 +2591,9 @@ namespace boost { typedef vec_adj_list_all_vertex_pa type; }; template - struct vec_adj_list_choose_vertex_pa { - typedef typename vec_adj_list_choose_vertex_pa_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct vec_adj_list_choose_vertex_pa + : vec_adj_list_choose_vertex_pa_helper::type::template bind_ + {}; } // namespace detail //========================================================================= @@ -2629,13 +2608,16 @@ namespace boost { Tag> > { + Tag tag; + explicit adj_list_edge_property_map(Tag tag = Tag()): tag(tag) {} + typedef Value value_type; typedef Ref reference; typedef detail::edge_desc_impl key_type; typedef boost::lvalue_property_map_tag category; inline Ref operator[](key_type e) const { Property& p = *(Property*)e.get_property(); - return get_property_value(p, Tag()); + return get_property_value(p, tag); } inline Ref operator()(key_type e) const { return this->operator[](e); @@ -2650,6 +2632,7 @@ namespace boost { PropPtr, Vertex> > { + explicit adj_list_edge_all_properties_map(edge_all_t = edge_all_t()) {} typedef Property value_type; typedef PropRef reference; typedef detail::edge_desc_impl key_type; @@ -2701,19 +2684,12 @@ namespace boost { typedef adj_list_all_edge_pmap type; }; template - struct adj_list_choose_edge_pmap { - typedef typename adj_list_choose_edge_pmap_helper::type Helper; - typedef typename Helper::template bind_ Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct adj_list_choose_edge_pmap + : adj_list_choose_edge_pmap_helper::type::template bind_ + {}; struct adj_list_edge_property_selector { template - struct bind_ { - typedef adj_list_choose_edge_pmap Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_: adj_list_choose_edge_pmap {}; }; } // namespace detail @@ -2730,11 +2706,9 @@ namespace boost { struct adj_list_vertex_property_selector { template - struct bind_ { - typedef detail::adj_list_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_ + : detail::adj_list_choose_vertex_pa + {}; }; template <> struct vertex_property_selector { @@ -2743,11 +2717,7 @@ namespace boost { struct vec_adj_list_vertex_property_selector { template - struct bind_ { - typedef detail::vec_adj_list_choose_vertex_pa Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + struct bind_: detail::vec_adj_list_choose_vertex_pa {}; }; template <> struct vertex_property_selector { @@ -2793,15 +2763,6 @@ namespace boost { #endif -#undef stored_edge -#undef stored_edge_property -#undef stored_edge_iter - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -#undef Graph -#endif - #endif // BOOST_GRAPH_DETAIL_DETAIL_ADJACENCY_LIST_CCT /* diff --git a/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp b/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp index 75ac96204..56495f343 100644 --- a/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp +++ b/project/jni/boost/include/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -44,7 +44,6 @@ #include #include #include -#include namespace boost { diff --git a/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp b/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp index ba58647a3..cf930fc18 100644 --- a/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp +++ b/project/jni/boost/include/boost/graph/detail/d_ary_heap.hpp @@ -20,6 +20,11 @@ #include #include +// WARNING: it is not safe to copy a d_ary_heap_indirect and then modify one of +// the copies. The class is required to be copyable so it can be passed around +// (without move support from C++11), but it deep-copies the heap contents yet +// shallow-copies the index_in_heap_map. + namespace boost { // Swap two elements in a property map without assuming they model @@ -121,18 +126,21 @@ namespace boost { } Value& top() { + BOOST_ASSERT (!this->empty()); return data[0]; } const Value& top() const { + BOOST_ASSERT (!this->empty()); return data[0]; } void pop() { + BOOST_ASSERT (!this->empty()); put(index_in_heap, data[0], (size_type)(-1)); if (data.size() != 1) { data[0] = data.back(); - put(index_in_heap, data[0], 0); + put(index_in_heap, data[0], (size_type)(0)); data.pop_back(); preserve_heap_property_down(); verify_heap(); diff --git a/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp b/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp index b359a73de..ca6266a52 100644 --- a/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp +++ b/project/jni/boost/include/boost/graph/detail/histogram_sort.hpp @@ -60,6 +60,7 @@ count_starts // Put the degree of each vertex v into m_rowstart[v + 1] for (KeyIterator i = begin; i != end; ++i) { if (key_filter(*i)) { + BOOST_ASSERT (key_transform(*i) < numkeys); ++starts[key_transform(*i) + 1]; } } @@ -99,6 +100,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) { if (key_filter(*i)) { vertices_size_type source = key_transform(*i); + BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; values1_out[insert_pos] = *v1i; @@ -137,6 +139,7 @@ histogram_sort(KeyIterator key_begin, KeyIterator key_end, for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) { if (key_filter(*i)) { vertices_size_type source = key_transform(*i); + BOOST_ASSERT (source < numkeys); EdgeIndex insert_pos = current_insert_positions[source]; ++current_insert_positions[source]; values1_out[insert_pos] = *v1i; @@ -163,6 +166,7 @@ histogram_sort_inplace(KeyIterator key_begin, std::vector insert_positions(rowstart, rowstart + numkeys); // 2. Swap the sources and targets into place for (size_t i = 0; i < rowstart[numkeys]; ++i) { + BOOST_ASSERT (key_transform(key_begin[i]) < numkeys); // While edge i is not in the right bucket: while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { // Add a slot in the right bucket @@ -197,6 +201,7 @@ histogram_sort_inplace(KeyIterator key_begin, std::vector insert_positions(rowstart, rowstart + numkeys); // 2. Swap the sources and targets into place for (size_t i = 0; i < rowstart[numkeys]; ++i) { + BOOST_ASSERT (key_transform(key_begin[i]) < numkeys); // While edge i is not in the right bucket: while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { // Add a slot in the right bucket diff --git a/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp b/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp index e1f874b2c..4494625c6 100644 --- a/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp +++ b/project/jni/boost/include/boost/graph/detail/indexed_properties.hpp @@ -253,7 +253,7 @@ class indexed_edge_properties typedef secret const_edge_map_type; secret operator[](secret) { return secret(); } - void write_by_index(std::size_t idx, const no_property& prop) {} + void write_by_index(std::size_t /*idx*/, const no_property& /*prop*/) {} edge_map_type get_edge_bundle(const IndexMap& = IndexMap()) const { return edge_map_type(); @@ -270,7 +270,7 @@ class indexed_edge_properties public: void push_back(const edge_push_back_type&) { } - void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) {} + void move_range(std::size_t /*src_begin*/, std::size_t /*src_end*/, std::size_t /*dest_begin*/) {} typedef dummy_no_property_iterator iterator; iterator begin() {return dummy_no_property_iterator();} diff --git a/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp b/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp new file mode 100644 index 000000000..4319d9d89 --- /dev/null +++ b/project/jni/boost/include/boost/graph/detail/is_distributed_selector.hpp @@ -0,0 +1,26 @@ +// Copyright 2012 The Trustees of Indiana University. + +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Jeremiah Willcock +// Andrew Lumsdaine + +// Selector to determine whether a selector is distributedS (can only be true +// if has been included) so that we can +// disable various sequential-graph-only traits specializations for distributed +// graphs. + +#ifndef BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP +#define BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP + +#include + +namespace boost { + namespace detail { + template struct is_distributed_selector: boost::mpl::false_ {}; + } +} + +#endif // BOOST_GRAPH_DETAIL_IS_DISTRIBUTED_SELECTOR_HPP diff --git a/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp b/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp index 6eb106093..a0c0973f9 100644 --- a/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp +++ b/project/jni/boost/include/boost/graph/detail/labeled_graph_traits.hpp @@ -218,9 +218,9 @@ namespace graph_detail { #define LABELED_GRAPH_PARAMS typename G, typename L, typename S #define LABELED_GRAPH labeled_graph -// Specialize mutability traits for for the labeled graph. +// Specialize mutability traits for the labeled graph. // This specialization depends on the mutability of the underlying graph type. -// If the underlying graph is fully mutable, this this is also fully mutable. +// If the underlying graph is fully mutable, this is also fully mutable. // Otherwise, it's different. template struct graph_mutability_traits< LABELED_GRAPH > { diff --git a/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp b/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp index 4e8b22e5e..994646988 100644 --- a/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp +++ b/project/jni/boost/include/boost/graph/detail/read_graphviz_spirit.hpp @@ -604,7 +604,9 @@ bool read_graphviz_spirit(MultiPassIterator begin, MultiPassIterator end, scanner_t scan(begin, end, policies); - return p.parse(scan); + bool ok = p.parse(scan); + m_graph.finish_building_graph(); + return ok; } } // namespace boost diff --git a/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp b/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp index 90a64a2cd..33acc07e3 100644 --- a/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp +++ b/project/jni/boost/include/boost/graph/detail/set_adaptor.hpp @@ -111,7 +111,7 @@ namespace boost { // Shit, can't implement this without knowing the size of the // universe. template - void set_compliment(const std::set& x, + void set_compliment(const std::set& /*x*/, std::set& z) { z.clear(); diff --git a/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp b/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp index ca2a1ebd8..c5ce6b6d4 100644 --- a/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp +++ b/project/jni/boost/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp @@ -113,16 +113,17 @@ namespace boost { distance_weight_combine, distance_compare); if (was_edge_relaxed) { - vertex_queue.update(neighbor_vertex); visitor.edge_relaxed(current_edge, graph); + if (is_neighbor_undiscovered) { + visitor.discover_vertex(neighbor_vertex, graph); + vertex_queue.push(neighbor_vertex); + } else { + vertex_queue.update(neighbor_vertex); + } } else { visitor.edge_not_relaxed(current_edge, graph); } - if (is_neighbor_undiscovered) { - visitor.discover_vertex(neighbor_vertex, graph); - vertex_queue.push(neighbor_vertex); - } } // end out edge iteration visitor.finish_vertex(min_vertex, graph); diff --git a/project/jni/boost/include/boost/graph/directed_graph.hpp b/project/jni/boost/include/boost/graph/directed_graph.hpp index 0bf025190..585308d18 100644 --- a/project/jni/boost/include/boost/graph/directed_graph.hpp +++ b/project/jni/boost/include/boost/graph/directed_graph.hpp @@ -7,9 +7,12 @@ #ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP #define BOOST_GRAPH_DIRECTED_GRAPH_HPP -#include #include #include +#include +#include +#include +#include namespace boost { @@ -28,29 +31,26 @@ struct directed_graph_tag { }; */ template < typename VertexProp = no_property, - typename EdgeProp= no_property, - typename GraphProp= no_property> + typename EdgeProp = no_property, + typename GraphProp = no_property> class directed_graph { public: - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; - - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; - -private: - // Wrap the user-specified properties with an index. - typedef property vertex_property; - typedef property edge_property; + typedef GraphProp graph_property_type; + typedef VertexProp vertex_property_type; + typedef EdgeProp edge_property_type; + typedef typename lookup_one_property::type graph_bundled; + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; +public: + // Embed indices into the vertex type. + typedef property internal_vertex_property; + typedef property internal_edge_property; public: typedef adjacency_list< listS, listS, bidirectionalS, - vertex_property, edge_property, GraphProp, + internal_vertex_property, internal_edge_property, GraphProp, listS > graph_type; @@ -83,8 +83,8 @@ public: typedef typename graph_type::edge_parallel_category edge_parallel_category; typedef typename graph_type::traversal_category traversal_category; - typedef unsigned vertex_index_type; - typedef unsigned edge_index_type; + typedef std::size_t vertex_index_type; + typedef std::size_t edge_index_type; directed_graph(GraphProp const& p = GraphProp()) : m_graph(p), m_num_vertices(0), m_num_edges(0), m_max_vertex_index(0) @@ -140,6 +140,7 @@ public: vertices_size_type num_vertices() const { return m_num_vertices; } + private: // This helper function manages the attribution of vertex indices. vertex_descriptor make_index(vertex_descriptor v) { @@ -153,7 +154,7 @@ public: { return make_index(boost::add_vertex(m_graph)); } vertex_descriptor add_vertex(vertex_property_type const& p) - { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + { return make_index(boost::add_vertex(internal_vertex_property(0u, p), m_graph)); } void clear_vertex(vertex_descriptor v) { @@ -189,7 +190,7 @@ public: std::pair add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) - { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + { return make_index(boost::add_edge(u, v, internal_edge_property(0u, p), m_graph)); } void remove_edge(vertex_descriptor u, vertex_descriptor v) { @@ -519,37 +520,32 @@ remove_in_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH& g) { return remove_in_edge_if(v, pred, g.impl()); } -// Helper code for working with property maps -namespace detail -{ - struct directed_graph_vertex_property_selector { - template - struct bind_ { - typedef typename DirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; +template +struct property_map: property_map {}; - struct directed_graph_edge_property_selector { - template - struct bind_ { - typedef typename DirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; -} +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; -template <> -struct vertex_property_selector -{ typedef detail::directed_graph_vertex_property_selector type; }; - -template <> -struct edge_property_selector -{ typedef detail::directed_graph_edge_property_selector type; }; +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; // PropertyGraph concepts template @@ -562,6 +558,26 @@ inline typename property_map::const_type get(Property p, DIRECTED_GRAPH const& g) { return get(p, g.impl()); } +template +inline typename property_map::type +get(vertex_all_t, DIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::const_type +get(vertex_all_t, DIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::type +get(edge_all_t, DIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(edge_all, g.impl())); } + +template +inline typename property_map::const_type +get(edge_all_t, DIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(edge_all, g.impl())); } + template inline typename property_traits< typename property_map< @@ -571,10 +587,40 @@ inline typename property_traits< get(Property p, DIRECTED_GRAPH const& g, Key const& k) { return get(p, g.impl(), k); } +template +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, vertex_all_t + >::const_type +>::value_type +get(vertex_all_t, DIRECTED_GRAPH const& g, Key const& k) +{ return get(vertex_all, g.impl(), k).m_base; } + +template +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, edge_all_t + >::const_type +>::value_type +get(edge_all_t, DIRECTED_GRAPH const& g, Key const& k) +{ return get(edge_all, g.impl(), k).m_base; } + template inline void put(Property p, DIRECTED_GRAPH& g, Key const& k, Value const& v) { put(p, g.impl(), k, v); } +template +inline void put(vertex_all_t, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(vertex_all, g.impl(), k, + typename DIRECTED_GRAPH::internal_vertex_property(get(vertex_index, g.impl(), k), v)); +} + +template +inline void put(edge_all_t, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(edge_all, g.impl(), k, + typename DIRECTED_GRAPH::internal_vertex_property(get(edge_index, g.impl(), k), v)); +} + template typename graph_property::type& get_property(DIRECTED_GRAPH& g, Property p) @@ -590,35 +636,6 @@ void set_property(DIRECTED_GRAPH& g, Property p, Value v) { return set_property(g.impl(), p, v); } -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - -template -inline typename property_map::type -get(Type Bundle::* p, DIRECTED_GRAPH& g) { - typedef typename property_map< - DIRECTED_GRAPH, Type Bundle::* - >::type return_type; - return return_type(&g, p); -} - -template -inline typename property_map::const_type -get(Type Bundle::* p, DIRECTED_GRAPH const& g) { - typedef typename property_map< - DIRECTED_GRAPH, Type Bundle::* - >::const_type return_type; - return return_type(&g, p); -} - -template -inline Type get(Type Bundle::* p, DIRECTED_GRAPH const& g, Key const& k) -{ return get(p, g.impl(), k); } - -template -inline void put(Type Bundle::* p, DIRECTED_GRAPH& g, Key const& k, Value const& v) -{ put(p, g.impl(), k, v); } -#endif - // Vertex index management template diff --git a/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp b/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp index d0bbbfe55..264ede512 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjacency_list.hpp @@ -1882,6 +1882,30 @@ namespace boost { } //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + // Opposite of above. + edge_property_type split_edge_property(const base_edge_property_type& p) + { return split_edge_property(p, directed_selector()); } + + edge_property_type + split_edge_property(const base_edge_property_type& p, directedS) + { + return p.m_base; + } + + edge_property_type + split_edge_property(const base_edge_property_type& p, bidirectionalS) + { + return p.m_base; + } + + edge_property_type + split_edge_property(const base_edge_property_type& p, undirectedS) + { + return p.m_base.m_base; + } + //--------------------------------------------------------------------- + /** The set of messages that can be transmitted and received by * a distributed adjacency list. This list will eventually be * exhaustive, but is currently quite limited. diff --git a/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp b/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp index 064aaba19..5401f1240 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjlist/redistribute.hpp @@ -237,8 +237,8 @@ PBGL_DISTRIB_ADJLIST_TYPE || get(vertex_to_processor, src) != src.owner || get(vertex_to_processor, tgt) != tgt.owner) redistributed_edges[get(vertex_to_processor, source(*ei, *this))] - .push_back(redistributed_edge(*ei, get(edge_all_t(), base(), - ei->local))); + .push_back(redistributed_edge(*ei, split_edge_property(get(edge_all_t(), base(), + ei->local)))); } inplace_all_to_all(pg, redistributed_edges); diff --git a/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp b/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp index 9325d610c..d904c5a90 100644 --- a/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp +++ b/project/jni/boost/include/boost/graph/distributed/adjlist/serialization.hpp @@ -833,12 +833,7 @@ void save_edges(Archive& ar, Graph const& g, DirectedS) typedef typename graph_traits< Graph>::edge_descriptor edge_descriptor; - // We retag the property list here so that bundled properties are - // properly placed into property. - typedef typename boost::detail::retag_property_list< - edge_bundle_t, - typename Graph::edge_property_type>::type - edge_property_type; + typedef typename Graph::edge_property_type edge_property_type; int E = num_edges(g); ar << BOOST_SERIALIZATION_NVP(E); @@ -947,12 +942,6 @@ template template void PBGL_DISTRIB_ADJLIST_TYPE::save(std::string const& filename) const { - // We retag the property list here so that bundled properties are - // properly placed into property. - typedef typename boost::detail::retag_property_list< - vertex_bundle_t, vertex_property_type - >::type vertex_property_type; - typedef typename config_type::VertexListS vertex_list_selector; process_group_type pg = process_group(); diff --git a/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp b/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp index b6ca7d06e..04d249a5b 100644 --- a/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp +++ b/project/jni/boost/include/boost/graph/distributed/betweenness_centrality.hpp @@ -1389,7 +1389,7 @@ namespace graph { namespace parallel { namespace detail { }; template<> - struct brandes_betweenness_centrality_dispatch1 + struct brandes_betweenness_centrality_dispatch1 { template @@ -1397,7 +1397,7 @@ namespace graph { namespace parallel { namespace detail { run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, Buffer sources, typename graph_traits::edges_size_type delta, - boost::detail::error_property_not_found) + boost::param_not_found) { boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( g, centrality, edge_centrality_map, vertex_index, sources, delta); @@ -1417,7 +1417,8 @@ brandes_betweenness_centrality(const Graph& g, typedef queue::vertex_descriptor> queue_t; queue_t q; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew_param; + typedef typename detail::choose_impl_result::type ew; graph::parallel::detail::brandes_betweenness_centrality_dispatch1::run( g, choose_param(get_param(params, vertex_centrality), @@ -1427,7 +1428,7 @@ brandes_betweenness_centrality(const Graph& g, choose_const_pmap(get_param(params, vertex_index), g, vertex_index), choose_param(get_param(params, buffer_param_t()), boost::ref(q)), choose_param(get_param(params, lookahead_t()), 0), - get_param(params, edge_weight)); + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); } template @@ -1605,14 +1606,14 @@ namespace detail { namespace graph { }; template<> - struct non_distributed_brandes_betweenness_centrality_dispatch1 + struct non_distributed_brandes_betweenness_centrality_dispatch1 { template static void run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, - Buffer sources, detail::error_property_not_found) + Buffer sources, param_not_found) { non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, vertex_index, sources); @@ -1631,7 +1632,8 @@ non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Gra typedef queue queue_t; queue_t q; - typedef typename property_value::type ew; + typedef typename get_param_type::type ew_param; + typedef typename detail::choose_impl_result::type ew; detail::graph::non_distributed_brandes_betweenness_centrality_dispatch1::run( pg, g, choose_param(get_param(params, vertex_centrality), @@ -1640,7 +1642,7 @@ non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Gra dummy_property_map()), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), choose_param(get_param(params, buffer_param_t()), boost::ref(q)), - get_param(params, edge_weight)); + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); } template diff --git a/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp b/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp index c987585f5..36e2df8bb 100644 --- a/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp +++ b/project/jni/boost/include/boost/graph/distributed/breadth_first_search.hpp @@ -118,7 +118,7 @@ namespace boost { typename graph_traits::vertex_descriptor s, ColorMap color, BFSVisitor vis, - error_property_not_found, + boost::param_not_found, VertexIndexMap vertex_index) { using boost::graph::parallel::process_group; diff --git a/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp b/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp index 01d32cfb8..33861c47b 100644 --- a/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp +++ b/project/jni/boost/include/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -365,30 +365,22 @@ class compressed_sparse_row_graph< // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) { - std::pair locator - = get(vertex_global, *this, v); - BOOST_ASSERT(locator.first == process_id(m_process_group)); - return base().m_vertex_properties[locator.second]; + return get(vertex_bundle, *this, v); } const vertex_bundled& operator[](vertex_descriptor v) const { - std::pair locator - = get(vertex_global, *this, v); - BOOST_ASSERT(locator.first == process_id(m_process_group)); - return base().m_process_group[locator.second]; + return get(vertex_bundle, *this, v); } edge_bundled& operator[](edge_descriptor e) { - BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); - return base().m_edge_properties[e.idx]; + return get(edge_bundle, *this, e); } const edge_bundled& operator[](edge_descriptor e) const { - BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); - return base().m_edge_properties[e.idx]; + return get(edge_bundle, *this, e); } // Create a vertex descriptor from a process ID and a local index. @@ -1757,19 +1749,22 @@ class csr_edge_global_map public: // ----------------------------------------------------------------- // Readable Property Map concept requirements - typedef std::pair value_type; - typedef value_type reference; typedef detail::csr_edge_descriptor key_type; + typedef std::pair > value_type; + typedef value_type reference; typedef readable_property_map_tag category; }; template -inline std::pair +inline std::pair > get(csr_edge_global_map pm, typename csr_edge_global_map::key_type k) { const int local_index_bits = sizeof(Vertex) * CHAR_BIT - processor_bits; - return std::pair(k.src >> local_index_bits, k.idx); + const Vertex local_index_mask = Vertex(-1) >> processor_bits; + return std::pair > + ((k.src >> local_index_bits), + detail::csr_edge_descriptor(k.src & local_index_mask, k.idx)); } template @@ -1796,7 +1791,7 @@ get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) template inline std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) { @@ -1818,7 +1813,7 @@ get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) template inline std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) { @@ -1827,12 +1822,16 @@ get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, const int local_index_bits = sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + const typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type local_index_mask = + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type(-1) >> processor_bits; typedef std::pair + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor> result_type; - return result_type(k.src >> local_index_bits, k.idx); + return result_type(k.src >> local_index_bits, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::base_type::edge_descriptor + (k.src & local_index_mask, k.idx)); } // ----------------------------------------------------------------- @@ -1847,7 +1846,8 @@ class property_map typedef local_property_map< typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type, global_map, - identity_property_map> type; + typename property_map::type + > type; typedef type const_type; }; @@ -1859,7 +1859,7 @@ get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) typedef typename property_map ::type result_type; return result_type(g.process_group(), get(edge_global, g), - identity_property_map()); + get(edge_index, g.base())); } template @@ -1878,7 +1878,7 @@ get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) typedef typename property_map ::const_type result_type; return result_type(g.process_group(), get(edge_global, g), - identity_property_map()); + get(edge_index, g.base())); } template @@ -1889,204 +1889,67 @@ get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, return k.idx; } -/* Common traits for getting vertex_bundle and edge_bundle maps */ +template +class property_map { + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE graph_type; + typedef typename graph_type::process_group_type process_group_type; + typedef typename graph_type::base_type base_graph_type; + typedef typename property_map::type + local_pmap; + typedef typename property_map::const_type + local_const_pmap; -namespace detail { - template struct get_bundles; + typedef graph_traits traits; + typedef typename graph_traits::vertex_descriptor local_vertex; + typedef typename property_traits::key_type local_key_type; - template - class get_bundles { - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; + typedef typename property_traits::value_type value_type; - // Extract the global property map for our key type. - typedef typename property_map::const_type vertex_global_map; - typedef typename property_traits::value_type vertex_locator; - typedef typename property_map::const_type edge_global_map; - typedef typename property_traits::value_type edge_locator; + typedef typename property_map::const_type + vertex_global_map; + typedef typename property_map::const_type + edge_global_map; - // Build the local property map - typedef bundle_property_map, - typename vertex_locator::second_type, - VertexProperty, - T> vertex_local_pmap; - - // Build the local const property map - typedef bundle_property_map, - typename vertex_locator::second_type, - VertexProperty, - const T> vertex_local_const_pmap; - - // Build the local property map - typedef bundle_property_map, - typename edge_locator::second_type, - EdgeProperty, - T> edge_local_pmap; - - // Build the local const property map - typedef bundle_property_map, - typename edge_locator::second_type, - EdgeProperty, - const T> edge_local_const_pmap; - - public: - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_pmap> vertex_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_const_pmap> vertex_map_const_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_pmap> edge_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_const_pmap> edge_map_const_type; - - }; - - template struct get_full_bundles; - - template - class get_full_bundles { // For vertex_bundle_t and edge_bundle_t - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; - - // Extract the global property map for our key type. - typedef typename property_map::const_type vertex_global_map; - typedef typename property_traits::value_type vertex_locator; - typedef typename property_map::const_type edge_global_map; - typedef typename property_traits::value_type edge_locator; - - // Build the local property maps - typedef typename property_map::type vertex_local_pmap; - typedef typename property_map::const_type vertex_local_const_pmap; - typedef typename property_map::type edge_local_pmap; - typedef typename property_map::const_type edge_local_const_pmap; - - public: - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_pmap> vertex_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, vertex_global_map, vertex_local_const_pmap> vertex_map_const_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_pmap> edge_map_type; - - typedef ::boost::parallel::distributed_property_map< - process_group_type, edge_global_map, edge_local_const_pmap> edge_map_const_type; - - }; -} - -template -struct property_map -{ - typedef typename detail::get_full_bundles::vertex_map_type type; - typedef typename detail::get_full_bundles::vertex_map_const_type const_type; -}; - -template -struct property_map -{ - typedef typename detail::get_full_bundles::edge_map_type type; - typedef typename detail::get_full_bundles::edge_map_const_type const_type; -}; - -// ----------------------------------------------------------------- -// Bundled Properties -template -class property_map -{ - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename Graph::process_group_type process_group_type; + typedef typename mpl::if_::type, + vertex_property_tag>, + vertex_global_map, edge_global_map>::type + global_map; public: - typedef typename mpl::if_, - typename detail::get_bundles::vertex_map_type, - typename detail::get_bundles::edge_map_type> - ::type type; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; - typedef typename mpl::if_, - typename detail::get_bundles::vertex_map_const_type, - typename detail::get_bundles::edge_map_const_type> - ::type const_type; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; }; -namespace detail { - // Retrieve the local bundle_property_map corresponding to a - // non-const vertex property. - template - inline bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, T> - get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::true_) - { - typedef bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, T> result_type; - return result_type(&g.base().vertex_properties().m_vertex_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // const vertex property. - template - inline bundle_property_map, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, const T> - get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::true_) - { - typedef bundle_property_map< - const std::vector, - typename Graph::vertex_descriptor, - typename Graph::vertex_bundled, const T> result_type; - return result_type(&g.base().vertex_properties().m_vertex_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // non-const edge property. - template - inline bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, T> - get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::false_) - { - typedef bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, T> result_type; - return result_type(&g.base().edge_properties().m_edge_properties, p); - } - - // Retrieve the local bundle_property_map corresponding to a - // const edge property. - template - inline bundle_property_map, - typename Graph::edges_size_type, - typename Graph::edge_bundled, const T> - get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::false_) - { - typedef bundle_property_map< - const std::vector, - typename Graph::edges_size_type, - typename Graph::edge_bundled, const T> result_type; - return result_type(&g.base().edge_properties().m_edge_properties, p); - } -} - -template -typename property_map::type -get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +template +typename property_map::type +get(Tag tag, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) { typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename property_map::type result_type; - - // Resolver + typedef typename property_map::type result_type; typedef typename property_traits::value_type value_type; - typedef typename property_reduce::template apply + typedef typename property_reduce::template apply + reduce; + + typedef typename mpl::if_::type, + vertex_property_tag>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(tag, g.base()), reduce()); +} + +template +typename property_map::const_type +get(Tag tag, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map::const_type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply reduce; typedef typename property_traits::key_type descriptor; @@ -2096,35 +1959,7 @@ get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) global_map_t; return result_type(g.process_group(), get(global_map_t(), g), - detail::get_distrib_csr_bundle - (p, g, mpl::bool_::value>()), - reduce()); -} - -template -typename property_map::const_type -get(T Bundle::* p, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) -{ - typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; - typedef typename property_map::const_type result_type; - - // Resolver - typedef typename property_traits::value_type value_type; - typedef typename property_reduce::template apply - reduce; - - typedef typename property_traits::key_type descriptor; - typedef typename graph_traits::vertex_descriptor vertex_descriptor; - typedef typename mpl::if_, - vertex_global_t, edge_global_t>::type - global_map_t; - - return result_type(g.process_group(), get(global_map_t(), g), - detail::get_distrib_csr_bundle - (p, g, mpl::bool_::value>()), - reduce()); + get(tag, g.base()), reduce()); } namespace mpi { diff --git a/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp b/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp index f72fa11a5..acfd19440 100644 --- a/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp +++ b/project/jni/boost/include/boost/graph/distributed/dijkstra_shortest_paths.hpp @@ -49,7 +49,7 @@ namespace boost { }; template<> - struct parallel_dijkstra_impl2< ::boost::detail::error_property_not_found > + struct parallel_dijkstra_impl2< ::boost::param_not_found > { template::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, - ::boost::detail::error_property_not_found, + ::boost::param_not_found, WeightMap weight, IndexMap index_map, ColorMap color_map, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis) @@ -95,7 +95,7 @@ namespace boost { }; template<> - struct parallel_dijkstra_impl< ::boost::detail::error_property_not_found > + struct parallel_dijkstra_impl< ::boost::param_not_found > { private: template::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, Lookahead lookahead, WeightMap weight, IndexMap index_map, - ::boost::detail::error_property_not_found, + ::boost::param_not_found, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis) { @@ -190,8 +190,7 @@ namespace boost { IndexMap> DefColorMap; DefColorMap color_map(color.begin(), index_map); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type color_map_type; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type color_map_type; graph::detail::parallel_dijkstra_impl ::run(g, s, predecessor, distance, diff --git a/project/jni/boost/include/boost/graph/distributed/page_rank.hpp b/project/jni/boost/include/boost/graph/distributed/page_rank.hpp index c2c230d38..1fc43ed68 100644 --- a/project/jni/boost/include/boost/graph/distributed/page_rank.hpp +++ b/project/jni/boost/include/boost/graph/distributed/page_rank.hpp @@ -93,6 +93,7 @@ page_rank_impl(const Graph& g, RankMap rank_map, Done done, ::const_type vertex_owner_map; typename property_map::const_type owner = get(vertex_owner, g); + (void)owner; typedef typename boost::graph::parallel::process_group_type ::type process_group_type; diff --git a/project/jni/boost/include/boost/graph/distributed/selector.hpp b/project/jni/boost/include/boost/graph/distributed/selector.hpp index 2e26c1690..937bdf8ab 100644 --- a/project/jni/boost/include/boost/graph/distributed/selector.hpp +++ b/project/jni/boost/include/boost/graph/distributed/selector.hpp @@ -13,6 +13,8 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include + namespace boost { /* The default local selector for a distributedS selector. */ @@ -31,6 +33,12 @@ namespace boost { typedef LocalS local_selector; typedef DistributionS distribution; }; + + namespace detail { + template + struct is_distributed_selector >: mpl::true_ {}; + } + } #endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP diff --git a/project/jni/boost/include/boost/graph/eccentricity.hpp b/project/jni/boost/include/boost/graph/eccentricity.hpp index a8b3e4854..63797a830 100644 --- a/project/jni/boost/include/boost/graph/eccentricity.hpp +++ b/project/jni/boost/include/boost/graph/eccentricity.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_GRAPH_ECCENTRICITY_HPP #define BOOST_GRAPH_ECCENTRICITY_HPP -#include +#include #include #include #include diff --git a/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp b/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp index 43cc592d2..8f86fb202 100644 --- a/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp +++ b/project/jni/boost/include/boost/graph/edmonds_karp_max_flow.hpp @@ -52,21 +52,21 @@ namespace boost { // find minimum residual capacity along the augmenting path FlowValue delta = (std::numeric_limits::max)(); - e = p[sink]; + e = get(p, sink); do { BOOST_USING_STD_MIN(); - delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[e]); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, get(residual_capacity, e)); u = source(e, g); - e = p[u]; + e = get(p, u); } while (u != src); // push delta units of flow along the augmenting path - e = p[sink]; + e = get(p, sink); do { - residual_capacity[e] -= delta; - residual_capacity[reverse_edge[e]] += delta; + put(residual_capacity, e, get(residual_capacity, e) - delta); + put(residual_capacity, get(reverse_edge, e), get(residual_capacity, get(reverse_edge, e)) + delta); u = source(e, g); - e = p[u]; + e = get(p, u); } while (u != src); } @@ -94,22 +94,22 @@ namespace boost { typename graph_traits::out_edge_iterator ei, e_end; for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - res[*ei] = cap[*ei]; + put(res, *ei, get(cap, *ei)); - color[sink] = Color::gray(); - while (color[sink] != Color::white()) { + put(color, sink, Color::gray()); + while (get(color, sink) != Color::white()) { boost::queue Q; breadth_first_search (detail::residual_graph(g, res), src, Q, make_bfs_visitor(record_edge_predecessors(pred, on_tree_edge())), color); - if (color[sink] != Color::white()) + if (get(color, sink) != Color::white()) detail::augment(g, src, sink, pred, res, rev); } // while typename property_traits::value_type flow = 0; for (boost::tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) - flow += (cap[*ei] - res[*ei]); + flow += (get(cap, *ei) - get(res, *ei)); return flow; } // edmonds_karp_max_flow() @@ -140,7 +140,7 @@ namespace boost { } }; template<> - struct edmonds_karp_dispatch2 { + struct edmonds_karp_dispatch2 { template static typename edge_capacity_value::type apply @@ -149,7 +149,7 @@ namespace boost { typename graph_traits::vertex_descriptor sink, PredMap pred, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertices_size_type size_type; @@ -183,13 +183,13 @@ namespace boost { const bgl_named_params& params, PredMap pred) { - typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; return edmonds_karp_dispatch2::apply (g, src, sink, pred, params, get_param(params, vertex_color)); } }; template<> - struct edmonds_karp_dispatch1 { + struct edmonds_karp_dispatch1 { template static typename edge_capacity_value::type @@ -198,7 +198,7 @@ namespace boost { typename graph_traits::vertex_descriptor src, typename graph_traits::vertex_descriptor sink, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertices_size_type size_type; @@ -206,7 +206,7 @@ namespace boost { num_vertices(g) : 1; std::vector pred_vec(n); - typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; return edmonds_karp_dispatch2::apply (g, src, sink, make_iterator_property_map(pred_vec.begin(), choose_const_pmap @@ -227,7 +227,7 @@ namespace boost { typename graph_traits::vertex_descriptor sink, const bgl_named_params& params) { - typedef typename property_value< bgl_named_params, vertex_predecessor_t>::type Pred; + typedef typename get_param_type< vertex_predecessor_t, bgl_named_params >::type Pred; return detail::edmonds_karp_dispatch1::apply (g, src, sink, params, get_param(params, vertex_predecessor)); } diff --git a/project/jni/boost/include/boost/graph/filtered_graph.hpp b/project/jni/boost/include/boost/graph/filtered_graph.hpp index 66cead609..74fea4611 100644 --- a/project/jni/boost/include/boost/graph/filtered_graph.hpp +++ b/project/jni/boost/include/boost/graph/filtered_graph.hpp @@ -195,7 +195,6 @@ namespace boost { typedef filtered_graph_tag graph_tag; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Bundled properties support template typename graph::detail::bundled_result::type& @@ -206,11 +205,10 @@ namespace boost { typename graph::detail::bundled_result::type const& operator[](Descriptor x) const { return this->m_g[x]; } -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES static vertex_descriptor null_vertex() { - return Graph::null_vertex(); + return Traits::null_vertex(); } //private: @@ -222,26 +220,21 @@ namespace boost { template - struct vertex_property_type > { - typedef typename vertex_property_type::type type; - }; + struct vertex_property_type >: + vertex_property_type {}; template - struct edge_property_type > { - typedef typename edge_property_type::type type; - }; + struct edge_property_type >: + edge_property_type {}; template - struct graph_property_type > { - typedef typename graph_property_type::type type; - }; + struct graph_property_type >: + graph_property_type {}; - -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template struct vertex_bundle_type > @@ -256,7 +249,6 @@ namespace boost { struct graph_bundle_type > : graph_bundle_type { }; -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES //=========================================================================== // Non-member functions for the Filtered Edge Graph diff --git a/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp b/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp index 4ce502e83..bab353f33 100644 --- a/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp +++ b/project/jni/boost/include/boost/graph/fruchterman_reingold.hpp @@ -363,7 +363,7 @@ namespace detail { }; template<> - struct fr_force_directed_layout + struct fr_force_directed_layout { template& params) { typedef typename Topology::point_difference_type PointDiff; @@ -404,8 +404,7 @@ fruchterman_reingold_force_directed_layout const Topology& topology, const bgl_named_params& params) { - typedef typename property_value, - vertex_displacement_t>::type D; + typedef typename get_param_type >::type D; detail::fr_force_directed_layout::run (g, position, topology, diff --git a/project/jni/boost/include/boost/graph/graph_archetypes.hpp b/project/jni/boost/include/boost/graph/graph_archetypes.hpp index 9b364bb81..81f9c2c8a 100644 --- a/project/jni/boost/include/boost/graph/graph_archetypes.hpp +++ b/project/jni/boost/include/boost/graph/graph_archetypes.hpp @@ -53,6 +53,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template V source(const typename incidence_graph_archetype::edge_descriptor&, @@ -105,6 +107,8 @@ namespace boost { // should use a different namespace for this typedef void out_edge_iterator; typedef void vertex_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template @@ -154,6 +158,8 @@ namespace boost { // should use a different namespace for this typedef void in_edge_iterator; typedef void edge_iterator; + + static vertex_descriptor null_vertex() {return vertex_descriptor();} }; template diff --git a/project/jni/boost/include/boost/graph/graph_concepts.hpp b/project/jni/boost/include/boost/graph/graph_concepts.hpp index 8cb7cbb2f..f03afeea3 100644 --- a/project/jni/boost/include/boost/graph/graph_concepts.hpp +++ b/project/jni/boost/include/boost/graph/graph_concepts.hpp @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include #include @@ -55,12 +58,10 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_concept(Graph,(G)) { typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::directed_category directed_category; - typedef typename graph_traits::edge_parallel_category - edge_parallel_category; - - typedef typename graph_traits::traversal_category - traversal_category; + typedef typename graph_traits::edge_parallel_category edge_parallel_category; + typedef typename graph_traits::traversal_category traversal_category; BOOST_CONCEPT_USAGE(Graph) { @@ -75,11 +76,12 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); : Graph { typedef typename graph_traits::edge_descriptor edge_descriptor; - typedef typename graph_traits::out_edge_iterator - out_edge_iterator; + typedef typename graph_traits::out_edge_iterator out_edge_iterator; + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::traversal_category traversal_category; - typedef typename graph_traits::traversal_category - traversal_category; + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); BOOST_CONCEPT_USAGE(IncidenceGraph) { BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); @@ -123,6 +125,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = in_edges(v, g); n = in_degree(v, g); e = *p.first; @@ -153,6 +157,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = adjacent_vertices(v, g); v = *p.first; const_constraints(g); @@ -178,6 +184,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if // you want to use vector_as_graph, it is! I'm sure the graph @@ -227,6 +236,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + BOOST_STATIC_ASSERT((boost::mpl::not_ >::value)); + p = edges(g); e = *p.first; u = source(e, g); diff --git a/project/jni/boost/include/boost/graph/graph_test.hpp b/project/jni/boost/include/boost/graph/graph_test.hpp index 7b3a5402b..69d89f34f 100644 --- a/project/jni/boost/include/boost/graph/graph_test.hpp +++ b/project/jni/boost/include/boost/graph/graph_test.hpp @@ -325,10 +325,10 @@ namespace boost { template void test_readable_vertex_property_graph - (const std::vector& vertex_prop, PropertyTag, const Graph& g) + (const std::vector& vertex_prop, PropertyTag tag, const Graph& g) { typedef typename property_map::const_type const_Map; - const_Map pmap = get(PropertyTag(), g); + const_Map pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator @@ -339,7 +339,7 @@ namespace boost { ++bgl_first_9) { //BGL_FORALL_VERTICES_T(v, g, Graph) { typename property_traits::value_type - pval1 = get(pmap, v), pval2 = get(PropertyTag(), g, v); + pval1 = get(pmap, v), pval2 = get(tag, g, v); BOOST_CHECK(pval1 == pval2); BOOST_CHECK(pval1 == *i++); } @@ -350,7 +350,7 @@ namespace boost { (const std::vector& vertex_prop, PropertyTag tag, Graph& g) { typedef typename property_map::type PMap; - PMap pmap = get(PropertyTag(), g); + PMap pmap = get(tag, g); typename std::vector::const_iterator i = vertex_prop.begin(); for (typename boost::graph_traits::vertex_iterator bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; @@ -368,7 +368,7 @@ namespace boost { typename std::vector::const_iterator j = vertex_prop.begin(); BGL_FORALL_VERTICES_T(v, g, Graph) - put(PropertyTag(), g, v, *j++); + put(tag, g, v, *j++); test_readable_vertex_property_graph(vertex_prop, tag, g); } diff --git a/project/jni/boost/include/boost/graph/graph_traits.hpp b/project/jni/boost/include/boost/graph/graph_traits.hpp index fad82f9d2..ceb0c2ac5 100644 --- a/project/jni/boost/include/boost/graph/graph_traits.hpp +++ b/project/jni/boost/include/boost/graph/graph_traits.hpp @@ -15,8 +15,12 @@ #include /* Primarily for std::pair */ #include #include +#include #include #include +#include +#include +#include #include #include #include @@ -25,23 +29,47 @@ namespace boost { + namespace detail { +#define BOOST_GRAPH_MEMBER_OR_VOID(name) \ + BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \ + template struct BOOST_JOIN(get_member_, name) {typedef typename T::name type;}; \ + template struct BOOST_JOIN(get_opt_member_, name): \ + boost::mpl::eval_if_c< \ + BOOST_JOIN(has_, name)::value, \ + BOOST_JOIN(get_member_, name), \ + boost::mpl::identity > \ + {}; + BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator) + BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator) + BOOST_GRAPH_MEMBER_OR_VOID(in_edge_iterator) + BOOST_GRAPH_MEMBER_OR_VOID(vertex_iterator) + BOOST_GRAPH_MEMBER_OR_VOID(edge_iterator) + BOOST_GRAPH_MEMBER_OR_VOID(vertices_size_type) + BOOST_GRAPH_MEMBER_OR_VOID(edges_size_type) + BOOST_GRAPH_MEMBER_OR_VOID(degree_size_type) + } + template struct graph_traits { +#define BOOST_GRAPH_PULL_OPT_MEMBER(name) \ + typedef typename detail::BOOST_JOIN(get_opt_member_, name)::type name; + typedef typename G::vertex_descriptor vertex_descriptor; typedef typename G::edge_descriptor edge_descriptor; - typedef typename G::adjacency_iterator adjacency_iterator; - typedef typename G::out_edge_iterator out_edge_iterator; - typedef typename G::in_edge_iterator in_edge_iterator; - typedef typename G::vertex_iterator vertex_iterator; - typedef typename G::edge_iterator edge_iterator; + BOOST_GRAPH_PULL_OPT_MEMBER(adjacency_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(out_edge_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(in_edge_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(vertex_iterator) + BOOST_GRAPH_PULL_OPT_MEMBER(edge_iterator) typedef typename G::directed_category directed_category; typedef typename G::edge_parallel_category edge_parallel_category; typedef typename G::traversal_category traversal_category; - typedef typename G::vertices_size_type vertices_size_type; - typedef typename G::edges_size_type edges_size_type; - typedef typename G::degree_size_type degree_size_type; + BOOST_GRAPH_PULL_OPT_MEMBER(vertices_size_type) + BOOST_GRAPH_PULL_OPT_MEMBER(edges_size_type) + BOOST_GRAPH_PULL_OPT_MEMBER(degree_size_type) +#undef BOOST_GRAPH_PULL_OPT_MEMBER static inline vertex_descriptor null_vertex(); }; @@ -218,28 +246,31 @@ namespace boost { //?? not the right place ?? Lee typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; - // Forward declare graph_bundle_t property name (from - // boost/graph/properties.hpp, which includes this file) for - // bundled_result. - enum graph_bundle_t {graph_bundle}; + namespace detail { + BOOST_MPL_HAS_XXX_TRAIT_DEF(graph_property_type) + BOOST_MPL_HAS_XXX_TRAIT_DEF(edge_property_type) + BOOST_MPL_HAS_XXX_TRAIT_DEF(vertex_property_type) + + template struct get_graph_property_type {typedef typename G::graph_property_type type;}; + template struct get_edge_property_type {typedef typename G::edge_property_type type;}; + template struct get_vertex_property_type {typedef typename G::vertex_property_type type;}; + } template - struct graph_property_type { - typedef typename G::graph_property_type type; - }; + struct graph_property_type + : boost::mpl::eval_if, + detail::get_graph_property_type, + no_property> {}; template - struct edge_property_type { - typedef typename G::edge_property_type type; - }; + struct edge_property_type + : boost::mpl::eval_if, + detail::get_edge_property_type, + no_property> {}; template - struct vertex_property_type { - typedef typename G::vertex_property_type type; - }; - - struct no_bundle { }; - struct no_graph_bundle : no_bundle { }; - struct no_vertex_bundle : no_bundle { }; - struct no_edge_bundle : no_bundle { }; + struct vertex_property_type + : boost::mpl::eval_if, + detail::get_vertex_property_type, + no_property> {}; template struct graph_bundle_type { @@ -281,7 +312,7 @@ namespace boost { // A helper metafunction for determining whether or not a type is // bundled. template - struct is_no_bundle : mpl::bool_::value> + struct is_no_bundle : mpl::bool_::value> { }; } // namespace graph_detail diff --git a/project/jni/boost/include/boost/graph/graphml.hpp b/project/jni/boost/include/boost/graph/graphml.hpp index 2239d9666..be73def30 100644 --- a/project/jni/boost/include/boost/graph/graphml.hpp +++ b/project/jni/boost/include/boost/graph/graphml.hpp @@ -204,14 +204,14 @@ template const char* mutate_graph_impl::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; void BOOST_GRAPH_DECL -read_graphml(std::istream& in, mutate_graph& g); +read_graphml(std::istream& in, mutate_graph& g, size_t desired_idx); template void -read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp) +read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp, size_t desired_idx = 0) { mutate_graph_impl mg(g,dp); - read_graphml(in, mg); + read_graphml(in, mg, desired_idx); } template @@ -262,7 +262,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { std::string key_id = "key" + lexical_cast(key_count++); - if (i->second->key() == typeid(Graph)) + if (i->second->key() == typeid(Graph*)) graph_key_ids[i->first] = key_id; else if (i->second->key() == typeid(vertex_descriptor)) vertex_key_ids[i->first] = key_id; @@ -273,7 +273,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, std::string type_name = "string"; mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); out << " second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" + << (i->second->key() == typeid(Graph*) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" << " attr.name=\"" << i->first << "\"" << " attr.type=\"" << type_name << "\"" << " />\n"; @@ -287,10 +287,12 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, // Output graph data for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { - if (i->second->key() == typeid(Graph)) + if (i->second->key() == typeid(Graph*)) { + // The const_cast here is just to get typeid correct for property + // map key; the graph should not be mutated using it. out << " first] << "\">" - << encode_char_entities(i->second->get_string(g)) << "\n"; + << encode_char_entities(i->second->get_string(const_cast(&g))) << "\n"; } } diff --git a/project/jni/boost/include/boost/graph/graphviz.hpp b/project/jni/boost/include/boost/graph/graphviz.hpp index 718220ffe..aedce5553 100644 --- a/project/jni/boost/include/boost/graph/graphviz.hpp +++ b/project/jni/boost/include/boost/graph/graphviz.hpp @@ -25,10 +25,14 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include namespace boost { @@ -713,6 +717,9 @@ class mutate_graph virtual void // RG: need new second parameter to support BGL subgraphs set_graph_property(const id_t& key, const id_t& value) = 0; + + virtual void + finish_building_graph() = 0; }; template @@ -781,6 +788,8 @@ class mutate_graph_impl : public mutate_graph put(key, dp_, &graph_, value); } + void finish_building_graph() {} + protected: MutableGraph& graph_; @@ -790,6 +799,109 @@ class mutate_graph_impl : public mutate_graph std::map bgl_edges; }; +template +class mutate_graph_impl > + : public mutate_graph +{ + typedef compressed_sparse_row_graph CSRGraph; + typedef typename graph_traits::vertices_size_type bgl_vertex_t; + typedef typename graph_traits::edges_size_type bgl_edge_t; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + public: + mutate_graph_impl(CSRGraph& graph, dynamic_properties& dp, + std::string node_id_prop) + : graph_(graph), dp_(dp), vertex_count(0), node_id_prop_(node_id_prop) { } + + ~mutate_graph_impl() {} + + void finish_building_graph() { + typedef compressed_sparse_row_graph TempCSRGraph; + TempCSRGraph temp(edges_are_unsorted_multi_pass, + edges_to_add.begin(), edges_to_add.end(), + counting_iterator(0), + vertex_count); + set_property(temp, graph_all, get_property(graph_, graph_all)); + graph_.assign(temp); // Copies structure, not properties + std::vector edge_permutation_from_sorting(num_edges(temp)); + BGL_FORALL_EDGES_T(e, temp, TempCSRGraph) { + edge_permutation_from_sorting[temp[e]] = e; + } + typedef boost::tuple v_prop; + BOOST_FOREACH(const v_prop& t, vertex_props) { + put(boost::get<0>(t), dp_, boost::get<1>(t), boost::get<2>(t)); + } + typedef boost::tuple e_prop; + BOOST_FOREACH(const e_prop& t, edge_props) { + put(boost::get<0>(t), dp_, edge_permutation_from_sorting[boost::get<1>(t)], boost::get<2>(t)); + } + } + + bool is_directed() const + { + return + boost::is_convertible< + typename boost::graph_traits::directed_category, + boost::directed_tag>::value; + } + + virtual void do_add_vertex(const node_t& node) + { + // Add the node to the graph. + bgl_vertex_t v = vertex_count++; + + // Set up a mapping from name to BGL vertex. + bgl_nodes.insert(std::make_pair(node, v)); + + // node_id_prop_ allows the caller to see the real id names for nodes. + vertex_props.push_back(boost::make_tuple(node_id_prop_, v, node)); + } + + void + do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) + { + bgl_edge_t result = edges_to_add.size(); + edges_to_add.push_back(std::make_pair(bgl_nodes[source], bgl_nodes[target])); + bgl_edges.insert(std::make_pair(edge, result)); + } + + void + set_node_property(const id_t& key, const node_t& node, const id_t& value) + { + vertex_props.push_back(boost::make_tuple(key, bgl_nodes[node], value)); + } + + void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) + { + edge_props.push_back(boost::make_tuple(key, bgl_edges[edge], value)); + } + + void + set_graph_property(const id_t& key, const id_t& value) + { + /* RG: pointer to graph prevents copying */ + put(key, dp_, &graph_, value); + } + + + protected: + CSRGraph& graph_; + dynamic_properties& dp_; + bgl_vertex_t vertex_count; + std::string node_id_prop_; + std::vector > vertex_props; + std::vector > edge_props; + std::vector > edges_to_add; + std::map bgl_nodes; + std::map bgl_edges; +}; + } } } // end namespace boost::detail::graph #ifdef BOOST_GRAPH_USE_SPIRIT_PARSER diff --git a/project/jni/boost/include/boost/graph/grid_graph.hpp b/project/jni/boost/include/boost/graph/grid_graph.hpp index f63f3d01e..9a09fca34 100644 --- a/project/jni/boost/include/boost/graph/grid_graph.hpp +++ b/project/jni/boost/include/boost/graph/grid_graph.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -31,11 +30,6 @@ #define BOOST_GRID_GRAPH_TYPE \ grid_graph -#define BOOST_GRID_GRAPH_TYPE_MEM typename BOOST_GRID_GRAPH_TYPE:: - -#define BOOST_GRID_GRAPH_TYPE_TD(mem) \ - typedef typename BOOST_GRID_GRAPH_TYPE::mem mem - #define BOOST_GRID_GRAPH_TRAITS_T \ typename graph_traits @@ -63,14 +57,21 @@ namespace boost { grid_graph_index_map() { } grid_graph_index_map(const Graph& graph) : - m_graph(make_shared(graph)) { } + m_graph(&graph) { } value_type operator[](key_type key) const { return (m_graph->index_of(key)); } + friend inline Index + get(const grid_graph_index_map& index_map, + const typename grid_graph_index_map::key_type& key) + { + return (index_map[key]); + } + protected: - shared_ptr m_graph; + const Graph* m_graph; }; template @@ -107,6 +108,13 @@ namespace boost { value_type operator[](const key_type& key) const { return (value_type(key.second, key.first)); } + + friend inline Descriptor + get(const grid_graph_reverse_edge_map& rev_map, + const typename grid_graph_reverse_edge_map::key_type& key) + { + return (rev_map[key]); + } }; template @@ -443,7 +451,7 @@ namespace boost { vertex_descriptor vertex_at (vertices_size_type vertex_index) const { - array vertex; + boost::array vertex; vertices_size_type index_divider = 1; for (std::size_t dimension_index = 0; @@ -533,6 +541,8 @@ namespace boost { vertex_descriptor source_vertex = source(edge, *this); vertex_descriptor target_vertex = target(edge, *this); + BOOST_ASSERT (source_vertex != target_vertex); + // Determine the dimension where the source and target vertices // differ (should only be one if this is a valid edge). std::size_t different_dimension_index = 0; @@ -733,13 +743,12 @@ namespace boost { // VertexListGraph //================ - template - friend inline std::pair - vertices(const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(vertex_iterator); - BOOST_GRID_GRAPH_TYPE_TD(vertex_function); - BOOST_GRID_GRAPH_TYPE_TD(vertex_index_iterator); + friend inline std::pair + vertices(const type& graph) { + typedef typename type::vertex_iterator vertex_iterator; + typedef typename type::vertex_function vertex_function; + typedef typename type::vertex_index_iterator vertex_index_iterator; return (std::make_pair (vertex_iterator(vertex_index_iterator(0), @@ -748,16 +757,14 @@ namespace boost { vertex_function(&graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type - num_vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::vertices_size_type + num_vertices(const type& graph) { return (graph.num_vertices()); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor - vertex(BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type vertex_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::vertex_descriptor + vertex(typename type::vertices_size_type vertex_index, + const type& graph) { return (graph.vertex_at(vertex_index)); } @@ -766,14 +773,13 @@ namespace boost { // IncidenceGraph //=============== - template - friend inline std::pair - out_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(out_edge_function); - BOOST_GRID_GRAPH_TYPE_TD(out_edge_iterator); + friend inline std::pair + out_edges(typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::degree_iterator degree_iterator; + typedef typename type::out_edge_function out_edge_function; + typedef typename type::out_edge_iterator out_edge_iterator; return (std::make_pair (out_edge_iterator(degree_iterator(0), @@ -782,19 +788,17 @@ namespace boost { out_edge_function(vertex, &graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + friend inline typename type::degree_size_type out_degree - (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.out_degree(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - out_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - BOOST_GRID_GRAPH_TYPE_MEM degree_size_type out_edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + out_edge_at(typename type::vertex_descriptor vertex, + typename type::degree_size_type out_edge_index, + const type& graph) { return (graph.out_edge_at(vertex, out_edge_index)); } @@ -802,14 +806,13 @@ namespace boost { // AdjacencyGraph //=============== - template - friend typename std::pair - adjacent_vertices (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(adjacent_vertex_function); - BOOST_GRID_GRAPH_TYPE_TD(adjacency_iterator); + friend typename std::pair + adjacent_vertices (typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::degree_iterator degree_iterator; + typedef typename type::adjacent_vertex_function adjacent_vertex_function; + typedef typename type::adjacency_iterator adjacency_iterator; return (std::make_pair (adjacency_iterator(degree_iterator(0), @@ -822,26 +825,23 @@ namespace boost { // EdgeListGraph //============== - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type - num_edges(const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edges_size_type + num_edges(const type& graph) { return (graph.num_edges()); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - edge_at(BOOST_GRID_GRAPH_TYPE_MEM edges_size_type edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + edge_at(typename type::edges_size_type edge_index, + const type& graph) { return (graph.edge_at(edge_index)); } - template - friend inline std::pair - edges(const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(edge_index_iterator); - BOOST_GRID_GRAPH_TYPE_TD(edge_function); - BOOST_GRID_GRAPH_TYPE_TD(edge_iterator); + friend inline std::pair + edges(const type& graph) { + typedef typename type::edge_index_iterator edge_index_iterator; + typedef typename type::edge_function edge_function; + typedef typename type::edge_iterator edge_iterator; return (std::make_pair (edge_iterator(edge_index_iterator(0), @@ -854,14 +854,13 @@ namespace boost { // BiDirectionalGraph //=================== - template - friend inline std::pair - in_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { - BOOST_GRID_GRAPH_TYPE_TD(in_edge_function); - BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); - BOOST_GRID_GRAPH_TYPE_TD(in_edge_iterator); + friend inline std::pair + in_edges(typename type::vertex_descriptor vertex, + const type& graph) { + typedef typename type::in_edge_function in_edge_function; + typedef typename type::degree_iterator degree_iterator; + typedef typename type::in_edge_iterator in_edge_iterator; return (std::make_pair (in_edge_iterator(degree_iterator(0), @@ -870,25 +869,22 @@ namespace boost { in_edge_function(vertex, &graph)))); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type - in_degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::degree_size_type + in_degree (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.in_degree(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type - degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::degree_size_type + degree (typename type::vertex_descriptor vertex, + const type& graph) { return (graph.out_degree(vertex) * 2); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor - in_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, - BOOST_GRID_GRAPH_TYPE_MEM degree_size_type in_edge_index, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend inline typename type::edge_descriptor + in_edge_at(typename type::vertex_descriptor vertex, + typename type::degree_size_type in_edge_index, + const type& graph) { return (graph.in_edge_at(vertex, in_edge_index)); } @@ -897,21 +893,20 @@ namespace boost { // Adjacency Matrix //================== - template - friend std::pair - edge (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor source_vertex, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor destination_vertex, - const BOOST_GRID_GRAPH_TYPE& graph) { + friend std::pair + edge (typename type::vertex_descriptor source_vertex, + typename type::vertex_descriptor destination_vertex, + const type& graph) { - std::pair edge_exists = + std::pair edge_exists = std::make_pair(std::make_pair(source_vertex, destination_vertex), false); for (std::size_t dimension_index = 0; dimension_index < Dimensions; ++dimension_index) { - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type dim_difference = 0; - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + typename type::vertices_size_type dim_difference = 0; + typename type::vertices_size_type source_dim = source_vertex[dimension_index], dest_dim = destination_vertex[dimension_index]; @@ -958,77 +953,54 @@ namespace boost { // Index Property Map Functions //============================= - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + friend inline typename type::vertices_size_type get(vertex_index_t, - const BOOST_GRID_GRAPH_TYPE& graph, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex) { + const type& graph, + typename type::vertex_descriptor vertex) { return (graph.index_of(vertex)); } - template - friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + friend inline typename type::edges_size_type get(edge_index_t, - const BOOST_GRID_GRAPH_TYPE& graph, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor edge) { + const type& graph, + typename type::edge_descriptor edge) { return (graph.index_of(edge)); } - template friend inline grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type> - get(vertex_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + type, + typename type::vertex_descriptor, + typename type::vertices_size_type> + get(vertex_index_t, const type& graph) { return (grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>(graph)); + type, + typename type::vertex_descriptor, + typename type::vertices_size_type>(graph)); } - template friend inline grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM edges_size_type> - get(edge_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + type, + typename type::edge_descriptor, + typename type::edges_size_type> + get(edge_index_t, const type& graph) { return (grid_graph_index_map< - BOOST_GRID_GRAPH_TYPE, - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, - BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>(graph)); + type, + typename type::edge_descriptor, + typename type::edges_size_type>(graph)); } - template friend inline grid_graph_reverse_edge_map< - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor> - get(edge_reverse_t, const BOOST_GRID_GRAPH_TYPE& graph) { + typename type::edge_descriptor> + get(edge_reverse_t, const type& graph) { return (grid_graph_reverse_edge_map< - BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor>()); + typename type::edge_descriptor>()); } - template - friend inline Index - get(const grid_graph_index_map& index_map, - const typename grid_graph_index_map::key_type& key) - { - return (index_map[key]); - } - template friend struct grid_graph_index_map; - template - friend inline Descriptor - get(const grid_graph_reverse_edge_map& rev_map, - const typename grid_graph_reverse_edge_map::key_type& key) - { - return (rev_map[key]); - } - template friend struct grid_graph_reverse_edge_map; @@ -1037,8 +1009,6 @@ namespace boost { } // namespace boost #undef BOOST_GRID_GRAPH_TYPE -#undef BOOST_GRID_GRAPH_TYPE_TD -#undef BOOST_GRID_GRAPH_TYPE_MEM #undef BOOST_GRID_GRAPH_TEMPLATE_PARAMS #undef BOOST_GRID_GRAPH_TRAITS_T diff --git a/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp b/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp index 8791b4cf1..d0a2aede9 100644 --- a/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp +++ b/project/jni/boost/include/boost/graph/is_kuratowski_subgraph.hpp @@ -9,7 +9,6 @@ #define __IS_KURATOWSKI_SUBGRAPH_HPP__ #include -#include //for next/prior #include //for tie #include #include @@ -176,7 +175,7 @@ namespace boost while (neighbors[v].size() > 0 && neighbors[v].size() < max_size) { - // Find one of v's neighbors u such that that v and u + // Find one of v's neighbors u such that v and u // have no neighbors in common. We'll look for such a // neighbor with a naive cubic-time algorithm since the // max size of any of the neighbor sets we'll consider @@ -301,11 +300,11 @@ namespace boost if (target_graph == detail::tg_k_5) { - return isomorphism(K_5,contracted_graph); + return boost::isomorphism(K_5,contracted_graph); } else //target_graph == tg_k_3_3 { - return isomorphism(K_3_3,contracted_graph); + return boost::isomorphism(K_3_3,contracted_graph); } diff --git a/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp b/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp index 74775b44f..c471cde8b 100644 --- a/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp +++ b/project/jni/boost/include/boost/graph/is_straight_line_drawing.hpp @@ -9,7 +9,7 @@ #define __IS_STRAIGHT_LINE_DRAWING_HPP__ #include -#include //for next and prior +#include #include #include #include @@ -19,6 +19,7 @@ #include #include #include +#include @@ -34,12 +35,12 @@ namespace boost // defines how far away from the endpoints of s1 and s2 we want to consider // an intersection. - bool intersects(double x1, double y1, - double x2, double y2, - double a1, double b1, - double a2, double b2, - double epsilon = 0.000001 - ) + inline bool intersects(double x1, double y1, + double x2, double y2, + double a1, double b1, + double a2, double b2, + double epsilon = 0.000001 + ) { if (x1 - x2 == 0) diff --git a/project/jni/boost/include/boost/graph/isomorphism.hpp b/project/jni/boost/include/boost/graph/isomorphism.hpp index bbdd1f7b4..99055f35c 100644 --- a/project/jni/boost/include/boost/graph/isomorphism.hpp +++ b/project/jni/boost/include/boost/graph/isomorphism.hpp @@ -11,8 +11,9 @@ #include #include #include +#include +#include #include -#include #include #include // for make_indirect_pmap #include @@ -134,6 +135,10 @@ namespace boost { bool test_isomorphism() { + // reset isomapping + BGL_FORALL_VERTICES_T(v, G1, Graph1) + f[v] = graph_traits::null_vertex(); + { std::vector invar1_array; BGL_FORALL_VERTICES_T(v, G1, Graph1) @@ -195,69 +200,130 @@ namespace boost { } private: + struct match_continuation { + enum {pos_G2_vertex_loop, pos_fi_adj_loop, pos_dfs_num} position; + typedef typename graph_traits::vertex_iterator vertex_iterator; + std::pair G2_verts; + typedef typename graph_traits::adjacency_iterator adjacency_iterator; + std::pair fi_adj; + edge_iter iter; + int dfs_num_k; + }; + bool match(edge_iter iter, int dfs_num_k) { + std::vector k; + typedef typename graph_traits::vertex_iterator vertex_iterator; + std::pair G2_verts(vertices(G2)); + typedef typename graph_traits::adjacency_iterator adjacency_iterator; + std::pair fi_adj; + vertex1_t i, j; + + recur: if (iter != ordered_edges.end()) { - vertex1_t i = source(*iter, G1), j = target(*iter, G2); + i = source(*iter, G1); + j = target(*iter, G2); if (dfs_num[i] > dfs_num_k) { - vertex1_t kp1 = dfs_vertices[dfs_num_k + 1]; - BGL_FORALL_VERTICES_T(u, G2, Graph2) { - if (invariant1(kp1) == invariant2(u) && in_S[u] == false) { - f[kp1] = u; - in_S[u] = true; - num_edges_on_k = 0; - - if (match(iter, dfs_num_k + 1)) -#if 0 - // dwa 2003/7/11 -- this *HAS* to be a bug! - ; -#endif - return true; + G2_verts = vertices(G2); + while (G2_verts.first != G2_verts.second) { + { + vertex2_t u = *G2_verts.first; + vertex1_t kp1 = dfs_vertices[dfs_num_k + 1]; + if (invariant1(kp1) == invariant2(u) && in_S[u] == false) { + { + f[kp1] = u; + in_S[u] = true; + num_edges_on_k = 0; - in_S[u] = false; + match_continuation new_k; + new_k.position = match_continuation::pos_G2_vertex_loop; + new_k.G2_verts = G2_verts; + new_k.iter = iter; + new_k.dfs_num_k = dfs_num_k; + k.push_back(new_k); + ++dfs_num_k; + goto recur; + } + } } +G2_loop_k: ++G2_verts.first; } } else if (dfs_num[j] > dfs_num_k) { - vertex1_t k = dfs_vertices[dfs_num_k]; - num_edges_on_k -= - count_if(adjacent_vertices(f[k], G2), make_indirect_pmap(in_S)); - - for (int jj = 0; jj < dfs_num_k; ++jj) { - vertex1_t j = dfs_vertices[jj]; - num_edges_on_k -= count(adjacent_vertices(f[j], G2), f[k]); + { + vertex1_t vk = dfs_vertices[dfs_num_k]; + num_edges_on_k -= + count_if(adjacent_vertices(f[vk], G2), make_indirect_pmap(in_S)); + + for (int jj = 0; jj < dfs_num_k; ++jj) { + vertex1_t j = dfs_vertices[jj]; + num_edges_on_k -= count(adjacent_vertices(f[j], G2), f[vk]); + } } if (num_edges_on_k != 0) - return false; - BGL_FORALL_ADJ_T(f[i], v, G2, Graph2) - if (invariant2(v) == invariant1(j) && in_S[v] == false) { - f[j] = v; - in_S[v] = true; - num_edges_on_k = 1; - BOOST_USING_STD_MAX(); - int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); - if (match(boost::next(iter), next_k)) - return true; - in_S[v] = false; + goto return_point_false; + fi_adj = adjacent_vertices(f[i], G2); + while (fi_adj.first != fi_adj.second) { + { + vertex2_t v = *fi_adj.first; + if (invariant2(v) == invariant1(j) && in_S[v] == false) { + f[j] = v; + in_S[v] = true; + num_edges_on_k = 1; + BOOST_USING_STD_MAX(); + int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); + match_continuation new_k; + new_k.position = match_continuation::pos_fi_adj_loop; + new_k.fi_adj = fi_adj; + new_k.iter = iter; + new_k.dfs_num_k = dfs_num_k; + ++iter; + dfs_num_k = next_k; + k.push_back(new_k); + goto recur; + } } - - +fi_adj_loop_k:++fi_adj.first; + } } else { if (container_contains(adjacent_vertices(f[i], G2), f[j])) { ++num_edges_on_k; - if (match(boost::next(iter), dfs_num_k)) - return true; + match_continuation new_k; + new_k.position = match_continuation::pos_dfs_num; + k.push_back(new_k); + ++iter; + goto recur; } } } else - return true; - return false; - } + goto return_point_true; + goto return_point_false; + { + return_point_true: return true; + + return_point_false: + if (k.empty()) return false; + const match_continuation& this_k = k.back(); + switch (this_k.position) { + case match_continuation::pos_G2_vertex_loop: {G2_verts = this_k.G2_verts; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*G2_verts.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto G2_loop_k;} + case match_continuation::pos_fi_adj_loop: {fi_adj = this_k.fi_adj; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*fi_adj.first] = false; i = source(*iter, G1); j = target(*iter, G2); goto fi_adj_loop_k;} + case match_continuation::pos_dfs_num: {k.pop_back(); goto return_point_false;} + default: { + BOOST_ASSERT(!"Bad position"); +#ifdef UNDER_CE + exit(-1); +#else + abort(); +#endif + } + } + } + } }; @@ -404,39 +470,68 @@ namespace boost { index_map1, index_map2 ); } + + template + struct make_degree_invariant { + const G& g; + const Index& index; + make_degree_invariant(const G& g, const Index& index): g(g), index(index) {} + typedef typename boost::graph_traits::degree_size_type degree_size_type; + typedef shared_array_property_map prop_map_type; + typedef degree_vertex_invariant result_type; + result_type operator()() const { + prop_map_type pm = make_shared_array_property_map(num_vertices(g), degree_size_type(), index); + compute_in_degree(g, pm); + return result_type(pm, g); + } + }; } // namespace detail + namespace graph { + namespace detail { + template + struct isomorphism_impl { + typedef bool result_type; + template + bool operator()(const Graph1& g1, const Graph2& g2, const ArgPack& arg_pack) const { + using namespace boost::graph::keywords; + typedef typename boost::detail::override_const_property_result::type index1_map_type; + typedef typename boost::detail::override_const_property_result::type index2_map_type; + index1_map_type index1_map = boost::detail::override_const_property(arg_pack, _vertex_index1_map, g1, boost::vertex_index); + index2_map_type index2_map = boost::detail::override_const_property(arg_pack, _vertex_index2_map, g2, boost::vertex_index); + typedef typename graph_traits::vertex_descriptor vertex2_t; + typename std::vector::size_type n = (typename std::vector::size_type)num_vertices(g1); + std::vector f(n); + typename boost::parameter::lazy_binding< + ArgPack, + tag::vertex_invariant1, + boost::detail::make_degree_invariant >::type + invariant1 = + arg_pack[_vertex_invariant1 || boost::detail::make_degree_invariant(g1, index1_map)]; + typename boost::parameter::lazy_binding< + ArgPack, + tag::vertex_invariant2, + boost::detail::make_degree_invariant >::type + invariant2 = + arg_pack[_vertex_invariant2 || boost::detail::make_degree_invariant(g2, index2_map)]; + return boost::isomorphism + (g1, g2, + choose_param(arg_pack[_isomorphism_map | boost::param_not_found()], + make_shared_array_property_map(num_vertices(g1), vertex2_t(), index1_map)), + invariant1, + invariant2, + arg_pack[_vertex_max_invariant | (invariant2.max)()], + index1_map, + index2_map); + } + }; + } + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(isomorphism, 2, 6) + } // Named parameter interface - template - bool isomorphism(const Graph1& g1, - const Graph2& g2, - const bgl_named_params& params) - { - typedef typename graph_traits::vertex_descriptor vertex2_t; - typename std::vector::size_type n = num_vertices(g1); - std::vector f(n); - return detail::isomorphism_impl - (g1, g2, - choose_param(get_param(params, vertex_isomorphism_t()), - make_safe_iterator_property_map(f.begin(), f.size(), - choose_const_pmap(get_param(params, vertex_index1), - g1, vertex_index), vertex2_t())), - choose_const_pmap(get_param(params, vertex_index1), g1, vertex_index), - choose_const_pmap(get_param(params, vertex_index2), g2, vertex_index), - params - ); - } - - // All defaults interface - template - bool isomorphism(const Graph1& g1, const Graph2& g2) - { - return isomorphism(g1, g2, - bgl_named_params(0));// bogus named param - } - + BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(isomorphism, 2) // Verify that the given mapping iso_map from the vertices of g1 to the // vertices of g2 describes an isomorphism. diff --git a/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp b/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp index 32e2b5cdc..b8da0fe19 100644 --- a/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp +++ b/project/jni/boost/include/boost/graph/johnson_all_pairs_shortest.hpp @@ -121,8 +121,6 @@ namespace boost { (g2, *u, pred, d, w_hat, id2, compare, combine, inf, zero,dvis); for (boost::tie(v, v_end) = vertices(g2); v != v_end; ++v) { if (*u != s && *v != s) { - typename Traits1::vertex_descriptor u1, v1; - u1 = verts1[get(id2, *u)]; v1 = verts1[get(id2, *v)]; D[get(id2, *u)-1][get(id2, *v)-1] = combine(get(d, *v), (get(h, *v) - get(h, *u))); } } diff --git a/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp b/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp index f8a210cab..63355c946 100644 --- a/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp +++ b/project/jni/boost/include/boost/graph/kamada_kawai_spring_layout.hpp @@ -475,12 +475,12 @@ namespace boost { * from every vertex to every other vertex, which is computed in the * first stages of the algorithm. This value's type must be a model * of BasicMatrix with value type equal to the value type of the - * weight map. The default is a a vector of vectors. + * weight map. The default is a vector of vectors. * * \param spring_strength (UTIL/OUT) will be used to store the * strength of the spring between every pair of vertices. This * value's type must be a model of BasicMatrix with value type equal - * to the value type of the weight map. The default is a a vector of + * to the value type of the weight map. The default is a vector of * vectors. * * \param partial_derivatives (UTIL) will be used to store the diff --git a/project/jni/boost/include/boost/graph/labeled_graph.hpp b/project/jni/boost/include/boost/graph/labeled_graph.hpp index e1a2f7c2d..5b688b02e 100644 --- a/project/jni/boost/include/boost/graph/labeled_graph.hpp +++ b/project/jni/boost/include/boost/graph/labeled_graph.hpp @@ -21,7 +21,7 @@ #include // This file implements a utility for creating mappings from arbitrary -// identifers to the vertices of a graph. +// identifiers to the vertices of a graph. namespace boost { @@ -104,7 +104,7 @@ namespace graph_detail { // Tag dispatch on random access containers (i.e., vectors). This function // basically requires a) that Container is vector

::template result::type& - choose_param(const P& param, const Default& d) { - return detail::choose_param_helper

::apply(param, d); + const P& choose_param(const P& param, const Default&) { + return param; + } + + template + Default choose_param(const param_not_found&, const Default& d) { + return d; } template inline bool is_default_param(const T&) { return false; } - inline bool is_default_param(const detail::error_property_not_found&) + inline bool is_default_param(const param_not_found&) { return true; } namespace detail { + template + struct const_type_as_type {typedef typename T::const_type type;}; + } // namespace detail + - struct choose_parameter { - template - struct bind_ { - typedef const P& const_result_type; - typedef const P& result_type; - typedef P type; - }; + // Use this function instead of choose_param() when you want + // to avoid requiring get(tag, g) when it is not used. + namespace detail { + template + struct choose_impl_result: + boost::mpl::eval_if< + boost::is_same, + boost::mpl::eval_if< + GraphIsConst, + detail::const_type_as_type >, + property_map >, + boost::mpl::identity > {}; - template - static typename bind_::const_result_type - const_apply(const P& p, const Graph&, Tag&) - { return p; } + // Parameters of f are (GraphIsConst, Graph, Param, Tag) + template struct choose_impl_helper; - template - static typename bind_::result_type - apply(const P& p, Graph&, Tag&) - { return p; } - }; - - struct choose_default_param { - template - struct bind_ { - typedef typename property_map::type - result_type; - typedef typename property_map::const_type - const_result_type; - typedef typename property_map::const_type - type; - }; - - template - static typename bind_::const_result_type - const_apply(const P&, const Graph& g, Tag tag) { - return get(tag, g); + template <> struct choose_impl_helper { + template + static typename property_map::type, PropertyTag>::const_type + f(boost::mpl::true_, const Graph& g, const Param&, PropertyTag tag) { + return get(tag, g); } - template - static typename bind_::result_type - apply(const P&, Graph& g, Tag tag) { - return get(tag, g); + + template + static typename property_map::type, PropertyTag>::type + f(boost::mpl::false_, Graph& g, const Param&, PropertyTag tag) { + return get(tag, g); } }; - template - struct choose_property_map { - typedef choose_parameter type; - }; - template <> - struct choose_property_map { - typedef choose_default_param type; + template <> struct choose_impl_helper { + template + static Param f(GraphIsConst, const Graph&, const Param& p, PropertyTag) { + return p; + } }; + } - template - struct choose_pmap_helper { - typedef typename choose_property_map::type Selector; - typedef typename Selector:: template bind_ Bind; - typedef Bind type; - typedef typename Bind::result_type result_type; - typedef typename Bind::const_result_type const_result_type; - typedef typename Bind::type result; - }; + template + typename detail::choose_impl_result::type + choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag) + { + return detail::choose_impl_helper::value> + ::f(boost::mpl::true_(), g, p, tag); + } + + template + typename detail::choose_impl_result::type + choose_pmap(const Param& p, Graph& g, PropertyTag tag) + { + return detail::choose_impl_helper::value> + ::f(boost::mpl::false_(), g, p, tag); + } + + namespace detail { // used in the max-flow algorithms template struct edge_capacity_value { typedef bgl_named_params Params; - typedef typename property_value< Params, edge_capacity_t>::type Param; - typedef typename detail::choose_pmap_helper::result CapacityEdgeMap; + typedef typename detail::choose_impl_result::type, edge_capacity_t>::type CapacityEdgeMap; typedef typename property_traits::value_type type; }; - } // namespace detail - - - // Use this function instead of choose_param() when you want - // to avoid requiring get(tag, g) when it is not used. - template - typename - detail::choose_pmap_helper::const_result_type - choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag) - { - typedef typename - detail::choose_pmap_helper::Selector Choice; - return Choice::const_apply(p, g, tag); - } - - template - typename detail::choose_pmap_helper::result_type - choose_pmap(const Param& p, Graph& g, PropertyTag tag) - { - typedef typename - detail::choose_pmap_helper::Selector Choice; - return Choice::apply(p, g, tag); } // Declare all new tags @@ -353,7 +357,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef convert_bgl_params_to_boost_parameter rest_conv; typedef boost::parameter::aux::arg_list type; static type conv(const T& x) { - return type(tagged_arg_type(x.m_value), rest_conv::conv(x)); + return type(tagged_arg_type(x.m_value), rest_conv::conv(x.m_base)); } }; @@ -362,7 +366,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef convert_bgl_params_to_boost_parameter rest_conv; typedef typename rest_conv::type type; static type conv(const bgl_named_params& x) { - return rest_conv::conv(x); + return rest_conv::conv(x.m_base); } }; @@ -375,7 +379,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template <> struct convert_bgl_params_to_boost_parameter { typedef boost::parameter::aux::empty_arg_list type; - static type conv(const boost::no_property&) {return type();} + static type conv(const boost::no_named_parameters&) {return type();} }; struct bgl_parameter_not_found_type {}; @@ -428,13 +432,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template struct override_property_t { typedef ArgType result_type; - result_type operator()(const Graph& g, const typename boost::add_reference::type a) const {return a;} + result_type operator()(const Graph&, const typename boost::add_reference::type a) const {return a;} }; template struct override_property_t { typedef typename boost::property_map::type result_type; - result_type operator()(const Graph& g, const ArgType& a) const {return get(Prop(), g);} + result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);} }; template @@ -451,7 +455,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template typename override_property_result::type - override_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop prop) { + override_property(const ArgPack& ap, const boost::parameter::keyword& t, const Graph& g, Prop) { return override_property_t< typename boost::parameter::value_type::type, Prop, @@ -460,6 +464,78 @@ BOOST_BGL_DECLARE_NAMED_PARAMS >()(g, ap[t | 0]); } + template struct make_arg_pack_type; + template <> struct make_arg_pack_type {typedef boost::parameter::aux::empty_arg_list type;}; + template + struct make_arg_pack_type { + typedef boost::parameter::aux::tagged_argument type; + }; + +#define BOOST_GRAPH_OPENING_PART_OF_PAIR(z, i, n) boost::parameter::aux::arg_list, +#define BOOST_GRAPH_MAKE_PAIR_PARAM(z, i, _) const boost::parameter::aux::tagged_argument& BOOST_PP_CAT(kw, i) + +#define BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION(z, i, _) \ + template \ + struct make_arg_pack_type { \ + typedef \ + BOOST_PP_REPEAT(i, BOOST_GRAPH_OPENING_PART_OF_PAIR, BOOST_PP_DEC(i)) boost::parameter::aux::empty_arg_list BOOST_PP_REPEAT(i, > BOOST_PP_TUPLE_EAT(3), ~) \ + type; \ + }; + BOOST_PP_REPEAT_FROM_TO(2, 11, BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION, ~) +#undef BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(name, nfixed, nnamed_max) \ + /* Entry point for conversion from BGL-style named parameters */ \ + template \ + typename boost::result_of< \ + detail::BOOST_PP_CAT(name, _impl)(BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const ArgPack&) \ + >::type \ + BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const ArgPack& arg_pack) { \ + return detail::BOOST_PP_CAT(name, _impl)()(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } \ + /* Individual functions taking Boost.Parameter-style keyword arguments */ \ + BOOST_PP_REPEAT(BOOST_PP_INC(nnamed_max), BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE, (name)(nfixed)) + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE(z, nnamed, seq) \ + BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, BOOST_PP_SEQ_ELEM(0, seq), BOOST_PP_SEQ_ELEM(1, seq)) + +#define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, name, nfixed) \ + template \ + typename boost::result_of< \ + detail::BOOST_PP_CAT(name, _impl) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \ + const typename boost::detail::make_arg_pack_type::type&) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) \ + BOOST_PP_ENUM_TRAILING(nnamed, BOOST_GRAPH_MAKE_PAIR_PARAM, ~)) { \ + return detail::BOOST_PP_CAT(name, _impl)() \ + (BOOST_PP_ENUM_PARAMS(nfixed, param), \ + (boost::parameter::aux::empty_arg_list() BOOST_PP_ENUM_TRAILING_PARAMS(nnamed, kw))); \ + } + +#define BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(name, nfixed) \ + template \ + typename boost::result_of< \ + ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \ + const typename boost::detail::convert_bgl_params_to_boost_parameter >::type &) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const boost::bgl_named_params& old_style_params) { \ + typedef boost::bgl_named_params old_style_params_type; \ + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(old_style_params_type, old_style_params) \ + return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } \ + \ + BOOST_PP_EXPR_IF(nfixed, template <) BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_EXPR_IF(nfixed, >) \ + BOOST_PP_EXPR_IF(nfixed, typename) boost::result_of< \ + ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \ + (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const boost::parameter::aux::empty_arg_list &) \ + >::type \ + name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param)) { \ + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(boost::no_named_parameters, boost::no_named_parameters()) \ + return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \ + } + } namespace detail { @@ -557,7 +633,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef Q priority_queue_type; static priority_queue_type - make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + make_queue(const Graph&, const ArgPack&, KeyT, const Q& q) { return q; } }; @@ -569,7 +645,7 @@ BOOST_BGL_DECLARE_NAMED_PARAMS typedef boost::d_ary_heap_indirect::helper::map_type, Compare> priority_queue_type; static priority_queue_type - make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q&) { return priority_queue_type( map_maker::make_map(g, ap, defaultKey), map_maker::make_map(g, ap, typename boost::property_traits::value_type(-1)) @@ -609,6 +685,13 @@ BOOST_BGL_DECLARE_NAMED_PARAMS make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { } + template + struct result { + typedef typename remove_const::arg1_type>::type>::type graph_type; + typedef typename remove_const::arg2_type>::type>::type arg_pack_type; + typedef typename priority_queue_maker::priority_queue_type type; + }; + template typename priority_queue_maker::priority_queue_type operator()(const Graph& g, const ArgPack& ap) const { @@ -616,6 +699,25 @@ BOOST_BGL_DECLARE_NAMED_PARAMS } }; + template + typename boost::graph_traits::vertex_descriptor + get_null_vertex(const G&) {return boost::graph_traits::null_vertex();} + + template + typename boost::graph_traits::vertex_descriptor + get_default_starting_vertex(const G& g) { + std::pair::vertex_iterator, typename boost::graph_traits::vertex_iterator> iters = vertices(g); + return (iters.first == iters.second) ? boost::graph_traits::null_vertex() : *iters.first; + } + + template + struct get_default_starting_vertex_t { + typedef typename boost::graph_traits::vertex_descriptor result_type; + const G& g; + get_default_starting_vertex_t(const G& g): g(g) {} + result_type operator()() const {return get_default_starting_vertex(g);} + }; + } // namespace detail } // namespace boost diff --git a/project/jni/boost/include/boost/graph/named_graph.hpp b/project/jni/boost/include/boost/graph/named_graph.hpp index 38f4ca0e1..4c687a086 100644 --- a/project/jni/boost/include/boost/graph/named_graph.hpp +++ b/project/jni/boost/include/boost/graph/named_graph.hpp @@ -11,14 +11,23 @@ #define BOOST_GRAPH_NAMED_GRAPH_HPP #include -#include -#include -#include +#include +#include +#include #include #include +#include #include +#include // for boost::lookup_one_property #include +#include // for boost::make_tuple +#include +#include +#include +#include +#include // for std::equal_to #include // for std::runtime_error +#include // for std::pair namespace boost { namespace graph { @@ -105,7 +114,7 @@ public: typedef vertex_name_type argument_type; typedef VertexProperty result_type; - VertexProperty operator()(const vertex_name_type& name) + VertexProperty operator()(const vertex_name_type&) { boost::throw_exception(std::runtime_error("add_vertex: " "unable to create a vertex from its name")); @@ -155,51 +164,6 @@ struct internal_vertex_constructor > : internal_vertex_constructor { }; #endif -/******************************************************************* - * Named graph-specific metafunctions * - *******************************************************************/ -namespace detail { - /** @internal - * Extracts the type of a bundled vertex property from a vertex - * property. The primary template matches when we have hit the end - * of the @c property<> list. - */ - template - struct extract_bundled_vertex - { - typedef VertexProperty type; - }; - - /** @internal - * Recursively extract the bundled vertex property from a vertex - * property. - */ - template - struct extract_bundled_vertex > - : extract_bundled_vertex - { }; - - /** - * We have found the bundled vertex property type, marked with - * vertex_bundle_t. - */ - template - struct extract_bundled_vertex > - { - typedef T type; - }; - - /** - * Translate @c no_property into @c error_property_not_found when we - * have failed to extract a bundled vertex property type. - */ - template<> - struct extract_bundled_vertex - { - typedef boost::detail::error_property_not_found type; - }; -} - /******************************************************************* * Named graph mixin * *******************************************************************/ @@ -228,7 +192,7 @@ public: typedef typename internal_vertex_name::type extract_name_type; /// The type of the "bundled" property, from which the name can be /// extracted. - typedef typename detail::extract_bundled_vertex::type + typedef typename lookup_one_property::type bundled_vertex_property_type; /// The type of the function object that generates vertex properties @@ -397,8 +361,15 @@ find_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, /// Retrieve the vertex associated with the given name, or add a new /// vertex with that name if no such vertex is available. +/// Note: This is enabled only when the vertex property type is different +/// from the vertex name to avoid ambiguous overload problems with +/// the add_vertex() function that takes a vertex property. template -Vertex + typename disable_if, +Vertex>::type add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, BGL_NAMED_GRAPH& g) { @@ -446,6 +417,35 @@ add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, g.derived()); } +// Overloads to support EdgeMutablePropertyGraph graphs +template +std::pair::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename edge_property_type::type const& p, + BGL_NAMED_GRAPH& g) { + return add_edge(u, add_vertex(v_name, g.derived()), p, g.derived()); +} + +template +std::pair::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + typename edge_property_type::type const& p, + BGL_NAMED_GRAPH& g) { + return add_edge(add_vertex(u_name, g.derived()), v, p, g.derived()); +} + +template +std::pair::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename edge_property_type::type const& p, + BGL_NAMED_GRAPH& g) { + return add_edge(add_vertex(u_name, g.derived()), + add_vertex(v_name, g.derived()), p, g.derived()); +} + #undef BGL_NAMED_GRAPH #undef BGL_NAMED_GRAPH_PARAMS @@ -477,7 +477,7 @@ struct maybe_named_graph { /// The type of the "bundled" property, from which the name can be /// extracted. - typedef typename detail::extract_bundled_vertex::type + typedef typename lookup_one_property::type bundled_vertex_property_type; /// Notify the named_graph that we have added the given vertex. This diff --git a/project/jni/boost/include/boost/graph/neighbor_bfs.hpp b/project/jni/boost/include/boost/graph/neighbor_bfs.hpp index 4585f2e29..4830dcc4e 100644 --- a/project/jni/boost/include/boost/graph/neighbor_bfs.hpp +++ b/project/jni/boost/include/boost/graph/neighbor_bfs.hpp @@ -250,13 +250,13 @@ namespace boost { }; template <> - struct neighbor_bfs_dispatch { + struct neighbor_bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { std::vector color_vec(num_vertices(g)); null_visitor null_vis; @@ -288,8 +288,7 @@ namespace boost { // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::neighbor_bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } diff --git a/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp b/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp index 6cb7bdb82..86203aaf3 100644 --- a/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp +++ b/project/jni/boost/include/boost/graph/planar_canonical_ordering.hpp @@ -12,7 +12,7 @@ #include #include #include -#include //for next and prior +#include #include #include diff --git a/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp b/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp index 71607fcbc..41ba2bc57 100644 --- a/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp +++ b/project/jni/boost/include/boost/graph/planar_detail/boyer_myrvold_impl.hpp @@ -10,7 +10,7 @@ #include #include -#include //for boost::next +#include #include //for std::min macros #include #include diff --git a/project/jni/boost/include/boost/graph/planar_face_traversal.hpp b/project/jni/boost/include/boost/graph/planar_face_traversal.hpp index bcd565528..6befa43ba 100644 --- a/project/jni/boost/include/boost/graph/planar_face_traversal.hpp +++ b/project/jni/boost/include/boost/graph/planar_face_traversal.hpp @@ -10,8 +10,11 @@ #define __PLANAR_FACE_TRAVERSAL_HPP__ #include -#include //for next and prior +#include +#include +#include #include +#include namespace boost diff --git a/project/jni/boost/include/boost/graph/properties.hpp b/project/jni/boost/include/boost/graph/properties.hpp index bc498bbf9..d540439ef 100644 --- a/project/jni/boost/include/boost/graph/properties.hpp +++ b/project/jni/boost/include/boost/graph/properties.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -68,26 +68,20 @@ namespace boost { struct vertex_property_tag { }; struct edge_property_tag { }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // See examples/edge_property.cpp for how to use this. #define BOOST_INSTALL_PROPERTY(KIND, NAME) \ template <> struct property_kind { \ typedef KIND##_property_tag type; \ } -#else -#define BOOST_INSTALL_PROPERTY(KIND, NAME) \ - template <> struct property_kind { \ - typedef KIND##_property_tag type; \ - } -#endif #define BOOST_DEF_PROPERTY(KIND, NAME) \ enum KIND##_##NAME##_t { KIND##_##NAME }; \ BOOST_INSTALL_PROPERTY(KIND, NAME) - BOOST_DEF_PROPERTY(vertex, all); - BOOST_DEF_PROPERTY(edge, all); - BOOST_DEF_PROPERTY(graph, all); + // These three are defined in boost/pending/property.hpp + BOOST_INSTALL_PROPERTY(vertex, all); + BOOST_INSTALL_PROPERTY(edge, all); + BOOST_INSTALL_PROPERTY(graph, all); BOOST_DEF_PROPERTY(vertex, index); BOOST_DEF_PROPERTY(vertex, index1); BOOST_DEF_PROPERTY(vertex, index2); @@ -128,10 +122,10 @@ namespace boost { BOOST_DEF_PROPERTY(graph, visitor); // These tags are used for property bundles - // BOOST_DEF_PROPERTY(graph, bundle); -- needed in graph_traits.hpp, so enum is defined there + // These three are defined in boost/pending/property.hpp BOOST_INSTALL_PROPERTY(graph, bundle); - BOOST_DEF_PROPERTY(vertex, bundle); - BOOST_DEF_PROPERTY(edge, bundle); + BOOST_INSTALL_PROPERTY(vertex, bundle); + BOOST_INSTALL_PROPERTY(edge, bundle); // These tags are used to denote the owners and local descriptors // for the vertices and edges of a distributed graph. @@ -148,6 +142,25 @@ namespace boost { namespace detail { + template + struct property_kind_from_graph: property_kind {}; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct property_kind_from_graph { + typedef typename boost::mpl::if_< + boost::is_base_of::type>, + vertex_property_tag, + typename boost::mpl::if_< + boost::is_base_of::type>, + edge_property_tag, + typename boost::mpl::if_< + boost::is_base_of::type>, + graph_property_tag, + void>::type>::type>::type type; + }; +#endif + struct dummy_edge_property_selector { template struct bind_ { @@ -192,70 +205,32 @@ namespace boost { }; template - struct edge_property_map { - typedef typename edge_property_type::type Property; - typedef typename graph_tag_or_void::type graph_tag; - typedef typename edge_property_selector::type Selector; - typedef typename Selector::template bind_ - Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; + struct edge_property_map + : edge_property_selector< + typename graph_tag_or_void::type + >::type::template bind_< + Graph, + typename edge_property_type::type, + PropertyTag> + {}; template - class vertex_property_map { - public: - typedef typename vertex_property_type::type Property; - typedef typename graph_tag_or_void::type graph_tag; - typedef typename vertex_property_selector::type Selector; - typedef typename Selector::template bind_ - Bind; - public: - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; - }; - - // This selects the kind of property map, whether is maps from - // edges or from vertices. - // - // It is overly complicated because it's a workaround for - // partial specialization. - struct choose_vertex_property_map { - template - struct bind_ { - typedef vertex_property_map type; - }; - }; - struct choose_edge_property_map { - template - struct bind_ { - typedef edge_property_map type; - }; - }; - template - struct property_map_kind_selector { - // VC++ gets confused if this isn't defined, even though - // this never gets used. - typedef choose_vertex_property_map type; - }; - template <> struct property_map_kind_selector { - typedef choose_vertex_property_map type; - }; - template <> struct property_map_kind_selector { - typedef choose_edge_property_map type; - }; + struct vertex_property_map + : vertex_property_selector< + typename graph_tag_or_void::type + >::type::template bind_< + Graph, + typename vertex_property_type::type, + PropertyTag> + {}; } // namespace detail - template - struct property_map { - // private: - typedef typename property_kind::type Kind; - typedef typename detail::property_map_kind_selector::type Selector; - typedef typename Selector::template bind_ Bind; - typedef typename Bind::type Map; - public: - typedef typename Map::type type; - typedef typename Map::const_type const_type; - }; + template + struct property_map: + mpl::if_< + is_same::type, edge_property_tag>, + detail::edge_property_map, + detail::vertex_property_map >::type + {}; // shortcut for accessing the value type of the property map template @@ -273,16 +248,8 @@ namespace boost { >::type type; }; - template - class vertex_property { - public: - typedef typename Graph::vertex_property_type type; - }; - template - class edge_property { - public: - typedef typename Graph::edge_property_type type; - }; + template struct vertex_property: vertex_property_type {}; + template struct edge_property: edge_property_type {}; template class degree_property_map @@ -383,99 +350,6 @@ namespace boost { # define BOOST_GRAPH_NO_BUNDLED_PROPERTIES #endif -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template - struct bundle_property_map - : put_get_helper > - { - typedef Descriptor key_type; - typedef typename remove_const::type value_type; - typedef T& reference; - typedef lvalue_property_map_tag category; - - bundle_property_map() { } - bundle_property_map(Graph* g_, T Bundle::* pm_) : g(g_), pm(pm_) {} - - reference operator[](key_type k) const { return (*g)[k].*pm; } - private: - Graph* g; - T Bundle::* pm; - }; - - namespace detail { - template - struct is_vertex_bundle - : mpl::and_, - mpl::and_ >, - mpl::not_ > > > - { }; - } - - // Specialize the property map template to generate bundled property maps. - template - struct property_map - { - private: - typedef graph_traits traits; - typedef typename Graph::vertex_bundled vertex_bundled; - typedef typename Graph::edge_bundled edge_bundled; - typedef typename mpl::if_c<(detail::is_vertex_bundle::value), - typename traits::vertex_descriptor, - typename traits::edge_descriptor>::type - descriptor; - typedef typename mpl::if_c<(detail::is_vertex_bundle::value), - vertex_bundled, - edge_bundled>::type - actual_bundle; - - public: - typedef bundle_property_map type; - typedef bundle_property_map - const_type; - }; -#endif - -// These metafunctions help implement the process of determining the vertex -// and edge properties of a graph. -namespace graph_detail { - template - struct retagged_property { - typedef typename Retag::type type; - }; - - // Search the normalized PropList (as returned by retagged<>::type) for - // the given bundle. Return the type error if no such bundle can be found. - template - struct retagged_bundle { - typedef typename property_value::type Value; - typedef typename mpl::if_< - is_same, no_bundle, Value - >::type type; - }; - - template - class normal_property { - // Normalize the property into a property list. - typedef detail::retag_property_list List; - public: - // Extract the normalized property and bundle types. - typedef typename retagged_property::type property; - typedef typename retagged_bundle::type bundle; - }; - - template - struct graph_prop : normal_property - { }; - - template - struct vertex_prop : normal_property - { }; - - template - struct edge_prop : normal_property - { }; -} // namespace graph_detail - // NOTE: These functions are declared, but never defined since they need to // be overloaded by graph implementations. However, we need them to be // declared for the functions below. @@ -498,17 +372,11 @@ get_property(Graph& g) { template inline typename graph_property::type const& -get_property(Graph const& g) { +get_property(const Graph& g) { return get_property(g, graph_bundle); } #endif } // namespace boost -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// Stay out of the way of the concept checking class -# undef Graph -# undef RandomAccessIterator -#endif - -#endif /* BOOST_GRAPH_PROPERTIES_HPPA */ +#endif /* BOOST_GRAPH_PROPERTIES_HPP */ diff --git a/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp b/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp index dd2461e7e..9d83ea18c 100644 --- a/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp +++ b/project/jni/boost/include/boost/graph/property_maps/constant_property_map.hpp @@ -54,6 +54,39 @@ inline constant_property_map make_constant_property(const Value& value) { return constant_property_map(value); } +/** + * Same as above, but pretends to be writable as well. + */ +template +struct constant_writable_property_map { + typedef Key key_type; + typedef Value value_type; + typedef Value& reference; + typedef boost::read_write_property_map_tag category; + + constant_writable_property_map() + : m_value() + { } + + constant_writable_property_map(const value_type &value) + : m_value(value) + { } + + constant_writable_property_map(const constant_writable_property_map& copy) + : m_value(copy.m_value) + { } + + friend Value get(const constant_writable_property_map& me, Key) {return me.m_value;} + friend void put(const constant_writable_property_map&, Key, Value) {} + + value_type m_value; +}; + +template +inline constant_writable_property_map +make_constant_writable_property(const Value& value) +{ return constant_writable_property_map(value); } + } /* namespace boost */ #endif diff --git a/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp b/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp index f6273481b..09ff55e34 100644 --- a/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp +++ b/project/jni/boost/include/boost/graph/property_maps/null_property_map.hpp @@ -29,7 +29,7 @@ namespace boost // The null_property_map only has a put() function. template - void put(null_property_map& pm, const K& key, const V& value) + void put(null_property_map& /*pm*/, const K& /*key*/, const V& /*value*/) { } // A helper function for intantiating null property maps. diff --git a/project/jni/boost/include/boost/graph/relax.hpp b/project/jni/boost/include/boost/graph/relax.hpp index 468579609..e3866df48 100644 --- a/project/jni/boost/include/boost/graph/relax.hpp +++ b/project/jni/boost/include/boost/graph/relax.hpp @@ -49,20 +49,30 @@ namespace boost { Vertex u = source(e, g), v = target(e, g); typedef typename property_traits::value_type D; typedef typename property_traits::value_type W; - D d_u = get(d, u), d_v = get(d, v); - W w_e = get(w, e); + const D d_u = get(d, u); + const D d_v = get(d, v); + const W& w_e = get(w, e); - // The redundant gets in the return statements are to ensure that extra - // floating-point precision in x87 registers does not lead to relax() - // returning true when the distance did not actually change. + // The seemingly redundant comparisons after the distance puts are to + // ensure that extra floating-point precision in x87 registers does not + // lead to relax() returning true when the distance did not actually + // change. if ( compare(combine(d_u, w_e), d_v) ) { put(d, v, combine(d_u, w_e)); - put(p, v, u); - return compare(get(d, v), d_v); + if (compare(get(d, v), d_v)) { + put(p, v, u); + return true; + } else { + return false; + } } else if (is_undirected && compare(combine(d_v, w_e), d_u)) { put(d, u, combine(d_v, w_e)); - put(p, u, v); - return compare(get(d, u), d_u); + if (compare(get(d, u), d_u)) { + put(p, u, v); + return true; + } else { + return false; + } } else return false; } diff --git a/project/jni/boost/include/boost/graph/reverse_graph.hpp b/project/jni/boost/include/boost/graph/reverse_graph.hpp index 48c4e0576..7985e97f0 100644 --- a/project/jni/boost/include/boost/graph/reverse_graph.hpp +++ b/project/jni/boost/include/boost/graph/reverse_graph.hpp @@ -105,6 +105,7 @@ class reverse_graph { typedef graph_traits Traits; public: typedef BidirectionalGraph base_type; + typedef GraphRef base_ref_type; // Constructor reverse_graph(GraphRef g) : m_g(g) {} @@ -358,47 +359,38 @@ namespace detail { } }; - struct reverse_graph_vertex_property_selector { - template - struct bind_ { - typedef typename ReverseGraph::base_type Graph; - typedef property_map PMap; - typedef typename PMap::type type; - typedef typename PMap::const_type const_type; - }; - }; - - struct reverse_graph_edge_property_selector { - template - struct bind_ { - typedef typename ReverseGraph::base_type Graph; - typedef property_map PMap; - typedef reverse_graph_edge_property_map type; - typedef reverse_graph_edge_property_map const_type; - }; - }; - } // namespace detail -template <> -struct vertex_property_selector { - typedef detail::reverse_graph_vertex_property_selector type; -}; - -template <> -struct edge_property_selector { - typedef detail::reverse_graph_edge_property_selector type; +template +struct property_map, Property> { + typedef boost::is_same::type, edge_property_tag> is_edge_prop; + typedef typename property_map::type orig_type; + typedef typename property_map::const_type orig_const_type; + typedef typename boost::mpl::if_, orig_type>::type type; + typedef typename boost::mpl::if_, orig_const_type>::type const_type; }; template -typename property_map, Property>::type +struct property_map, Property> { + typedef boost::is_same::type, edge_property_tag> is_edge_prop; + typedef typename property_map::const_type orig_const_type; + typedef typename boost::mpl::if_, orig_const_type>::type const_type; + typedef const_type type; +}; + +template +typename disable_if< + is_same, + typename property_map, Property>::type>::type get(Property p, reverse_graph& g) { return typename property_map, Property>::type(get(p, g.m_g)); } template -typename property_map, Property>::const_type +typename disable_if< + is_same, + typename property_map, Property>::const_type>::type get(Property p, const reverse_graph& g) { const BidirGraph& gref = g.m_g; // in case GRef is non-const @@ -406,9 +398,11 @@ get(Property p, const reverse_graph& g) } template -typename property_traits< - typename property_map::const_type ->::value_type +typename disable_if< + is_same, + typename property_traits< + typename property_map, Property>::const_type + >::value_type>::type get(Property p, const reverse_graph& g, const Key& k) { return get(get(p, g), k); @@ -439,7 +433,7 @@ namespace detail { { return m[k]; } -}; +} template struct property_traits > { @@ -459,19 +453,40 @@ struct property_map, edge_underlying_t> { typedef detail::underlying_edge_desc_map_type const_type; }; -template -detail::underlying_edge_desc_map_type::edge_descriptor> +template struct is_reverse_graph: boost::mpl::false_ {}; +template struct is_reverse_graph >: boost::mpl::true_ {}; + +template +typename enable_if, + detail::underlying_edge_desc_map_type::edge_descriptor> >::type get(edge_underlying_t, - const reverse_graph& g) + G&) { - return detail::underlying_edge_desc_map_type::edge_descriptor>(); + return detail::underlying_edge_desc_map_type::edge_descriptor>(); } -template -typename graph_traits::edge_descriptor +template +typename enable_if, typename graph_traits::edge_descriptor>::type get(edge_underlying_t, - const reverse_graph& g, - const typename graph_traits >::edge_descriptor& k) + G&, + const typename graph_traits::edge_descriptor& k) +{ + return k.underlying_descx; +} + +template +typename enable_if, detail::underlying_edge_desc_map_type::edge_descriptor> >::type +get(edge_underlying_t, + const G&) +{ + return detail::underlying_edge_desc_map_type::edge_descriptor>(); +} + +template +typename enable_if, typename graph_traits::edge_descriptor>::type +get(edge_underlying_t, + const G&, + const typename graph_traits::edge_descriptor& k) { return k.underlying_descx; } diff --git a/project/jni/boost/include/boost/graph/stanford_graph.hpp b/project/jni/boost/include/boost/graph/stanford_graph.hpp index 0bb798c0f..89f5e34b2 100644 --- a/project/jni/boost/include/boost/graph/stanford_graph.hpp +++ b/project/jni/boost/include/boost/graph/stanford_graph.hpp @@ -318,13 +318,15 @@ namespace boost { class sgb_vertex_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_vertex_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](Vertex* v) const { - return get_util_field(v, Tag()); + return get_util_field(v, tag); } }; @@ -333,13 +335,15 @@ namespace boost { class sgb_edge_util_map : public boost::put_get_helper > { + Tag tag; public: + explicit sgb_edge_util_map(Tag tag = Tag()): tag(tag) {} typedef boost::lvalue_property_map_tag category; typedef typename Tag::type value_type; typedef Vertex* key_type; typedef Ref reference; reference operator[](const sgb_edge& e) const { - return get_util_field(e._arc, Tag()); + return get_util_field(e._arc, tag); } }; diff --git a/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp b/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp index 814eae0ce..060f51b4a 100644 --- a/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp +++ b/project/jni/boost/include/boost/graph/stoer_wagner_min_cut.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace boost { @@ -218,7 +218,9 @@ namespace boost { typedef boost::bgl_named_params params_type; BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) - BOOST_AUTO(pq, (boost::detail::make_priority_queue_from_arg_pack_gen >(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0)))(g, arg_pack))); + typedef boost::detail::make_priority_queue_from_arg_pack_gen > gen_type; + gen_type gen(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0))); + typename boost::result_of::type pq = gen(g, arg_pack); return boost::detail::stoer_wagner_min_cut(g, weights, diff --git a/project/jni/boost/include/boost/graph/strong_components.hpp b/project/jni/boost/include/boost/graph/strong_components.hpp index ba5d45907..61345bdcb 100644 --- a/project/jni/boost/include/boost/graph/strong_components.hpp +++ b/project/jni/boost/include/boost/graph/strong_components.hpp @@ -131,7 +131,7 @@ namespace boost { template <> - struct strong_comp_dispatch2 { + struct strong_comp_dispatch2 { template inline static typename property_traits::value_type @@ -139,7 +139,7 @@ namespace boost { ComponentMap comp, RootMap r_map, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::vertices_size_type size_type; size_type n = num_vertices(g) > 0 ? num_vertices(g) : 1; @@ -179,7 +179,7 @@ namespace boost { } }; template <> - struct strong_comp_dispatch1 { + struct strong_comp_dispatch1 { template @@ -187,7 +187,7 @@ namespace boost { apply(const Graph& g, ComponentMap comp, const bgl_named_params& params, - detail::error_property_not_found) + param_not_found) { typedef typename graph_traits::vertex_descriptor Vertex; typename std::vector::size_type diff --git a/project/jni/boost/include/boost/graph/subgraph.hpp b/project/jni/boost/include/boost/graph/subgraph.hpp index b98c39026..22706bc61 100644 --- a/project/jni/boost/include/boost/graph/subgraph.hpp +++ b/project/jni/boost/include/boost/graph/subgraph.hpp @@ -24,7 +24,9 @@ #include #include -#include +#include +#include +#include namespace boost { @@ -103,13 +105,11 @@ public: typedef typename Traits::in_edge_iterator in_edge_iterator; - typedef typename Graph::edge_property_type edge_property_type; - typedef typename Graph::vertex_property_type vertex_property_type; - typedef typename Graph::vertex_bundled vertex_bundled; - typedef typename Graph::edge_bundled edge_bundled; + typedef typename edge_property_type::type edge_property_type; + typedef typename vertex_property_type::type vertex_property_type; typedef subgraph_tag graph_tag; typedef Graph graph_type; - typedef typename Graph::graph_property_type graph_property_type; + typedef typename graph_property_type::type graph_property_type; // Create the main graph, the root of the subgraph tree subgraph() @@ -131,15 +131,29 @@ public: // copy constructor subgraph(const subgraph& x) - : m_graph(x.m_graph), m_parent(x.m_parent), m_edge_counter(x.m_edge_counter) + : m_parent(x.m_parent), m_edge_counter(x.m_edge_counter) , m_global_vertex(x.m_global_vertex), m_global_edge(x.m_global_edge) { - // Do a deep copy (recursive). - for(typename ChildrenList::const_iterator i = x.m_children.begin(); - i != x.m_children.end(); ++i) + if(x.is_root()) { - m_children.push_back(new subgraph( **i )); + m_graph = x.m_graph; } + // Do a deep copy (recursive). + // Only the root graph is copied, the subgraphs contain + // only references to the global vertices they own. + typename subgraph::children_iterator i,i_end; + boost::tie(i,i_end) = x.children(); + for(; i != i_end; ++i) + { + subgraph child = this->create_subgraph(); + child = *i; + vertex_iterator vi,vi_end; + boost::tie(vi,vi_end) = vertices(*i); + for (;vi!=vi_end;++vi) + { + add_vertex(*vi,child); + } + } } @@ -334,9 +348,6 @@ public: // Probably shouldn't be public.... } }; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -// TODO: I don't think these are required since the default metafunction -// returns Graph::vertex_bundled. template struct vertex_bundle_type > : vertex_bundle_type @@ -346,7 +357,11 @@ template struct edge_bundle_type > : edge_bundle_type { }; -#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + +template +struct graph_bundle_type > + : graph_bundle_type +{ }; //=========================================================================== // Functions special to the Subgraph Class @@ -764,7 +779,10 @@ class subgraph_global_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; @@ -772,18 +790,19 @@ public: subgraph_global_property_map() { } - subgraph_global_property_map(GraphPtr g) - : m_g(g) + subgraph_global_property_map(GraphPtr g, Tag tag) + : m_g(g), m_tag(tag) { } reference operator[](key_type e) const { - PropertyMap pmap = get(Tag(), m_g->root().m_graph); + PropertyMap pmap = get(m_tag, m_g->root().m_graph); return m_g->is_root() ? pmap[e] : pmap[m_g->local_to_global(e)]; } GraphPtr m_g; + Tag m_tag; }; /** @@ -799,7 +818,10 @@ class subgraph_local_property_map { typedef property_traits Traits; public: - typedef typename Traits::category category; + typedef typename mpl::if_::type>, + readable_property_map_tag, + typename Traits::category>::type + category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; @@ -810,17 +832,18 @@ public: subgraph_local_property_map() { } - subgraph_local_property_map(GraphPtr g) - : m_g(g) + subgraph_local_property_map(GraphPtr g, Tag tag) + : m_g(g), m_tag(tag) { } reference operator[](key_type e) const { // Get property map on the underlying graph. - PropertyMap pmap = get(Tag(), m_g->m_graph); + PropertyMap pmap = get(m_tag, m_g->m_graph); return pmap[e]; } GraphPtr m_g; + Tag m_tag; }; namespace detail { @@ -935,139 +958,37 @@ struct edge_property_selector { typedef detail::subgraph_property_generator type; }; -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -/** @internal - * This property map implements local or global bundled property access on - * an underlying graph. The LocalGlobal template template parameter must be - * one of the local_property or global_property templates. - */ -template < - typename Graph, typename Descriptor, typename Bundle, typename T, - template class LocalGlobal> -struct subgraph_lg_bundle_property_map - : put_get_helper< - T&, - subgraph_lg_bundle_property_map - > -{ -private: - typedef LocalGlobal Wrap; -public: - typedef Descriptor key_type; - typedef typename remove_const::type value_type; - typedef T& reference; - typedef lvalue_property_map_tag category; - - subgraph_lg_bundle_property_map() - { } - - subgraph_lg_bundle_property_map(Graph* g, T Bundle::* p) - : m_g(g), m_prop(p) - { } - - reference operator[](key_type k) const - { return (*m_g)[Wrap(k)].*m_prop; } - -private: - Graph* m_g; - T Bundle::* m_prop; -}; - -// Specialize the property map template to generate bundled property maps. -// NOTE: I'm cheating (actually double-dipping) with the local/global subgraph -// property templates. I'm not using them store descriptors, just specialize -// the property map template for specific lookups. -namespace graph_detail { - // Help decoding some of the types required for property map definitions. - template - struct bundled_subgraph_pmap_helper { - typedef subgraph Subgraph; - typedef graph_traits Traits; - typedef typename Subgraph::vertex_bundled VertBundled; - typedef typename Subgraph::edge_bundled EdgeBundled; - - // Deduce the descriptor from the template params - typedef typename mpl::if_< - detail::is_vertex_bundle, - typename Traits::vertex_descriptor, typename Traits::edge_descriptor - >::type Desc; - - // Deduce the bundled property type - typedef typename mpl::if_< - detail::is_vertex_bundle, - VertBundled, EdgeBundled - >::type Prop; - }; -} // namespace graph_detail - -template -struct property_map, local_property > - : graph_detail::bundled_subgraph_pmap_helper -{ -private: - typedef graph_detail::bundled_subgraph_pmap_helper Base; - typedef typename Base::Subgraph Subgraph; - typedef typename Base::Desc Desc; - typedef typename Base::Prop Prop; -public: - typedef subgraph_lg_bundle_property_map< - Subgraph, Desc, Prop, T, local_property - > type; - typedef subgraph_lg_bundle_property_map< - Subgraph const, Desc, Prop, T const, local_property - > const_type; -}; - -template -struct property_map, global_property > - : graph_detail::bundled_subgraph_pmap_helper -{ -private: - typedef graph_detail::bundled_subgraph_pmap_helper Base; - typedef typename Base::Subgraph Subgraph; - typedef typename Base::Desc Desc; - typedef typename Base::Prop Prop; -public: - typedef subgraph_lg_bundle_property_map< - Subgraph, Desc, Prop, T, global_property - > type; - typedef subgraph_lg_bundle_property_map< - Subgraph const, Desc, Prop, T const, global_property - > const_type; -}; -#endif - // ================================================== // get(p, g), get(p, g, k), and put(p, g, k, v) // ================================================== template typename property_map, Property>::type -get(Property, subgraph& g) { +get(Property p, subgraph& g) { typedef typename property_map< subgraph, Property>::type PMap; - return PMap(&g); + return PMap(&g, p); } template typename property_map, Property>::const_type -get(Property, const subgraph& g) { +get(Property p, const subgraph& g) { typedef typename property_map< subgraph, Property>::const_type PMap; - return PMap(&g); + return PMap(&g, p); } template typename property_traits< typename property_map, Property>::const_type >::value_type -get(Property, const subgraph& g, const Key& k) { +get(Property p, const subgraph& g, const Key& k) { typedef typename property_map< subgraph, Property>::const_type PMap; - PMap pmap(&g); + PMap pmap(&g, p); return pmap[k]; } template -void put(Property, subgraph& g, const Key& k, const Value& val) { +void put(Property p, subgraph& g, const Key& k, const Value& val) { typedef typename property_map< subgraph, Property>::type PMap; - PMap pmap(&g); + PMap pmap(&g, p); pmap[k] = val; } @@ -1077,20 +998,20 @@ void put(Property, subgraph& g, const Key& k, const Value& val) { // ================================================== template typename property_map, global_property >::type -get(global_property, subgraph& g) { +get(global_property p, subgraph& g) { typedef typename property_map< subgraph, global_property >::type Map; - return Map(&g); + return Map(&g, p.value); } template typename property_map, global_property >::const_type -get(global_property, const subgraph& g) { +get(global_property p, const subgraph& g) { typedef typename property_map< subgraph, global_property >::const_type Map; - return Map(&g); + return Map(&g, p.value); } // ================================================== @@ -1099,112 +1020,22 @@ get(global_property, const subgraph& g) { // ================================================== template typename property_map, local_property >::type -get(local_property, subgraph& g) { +get(local_property p, subgraph& g) { typedef typename property_map< subgraph, local_property >::type Map; - return Map(&g); + return Map(&g, p.value); } template typename property_map, local_property >::const_type -get(local_property, const subgraph& g) { +get(local_property p, const subgraph& g) { typedef typename property_map< subgraph, local_property >::const_type Map; - return Map(&g); -} - -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -// ================================================== -// get(bundle(p), g) -// ================================================== - -template -inline typename property_map, T Bundle::*>::type -get(T Bundle::* p, subgraph& g) { - typedef typename property_map, T Bundle::*>::type Map; - return Map(&g, p); -} - -template -inline typename property_map, T Bundle::*>::const_type -get(T Bundle::* p, subgraph const& g) { - typedef typename property_map, T Bundle::*>::const_type Map; - return Map(&g, p); -} - -template -inline Type get(Type Bundle::* p, subgraph const& g, Key const& k) -{ return get(get(p, g), k); } - -template -inline void put(Type Bundle::* p, Graph& g, Key const& k, Value const& v) -{ put(get(p, g), k, v); } - -// ========================================================= -// Local bundled, get - -template -inline typename property_map< - subgraph, local_property ->::type -get(local_property p, subgraph& g) { - typedef typename property_map< - subgraph, local_property - >::type Map; return Map(&g, p.value); } -template -inline typename property_map< - subgraph, local_property ->::const_type -get(local_property p, subgraph const& g) { - typedef typename property_map< - subgraph, local_property - >::const_type Map; - return Map(&g, p.value); -} - -template -inline Type get(local_property p, subgraph const& g, - Key const& k) -{ return get(get(p, g), k); } - -// ========================================================= -// Global bundled, get - -template -inline typename property_map< - subgraph, global_property ->::type -get(global_property p, subgraph& g) { - typedef typename property_map< - subgraph, global_property - >::type Map; - return Map(&g, p.value); -} - -template -inline typename property_map< - subgraph, global_property ->::const_type -get(global_property p, subgraph const& g) { - typedef typename property_map< - subgraph, global_property - >::const_type Map; - return Map(&g, p.value); -} - -template -inline Type get(global_property p, subgraph const& g, - Key const& k) -{ return get(get(p, g), k); } - -#endif - template inline typename graph_property::type& get_property(subgraph& g, Tag tag) { diff --git a/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp b/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp index 2e7ebc97c..97ee89c44 100644 --- a/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp +++ b/project/jni/boost/include/boost/graph/tiernan_all_cycles.hpp @@ -64,7 +64,7 @@ namespace boost // basically modernized it to use real data structures (no more arrays and matrices). // Oh... and there's explicit control structures - not just gotos. // -// The problem is definitely NP-complete, an an unbounded implementation of this +// The problem is definitely NP-complete, an unbounded implementation of this // will probably run for quite a while on a large graph. The conclusions // of this paper also reference a Paton algorithm for undirected graphs as being // much more efficient (apparently based on spanning trees). Although not implemented, @@ -85,7 +85,7 @@ namespace boost // } /** - * The default cycle visitor providse an empty visit function for cycle + * The default cycle visitor provides an empty visit function for cycle * visitors. */ struct cycle_visitor @@ -168,7 +168,7 @@ namespace detail // conditions for allowing a traversal along this edge are: // 1. the index of v must be greater than that at which the - // the path is rooted (p.front()). + // path is rooted (p.front()). // 2. the vertex v cannot already be in the path // 3. the vertex v cannot be closed to the vertex u diff --git a/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp b/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp new file mode 100644 index 000000000..86d57ece0 --- /dev/null +++ b/project/jni/boost/include/boost/graph/two_graphs_common_spanning_trees.hpp @@ -0,0 +1,870 @@ +// Copyright (C) 2012, Michele Caini. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Two Graphs Common Spanning Trees Algorithm +// Based on academic article of Mint, Read and Tarjan +// Efficient Algorithm for Common Spanning Tree Problem +// Electron. Lett., 28 April 1983, Volume 19, Issue 9, p.346-347 + + +#ifndef BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP +#define BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost +{ + + +namespace detail { + + + template + < + typename TreeMap, + typename PredMap, + typename DistMap, + typename LowMap, + typename Buffer + > + struct bridges_visitor: public default_dfs_visitor + { + bridges_visitor( + TreeMap tree, + PredMap pred, + DistMap dist, + LowMap low, + Buffer& buffer + ): mTree(tree), mPred(pred), mDist(dist), mLow(low), mBuffer(buffer) + { mNum = -1; } + + template + void initialize_vertex(const Vertex& u, const Graph& g) + { + put(mPred, u, u); + put(mDist, u, -1); + } + + template + void discover_vertex(const Vertex& u, const Graph& g) + { + put(mDist, u, ++mNum); + put(mLow, u, get(mDist, u)); + } + + template + void tree_edge(const Edge& e, const Graph& g) + { + put(mPred, target(e, g), source(e, g)); + put(mTree, target(e, g), e); + } + + template + void back_edge(const Edge& e, const Graph& g) + { + put(mLow, source(e, g), + (std::min)(get(mLow, source(e, g)), get(mDist, target(e, g)))); + } + + template + void finish_vertex(const Vertex& u, const Graph& g) + { + Vertex parent = get(mPred, u); + if(get(mLow, u) > get(mDist, parent)) + mBuffer.push(get(mTree, u)); + put(mLow, parent, + (std::min)(get(mLow, parent), get(mLow, u))); + } + + TreeMap mTree; + PredMap mPred; + DistMap mDist; + LowMap mLow; + Buffer& mBuffer; + int mNum; + }; + + + template + struct cycle_finder: public base_visitor< cycle_finder > + { + typedef on_back_edge event_filter; + cycle_finder(): mBuffer(0) { } + cycle_finder(Buffer* buffer) + : mBuffer(buffer) { } + template + void operator()(const Edge& e, const Graph& g) + { + if(mBuffer) + mBuffer->push(e); + } + Buffer* mBuffer; + }; + + + template + struct deleted_edge_status + { + deleted_edge_status() { } + deleted_edge_status(DeletedMap map): mMap(map) { } + template + bool operator()(const Edge& e) const + { return (!get(mMap, e)); } + DeletedMap mMap; + }; + + + template + struct inL_edge_status + { + inL_edge_status() { } + inL_edge_status(InLMap map): mMap(map) { } + template + bool operator()(const Edge& e) const + { return get(mMap, e); } + InLMap mMap; + }; + + + template < + typename Graph, + typename Func, + typename Seq, + typename Map + > + void rec_two_graphs_common_spanning_trees + ( + const Graph& iG, + bimap< + bimaps::set_of, + bimaps::set_of< typename graph_traits::edge_descriptor > + > iG_bimap, + Map aiG_inL, + Map diG, + const Graph& vG, + bimap< + bimaps::set_of, + bimaps::set_of< typename graph_traits::edge_descriptor > + > vG_bimap, + Map avG_inL, + Map dvG, + Func func, + Seq inL + ) + { + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::vertex_descriptor vertex_descriptor; + typedef typename GraphTraits::edge_descriptor edge_descriptor; + + typedef typename Seq::size_type seq_size_type; + + int edges = num_vertices(iG) - 1; +// +// [ Michele Caini ] +// +// Using the condition (edges != 0) leads to the accidental submission of +// sub-graphs ((V-1+1)-fake-tree, named here fat-tree). +// Remove this condition is a workaround for the problem of fat-trees. +// Please do not add that condition, even if it improves performance. +// +// Here is proposed the previous guard (that was wrong): +// for(seq_size_type i = 0; (i < inL.size()) && (edges != 0); ++i) +// + { + for(seq_size_type i = 0; i < inL.size(); ++i) + if(inL[i]) + --edges; + + if(edges < 0) + return; + } + + bool is_tree = (edges == 0); + if(is_tree) { + func(inL); + } else { + std::map vertex_color; + std::map edge_color; + + std::stack iG_buf, vG_buf; + bool found = false; + + seq_size_type m; + for(seq_size_type j = 0; j < inL.size() && !found; ++j) { + if(!inL[j] + && !get(diG, iG_bimap.left.at(j)) + && !get(dvG, vG_bimap.left.at(j))) + { + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(iG_buf.empty() && vG_buf.empty()) { + inL[j] = true; + found = true; + m = j; + } else { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + } + + if(found) { + + std::stack iG_buf_copy, vG_buf_copy; + for(seq_size_type j = 0; j < inL.size(); ++j) { + if(!inL[j] + && !get(diG, iG_bimap.left.at(j)) + && !get(dvG, vG_bimap.left.at(j))) + { + + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf)), + associative_property_map< std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf)), + associative_property_map< std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf.empty() || !vG_buf.empty()) { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(diG, iG_bimap.left.at(j), true); + put(dvG, vG_bimap.left.at(j), true); + iG_buf_copy.push(iG_bimap.left.at(j)); + vG_buf_copy.push(vG_bimap.left.at(j)); + } + + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + + // REC + detail::rec_two_graphs_common_spanning_trees + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + while(!iG_buf_copy.empty()) { + put(diG, iG_buf_copy.top(), false); + put(dvG, vG_bimap.left.at( + iG_bimap.right.at(iG_buf_copy.top())), false); + iG_buf_copy.pop(); + } + while(!vG_buf_copy.empty()) { + put(dvG, vG_buf_copy.top(), false); + put(diG, iG_bimap.left.at( + vG_bimap.right.at(vG_buf_copy.top())), false); + vG_buf_copy.pop(); + } + + inL[m] = false; + put(aiG_inL, iG_bimap.left.at(m), false); + put(avG_inL, vG_bimap.left.at(m), false); + + put(diG, iG_bimap.left.at(m), true); + put(dvG, vG_bimap.left.at(m), true); + + std::map tree_map; + std::map pred_map; + std::map dist_map, low_map; + + detail::bridges_visitor< + associative_property_map< + std::map + >, + associative_property_map< + std::map + >, + associative_property_map< std::map >, + associative_property_map< std::map >, + std::stack + > + iG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map< + std::map< vertex_descriptor, int> >(dist_map), + associative_property_map< + std::map< vertex_descriptor, int> >(low_map), + iG_buf + ), + vG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map< + std::map< vertex_descriptor, int> >(dist_map), + associative_property_map< + std::map< vertex_descriptor, int> >(low_map), + vG_buf + ); + + undirected_dfs(make_filtered_graph(iG, + detail::deleted_edge_status< associative_property_map< + std::map > >(diG)), + iG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs(make_filtered_graph(vG, + detail::deleted_edge_status< associative_property_map< + std::map > >(dvG)), + vG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + found = false; + std::stack iG_buf_tmp, vG_buf_tmp; + while(!iG_buf.empty() && !found) { + if(!inL[iG_bimap.right.at(iG_buf.top())]) { + put(aiG_inL, iG_buf.top(), true); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf_tmp.empty() || !vG_buf_tmp.empty()) { + found = true; + } else { + while(!iG_buf_tmp.empty()) iG_buf_tmp.pop(); + while(!vG_buf_tmp.empty()) vG_buf_tmp.pop(); + iG_buf_copy.push(iG_buf.top()); + } + + put(aiG_inL, iG_buf.top(), false); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), false); + } + iG_buf.pop(); + } + while(!vG_buf.empty() && !found) { + if(!inL[vG_bimap.right.at(vG_buf.top())]) { + put(avG_inL, vG_buf.top(), true); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&iG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< + std::stack > (&vG_buf_tmp)), + associative_property_map< + std::map< + vertex_descriptor, default_color_type> >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf_tmp.empty() || !vG_buf_tmp.empty()) { + found = true; + } else { + while(!iG_buf_tmp.empty()) iG_buf_tmp.pop(); + while(!vG_buf_tmp.empty()) vG_buf_tmp.pop(); + vG_buf_copy.push(vG_buf.top()); + } + + put(avG_inL, vG_buf.top(), false); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), false); + } + vG_buf.pop(); + } + + if(!found) { + + while(!iG_buf_copy.empty()) { + inL[iG_bimap.right.at(iG_buf_copy.top())] = true; + put(aiG_inL, iG_buf_copy.top(), true); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf_copy.top())), true); + iG_buf.push(iG_buf_copy.top()); + iG_buf_copy.pop(); + } + while(!vG_buf_copy.empty()) { + inL[vG_bimap.right.at(vG_buf_copy.top())] = true; + put(avG_inL, vG_buf_copy.top(), true); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf_copy.top())), true); + vG_buf.push(vG_buf_copy.top()); + vG_buf_copy.pop(); + } + + // REC + detail::rec_two_graphs_common_spanning_trees< + Graph, Func, Seq, Map> + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + while(!iG_buf.empty()) { + inL[iG_bimap.right.at(iG_buf.top())] = false; + put(aiG_inL, iG_buf.top(), false); + put(avG_inL, vG_bimap.left.at( + iG_bimap.right.at(iG_buf.top())), false); + iG_buf.pop(); + } + while(!vG_buf.empty()) { + inL[vG_bimap.right.at(vG_buf.top())] = false; + put(avG_inL, vG_buf.top(), false); + put(aiG_inL, iG_bimap.left.at( + vG_bimap.right.at(vG_buf.top())), false); + vG_buf.pop(); + } + + } + + put(diG, iG_bimap.left.at(m), false); + put(dvG, vG_bimap.left.at(m), false); + + } + } + } + +} // namespace detail + + + +template +struct tree_collector +{ + +public: + BOOST_CONCEPT_ASSERT((BackInsertionSequence)); + BOOST_CONCEPT_ASSERT((RandomAccessContainer)); + BOOST_CONCEPT_ASSERT((CopyConstructible)); + + typedef typename Coll::value_type coll_value_type; + typedef typename Seq::value_type seq_value_type; + + BOOST_STATIC_ASSERT((is_same::value)); + BOOST_STATIC_ASSERT((is_same::value)); + + tree_collector(Coll& seqs): mSeqs(seqs) { } + + inline void operator()(Seq seq) + { mSeqs.push_back(seq); } + +private: + Coll& mSeqs; + +}; + + + +template < + typename Graph, + typename Order, + typename Func, + typename Seq +> +BOOST_CONCEPT_REQUIRES( + ((RandomAccessContainer)) + ((IncidenceGraphConcept)) + ((UnaryFunction)) + ((Mutable_RandomAccessContainer)) + ((VertexAndEdgeListGraphConcept)), + (void) +) +two_graphs_common_spanning_trees + ( + const Graph& iG, + Order iG_map, + const Graph& vG, + Order vG_map, + Func func, + Seq inL + ) +{ + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::directed_category directed_category; + typedef typename GraphTraits::vertex_descriptor vertex_descriptor; + typedef typename GraphTraits::edge_descriptor edge_descriptor; + + typedef typename GraphTraits::edges_size_type edges_size_type; + typedef typename GraphTraits::edge_iterator edge_iterator; + + typedef typename Seq::const_iterator seq_const_iterator; + typedef typename Seq::difference_type seq_diff_type; + typedef typename Seq::value_type seq_value_type; + typedef typename Seq::size_type seq_size_type; + typedef typename Seq::iterator seq_iterator; + + typedef typename Order::const_iterator order_const_iterator; + typedef typename Order::difference_type order_diff_type; + typedef typename Order::value_type order_value_type; + typedef typename Order::size_type order_size_type; + typedef typename Order::iterator order_iterator; + + BOOST_STATIC_ASSERT((is_same::value)); + BOOST_CONCEPT_ASSERT((Convertible)); + + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_STATIC_ASSERT((is_same::value)); + + BOOST_STATIC_ASSERT((is_same::value)); + + if(num_vertices(iG) != num_vertices(vG)) + return; + + if(inL.size() != num_edges(iG) + || inL.size() != num_edges(vG)) + return; + + if(iG_map.size() != num_edges(iG) + || vG_map.size() != num_edges(vG)) + return; + + typedef bimaps::bimap< + bimaps::set_of< int >, + bimaps::set_of< order_value_type > + > bimap_type; + typedef typename bimap_type::value_type bimap_value; + + bimap_type iG_bimap, vG_bimap; + for(order_size_type i = 0; i < iG_map.size(); ++i) + iG_bimap.insert(bimap_value(i, iG_map[i])); + for(order_size_type i = 0; i < vG_map.size(); ++i) + vG_bimap.insert(bimap_value(i, vG_map[i])); + + edge_iterator current, last; + boost::tuples::tie(current, last) = edges(iG); + for(; current != last; ++current) + if(iG_bimap.right.find(*current) == iG_bimap.right.end()) + return; + boost::tuples::tie(current, last) = edges(vG); + for(; current != last; ++current) + if(vG_bimap.right.find(*current) == vG_bimap.right.end()) + return; + + std::stack iG_buf, vG_buf; + + std::map tree_map; + std::map pred_map; + std::map dist_map, low_map; + + detail::bridges_visitor< + associative_property_map< + std::map + >, + associative_property_map< + std::map + >, + associative_property_map< std::map >, + associative_property_map< std::map >, + std::stack + > + iG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map >(dist_map), + associative_property_map >(low_map), + iG_buf + ), + vG_vis( + associative_property_map< + std::map< vertex_descriptor, edge_descriptor> >(tree_map), + associative_property_map< + std::map< vertex_descriptor, vertex_descriptor> >(pred_map), + associative_property_map >(dist_map), + associative_property_map >(low_map), + vG_buf + ); + + std::map vertex_color; + std::map edge_color; + + undirected_dfs(iG, iG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs(vG, vG_vis, + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + while(!iG_buf.empty()) { + inL[iG_bimap.right.at(iG_buf.top())] = true; + iG_buf.pop(); + } + while(!vG_buf.empty()) { + inL[vG_bimap.right.at(vG_buf.top())] = true; + vG_buf.pop(); + } + + std::map iG_inL, vG_inL; + associative_property_map< std::map > + aiG_inL(iG_inL), avG_inL(vG_inL); + + for(seq_size_type i = 0; i < inL.size(); ++i) + { + if(inL[i]) { + put(aiG_inL, iG_bimap.left.at(i), true); + put(avG_inL, vG_bimap.left.at(i), true); + } else { + put(aiG_inL, iG_bimap.left.at(i), false); + put(avG_inL, vG_bimap.left.at(i), false); + } + } + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(iG_buf.empty() && vG_buf.empty()) { + + std::map iG_deleted, vG_deleted; + associative_property_map< std::map > diG(iG_deleted); + associative_property_map< std::map > dvG(vG_deleted); + + boost::tuples::tie(current, last) = edges(iG); + for(; current != last; ++current) + put(diG, *current, false); + boost::tuples::tie(current, last) = edges(vG); + for(; current != last; ++current) + put(dvG, *current, false); + + for(seq_size_type j = 0; j < inL.size(); ++j) { + if(!inL[j]) { + put(aiG_inL, iG_bimap.left.at(j), true); + put(avG_inL, vG_bimap.left.at(j), true); + + undirected_dfs( + make_filtered_graph(iG, + detail::inL_edge_status< associative_property_map< + std::map > >(aiG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&iG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + undirected_dfs( + make_filtered_graph(vG, + detail::inL_edge_status< associative_property_map< + std::map > >(avG_inL)), + make_dfs_visitor( + detail::cycle_finder< std::stack > (&vG_buf)), + associative_property_map< + std::map >(vertex_color), + associative_property_map< + std::map >(edge_color) + ); + + if(!iG_buf.empty() || !vG_buf.empty()) { + while(!iG_buf.empty()) iG_buf.pop(); + while(!vG_buf.empty()) vG_buf.pop(); + put(diG, iG_bimap.left.at(j), true); + put(dvG, vG_bimap.left.at(j), true); + } + + put(aiG_inL, iG_bimap.left.at(j), false); + put(avG_inL, vG_bimap.left.at(j), false); + } + } + + int cc = 0; + + std::map com_map; + cc += connected_components( + make_filtered_graph(iG, + detail::deleted_edge_status > >(diG)), + associative_property_map >(com_map) + ); + cc += connected_components( + make_filtered_graph(vG, + detail::deleted_edge_status > >(dvG)), + associative_property_map< std::map >(com_map) + ); + + if(cc != 2) + return; + + // REC + detail::rec_two_graphs_common_spanning_trees > > + (iG, iG_bimap, aiG_inL, diG, vG, vG_bimap, aiG_inL, dvG, func, inL); + + } + +} + + +template < + typename Graph, + typename Func, + typename Seq +> +BOOST_CONCEPT_REQUIRES( + ((IncidenceGraphConcept)) + ((EdgeListGraphConcept)), + (void) +) +two_graphs_common_spanning_trees + ( + const Graph& iG, + const Graph& vG, + Func func, + Seq inL + ) +{ + typedef graph_traits GraphTraits; + + typedef typename GraphTraits::edge_descriptor edge_descriptor; + typedef typename GraphTraits::edges_size_type edges_size_type; + typedef typename GraphTraits::edge_iterator edge_iterator; + + std::vector iGO, vGO; + edge_iterator curr, last; + + boost::tuples::tie(curr, last) = edges(iG); + for(; curr != last; ++curr) + iGO.push_back(*curr); + + boost::tuples::tie(curr, last) = edges(vG); + for(; curr != last; ++curr) + vGO.push_back(*curr); + + two_graphs_common_spanning_trees(iG, iGO, vG, vGO, func, inL); +} + + +} // namespace boost + + +#endif // BOOST_GRAPH_TWO_GRAPHS_COMMON_SPANNING_TREES_HPP diff --git a/project/jni/boost/include/boost/graph/undirected_dfs.hpp b/project/jni/boost/include/boost/graph/undirected_dfs.hpp index df31d22b2..a3e1c038f 100644 --- a/project/jni/boost/include/boost/graph/undirected_dfs.hpp +++ b/project/jni/boost/include/boost/graph/undirected_dfs.hpp @@ -188,7 +188,7 @@ namespace boost { }; template <> - struct udfs_dispatch { + struct udfs_dispatch { template @@ -196,7 +196,7 @@ namespace boost { apply(const Graph& g, DFSVisitor vis, Vertex start_vertex, const bgl_named_params& params, EdgeColorMap edge_color, - detail::error_property_not_found) + param_not_found) { std::vector color_vec(num_vertices(g)); default_color_type c = white_color; // avoid warning about un-init @@ -219,8 +219,7 @@ namespace boost { undirected_dfs(const Graph& g, const bgl_named_params& params) { - typedef typename property_value< bgl_named_params, - vertex_color_t>::type C; + typedef typename get_param_type< vertex_color_t, bgl_named_params >::type C; detail::udfs_dispatch::apply (g, choose_param(get_param(params, graph_visitor), diff --git a/project/jni/boost/include/boost/graph/undirected_graph.hpp b/project/jni/boost/include/boost/graph/undirected_graph.hpp index 3178b42af..5c000dc2a 100644 --- a/project/jni/boost/include/boost/graph/undirected_graph.hpp +++ b/project/jni/boost/include/boost/graph/undirected_graph.hpp @@ -7,14 +7,12 @@ #ifndef BOOST_GRAPH_UNDIRECTED_GRAPH_HPP #define BOOST_GRAPH_UNDIRECTED_GRAPH_HPP -#include #include #include - -// NOTE: The retag_property_list is used to "normalize" a proeprty such that -// any non-property conforming parameter is wrapped in a vertex_bundle -// property. For example (with bad syntax) retag> -> property, -// but retag -> property. +#include +#include +#include +#include namespace boost { @@ -38,25 +36,23 @@ template < class undirected_graph { public: - typedef typename graph_detail::graph_prop::property graph_property_type; - typedef typename graph_detail::graph_prop::bundle graph_bundled; + typedef GraphProp graph_property_type; + typedef VertexProp vertex_property_type; + typedef EdgeProp edge_property_type; + typedef typename lookup_one_property::type graph_bundled; + typedef typename lookup_one_property::type vertex_bundled; + typedef typename lookup_one_property::type edge_bundled; - typedef typename graph_detail::vertex_prop::property vertex_property_type; - typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - - typedef typename graph_detail::edge_prop::property edge_property_type; - typedef typename graph_detail::edge_prop::bundle edge_bundled; - -private: +public: // Embed indices into the vertex type. - typedef property vertex_property; - typedef property edge_property; + typedef property internal_vertex_property; + typedef property internal_edge_property; public: typedef adjacency_list graph_type; private: @@ -159,7 +155,7 @@ public: { return make_index(boost::add_vertex(m_graph)); } vertex_descriptor add_vertex(vertex_property_type const& p) - { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + { return make_index(boost::add_vertex(internal_vertex_property(0u, p), m_graph)); } void clear_vertex(vertex_descriptor v) { std::pair @@ -196,7 +192,7 @@ public: std::pair add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) - { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + { return make_index(boost::add_edge(u, v, internal_edge_property(0u, p), m_graph)); } void remove_edge(vertex_descriptor u, vertex_descriptor v) { // find all edges, (u, v) @@ -530,36 +526,32 @@ remove_in_edge_if(typename UNDIRECTED_GRAPH::vertex_descriptor v, UNDIRECTED_GRAPH& g) { return remove_in_edge_if(v, pred, g.impl()); } -// Helper code for working with property maps -namespace detail { - struct undirected_graph_vertex_property_selector { - template - struct bind_ { - typedef typename UndirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; +template +struct property_map: property_map {}; - struct undirected_graph_edge_property_selector { - template - struct bind_ { - typedef typename UndirectedGraph::graph_type Graph; - typedef property_map PropertyMap; - typedef typename PropertyMap::type type; - typedef typename PropertyMap::const_type const_type; - }; - }; -} // namespace detail +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; -template <> -struct vertex_property_selector -{ typedef detail::undirected_graph_vertex_property_selector type; }; - -template <> -struct edge_property_selector -{ typedef detail::undirected_graph_edge_property_selector type; }; +template +struct property_map { + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::const_type> + const_type; + typedef transform_value_property_map< + detail::remove_first_property, + typename property_map::type> + type; +}; // PropertyGraph concepts template @@ -572,6 +564,26 @@ inline typename property_map::const_type get(Property p, UNDIRECTED_GRAPH const& g) { return get(p, g.impl()); } +template +inline typename property_map::type +get(vertex_all_t, UNDIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::const_type +get(vertex_all_t, UNDIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(vertex_all, g.impl())); } + +template +inline typename property_map::type +get(edge_all_t, UNDIRECTED_GRAPH& g) +{ return typename property_map::type(detail::remove_first_property(), get(edge_all, g.impl())); } + +template +inline typename property_map::const_type +get(edge_all_t, UNDIRECTED_GRAPH const& g) +{ return typename property_map::const_type(detail::remove_first_property(), get(edge_all, g.impl())); } + template inline typename property_traits< typename property_map< @@ -581,10 +593,40 @@ inline typename property_traits< get(Property p, UNDIRECTED_GRAPH const& g, Key const& k) { return get(p, g.impl(), k); } +template +inline typename property_traits< + typename property_map< + typename UNDIRECTED_GRAPH::graph_type, vertex_all_t + >::const_type +>::value_type +get(vertex_all_t, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(vertex_all, g.impl(), k).m_base; } + +template +inline typename property_traits< + typename property_map< + typename UNDIRECTED_GRAPH::graph_type, edge_all_t + >::const_type +>::value_type +get(edge_all_t, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(edge_all, g.impl(), k).m_base; } + template inline void put(Property p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) { put(p, g.impl(), k, v); } +template +inline void put(vertex_all_t, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(vertex_all, g.impl(), k, + typename UNDIRECTED_GRAPH::internal_vertex_property(get(vertex_index, g.impl(), k), v)); +} + +template +inline void put(edge_all_t, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(edge_all, g.impl(), k, + typename UNDIRECTED_GRAPH::internal_vertex_property(get(edge_index, g.impl(), k), v)); +} + template inline typename graph_property::type& get_property(UNDIRECTED_GRAPH& g, Property p) @@ -599,36 +641,6 @@ template inline void set_property(UNDIRECTED_GRAPH& g, Property p, Value v) { return set_property(g.impl(), p, v); } -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES -template -inline typename property_map::type -get(Type Bundle::* p, UNDIRECTED_GRAPH& g) { - typedef typename property_map< - UNDIRECTED_GRAPH, Type Bundle::* - >::type return_type; - return return_type(&g, p); -} - -template -inline typename property_map::const_type -get(Type Bundle::* p, UNDIRECTED_GRAPH const& g) { - typedef typename property_map< - UNDIRECTED_GRAPH, Type Bundle::* - >::const_type return_type; - return return_type(&g, p); -} - -template -inline Type -get(Type Bundle::* p, UNDIRECTED_GRAPH const& g, Key const& k) -{ return get(p, g.impl(), k); } - -template -inline void -put(Type Bundle::* p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) -{ put(p, g.impl(), k, v); } -#endif - // Indexed Vertex graph template diff --git a/project/jni/boost/include/boost/graph/vector_as_graph.hpp b/project/jni/boost/include/boost/graph/vector_as_graph.hpp index ee0df4bc9..7bc8ac380 100644 --- a/project/jni/boost/include/boost/graph/vector_as_graph.hpp +++ b/project/jni/boost/include/boost/graph/vector_as_graph.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -71,13 +72,14 @@ namespace boost { out_edge_iterator; typedef void in_edge_iterator; typedef void edge_iterator; - typedef typename integer_range::iterator vertex_iterator; + typedef counting_iterator vertex_iterator; typedef directed_tag directed_category; typedef allow_parallel_edge_tag edge_parallel_category; typedef vector_as_graph_traversal_tag traversal_category; typedef typename std::vector::size_type vertices_size_type; typedef void edges_size_type; typedef typename EdgeList::size_type degree_size_type; + static V null_vertex() {return V(-1);} }; template struct edge_property_type< std::vector > @@ -178,14 +180,11 @@ namespace boost { // source() and target() already provided for pairs in graph_traits.hpp template - std::pair - ::iterator, - typename boost::integer_range - ::iterator > + std::pair, + boost::counting_iterator > vertices(const std::vector& v) { - typedef typename boost::integer_range - ::iterator Iter; + typedef boost::counting_iterator Iter; return std::make_pair(Iter(0), Iter(v.size())); } diff --git a/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp b/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp new file mode 100755 index 000000000..89784dfe4 --- /dev/null +++ b/project/jni/boost/include/boost/graph/vf2_sub_graph_iso.hpp @@ -0,0 +1,1125 @@ +//======================================================================= +// Copyright (C) 2012 Flavio De Lorenzi (fdlorenzi@gmail.com) +// +// The algorithm implemented here is derived from original ideas by +// Pasquale Foggia and colaborators. For further information see +// e.g. Cordella et al. 2001, 2004. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= + +#ifndef BOOST_VF2_SUB_GRAPH_ISO_HPP +#define BOOST_VF2_SUB_GRAPH_ISO_HPP + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include // for always_equivalent +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_GRAPH_ITERATION_MACROS_HPP +#define BOOST_ISO_INCLUDED_ITER_MACROS // local macro, see bottom of file +#include +#endif + +namespace boost { + + // Default print_callback + template + struct vf2_print_callback { + + vf2_print_callback(const Graph1& graph1, const Graph2& graph2) + : graph1_(graph1), graph2_(graph2) {} + + template + bool operator()(CorrespondenceMap1To2 f, CorrespondenceMap2To1) const { + + // Print (sub)graph isomorphism map + BGL_FORALL_VERTICES_T(v, graph1_, Graph1) + std::cout << '(' << get(vertex_index_t(), graph1_, v) << ", " + << get(vertex_index_t(), graph1_, get(f, v)) << ") "; + + std::cout << std::endl; + + return true; + } + + private: + const Graph1& graph1_; + const Graph2& graph2_; + }; + + namespace detail { + + // State associated with a single graph (graph_this) + template + class base_state { + + typedef typename graph_traits::vertex_descriptor vertex_this_type; + typedef typename graph_traits::vertex_descriptor vertex_other_type; + + typedef typename graph_traits::vertices_size_type size_type; + + const GraphThis& graph_this_; + const GraphOther& graph_other_; + + IndexMapThis index_map_this_; + IndexMapOther index_map_other_; + + std::vector core_vec_; + typedef iterator_property_map::iterator, + IndexMapThis, vertex_other_type, + vertex_other_type&> core_map_type; + core_map_type core_; + + std::vector in_vec_, out_vec_; + typedef iterator_property_map::iterator, + IndexMapThis, size_type, size_type&> in_out_map_type; + in_out_map_type in_, out_; + + size_type term_in_count_, term_out_count_, term_both_count_, core_count_; + + // Forbidden + base_state(const base_state&); + base_state& operator=(const base_state&); + + public: + + base_state(const GraphThis& graph_this, const GraphOther& graph_other, + IndexMapThis index_map_this, IndexMapOther index_map_other) + : graph_this_(graph_this), graph_other_(graph_other), + index_map_this_(index_map_this), index_map_other_(index_map_other), + term_in_count_(0), term_out_count_(0), term_both_count_(0), core_count_(0) { + + core_vec_.resize(num_vertices(graph_this_), graph_traits::null_vertex()); + core_ = make_iterator_property_map(core_vec_.begin(), index_map_this_); + + in_vec_.resize(num_vertices(graph_this_), 0); + in_ = make_iterator_property_map(in_vec_.begin(), index_map_this_); + + out_vec_.resize(num_vertices(graph_this_), 0); + out_ = make_iterator_property_map(out_vec_.begin(), index_map_this_); + } + + // Adds a vertex pair to the state of graph graph_this + void push(const vertex_this_type& v_this, const vertex_other_type& v_other) { + + ++core_count_; + + put(core_, v_this, v_other); + + if (!get(in_, v_this)) { + put(in_, v_this, core_count_); + ++term_in_count_; + if (get(out_, v_this)) + ++term_both_count_; + } + + if (!get(out_, v_this)) { + put(out_, v_this, core_count_); + ++term_out_count_; + if (get(in_, v_this)) + ++term_both_count_; + } + + BGL_FORALL_INEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = source(e, graph_this_); + if (!get(in_, w)) { + put(in_, w, core_count_); + ++term_in_count_; + if (get(out_, w)) + ++term_both_count_; + } + } + + BGL_FORALL_OUTEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = target(e, graph_this_); + if (!get(out_, w)) { + put(out_, w, core_count_); + ++term_out_count_; + if (get(in_, w)) + ++term_both_count_; + } + } + + } + + // Removes vertex pair from state of graph_this + void pop(const vertex_this_type& v_this, const vertex_other_type&) { + + if (!core_count_) return; + + if (get(in_, v_this) == core_count_) { + put(in_, v_this, 0); + --term_in_count_; + if (get(out_, v_this)) + --term_both_count_; + } + + BGL_FORALL_INEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = source(e, graph_this_); + if (get(in_, w) == core_count_) { + put(in_, w, 0); + --term_in_count_; + if (get(out_, w)) + --term_both_count_; + } + } + + if (get(out_, v_this) == core_count_) { + put(out_, v_this, 0); + --term_out_count_; + if (get(in_, v_this)) + --term_both_count_; + } + + BGL_FORALL_OUTEDGES_T(v_this, e, graph_this_, GraphThis) { + vertex_this_type w = target(e, graph_this_); + if (get(out_, w) == core_count_) { + put(out_, w, 0); + --term_out_count_; + if (get(in_, w)) + --term_both_count_; + } + } + put(core_, v_this, graph_traits::null_vertex()); + + --core_count_; + + } + + // Returns true if the in-terminal set is not empty + bool term_in() const { + return core_count_ < term_in_count_ ; + } + + // Returns true if vertex belongs to the in-terminal set + bool term_in(const vertex_this_type& v) const { + return (get(in_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true if the out-terminal set is not empty + bool term_out() const { + return core_count_ < term_out_count_; + } + + // Returns true if vertex belongs to the out-terminal set + bool term_out(const vertex_this_type& v) const { + return (get(out_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true of both (in- and out-terminal) sets are not empty + bool term_both() const { + return core_count_ < term_both_count_; + } + + // Returns true if vertex belongs to both (in- and out-terminal) sets + bool term_both(const vertex_this_type& v) const { + return (get(in_, v) > 0) && (get(out_, v) > 0) && + (get(core_, v) == graph_traits::null_vertex()); + } + + // Returns true if vertex belongs to the core map, i.e. it is in the + // present mapping + bool in_core(const vertex_this_type& v) const { + return get(core_, v) != graph_traits::null_vertex(); + } + + // Returns the number of vertices in the mapping + size_type count() const { + return core_count_; + } + + // Returns the image (in graph_other) of vertex v (in graph_this) + vertex_other_type core(const vertex_this_type& v) const { + return get(core_, v); + } + + // Returns the mapping + core_map_type get_map() const { + return core_; + } + + // Returns the "time" (or depth) when vertex was added to the in-terminal set + size_type in_depth(const vertex_this_type& v) const { + return get(in_, v); + } + + // Returns the "time" (or depth) when vertex was added to the out-terminal set + size_type out_depth(const vertex_this_type& v) const { + return get(out_, v); + } + + // Returns the terminal set counts + boost::tuple + term_set() const { + return boost::make_tuple(term_in_count_, term_out_count_, + term_both_count_); + } + + }; + + + // Function object that checks whether a valid edge + // exists. For multi-graphs matched edges are excluded + template + struct equivalent_edge_exists { + typedef typename boost::graph_traits::edge_descriptor edge_type; + + BOOST_CONCEPT_ASSERT(( LessThanComparable )); + + template + bool operator()(typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + EdgePredicate is_valid_edge, const Graph& g) { + + BGL_FORALL_OUTEDGES_T(s, e, g, Graph) { + if ((target(e, g) == t) && is_valid_edge(e) && + (matched_edges_.find(e) == matched_edges_.end())) { + matched_edges_.insert(e); + return true; + } + } + + return false; + } + + private: + + std::set matched_edges_; + }; + + template + struct equivalent_edge_exists >::type> { + template + bool operator()(typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + EdgePredicate is_valid_edge, const Graph& g) { + + typename graph_traits::edge_descriptor e; + bool found; + boost::tie(e, found) = edge(s, t, g); + if (!found) + return false; + else if (is_valid_edge(e)) + return true; + + return false; + } + + }; + + + // Generates a predicate for edge e1 given a binary predicate and a + // fixed edge e2 + template + struct edge1_predicate { + + edge1_predicate(EdgeEquivalencePredicate edge_comp, + typename graph_traits::edge_descriptor e2) + : edge_comp_(edge_comp), e2_(e2) {} + + bool operator()(typename graph_traits::edge_descriptor e1) { + return edge_comp_(e1, e2_); + } + + EdgeEquivalencePredicate edge_comp_; + typename graph_traits::edge_descriptor e2_; + }; + + + // Generates a predicate for edge e2 given given a binary predicate and a + // fixed edge e1 + template + struct edge2_predicate { + + edge2_predicate(EdgeEquivalencePredicate edge_comp, + typename graph_traits::edge_descriptor e1) + : edge_comp_(edge_comp), e1_(e1) {} + + bool operator()(typename graph_traits::edge_descriptor e2) { + return edge_comp_(e1_, e2); + } + + EdgeEquivalencePredicate edge_comp_; + typename graph_traits::edge_descriptor e1_; + }; + + + enum problem_selector { subgraph_iso, isomorphism }; + + // The actual state associated with both graphs + template + class state { + + typedef typename graph_traits::vertex_descriptor vertex1_type; + typedef typename graph_traits::vertex_descriptor vertex2_type; + + typedef typename graph_traits::edge_descriptor edge1_type; + typedef typename graph_traits::edge_descriptor edge2_type; + + typedef typename graph_traits::vertices_size_type graph1_size_type; + typedef typename graph_traits::vertices_size_type graph2_size_type; + + const Graph1& graph1_; + const Graph2& graph2_; + + IndexMap1 index_map1_; + + EdgeEquivalencePredicate edge_comp_; + VertexEquivalencePredicate vertex_comp_; + + base_state state1_; + base_state state2_; + + // Two helper functions used in Feasibility and Valid functions to test + // terminal set counts when testing for: + // - graph sub-graph isomorphism, or + inline bool comp_term_sets(graph1_size_type a, + graph2_size_type b, + boost::mpl::int_) const { + return a <= b; + } + + // - graph isomorphism + inline bool comp_term_sets(graph1_size_type a, + graph2_size_type b, + boost::mpl::int_) const { + return a == b; + } + + // Forbidden + state(const state&); + state& operator=(const state&); + + public: + + state(const Graph1& graph1, const Graph2& graph2, + IndexMap1 index_map1, IndexMap2 index_map2, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) + : graph1_(graph1), graph2_(graph2), + index_map1_(index_map1), + edge_comp_(edge_comp), vertex_comp_(vertex_comp), + state1_(graph1, graph2, index_map1, index_map2), + state2_(graph2, graph1, index_map2, index_map1) {} + + // Add vertex pair to the state + void push(const vertex1_type& v, const vertex2_type& w) { + state1_.push(v, w); + state2_.push(w, v); + } + + // Remove vertex pair from state + void pop(const vertex1_type& v, const vertex2_type&) { + vertex2_type w = state1_.core(v); + state1_.pop(v, w); + state2_.pop(w, v); + } + + // Checks the feasibility of a new vertex pair + bool feasible(const vertex1_type& v_new, const vertex2_type& w_new) { + + if (!vertex_comp_(v_new, w_new)) return false; + + // graph1 + graph1_size_type term_in1_count = 0, term_out1_count = 0, rest1_count = 0; + + { + equivalent_edge_exists edge2_exists; + + BGL_FORALL_INEDGES_T(v_new, e1, graph1_, Graph1) { + vertex1_type v = source(e1, graph1_); + + if (state1_.in_core(v) || (v == v_new)) { + vertex2_type w = w_new; + if (v != v_new) + w = state1_.core(v); + if (!edge2_exists(w, w_new, + edge2_predicate(edge_comp_, e1), + graph2_)) + return false; + + } else { + if (0 < state1_.in_depth(v)) + ++term_in1_count; + if (0 < state1_.out_depth(v)) + ++term_out1_count; + if ((state1_.in_depth(v) == 0) && (state1_.out_depth(v) == 0)) + ++rest1_count; + } + } + } + + { + equivalent_edge_exists edge2_exists; + + BGL_FORALL_OUTEDGES_T(v_new, e1, graph1_, Graph1) { + vertex1_type v = target(e1, graph1_); + if (state1_.in_core(v) || (v == v_new)) { + vertex2_type w = w_new; + if (v != v_new) + w = state1_.core(v); + + if (!edge2_exists(w_new, w, + edge2_predicate(edge_comp_, e1), + graph2_)) + return false; + + } else { + if (0 < state1_.in_depth(v)) + ++term_in1_count; + if (0 < state1_.out_depth(v)) + ++term_out1_count; + if ((state1_.in_depth(v) == 0) && (state1_.out_depth(v) == 0)) + ++rest1_count; + } + } + } + + // graph2 + graph2_size_type term_out2_count = 0, term_in2_count = 0, rest2_count = 0; + + { + equivalent_edge_exists edge1_exists; + + BGL_FORALL_INEDGES_T(w_new, e2, graph2_, Graph2) { + vertex2_type w = source(e2, graph2_); + if (state2_.in_core(w) || (w == w_new)) { + vertex1_type v = v_new; + if (w != w_new) + v = state2_.core(w); + + if (!edge1_exists(v, v_new, + edge1_predicate(edge_comp_, e2), + graph1_)) + return false; + + } else { + if (0 < state2_.in_depth(w)) + ++term_in2_count; + if (0 < state2_.out_depth(w)) + ++term_out2_count; + if ((state2_.in_depth(w) == 0) && (state2_.out_depth(w) == 0)) + ++rest2_count; + } + } + } + + { + equivalent_edge_exists edge1_exists; + + BGL_FORALL_OUTEDGES_T(w_new, e2, graph2_, Graph2) { + vertex2_type w = target(e2, graph2_); + if (state2_.in_core(w) || (w == w_new)) { + vertex1_type v = v_new; + if (w != w_new) + v = state2_.core(w); + + if (!edge1_exists(v_new, v, + edge1_predicate(edge_comp_, e2), + graph1_)) + return false; + + } else { + if (0 < state2_.in_depth(w)) + ++term_in2_count; + if (0 < state2_.out_depth(w)) + ++term_out2_count; + if ((state2_.in_depth(w) == 0) && (state2_.out_depth(w) == 0)) + ++rest2_count; + } + } + } + + return comp_term_sets(term_in1_count, term_in2_count, + boost::mpl::int_()) && + comp_term_sets(term_out1_count, term_out2_count, + boost::mpl::int_()) && + comp_term_sets(rest1_count, rest2_count, + boost::mpl::int_()); + } + + // Returns true if vertex v in graph1 is a possible candidate to + // be added to the current state + bool possible_candidate1(const vertex1_type& v) const { + if (state1_.term_both() && state2_.term_both()) + return state1_.term_both(v); + else if (state1_.term_out() && state2_.term_out()) + return state1_.term_out(v); + else if (state1_.term_in() && state2_.term_in()) + return state1_.term_in(v); + else + return !state1_.in_core(v); + } + + // Returns true if vertex w in graph2 is a possible candidate to + // be added to the current state + bool possible_candidate2(const vertex2_type& w) const { + if (state1_.term_both() && state2_.term_both()) + return state2_.term_both(w); + else if (state1_.term_out() && state2_.term_out()) + return state2_.term_out(w); + else if (state1_.term_in() && state2_.term_in()) + return state2_.term_in(w); + else + return !state2_.in_core(w); + } + + // Returns true if a mapping was found + bool success() const { + return state1_.count() == num_vertices(graph1_); + } + + // Returns true if a state is valid + bool valid() const { + boost::tuple term1; + boost::tuple term2; + + term1 = state1_.term_set(); + term2 = state2_.term_set(); + + return comp_term_sets(boost::get<0>(term1), boost::get<0>(term2), + boost::mpl::int_()) && + comp_term_sets(boost::get<1>(term1), boost::get<1>(term2), + boost::mpl::int_()) && + comp_term_sets(boost::get<2>(term1), boost::get<2>(term2), + boost::mpl::int_()); + } + + // Calls the user_callback with a graph (sub)graph mapping + bool call_back(SubGraphIsoMapCallback user_callback) const { + return user_callback(state1_.get_map(), state2_.get_map()); + } + + }; + + + // Data structure to keep info used for back tracking during + // matching process + template + struct vf2_match_continuation { + typename VertexOrder1::const_iterator graph1_verts_iter; + typename graph_traits::vertex_iterator graph2_verts_iter; + }; + + // Non-recursive method that explores state space using a depth-first + // search strategy. At each depth possible pairs candidate are compute + // and tested for feasibility to extend the mapping. If a complete + // mapping is found, the mapping is output to user_callback in the form + // of a correspondence map (graph1 to graph2). Returning false from the + // user_callback will terminate the search. Function match will return + // true if the entire search space was explored. + template + bool match(const Graph1& graph1, const Graph2& graph2, + SubGraphIsoMapCallback user_callback, const VertexOrder1& vertex_order1, + state& s) { + + typename VertexOrder1::const_iterator graph1_verts_iter; + + typedef typename graph_traits::vertex_iterator vertex2_iterator_type; + vertex2_iterator_type graph2_verts_iter, graph2_verts_iter_end; + + typedef vf2_match_continuation match_continuation_type; + std::vector k; + + recur: + if (s.success()) { + if (!s.call_back(user_callback)) + return false; + + goto back_track; + } + + if (!s.valid()) + goto back_track; + + graph1_verts_iter = vertex_order1.begin(); + while (graph1_verts_iter != vertex_order1.end() && + !s.possible_candidate1(*graph1_verts_iter)) { + ++graph1_verts_iter; + } + + boost::tie(graph2_verts_iter, graph2_verts_iter_end) = vertices(graph2); + while (graph2_verts_iter != graph2_verts_iter_end) { + if (s.possible_candidate2(*graph2_verts_iter)) { + if (s.feasible(*graph1_verts_iter, *graph2_verts_iter)) { + match_continuation_type kk; + kk.graph1_verts_iter = graph1_verts_iter; + kk.graph2_verts_iter = graph2_verts_iter; + k.push_back(kk); + + s.push(*graph1_verts_iter, *graph2_verts_iter); + goto recur; + } + } + graph2_loop: ++graph2_verts_iter; + } + + back_track: + if (k.empty()) + return true; + + const match_continuation_type kk = k.back(); + graph1_verts_iter = kk.graph1_verts_iter; + graph2_verts_iter = kk.graph2_verts_iter; + k.pop_back(); + + s.pop(*graph1_verts_iter, *graph2_verts_iter); + + goto graph2_loop; + } + + + // Used to sort nodes by in/out degrees + template + struct vertex_in_out_degree_cmp { + typedef typename graph_traits::vertex_descriptor vertex_type; + + vertex_in_out_degree_cmp(const Graph& graph) + : graph_(graph) {} + + bool operator()(const vertex_type& v, const vertex_type& w) const { + // lexicographical comparison + return std::make_pair(in_degree(v, graph_), out_degree(v, graph_)) < + std::make_pair(in_degree(w, graph_), out_degree(w, graph_)); + } + + const Graph& graph_; + }; + + + // Used to sort nodes by multiplicity of in/out degrees + template + struct vertex_frequency_degree_cmp { + typedef typename graph_traits::vertex_descriptor vertex_type; + + vertex_frequency_degree_cmp(const Graph& graph, FrequencyMap freq) + : graph_(graph), freq_(freq) {} + + bool operator()(const vertex_type& v, const vertex_type& w) const { + // lexicographical comparison + return std::make_pair(freq_[v], in_degree(v, graph_)+out_degree(v, graph_)) < + std::make_pair(freq_[w], in_degree(w, graph_)+out_degree(w, graph_)); + } + + const Graph& graph_; + FrequencyMap freq_; + }; + + + // Sorts vertices of a graph by multiplicity of in/out degrees + template + void sort_vertices(const Graph& graph, IndexMap index_map, VertexOrder& order) { + typedef typename graph_traits::vertices_size_type size_type; + + boost::range::sort(order, vertex_in_out_degree_cmp(graph)); + + std::vector freq_vec(num_vertices(graph), 0); + typedef iterator_property_map::iterator, + IndexMap, size_type, size_type&> frequency_map_type; + + frequency_map_type freq = make_iterator_property_map(freq_vec.begin(), index_map); + + typedef typename VertexOrder::iterator order_iterator; + + for (order_iterator order_iter = order.begin(); order_iter != order.end(); ) { + size_type count = 0; + for (order_iterator count_iter = order_iter; + (count_iter != order.end()) && + (in_degree(*order_iter, graph) == in_degree(*count_iter, graph)) && + (out_degree(*order_iter, graph) == out_degree(*count_iter, graph)); + ++count_iter) + ++count; + + for (size_type i = 0; i < count; ++i) { + freq[*order_iter] = count; + ++order_iter; + } + } + + boost::range::sort(order, vertex_frequency_degree_cmp(graph, freq)); + + } + + } // namespace detail + + + // Returns vertex order (vertices sorted by multiplicity of in/out degrees) + template + std::vector::vertex_descriptor> + vertex_order_by_mult(const Graph& graph) { + + std::vector::vertex_descriptor> vertex_order; + std::copy(vertices(graph).first, vertices(graph).second, std::back_inserter(vertex_order)); + + detail::sort_vertices(graph, get(vertex_index, graph), vertex_order); + return vertex_order; + } + + + // Enumerates all graph sub-graph isomorphism mappings between graphs + // graph_small and graph_large. Continues until user_callback returns true or the + // search space has been fully explored. + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback, + IndexMapSmall index_map_small, IndexMapLarge index_map_large, + const VertexOrderSmall& vertex_order_small, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + // Graph requirements + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + typedef typename graph_traits::vertex_descriptor vertex_small_type; + typedef typename graph_traits::vertex_descriptor vertex_large_type; + + typedef typename graph_traits::vertices_size_type size_type_small; + typedef typename graph_traits::vertices_size_type size_type_large; + + // Property map requirements + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMapSmallValue; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMapLargeValue; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + // Edge & vertex requirements + typedef typename graph_traits::edge_descriptor edge_small_type; + typedef typename graph_traits::edge_descriptor edge_large_type; + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + // Vertex order requirements + BOOST_CONCEPT_ASSERT(( ContainerConcept )); + typedef typename VertexOrderSmall::value_type order_value_type; + BOOST_STATIC_ASSERT(( is_same::value )); + BOOST_ASSERT( num_vertices(graph_small) == vertex_order_small.size() ); + + if (num_vertices(graph_small) > num_vertices(graph_large)) + return false; + + typename graph_traits::edges_size_type num_edges_small = num_edges(graph_small); + typename graph_traits::edges_size_type num_edges_large = num_edges(graph_large); + + // Double the number of edges for undirected graphs: each edge counts as + // in-edge and out-edge + if (is_undirected(graph_small)) num_edges_small *= 2; + if (is_undirected(graph_large)) num_edges_large *= 2; + if (num_edges_small > num_edges_large) + return false; + + if ((num_vertices(graph_small) == 0) && (num_vertices(graph_large) == 0)) + return true; + + detail::state + s(graph_small, graph_large, index_map_small, index_map_large, edge_comp, vertex_comp); + + return detail::match(graph_small, graph_large, user_callback, vertex_order_small, s); + } + + + // All default interface for vf2_subgraph_iso + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback) { + + typedef typename graph_traits::vertex_descriptor vertex_small_type; + + return vf2_subgraph_iso(graph_small, graph_large, user_callback, + get(vertex_index, graph_small), get(vertex_index, graph_large), + vertex_order_by_mult(graph_small), + always_equivalent(), always_equivalent()); + } + + + // Named parameter interface of vf2_subgraph_iso + template + bool vf2_subgraph_iso(const GraphSmall& graph_small, const GraphLarge& graph_large, + SubGraphIsoMapCallback user_callback, + const VertexOrderSmall& vertex_order_small, + const bgl_named_params& params) { + + return vf2_subgraph_iso(graph_small, graph_large, user_callback, + choose_const_pmap(get_param(params, vertex_index1), + graph_small, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph_large, vertex_index), + vertex_order_small, + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()) + ); + + } + + + // Enumerates all isomorphism mappings between graphs graph1_ and graph2_. + // Continues until user_callback returns true or the search space has been + // fully explored. + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback, + IndexMap1 index_map1, IndexMap2 index_map2, + const VertexOrder1& vertex_order1, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + // Graph requirements + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept )); + BOOST_CONCEPT_ASSERT(( VertexListGraphConcept )); + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + + typedef typename graph_traits::vertex_descriptor vertex1_type; + typedef typename graph_traits::vertex_descriptor vertex2_type; + + typedef typename graph_traits::vertices_size_type size_type1; + typedef typename graph_traits::vertices_size_type size_type2; + + // Property map requirements + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMap1Value; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + typedef typename property_traits::value_type IndexMap2Value; + BOOST_STATIC_ASSERT(( is_convertible::value )); + + // Edge & vertex requirements + typedef typename graph_traits::edge_descriptor edge1_type; + typedef typename graph_traits::edge_descriptor edge2_type; + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + BOOST_CONCEPT_ASSERT(( BinaryPredicateConcept )); + + // Vertex order requirements + BOOST_CONCEPT_ASSERT(( ContainerConcept )); + typedef typename VertexOrder1::value_type order_value_type; + BOOST_STATIC_ASSERT(( is_same::value )); + BOOST_ASSERT( num_vertices(graph1) == vertex_order1.size() ); + + if (num_vertices(graph1) != num_vertices(graph2)) + return false; + + typename graph_traits::edges_size_type num_edges1 = num_edges(graph1); + typename graph_traits::edges_size_type num_edges2 = num_edges(graph2); + + // Double the number of edges for undirected graphs: each edge counts as + // in-edge and out-edge + if (is_undirected(graph1)) num_edges1 *= 2; + if (is_undirected(graph2)) num_edges2 *= 2; + if (num_edges1 != num_edges2) + return false; + + if ((num_vertices(graph1) == 0) && (num_vertices(graph2) == 0)) + return true; + + detail::state + s(graph1, graph2, index_map1, index_map2, edge_comp, vertex_comp); + + return detail::match(graph1, graph2, user_callback, vertex_order1, s); + } + + + // All default interface for vf2_graph_iso + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback) { + + typedef typename graph_traits::vertex_descriptor vertex1_type; + + return vf2_graph_iso(graph1, graph2, user_callback, + get(vertex_index, graph1), get(vertex_index, graph2), + vertex_order_by_mult(graph1), + always_equivalent(), always_equivalent()); + } + + + // Named parameter interface of vf2_graph_iso + template + bool vf2_graph_iso(const Graph1& graph1, const Graph2& graph2, + GraphIsoMapCallback user_callback, + const VertexOrder1& vertex_order1, + const bgl_named_params& params) { + + return vf2_graph_iso(graph1, graph2, user_callback, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + vertex_order1, + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()) + ); + + } + + + // Verifies a graph (sub)graph isomorphism map + template + inline bool verify_vf2_subgraph_iso(const Graph1& graph1, const Graph2& graph2, + const CorresponenceMap1To2 f, + EdgeEquivalencePredicate edge_comp, + VertexEquivalencePredicate vertex_comp) { + + BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept )); + BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept )); + + detail::equivalent_edge_exists edge2_exists; + + BGL_FORALL_EDGES_T(e1, graph1, Graph1) { + typename graph_traits::vertex_descriptor s1, t1; + typename graph_traits::vertex_descriptor s2, t2; + + s1 = source(e1, graph1); t1 = target(e1, graph1); + s2 = get(f, s1); t2 = get(f, t1); + + if (!vertex_comp(s1, s2) || !vertex_comp(t1, t2)) + return false; + + typename graph_traits::edge_descriptor e2; + + if (!edge2_exists(s2, t2, + detail::edge2_predicate(edge_comp, e1), + graph2)) + return false; + + } + + return true; + } + + // Variant of verify_subgraph_iso with all default parameters + template + inline bool verify_vf2_subgraph_iso(const Graph1& graph1, const Graph2& graph2, + const CorresponenceMap1To2 f) { + return verify_vf2_subgraph_iso(graph1, graph2, f, + always_equivalent(), always_equivalent()); + } + + + +} // namespace boost + +#ifdef BOOST_ISO_INCLUDED_ITER_MACROS +#undef BOOST_ISO_INCLUDED_ITER_MACROS +#include +#endif + +#endif // BOOST_VF2_SUB_GRAPH_ISO_HPP diff --git a/project/jni/boost/include/boost/graph/visitors.hpp b/project/jni/boost/include/boost/graph/visitors.hpp index f986c96ce..d10e140c7 100644 --- a/project/jni/boost/include/boost/graph/visitors.hpp +++ b/project/jni/boost/include/boost/graph/visitors.hpp @@ -269,7 +269,7 @@ namespace boost { {} template - void operator() (VertexOrEdge v, const Graph& g) + void operator() (VertexOrEdge v, const Graph&) { put (property_map_, v, value_); } @@ -292,7 +292,7 @@ namespace boost { inline property_put put_property (PropertyMap property_map, typename property_traits ::value_type value, - EventTag tag) + EventTag) { return property_put (property_map, value); } diff --git a/project/jni/boost/include/boost/heap/binomial_heap.hpp b/project/jni/boost/include/boost/heap/binomial_heap.hpp index 742754f68..4ffe89dfd 100644 --- a/project/jni/boost/include/boost/heap/binomial_heap.hpp +++ b/project/jni/boost/include/boost/heap/binomial_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_BINOMIAL_HEAP_HPP #include +#include #include #include @@ -61,7 +62,11 @@ struct make_binomial_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + type(type const & rhs): + base_type(rhs), allocator_type(rhs) + {} + type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) @@ -145,6 +150,7 @@ private: typedef typename base_maker::compare_argument value_compare; typedef typename base_maker::allocator_type allocator_type; + typedef typename base_maker::node_type node; typedef typename allocator_type::pointer node_pointer; typedef typename allocator_type::const_pointer const_node_pointer; @@ -240,7 +246,7 @@ public: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) binomial_heap(binomial_heap && rhs): super_t(std::move(rhs)), top_element(rhs.top_element) @@ -348,7 +354,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -523,7 +529,7 @@ public: rhs.set_size(0); rhs.top_element = NULL; - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -569,7 +575,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(&*it); + node_type * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /// \copydoc boost::heap::priority_queue::value_comp diff --git a/project/jni/boost/include/boost/heap/d_ary_heap.hpp b/project/jni/boost/include/boost/heap/d_ary_heap.hpp index 6a9cc8f33..f84fdd783 100644 --- a/project/jni/boost/include/boost/heap/d_ary_heap.hpp +++ b/project/jni/boost/include/boost/heap/d_ary_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_D_ARY_HEAP_HPP #include +#include #include #include @@ -32,16 +33,11 @@ namespace boost { namespace heap { namespace detail { -template struct nop_index_updater { - void operator()(T &, std::size_t) const + template + static void run(T &, std::size_t) {} - - template - struct rebind { - typedef nop_index_updater other; - }; }; typedef parameter::parameters, @@ -69,7 +65,7 @@ class d_ary_heap: typedef std::vector container_type; typedef typename container_type::const_iterator container_iterator; - typedef typename IndexUpdater::template rebind::other index_updater; + typedef IndexUpdater index_updater; container_type q_; @@ -159,7 +155,7 @@ public: super_t(rhs), q_(rhs.q_) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES d_ary_heap(d_ary_heap && rhs): super_t(std::move(rhs)), q_(std::move(rhs.q_)) {} @@ -217,7 +213,7 @@ public: siftup(q_.size() - 1); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void emplace(Args&&... args) { @@ -279,7 +275,7 @@ private: void reset_index(size_type index, size_type new_index) { BOOST_HEAP_ASSERT(index < q_.size()); - index_updater()(q_[index], new_index); + index_updater::run(q_[index], new_index); } void siftdown(size_type index) @@ -355,7 +351,7 @@ private: typedef typename container_type::const_iterator container_iterator; const size_t first_index = first_child_index(index); - const size_type last_index = std::min(first_index + D - 1, size() - 1); + const size_type last_index = (std::min)(first_index + D - 1, size() - 1); return last_index; } @@ -423,8 +419,8 @@ struct select_dary_heap static const bool is_mutable = extract_mutable::value; typedef typename mpl::if_c< is_mutable, - priority_queue_mutable_wrapper > >, - d_ary_heap > + priority_queue_mutable_wrapper >, + d_ary_heap >::type type; }; @@ -528,7 +524,7 @@ public: super_t(rhs) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) d_ary_heap(d_ary_heap && rhs): super_t(std::move(rhs)) @@ -591,7 +587,7 @@ public: return super_t::push(v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /// \copydoc boost::heap::priority_queue::emplace template typename mpl::if_c::type emplace(Args&&... args) @@ -753,7 +749,7 @@ public: static handle_type s_handle_from_iterator(iterator const & it) { BOOST_STATIC_ASSERT(is_mutable); - return super_t::handle_type(it); + return super_t::s_handle_from_iterator(it); } /// \copydoc boost::heap::priority_queue::pop @@ -769,13 +765,25 @@ public: } /// \copydoc boost::heap::priority_queue::begin - iterator begin(void) const + const_iterator begin(void) const + { + return super_t::begin(); + } + + /// \copydoc boost::heap::priority_queue::begin + iterator begin(void) { return super_t::begin(); } /// \copydoc boost::heap::priority_queue::end - iterator end(void) const + iterator end(void) + { + return super_t::end(); + } + + /// \copydoc boost::heap::priority_queue::end + const_iterator end(void) const { return super_t::end(); } diff --git a/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp b/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp index 557f89229..ca465ebce 100644 --- a/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp +++ b/project/jni/boost/include/boost/heap/detail/heap_comparison.hpp @@ -141,8 +141,8 @@ bool heap_equality(Heap1 const & lhs, Heap2 const & rhs) heap_equivalence_copy >::type equivalence_check; - equivalence_check check; - return check(lhs, rhs); + equivalence_check eq_check; + return eq_check(lhs, rhs); } @@ -230,8 +230,8 @@ bool heap_compare(Heap1 const & lhs, Heap2 const & rhs) heap_compare_copy >::type compare_check; - compare_check check; - return check(lhs, rhs); + compare_check check_object; + return check_object(lhs, rhs); } diff --git a/project/jni/boost/include/boost/heap/detail/heap_node.hpp b/project/jni/boost/include/boost/heap/detail/heap_node.hpp index 659ffc300..588891744 100644 --- a/project/jni/boost/include/boost/heap/detail/heap_node.hpp +++ b/project/jni/boost/include/boost/heap/detail/heap_node.hpp @@ -171,7 +171,7 @@ public: value(v) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template heap_node(Args&&... args): value(std::forward(args)...) @@ -230,7 +230,7 @@ struct parent_pointing_heap_node: super_t(v), parent(NULL) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template parent_pointing_heap_node(Args&&... args): super_t(std::forward(args)...), parent(NULL) @@ -310,7 +310,7 @@ struct marked_heap_node: super_t(v), mark(false) {} -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template marked_heap_node(Args&&... args): super_t(std::forward(args)...), mark(false) diff --git a/project/jni/boost/include/boost/heap/detail/ilog2.hpp b/project/jni/boost/include/boost/heap/detail/ilog2.hpp index 9b5df05ef..c6b65c66c 100644 --- a/project/jni/boost/include/boost/heap/detail/ilog2.hpp +++ b/project/jni/boost/include/boost/heap/detail/ilog2.hpp @@ -61,4 +61,4 @@ IntType log2(IntType value) } /* namespace heap */ } /* namespace boost */ -#endif /* BOOST_HEAP_DETAIL_ILOG2_HPP */ \ No newline at end of file +#endif /* BOOST_HEAP_DETAIL_ILOG2_HPP */ diff --git a/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp b/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp index 37f6ddfeb..3218858ce 100644 --- a/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp +++ b/project/jni/boost/include/boost/heap/detail/mutable_heap.hpp @@ -68,19 +68,13 @@ private: q_.set_stability_count(new_count); } - template struct index_updater { template - void operator()(It & it, size_type new_index) + static void run(It & it, size_type new_index) { q_type::get_value(it)->second = new_index; } - - template - struct rebind { - typedef index_updater other; - }; }; public: @@ -94,6 +88,10 @@ public: handle_type (void) {} + handle_type(handle_type const & rhs): + iterator(rhs.iterator) + {} + private: explicit handle_type(list_iterator const & it): iterator(it) @@ -120,7 +118,7 @@ private: typedef typename PriorityQueueType::template rebind >::other q_type; + allocator_type, index_updater >::other q_type; protected: q_type q_; @@ -132,7 +130,7 @@ protected: {} priority_queue_mutable_wrapper(priority_queue_mutable_wrapper const & rhs): - objects(rhs.objects) + q_(rhs.q_), objects(rhs.objects) { for (typename object_list::iterator it = objects.begin(); it != objects.end(); ++it) q_.push(it); @@ -140,6 +138,7 @@ protected: priority_queue_mutable_wrapper & operator=(priority_queue_mutable_wrapper const & rhs) { + q_ = rhs.q_; objects = rhs.objects; q_.clear(); for (typename object_list::iterator it = objects.begin(); it != objects.end(); ++it) @@ -147,7 +146,7 @@ protected: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES priority_queue_mutable_wrapper (priority_queue_mutable_wrapper && rhs): q_(std::move(rhs.q_)) { @@ -166,25 +165,27 @@ protected: public: - class iterator: - public boost::iterator_adaptor + class iterator_base: + public boost::iterator_adaptor, + iterator_type, value_type const, boost::bidirectional_traversal_tag> { - typedef boost::iterator_adaptor, + iterator_type, value_type const, boost::bidirectional_traversal_tag> super_t; friend class boost::iterator_core_access; friend class priority_queue_mutable_wrapper; - iterator(void): + iterator_base(void): super_t(0) {} - explicit iterator(const_list_iterator const & it): + template + explicit iterator_base(T const & it): super_t(it) {} @@ -192,9 +193,16 @@ public: { return super_t::base()->first; } + + iterator_type get_list_iterator() const + { + return super_t::base_reference(); + } }; - typedef iterator const_iterator; + typedef iterator_base iterator; + typedef iterator_base const_iterator; + typedef typename object_list::difference_type difference_type; class ordered_iterator: @@ -331,7 +339,7 @@ public: return handle_type(ret); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template handle_type emplace(Args&&... args) { @@ -374,7 +382,7 @@ public: { list_iterator it = handle.iterator; value_type const & current_value = it->first; - value_compare const & cmp = q_; + value_compare const & cmp = q_.value_comp(); if (cmp(v, current_value)) decrease(handle, v); else @@ -464,12 +472,22 @@ public: objects.erase(it); } - iterator begin(void) const + const_iterator begin(void) const + { + return const_iterator(objects.begin()); + } + + const_iterator end(void) const + { + return const_iterator(objects.end()); + } + + iterator begin(void) { return iterator(objects.begin()); } - iterator end(void) const + iterator end(void) { return iterator(objects.end()); } @@ -489,7 +507,7 @@ public: static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(it); + return handle_type(it.get_list_iterator()); } value_compare const & value_comp(void) const diff --git a/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp b/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp index e2f166f85..e2cbf1f39 100644 --- a/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp +++ b/project/jni/boost/include/boost/heap/detail/ordered_adaptor_iterator.hpp @@ -64,8 +64,8 @@ class ordered_adaptor_iterator: bool operator()(size_t lhs, size_t rhs) { - assert(lhs <= Dispatcher::max_index(container)); - assert(rhs <= Dispatcher::max_index(container)); + BOOST_ASSERT(lhs <= Dispatcher::max_index(container)); + BOOST_ASSERT(rhs <= Dispatcher::max_index(container)); return ValueCompare::operator()(Dispatcher::get_internal_value(container, lhs), Dispatcher::get_internal_value(container, rhs)); } @@ -76,7 +76,7 @@ class ordered_adaptor_iterator: public: ordered_adaptor_iterator(void): - container(NULL), current_index(std::numeric_limits::max()), + container(NULL), current_index((std::numeric_limits::max)()), unvisited_nodes(compare_by_heap_value(NULL, ValueCompare())) {} diff --git a/project/jni/boost/include/boost/heap/detail/stable_heap.hpp b/project/jni/boost/include/boost/heap/detail/stable_heap.hpp index e9f3f2cd8..aaaa9de2e 100644 --- a/project/jni/boost/include/boost/heap/detail/stable_heap.hpp +++ b/project/jni/boost/include/boost/heap/detail/stable_heap.hpp @@ -24,7 +24,6 @@ namespace boost { namespace heap { namespace detail { - template struct size_holder { @@ -35,7 +34,7 @@ struct size_holder size_(0) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES size_holder(size_holder && rhs): size_(rhs.size_) { @@ -93,7 +92,7 @@ struct size_holder size_holder(void) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES size_holder(size_holder && rhs) {} @@ -133,6 +132,8 @@ struct size_holder {} }; +// note: MSVC does not implement lookup correctly, we therefore have to place the Cmp object as member inside the +// struct. of course, this prevents EBO and significantly reduces the readability of this code template struct heap_base: +#ifndef BOOST_MSVC Cmp, +#endif size_holder { typedef StabilityCounterType stability_counter_type; @@ -151,31 +154,47 @@ struct heap_base: typedef Cmp internal_compare; static const bool is_stable = stable; +#ifdef BOOST_MSVC + Cmp cmp_; +#endif + heap_base (Cmp const & cmp = Cmp()): +#ifndef BOOST_MSVC Cmp(cmp) +#else + cmp_(cmp) +#endif {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES heap_base(heap_base && rhs): +#ifndef BOOST_MSVC Cmp(std::move(static_cast(rhs))), +#else + cmp_(std::move(rhs.cmp_)), +#endif size_holder_type(std::move(static_cast(rhs))) {} heap_base(heap_base const & rhs): +#ifndef BOOST_MSVC Cmp(static_cast(rhs)), +#else + cmp_(rhs.value_comp()), +#endif size_holder_type(static_cast(rhs)) {} heap_base & operator=(heap_base && rhs) { - Cmp::operator=(std::move(static_cast(rhs))); + value_comp_ref().operator=(std::move(rhs.value_comp_ref())); size_holder_type::operator=(std::move(static_cast(rhs))); return *this; } heap_base & operator=(heap_base const & rhs) { - Cmp::operator=(static_cast(rhs)); + value_comp_ref().operator=(rhs.value_comp()); size_holder_type::operator=(static_cast(rhs)); return *this; } @@ -183,7 +202,7 @@ struct heap_base: bool operator()(internal_type const & lhs, internal_type const & rhs) const { - return Cmp::operator()(lhs, rhs); + return value_comp().operator()(lhs, rhs); } internal_type make_node(T const & val) @@ -191,7 +210,7 @@ struct heap_base: return val; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES T && make_node(T && val) { return std::forward(val); @@ -210,17 +229,21 @@ struct heap_base: Cmp const & value_comp(void) const { +#ifndef BOOST_MSVC return *this; +#else + return cmp_; +#endif } Cmp const & get_internal_cmp(void) const { - return *this; + return value_comp(); } void swap(heap_base & rhs) { - std::swap(static_cast(*this), static_cast(rhs)); + std::swap(value_comp_ref(), rhs.value_comp_ref()); size_holder::swap(rhs); } @@ -234,15 +257,28 @@ struct heap_base: template friend struct heap_merge_emulate; + +private: + Cmp & value_comp_ref(void) + { +#ifndef BOOST_MSVC + return *this; +#else + return cmp_; +#endif + } }; + template struct heap_base: +#ifndef BOOST_MSVC Cmp, +#endif size_holder { typedef StabilityCounterType stability_counter_type; @@ -251,21 +287,43 @@ struct heap_base: typedef size_holder size_holder_type; typedef Cmp value_compare; +#ifdef BOOST_MSVC + Cmp cmp_; +#endif + heap_base (Cmp const & cmp = Cmp()): - Cmp(cmp), counter_(0) +#ifndef BOOST_MSVC + Cmp(cmp), +#else + cmp_(cmp), +#endif + counter_(0) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES heap_base(heap_base && rhs): +#ifndef BOOST_MSVC Cmp(std::move(static_cast(rhs))), +#else + cmp_(std::move(rhs.cmp_)), +#endif size_holder_type(std::move(static_cast(rhs))), counter_(rhs.counter_) { rhs.counter_ = 0; } + heap_base(heap_base const & rhs): +#ifndef BOOST_MSVC + Cmp(static_cast(rhs)), +#else + cmp_(rhs.value_comp()), +#endif + size_holder_type(static_cast(rhs)), counter_(rhs.counter_) + {} + heap_base & operator=(heap_base && rhs) { - Cmp::operator=(std::move(static_cast(rhs))); + value_comp_ref().operator=(std::move(rhs.value_comp_ref())); size_holder_type::operator=(std::move(static_cast(rhs))); counter_ = rhs.counter_; @@ -275,40 +333,38 @@ struct heap_base: heap_base & operator=(heap_base const & rhs) { - Cmp::operator=(static_cast(rhs)); + value_comp_ref().operator=(rhs.value_comp()); size_holder_type::operator=(static_cast(rhs)); counter_ = rhs.counter_; return *this; } - #endif bool operator()(internal_type const & lhs, internal_type const & rhs) const { - internal_compare cmp(get_internal_cmp()); - return cmp(lhs, rhs); + return get_internal_cmp()(lhs, rhs); } bool operator()(T const & lhs, T const & rhs) const { - return Cmp::operator()(lhs, rhs); + return value_comp()(lhs, rhs); } internal_type make_node(T const & val) { stability_counter_type count = ++counter_; - if (counter_ == std::numeric_limits::max()) + if (counter_ == (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::runtime_error("boost::heap counter overflow")); return std::make_pair(val, count); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template internal_type make_node(Args&&... args) { stability_counter_type count = ++counter_; - if (counter_ == std::numeric_limits::max()) + if (counter_ == (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::runtime_error("boost::heap counter overflow")); return std::make_pair(std::forward(args)..., count); } @@ -326,7 +382,11 @@ struct heap_base: Cmp const & value_comp(void) const { +#ifndef BOOST_MSVC return *this; +#else + return cmp_; +#endif } struct internal_compare: @@ -350,12 +410,16 @@ struct heap_base: internal_compare get_internal_cmp(void) const { - return internal_compare(*this); + return internal_compare(value_comp()); } void swap(heap_base & rhs) { +#ifndef BOOST_MSVC std::swap(static_cast(*this), static_cast(rhs)); +#else + std::swap(cmp_, rhs.cmp_); +#endif std::swap(counter_, rhs.counter_); size_holder::swap(rhs); } @@ -374,6 +438,15 @@ struct heap_base: friend struct heap_merge_emulate; private: + Cmp & value_comp_ref(void) + { +#ifndef BOOST_MSVC + return *this; +#else + return cmp_; +#endif + } + stability_counter_type counter_; }; diff --git a/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp b/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp index 7a184310d..83c8d3fb4 100644 --- a/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp +++ b/project/jni/boost/include/boost/heap/detail/tree_iterator.hpp @@ -254,6 +254,11 @@ public: return !operator!=(rhs); } + const Node * get_node() const + { + return adaptor_type::base_reference(); + } + private: void increment(void) { @@ -373,6 +378,11 @@ public: { return static_cast(&*it); } + + const Node * get_node() const + { + return get_node(adaptor_type::base_reference()); + } }; diff --git a/project/jni/boost/include/boost/heap/fibonacci_heap.hpp b/project/jni/boost/include/boost/heap/fibonacci_heap.hpp index 907d44230..eb6883408 100644 --- a/project/jni/boost/include/boost/heap/fibonacci_heap.hpp +++ b/project/jni/boost/include/boost/heap/fibonacci_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_FIBONACCI_HEAP_HPP #include +#include #include #include @@ -62,12 +63,17 @@ struct make_fibonacci_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) {} + type(type & rhs): + base_type(static_cast(rhs)), + allocator_type(static_cast(rhs)) + {} + type & operator=(type && rhs) { base_type::operator=(std::move(static_cast(rhs))); @@ -223,7 +229,7 @@ public: size_holder::set_size(rhs.size()); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) fibonacci_heap(fibonacci_heap && rhs): super_t(std::move(rhs)), top_element(rhs.top_element) @@ -232,6 +238,13 @@ public: rhs.top_element = NULL; } + fibonacci_heap(fibonacci_heap & rhs): + super_t(rhs), top_element(rhs.top_element) + { + roots.splice(roots.begin(), rhs.roots); + rhs.top_element = NULL; + } + /// \copydoc boost::heap::priority_queue::operator=(priority_queue &&) fibonacci_heap & operator=(fibonacci_heap && rhs) { @@ -346,7 +359,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -384,16 +397,7 @@ public: node_pointer element = top_element; roots.erase(node_list_type::s_iterator_to(*element)); - add_children_to_root(element); - - element->~node(); - allocator_type::deallocate(element, 1); - - size_holder::decrement(); - if (!empty()) - consolidate(); - else - top_element = NULL; + finish_erase_or_pop(element); } /** @@ -413,7 +417,7 @@ public: /** \copydoc boost::heap::fibonacci_heap::update(handle_type, const_reference) * * \b Rationale: The lazy update function is a modification of the traditional update, that just invalidates - * the iterator the the object referred to by the handle. + * the iterator to the object referred to by the handle. * */ void update_lazy(handle_type handle, const_reference v) { @@ -444,7 +448,7 @@ public: /** \copydoc boost::heap::fibonacci_heap::update (handle_type handle) * * \b Rationale: The lazy update function is a modification of the traditional update, that just invalidates - * the iterator the the object referred to by the handle. + * the iterator to the object referred to by the handle. * */ void update_lazy (handle_type handle) { @@ -529,21 +533,15 @@ public: * */ void erase(handle_type const & handle) { - node_pointer n = handle.node_; - node_pointer parent = n->get_parent(); + node_pointer element = handle.node_; + node_pointer parent = element->get_parent(); if (parent) - parent->children.erase(node_list_type::s_iterator_to(*n)); + parent->children.erase(node_list_type::s_iterator_to(*element)); else - roots.erase(node_list_type::s_iterator_to(*n)); + roots.erase(node_list_type::s_iterator_to(*element)); - add_children_to_root(n); - consolidate(); - - n->~node(); - allocator_type::deallocate(n, 1); - - size_holder::decrement(); + finish_erase_or_pop(element); } /// \copydoc boost::heap::priority_queue::begin @@ -597,7 +595,7 @@ public: rhs.set_size(0); - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -605,7 +603,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return super_t::s_handle_from_iterator(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /// \copydoc boost::heap::priority_queue::value_comp @@ -701,6 +700,9 @@ private: void consolidate(void) { + if (roots.empty()) + return; + static const size_type max_log2 = sizeof(size_type) * 8; boost::array aux; aux.assign(NULL); @@ -740,6 +742,20 @@ private: while (it != roots.end()); } + void finish_erase_or_pop(node_pointer erased_node) + { + add_children_to_root(erased_node); + + erased_node->~node(); + allocator_type::deallocate(erased_node, 1); + + size_holder::decrement(); + if (!empty()) + consolidate(); + else + top_element = NULL; + } + mutable node_pointer top_element; node_list_type roots; #endif diff --git a/project/jni/boost/include/boost/heap/heap_merge.hpp b/project/jni/boost/include/boost/heap/heap_merge.hpp index 192d0f9d3..eabae3196 100644 --- a/project/jni/boost/include/boost/heap/heap_merge.hpp +++ b/project/jni/boost/include/boost/heap/heap_merge.hpp @@ -56,8 +56,8 @@ struct heap_merge_emulate rhs.pop(); } - lhs.set_stability_count(std::max(lhs.get_stability_count(), - rhs.get_stability_count())); + lhs.set_stability_count((std::max)(lhs.get_stability_count(), + rhs.get_stability_count())); rhs.set_stability_count(0); } diff --git a/project/jni/boost/include/boost/heap/pairing_heap.hpp b/project/jni/boost/include/boost/heap/pairing_heap.hpp index 577fdc534..f7ea7ba8d 100644 --- a/project/jni/boost/include/boost/heap/pairing_heap.hpp +++ b/project/jni/boost/include/boost/heap/pairing_heap.hpp @@ -10,6 +10,7 @@ #define BOOST_HEAP_PAIRING_HEAP_HPP #include +#include #include #include @@ -62,7 +63,11 @@ struct make_pairing_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + type(type const & rhs): + base_type(rhs), allocator_type(rhs) + {} + type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) @@ -95,7 +100,7 @@ struct make_pairing_heap_base * the complexity analysis is yet unsolved. For details, consult: * * Pettie, Seth (2005), "Towards a final analysis of pairing heaps", - * Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174–183 + * Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174-183 * * The template parameter T is the type to be managed by the container. * The user can specify additional options and if no options are provided default options are used. @@ -236,7 +241,7 @@ public: size_holder::set_size(rhs.get_size()); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) pairing_heap(pairing_heap && rhs): super_t(std::move(rhs)), root(rhs.root) @@ -352,7 +357,7 @@ public: return handle_type(n); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. * @@ -549,7 +554,8 @@ public: /// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return super_t::s_handle_from_iterator(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /** @@ -573,7 +579,7 @@ public: rhs.set_size(0); rhs.root = NULL; - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -650,7 +656,7 @@ private: node_pointer merge_node_list(node_child_list & children) { - assert(!children.empty()); + BOOST_HEAP_ASSERT(!children.empty()); node_pointer merged = merge_first_pair(children); if (children.empty()) return merged; @@ -668,7 +674,7 @@ private: node_pointer merge_first_pair(node_child_list & children) { - assert(!children.empty()); + BOOST_HEAP_ASSERT(!children.empty()); node_pointer first_child = static_cast(&children.front()); children.pop_front(); if (children.empty()) diff --git a/project/jni/boost/include/boost/heap/priority_queue.hpp b/project/jni/boost/include/boost/heap/priority_queue.hpp index 05d79fd87..7f2fa13fb 100644 --- a/project/jni/boost/include/boost/heap/priority_queue.hpp +++ b/project/jni/boost/include/boost/heap/priority_queue.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -122,13 +123,13 @@ public: super_t(rhs), q_(rhs.q_) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /** * \b Effects: C++11-style move constructor. * * \b Complexity: Constant. * - * \b Note: Only available, if BOOST_HAS_RVALUE_REFS is defined + * \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined * */ priority_queue(priority_queue && rhs): super_t(std::move(rhs)), q_(std::move(rhs.q_)) @@ -139,7 +140,7 @@ public: * * \b Complexity: Constant. * - * \b Note: Only available, if BOOST_HAS_RVALUE_REFS is defined + * \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined * */ priority_queue & operator=(priority_queue && rhs) { @@ -241,7 +242,7 @@ public: std::push_heap(q_.begin(), q_.end(), static_cast(*this)); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. * diff --git a/project/jni/boost/include/boost/heap/skew_heap.hpp b/project/jni/boost/include/boost/heap/skew_heap.hpp index de89a63a8..17c3d1d95 100644 --- a/project/jni/boost/include/boost/heap/skew_heap.hpp +++ b/project/jni/boost/include/boost/heap/skew_heap.hpp @@ -84,7 +84,7 @@ struct skew_heap_node: children.assign(0); } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES skew_heap_node(value_type && v): value(v) { @@ -199,12 +199,17 @@ struct make_skew_heap_base base_type(arg) {} -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES type(type && rhs): base_type(std::move(static_cast(rhs))), allocator_type(std::move(static_cast(rhs))) {} + type(type const & rhs): + base_type(rhs), + allocator_type(rhs) + {} + type & operator=(type && rhs) { base_type::operator=(std::move(static_cast(rhs))); @@ -383,7 +388,7 @@ public: return *this; } -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES /// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&) skew_heap(skew_heap && rhs): super_t(std::move(rhs)), root(rhs.root) @@ -418,7 +423,7 @@ public: return push_helper::push(this, v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) /** * \b Effects: Adds a new element to the priority queue. The element is directly constructed in-place. * @@ -559,7 +564,7 @@ public: rhs.root = NULL; sanity_check(); - super_t::set_stability_count(std::max(super_t::get_stability_count(), + super_t::set_stability_count((std::max)(super_t::get_stability_count(), rhs.get_stability_count())); rhs.set_stability_count(0); } @@ -616,7 +621,8 @@ public: /// \copydoc boost::heap::d_ary_heap::s_handle_from_iterator static handle_type s_handle_from_iterator(iterator const & it) { - return handle_type(&*it); + node * ptr = const_cast(it.get_node()); + return handle_type(ptr); } /** @@ -756,7 +762,7 @@ private: self->push_internal(v); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static void emplace(skew_heap * self, Args&&... args) { @@ -772,7 +778,7 @@ private: return handle_type(self->push_internal(v)); } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static handle_type emplace(skew_heap * self, Args&&... args) { @@ -792,7 +798,7 @@ private: return n; } -#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template node_pointer emplace_internal(Args&&... args) { diff --git a/project/jni/boost/include/boost/icl/concept/element_associator.hpp b/project/jni/boost/include/boost/icl/concept/element_associator.hpp index a9371848d..ce421e018 100644 --- a/project/jni/boost/include/boost/icl/concept/element_associator.hpp +++ b/project/jni/boost/include/boost/icl/concept/element_associator.hpp @@ -188,7 +188,7 @@ operator + (const typename Type::value_type& operand, Type object) } template -inline typename enable_if, Type>::type +inline typename enable_if, Type>::type& operator += (Type& object, const Type& operand) { if(&object == &operand) diff --git a/project/jni/boost/include/boost/icl/concept/element_map.hpp b/project/jni/boost/include/boost/icl/concept/element_map.hpp index d54df0218..b2d78abbe 100644 --- a/project/jni/boost/include/boost/icl/concept/element_map.hpp +++ b/project/jni/boost/include/boost/icl/concept/element_map.hpp @@ -11,6 +11,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber #include #include #include +#include #include #include #include diff --git a/project/jni/boost/include/boost/icl/concept/interval_associator.hpp b/project/jni/boost/include/boost/icl/concept/interval_associator.hpp index 75d8622af..14d522eb3 100644 --- a/project/jni/boost/include/boost/icl/concept/interval_associator.hpp +++ b/project/jni/boost/include/boost/icl/concept/interval_associator.hpp @@ -325,7 +325,7 @@ operator += (Type& object, const OperandT& operand) } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (T, c P&) T:{S}|{M} P:{e i S}|{b p M} //------------------------------------------------------------------------------ @@ -340,13 +340,13 @@ operator + (Type object, const OperandT& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -357,9 +357,9 @@ operator + (Type&& object, const OperandT& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'} //------------------------------------------------------------------------------ @@ -374,13 +374,13 @@ operator + (const OperandT& operand, Type object) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -391,9 +391,9 @@ operator + (const OperandT& operand, Type&& object) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op + (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -408,13 +408,13 @@ operator + (Type object, const Type& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator + (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -439,7 +439,7 @@ operator + (Type&& object, Type&& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- Addition |=, | @@ -477,7 +477,7 @@ operator |= (Type& object, const OperandT& operand) return object += operand; } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{e i S}|{b p M} //------------------------------------------------------------------------------ @@ -492,13 +492,13 @@ operator | (Type object, const OperandT& operand) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -509,9 +509,9 @@ operator | (Type&& object, const OperandT& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -526,13 +526,13 @@ operator | (const OperandT& operand, Type object) return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -543,9 +543,9 @@ operator | (const OperandT& operand, Type&& object) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op | (T, c P&) T:{S}|{M} P:{S}|{M} //------------------------------------------------------------------------------ @@ -559,13 +559,13 @@ operator | (Type object, const Type& operand) { return object += operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator | (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp += operand); } @@ -590,7 +590,7 @@ operator | (Type&& object, Type&& operand) return boost::move(object += operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //============================================================================== @@ -605,7 +605,7 @@ insert(Type& object, const OperandT& operand) { typename Type::iterator prior_ = object.end(); ICL_const_FORALL(typename OperandT, elem_, operand) - insert(object, *elem_); + insert(object, prior_, *elem_); return object; } @@ -707,7 +707,7 @@ operator -= (Type& object, const IntervalSetT& operand) return erase(object, operand); } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op - (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'} //------------------------------------------------------------------------------ @@ -718,13 +718,13 @@ operator - (Type object, const OperandT& operand) return object -= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator - (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp -= operand); } @@ -735,7 +735,7 @@ operator - (Type&& object, const OperandT& operand) return boost::move(object -= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //============================================================================== //= Intersection @@ -776,7 +776,7 @@ operator &= (Type& object, const OperandT& operand) return object; } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S typename enable_if, Type>::type operator & (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -804,9 +804,9 @@ operator & (Type&& object, const OperandT& operand) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (c P&, T) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S typename enable_if, Type>::type operator & (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -834,9 +834,9 @@ operator & (const OperandT& operand, Type&& object) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op & (T, c T&) T:{S M} //------------------------------------------------------------------------------ @@ -847,13 +847,13 @@ operator & (Type object, const Type& operand) return object &= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator & (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp &= operand); } @@ -878,7 +878,7 @@ operator & (Type&& object, Type&& operand) return boost::move(object &= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- intersects @@ -1011,7 +1011,7 @@ operator ^= (Type& object, const OperandT& operand) return icl::flip(object, operand); } -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (T, c P&) T:{S}|{M} P:{e i S'}|{b p M'} S typename enable_if, Type>::type operator ^ (const Type& object, const OperandT& operand) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1039,9 +1039,9 @@ operator ^ (Type&& object, const OperandT& operand) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'} S typename enable_if, Type>::type operator ^ (const OperandT& operand, const Type& object) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1069,9 +1069,9 @@ operator ^ (const OperandT& operand, Type&& object) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //------------------------------------------------------------------------------ //- T op ^ (T, c T&) T:{S M} //------------------------------------------------------------------------------ @@ -1082,13 +1082,13 @@ operator ^ (typename Type::overloadable_type object, const Type& operand) return object ^= operand; } -#else //BOOST_NO_RVALUE_REFERENCES +#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES template typename enable_if, Type>::type operator ^ (const Type& object, const Type& operand) { - Type temp = object; + Type temp = object; return boost::move(temp ^= operand); } @@ -1113,7 +1113,7 @@ operator ^ (Type&& object, Type&& operand) return boost::move(object ^= operand); } -#endif //BOOST_NO_RVALUE_REFERENCES +#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Element Iteration diff --git a/project/jni/boost/include/boost/icl/detail/set_algo.hpp b/project/jni/boost/include/boost/icl/detail/set_algo.hpp index 7f74cd46e..7b0e7c598 100644 --- a/project/jni/boost/include/boost/icl/detail/set_algo.hpp +++ b/project/jni/boost/include/boost/icl/detail/set_algo.hpp @@ -11,10 +11,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #define BOOST_ICL_SET_ALGO_HPP_JOFA_990225 #include - #include -#include - #include #include #include diff --git a/project/jni/boost/include/boost/icl/functors.hpp b/project/jni/boost/include/boost/icl/functors.hpp index 1b4758fc5..2401b2b80 100644 --- a/project/jni/boost/include/boost/icl/functors.hpp +++ b/project/jni/boost/include/boost/icl/functors.hpp @@ -22,14 +22,14 @@ namespace boost{namespace icl template struct identity_based_inplace_combine : public std::binary_function { - static Type identity_element() { return boost::icl::identity_element::value(); } + inline static Type identity_element() { return boost::icl::identity_element::value(); } }; // ------------------------------------------------------------------------ template struct unit_element_based_inplace_combine : public std::binary_function { - static Type identity_element() { return boost::icl::unit_element::value(); } + inline static Type identity_element() { return boost::icl::unit_element::value(); } }; // ------------------------------------------------------------------------ @@ -49,11 +49,13 @@ namespace boost{namespace icl : public identity_based_inplace_combine { typedef inplace_erasure type; + typedef identity_based_inplace_combine base_type; void operator()(Type& object, const Type& operand)const { if(object == operand) - object = Type(); + //identity_element(); //JODO Old gcc-3.4.4 does not compile this + object = base_type::identity_element(); //<-- but this. } }; @@ -112,8 +114,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object &= ~operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -140,8 +140,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object ^= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; // ------------------------------------------------------------------------ @@ -165,8 +163,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { object ^= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -180,8 +176,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { insert(object,operand); } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -195,8 +189,6 @@ namespace boost{namespace icl void operator()(Type& object, const Type& operand)const { erase(object,operand); } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -204,14 +196,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ template struct inplace_star - : public identity_based_inplace_combine + : public identity_based_inplace_combine //JODO unit_element_ { typedef inplace_star type; void operator()(Type& object, const Type& operand)const { object *= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -219,14 +209,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ template struct inplace_slash - : public identity_based_inplace_combine + : public identity_based_inplace_combine //JODO unit_element_ { typedef inplace_slash type; void operator()(Type& object, const Type& operand)const { object /= operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -243,8 +231,6 @@ namespace boost{namespace icl if(object < operand) object = operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -261,8 +247,6 @@ namespace boost{namespace icl if(object > operand) object = operand; } - - static Type identity_element() { return boost::icl::identity_element::value(); } }; template<> @@ -340,6 +324,19 @@ namespace boost{namespace icl struct inverse > { typedef icl::inplace_max type; }; + template + struct inverse > + { typedef icl::inplace_erasure type; }; + + // If a Functor + template + struct inverse + { + typedef typename + remove_reference::type argument_type; + typedef icl::inplace_erasure type; + }; + //-------------------------------------------------------------------------- // Inverse inter_section functor diff --git a/project/jni/boost/include/boost/icl/gregorian.hpp b/project/jni/boost/include/boost/icl/gregorian.hpp index 883299c61..a10161709 100644 --- a/project/jni/boost/include/boost/icl/gregorian.hpp +++ b/project/jni/boost/include/boost/icl/gregorian.hpp @@ -77,12 +77,12 @@ namespace boost{namespace icl // ------------------------------------------------------------------------ - boost::gregorian::date operator ++(boost::gregorian::date& x) + inline boost::gregorian::date operator ++(boost::gregorian::date& x) { return x += boost::gregorian::date::duration_type::unit(); } - boost::gregorian::date operator --(boost::gregorian::date& x) + inline boost::gregorian::date operator --(boost::gregorian::date& x) { return x -= boost::gregorian::date::duration_type::unit(); } @@ -107,12 +107,12 @@ namespace boost{namespace icl typedef boost::gregorian::date_duration type; }; - boost::gregorian::date_duration operator ++(boost::gregorian::date_duration& x) + inline boost::gregorian::date_duration operator ++(boost::gregorian::date_duration& x) { return x += boost::gregorian::date::duration_type::unit(); } - boost::gregorian::date_duration operator --(boost::gregorian::date_duration& x) + inline boost::gregorian::date_duration operator --(boost::gregorian::date_duration& x) { return x -= boost::gregorian::date::duration_type::unit(); } diff --git a/project/jni/boost/include/boost/icl/impl_config.hpp b/project/jni/boost/include/boost/icl/impl_config.hpp index 1f244d239..d21d132d4 100644 --- a/project/jni/boost/include/boost/icl/impl_config.hpp +++ b/project/jni/boost/include/boost/icl/impl_config.hpp @@ -9,6 +9,8 @@ Copyright (c) 2009-2011: Joachim Faulhaber #ifndef BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 #define BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 +#include + /*-----------------------------------------------------------------------------+ | You can choose an implementation for the basic set and map classes. | | Select at most ONE of the following defines to change the default | @@ -39,6 +41,19 @@ Copyright (c) 2009-2011: Joachim Faulhaber # define ICL_IMPL_SPACE std #endif +/*-----------------------------------------------------------------------------+ +| MEMO 2012-12-30: Due to problems with new c++11 compilers and their | +| implementation of rvalue references, ICL's move implementation will be | +| disabled for some new compilers for version 1.53. | ++-----------------------------------------------------------------------------*/ +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#elif defined(__clang__) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#elif (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) +# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES +#endif + #include #endif // BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225 diff --git a/project/jni/boost/include/boost/icl/interval_base_map.hpp b/project/jni/boost/include/boost/icl/interval_base_map.hpp index 9f265a67c..7ecbb4d4e 100644 --- a/project/jni/boost/include/boost/icl/interval_base_map.hpp +++ b/project/jni/boost/include/boost/icl/interval_base_map.hpp @@ -222,7 +222,7 @@ public: return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -244,7 +244,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES /** swap the content of containers */ void swap(interval_base_map& object) { _map.swap(object._map); } diff --git a/project/jni/boost/include/boost/icl/interval_base_set.hpp b/project/jni/boost/include/boost/icl/interval_base_set.hpp index b5bd4d5cb..722db64d1 100644 --- a/project/jni/boost/include/boost/icl/interval_base_set.hpp +++ b/project/jni/boost/include/boost/icl/interval_base_set.hpp @@ -175,7 +175,7 @@ public: return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -195,7 +195,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES /** swap the content of containers */ void swap(interval_base_set& operand) { _set.swap(operand._set); } diff --git a/project/jni/boost/include/boost/icl/interval_map.hpp b/project/jni/boost/include/boost/icl/interval_map.hpp index f743b3d53..8b47044d8 100644 --- a/project/jni/boost/include/boost/icl/interval_map.hpp +++ b/project/jni/boost/include/boost/icl/interval_map.hpp @@ -86,7 +86,7 @@ public: Traits,Compare,Combine,Section,Interval,Alloc>& src) { this->assign(src); } - explicit interval_map(domain_mapping_type& base_pair): base_type() + explicit interval_map(const domain_mapping_type& base_pair): base_type() { this->add(base_pair); } explicit interval_map(const value_type& value_pair): base_type() @@ -94,6 +94,13 @@ public: /// Assignment operator + interval_map& operator = (const interval_map& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template interval_map& operator = (const interval_base_mapadd(prior_, *it_); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -131,7 +138,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/interval_set.hpp b/project/jni/boost/include/boost/icl/interval_set.hpp index 890e29efa..7dce8a480 100644 --- a/project/jni/boost/include/boost/icl/interval_set.hpp +++ b/project/jni/boost/include/boost/icl/interval_set.hpp @@ -116,6 +116,13 @@ public: } /// Assignment operator + interval_set& operator = (const interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template interval_set& operator = (const interval_base_set& src) @@ -137,7 +144,7 @@ public: prior_ = this->add(prior_, *it_); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -154,7 +161,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/map.hpp b/project/jni/boost/include/boost/icl/map.hpp index 7092906a7..0081dcfff 100644 --- a/project/jni/boost/include/boost/icl/map.hpp +++ b/project/jni/boost/include/boost/icl/map.hpp @@ -34,9 +34,9 @@ Copyright (c) 2007-2011: Joachim Faulhaber #include #include #include -#include #include +#include namespace boost{namespace icl { @@ -192,13 +192,13 @@ public: insert(key_value_pair); } - map& operator = (map& src) + map& operator = (const map& src) { base_type::operator=(src); return *this; } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -218,7 +218,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES void swap(map& src) { base_type::swap(src); } diff --git a/project/jni/boost/include/boost/icl/ptime.hpp b/project/jni/boost/include/boost/icl/ptime.hpp index 455963f19..42c2235ec 100644 --- a/project/jni/boost/include/boost/icl/ptime.hpp +++ b/project/jni/boost/include/boost/icl/ptime.hpp @@ -76,12 +76,12 @@ namespace boost{namespace icl }; // ------------------------------------------------------------------------ - boost::posix_time::ptime operator ++(boost::posix_time::ptime& x) + inline boost::posix_time::ptime operator ++(boost::posix_time::ptime& x) { return x += boost::posix_time::ptime::time_duration_type::unit(); } - boost::posix_time::ptime operator --(boost::posix_time::ptime& x) + inline boost::posix_time::ptime operator --(boost::posix_time::ptime& x) { return x -= boost::posix_time::ptime::time_duration_type::unit(); } @@ -106,12 +106,12 @@ namespace boost{namespace icl typedef boost::posix_time::time_duration type; }; - boost::posix_time::time_duration operator ++(boost::posix_time::time_duration& x) + inline boost::posix_time::time_duration operator ++(boost::posix_time::time_duration& x) { return x += boost::posix_time::ptime::time_duration_type::unit(); } - boost::posix_time::time_duration operator --(boost::posix_time::time_duration& x) + inline boost::posix_time::time_duration operator --(boost::posix_time::time_duration& x) { return x -= boost::posix_time::ptime::time_duration_type::unit(); } diff --git a/project/jni/boost/include/boost/icl/separate_interval_set.hpp b/project/jni/boost/include/boost/icl/separate_interval_set.hpp index 2292bd75b..4d06a2941 100644 --- a/project/jni/boost/include/boost/icl/separate_interval_set.hpp +++ b/project/jni/boost/include/boost/icl/separate_interval_set.hpp @@ -107,6 +107,13 @@ public: explicit separate_interval_set(const interval_type& itv): base_type() { this->add(itv); } /// Assignment operator + separate_interval_set& operator = (const separate_interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template separate_interval_set& operator = (const interval_base_set& src) @@ -123,7 +130,7 @@ public: this->_set.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -140,7 +147,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/set.hpp b/project/jni/boost/include/boost/icl/set.hpp index 90e655f0d..db44b5e80 100644 --- a/project/jni/boost/include/boost/icl/set.hpp +++ b/project/jni/boost/include/boost/icl/set.hpp @@ -18,10 +18,8 @@ Copyright (c) 2007-2011: Joachim Faulhaber # include #endif -#include - - -}} // namespace icl boost +#include +#include #endif // BOOST_ICL_SET_HPP_JOFA_070519 diff --git a/project/jni/boost/include/boost/icl/split_interval_map.hpp b/project/jni/boost/include/boost/icl/split_interval_map.hpp index 762ab5cc1..487b0d22b 100644 --- a/project/jni/boost/include/boost/icl/split_interval_map.hpp +++ b/project/jni/boost/include/boost/icl/split_interval_map.hpp @@ -72,13 +72,20 @@ public: /// Copy constructor split_interval_map(const split_interval_map& src): base_type(src) {} - explicit split_interval_map(domain_mapping_type& base_pair): base_type() + explicit split_interval_map(const domain_mapping_type& base_pair): base_type() { this->add(base_pair); } explicit split_interval_map(const value_type& value_pair): base_type() { this->add(value_pair); } - /// Copy assignment operator + /// Assignment operator + split_interval_map& operator = (const split_interval_map& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template split_interval_map& operator = (const interval_base_map_map.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -112,7 +119,7 @@ public: } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: // Private functions that shall be accessible by the baseclass: diff --git a/project/jni/boost/include/boost/icl/split_interval_set.hpp b/project/jni/boost/include/boost/icl/split_interval_set.hpp index 452a521fa..5b6235f65 100644 --- a/project/jni/boost/include/boost/icl/split_interval_set.hpp +++ b/project/jni/boost/include/boost/icl/split_interval_set.hpp @@ -105,6 +105,13 @@ public: explicit split_interval_set(const domain_type& itv): base_type() { this->add(itv); } /// Assignment operator + split_interval_set& operator = (const split_interval_set& src) + { + base_type::operator=(src); + return *this; + } + + /// Assignment operator for base type template split_interval_set& operator = (const interval_base_set& src) @@ -118,7 +125,7 @@ public: this->_set.insert(src.begin(), src.end()); } -# ifndef BOOST_NO_RVALUE_REFERENCES +# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES //========================================================================== //= Move semantics //========================================================================== @@ -135,7 +142,7 @@ public: return *this; } //========================================================================== -# endif // BOOST_NO_RVALUE_REFERENCES +# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES private: diff --git a/project/jni/boost/include/boost/integer.hpp b/project/jni/boost/include/boost/integer.hpp index fc0b3983b..35a1e1098 100644 --- a/project/jni/boost/include/boost/integer.hpp +++ b/project/jni/boost/include/boost/integer.hpp @@ -20,6 +20,7 @@ #include // for boost::::boost::integer_traits #include // for ::std::numeric_limits #include // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T +#include // // We simply cannot include this header on gcc without getting copious warnings of the kind: @@ -51,6 +52,7 @@ namespace boost // convert category to type template< int Category > struct int_least_helper {}; // default is empty + template< int Category > struct uint_least_helper {}; // default is empty // specializatons: 1=long, 2=int, 3=short, 4=signed char, // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char @@ -65,14 +67,14 @@ namespace boost template<> struct int_least_helper<4> { typedef short least; }; template<> struct int_least_helper<5> { typedef signed char least; }; #ifdef BOOST_HAS_LONG_LONG - template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; }; + template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; #elif defined(BOOST_HAS_MS_INT64) - template<> struct int_least_helper<6> { typedef unsigned __int64 least; }; + template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; #endif - template<> struct int_least_helper<7> { typedef unsigned long least; }; - template<> struct int_least_helper<8> { typedef unsigned int least; }; - template<> struct int_least_helper<9> { typedef unsigned short least; }; - template<> struct int_least_helper<10> { typedef unsigned char least; }; + template<> struct uint_least_helper<2> { typedef unsigned long least; }; + template<> struct uint_least_helper<3> { typedef unsigned int least; }; + template<> struct uint_least_helper<4> { typedef unsigned short least; }; + template<> struct uint_least_helper<5> { typedef unsigned char least; }; template struct exact_signed_base_helper{}; @@ -111,10 +113,12 @@ namespace boost template< int Bits > // bits (including sign) required struct int_t : public detail::exact_signed_base_helper { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), + "No suitable signed integer type with the requested number of bits is available."); typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -130,6 +134,8 @@ namespace boost template< int Bits > // bits required struct uint_t : public detail::exact_unsigned_base_helper { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), + "No suitable unsigned integer type with the requested number of bits is available."); #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) // It's really not clear why this workaround should be needed... shrug I guess! JM BOOST_STATIC_CONSTANT(int, s = @@ -140,11 +146,10 @@ namespace boost (Bits <= ::std::numeric_limits::digits)); typedef typename detail::int_least_helper< ::boost::uint_t::s>::least least; #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -217,7 +222,7 @@ namespace boost // It's really not clear why this workaround should be needed... shrug I guess! JM #if defined(BOOST_NO_INTEGRAL_INT64_T) BOOST_STATIC_CONSTANT(unsigned, which = - 6 + + 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + @@ -225,18 +230,17 @@ namespace boost typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; #else // BOOST_NO_INTEGRAL_INT64_T BOOST_STATIC_CONSTANT(unsigned, which = - 5 + + 1 + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max) + (MaxValue <= ::boost::integer_traits::const_max)); - typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; + typedef typename detail::uint_least_helper< ::boost::uint_value_t::which>::least least; #endif // BOOST_NO_INTEGRAL_INT64_T #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits::const_max) + #else diff --git a/project/jni/boost/include/boost/integer_traits.hpp b/project/jni/boost/include/boost/integer_traits.hpp index c6d761a71..ddd560952 100644 --- a/project/jni/boost/include/boost/integer_traits.hpp +++ b/project/jni/boost/include/boost/integer_traits.hpp @@ -5,7 +5,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * $Id: integer_traits.hpp 76784 2012-01-29 21:58:13Z eric_niebler $ + * $Id: integer_traits.hpp 81851 2012-12-11 14:42:26Z marshall $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ diff --git a/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp index 846df5d41..8a2d61ecc 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -35,7 +35,7 @@ #include //!\file -//!Describes adaptive_pool pooled shared memory STL compatible allocator +//!Describes adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -101,11 +101,11 @@ class adaptive_pool_base typedef boost::container::container_detail::transform_multiallocation_chain multiallocation_chain; - //!Obtains adaptive_pool_base from + //!Obtains adaptive_pool_base from //!adaptive_pool_base template struct rebind - { + { typedef adaptive_pool_base other; }; @@ -122,15 +122,15 @@ class adaptive_pool_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - adaptive_pool_base(segment_manager *segment_mngr) + adaptive_pool_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool::type>(segment_mngr)) { } - //!Copy constructor from other adaptive_pool_base. Increments the reference + //!Copy constructor from other adaptive_pool_base. Increments the reference //!count of the associated node pool. Never throws - adaptive_pool_base(const adaptive_pool_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + adaptive_pool_base(const adaptive_pool_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Assignment from other adaptive_pool_base @@ -151,7 +151,7 @@ class adaptive_pool_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~adaptive_pool_base() + ~adaptive_pool_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -178,14 +178,14 @@ class adaptive_pool_base //!Equality test for same type //!of adaptive_pool_base template inline -bool operator==(const adaptive_pool_base &alloc1, +bool operator==(const adaptive_pool_base &alloc1, const adaptive_pool_base &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of adaptive_pool_base template inline -bool operator!=(const adaptive_pool_base &alloc1, +bool operator!=(const adaptive_pool_base &alloc1, const adaptive_pool_base &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -211,11 +211,11 @@ class adaptive_pool_v1 template struct rebind - { + { typedef adaptive_pool_v1 other; }; - adaptive_pool_v1(SegmentManager *segment_mngr) + adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -230,13 +230,13 @@ class adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances -//!of adaptive_pool with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of adaptive_pool with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks //!that the adaptive node pool will hold. The rest of the totally free blocks will be @@ -271,11 +271,11 @@ class adaptive_pool template struct rebind - { + { typedef adaptive_pool other; }; - adaptive_pool(SegmentManager *segment_mngr) + adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -299,11 +299,11 @@ class adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains adaptive_pool from + //!Obtains adaptive_pool from //!adaptive_pool template struct rebind - { + { typedef adaptive_pool other; }; @@ -314,7 +314,7 @@ class adaptive_pool adaptive_pool& operator= (const adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other adaptive_pool //adaptive_pool& operator=(const adaptive_pool&); @@ -324,7 +324,7 @@ class adaptive_pool //!Can throw boost::interprocess::bad_alloc adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other adaptive_pool. Increments the reference + //!Copy constructor from other adaptive_pool. Increments the reference //!count of the associated node pool. Never throws adaptive_pool(const adaptive_pool &other); @@ -351,7 +351,7 @@ class adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class adaptive_pool //!Never throws const_pointer address(const_reference value) const; /* - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -400,12 +400,12 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -413,7 +413,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -426,7 +426,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -439,7 +439,7 @@ class adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain it); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -448,13 +448,13 @@ class adaptive_pool //!Equality test for same type //!of adaptive_pool template inline -bool operator==(const adaptive_pool &alloc1, +bool operator==(const adaptive_pool &alloc1, const adaptive_pool &alloc2); //!Inequality test for same type //!of adaptive_pool template inline -bool operator!=(const adaptive_pool &alloc1, +bool operator!=(const adaptive_pool &alloc1, const adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp index aa4b22dcc..497cbd447 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/allocator.hpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -45,12 +45,12 @@ namespace boost { namespace interprocess { -//!An STL compatible allocator that uses a segment manager as +//!An STL compatible allocator that uses a segment manager as //!memory source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... template -class allocator +class allocator { public: //Segment manager @@ -115,7 +115,7 @@ class allocator //!objects of type T2 template struct rebind - { + { typedef allocator other; }; @@ -126,27 +126,28 @@ class allocator //!Constructor from the segment manager. //!Never throws - allocator(segment_manager *segment_mngr) + allocator(segment_manager *segment_mngr) : mp_mngr(segment_mngr) { } //!Constructor from other allocator. //!Never throws - allocator(const allocator &other) + allocator(const allocator &other) : mp_mngr(other.get_segment_manager()){ } //!Constructor from related allocator. //!Never throws template - allocator(const allocator &other) + allocator(const allocator &other) : mp_mngr(other.get_segment_manager()){} - //!Allocates memory for an array of count elements. + //!Allocates memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_ptr hint = 0) { (void)hint; - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); + } return pointer(static_cast(mp_mngr->allocate(count*sizeof(T)))); } @@ -169,13 +170,13 @@ class allocator //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -189,19 +190,20 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many - (size_type elem_size, size_type num_elements) + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) { - return multiallocation_chain(mp_mngr->allocate_many(sizeof(T)*elem_size, num_elements)); + if(size_overflows(elem_size)){ + throw bad_alloc(); + } + mp_mngr->allocate_many(elem_size*sizeof(T), num_elements, chain); } //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many - (const size_type *elem_sizes, size_type n_elements) + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { - multiallocation_chain(mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T))); + mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), chain); } //!Allocates many elements of size elem_size in a contiguous block @@ -210,10 +212,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain) - { - return mp_mngr->deallocate_many(chain.extract_multiallocation_chain()); - } + void deallocate_many(multiallocation_chain &chain) + { mp_mngr->deallocate_many(chain); } //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -227,9 +227,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual - (size_type num_elements) - { return this->allocate_many(1, num_elements); } + void allocate_individual(size_type num_elements, multiallocation_chain &chain) + { this->allocate_many(1, num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -243,8 +242,8 @@ class allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) - { return this->deallocate_many(boost::move(chain)); } + void deallocate_individual(multiallocation_chain &chain) + { this->deallocate_many(chain); } //!Returns address of mutable object. //!Never throws @@ -273,14 +272,14 @@ class allocator //!Equality test for same type //!of allocator template inline -bool operator==(const allocator &alloc1, +bool operator==(const allocator &alloc1, const allocator &alloc2) { return alloc1.get_segment_manager() == alloc2.get_segment_manager(); } //!Inequality test for same type //!of allocator template inline -bool operator!=(const allocator &alloc1, +bool operator!=(const allocator &alloc1, const allocator &alloc2) { return alloc1.get_segment_manager() != alloc2.get_segment_manager(); } diff --git a/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp index bec1050de..2a2d7b8a4 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/cached_adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,7 +28,7 @@ #include //!\file -//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator +//!Describes cached_adaptive_pool pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -69,7 +69,7 @@ class cached_adaptive_pool_v1 template struct rebind - { + { typedef cached_adaptive_pool_v1 other; }; @@ -77,7 +77,7 @@ class cached_adaptive_pool_v1 typedef typename base_t::size_type size_type; cached_adaptive_pool_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -93,12 +93,12 @@ class cached_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... //! -//!This node allocator shares a segregated storage between all instances of +//!This node allocator shares a segregated storage between all instances of //!cached_adaptive_pool with equal sizeof(T) placed in the same //!memory segment. But also caches some nodes privately to //!avoid some synchronization overhead. @@ -149,13 +149,13 @@ class cached_adaptive_pool template struct rebind - { + { typedef cached_adaptive_pool other; }; cached_adaptive_pool(SegmentManager *segment_mngr, - std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + std::size_t max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -179,11 +179,11 @@ class cached_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains cached_adaptive_pool from + //!Obtains cached_adaptive_pool from //!cached_adaptive_pool template struct rebind - { + { typedef cached_adaptive_pool other; }; @@ -194,7 +194,7 @@ class cached_adaptive_pool cached_adaptive_pool& operator= (const cached_adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other cached_adaptive_pool cached_adaptive_pool& operator=(const cached_adaptive_pool&); @@ -204,7 +204,7 @@ class cached_adaptive_pool //!Can throw boost::interprocess::bad_alloc cached_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other cached_adaptive_pool. Increments the reference + //!Copy constructor from other cached_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws cached_adaptive_pool(const cached_adaptive_pool &other); @@ -231,7 +231,7 @@ class cached_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -255,7 +255,7 @@ class cached_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -270,7 +270,7 @@ class cached_adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -280,12 +280,12 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -293,7 +293,7 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -319,7 +319,7 @@ class cached_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); //!Sets the new max cached nodes value. This can provoke deallocations //!if "newmax" is less than current cached nodes. Never throws void set_max_cached_nodes(size_type newmax); @@ -335,13 +335,13 @@ class cached_adaptive_pool //!Equality test for same type //!of cached_adaptive_pool template inline -bool operator==(const cached_adaptive_pool &alloc1, +bool operator==(const cached_adaptive_pool &alloc1, const cached_adaptive_pool &alloc2); //!Inequality test for same type //!of cached_adaptive_pool template inline -bool operator!=(const cached_adaptive_pool &alloc1, +bool operator!=(const cached_adaptive_pool &alloc1, const cached_adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp index 03398156d..ed1bee2f1 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/cached_node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,7 +28,7 @@ #include //!\file -//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator +//!Describes cached_cached_node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -64,7 +64,7 @@ class cached_node_allocator_v1 template struct rebind - { + { typedef cached_node_allocator_v1 other; }; @@ -72,7 +72,7 @@ class cached_node_allocator_v1 typedef typename base_t::size_type size_type; cached_node_allocator_v1(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -122,12 +122,12 @@ class cached_node_allocator template struct rebind - { + { typedef cached_node_allocator other; }; cached_node_allocator(SegmentManager *segment_mngr, - size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) + size_type max_cached_nodes = base_t::DEFAULT_MAX_CACHED_NODES) : base_t(segment_mngr, max_cached_nodes) {} @@ -151,11 +151,11 @@ class cached_node_allocator typedef typename SegmentManager::size_type size_type; typedef typename SegmentManager::difference_type difference_type; - //!Obtains cached_node_allocator from + //!Obtains cached_node_allocator from //!cached_node_allocator template struct rebind - { + { typedef cached_node_allocator other; }; @@ -166,7 +166,7 @@ class cached_node_allocator cached_node_allocator& operator= (const cached_node_allocator&); - //!Not assignable from + //!Not assignable from //!other cached_node_allocator cached_node_allocator& operator=(const cached_node_allocator&); @@ -176,7 +176,7 @@ class cached_node_allocator //!Can throw boost::interprocess::bad_alloc cached_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other cached_node_allocator. Increments the reference + //!Copy constructor from other cached_node_allocator. Increments the reference //!count of the associated node pool. Never throws cached_node_allocator(const cached_node_allocator &other); @@ -203,7 +203,7 @@ class cached_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -227,7 +227,7 @@ class cached_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Default construct an object. + //!Default construct an object. //!Throws if T's default constructor throws void construct(const pointer &ptr, const_reference v); @@ -242,7 +242,7 @@ class cached_node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -252,12 +252,12 @@ class cached_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -265,7 +265,7 @@ class cached_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -307,13 +307,13 @@ class cached_node_allocator //!Equality test for same type //!of cached_node_allocator template inline -bool operator==(const cached_node_allocator &alloc1, +bool operator==(const cached_node_allocator &alloc1, const cached_node_allocator &alloc2); //!Inequality test for same type //!of cached_node_allocator template inline -bool operator!=(const cached_node_allocator &alloc1, +bool operator!=(const cached_node_allocator &alloc1, const cached_node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp index 4ccc92066..a3afa8ee4 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -45,10 +45,16 @@ template< class SegmentManager > class private_adaptive_node_pool : public boost::container::container_detail::private_adaptive_node_pool_impl - + < typename SegmentManager::segment_manager_base_type + , ::boost::container::adaptive_pool_flag::size_ordered | + ::boost::container::adaptive_pool_flag::address_ordered + > { typedef boost::container::container_detail::private_adaptive_node_pool_impl - base_t; + < typename SegmentManager::segment_manager_base_type + , ::boost::container::adaptive_pool_flag::size_ordered | + ::boost::container::adaptive_pool_flag::address_ordered + > base_t; //Non-copyable private_adaptive_node_pool(); private_adaptive_node_pool(const private_adaptive_node_pool &); @@ -74,7 +80,7 @@ class private_adaptive_node_pool }; //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager @@ -83,7 +89,7 @@ template< class SegmentManager , std::size_t MaxFreeBlocks , unsigned char OverheadPercent > -class shared_adaptive_node_pool +class shared_adaptive_node_pool : public ipcdetail::shared_pool_impl < private_adaptive_node_pool diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp index ea660b1a9..f2b54a8ab 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/allocator_common.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -73,7 +73,7 @@ namespace ipcdetail { template struct get_or_create_node_pool_func { - + //!This connects or constructs the unique instance of node_pool_t //!Can throw boost::interprocess::bad_alloc void operator()() @@ -90,7 +90,7 @@ struct get_or_create_node_pool_func //!object parameters get_or_create_node_pool_func(typename NodePool::segment_manager *mngr) : mp_segment_manager(mngr){} - + NodePool *mp_node_pool; typename NodePool::segment_manager *mp_segment_manager; }; @@ -103,13 +103,13 @@ inline NodePool *get_or_create_node_pool(typename NodePool::segment_manager *mgn return func.mp_node_pool; } -//!Object function that decrements the reference count. If the count -//!reaches to zero destroys the node allocator from memory. +//!Object function that decrements the reference count. If the count +//!reaches to zero destroys the node allocator from memory. //!Never throws template struct destroy_if_last_link_func { - //!Decrements reference count and destroys the object if there is no + //!Decrements reference count and destroys the object if there is no //!more attached allocators. Never throws void operator()() { @@ -117,19 +117,19 @@ struct destroy_if_last_link_func if(mp_node_pool->dec_ref_count() != 0) return; //Last link, let's destroy the segment_manager - mp_node_pool->get_segment_manager()->template destroy(boost::interprocess::unique_instance); - } + mp_node_pool->get_segment_manager()->template destroy(boost::interprocess::unique_instance); + } //!Constructor. Initializes function //!object parameters - destroy_if_last_link_func(NodePool *pool) + destroy_if_last_link_func(NodePool *pool) : mp_node_pool(pool) {} NodePool *mp_node_pool; }; -//!Destruction function, initializes and executes destruction function +//!Destruction function, initializes and executes destruction function //!object. Never throws template inline void destroy_node_pool_if_last_link(NodePool *pool) @@ -173,7 +173,7 @@ class cache_impl ~cache_impl() { this->deallocate_all_cached_nodes(); - ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); + ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); } NodePool *get_node_pool() const @@ -189,34 +189,29 @@ class cache_impl { //If don't have any cached node, we have to get a new list of free nodes from the pool if(m_cached_nodes.empty()){ - m_cached_nodes = mp_node_pool->allocate_nodes(m_max_cached_nodes/2); + mp_node_pool->allocate_nodes(m_max_cached_nodes/2, m_cached_nodes); } - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front()); - m_cached_nodes.pop_front(); + void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); return ret; } - multiallocation_chain cached_allocation(size_type n) + void cached_allocation(size_type n, multiallocation_chain &chain) { - multiallocation_chain chain; size_type count = n, allocated(0); BOOST_TRY{ //If don't have any cached node, we have to get a new list of free nodes from the pool while(!m_cached_nodes.empty() && count--){ - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.front()); - m_cached_nodes.pop_front(); + void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); chain.push_back(ret); ++allocated; } if(allocated != n){ - multiallocation_chain chain2(mp_node_pool->allocate_nodes(n - allocated)); - chain.splice_after(chain.last(), chain2, chain2.before_begin(), chain2.last(), n - allocated); + mp_node_pool->allocate_nodes(n - allocated, chain); } - return boost::move(chain); } BOOST_CATCH(...){ - this->cached_deallocation(boost::move(chain)); + this->cached_deallocation(chain); BOOST_RETHROW } BOOST_CATCH_END @@ -227,7 +222,7 @@ class cache_impl //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -235,14 +230,14 @@ class cache_impl m_cached_nodes.push_front(ptr); } - void cached_deallocation(multiallocation_chain chain) + void cached_deallocation(multiallocation_chain &chain) { m_cached_nodes.splice_after(m_cached_nodes.before_begin(), chain); //Check if cache is full if(m_cached_nodes.size() >= m_max_cached_nodes){ //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); @@ -262,7 +257,7 @@ class cache_impl void deallocate_all_cached_nodes() { if(m_cached_nodes.empty()) return; - mp_node_pool->deallocate_nodes(boost::move(m_cached_nodes)); + mp_node_pool->deallocate_nodes(m_cached_nodes); } private: @@ -279,7 +274,7 @@ class cache_impl void priv_deallocate_n_nodes(size_type n) { //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more + //with other equal allocator. Since the cache is full, and more //deallocations are probably coming, we'll make some room in cache //in a single, efficient multi node deallocation. size_type count(n); @@ -290,16 +285,16 @@ class cache_impl multiallocation_chain chain; chain.splice_after(chain.before_begin(), m_cached_nodes, m_cached_nodes.before_begin(), it, n); //Deallocate all new linked list at once - mp_node_pool->deallocate_nodes(boost::move(chain)); + mp_node_pool->deallocate_nodes(chain); } public: void swap(cache_impl &other) { - ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); - m_cached_nodes.swap(other.m_cached_nodes); - ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); - } + ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); + m_cached_nodes.swap(other.m_cached_nodes); + ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); + } }; template @@ -335,13 +330,13 @@ class array_allocation_impl //!pointed by p can hold. This size only works for memory allocated with //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const - { + { return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0) { @@ -355,17 +350,20 @@ class array_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements) + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) { - return this->derived()->get_segment_manager()->allocate_many(sizeof(T)*elem_size, num_elements); + if(size_overflows(elem_size)){ + throw bad_alloc(); + } + this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain); } //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements) + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { - return this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T)); + this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain); } //!Allocates many elements of size elem_size in a contiguous block @@ -374,8 +372,8 @@ class array_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain) - { return this->derived()->get_segment_manager()->deallocate_many(boost::move(chain)); } + void deallocate_many(multiallocation_chain &chain) + { this->derived()->get_segment_manager()->deallocate_many(chain); } //!Returns the number of elements that could be //!allocated. Never throws @@ -450,21 +448,24 @@ class node_pool_allocation_impl }; public: - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { (void)hint; typedef typename node_pool<0>::type node_pool_t; node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); - else if(Version == 1 && count == 1) + } + else if(Version == 1 && count == 1){ return pointer(static_cast (pool->allocate_node())); - else + } + else{ return pointer(static_cast - (pool->get_segment_manager()->allocate(sizeof(T)*count))); + (pool->get_segment_manager()->allocate(count*sizeof(T)))); + } } //!Deallocate allocated memory. Never throws @@ -495,11 +496,11 @@ class node_pool_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements) + void allocate_individual(size_type num_elements, multiallocation_chain &chain) { typedef typename node_pool<0>::type node_pool_t; node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - return multiallocation_chain(pool->allocate_nodes(num_elements)); + pool->allocate_nodes(num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). @@ -518,10 +519,10 @@ class node_pool_allocation_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) + void deallocate_individual(multiallocation_chain &chain) { node_pool<0>::get(this->derived()->get_node_pool())->deallocate_nodes - (chain.extract_multiallocation_chain()); + (chain); } //!Deallocates all free blocks of the pool @@ -599,20 +600,21 @@ class cached_allocator_impl size_type get_max_cached_nodes() const { return m_cache.get_max_cached_nodes(); } - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0) { (void)hint; void * ret; - if(count > this->max_size()) + if(size_overflows(count)){ throw bad_alloc(); + } else if(Version == 1 && count == 1){ ret = m_cache.cached_allocation(); } else{ - ret = this->get_segment_manager()->allocate(sizeof(T)*count); - } + ret = this->get_segment_manager()->allocate(count*sizeof(T)); + } return pointer(static_cast(ret)); } @@ -640,8 +642,8 @@ class cached_allocator_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements) - { return multiallocation_chain(this->m_cache.cached_allocation(num_elements)); } + void allocate_individual(size_type num_elements, multiallocation_chain &chain) + { this->m_cache.cached_allocation(num_elements, chain); } //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -655,12 +657,8 @@ class cached_allocator_impl //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain) - { - typename node_pool_t::multiallocation_chain mem - (chain.extract_multiallocation_chain()); - m_cache.cached_deallocation(boost::move(mem)); - } + void deallocate_individual(multiallocation_chain &chain) + { m_cache.cached_deallocation(chain); } //!Deallocates all free blocks of the pool void deallocate_free_blocks() @@ -686,20 +684,20 @@ class cached_allocator_impl //!Equality test for same type of //!cached_allocator_impl template inline -bool operator==(const cached_allocator_impl &alloc1, +bool operator==(const cached_allocator_impl &alloc1, const cached_allocator_impl &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type of //!cached_allocator_impl template inline -bool operator!=(const cached_allocator_impl &alloc1, +bool operator!=(const cached_allocator_impl &alloc1, const cached_allocator_impl &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template @@ -736,7 +734,7 @@ class shared_pool_impl //----------------------- return private_node_allocator_t::allocate_node(); } - + //!Deallocates an array pointed by ptr. Never throws void deallocate_node(void *ptr) { @@ -745,25 +743,15 @@ class shared_pool_impl //----------------------- private_node_allocator_t::deallocate_node(ptr); } -/* - //!Allocates a singly linked list of n nodes ending in null pointer. - //!can throw boost::interprocess::bad_alloc - void allocate_nodes(multiallocation_chain &nodes, size_type n) - { - //----------------------- - boost::interprocess::scoped_lock guard(m_header); - //----------------------- - return private_node_allocator_t::allocate_nodes(nodes, n); - } -*/ - //!Allocates n nodes. + + //!Allocates n nodes. //!Can throw boost::interprocess::bad_alloc - multiallocation_chain allocate_nodes(const size_type n) + void allocate_nodes(const size_type n, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return private_node_allocator_t::allocate_nodes(n); + private_node_allocator_t::allocate_nodes(n, chain); } //!Deallocates a linked list of nodes ending in null pointer. Never throws @@ -776,12 +764,12 @@ class shared_pool_impl } //!Deallocates the nodes pointed by the multiallocation iterator. Never throws - void deallocate_nodes(multiallocation_chain chain) + void deallocate_nodes(multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - private_node_allocator_t::deallocate_nodes(boost::move(chain)); + private_node_allocator_t::deallocate_nodes(chain); } //!Deallocates all the free blocks of memory. Never throws diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp index 7327ff92d..e67d3217b 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/node_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -37,7 +37,7 @@ namespace ipcdetail { //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock > @@ -73,18 +73,18 @@ class private_node_pool //!Pooled shared memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time //!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is +//!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager , std::size_t NodeSize , std::size_t NodesPerBlock > -class shared_node_pool +class shared_node_pool : public ipcdetail::shared_pool_impl < private_node_pool diff --git a/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp b/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp index da7e4668e..e9fec385e 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/detail/node_tools.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp index f1c3259d7..3b2ec2901 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -34,7 +34,7 @@ #include //!\file -//!Describes node_allocator pooled shared memory STL compatible allocator +//!Describes node_allocator pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -98,11 +98,11 @@ class node_allocator_base typedef boost::container::container_detail::transform_multiallocation_chain multiallocation_chain; - //!Obtains node_allocator_base from + //!Obtains node_allocator_base from //!node_allocator_base template struct rebind - { + { typedef node_allocator_base other; }; @@ -121,15 +121,15 @@ class node_allocator_base //!Constructor from a segment manager. If not present, constructs a node //!pool. Increments the reference count of the associated node pool. //!Can throw boost::interprocess::bad_alloc - node_allocator_base(segment_manager *segment_mngr) + node_allocator_base(segment_manager *segment_mngr) : mp_node_pool(ipcdetail::get_or_create_node_pool::type>(segment_mngr)) { } - //!Copy constructor from other node_allocator_base. Increments the reference + //!Copy constructor from other node_allocator_base. Increments the reference //!count of the associated node pool. Never throws - node_allocator_base(const node_allocator_base &other) - : mp_node_pool(other.get_node_pool()) - { - node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); + node_allocator_base(const node_allocator_base &other) + : mp_node_pool(other.get_node_pool()) + { + node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->inc_ref_count(); } //!Copy constructor from related node_allocator_base. If not present, constructs @@ -150,7 +150,7 @@ class node_allocator_base //!Destructor, removes node_pool_t from memory //!if its reference count reaches to zero. Never throws - ~node_allocator_base() + ~node_allocator_base() { ipcdetail::destroy_node_pool_if_last_link(node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))); } //!Returns a pointer to the node pool. @@ -177,14 +177,14 @@ class node_allocator_base //!Equality test for same type //!of node_allocator_base template inline -bool operator==(const node_allocator_base &alloc1, +bool operator==(const node_allocator_base &alloc1, const node_allocator_base &alloc2) { return alloc1.get_node_pool() == alloc2.get_node_pool(); } //!Inequality test for same type //!of node_allocator_base template inline -bool operator!=(const node_allocator_base &alloc1, +bool operator!=(const node_allocator_base &alloc1, const node_allocator_base &alloc2) { return alloc1.get_node_pool() != alloc2.get_node_pool(); } @@ -206,11 +206,11 @@ class node_allocator_v1 template struct rebind - { + { typedef node_allocator_v1 other; }; - node_allocator_v1(SegmentManager *segment_mngr) + node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -225,12 +225,12 @@ class node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This node allocator shares a segregated storage between all instances -//!of node_allocator with equal sizeof(T) placed in the same segment +//!This node allocator shares a segregated storage between all instances +//!of node_allocator with equal sizeof(T) placed in the same segment //!group. NodesPerBlock is the number of nodes allocated at once when the allocator //!needs runs out of nodes template < class T @@ -256,11 +256,11 @@ class node_allocator template struct rebind - { + { typedef node_allocator other; }; - node_allocator(SegmentManager *segment_mngr) + node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -284,11 +284,11 @@ class node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains node_allocator from + //!Obtains node_allocator from //!node_allocator template struct rebind - { + { typedef node_allocator other; }; @@ -299,7 +299,7 @@ class node_allocator node_allocator& operator= (const node_allocator&); - //!Not assignable from + //!Not assignable from //!other node_allocator //node_allocator& operator=(const node_allocator&); @@ -309,7 +309,7 @@ class node_allocator //!Can throw boost::interprocess::bad_alloc node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other node_allocator. Increments the reference + //!Copy constructor from other node_allocator. Increments the reference //!count of the associated node pool. Never throws node_allocator(const node_allocator &other); @@ -336,7 +336,7 @@ class node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -360,7 +360,7 @@ class node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -375,7 +375,7 @@ class node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -385,12 +385,12 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -398,7 +398,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -411,7 +411,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -424,7 +424,7 @@ class node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -433,13 +433,13 @@ class node_allocator //!Equality test for same type //!of node_allocator template inline -bool operator==(const node_allocator &alloc1, +bool operator==(const node_allocator &alloc1, const node_allocator &alloc2); //!Inequality test for same type //!of node_allocator template inline -bool operator!=(const node_allocator &alloc1, +bool operator!=(const node_allocator &alloc1, const node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp b/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp index 301fb92da..fd7ad7c7d 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/private_adaptive_pool.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -33,7 +33,7 @@ #include //!\file -//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator +//!Describes private_adaptive_pool_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -102,7 +102,7 @@ class private_adaptive_pool_base //!Obtains node_allocator from other node_allocator template struct rebind - { + { typedef private_adaptive_pool_base other; }; @@ -154,7 +154,7 @@ class private_adaptive_pool_base {} //!Destructor, frees all used memory. Never throws - ~private_adaptive_pool_base() + ~private_adaptive_pool_base() {} //!Returns the segment manager. Never throws @@ -178,13 +178,13 @@ class private_adaptive_pool_base //!Equality test for same type of private_adaptive_pool_base template inline -bool operator==(const private_adaptive_pool_base &alloc1, +bool operator==(const private_adaptive_pool_base &alloc1, const private_adaptive_pool_base &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_adaptive_pool_base template inline -bool operator!=(const private_adaptive_pool_base &alloc1, +bool operator!=(const private_adaptive_pool_base &alloc1, const private_adaptive_pool_base &alloc2) { return &alloc1 != &alloc2; } @@ -210,11 +210,11 @@ class private_adaptive_pool_v1 template struct rebind - { + { typedef private_adaptive_pool_v1 other; }; - private_adaptive_pool_v1(SegmentManager *segment_mngr) + private_adaptive_pool_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -229,7 +229,7 @@ class private_adaptive_pool_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... @@ -269,12 +269,12 @@ class private_adaptive_pool template struct rebind - { + { typedef private_adaptive_pool other; }; - private_adaptive_pool(SegmentManager *segment_mngr) + private_adaptive_pool(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -298,11 +298,11 @@ class private_adaptive_pool typedef typename segment_manager::size_type size_type; typedef typename segment_manager::difference_type difference_type; - //!Obtains private_adaptive_pool from + //!Obtains private_adaptive_pool from //!private_adaptive_pool template struct rebind - { + { typedef private_adaptive_pool other; }; @@ -314,7 +314,7 @@ class private_adaptive_pool private_adaptive_pool& operator= (const private_adaptive_pool&); - //!Not assignable from + //!Not assignable from //!other private_adaptive_pool private_adaptive_pool& operator=(const private_adaptive_pool&); @@ -324,7 +324,7 @@ class private_adaptive_pool //!Can throw boost::interprocess::bad_alloc private_adaptive_pool(segment_manager *segment_mngr); - //!Copy constructor from other private_adaptive_pool. Increments the reference + //!Copy constructor from other private_adaptive_pool. Increments the reference //!count of the associated node pool. Never throws private_adaptive_pool(const private_adaptive_pool &other); @@ -351,7 +351,7 @@ class private_adaptive_pool //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -375,7 +375,7 @@ class private_adaptive_pool //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -390,7 +390,7 @@ class private_adaptive_pool std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -400,12 +400,12 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -413,7 +413,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -426,7 +426,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -439,7 +439,7 @@ class private_adaptive_pool //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -448,13 +448,13 @@ class private_adaptive_pool //!Equality test for same type //!of private_adaptive_pool template inline -bool operator==(const private_adaptive_pool &alloc1, +bool operator==(const private_adaptive_pool &alloc1, const private_adaptive_pool &alloc2); //!Inequality test for same type //!of private_adaptive_pool template inline -bool operator!=(const private_adaptive_pool &alloc1, +bool operator!=(const private_adaptive_pool &alloc1, const private_adaptive_pool &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp b/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp index f202e316f..93a4750b8 100644 --- a/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp +++ b/project/jni/boost/include/boost/interprocess/allocators/private_node_allocator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -33,7 +33,7 @@ #include //!\file -//!Describes private_node_allocator_base pooled shared memory STL compatible allocator +//!Describes private_node_allocator_base pooled shared memory STL compatible allocator namespace boost { namespace interprocess { @@ -97,7 +97,7 @@ class private_node_allocator_base //!Obtains node_allocator from other node_allocator template struct rebind - { + { typedef private_node_allocator_base other; }; @@ -146,7 +146,7 @@ class private_node_allocator_base {} //!Destructor, frees all used memory. Never throws - ~private_node_allocator_base() + ~private_node_allocator_base() {} //!Returns the segment manager. Never throws @@ -170,13 +170,13 @@ class private_node_allocator_base //!Equality test for same type of private_node_allocator_base template inline -bool operator==(const private_node_allocator_base &alloc1, +bool operator==(const private_node_allocator_base &alloc1, const private_node_allocator_base &alloc2) { return &alloc1 == &alloc2; } //!Inequality test for same type of private_node_allocator_base template inline -bool operator!=(const private_node_allocator_base &alloc1, +bool operator!=(const private_node_allocator_base &alloc1, const private_node_allocator_base &alloc2) { return &alloc1 != &alloc2; } @@ -198,11 +198,11 @@ class private_node_allocator_v1 template struct rebind - { + { typedef private_node_allocator_v1 other; }; - private_node_allocator_v1(SegmentManager *segment_mngr) + private_node_allocator_v1(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -217,11 +217,11 @@ class private_node_allocator_v1 /// @endcond -//!An STL node allocator that uses a segment manager as memory +//!An STL node allocator that uses a segment manager as memory //!source. The internal pointer type will of the same type (raw, smart) as //!"typename SegmentManager::void_pointer" type. This allows //!placing the allocator in shared memory, memory mapped-files, etc... -//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated +//!This allocator has its own node pool. NodesPerBlock is the number of nodes allocated //!at once when the allocator needs runs out of nodes template < class T , class SegmentManager @@ -246,12 +246,12 @@ class private_node_allocator template struct rebind - { + { typedef private_node_allocator other; }; - private_node_allocator(SegmentManager *segment_mngr) + private_node_allocator(SegmentManager *segment_mngr) : base_t(segment_mngr) {} @@ -275,11 +275,11 @@ class private_node_allocator typedef typename segment_manager::size_type size_type; typedef typename segment_manage::difference_type difference_type; - //!Obtains private_node_allocator from + //!Obtains private_node_allocator from //!private_node_allocator template struct rebind - { + { typedef private_node_allocator other; }; @@ -291,7 +291,7 @@ class private_node_allocator private_node_allocator& operator= (const private_node_allocator&); - //!Not assignable from + //!Not assignable from //!other private_node_allocator private_node_allocator& operator=(const private_node_allocator&); @@ -301,7 +301,7 @@ class private_node_allocator //!Can throw boost::interprocess::bad_alloc private_node_allocator(segment_manager *segment_mngr); - //!Copy constructor from other private_node_allocator. Increments the reference + //!Copy constructor from other private_node_allocator. Increments the reference //!count of the associated node pool. Never throws private_node_allocator(const private_node_allocator &other); @@ -328,7 +328,7 @@ class private_node_allocator //!Never throws size_type max_size() const; - //!Allocate memory for an array of count elements. + //!Allocate memory for an array of count elements. //!Throws boost::interprocess::bad_alloc if there is no enough memory pointer allocate(size_type count, cvoid_pointer hint = 0); @@ -352,7 +352,7 @@ class private_node_allocator //!Never throws const_pointer address(const_reference value) const; - //!Copy construct an object. + //!Copy construct an object. //!Throws if T's copy constructor throws void construct(const pointer &ptr, const_reference v); @@ -367,7 +367,7 @@ class private_node_allocator std::pair allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, + size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse = 0); @@ -377,12 +377,12 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - multiallocation_chain allocate_many(size_type elem_size, size_type num_elements); + void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain); //!Allocates n_elements elements, each one of size elem_sizes[i]in a //!contiguous block //!of memory. The elements must be deallocated - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements); + void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, @@ -390,7 +390,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. The elements must be deallocated //!with deallocate(...) - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -403,7 +403,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - multiallocation_chain allocate_individual(size_type num_elements); + void allocate_individual(size_type num_elements, multiallocation_chain &chain); //!Deallocates memory previously allocated with allocate_one(). //!You should never use deallocate_one to deallocate memory allocated @@ -416,7 +416,7 @@ class private_node_allocator //!preferred_elements. The number of actually allocated elements is //!will be assigned to received_size. Memory allocated with this function //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain chain); + void deallocate_individual(multiallocation_chain &chain); #endif }; @@ -425,13 +425,13 @@ class private_node_allocator //!Equality test for same type //!of private_node_allocator template inline -bool operator==(const private_node_allocator &alloc1, +bool operator==(const private_node_allocator &alloc1, const private_node_allocator &alloc2); //!Inequality test for same type //!of private_node_allocator template inline -bool operator!=(const private_node_allocator &alloc1, +bool operator!=(const private_node_allocator &alloc1, const private_node_allocator &alloc2); #endif diff --git a/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp index 7184306a6..2eb219a83 100644 --- a/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/anonymous_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -20,7 +20,7 @@ #include #if (!defined(BOOST_INTERPROCESS_WINDOWS)) -# include //open, O_CREAT, O_*... +# include //open, O_CREAT, O_*... # include //mmap # include //mode_t, S_IRWXG, S_IRWXO, S_IRWXU, #else @@ -43,12 +43,10 @@ namespace ipcdetail{ { public: static mapped_region - create_posix_mapped_region(void *address, offset_t offset, std::size_t size) + create_posix_mapped_region(void *address, std::size_t size) { mapped_region region; region.m_base = address; - region.m_offset = offset; - region.m_extra_offset = 0; region.m_size = size; return region; } @@ -92,16 +90,16 @@ anonymous_shared_memory(std::size_t size, void *address = 0) , 0); if(address == MAP_FAILED){ - if(fd != -1) + if(fd != -1) close(fd); error_info err = system_error_code(); throw interprocess_exception(err); } - if(fd != -1) + if(fd != -1) close(fd); - return ipcdetail::raw_mapped_region_creator::create_posix_mapped_region(address, 0, size); + return ipcdetail::raw_mapped_region_creator::create_posix_mapped_region(address, size); } #else { diff --git a/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp b/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp index 660b6cbdb..eea431b0d 100644 --- a/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/allocation_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp b/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp index 7852bbc85..28cd0f126 100644 --- a/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/containers_fwd.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/deque.hpp b/project/jni/boost/include/boost/interprocess/containers/deque.hpp index 30ca43203..66122e247 100644 --- a/project/jni/boost/include/boost/interprocess/containers/deque.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/deque.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp b/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp index f18a006c7..38b04ac9a 100644 --- a/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/flat_map.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp b/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp index 1b2bf9b4d..45b42fd1e 100644 --- a/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/flat_set.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/list.hpp b/project/jni/boost/include/boost/interprocess/containers/list.hpp index a75b9759b..50f0ff0d0 100644 --- a/project/jni/boost/include/boost/interprocess/containers/list.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/list.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/map.hpp b/project/jni/boost/include/boost/interprocess/containers/map.hpp index 2e45ec063..ca00b2049 100644 --- a/project/jni/boost/include/boost/interprocess/containers/map.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/map.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/pair.hpp b/project/jni/boost/include/boost/interprocess/containers/pair.hpp index 8ba6d047a..65526ab93 100644 --- a/project/jni/boost/include/boost/interprocess/containers/pair.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/pair.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/set.hpp b/project/jni/boost/include/boost/interprocess/containers/set.hpp index db06afea6..697920453 100644 --- a/project/jni/boost/include/boost/interprocess/containers/set.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/set.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/slist.hpp b/project/jni/boost/include/boost/interprocess/containers/slist.hpp index f93379cb7..b511d060f 100644 --- a/project/jni/boost/include/boost/interprocess/containers/slist.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/slist.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp b/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp index ae09e6b52..4a59b81ed 100644 --- a/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/stable_vector.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/string.hpp b/project/jni/boost/include/boost/interprocess/containers/string.hpp index a11bb904b..e7af2fa36 100644 --- a/project/jni/boost/include/boost/interprocess/containers/string.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/string.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/vector.hpp b/project/jni/boost/include/boost/interprocess/containers/vector.hpp index 3a6b41151..3f10e0153 100644 --- a/project/jni/boost/include/boost/interprocess/containers/vector.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/vector.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/containers/version_type.hpp b/project/jni/boost/include/boost/interprocess/containers/version_type.hpp index 247f800f4..4516e8c9b 100644 --- a/project/jni/boost/include/boost/interprocess/containers/version_type.hpp +++ b/project/jni/boost/include/boost/interprocess/containers/version_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/creation_tags.hpp b/project/jni/boost/include/boost/interprocess/creation_tags.hpp index 374829ac2..459eb4df4 100644 --- a/project/jni/boost/include/boost/interprocess/creation_tags.hpp +++ b/project/jni/boost/include/boost/interprocess/creation_tags.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/detail/atomic.hpp b/project/jni/boost/include/boost/interprocess/detail/atomic.hpp index f7551f3dd..08481a430 100644 --- a/project/jni/boost/include/boost/interprocess/detail/atomic.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/atomic.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2011 +// (C) Copyright Ion Gaztanaga 2006-2012 // (C) Copyright Markus Schoepflin 2007 // (C) Copyright Bryce Lelbach 2010 // @@ -117,23 +117,6 @@ inline boost::uint32_t atomic_cas32 : "cc"); return prev; -/* - asm volatile( "lock\n\t" - "cmpxchg %3,%1" - : "=a" (prev), "=m" (*(mem)) - : "0" (prev), "r" (with) - : "memory", "cc"); -*/ -/* - boost::uint32_t prev; - - asm volatile ("lock; cmpxchgl %1, %2" - : "=a" (prev) - : "r" (with), "m" (*(mem)), "0"(cmp)); - asm volatile("" : : : "memory"); - - return prev; -*/ } //! Atomically add 'val' to an boost::uint32_t @@ -158,14 +141,6 @@ inline boost::uint32_t atomic_add32 ); return r; -/* - asm volatile( "lock\n\t; xaddl %0,%1" - : "=r"(val), "=m"(*mem) - : "0"(val), "m"(*mem)); - asm volatile("" : : : "memory"); - - return val; -*/ } //! Atomically increment an apr_uint32_t by 1 @@ -208,17 +183,14 @@ inline boost::uint32_t atomic_add32(volatile boost::uint32_t *mem, boost::uint32 { boost::uint32_t prev, temp; - asm volatile ("0:\n\t" // retry local label - "lwarx %0,0,%2\n\t" // load prev and reserve - "add %1,%0,%3\n\t" // temp = prev + val - "stwcx. %1,0,%2\n\t" // conditionally store - "bne- 0b" // start over if we lost - // the reservation - //XXX find a cleaner way to define the temp - //it's not an output - : "=&r" (prev), "=&r" (temp) // output, temp - : "b" (mem), "r" (val) // inputs - : "memory", "cc"); // clobbered + asm volatile ("1:\n\t" + "lwarx %0,0,%2\n\t" + "add %1,%0,%3\n\t" + "stwcx. %1,0,%2\n\t" + "bne- 1b" + : "=&r" (prev), "=&r" (temp) + : "b" (mem), "r" (val) + : "cc", "memory"); return prev; } @@ -233,19 +205,16 @@ inline boost::uint32_t atomic_cas32 { boost::uint32_t prev; - asm volatile ("0:\n\t" // retry local label - "lwarx %0,0,%1\n\t" // load prev and reserve - "cmpw %0,%3\n\t" // does it match cmp? - "bne- 1f\n\t" // ...no, bail out - "stwcx. %2,0,%1\n\t" // ...yes, conditionally - // store with - "bne- 0b\n\t" // start over if we lost - // the reservation - "1:" // exit local label - - : "=&r"(prev) // output - : "b" (mem), "r" (with), "r"(cmp) // inputs - : "memory", "cc"); // clobbered + asm volatile ("1:\n\t" + "lwarx %0,0,%1\n\t" + "cmpw %0,%3\n\t" + "bne- 2f\n\t" + "stwcx. %2,0,%1\n\t" + "bne- 1b\n\t" + "2:" + : "=&r"(prev) + : "b" (mem), "r"(cmp), "r" (with) + : "cc", "memory"); return prev; } @@ -275,56 +244,6 @@ inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) } //namespace interprocess{ } //namespace boost{ -#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ return __sync_fetch_and_add(const_cast(mem), val); } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return __sync_val_compare_and_swap(const_cast(mem), cmp, with); } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - #elif (defined(sun) || defined(__sun)) #include @@ -471,97 +390,147 @@ inline boost::uint32_t atomic_cas32( } //namespace interprocess{ } //namespace boost{ -#elif defined(__IBMCPP__) && (__IBMCPP__ >= 800) && defined(_AIX) +#elif defined(__IBMCPP__) && (__IBMCPP__ >= 800) && defined(_AIX) -#include +#include -namespace boost { -namespace interprocess { -namespace ipcdetail{ +namespace boost { +namespace interprocess { +namespace ipcdetail{ -//first define boost::uint32_t versions of __lwarx and __stwcx to avoid poluting -//all the functions with casts +//first define boost::uint32_t versions of __lwarx and __stwcx to avoid poluting +//all the functions with casts -//! From XLC documenation : -//! This function can be used with a subsequent stwcxu call to implement a -//! read-modify-write on a specified memory location. The two functions work -//! together to ensure that if the store is successfully performed, no other -//! processor or mechanism can modify the target doubleword between the time -//! lwarxu function is executed and the time the stwcxu functio ncompletes. -//! "mem" : pointer to the object -//! Returns the value at pointed to by mem -inline boost::uint32_t lwarxu(volatile boost::uint32_t *mem) -{ - return static_cast(__lwarx(reinterpret_cast(mem))); -} +//! From XLC documenation : +//! This function can be used with a subsequent stwcxu call to implement a +//! read-modify-write on a specified memory location. The two functions work +//! together to ensure that if the store is successfully performed, no other +//! processor or mechanism can modify the target doubleword between the time +//! lwarxu function is executed and the time the stwcxu functio ncompletes. +//! "mem" : pointer to the object +//! Returns the value at pointed to by mem +inline boost::uint32_t lwarxu(volatile boost::uint32_t *mem) +{ + return static_cast(__lwarx(reinterpret_cast(mem))); +} -//! "mem" : pointer to the object -//! "val" : the value to store -//! Returns true if the update of mem is successful and false if it is -//!unsuccessful -inline bool stwcxu(volatile boost::uint32_t* mem, boost::uint32_t val) -{ - return (__stwcx(reinterpret_cast(mem), static_cast(val)) != 0); -} +//! "mem" : pointer to the object +//! "val" : the value to store +//! Returns true if the update of mem is successful and false if it is +//!unsuccessful +inline bool stwcxu(volatile boost::uint32_t* mem, boost::uint32_t val) +{ + return (__stwcx(reinterpret_cast(mem), static_cast(val)) != 0); +} -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ - boost::uint32_t oldValue; - do - { - oldValue = lwarxu(mem); - }while (!stwcxu(mem, oldValue+val)); - return oldValue; -} +//! "mem": pointer to the object +//! "val": amount to add +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_add32 + (volatile boost::uint32_t *mem, boost::uint32_t val) +{ + boost::uint32_t oldValue; + do + { + oldValue = lwarxu(mem); + }while (!stwcxu(mem, oldValue+val)); + return oldValue; +} -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } +//! Atomically increment an apr_uint32_t by 1 +//! "mem": pointer to the object +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, 1); } -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } +//! Atomically decrement an boost::uint32_t by 1 +//! "mem": pointer to the atomic value +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, (boost::uint32_t)-1); } -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } +//! Atomically read an boost::uint32_t from memory +inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) +{ return *mem; } -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - boost::uint32_t oldValue; - boost::uint32_t valueToStore; - do - { - oldValue = lwarxu(mem); - } while (!stwcxu(mem, (oldValue == with) ? cmp : oldValue)); +//! Compare an boost::uint32_t's value with "cmp". +//! If they are the same swap the value with "with" +//! "mem": pointer to the value +//! "with" what to swap it with +//! "cmp": the value to compare it to +//! Returns the old value of *mem +inline boost::uint32_t atomic_cas32 + (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) +{ + boost::uint32_t oldValue; + boost::uint32_t valueToStore; + do + { + oldValue = lwarxu(mem); + } while (!stwcxu(mem, (oldValue == with) ? cmp : oldValue)); - return oldValue; -} + return oldValue; +} -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } +//! Atomically set an boost::uint32_t in memory +//! "mem": pointer to the object +//! "param": val value that the object will assume +inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) +{ *mem = val; } -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) + +namespace boost { +namespace interprocess { +namespace ipcdetail{ + +//! Atomically add 'val' to an boost::uint32_t +//! "mem": pointer to the object +//! "val": amount to add +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_add32 + (volatile boost::uint32_t *mem, boost::uint32_t val) +{ return __sync_fetch_and_add(const_cast(mem), val); } + +//! Atomically increment an apr_uint32_t by 1 +//! "mem": pointer to the object +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, 1); } + +//! Atomically decrement an boost::uint32_t by 1 +//! "mem": pointer to the atomic value +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) +{ return atomic_add32(mem, (boost::uint32_t)-1); } + +//! Atomically read an boost::uint32_t from memory +inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) +{ return *mem; } + +//! Compare an boost::uint32_t's value with "cmp". +//! If they are the same swap the value with "with" +//! "mem": pointer to the value +//! "with" what to swap it with +//! "cmp": the value to compare it to +//! Returns the old value of *mem +inline boost::uint32_t atomic_cas32 + (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) +{ return __sync_val_compare_and_swap(const_cast(mem), cmp, with); } + +//! Atomically set an boost::uint32_t in memory +//! "mem": pointer to the object +//! "param": val value that the object will assume +inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) +{ *mem = val; } + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ #else @@ -583,9 +552,9 @@ inline bool atomic_add_unless32 return c != unless_this; } -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp b/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp index bd91d1b6b..37dabd1f8 100644 --- a/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/cast_tags.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp b/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp index 559331ab3..9224f7dd6 100644 --- a/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/config_begin.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -44,4 +44,5 @@ // with /GR-; unpredictable behavior may result #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4250) // inherits 'x' via dominance #endif diff --git a/project/jni/boost/include/boost/interprocess/detail/config_end.hpp b/project/jni/boost/include/boost/interprocess/detail/config_end.hpp index 422458e85..f871ce754 100644 --- a/project/jni/boost/include/boost/interprocess/detail/config_end.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/config_end.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp b/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp new file mode 100644 index 000000000..fb578ef01 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/config_external_begin.hpp @@ -0,0 +1,18 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED +#define BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED +#include +#endif + +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wshadow" +#endif diff --git a/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp b/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp new file mode 100644 index 000000000..214558f58 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/config_external_end.hpp @@ -0,0 +1,12 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406) +# pragma GCC diagnostic pop +#endif diff --git a/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp b/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp new file mode 100644 index 000000000..2b96e2b6d --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/file_locking_helpers.hpp @@ -0,0 +1,298 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP +#define BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +#include +#include +#include + +#else //defined(BOOST_INTERPROCESS_WINDOWS) + +#include +#include +#include + +#endif //defined(BOOST_INTERPROCESS_WINDOWS) + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +struct locking_file_serial_id +{ + int fd; + unsigned long dwVolumeSerialNumber; + unsigned long nFileIndexHigh; + unsigned long nFileIndexLow; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno == EDEADLK){ + ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + return 0 == _locking(fd, _LK_NBLCK , 1); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + file_handle_t handle = create_or_open_file(name, read_write, p); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; + } + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + struct _stat s; + if(0 == _stat(name, &s)){ + return fd; + } + else{ + _close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + file_handle_t handle = open_existing_file(name, read_write); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; + } + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ _close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct _stat s; + return EBADF != _fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + if(_isatty(fd)) + return false; + struct _stat s; + if(0 != _fstat(fd, &s)) + return false; + return 0 != (s.st_mode & _S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct _stat s; + if(0 != _fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + id.fd = fd; + id.dwVolumeSerialNumber = info.dwVolumeSerialNumber; + id.nFileIndexHigh = info.nFileIndexHigh; + id.nFileIndexLow = info.nFileIndexLow; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + + return id.dwVolumeSerialNumber == info.dwVolumeSerialNumber && + id.nFileIndexHigh == info.nFileIndexHigh && + id.nFileIndexLow == info.nFileIndexLow; +} + +#else //UNIX + +struct locking_file_serial_id +{ + int fd; + dev_t st_dev; + ino_t st_ino; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno != EINTR){ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + ret = fcntl (fd, F_SETLKW, &lock); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + return 0 == fcntl (fd, F_SETLK, &lock); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + int fd = create_or_open_file(name, read_write, p); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + struct stat s; + if(0 == stat(name, &s)){ + return fd; + } + else{ + close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + int fd = open_existing_file(name, read_write); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct stat s; + return EBADF != fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + return 0 != (s.st_mode & S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + id.fd = fd; + id.st_dev = s.st_dev; + id.st_ino = s.st_ino; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + struct stat info; + if(0 != fstat(fd, &info)) + return false; + + return id.st_dev == info.st_dev && + id.st_ino == info.st_ino; +} + +#endif + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp b/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp index 7b53f36ac..e139df26a 100644 --- a/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/file_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -44,13 +44,13 @@ class file_wrapper file_wrapper(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); } - //!Tries to open a file with name "name", with the access mode "mode". + //!Tries to open a file with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. file_wrapper(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); } - //!Moves the ownership of "moved"'s file to *this. - //!After the call, "moved" does not represent any file. + //!Moves the ownership of "moved"'s file to *this. + //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper(BOOST_RV_REF(file_wrapper) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) @@ -60,10 +60,10 @@ class file_wrapper //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved) - { + { file_wrapper tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to file_wrappers. @@ -73,7 +73,7 @@ class file_wrapper //!Erases a file from the system. //!Returns false on error. Never throws static bool remove(const char *name); - + //!Sets the size of the file void truncate(offset_t length); @@ -108,11 +108,11 @@ class file_wrapper std::string m_filename; }; -inline file_wrapper::file_wrapper() +inline file_wrapper::file_wrapper() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline file_wrapper::~file_wrapper() +inline file_wrapper::~file_wrapper() { this->priv_close(); } inline const char *file_wrapper::get_name() const @@ -122,10 +122,10 @@ inline bool file_wrapper::get_size(offset_t &size) const { return get_file_size((file_handle_t)m_handle, size); } inline void file_wrapper::swap(file_wrapper &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t file_wrapper::get_mapping_handle() const @@ -135,7 +135,7 @@ inline mode_t file_wrapper::get_mode() const { return m_mode; } inline bool file_wrapper::priv_open_or_create - (ipcdetail::create_enum_t type, + (ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm = permissions()) diff --git a/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp b/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp index 0e69452a4..7c0966c10 100644 --- a/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/in_place_interface.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -25,7 +25,7 @@ //!Describes an abstract interface for placement construction and destruction. namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { struct in_place_interface diff --git a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp index 4bffbe9d4..9f41ba63f 100644 --- a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -18,1163 +18,27 @@ #include #include -#if defined(BOOST_INTERPROCESS_WINDOWS) -#include -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if defined(BOOST_INTERPROCESS_WINDOWS) -#include -#include - -#include -#else -#include -#include -#include +#ifdef BOOST_INTERPROCESS_WINDOWS + #include #endif +#include namespace boost{ namespace interprocess{ namespace ipcdetail{ -struct intermodule_singleton_mutex_family -{ - typedef boost::interprocess::ipcdetail::spin_mutex mutex_type; - typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type; -}; - -struct intermodule_types -{ - //We must use offset_ptr since a loaded DLL can map the singleton holder shared memory - //at a different address than other DLLs/main executables - typedef rbtree_best_fit > mem_algo; - template - struct open_or_create - { - typedef managed_open_or_create_impl - type; - }; -}; - -template -class basic_managed_global_memory - : public basic_managed_memory_impl - < char - , intermodule_types::mem_algo - , iset_index - , intermodule_types::open_or_create::type::ManagedOpenOrCreateUserOffset - > - , private intermodule_types::open_or_create::type -{ - /// @cond - typedef typename intermodule_types::template open_or_create::type base2_t; - - typedef basic_managed_memory_impl - < char - , intermodule_types::mem_algo - , iset_index - , base2_t::ManagedOpenOrCreateUserOffset - > base_t; - - typedef create_open_func create_open_func_t; - - basic_managed_global_memory *get_this_pointer() - { return this; } - - public: - typedef typename base_t::size_type size_type; - - private: - typedef typename base_t::char_ptr_holder_t char_ptr_holder_t; - BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory) - /// @endcond - - public: //functions -/* - basic_managed_global_memory() - {} - - basic_managed_global_memory(create_only_t create_only, const char *name, - size_type size, const void *addr = 0, const permissions& perm = permissions()) - : base_t() - , base2_t(create_only, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), DoCreate), perm) - {} -*/ - basic_managed_global_memory (open_or_create_t open_or_create, - const char *name, size_type size, - const void *addr = 0, const permissions& perm = permissions()) - : base_t() - , base2_t(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), - DoOpenOrCreate), perm) - {} - - basic_managed_global_memory (open_only_t open_only, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - -/* - basic_managed_global_memory (open_copy_on_write_t, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - - //!Connects to a created shared memory and its segment manager. - //!in read-only mode. - //!This can throw. - basic_managed_global_memory (open_read_only_t, const char* name, - const void *addr = 0) - : base_t() - , base2_t(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), - DoOpen)) - {} - - //!Moves the ownership of "moved"'s managed memory to *this. - //!Does not throw - basic_managed_global_memory(BOOST_RV_REF(basic_managed_global_memory) moved) - { - basic_managed_global_memory tmp; - this->swap(moved); - tmp.swap(moved); - } - - //!Moves the ownership of "moved"'s managed memory to *this. - //!Does not throw - basic_managed_global_memory &operator=(BOOST_RV_REF(basic_managed_global_memory) moved) - { - basic_managed_global_memory tmp(boost::move(moved)); - this->swap(tmp); - return *this; - }*/ -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) -typedef basic_managed_global_memory windows_managed_global_memory; -#endif - -typedef basic_managed_global_memory managed_global_memory; - -namespace file_locking_helpers { - -inline void get_pid_creation_time_str(std::string &s) -{ - std::stringstream stream; - stream << get_current_process_id() << '_'; - stream.precision(6); - stream << std::fixed << get_current_process_creation_time(); - s = stream.str(); -} - -inline void create_tmp_subdir_and_get_pid_based_filepath(const char *subdir_name, const char *file_prefix, OS_process_id_t pid, std::string &s, bool creation_time = false) -{ - //Let's create a lock file for each process gmem that will mark if - //the process is alive or not - create_tmp_and_clean_old(s); - s += "/"; - s += subdir_name; - if(!open_or_create_directory(s.c_str())){ - throw interprocess_exception(error_info(system_error_code())); - } - s += "/"; - s += file_prefix; - if(creation_time){ - std::string sstamp; - get_pid_creation_time_str(sstamp); - s += sstamp; - } - else{ - pid_str_t pid_str; - get_pid_str(pid_str, pid); - s += pid_str; - } -} - -inline bool check_if_filename_complies_with_pid - (const char *filename, const char *prefix, OS_process_id_t pid, std::string &file_suffix, bool creation_time = false) -{ - //Check if filename complies with lock file name pattern - std::string fname(filename); - std::string fprefix(prefix); - if(fname.size() <= fprefix.size()){ - return false; - } - fname.resize(fprefix.size()); - if(fname != fprefix){ - return false; - } - - //If not our lock file, delete it if we can lock it - fname = filename; - fname.erase(0, fprefix.size()); - pid_str_t pid_str; - get_pid_str(pid_str, pid); - file_suffix = pid_str; - if(creation_time){ - std::size_t p = fname.find('_'); - if (p == std::string::npos){ - return false; - } - std::string save_suffix(fname); - fname.erase(p); - fname.swap(file_suffix); - bool ret = (file_suffix == fname); - file_suffix.swap(save_suffix); - return ret; - } - else{ - fname.swap(file_suffix); - return (file_suffix == fname); - } -} - -} //file_locking_helpers - -namespace intermodule_singleton_helpers { - -const int GMemMarkToBeRemoved = -1; -const int GMemNotPresent = -2; - -inline const char *get_lock_file_subdir_name() -{ return "gmem"; } - -inline const char *get_lock_file_base_name() -{ return "lck"; } - -inline void create_and_get_singleton_lock_file_path(std::string &s) -{ - file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath - (get_lock_file_subdir_name(), get_lock_file_base_name(), get_current_process_id(), s, true); -} - -inline const char *get_shm_base_name() -{ return "bip.gmem.shm."; } - -inline void get_shm_name(std::string &shm_name) -{ - file_locking_helpers::get_pid_creation_time_str(shm_name); - shm_name.insert(0, get_shm_base_name()); -} - -inline std::size_t get_shm_size() -{ return 65536; } - -template -struct managed_sh_dependant -{ - static void apply_gmem_erase_logic(const char *filepath, const char *filename); - - static bool remove_old_gmem() - { - std::string refcstrRootDirectory; - tmp_folder(refcstrRootDirectory); - refcstrRootDirectory += "/"; - refcstrRootDirectory += get_lock_file_subdir_name(); - return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); - } -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct managed_sh_dependant -{ - static void apply_gmem_erase_logic(const char *, const char *){} - - static bool remove_old_gmem() - { return true; } -}; - - -struct locking_file_serial_id -{ - int fd; - unsigned long dwVolumeSerialNumber; - unsigned long nFileIndexHigh; - unsigned long nFileIndexLow; - //This reference count counts the number of modules attached - //to the shared memory and lock file. This serves to unlink - //the locking file and shared memory when all modules are - //done with the global memory (shared memory) - volatile boost::uint32_t modules_attached_to_gmem_count; -}; - -inline bool lock_locking_file(int fd) -{ - int ret = 0; - while(ret != 0 && errno == EDEADLK){ - ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); - } - return 0 == ret; -} - -inline bool try_lock_locking_file(int fd) -{ - return 0 == _locking(fd, _LK_NBLCK , 1); -} - -inline int open_or_create_and_lock_file(const char *name) -{ - permissions p; - p.set_unrestricted(); - while(1){ - file_handle_t handle = create_or_open_file(name, read_write, p); - int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); - if(fd < 0){ - close_file(handle); - return fd; - } - if(!try_lock_locking_file(fd)){ - _close(fd); - return -1; - } - struct _stat s; - if(0 == _stat(name, &s)){ - return fd; - } - else{ - _close(fd); - } - } -} - -inline int try_open_and_lock_file(const char *name) -{ - file_handle_t handle = open_existing_file(name, read_write); - int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); - if(fd < 0){ - close_file(handle); - return fd; - } - if(!try_lock_locking_file(fd)){ - _close(fd); - return -1; - } - return fd; -} - -inline void close_lock_file(int fd) -{ _close(fd); } - -inline bool is_valid_fd(int fd) -{ - struct _stat s; - return EBADF != _fstat(fd, &s); -} - -inline bool is_normal_file(int fd) -{ - if(_isatty(fd)) - return false; - struct _stat s; - if(0 != _fstat(fd, &s)) - return false; - return 0 != (s.st_mode & _S_IFREG); -} - -inline std::size_t get_size(int fd) -{ - struct _stat s; - if(0 != _fstat(fd, &s)) - return 0u; - return (std::size_t)s.st_size; -} - -inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) -{ - winapi::interprocess_by_handle_file_information info; - if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) - return false; - id.fd = fd; - id.dwVolumeSerialNumber = info.dwVolumeSerialNumber; - id.nFileIndexHigh = info.nFileIndexHigh; - id.nFileIndexLow = info.nFileIndexLow; - id.modules_attached_to_gmem_count = 1; //Initialize attached count - return true; -} - -inline bool compare_file_serial(int fd, const locking_file_serial_id &id) -{ - winapi::interprocess_by_handle_file_information info; - if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) - return false; - - return id.dwVolumeSerialNumber == info.dwVolumeSerialNumber && - id.nFileIndexHigh == info.nFileIndexHigh && - id.nFileIndexLow == info.nFileIndexLow; -} - -#else //UNIX - -struct locking_file_serial_id -{ - int fd; - dev_t st_dev; - ino_t st_ino; - //This reference count counts the number of modules attached - //to the shared memory and lock file. This serves to unlink - //the locking file and shared memory when all modules are - //done with the global memory (shared memory) - volatile boost::uint32_t modules_attached_to_gmem_count; -}; - -inline bool lock_locking_file(int fd) -{ - int ret = 0; - while(ret != 0 && errno != EINTR){ - struct flock lock; - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - ret = fcntl (fd, F_SETLKW, &lock); - } - return 0 == ret; -} - -inline bool try_lock_locking_file(int fd) -{ - struct flock lock; - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - return 0 == fcntl (fd, F_SETLK, &lock); -} - -inline int open_or_create_and_lock_file(const char *name) -{ - permissions p; - p.set_unrestricted(); - while(1){ - int fd = create_or_open_file(name, read_write, p); - if(fd < 0){ - return fd; - } - if(!try_lock_locking_file(fd)){ - close(fd); - return -1; - } - struct stat s; - if(0 == stat(name, &s)){ - return fd; - } - else{ - close(fd); - } - } -} - -inline int try_open_and_lock_file(const char *name) -{ - int fd = open_existing_file(name, read_write); - if(fd < 0){ - return fd; - } - if(!try_lock_locking_file(fd)){ - close(fd); - return -1; - } - return fd; -} - -inline void close_lock_file(int fd) -{ close(fd); } - -inline bool is_valid_fd(int fd) -{ - struct stat s; - return EBADF != fstat(fd, &s); -} - -inline bool is_normal_file(int fd) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return false; - return 0 != (s.st_mode & S_IFREG); -} - -inline std::size_t get_size(int fd) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return 0u; - return (std::size_t)s.st_size; -} - -inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) -{ - struct stat s; - if(0 != fstat(fd, &s)) - return false; - id.fd = fd; - id.st_dev = s.st_dev; - id.st_ino = s.st_ino; - id.modules_attached_to_gmem_count = 1; //Initialize attached count - return true; -} - -inline bool compare_file_serial(int fd, const locking_file_serial_id &id) -{ - struct stat info; - if(0 != fstat(fd, &info)) - return false; - - return id.st_dev == info.st_dev && - id.st_ino == info.st_ino; -} - -#endif - -template -struct gmem_erase_func -{ - gmem_erase_func(const char *shm_name, const char *singleton_lock_file_path, ManagedShMem & shm) - :shm_name_(shm_name), singleton_lock_file_path_(singleton_lock_file_path), shm_(shm) - {} - - void operator()() - { - locking_file_serial_id *pserial_id = shm_.template find("lock_file_fd").first; - if(pserial_id){ - pserial_id->fd = GMemMarkToBeRemoved; - } - delete_file(singleton_lock_file_path_); - shared_memory_object::remove(shm_name_); - } - - const char * const shm_name_; - const char * const singleton_lock_file_path_; - ManagedShMem & shm_; -}; - -//This function applies shared memory erasure logic based on the passed lock file. -template -void managed_sh_dependant:: - apply_gmem_erase_logic(const char *filepath, const char *filename) -{ - int fd = GMemMarkToBeRemoved; - try{ - std::string str; - //If the filename is current process lock file, then avoid it - if(file_locking_helpers::check_if_filename_complies_with_pid - (filename, get_lock_file_base_name(), get_current_process_id(), str, true)){ - return; - } - //Open and lock the other process' lock file - fd = try_open_and_lock_file(filepath); - if(fd < 0){ - return; - } - //If done, then the process is dead so take global shared memory name - //(the name is based on the lock file name) and try to apply erasure logic - str.insert(0, get_shm_base_name()); - try{ - ManagedShMem shm(open_only, str.c_str()); - gmem_erase_func func(str.c_str(), filepath, shm); - shm.try_atomic_func(func); - } - catch(interprocess_exception &e){ - //If shared memory is not found erase the lock file - if(e.get_error_code() == not_found_error){ - delete_file(filepath); - } - } - } - catch(...){ - - } - if(fd >= 0){ - close_lock_file(fd); - } -} - -} //namespace intermodule_singleton_helpers { - - - -namespace intermodule_singleton_helpers { - -//The lock file logic creates uses a unique instance to a file -template -struct lock_file_logic -{ - lock_file_logic(ManagedShMem &shm) - : mshm(shm) - { shm.atomic_func(*this); } - - void operator()(void) - { - retry_with_new_shm = false; - - //First find the file locking descriptor id - locking_file_serial_id *pserial_id = - mshm.template find("lock_file_fd").first; - - int fd; - //If not found schedule a creation - if(!pserial_id){ - fd = GMemNotPresent; - } - //Else get it - else{ - fd = pserial_id->fd; - } - //If we need to create a new one, do it - if(fd == GMemNotPresent){ - std::string lck_str; - //Create a unique current pid based lock file path - create_and_get_singleton_lock_file_path(lck_str); - //Open or create and lock file - int fd = intermodule_singleton_helpers::open_or_create_and_lock_file(lck_str.c_str()); - //If failed, write a bad file descriptor to notify other modules that - //something was wrong and unlink shared memory. Mark the function object - //to tell caller to retry with another shared memory - if(fd < 0){ - this->register_lock_file(GMemMarkToBeRemoved); - std::string s; - get_shm_name(s); - shared_memory_object::remove(s.c_str()); - retry_with_new_shm = true; - } - //If successful, register the file descriptor - else{ - this->register_lock_file(fd); - } - } - //If the fd was invalid (maybe a previous try failed) notify caller that - //should retry creation logic, since this shm might have been already - //unlinked since the shm was removed - else if (fd == GMemMarkToBeRemoved){ - retry_with_new_shm = true; - } - //If the stored fd is not valid (a open fd, a normal file with the - //expected size, or does not have the same file id number, - //then it's an old shm from an old process with the same pid. - //If that's the case, mark it as invalid - else if(!is_valid_fd(fd) || - !is_normal_file(fd) || - 0 != get_size(fd) || - !compare_file_serial(fd, *pserial_id)){ - pserial_id->fd = GMemMarkToBeRemoved; - std::string s; - get_shm_name(s); - shared_memory_object::remove(s.c_str()); - retry_with_new_shm = true; - } - else{ - //If the lock file is ok, increment reference count of - //attached modules to shared memory - atomic_inc32(&pserial_id->modules_attached_to_gmem_count); - } - } - - private: - locking_file_serial_id * register_lock_file(int fd) - { - locking_file_serial_id *pinfo = mshm.template construct("lock_file_fd")(); - fill_file_serial_id(fd, *pinfo); - return pinfo; - } - - public: - ManagedShMem &mshm; - bool retry_with_new_shm; -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct lock_file_logic -{ - lock_file_logic(windows_managed_global_memory &) - : retry_with_new_shm(false) - {} - - void operator()(void){} - const bool retry_with_new_shm; -}; - -#endif - -} //namespace intermodule_singleton_helpers { - -//This class contains common code for all singleton types, so that we instantiate this -//code just once per module. This class also holds a reference counted shared memory -//to be used by all instances - -template -class intermodule_singleton_common -{ - public: - typedef void*(singleton_constructor_t)(ManagedShMem &); - typedef void (singleton_destructor_t)(void *, ManagedShMem &); - - static const ::boost::uint32_t Uninitialized = 0u; - static const ::boost::uint32_t Initializing = 1u; - static const ::boost::uint32_t Initialized = 2u; - static const ::boost::uint32_t Broken = 3u; - - static void finalize_singleton_logic(void *ptr, singleton_destructor_t destructor) - { - if(ptr) - destructor(ptr, get_shm()); - //If this is the last singleton of this module - //apply shm destruction. - //Note: singletons are destroyed when the module is unloaded - //so no threads should be executing or holding references - //to this module - if(1 == atomic_dec32(&this_module_singleton_count)){ - destroy_shm(); - } - } - - static void initialize_singleton_logic - (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t ini_func); - - private: - static ManagedShMem &get_shm() - { - return *static_cast(static_cast(&mem_holder.shm_mem)); - } - - static void initialize_shm(); - static void destroy_shm(); - //Static data, zero-initalized without any dependencies - //this_module_singleton_count is the number of singletons used by this module - static volatile boost::uint32_t this_module_singleton_count; - //this_module_shm_initialized is the state of this module's shm class object - static volatile boost::uint32_t this_module_shm_initialized; - static struct mem_holder_t - { - ::boost::detail::max_align aligner; - char shm_mem [sizeof(ManagedShMem)]; - } mem_holder; -}; - -template -volatile boost::uint32_t intermodule_singleton_common::this_module_singleton_count; - -template -volatile boost::uint32_t intermodule_singleton_common::this_module_shm_initialized; - -template -typename intermodule_singleton_common::mem_holder_t - intermodule_singleton_common::mem_holder; - -template -void intermodule_singleton_common::initialize_shm() -{ - //Obtain unique shm name and size - std::string s; - while(1){ - //Try to pass shm state to initializing - ::boost::uint32_t tmp = atomic_cas32(&this_module_shm_initialized, Initializing, Uninitialized); - if(tmp >= Initialized){ - break; - } - //If some other thread is doing the work wait - else if(tmp == Initializing){ - thread_yield(); - } - else{ //(tmp == Uninitialized) - //If not initialized try it again? - try{ - //Remove old shared memory from the system - intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); - // - if(s.empty()){ - intermodule_singleton_helpers::get_shm_name(s); - } - const char *ShmName = s.c_str(); - const std::size_t ShmSize = intermodule_singleton_helpers::get_shm_size();; - - //in-place construction of the shared memory class - ::new (&get_shm())ManagedShMem(open_or_create, ShmName, ShmSize); - //Use shared memory internal lock to initialize the lock file - //that will mark this gmem as "in use". - intermodule_singleton_helpers::lock_file_logic f(get_shm()); - //If function failed (maybe a competing process has erased the shared - //memory between creation and file locking), retry with a new instance. - if(f.retry_with_new_shm){ - get_shm().~ManagedShMem(); - atomic_write32(&this_module_shm_initialized, Uninitialized); - } - else{ - //Locking succeeded, so this shared memory module-instance is ready - atomic_write32(&this_module_shm_initialized, Initialized); - break; - } - } - catch(...){ - // - throw; - } - } - } -} - -template -struct unlink_shmlogic -{ - unlink_shmlogic(ManagedShMem &mshm) - : mshm_(mshm) - { mshm.atomic_func(*this); } - void operator()() - { - intermodule_singleton_helpers::locking_file_serial_id *pserial_id = - mshm_.template find - ("lock_file_fd").first; - BOOST_ASSERT(0 != pserial_id); - if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){ - int fd = pserial_id->fd; - if(fd > 0){ - pserial_id->fd = intermodule_singleton_helpers::GMemMarkToBeRemoved; - std::string s; - intermodule_singleton_helpers::create_and_get_singleton_lock_file_path(s); - delete_file(s.c_str()); - intermodule_singleton_helpers::close_lock_file(fd); - intermodule_singleton_helpers::get_shm_name(s); - shared_memory_object::remove(s.c_str()); - } - } - } - ManagedShMem &mshm_; -}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template<> -struct unlink_shmlogic -{ - unlink_shmlogic(windows_managed_global_memory &) - {} - void operator()(){} -}; - -#endif - - -template -void intermodule_singleton_common::destroy_shm() -{ - if(!atomic_read32(&this_module_singleton_count)){ - //This module is being unloaded, so destroy - //the shared memory object of this module - //and unlink the shared memory if it's the last - unlink_shmlogic f(get_shm()); - (get_shm()).~ManagedShMem(); - atomic_write32(&this_module_shm_initialized, Uninitialized); - //Do some cleanup for other processes old gmem instances - intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); - } -} - -//Initialize this_module_singleton_ptr, creates the shared memory if needed and also creates an unique -//opaque type in shared memory through a singleton_constructor_t function call, -//initializing the passed pointer to that unique instance. -// -//We have two concurrency types here. a)the shared memory/singleton creation must -//be safe between threads of this process but in different modules/dlls. b) -//the pointer to the singleton is per-module, so we have to protect this -//initization between threads of the same module. -// -//All static variables declared here are shared between inside a module -//so atomic operations will synchronize only threads of the same module. -template -void intermodule_singleton_common::initialize_singleton_logic - (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t constructor) -{ - //If current module is not initialized enter to lock free logic - if(atomic_read32(&this_module_singleton_initialized) != Initialized){ - //Now a single thread of the module will succeed in this CAS. - //trying to pass from Uninitialized to Initializing - ::boost::uint32_t previous_module_singleton_initialized = atomic_cas32 - (&this_module_singleton_initialized, Initializing, Uninitialized); - //If the thread succeeded the CAS (winner) it will compete with other - //winner threads from other modules to create the shared memory - if(previous_module_singleton_initialized == Uninitialized){ - try{ - //Now initialize shm, this function solves concurrency issues - //between threads of several modules - initialize_shm(); - //Increment the module reference count that reflects how many - //singletons this module holds, so that we can safely destroy - //module shared memory object when no singleton is left - atomic_inc32(&this_module_singleton_count); - //Now try to create the singleton in shared memory. - //This function solves concurrency issues - //between threads of several modules - void *tmp = constructor(get_shm()); - //Insert a barrier before assigning the pointer to - //make sure this assignment comes after the initialization - atomic_write32(&this_module_singleton_initialized, Initializing); - //Assign the singleton address to the module-local pointer - ptr = tmp; - //Memory barrier inserted, all previous operations should complete - //before this one. Now marked as initialized - atomic_inc32(&this_module_singleton_initialized); - } - catch(...){ - //Mark singleton failed to initialize - atomic_write32(&this_module_singleton_initialized, Broken); - throw; - } - } - //If previous state was initializing, this means that another winner thread is - //trying to initialize the singleton. Just wait until completes its work. - else if(previous_module_singleton_initialized == Initializing){ - while(1){ - previous_module_singleton_initialized = atomic_read32(&this_module_singleton_initialized); - if(previous_module_singleton_initialized >= Initialized){ - //Already initialized, or exception thrown by initializer thread - break; - } - else if(previous_module_singleton_initialized == Initializing){ - thread_yield(); - } - else{ - //This can't be happening! - BOOST_ASSERT(0); - } - } - } - else if(previous_module_singleton_initialized == Initialized){ - //Nothing to do here, the singleton is ready - } - //If previous state was greater than initialized, then memory is broken - //trying to initialize the singleton. - else{//(previous_module_singleton_initialized > Initialized) - throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed"); - } - } - BOOST_ASSERT(ptr != 0); -} - //Now this class is a singleton, initializing the singleton in //the first get() function call if LazyInit is false. If true //then the singleton will be initialized when loading the module. -template -class intermodule_singleton_impl -{ - public: - static C& get() //Let's make inlining easy - { - if(!this_module_singleton_ptr){ - if(lifetime.dummy_function()) //This forces lifetime instantiation, for reference counted destruction - intermodule_singleton_common::initialize_singleton_logic - (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); - } - return *static_cast(this_module_singleton_ptr); - } - - private: - - struct ref_count_ptr - { - ref_count_ptr(C *p, boost::uint32_t count) - : ptr(p), singleton_ref_count(count) - {} - C *ptr; - //This reference count serves to count the number of attached - //modules to this singleton - volatile boost::uint32_t singleton_ref_count; - }; - - //These statics will be zero-initialized without any constructor call dependency - //this_module_singleton_ptr will be a module-local pointer to the singleton - static void* this_module_singleton_ptr; - //this_module_singleton_count will be used to synchronize threads of the same module - //for access to a singleton instance, and to flag the state of the - //singleton. - static volatile boost::uint32_t this_module_singleton_initialized; - - //This class destructor will trigger singleton destruction - struct lifetime_type_lazy - { - bool dummy_function() - { return m_dummy == 0; } - - ~lifetime_type_lazy() - { - intermodule_singleton_common::finalize_singleton_logic - (this_module_singleton_ptr, singleton_destructor); - } - //Dummy volatile so that the compiler can't resolve its value at compile-time - //and can't avoid lifetime_type instantiation if dummy_function() is called. - static volatile int m_dummy; - }; - - struct lifetime_type_static - : public lifetime_type_lazy - { - lifetime_type_static() - { - intermodule_singleton_common::initialize_singleton_logic - (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); - } - }; - - typedef typename if_c - ::type lifetime_type; - - static lifetime_type lifetime; - - //A functor to be executed inside shared memory lock that just - //searches for the singleton in shm and if not present creates a new one. - //If singleton constructor throws, the exception is propagated - struct init_atomic_func - { - init_atomic_func(ManagedShMem &m) - : mshm(m) - {} - - void operator()() - { - ref_count_ptr *rcount = mshm.template find(unique_instance).first; - if(!rcount){ - C *p = new C(); - try{ - rcount = mshm.template construct(unique_instance)(p, 0u); - } - catch(...){ - delete p; - throw; - } - } - atomic_inc32(&rcount->singleton_ref_count); - ret_ptr = rcount->ptr; - } - ManagedShMem &mshm; - void *ret_ptr; - }; - - //A functor to be executed inside shared memory lock that just - //deletes the singleton in shm if the attached count reaches to zero - struct fini_atomic_func - { - fini_atomic_func(ManagedShMem &m) - : mshm(m) - {} - - void operator()() - { - ref_count_ptr *rcount = mshm.template find(unique_instance).first; - //The object must exist - BOOST_ASSERT(rcount); - //Check if last reference - if(atomic_dec32(&rcount->singleton_ref_count) == 1){ - //If last, destroy the object - BOOST_ASSERT(rcount->ptr != 0); - delete rcount->ptr; - //Now destroy shm entry - bool destroyed = mshm.template destroy(unique_instance); - (void)destroyed; BOOST_ASSERT(destroyed == true); - } - } - ManagedShMem &mshm; - void *ret_ptr; - }; - - //A wrapper to execute init_atomic_func - static void *singleton_constructor(ManagedShMem &mshm) - { - init_atomic_func f(mshm); - mshm.atomic_func(f); - return f.ret_ptr; - } - - //A wrapper to execute fini_atomic_func - static void singleton_destructor(void *p, ManagedShMem &mshm) - { (void)p; - fini_atomic_func f(mshm); - mshm.atomic_func(f); - } -}; - -template -volatile int intermodule_singleton_impl::lifetime_type_lazy::m_dummy = 0; - -//These will be zero-initialized by the loader -template -void *intermodule_singleton_impl::this_module_singleton_ptr = 0; - -template -volatile boost::uint32_t intermodule_singleton_impl::this_module_singleton_initialized = 0; - -template -typename intermodule_singleton_impl::lifetime_type - intermodule_singleton_impl::lifetime; - -template -class portable_intermodule_singleton - : public intermodule_singleton_impl -{}; - -#if defined(BOOST_INTERPROCESS_WINDOWS) - -template -class windows_intermodule_singleton - : public intermodule_singleton_impl - < C - , LazyInit - , windows_managed_global_memory - > -{}; - -#endif - -//Now this class is a singleton, initializing the singleton in -//the first get() function call if LazyInit is false. If true -//then the singleton will be initialized when loading the module. -template +template class intermodule_singleton #ifdef BOOST_INTERPROCESS_WINDOWS - : public windows_intermodule_singleton + : public windows_intermodule_singleton #else - : public portable_intermodule_singleton + : public portable_intermodule_singleton #endif {}; - } //namespace ipcdetail{ } //namespace interprocess{ } //namespace boost{ diff --git a/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp new file mode 100644 index 000000000..d03c56652 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/intermodule_singleton_common.hpp @@ -0,0 +1,496 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP +#define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +namespace intermodule_singleton_helpers { + +inline void get_pid_creation_time_str(std::string &s) +{ + std::stringstream stream; + stream << get_current_process_id() << '_'; + stream.precision(6); + stream << std::fixed << get_current_process_creation_time(); + s = stream.str(); +} + +inline const char *get_map_base_name() +{ return "bip.gmem.map."; } + +inline void get_map_name(std::string &map_name) +{ + get_pid_creation_time_str(map_name); + map_name.insert(0, get_map_base_name()); +} + +inline std::size_t get_map_size() +{ return 65536; } + +template +struct thread_safe_global_map_dependant; + +} //namespace intermodule_singleton_helpers { + +//This class contains common code for all singleton types, so that we instantiate this +//code just once per module. This class also holds a thread soafe global map +//to be used by all instances protected with a reference count +template +class intermodule_singleton_common +{ + public: + typedef void*(singleton_constructor_t)(ThreadSafeGlobalMap &); + typedef void (singleton_destructor_t)(void *, ThreadSafeGlobalMap &); + + static const ::boost::uint32_t Uninitialized = 0u; + static const ::boost::uint32_t Initializing = 1u; + static const ::boost::uint32_t Initialized = 2u; + static const ::boost::uint32_t Broken = 3u; + static const ::boost::uint32_t Destroyed = 4u; + + //Initialize this_module_singleton_ptr, creates the global map if needed and also creates an unique + //opaque type in global map through a singleton_constructor_t function call, + //initializing the passed pointer to that unique instance. + // + //We have two concurrency types here. a)the global map/singleton creation must + //be safe between threads of this process but in different modules/dlls. b) + //the pointer to the singleton is per-module, so we have to protect this + //initization between threads of the same module. + // + //All static variables declared here are shared between inside a module + //so atomic operations will synchronize only threads of the same module. + static void initialize_singleton_logic + (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t constructor, bool phoenix) + { + //If current module is not initialized enter to lock free logic + if(atomic_read32(&this_module_singleton_initialized) != Initialized){ + //Now a single thread of the module will succeed in this CAS. + //trying to pass from Uninitialized to Initializing + ::boost::uint32_t previous_module_singleton_initialized = atomic_cas32 + (&this_module_singleton_initialized, Initializing, Uninitialized); + //If the thread succeeded the CAS (winner) it will compete with other + //winner threads from other modules to create the global map + if(previous_module_singleton_initialized == Destroyed){ + //Trying to resurrect a dead Phoenix singleton. Just try to + //mark it as uninitialized and start again + if(phoenix){ + atomic_cas32(&this_module_singleton_initialized, Uninitialized, Destroyed); + previous_module_singleton_initialized = atomic_cas32 + (&this_module_singleton_initialized, Initializing, Uninitialized); + } + //Trying to resurrect a non-Phoenix dead singleton is an error + else{ + throw interprocess_exception("Boost.Interprocess: Dead reference on non-Phoenix singleton of type"); + } + } + if(previous_module_singleton_initialized == Uninitialized){ + try{ + //Now initialize the global map, this function must solve concurrency + //issues between threads of several modules + initialize_global_map_handle(); + //Now try to create the singleton in global map. + //This function solves concurrency issues + //between threads of several modules + void *tmp = constructor(get_map()); + //Increment the module reference count that reflects how many + //singletons this module holds, so that we can safely destroy + //module global map object when no singleton is left + atomic_inc32(&this_module_singleton_count); + //Insert a barrier before assigning the pointer to + //make sure this assignment comes after the initialization + atomic_write32(&this_module_singleton_initialized, Initializing); + //Assign the singleton address to the module-local pointer + ptr = tmp; + //Memory barrier inserted, all previous operations should complete + //before this one. Now marked as initialized + atomic_write32(&this_module_singleton_initialized, Initialized); + } + catch(...){ + //Mark singleton failed to initialize + atomic_write32(&this_module_singleton_initialized, Broken); + throw; + } + } + //If previous state was initializing, this means that another winner thread is + //trying to initialize the singleton. Just wait until completes its work. + else if(previous_module_singleton_initialized == Initializing){ + while(1){ + previous_module_singleton_initialized = atomic_read32(&this_module_singleton_initialized); + if(previous_module_singleton_initialized >= Initialized){ + //Already initialized, or exception thrown by initializer thread + break; + } + else if(previous_module_singleton_initialized == Initializing){ + thread_yield(); + } + else{ + //This can't be happening! + BOOST_ASSERT(0); + } + } + } + else if(previous_module_singleton_initialized == Initialized){ + //Nothing to do here, the singleton is ready + } + //If previous state was greater than initialized, then memory is broken + //trying to initialize the singleton. + else{//(previous_module_singleton_initialized > Initialized) + throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed"); + } + } + BOOST_ASSERT(ptr != 0); + } + + static void finalize_singleton_logic(void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_destructor_t destructor) + { + //Protect destruction against lazy singletons not initialized in this execution + if(ptr){ + //Note: this destructor might provoke a Phoenix singleton + //resurrection. This means that this_module_singleton_count + //might change after this call. + destructor(ptr, get_map()); + ptr = 0; + + //Memory barrier to make sure pointer is nulled. + //Mark this singleton as destroyed. + atomic_write32(&this_module_singleton_initialized, Destroyed); + + //If this is the last singleton of this module + //apply map destruction. + //Note: singletons are destroyed when the module is unloaded + //so no threads should be executing or holding references + //to this module + if(1 == atomic_dec32(&this_module_singleton_count)){ + destroy_global_map_handle(); + } + } + } + + private: + static ThreadSafeGlobalMap &get_map() + { + return *static_cast(static_cast(&mem_holder.map_mem[0])); + } + + static void initialize_global_map_handle() + { + //Obtain unique map name and size + while(1){ + //Try to pass map state to initializing + ::boost::uint32_t tmp = atomic_cas32(&this_module_map_initialized, Initializing, Uninitialized); + if(tmp == Initialized || tmp == Broken){ + break; + } + else if(tmp == Destroyed){ + tmp = atomic_cas32(&this_module_map_initialized, Uninitialized, Destroyed); + continue; + } + //If some other thread is doing the work wait + else if(tmp == Initializing){ + thread_yield(); + } + else{ //(tmp == Uninitialized) + //If not initialized try it again? + try{ + //Remove old global map from the system + intermodule_singleton_helpers::thread_safe_global_map_dependant::remove_old_gmem(); + //in-place construction of the global map class + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::construct_map(static_cast(&get_map())); + //Use global map's internal lock to initialize the lock file + //that will mark this gmem as "in use". + typename intermodule_singleton_helpers::thread_safe_global_map_dependant:: + lock_file_logic f(get_map()); + //If function failed (maybe a competing process has erased the shared + //memory between creation and file locking), retry with a new instance. + if(f.retry()){ + get_map().~ThreadSafeGlobalMap(); + atomic_write32(&this_module_map_initialized, Destroyed); + } + else{ + //Locking succeeded, so this global map module-instance is ready + atomic_write32(&this_module_map_initialized, Initialized); + break; + } + } + catch(...){ + // + throw; + } + } + } + } + + static void destroy_global_map_handle() + { + if(!atomic_read32(&this_module_singleton_count)){ + //This module is being unloaded, so destroy + //the global map object of this module + //and unlink the global map if it's the last + typename intermodule_singleton_helpers::thread_safe_global_map_dependant:: + unlink_map_logic f(get_map()); + (get_map()).~ThreadSafeGlobalMap(); + atomic_write32(&this_module_map_initialized, Destroyed); + //Do some cleanup for other processes old gmem instances + intermodule_singleton_helpers::thread_safe_global_map_dependant::remove_old_gmem(); + } + } + + //Static data, zero-initalized without any dependencies + //this_module_singleton_count is the number of singletons used by this module + static volatile boost::uint32_t this_module_singleton_count; + + //this_module_map_initialized is the state of this module's map class object. + //Values: Uninitialized, Initializing, Initialized, Broken + static volatile boost::uint32_t this_module_map_initialized; + + //Raw memory to construct the global map manager + static struct mem_holder_t + { + ::boost::detail::max_align aligner; + char map_mem [sizeof(ThreadSafeGlobalMap)]; + } mem_holder; +}; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_singleton_count; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_map_initialized; + +template +typename intermodule_singleton_common::mem_holder_t + intermodule_singleton_common::mem_holder; + +//A reference count to be stored in global map holding the number +//of singletons (one per module) attached to the instance pointed by +//the internal ptr. +struct ref_count_ptr +{ + ref_count_ptr(void *p, boost::uint32_t count) + : ptr(p), singleton_ref_count(count) + {} + void *ptr; + //This reference count serves to count the number of attached + //modules to this singleton + volatile boost::uint32_t singleton_ref_count; +}; + + +//Now this class is a singleton, initializing the singleton in +//the first get() function call if LazyInit is false. If true +//then the singleton will be initialized when loading the module. +template +class intermodule_singleton_impl +{ + public: + + static C& get() //Let's make inlining easy + { + if(!this_module_singleton_ptr){ + if(lifetime.dummy_function()){ //This forces lifetime instantiation, for reference counted destruction + atentry_work(); + } + } + return *static_cast(this_module_singleton_ptr); + } + + private: + + static void atentry_work() + { + intermodule_singleton_common::initialize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor, Phoenix); + } + + static void atexit_work() + { + intermodule_singleton_common::finalize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_destructor); + } + + //These statics will be zero-initialized without any constructor call dependency + //this_module_singleton_ptr will be a module-local pointer to the singleton + static void* this_module_singleton_ptr; + + //this_module_singleton_count will be used to synchronize threads of the same module + //for access to a singleton instance, and to flag the state of the + //singleton. + static volatile boost::uint32_t this_module_singleton_initialized; + + //This class destructor will trigger singleton destruction + struct lifetime_type_lazy + { + bool dummy_function() + { return m_dummy == 0; } + + ~lifetime_type_lazy() + { + if(!Phoenix){ + atexit_work(); + } + } + + //Dummy volatile so that the compiler can't resolve its value at compile-time + //and can't avoid lifetime_type instantiation if dummy_function() is called. + static volatile int m_dummy; + }; + + struct lifetime_type_static + : public lifetime_type_lazy + { + lifetime_type_static() + { atentry_work(); } + }; + + typedef typename if_c + ::type lifetime_type; + + static lifetime_type lifetime; + + //A functor to be executed inside global map lock that just + //searches for the singleton in map and if not present creates a new one. + //If singleton constructor throws, the exception is propagated + struct init_atomic_func + { + init_atomic_func(ThreadSafeGlobalMap &m) + : m_map(m) + {} + + void operator()() + { + ref_count_ptr *rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::find(m_map, typeid(C).name()); + if(!rcount){ + C *p = new C; + try{ + ref_count_ptr val(p, 0u); + rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::insert(m_map, typeid(C).name(), val); + } + catch(...){ + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::erase(m_map, typeid(C).name()); + delete p; + throw; + } + } + if(Phoenix){ + std::atexit(&atexit_work); + } + atomic_inc32(&rcount->singleton_ref_count); + ret_ptr = rcount->ptr; + } + void *data() const + { return ret_ptr; } + + private: + ThreadSafeGlobalMap &m_map; + void *ret_ptr; + }; + + //A functor to be executed inside global map lock that just + //deletes the singleton in map if the attached count reaches to zero + struct fini_atomic_func + { + fini_atomic_func(ThreadSafeGlobalMap &m) + : m_map(m) + {} + + void operator()() + { + ref_count_ptr *rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::find(m_map, typeid(C).name()); + //The object must exist + BOOST_ASSERT(rcount); + BOOST_ASSERT(rcount->singleton_ref_count > 0); + //Check if last reference + if(atomic_dec32(&rcount->singleton_ref_count) == 1){ + //If last, destroy the object + BOOST_ASSERT(rcount->ptr != 0); + C *pc = static_cast(rcount->ptr); + //Now destroy map entry + bool destroyed = intermodule_singleton_helpers::thread_safe_global_map_dependant + ::erase(m_map, typeid(C).name()); + (void)destroyed; BOOST_ASSERT(destroyed == true); + delete pc; + } + } + void *data() const + { return ret_ptr; } + + private: + ThreadSafeGlobalMap &m_map; + void *ret_ptr; + }; + + //A wrapper to execute init_atomic_func + static void *singleton_constructor(ThreadSafeGlobalMap &map) + { + init_atomic_func f(map); + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::atomic_func(map, f); + return f.data(); + } + + //A wrapper to execute fini_atomic_func + static void singleton_destructor(void *p, ThreadSafeGlobalMap &map) + { (void)p; + fini_atomic_func f(map); + intermodule_singleton_helpers::thread_safe_global_map_dependant + ::atomic_func(map, f); + } +}; + +template +volatile int intermodule_singleton_impl::lifetime_type_lazy::m_dummy = 0; + +//These will be zero-initialized by the loader +template +void *intermodule_singleton_impl::this_module_singleton_ptr = 0; + +template +volatile boost::uint32_t intermodule_singleton_impl::this_module_singleton_initialized = 0; + +template +typename intermodule_singleton_impl::lifetime_type + intermodule_singleton_impl::lifetime; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp b/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp index 258177674..2fcc07bcc 100644 --- a/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/interprocess_tester.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp b/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp index 92970923d..ca2ff4acf 100644 --- a/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/intersegment_ptr.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -68,8 +68,8 @@ struct intersegment_base static const std::size_t begin_bits = max_segment_size_bits - align_bits; static const std::size_t pow_size_bits_helper = static_log2::value; - static const std::size_t pow_size_bits = - (max_segment_size_bits == (std::size_t(1) << pow_size_bits_helper)) ? + static const std::size_t pow_size_bits = + (max_segment_size_bits == (std::size_t(1) << pow_size_bits_helper)) ? pow_size_bits_helper : pow_size_bits_helper + 1; static const std::size_t frc_size_bits = size_t_bits - ctrl_bits - begin_bits - pow_size_bits; @@ -177,7 +177,7 @@ struct intersegment_base void set_mode(std::size_t mode) { - BOOST_ASSERT(mode < is_max_mode); + BOOST_ASSERT(mode < is_max_mode); members.direct.ctrl = mode; } @@ -185,7 +185,7 @@ struct intersegment_base //!null pointer bool is_null() const { - return (this->get_mode() < is_relative) && + return (this->get_mode() < is_relative) && !members.direct.dummy && !members.direct.addr; } @@ -309,13 +309,13 @@ struct flat_map_intersegment void *ptr_base; void *this_base; get_segment_info_and_offset(this, this_info, this_offset, this_base); - + if(!this_info.group){ this->set_mode(is_in_stack); this->members.direct.addr = const_cast(ptr); } else{ - get_segment_info_and_offset(ptr, ptr_info, ptr_offset, ptr_base); + get_segment_info_and_offset(ptr, ptr_info, ptr_offset, ptr_base); if(ptr_info.group != this_info.group){ this->set_mode(is_pointee_outside); @@ -340,7 +340,7 @@ struct flat_map_intersegment } } - //!Sets the object internals to represent the address pointed + //!Sets the object internals to represent the address pointed //!by another flat_map_intersegment void set_from_other(const self_t &other) { @@ -383,7 +383,7 @@ struct flat_map_intersegment }; vector m_segments; multi_segment_services &m_ms_services; - + public: segment_group_t(multi_segment_services &ms_services) : m_ms_services(ms_services) @@ -434,7 +434,7 @@ struct flat_map_intersegment typedef set segment_groups_t; typedef boost::interprocess::flat_map - > ptr_to_segment_info_t; @@ -443,9 +443,9 @@ struct flat_map_intersegment //!Mutex to preserve integrity in multi-threaded //!enviroments typedef Mutex mutex_type; - //!Maps base addresses and segment information + //!Maps base addresses and segment information //!(size and segment group and id)* - + ptr_to_segment_info_t m_ptr_to_segment_info; ~mappings_t() @@ -476,7 +476,7 @@ struct flat_map_intersegment return; } //Find the first base address greater than ptr - typename ptr_to_segment_info_t::iterator it + typename ptr_to_segment_info_t::iterator it = s_map.m_ptr_to_segment_info.upper_bound(ptr); if(it == s_map.m_ptr_to_segment_info.begin()){ segment = segment_info_t(); @@ -486,7 +486,7 @@ struct flat_map_intersegment --it; char * segment_base = const_cast(reinterpret_cast(it->first)); std::size_t segment_size = it->second.size; - + if(segment_base <= reinterpret_cast(ptr) && (segment_base + segment_size) >= reinterpret_cast(ptr)){ segment = it->second; @@ -552,7 +552,7 @@ struct flat_map_intersegment s_groups.insert(segment_group_t(*services)); BOOST_ASSERT(ret.second); return &*ret.first; - } + } } static bool delete_group(segment_group_id id) @@ -574,23 +574,23 @@ struct flat_map_intersegment } } return success; - } + } } }; //!Static map-segment_info associated with //!flat_map_intersegment<> template -typename flat_map_intersegment::mappings_t +typename flat_map_intersegment::mappings_t flat_map_intersegment::s_map; //!Static segment group container associated with //!flat_map_intersegment<> template -typename flat_map_intersegment::segment_groups_t +typename flat_map_intersegment::segment_groups_t flat_map_intersegment::s_groups; -//!A smart pointer that can point to a pointee that resides in another memory +//!A smart pointer that can point to a pointee that resides in another memory //!memory mapped or shared memory segment. template class intersegment_ptr : public flat_map_intersegment @@ -623,13 +623,13 @@ class intersegment_ptr : public flat_map_intersegment //!Constructor from other intersegment_ptr //!Never throws - intersegment_ptr(const intersegment_ptr& ptr) + intersegment_ptr(const intersegment_ptr& ptr) { base_t::set_from_other(ptr); } - //!Constructor from other intersegment_ptr. If pointers of pointee types are + //!Constructor from other intersegment_ptr. If pointers of pointee types are //!convertible, intersegment_ptrs will be convertibles. Never throws. template - intersegment_ptr(const intersegment_ptr &ptr) + intersegment_ptr(const intersegment_ptr &ptr) { pointer p(ptr.get()); (void)p; base_t::set_from_other(ptr); } //!Emulates static_cast operator. @@ -663,17 +663,17 @@ class intersegment_ptr : public flat_map_intersegment //!Pointer-like -> operator. It can return 0 pointer. //!Never throws. - pointer operator->() const + pointer operator->() const { return self_t::get(); } - //!Dereferencing operator, if it is a null intersegment_ptr behavior + //!Dereferencing operator, if it is a null intersegment_ptr behavior //!is undefined. Never throws. - reference operator* () const + reference operator* () const { return *(self_t::get()); } //!Indexing operator. //!Never throws. - reference operator[](std::ptrdiff_t idx) const + reference operator[](std::ptrdiff_t idx) const { return self_t::get()[idx]; } //!Assignment from pointer (saves extra conversion). @@ -686,19 +686,19 @@ class intersegment_ptr : public flat_map_intersegment intersegment_ptr& operator= (const intersegment_ptr &ptr) { base_t::set_from_other(ptr); return *this; } - //!Assignment from related intersegment_ptr. If pointers of pointee types + //!Assignment from related intersegment_ptr. If pointers of pointee types //!are assignable, intersegment_ptrs will be assignable. Never throws. template intersegment_ptr& operator= (const intersegment_ptr & ptr) - { - pointer p(ptr.get()); (void)p; - base_t::set_from_other(ptr); return *this; + { + pointer p(ptr.get()); (void)p; + base_t::set_from_other(ptr); return *this; } - + //!intersegment_ptr + std::ptrdiff_t. //!Never throws. - intersegment_ptr operator+ (std::ptrdiff_t idx) const - { + intersegment_ptr operator+ (std::ptrdiff_t idx) const + { intersegment_ptr result (*this); result.inc_offset(idx*sizeof(T)); return result; @@ -706,8 +706,8 @@ class intersegment_ptr : public flat_map_intersegment //!intersegment_ptr - std::ptrdiff_t. //!Never throws. - intersegment_ptr operator- (std::ptrdiff_t idx) const - { + intersegment_ptr operator- (std::ptrdiff_t idx) const + { intersegment_ptr result (*this); result.dec_offset(idx*sizeof(T)); return result; @@ -727,7 +727,7 @@ class intersegment_ptr : public flat_map_intersegment //!Never throws. intersegment_ptr& operator++ (void) { base_t::inc_offset(sizeof(T)); return *this; } - + //!intersegment_ptr++. //!Never throws. intersegment_ptr operator++ (int) @@ -745,10 +745,10 @@ class intersegment_ptr : public flat_map_intersegment //!Safe bool conversion operator. //!Never throws. - operator unspecified_bool_type() const + operator unspecified_bool_type() const { return base_t::is_null()? 0 : &self_t::unspecified_bool_type_func; } - //!Not operator. Not needed in theory, but improves portability. + //!Not operator. Not needed in theory, but improves portability. //!Never throws. bool operator! () const { return base_t::is_null(); } @@ -784,12 +784,12 @@ class intersegment_ptr : public flat_map_intersegment template inline bool operator ==(const intersegment_ptr &left, const intersegment_ptr &right) -{ +{ //Make sure both pointers can be compared bool e = typename intersegment_ptr::pointer(0) == typename intersegment_ptr::pointer(0); (void)e; - return left._equal(right); + return left._equal(right); } //!Returns true if *this is less than other. @@ -798,74 +798,74 @@ bool operator ==(const intersegment_ptr &left, template inline bool operator <(const intersegment_ptr &left, const intersegment_ptr &right) -{ +{ //Make sure both pointers can be compared bool e = typename intersegment_ptr::pointer(0) < typename intersegment_ptr::pointer(0); (void)e; - return left._less(right); + return left._less(right); } template inline -bool operator!= (const intersegment_ptr &pt1, +bool operator!= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 ==pt2); } //!intersegment_ptr <= intersegment_ptr. //!Never throws. template inline -bool operator<= (const intersegment_ptr &pt1, +bool operator<= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 > pt2); } //!intersegment_ptr > intersegment_ptr. //!Never throws. template inline -bool operator> (const intersegment_ptr &pt1, +bool operator> (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return (pt2 < pt1); } //!intersegment_ptr >= intersegment_ptr. //!Never throws. template inline -bool operator>= (const intersegment_ptr &pt1, +bool operator>= (const intersegment_ptr &pt1, const intersegment_ptr &pt2) { return !(pt1 < pt2); } //!operator<< template inline -std::basic_ostream & operator<< +std::basic_ostream & operator<< (std::basic_ostream & os, const intersegment_ptr & p) { return os << p.get(); } //!operator>> template inline -std::basic_istream & operator>> +std::basic_istream & operator>> (std::basic_istream & os, intersegment_ptr & p) { U * tmp; return os >> tmp; p = tmp; } -//!std::ptrdiff_t + intersegment_ptr. +//!std::ptrdiff_t + intersegment_ptr. //!The result is another pointer of the same segment template inline intersegment_ptr operator+ (std::ptrdiff_t diff, const intersegment_ptr& right) { return right + diff; } -//!intersegment_ptr - intersegment_ptr. +//!intersegment_ptr - intersegment_ptr. //!This only works with two intersegment_ptr-s that point to the //!same segment template inline -std::ptrdiff_t operator- (const intersegment_ptr &pt, +std::ptrdiff_t operator- (const intersegment_ptr &pt, const intersegment_ptr &pt2) { return pt._diff(pt2)/sizeof(T); } //! swap specialization template inline -void swap (boost::interprocess::intersegment_ptr &pt, +void swap (boost::interprocess::intersegment_ptr &pt, boost::interprocess::intersegment_ptr &pt2) { pt.swap(pt2); } -//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. +//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) @@ -873,19 +873,19 @@ T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) //!Simulation of static_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr static_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::static_cast_tag()); } //!Simulation of const_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr const_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. //!Never throws. -template inline +template inline boost::interprocess::intersegment_ptr dynamic_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::dynamic_cast_tag()); } @@ -895,7 +895,7 @@ template inline boost::interprocess::intersegment_ptr reinterpret_pointer_cast(const boost::interprocess::intersegment_ptr &r) { return boost::interprocess::intersegment_ptr(r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); } -//!Trait class to detect if an smart pointer has +//!Trait class to detect if an smart pointer has //!multi-segment addressing capabilities. template struct is_multisegment_ptr @@ -907,7 +907,7 @@ struct is_multisegment_ptr } //namespace interprocess { #if defined(_MSC_VER) && (_MSC_VER < 1400) -//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. +//!to_raw_pointer() enables boost::mem_fn to recognize intersegment_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) @@ -918,14 +918,14 @@ T * to_raw_pointer(boost::interprocess::intersegment_ptr const & p) //!for optimizations template struct has_trivial_constructor - < boost::interprocess::intersegment_ptr > + < boost::interprocess::intersegment_ptr > : public true_type{}; //!has_trivial_destructor<> == true_type specialization //!for optimizations template struct has_trivial_destructor - < boost::interprocess::intersegment_ptr > + < boost::interprocess::intersegment_ptr > : public true_type{}; } //namespace boost { @@ -950,7 +950,7 @@ struct has_trivial_destructor // std::size_t offset; //RELATIVE_SIZE_BITS = SIZE_T_BITS - -// MAX_SEGMENT_BITS - +// MAX_SEGMENT_BITS - // CTRL_BITS 10 10 //MAX_SEGMENT_SIZE = SIZE_T_BITS - ALIGN_BITS 20 52 diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp new file mode 100644 index 000000000..548e17d9e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/managed_global_memory.hpp @@ -0,0 +1,115 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP +#define BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +struct intermodule_singleton_mutex_family +{ + typedef boost::interprocess::ipcdetail::spin_mutex mutex_type; + typedef boost::interprocess::ipcdetail::spin_recursive_mutex recursive_mutex_type; +}; + +struct intermodule_types +{ + //We must use offset_ptr since a loaded DLL can map the singleton holder shared memory + //at a different address than other DLLs or the main executable + typedef rbtree_best_fit > mem_algo; + template + struct open_or_create + { + typedef managed_open_or_create_impl + type; + }; +}; + +//we must implement our own managed shared memory to avoid circular dependencies +template +class basic_managed_global_memory + : public basic_managed_memory_impl + < char + , intermodule_types::mem_algo + , iset_index + , intermodule_types::open_or_create::type::ManagedOpenOrCreateUserOffset + > + , private intermodule_types::open_or_create::type +{ + /// @cond + typedef typename intermodule_types::template open_or_create::type base2_t; + + typedef basic_managed_memory_impl + < char + , intermodule_types::mem_algo + , iset_index + , base2_t::ManagedOpenOrCreateUserOffset + > base_t; + + typedef create_open_func create_open_func_t; + + basic_managed_global_memory *get_this_pointer() + { return this; } + + public: + typedef typename base_t::size_type size_type; + + private: + typedef typename base_t::char_ptr_holder_t char_ptr_holder_t; + BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_global_memory) + /// @endcond + + public: //functions + + basic_managed_global_memory (open_or_create_t open_or_create, + const char *name, size_type size, + const void *addr = 0, const permissions& perm = permissions()) + : base_t() + , base2_t(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), + DoOpenOrCreate), perm) + {} + + basic_managed_global_memory (open_only_t open_only, const char* name, + const void *addr = 0) + : base_t() + , base2_t(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), + DoOpen)) + {} +}; + + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp index 31c380443..2f97935d4 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_memory_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -34,7 +34,7 @@ #include //!\file -//!Describes a named shared memory allocation user class. +//!Describes a named shared memory allocation user class. //! namespace boost { @@ -45,7 +45,7 @@ template class create_open_func; template< - class CharType, + class CharType, class MemoryAlgorithm, template class IndexType > @@ -54,14 +54,14 @@ struct segment_manager_type typedef segment_manager type; }; -//!This class is designed to be a base class to classes that manage -//!creation of objects in a fixed size memory buffer. Apart -//!from allocating raw memory, the user can construct named objects. To +//!This class is designed to be a base class to classes that manage +//!creation of objects in a fixed size memory buffer. Apart +//!from allocating raw memory, the user can construct named objects. To //!achieve this, this class uses the reserved space provided by the allocation //!algorithm to place a named_allocator_algo, who takes care of name mappings. //!The class can be customized with the char type used for object names //!and the memory allocation algorithm to be used.*/ -template < class CharType +template < class CharType , class MemoryAlgorithm , template class IndexType , std::size_t Offset = 0 @@ -92,7 +92,7 @@ class basic_managed_memory_impl /// @cond - typedef typename + typedef typename segment_manager::char_ptr_holder_t char_ptr_holder_t; //Experimental. Don't use. @@ -153,7 +153,7 @@ class basic_managed_memory_impl } //!Constructor. Allocates basic resources. Never throws. - basic_managed_memory_impl() + basic_managed_memory_impl() : mp_header(0){} //!Destructor. Calls close. Never throws. @@ -169,19 +169,19 @@ class basic_managed_memory_impl if(size < segment_manager::get_min_size()) return false; - //This function should not throw. The index construction can + //This function should not throw. The index construction can //throw if constructor allocates memory. So we must catch it. BOOST_TRY{ - //Let's construct the allocator in memory + //Let's construct the allocator in memory mp_header = new(addr) segment_manager(size); } BOOST_CATCH(...){ return false; } BOOST_CATCH_END - return true; + return true; } - + //!Connects to a segment manager in the reserved buffer. Never throws. bool open_impl (void *addr, size_type) { @@ -192,7 +192,7 @@ class basic_managed_memory_impl //!Frees resources. Never throws. bool close_impl() - { + { bool ret = mp_header != 0; mp_header = 0; return ret; @@ -249,40 +249,40 @@ class basic_managed_memory_impl void zero_free_memory() { mp_header->zero_free_memory(); } - //!Transforms an absolute address into an offset from base address. + //!Transforms an absolute address into an offset from base address. //!The address must belong to the memory segment. Never throws. handle_t get_handle_from_address (const void *ptr) const { - return (handle_t)(reinterpret_cast(ptr) - - reinterpret_cast(this->get_address())); + return (handle_t)(reinterpret_cast(ptr) - + reinterpret_cast(this->get_address())); } //!Returns true if the address belongs to the managed memory segment bool belongs_to_segment (const void *ptr) const - { - return ptr >= this->get_address() && + { + return ptr >= this->get_address() && ptr < (reinterpret_cast(this->get_address()) + this->get_size()); } - //!Transforms previously obtained offset into an absolute address in the + //!Transforms previously obtained offset into an absolute address in the //!process space of the current process. Never throws.*/ void * get_address_from_handle (handle_t offset) const { return reinterpret_cast(this->get_address()) + offset; } //!Searches for nbytes of free memory in the segment, marks the - //!memory as used and return the pointer to the memory. If no + //!memory as used and return the pointer to the memory. If no //!memory is available throws a boost::interprocess::bad_alloc exception void* allocate (size_type nbytes) { return mp_header->allocate(nbytes); } - //!Searches for nbytes of free memory in the segment, marks the - //!memory as used and return the pointer to the memory. If no memory + //!Searches for nbytes of free memory in the segment, marks the + //!memory as used and return the pointer to the memory. If no memory //!is available returns 0. Never throws. void* allocate (size_type nbytes, std::nothrow_t nothrow) { return mp_header->allocate(nbytes, nothrow); } //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment" - //!must be power of two. If no memory + //!must be power of two. If no memory //!is available returns 0. Never throws. void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t nothrow) { return mp_header->allocate_aligned(nbytes, alignment, nothrow); } @@ -292,13 +292,13 @@ class basic_managed_memory_impl allocation_command (boost::interprocess::allocation_type command, size_type limit_size, size_type preferred_size,size_type &received_size, T *reuse_ptr = 0) - { + { return mp_header->allocation_command (command, limit_size, preferred_size, received_size, reuse_ptr); } //!Allocates nbytes bytes aligned to "alignment" bytes. "alignment" - //!must be power of two. If no + //!must be power of two. If no //!memory is available throws a boost::interprocess::bad_alloc exception void * allocate_aligned(size_type nbytes, size_type alignment) { return mp_header->allocate_aligned(nbytes, alignment); } @@ -307,25 +307,31 @@ class basic_managed_memory_impl //Experimental. Don't use. - //!Allocates n_elements of elem_size bytes. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) - { return mp_header->allocate_many(elem_bytes, num_elements); } + //!Allocates n_elements of elem_bytes bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { mp_header->allocate_many(elem_bytes, n_elements, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements) - { return mp_header->allocate_many(elem_sizes, n_elements); } + //!Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { mp_header->allocate_many(element_lengths, n_elements, sizeof_element, chain); } - //!Allocates n_elements of elem_size bytes. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements, std::nothrow_t nothrow) - { return mp_header->allocate_many(elem_bytes, num_elements, nothrow); } + //!Allocates n_elements of elem_bytes bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { mp_header->allocate_many(std::nothrow_t(), elem_bytes, n_elements, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, std::nothrow_t nothrow) - { return mp_header->allocate_many(elem_sizes, n_elements, nothrow); } + //!Allocates n_elements, each one of + //!element_lengths[i]*sizeof_element bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { mp_header->allocate_many(std::nothrow_t(), elem_sizes, n_elements, sizeof_element, chain); } - //!Allocates n_elements, each one of elem_sizes[i] bytes. - void deallocate_many(multiallocation_chain chain) - { return mp_header->deallocate_many(boost::move(chain)); } + //!Deallocates all elements contained in chain. + //!Never throws. + void deallocate_many(multiallocation_chain &chain) + { mp_header->deallocate_many(chain); } /// @endcond @@ -342,18 +348,18 @@ class basic_managed_memory_impl //!Creates a named object or array in memory //! - //!Allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -363,18 +369,18 @@ class basic_managed_memory_impl //!Finds or creates a named object or array in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -384,18 +390,18 @@ class basic_managed_memory_impl //!Creates a named object or array in memory //! - //!Allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! //!-> If the name was previously used, returns 0. //! - //!-> Returns 0 if there is no available memory + //!-> Returns 0 if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -405,18 +411,18 @@ class basic_managed_memory_impl //!Finds or creates a named object or array in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs a T object or an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs a T object or an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. If an array is being constructed all objects are //!created using the same parameters given to this function. //! - //!-> Returns 0 if there is no available memory + //!-> Returns 0 if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and if an + //!Memory is freed automatically if T's constructor throws and if an //!array was being constructed, destructors of created objects are called //!before freeing the memory. template @@ -424,54 +430,54 @@ class basic_managed_memory_impl find_or_construct(char_ptr_holder_t name, std::nothrow_t nothrow) { return mp_header->template find_or_construct(name, nothrow); } - //!Creates a named array from iterators in memory + //!Creates a named array from iterators in memory //! - //!Allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory. template typename segment_manager::template construct_iter_proxy::type construct_it(char_ptr_holder_t name) { return mp_header->template construct_it(name); } - //!Finds or creates a named array from iterators in memory + //!Finds or creates a named array from iterators in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. //! //!-> If the name was previously used, returns 0. //! - //!-> Throws boost::interprocess::bad_alloc if there is no available memory + //!-> Throws boost::interprocess::bad_alloc if there is no available memory //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory. template typename segment_manager::template construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name) { return mp_header->template find_or_construct_it(name); } - //!Creates a named array from iterators in memory + //!Creates a named array from iterators in memory //! - //!Allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. @@ -482,19 +488,19 @@ class basic_managed_memory_impl //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory.*/ template typename segment_manager::template construct_iter_proxy::type construct_it(char_ptr_holder_t name, std::nothrow_t nothrow) { return mp_header->template construct_it(name, nothrow); } - //!Finds or creates a named array from iterators in memory + //!Finds or creates a named array from iterators in memory //! - //!Tries to find an object with the given name in memory. If - //!found, returns the pointer to this pointer. If the object is not found, - //!allocates and constructs an array of T in memory, - //!associates this with the given name and returns a pointer to the + //!Tries to find an object with the given name in memory. If + //!found, returns the pointer to this pointer. If the object is not found, + //!allocates and constructs an array of T in memory, + //!associates this with the given name and returns a pointer to the //!created object. Each element in the array is created using the //!objects returned when dereferencing iterators as parameters //!and incrementing all iterators for each element. @@ -505,7 +511,7 @@ class basic_managed_memory_impl //! //!-> If T's constructor throws, the function throws that exception. //! - //!Memory is freed automatically if T's constructor throws and + //!Memory is freed automatically if T's constructor throws and //!destructors of created objects are called before freeing the memory.*/ template typename segment_manager::template construct_iter_proxy::type @@ -537,11 +543,11 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object or array, the Standard + //!When deleting a dynamically object or array, the Standard //!does not guarantee that dynamically allocated memory, will be released. - //!Also, when deleting arrays, the Standard doesn't require calling - //!destructors for the rest of the objects if for one of them the destructor - //!terminated with an exception. + //!Also, when deleting arrays, the Standard doesn't require calling + //!destructors for the rest of the objects if for one of them the destructor + //!terminated with an exception. //! //!Destroying an object: //! @@ -550,13 +556,13 @@ class basic_managed_memory_impl //! //!Destroying an array: //! - //!When destroying an array, if a destructor throws, the rest of + //!When destroying an array, if a destructor throws, the rest of //!destructors are called. If any of these throws, the exceptions are //!ignored. The name association will be erased, memory will be freed and //!the first exception will be thrown. This guarantees the unlocking of //!mutexes and other resources. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended. template bool destroy(const CharType *name) @@ -568,7 +574,7 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object, the Standard does not + //!When deleting a dynamically object, the Standard does not //!guarantee that dynamically allocated memory will be released. //! //!Destroying an object: @@ -576,7 +582,7 @@ class basic_managed_memory_impl //!If the destructor throws, the memory will be freed and that exception //!will be thrown. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended for memory. template bool destroy(const unique_instance_t *const ) @@ -588,7 +594,7 @@ class basic_managed_memory_impl //! //!Exception Handling: //! - //!When deleting a dynamically object, the Standard does not + //!When deleting a dynamically object, the Standard does not //!guarantee that dynamically allocated memory will be released. //! //!Destroying an object: @@ -596,7 +602,7 @@ class basic_managed_memory_impl //!If the destructor throws, the memory will be freed and that exception //!will be thrown. //! - //!For all theses reasons, classes with throwing destructors are not + //!For all theses reasons, classes with throwing destructors are not //!recommended for memory. template void destroy_ptr(const T *ptr) @@ -620,13 +626,13 @@ class basic_managed_memory_impl static size_type get_instance_length(const T *ptr) { return segment_manager::get_instance_length(ptr); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" named objects in the memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_named_objects(size_type num) { mp_header->reserve_named_objects(num); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" unique objects in the memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_unique_objects(size_type num) @@ -652,7 +658,7 @@ class basic_managed_memory_impl const_named_iterator named_begin() const { return mp_header->named_begin(); } - //!Returns a constant iterator to the end of the index + //!Returns a constant iterator to the end of the index //!storing the named allocations. NOT thread-safe. Never throws. const_named_iterator named_end() const { return mp_header->named_end(); } @@ -662,7 +668,7 @@ class basic_managed_memory_impl const_unique_iterator unique_begin() const { return mp_header->unique_begin(); } - //!Returns a constant iterator to the end of the index + //!Returns a constant iterator to the end of the index //!storing the unique allocations. NOT thread-safe. Never throws. const_unique_iterator unique_end() const { return mp_header->unique_end(); } @@ -719,20 +725,40 @@ class basic_managed_memory_impl template class create_open_func { + typedef typename BasicManagedMemoryImpl::size_type size_type; + public: + create_open_func(BasicManagedMemoryImpl * const frontend, create_enum_t type) : m_frontend(frontend), m_type(type){} - bool operator()(void *addr, typename BasicManagedMemoryImpl::size_type size, bool created) const - { - if(((m_type == DoOpen) && created) || - ((m_type == DoCreate) && !created)) + bool operator()(void *addr, std::size_t size, bool created) const + { + if( ((m_type == DoOpen) && created) || + ((m_type == DoCreate) && !created) || + //Check for overflow + size_type(-1) < size ){ return false; + } + else if(created){ + return m_frontend->create_impl(addr, static_cast(size)); + } + else{ + return m_frontend->open_impl (addr, static_cast(size)); + } + } - if(created) - return m_frontend->create_impl(addr, size); - else - return m_frontend->open_impl (addr, size); + std::size_t get_min_size() const + { + const size_type sz = m_frontend->get_segment_manager()->get_min_size(); + if(sz > std::size_t(-1)){ + //The minimum size is not representable by std::size_t + BOOST_ASSERT(false); + return std::size_t(-1); + } + else{ + return static_cast(sz); + } } private: diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp index 579d1ad6f..b1b272514 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_multi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -36,7 +36,7 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include //!\file @@ -51,28 +51,28 @@ namespace interprocess { //-Use GetSecurityInfo? //-Change everything to use only a shared memory object expanded via truncate()? -//!A basic shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +//!A basic shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl template < - class CharType, - class MemoryAlgorithm, + class CharType, + class MemoryAlgorithm, template class IndexType > -class basic_managed_multi_shared_memory +class basic_managed_multi_shared_memory : public ipcdetail::basic_managed_memory_impl { typedef basic_managed_multi_shared_memory self_t; - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; - + typedef typename MemoryAlgorithm::void_pointer void_pointer; typedef typename ipcdetail:: - managed_open_or_create_impl managed_impl; + managed_open_or_create_impl managed_impl; typedef typename void_pointer::segment_group_id segment_group_id; typedef typename base_t::size_type size_type; @@ -91,7 +91,7 @@ class basic_managed_multi_shared_memory // { // public: // segment_creator(shared_memory &shmem, -// const char *mem_name, +// const char *mem_name, // const void *addr) // : m_shmem(shmem), m_mem_name(mem_name), m_addr(addr){} // @@ -99,8 +99,8 @@ class basic_managed_multi_shared_memory // { // if(!m_shmem.create(m_mem_name, size, m_addr)) // return 0; -// return m_shmem.get_address(); -// } +// return m_shmem.get_address(); +// } // private: // shared_memory &m_shmem; // const char *m_mem_name; @@ -113,7 +113,7 @@ class basic_managed_multi_shared_memory public: typedef std::pair result_type; typedef basic_managed_multi_shared_memory frontend_t; - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; typedef typename void_pointer::segment_group_id segment_group_id; group_services(frontend_t *const frontend) @@ -127,14 +127,14 @@ class basic_managed_multi_shared_memory alloc_size += 1; //If requested size is less than minimum, update that - alloc_size = (m_min_segment_size > alloc_size) ? + alloc_size = (m_min_segment_size > alloc_size) ? m_min_segment_size : alloc_size; if(mp_frontend->priv_new_segment(create_open_func::DoCreate, alloc_size, 0, permissions())){ typename shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin(); return result_type(m_impl.get_real_address(), m_impl.get_real_size()-1); }*/ - return result_type(static_cast(0), 0); + return result_type(static_cast(0), 0); } virtual bool update_segments () @@ -166,7 +166,7 @@ class basic_managed_multi_shared_memory struct create_open_func { enum type_t { DoCreate, DoOpen, DoOpenOrCreate }; - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; create_open_func(self_t * const frontend, @@ -174,8 +174,8 @@ class basic_managed_multi_shared_memory : mp_frontend(frontend), m_type(type), m_segment_number(segment_number){} bool operator()(void *addr, size_type size, bool created) const - { - if(((m_type == DoOpen) && created) || + { + if(((m_type == DoOpen) && created) || ((m_type == DoCreate) && !created)) return false; segment_group_id group = mp_frontend->m_group_services.get_group(); @@ -191,7 +191,7 @@ class basic_managed_multi_shared_memory //Check if this is the master segment if(!m_segment_number){ //Create or open the Interprocess machinery - if((impl_done = created ? + if((impl_done = created ? mp_frontend->create_impl(addr, size) : mp_frontend->open_impl(addr, size))){ return true; } @@ -211,22 +211,36 @@ class basic_managed_multi_shared_memory } return false; } + + std::size_t get_min_size() const + { + const size_type sz = mp_frontend->get_segment_manager()->get_min_size(); + if(sz > std::size_t(-1)){ + //The minimum size is not representable by std::size_t + BOOST_ASSERT(false); + return std::size_t(-1); + } + else{ + return static_cast(sz); + } + } + self_t * const mp_frontend; type_t m_type; - size_type m_segment_number; + size_type m_segment_number; }; //!Functor to execute atomically when closing a shared memory segment. struct close_func { - typedef typename + typedef typename basic_managed_multi_shared_memory::void_pointer void_pointer; close_func(self_t * const frontend) : mp_frontend(frontend){} void operator()(const mapped_region ®ion, bool last) const - { + { if(last) mp_frontend->destroy_impl(); else mp_frontend->close_impl(); } @@ -251,7 +265,7 @@ class basic_managed_multi_shared_memory const permissions &perm = permissions()) : m_group_services(get_this_pointer()) { - priv_open_or_create(create_open_func::DoCreate,name, size, perm); + priv_open_or_create(create_open_func::DoCreate,name, size, perm); } basic_managed_multi_shared_memory(open_or_create_t, @@ -273,7 +287,7 @@ class basic_managed_multi_shared_memory { this->priv_close(); } private: - bool priv_open_or_create(typename create_open_func::type_t type, + bool priv_open_or_create(typename create_open_func::type_t type, const char *name, size_type size, const permissions &perm) @@ -301,7 +315,7 @@ class basic_managed_multi_shared_memory if(group){ void_pointer::delete_group(group); } - return false; + return false; } bool priv_new_segment(typename create_open_func::type_t type, @@ -312,7 +326,7 @@ class basic_managed_multi_shared_memory BOOST_TRY{ //Get the number of groups of this multi_segment group size_type segment_id = m_shmem_list.size(); - //Format the name of the shared memory: append segment number. + //Format the name of the shared memory: append segment number. boost::interprocess::basic_ovectorstream formatter; //Pre-reserve string size size_type str_size = m_root_name.length()+10; @@ -368,7 +382,7 @@ class basic_managed_multi_shared_memory //!Frees resources. Never throws. void priv_close() - { + { if(!m_shmem_list.empty()){ bool ret; //Obtain group identifier @@ -385,7 +399,7 @@ class basic_managed_multi_shared_memory m_shmem_list.clear(); } } - + private: shmem_list_t m_shmem_list; group_services m_group_services; diff --git a/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp b/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp index 4d6997f33..f8154d061 100644 --- a/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/managed_open_or_create_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -48,12 +48,12 @@ class xsi_key; template<> struct managed_open_or_create_impl_device_id_t -{ +{ typedef xsi_key type; }; #endif //BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS - + /// @endcond namespace ipcdetail { @@ -79,12 +79,12 @@ class managed_open_or_create_impl_device_holder const DeviceAbstraction &get_device() const { return dev; } - + private: DeviceAbstraction dev; }; -template +template class managed_open_or_create_impl : public managed_open_or_create_impl_device_holder { @@ -94,16 +94,16 @@ class managed_open_or_create_impl typedef typename managed_open_or_create_impl_device_id_t::type device_id_t; typedef managed_open_or_create_impl_device_holder DevHolder; enum - { - UninitializedSegment, - InitializingSegment, + { + UninitializedSegment, + InitializingSegment, InitializedSegment, CorruptedSegment }; public: static const std::size_t - ManagedOpenOrCreateUserOffset = + ManagedOpenOrCreateUserOffset = ct_rounded_size < sizeof(boost::uint32_t) , MemAlignment ? (MemAlignment) : @@ -113,7 +113,7 @@ class managed_open_or_create_impl managed_open_or_create_impl() {} - managed_open_or_create_impl(create_only_t, + managed_open_or_create_impl(create_only_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -130,7 +130,7 @@ class managed_open_or_create_impl , null_mapped_region_function()); } - managed_open_or_create_impl(open_only_t, + managed_open_or_create_impl(open_only_t, const device_id_t & id, mode_t mode, const void *addr) @@ -146,7 +146,7 @@ class managed_open_or_create_impl } - managed_open_or_create_impl(open_or_create_t, + managed_open_or_create_impl(open_or_create_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -164,7 +164,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(create_only_t, + managed_open_or_create_impl(create_only_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -183,7 +183,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(open_only_t, + managed_open_or_create_impl(open_only_t, const device_id_t & id, mode_t mode, const void *addr, @@ -200,7 +200,7 @@ class managed_open_or_create_impl } template - managed_open_or_create_impl(open_or_create_t, + managed_open_or_create_impl(open_or_create_t, const device_id_t & id, std::size_t size, mode_t mode, @@ -222,10 +222,10 @@ class managed_open_or_create_impl { this->swap(moved); } managed_open_or_create_impl &operator=(BOOST_RV_REF(managed_open_or_create_impl) moved) - { + { managed_open_or_create_impl tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } ~managed_open_or_create_impl() @@ -298,10 +298,10 @@ class managed_open_or_create_impl tmp.swap(dev); } - template inline + template inline void priv_open_or_create - (create_enum_t type, - const device_id_t & id, + (create_enum_t type, + const device_id_t & id, std::size_t size, mode_t mode, const void *addr, const permissions &perm, @@ -315,8 +315,13 @@ class managed_open_or_create_impl bool cow = false; DeviceAbstraction dev; - if(type != DoOpen && size < ManagedOpenOrCreateUserOffset){ - throw interprocess_exception(error_info(size_error)); + if(type != DoOpen){ + //Check if the requested size is enough to build the managed metadata + const std::size_t func_min_size = construct_func.get_min_size(); + if( (std::size_t(-1) - ManagedOpenOrCreateUserOffset) < func_min_size || + size < (func_min_size + ManagedOpenOrCreateUserOffset) ){ + throw interprocess_exception(error_info(size_error)); + } } //Check size can be represented by offset_t (used by truncate) if(type != DoOpen && !check_offset_t_size(size, file_like_t())){ @@ -366,8 +371,8 @@ class managed_open_or_create_impl created = false; completed = true; } - catch(interprocess_exception &ex){ - if(ex.get_error_code() != not_found_error){ + catch(interprocess_exception &e){ + if(e.get_error_code() != not_found_error){ throw; } } @@ -396,7 +401,8 @@ class managed_open_or_create_impl if(previous == UninitializedSegment){ try{ - construct_func(static_cast(region.get_address()) + ManagedOpenOrCreateUserOffset, size - ManagedOpenOrCreateUserOffset, true); + construct_func( static_cast(region.get_address()) + ManagedOpenOrCreateUserOffset + , size - ManagedOpenOrCreateUserOffset, true); //All ok, just move resources to the external mapped region m_mapped_region.swap(region); } @@ -460,6 +466,11 @@ class managed_open_or_create_impl } } + friend void swap(managed_open_or_create_impl &left, managed_open_or_create_impl &right) + { + left.swap(right); + } + private: friend class interprocess_tester; void dont_close_on_destruction() @@ -468,11 +479,6 @@ class managed_open_or_create_impl mapped_region m_mapped_region; }; -template -inline void swap(managed_open_or_create_impl &x - ,managed_open_or_create_impl &y) -{ x.swap(y); } - } //namespace ipcdetail { } //namespace interprocess { diff --git a/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp index 08274160d..20922b39c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/math_functions.hpp @@ -1,10 +1,10 @@ ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Stephen Cleary 2000. -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. @@ -93,7 +93,7 @@ inline std::size_t floor_log2 (std::size_t x) std::size_t n = x; std::size_t log2 = 0; - + for(std::size_t shift = Bits >> 1; shift; shift >>= 1){ std::size_t tmp = n >> shift; if (tmp) diff --git a/project/jni/boost/include/boost/interprocess/detail/min_max.hpp b/project/jni/boost/include/boost/interprocess/detail/min_max.hpp index 75aa00f87..63ce7efd9 100644 --- a/project/jni/boost/include/boost/interprocess/detail/min_max.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/min_max.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -21,7 +21,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { template const T &max_value(const T &a, const T &b) @@ -31,7 +31,7 @@ template const T &min_value(const T &a, const T &b) { return a < b ? a : b; } -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/move.hpp b/project/jni/boost/include/boost/interprocess/detail/move.hpp index 1ec43b211..87684f621 100644 --- a/project/jni/boost/include/boost/interprocess/detail/move.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/move.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2010-2011. +// (C) Copyright Ion Gaztanaga 2010-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) diff --git a/project/jni/boost/include/boost/interprocess/detail/mpl.hpp b/project/jni/boost/include/boost/interprocess/detail/mpl.hpp index c5b6f90ef..4c5e1f1b9 100644 --- a/project/jni/boost/include/boost/interprocess/detail/mpl.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/mpl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -105,24 +105,24 @@ struct if_ template -struct select1st -// : public std::unary_function +struct select1st +// : public std::unary_function { template - const typename Pair::first_type& operator()(const OtherPair& x) const + const typename Pair::first_type& operator()(const OtherPair& x) const { return x.first; } - const typename Pair::first_type& operator()(const typename Pair::first_type& x) const + const typename Pair::first_type& operator()(const typename Pair::first_type& x) const { return x; } }; // identity is an extension: it is not part of the standard. template -struct identity -// : public std::unary_function +struct identity +// : public std::unary_function { typedef T type; - const T& operator()(const T& x) const + const T& operator()(const T& x) const { return x; } }; @@ -144,8 +144,8 @@ struct ls_zeros<1> static const std::size_t value = 0; }; -} //namespace ipcdetail { -} //namespace interprocess { +} //namespace ipcdetail { +} //namespace interprocess { } //namespace boost { #endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp b/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp index 4b6cafc74..f625a9bc3 100644 --- a/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/multi_segment_services.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -20,7 +20,7 @@ /*!\file - Describes a named shared memory allocation user class. + Describes a named shared memory allocation user class. */ namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp b/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp index 604d7881e..14a9aa0a7 100644 --- a/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/named_proxy.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -24,7 +24,7 @@ #include #ifndef BOOST_INTERPROCESS_PERFECT_FORWARDING -#include +#include #else #include #include @@ -34,7 +34,7 @@ //!Describes a proxy class that implements named allocation syntax. namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING @@ -83,7 +83,7 @@ struct CtorNArg : public placement_destroy { this->expansion_helper(++get(args_)...); } - + template void expansion_helper(ExpansionArgs &&...) {} @@ -93,11 +93,11 @@ struct CtorNArg : public placement_destroy {} tuple args_; -}; +}; //!Describes a proxy class that implements named //!allocation syntax. -template +template < class SegmentManager //segment manager to construct the object , class T //type of object to build , bool is_iterator //passing parameters are normal object or iterators? @@ -119,10 +119,10 @@ class named_proxy template T *operator()(Args &&...args) const - { + { CtorNArg &&ctor_obj = CtorNArg (boost::forward(args)...); - return mp_mngr->template + return mp_mngr->template generic_construct(mp_name, m_num, m_find, m_dothrow, ctor_obj); } @@ -199,7 +199,7 @@ struct Ctor0Arg : public placement_destroy // private: // void construct(void *mem, true_) // { new((void*)mem)T(*m_p1, *m_p2); } -// +// // void construct(void *mem, false_) // { new((void*)mem)T(m_p1, m_p2); } // @@ -270,7 +270,7 @@ struct Ctor0Arg : public placement_destroy //!Describes a proxy class that implements named //!allocation syntax. -template +template < class SegmentManager //segment manager to construct the object , class T //type of object to build , bool is_iterator //passing parameters are normal object or iterators? @@ -293,9 +293,9 @@ class named_proxy //!makes a named allocation and calls the //!default constructor T *operator()() const - { + { Ctor0Arg ctor_obj; - return mp_mngr->template + return mp_mngr->template generic_construct(mp_name, m_num, m_find, m_dothrow, ctor_obj); } //! @@ -322,7 +322,7 @@ class named_proxy //////////////////////////////////////////////////////////////////////// // // template - // T *operator()(P1 &p1, P2 &p2) const + // T *operator()(P1 &p1, P2 &p2) const // { // typedef Ctor2Arg // diff --git a/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp index b680c5713..840079dc1 100644 --- a/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/os_file_functions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -32,7 +32,7 @@ # include # include # if 0 -# include +# include # endif # else # error Unknown platform @@ -58,7 +58,7 @@ typedef enum { read_only = winapi::generic_read , read_write = winapi::generic_read | winapi::generic_write , copy_on_write , read_private - , invalid_mode = 0xffff + , invalid_mode = 0xffff } mode_t; typedef enum { file_begin = winapi::file_begin @@ -96,28 +96,28 @@ inline const char *get_temporary_path() inline file_handle_t create_new_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file ( name, (unsigned int)mode, winapi::create_new, attr - , (winapi::interprocess_security_attributes*)perm.get_permissions()); + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t create_or_open_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file ( name, (unsigned int)mode, winapi::open_always, attr - , (winapi::interprocess_security_attributes*)perm.get_permissions()); + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t open_existing_file (const char *name, mode_t mode, bool temporary = false) -{ +{ unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file - (name, (unsigned int)mode, winapi::open_existing, attr, 0); + (name, (unsigned int)mode, winapi::open_existing, attr, 0); } inline bool delete_file(const char *name) @@ -140,7 +140,7 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size) if(offset_t(size) > filesize){ if(!winapi::set_file_pointer_ex(hnd, filesize, 0, winapi::file_begin)){ return false; - } + } //We will write zeros in the end of the file //since set_end_of_file does not guarantee this for(std::size_t remaining = size - filesize, write_size = 0 @@ -177,7 +177,7 @@ inline bool get_file_pointer(file_handle_t hnd, offset_t &off) { return winapi::set_file_pointer_ex(hnd, 0, &off, winapi::file_current); } inline bool write_file(file_handle_t hnd, const void *data, std::size_t numdata) -{ +{ unsigned long written; return 0 != winapi::write_file(hnd, data, (unsigned long)numdata, &written, 0); } @@ -189,9 +189,9 @@ inline bool close_file(file_handle_t hnd) { return 0 != winapi::close_handle(hnd); } inline bool acquire_file_lock(file_handle_t hnd) -{ +{ static winapi::interprocess_overlapped overlapped; - const unsigned long len = 0xffffffff; + const unsigned long len = ((unsigned long)-1); // winapi::interprocess_overlapped overlapped; // std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::lock_file_ex @@ -199,44 +199,44 @@ inline bool acquire_file_lock(file_handle_t hnd) } inline bool try_acquire_file_lock(file_handle_t hnd, bool &acquired) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); if(!winapi::lock_file_ex - (hnd, winapi::lockfile_exclusive_lock | winapi::lockfile_fail_immediately, + (hnd, winapi::lockfile_exclusive_lock | winapi::lockfile_fail_immediately, 0, len, len, &overlapped)){ - return winapi::get_last_error() == winapi::error_lock_violation ? + return winapi::get_last_error() == winapi::error_lock_violation ? acquired = false, true : false; - + } return (acquired = true); } inline bool release_file_lock(file_handle_t hnd) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::unlock_file_ex(hnd, 0, len, len, &overlapped); } inline bool acquire_file_lock_sharable(file_handle_t hnd) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); return winapi::lock_file_ex(hnd, 0, 0, len, len, &overlapped); } inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) -{ - const unsigned long len = 0xffffffff; +{ + const unsigned long len = ((unsigned long)-1); winapi::interprocess_overlapped overlapped; std::memset(&overlapped, 0, sizeof(overlapped)); if(!winapi::lock_file_ex (hnd, winapi::lockfile_fail_immediately, 0, len, len, &overlapped)){ - return winapi::get_last_error() == winapi::error_lock_violation ? + return winapi::get_last_error() == winapi::error_lock_violation ? acquired = false, true : false; } return (acquired = true); @@ -367,7 +367,7 @@ typedef enum { read_only = O_RDONLY , read_write = O_RDWR , copy_on_write , read_private - , invalid_mode = 0xffff + , invalid_mode = 0xffff } mode_t; typedef enum { file_begin = SEEK_SET @@ -406,7 +406,7 @@ inline const char *get_temporary_path() inline file_handle_t create_new_file (const char *name, mode_t mode, const permissions & perm = permissions(), bool temporary = false) -{ +{ (void)temporary; int ret = ::open(name, ((int)mode) | O_EXCL | O_CREAT, perm.get_permissions()); if(ret >= 0){ @@ -439,7 +439,7 @@ inline file_handle_t create_or_open_file inline file_handle_t open_existing_file (const char *name, mode_t mode, bool temporary = false) -{ +{ (void)temporary; return ::open(name, (int)mode); } @@ -459,7 +459,7 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size) } inline bool get_file_size(file_handle_t hnd, offset_t &size) -{ +{ struct stat data; bool ret = 0 == ::fstat(hnd, &data); if(ret){ @@ -472,7 +472,7 @@ inline bool set_file_pointer(file_handle_t hnd, offset_t off, file_pos_t pos) { return ((off_t)(-1)) != ::lseek(hnd, off, (int)pos); } inline bool get_file_pointer(file_handle_t hnd, offset_t &off) -{ +{ off = ::lseek(hnd, 0, SEEK_CUR); return off != ((off_t)-1); } @@ -522,7 +522,7 @@ inline bool release_file_lock(file_handle_t hnd) } inline bool acquire_file_lock_sharable(file_handle_t hnd) -{ +{ struct ::flock lock; lock.l_type = F_RDLCK; lock.l_whence = SEEK_SET; @@ -532,7 +532,7 @@ inline bool acquire_file_lock_sharable(file_handle_t hnd) } inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) -{ +{ struct flock lock; lock.l_type = F_RDLCK; lock.l_whence = SEEK_SET; @@ -540,7 +540,7 @@ inline bool try_acquire_file_lock_sharable(file_handle_t hnd, bool &acquired) lock.l_len = 0; int ret = ::fcntl(hnd, F_SETLK, &lock); if(ret == -1){ - return (errno == EAGAIN || errno == EACCES) ? + return (errno == EAGAIN || errno == EACCES) ? acquired = false, true : false; } return (acquired = true); @@ -601,7 +601,7 @@ inline bool delete_subdirectories_recursive || (de->d_name[1] == '.' && de->d_name[2] == '\0' )) ){ continue; } - if(dont_delete_this && std::strcmp(dont_delete_this, de->d_name) == 0){ + if(dont_delete_this && std::strcmp(dont_delete_this, de->d_name) == 0){ continue; } fn = refcstrRootDirectory; diff --git a/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp b/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp index e49e82c8e..f881a1f46 100644 --- a/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/os_thread_functions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -104,7 +104,7 @@ typedef pthread_t OS_thread_id_t; typedef pid_t OS_process_id_t; struct OS_systemwide_thread_id_t -{ +{ OS_systemwide_thread_id_t() : pid(), tid() {} @@ -153,7 +153,7 @@ inline OS_thread_id_t get_current_thread_id() { return ::pthread_self(); } inline OS_thread_id_t get_invalid_thread_id() -{ +{ static pthread_t invalid_id; return invalid_id; } diff --git a/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp b/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp index 7c45be085..aa8da550c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/pointer_type.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -61,11 +61,11 @@ template struct pointer_type { typedef typename pointer_type_imp::pointer_type::type>::type type; + typename remove_reference::type>::type type; }; } //namespace ipcdetail { -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp new file mode 100644 index 000000000..2d0190687 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/portable_intermodule_singleton.hpp @@ -0,0 +1,356 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP +#define BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +typedef basic_managed_global_memory managed_global_memory; + +namespace intermodule_singleton_helpers { + +static void create_tmp_subdir_and_get_pid_based_filepath + (const char *subdir_name, const char *file_prefix, OS_process_id_t pid, std::string &s, bool creation_time = false) +{ + //Let's create a lock file for each process gmem that will mark if + //the process is alive or not + create_tmp_and_clean_old(s); + s += "/"; + s += subdir_name; + if(!open_or_create_directory(s.c_str())){ + throw interprocess_exception(error_info(system_error_code())); + } + s += "/"; + s += file_prefix; + if(creation_time){ + std::string sstamp; + get_pid_creation_time_str(sstamp); + s += sstamp; + } + else{ + pid_str_t pid_str; + get_pid_str(pid_str, pid); + s += pid_str; + } +} + +static bool check_if_filename_complies_with_pid + (const char *filename, const char *prefix, OS_process_id_t pid, std::string &file_suffix, bool creation_time = false) +{ + //Check if filename complies with lock file name pattern + std::string fname(filename); + std::string fprefix(prefix); + if(fname.size() <= fprefix.size()){ + return false; + } + fname.resize(fprefix.size()); + if(fname != fprefix){ + return false; + } + + //If not our lock file, delete it if we can lock it + fname = filename; + fname.erase(0, fprefix.size()); + pid_str_t pid_str; + get_pid_str(pid_str, pid); + file_suffix = pid_str; + if(creation_time){ + std::size_t p = fname.find('_'); + if (p == std::string::npos){ + return false; + } + std::string save_suffix(fname); + fname.erase(p); + fname.swap(file_suffix); + bool ret = (file_suffix == fname); + file_suffix.swap(save_suffix); + return ret; + } + else{ + fname.swap(file_suffix); + return (file_suffix == fname); + } +} + +template<> +struct thread_safe_global_map_dependant +{ + private: + static const int GMemMarkToBeRemoved = -1; + static const int GMemNotPresent = -2; + + static const char *get_lock_file_subdir_name() + { return "gmem"; } + + static const char *get_lock_file_base_name() + { return "lck"; } + + static void create_and_get_singleton_lock_file_path(std::string &s) + { + create_tmp_subdir_and_get_pid_based_filepath + (get_lock_file_subdir_name(), get_lock_file_base_name(), get_current_process_id(), s, true); + } + + struct gmem_erase_func + { + gmem_erase_func(const char *shm_name, const char *singleton_lock_file_path, managed_global_memory & shm) + :shm_name_(shm_name), singleton_lock_file_path_(singleton_lock_file_path), shm_(shm) + {} + + void operator()() + { + locking_file_serial_id *pserial_id = shm_.find("lock_file_fd").first; + if(pserial_id){ + pserial_id->fd = GMemMarkToBeRemoved; + } + delete_file(singleton_lock_file_path_); + shared_memory_object::remove(shm_name_); + } + + const char * const shm_name_; + const char * const singleton_lock_file_path_; + managed_global_memory & shm_; + }; + + //This function applies shared memory erasure logic based on the passed lock file. + static void apply_gmem_erase_logic(const char *filepath, const char *filename) + { + int fd = GMemMarkToBeRemoved; + try{ + std::string str; + //If the filename is current process lock file, then avoid it + if(check_if_filename_complies_with_pid + (filename, get_lock_file_base_name(), get_current_process_id(), str, true)){ + return; + } + //Open and lock the other process' lock file + fd = try_open_and_lock_file(filepath); + if(fd < 0){ + return; + } + //If done, then the process is dead so take global shared memory name + //(the name is based on the lock file name) and try to apply erasure logic + str.insert(0, get_map_base_name()); + try{ + managed_global_memory shm(open_only, str.c_str()); + gmem_erase_func func(str.c_str(), filepath, shm); + shm.try_atomic_func(func); + } + catch(interprocess_exception &e){ + //If shared memory is not found erase the lock file + if(e.get_error_code() == not_found_error){ + delete_file(filepath); + } + } + } + catch(...){ + + } + if(fd >= 0){ + close_lock_file(fd); + } + } + + public: + + static bool remove_old_gmem() + { + std::string refcstrRootDirectory; + tmp_folder(refcstrRootDirectory); + refcstrRootDirectory += "/"; + refcstrRootDirectory += get_lock_file_subdir_name(); + return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); + } + + struct lock_file_logic + { + lock_file_logic(managed_global_memory &shm) + : mshm(shm) + { shm.atomic_func(*this); } + + void operator()(void) + { + retry_with_new_map = false; + + //First find the file locking descriptor id + locking_file_serial_id *pserial_id = + mshm.find("lock_file_fd").first; + + int fd; + //If not found schedule a creation + if(!pserial_id){ + fd = GMemNotPresent; + } + //Else get it + else{ + fd = pserial_id->fd; + } + //If we need to create a new one, do it + if(fd == GMemNotPresent){ + std::string lck_str; + //Create a unique current pid based lock file path + create_and_get_singleton_lock_file_path(lck_str); + //Open or create and lock file + int fd_lockfile = open_or_create_and_lock_file(lck_str.c_str()); + //If failed, write a bad file descriptor to notify other modules that + //something was wrong and unlink shared memory. Mark the function object + //to tell caller to retry with another shared memory + if(fd_lockfile < 0){ + this->register_lock_file(GMemMarkToBeRemoved); + std::string s; + get_map_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_map = true; + } + //If successful, register the file descriptor + else{ + this->register_lock_file(fd_lockfile); + } + } + //If the fd was invalid (maybe a previous try failed) notify caller that + //should retry creation logic, since this shm might have been already + //unlinked since the shm was removed + else if (fd == GMemMarkToBeRemoved){ + retry_with_new_map = true; + } + //If the stored fd is not valid (a open fd, a normal file with the + //expected size, or does not have the same file id number, + //then it's an old shm from an old process with the same pid. + //If that's the case, mark it as invalid + else if(!is_valid_fd(fd) || + !is_normal_file(fd) || + 0 != get_size(fd) || + !compare_file_serial(fd, *pserial_id)){ + pserial_id->fd = GMemMarkToBeRemoved; + std::string s; + get_map_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_map = true; + } + else{ + //If the lock file is ok, increment reference count of + //attached modules to shared memory + atomic_inc32(&pserial_id->modules_attached_to_gmem_count); + } + } + + bool retry() const { return retry_with_new_map; } + + private: + locking_file_serial_id * register_lock_file(int fd) + { + locking_file_serial_id *pinfo = mshm.construct("lock_file_fd")(); + fill_file_serial_id(fd, *pinfo); + return pinfo; + } + + managed_global_memory &mshm; + bool retry_with_new_map; + }; + + static void construct_map(void *addr) + { + std::string s; + intermodule_singleton_helpers::get_map_name(s); + const char *MapName = s.c_str(); + const std::size_t MapSize = intermodule_singleton_helpers::get_map_size();; + ::new (addr)managed_global_memory(open_or_create, MapName, MapSize); + } + + struct unlink_map_logic + { + unlink_map_logic(managed_global_memory &mshm) + : mshm_(mshm) + { mshm.atomic_func(*this); } + + void operator()() + { + locking_file_serial_id *pserial_id = + mshm_.find + ("lock_file_fd").first; + BOOST_ASSERT(0 != pserial_id); + if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){ + int fd = pserial_id->fd; + if(fd > 0){ + pserial_id->fd = GMemMarkToBeRemoved; + std::string s; + create_and_get_singleton_lock_file_path(s); + delete_file(s.c_str()); + close_lock_file(fd); + intermodule_singleton_helpers::get_map_name(s); + shared_memory_object::remove(s.c_str()); + } + } + } + + private: + managed_global_memory &mshm_; + }; + + static ref_count_ptr *find(managed_global_memory &map, const char *name) + { + return map.find(name).first; + } + + static ref_count_ptr *insert(managed_global_memory &map, const char *name, const ref_count_ptr &ref) + { + return map.construct(name)(ref); + } + + static bool erase(managed_global_memory &map, const char *name) + { + return map.destroy(name); + } + + template + static void atomic_func(managed_global_memory &map, F &f) + { + map.atomic_func(f); + } +}; + +} //namespace intermodule_singleton_helpers { + +template +class portable_intermodule_singleton + : public intermodule_singleton_impl +{}; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp b/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp index c1276f0f2..fa167f576 100644 --- a/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/posix_time_types_wrk.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -15,7 +15,7 @@ #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define BOOST_INTERPROCESS_WIN32_LEAN_AND_MEAN #endif //#ifndef WIN32_LEAN_AND_MEAN #endif //#ifdef _WIN32 diff --git a/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp b/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp index 4af268645..0eb419d62 100644 --- a/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/preprocessor.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -21,7 +21,7 @@ #error "This file is not needed when perfect forwarding is available" #endif -#include +#include #include #include #include @@ -35,7 +35,7 @@ //This cast is ugly but it is necessary until "perfect forwarding" //is achieved in C++0x. Meanwhile, if we want to be able to //bind rvalues with non-const references, we have to be ugly -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ //! @@ -45,7 +45,7 @@ //! #endif -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PP_PARAM(U, u) \ U && u \ //! @@ -55,78 +55,144 @@ //! #endif -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ + //! -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ -//! - -#else - -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \ -//! +#else //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ + //! #endif -#else -#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ -//! -#endif +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ - BOOST_PP_CAT(++m_p, n) \ -//! + #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) -#ifndef BOOST_NO_RVALUE_REFERENCES + namespace boost { + namespace interprocess { + namespace ipcdetail { + template + struct ref_holder; -#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + template + struct ref_holder + { + ref_holder(T &t) + : t_(t) + {} + T &t_; + T & get() { return t_; } + T & get_lvalue() { return t_; } + }; -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ -//! + template + struct ref_holder + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + const T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + const T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(T &&t) + : t_(t) + {} + T &t_; + T && get() { return ::boost::move(t_); } + T & get_lvalue() { return t_; } + }; + + template + struct ref_holder + { + ref_holder(T &&t) + : t(t) + {} + T &t; + T && get() { return ::boost::move(t_); } + T & get_lvalue() { return t_; } + }; + + } //namespace ipcdetail { + } //namespace interprocess { + } //namespace boost { + + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ + ::boost::interprocess::ipcdetail::ref_holder BOOST_PP_CAT(m_p, n); \ + //! + + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n).get_lvalue() \ + //! + + #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data)\ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ + //! + + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n) \ + //! + + #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #else + #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ + //! -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ -//! + #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++m_p, n) \ + //! -#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) - - -#else -#define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \ - BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ -//! #endif #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \ ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ //! -#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) -#include + #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ + //! -#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ -::boost::container::container_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \ -//! + #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ + BOOST_PP_CAT(*m_p, n).get_lvalue() \ + //! #else -#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ -::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ -//! + #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ + ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ + //! -#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ + BOOST_PP_CAT(*m_p, n) \ + //! -#define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ -BOOST_PP_CAT(*m_p, n) \ -//! + +#endif //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #include diff --git a/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp b/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp index 4a4709e3a..63d9915b5 100644 --- a/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/ptime_wrk.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -15,7 +15,7 @@ #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #define BOOST_INTERPROCESS_WIN32_LEAN_AND_MEAN #endif //#ifndef WIN32_LEAN_AND_MEAN #endif //#ifdef _WIN32 diff --git a/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp b/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp index b2097d0ad..cac659549 100644 --- a/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/robust_emulation.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2010-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2010-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -68,7 +68,7 @@ inline void robust_lock_path(std::string &s) inline void create_and_get_robust_lock_file_path(std::string &s, OS_process_id_t pid) { - file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath + intermodule_singleton_helpers::create_tmp_subdir_and_get_pid_based_filepath (robust_lock_subdir_path(), robust_lock_prefix(), pid, s); } @@ -132,7 +132,7 @@ class robust_mutex_lock_file throw interprocess_exception(other_error, "Robust emulation robust_mutex_lock_file constructor failed: create_file filed with unexpected error"); } } - } + } ~robust_mutex_lock_file() { @@ -154,7 +154,7 @@ class robust_mutex_lock_file { std::string pid_str; //If the lock file is not our own lock file, then try to do the cleanup - if(!file_locking_helpers::check_if_filename_complies_with_pid + if(!intermodule_singleton_helpers::check_if_filename_complies_with_pid (filename, robust_lock_prefix(), get_current_process_id(), pid_str)){ remove_if_can_lock_file(filepath); } @@ -197,8 +197,8 @@ class robust_spin_mutex bool lock_own_unique_file(); bool robust_check(); bool check_if_owner_dead_and_take_ownership_atomically(); - bool is_owner_dead(boost::uint32_t owner); - void owner_to_filename(boost::uint32_t owner, std::string &s); + bool is_owner_dead(boost::uint32_t own); + void owner_to_filename(boost::uint32_t own, std::string &s); //The real mutex Mutex mtx; //The pid of the owner @@ -309,9 +309,9 @@ inline bool robust_spin_mutex::timed_lock } template -inline void robust_spin_mutex::owner_to_filename(boost::uint32_t owner, std::string &s) +inline void robust_spin_mutex::owner_to_filename(boost::uint32_t own, std::string &s) { - robust_emulation_helpers::create_and_get_robust_lock_file_path(s, owner); + robust_emulation_helpers::create_and_get_robust_lock_file_path(s, own); } template @@ -324,7 +324,7 @@ inline bool robust_spin_mutex::robust_check() return false; } atomic_write32(&this->state, fixing_state); - return true; + return true; } template @@ -349,16 +349,16 @@ inline bool robust_spin_mutex::check_if_owner_dead_and_take_ownership_ato } template -inline bool robust_spin_mutex::is_owner_dead(boost::uint32_t owner) +inline bool robust_spin_mutex::is_owner_dead(boost::uint32_t own) { //If owner is an invalid id, then it's clear it's dead - if(owner == (boost::uint32_t)get_invalid_process_id()){ + if(own == (boost::uint32_t)get_invalid_process_id()){ return true; } //Obtain the lock filename of the owner field std::string file; - this->owner_to_filename(owner, file); + this->owner_to_filename(own, file); //Now the logic is to open and lock it file_handle_t fhnd = open_existing_file(file.c_str(), read_write); @@ -424,7 +424,7 @@ template inline bool robust_spin_mutex::lock_own_unique_file() { //This function forces instantiation of the singleton - robust_emulation_helpers::robust_mutex_lock_file* dummy = + robust_emulation_helpers::robust_mutex_lock_file* dummy = &ipcdetail::intermodule_singleton ::get(); return dummy != 0; diff --git a/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp b/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp index ea820b388..83e5a05eb 100644 --- a/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/segment_manager_helper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -81,21 +81,18 @@ struct block_header unsigned char m_value_alignment; unsigned char m_alloc_type_sizeof_char; - block_header(size_type value_bytes - ,size_type value_alignment - ,unsigned char alloc_type - ,std::size_t sizeof_char + block_header(size_type val_bytes + ,size_type val_alignment + ,unsigned char al_type + ,std::size_t szof_char ,std::size_t num_char ) - : m_value_bytes(value_bytes) + : m_value_bytes(val_bytes) , m_num_char((unsigned short)num_char) - , m_value_alignment((unsigned char)value_alignment) - , m_alloc_type_sizeof_char - ( (alloc_type << 5u) | - ((unsigned char)sizeof_char & 0x1F) ) + , m_value_alignment((unsigned char)val_alignment) + , m_alloc_type_sizeof_char( (al_type << 5u) | ((unsigned char)szof_char & 0x1F) ) {}; - template block_header &operator= (const T& ) { return *this; } @@ -130,7 +127,7 @@ struct block_header template CharType *name() const - { + { return const_cast(reinterpret_cast (reinterpret_cast(this) + name_offset())); } @@ -139,7 +136,7 @@ struct block_header { return m_num_char; } size_type name_offset() const - { + { return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char())); } @@ -157,7 +154,7 @@ struct block_header bool less_comp(const block_header &b) const { return m_num_char < b.m_num_char || - (m_num_char < b.m_num_char && + (m_num_char < b.m_num_char && std::char_traits::compare (name(), b.name(), m_num_char) < 0); } @@ -175,10 +172,10 @@ struct block_header { return block_header_from_value(value, sizeof(T), ::boost::alignment_of::value); } static block_header *block_header_from_value(const void *value, std::size_t sz, std::size_t algn) - { - block_header * hdr = + { + block_header * hdr = const_cast - (reinterpret_cast(reinterpret_cast(value) - + (reinterpret_cast(reinterpret_cast(value) - get_rounded_size(sizeof(block_header), algn))); (void)sz; //Some sanity checks @@ -189,9 +186,9 @@ struct block_header template static block_header *from_first_header(Header *header) - { - block_header * hdr = - reinterpret_cast*>(reinterpret_cast(header) + + { + block_header * hdr = + reinterpret_cast*>(reinterpret_cast(header) + get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of >::value))); //Some sanity checks return hdr; @@ -199,9 +196,9 @@ struct block_header template static Header *to_first_header(block_header *bheader) - { - Header * hdr = - reinterpret_cast(reinterpret_cast(bheader) - + { + Header * hdr = + reinterpret_cast(reinterpret_cast(bheader) - get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of >::value))); //Some sanity checks return hdr; @@ -311,15 +308,15 @@ template class char_ptr_holder { public: - char_ptr_holder(const CharType *name) + char_ptr_holder(const CharType *name) : m_name(name) {} - char_ptr_holder(const anonymous_instance_t *) + char_ptr_holder(const anonymous_instance_t *) : m_name(static_cast(0)) {} - char_ptr_holder(const unique_instance_t *) + char_ptr_holder(const unique_instance_t *) : m_name(reinterpret_cast(-1)) {} @@ -330,7 +327,7 @@ class char_ptr_holder const CharType *m_name; }; -//!The key of the the named allocation information index. Stores an offset pointer +//!The key of the the named allocation information index. Stores an offset pointer //!to a null terminated string and the length of the string to speed up sorting template struct index_key @@ -350,15 +347,16 @@ struct index_key public: //!Constructor of the key - index_key (const char_type *name, size_type length) - : mp_str(name), m_len(length) {} + index_key (const char_type *nm, size_type length) + : mp_str(nm), m_len(length) + {} //!Less than function for index ordering bool operator < (const index_key & right) const { - return (m_len < right.m_len) || - (m_len == right.m_len && - std::char_traits::compare + return (m_len < right.m_len) || + (m_len == right.m_len && + std::char_traits::compare (to_raw_pointer(mp_str) ,to_raw_pointer(right.mp_str), m_len) < 0); } @@ -366,14 +364,14 @@ struct index_key //!Equal to function for index ordering bool operator == (const index_key & right) const { - return m_len == right.m_len && - std::char_traits::compare + return m_len == right.m_len && + std::char_traits::compare (to_raw_pointer(mp_str), to_raw_pointer(right.mp_str), m_len) == 0; } - void name(const CharT *name) - { mp_str = name; } + void name(const CharT *nm) + { mp_str = nm; } void name_length(size_type len) { m_len = len; } @@ -478,14 +476,14 @@ struct segment_manager_iterator_transform , segment_manager_iterator_value_adaptor > { typedef segment_manager_iterator_value_adaptor result_type; - + result_type operator()(const typename Iterator::value_type &arg) const { return result_type(arg); } }; } //namespace ipcdetail { -//These pointers are the ones the user will use to +//These pointers are the ones the user will use to //indicate previous allocation types static const ipcdetail::anonymous_instance_t * anonymous_instance = 0; static const ipcdetail::unique_instance_t * unique_instance = 0; diff --git a/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp b/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp index 38aafb2be..e4e867e3f 100644 --- a/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/tmp_dir_helpers.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -18,80 +18,87 @@ #include #include -#if defined(BOOST_INTERPROCESS_WINDOWS) - //#define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME - //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - //#include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) - //#include - //#if defined(CTL_KERN) && defined (KERN_BOOTTIME) - //#define BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME - //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - //#endif +#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) && defined(BOOST_INTERPROCESS_WINDOWS) + #include #endif namespace boost { namespace interprocess { namespace ipcdetail { -#if defined (BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) -inline void get_bootstamp(std::string &s, bool add = false) -{ - std::string bootstamp; - winapi::get_last_bootup_time(bootstamp); - if(add){ - s += bootstamp; - } - else{ - s.swap(bootstamp); - } -} -#elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME) -inline void get_bootstamp(std::string &s, bool add = false) -{ - // FreeBSD specific: sysctl "kern.boottime" - int request[2] = { CTL_KERN, KERN_BOOTTIME }; - struct ::timeval result; - std::size_t result_len = sizeof result; +#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + #if defined(BOOST_INTERPROCESS_WINDOWS) + //This type will initialize the stamp + struct windows_bootstamp + { + windows_bootstamp() + { + winapi::get_last_bootup_time(stamp); + } + //Use std::string. Even if this will be constructed in shared memory, all + //modules/dlls are from this process so internal raw pointers to heap are always valid + std::string stamp; + }; - if (::sysctl (request, 2, &result, &result_len, NULL, 0) < 0) - return; - - char bootstamp_str[256]; - - const char Characters [] = - { '0', '1', '2', '3', '4', '5', '6', '7' - , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - std::size_t char_counter = 0; - //32 bit values to allow 32 and 64 bit process IPC - boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) }; - for(std::size_t field = 0; field != 2; ++field){ - for(std::size_t i = 0; i != sizeof(fields[0]); ++i){ - const char *ptr = (const char *)&fields[field]; - bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4]; - bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)]; + inline void get_bootstamp(std::string &s, bool add = false) + { + const windows_bootstamp &bootstamp = windows_intermodule_singleton::get(); + if(add){ + s += bootstamp.stamp; + } + else{ + s = bootstamp.stamp; + } } - } - bootstamp_str[char_counter] = 0; - if(add){ - s += bootstamp_str; - } - else{ - s = bootstamp_str; - } -} -#endif + #elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME) + inline void get_bootstamp(std::string &s, bool add = false) + { + // FreeBSD specific: sysctl "kern.boottime" + int request[2] = { CTL_KERN, KERN_BOOTTIME }; + struct ::timeval result; + std::size_t result_len = sizeof result; + + if (::sysctl (request, 2, &result, &result_len, NULL, 0) < 0) + return; + + char bootstamp_str[256]; + + const char Characters [] = + { '0', '1', '2', '3', '4', '5', '6', '7' + , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + + std::size_t char_counter = 0; + //32 bit values to allow 32 and 64 bit process IPC + boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) }; + for(std::size_t field = 0; field != 2; ++field){ + for(std::size_t i = 0; i != sizeof(fields[0]); ++i){ + const char *ptr = (const char *)&fields[field]; + bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4]; + bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)]; + } + } + bootstamp_str[char_counter] = 0; + if(add){ + s += bootstamp_str; + } + else{ + s = bootstamp_str; + } + } + #else + #error "BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME defined with no known implementation" + #endif +#endif //#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) inline void get_tmp_base_dir(std::string &tmp_name) { #if defined (BOOST_INTERPROCESS_WINDOWS) - winapi::get_shared_documents_folder(tmp_name); - if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){ - tmp_name = get_temporary_path(); - } + winapi::get_shared_documents_folder(tmp_name); + if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){ + tmp_name = get_temporary_path(); + } #else - tmp_name = get_temporary_path(); + tmp_name = get_temporary_path(); #endif if(tmp_name.empty()){ error_info err = system_error_code(); @@ -104,9 +111,9 @@ inline void get_tmp_base_dir(std::string &tmp_name) inline void tmp_folder(std::string &tmp_name) { get_tmp_base_dir(tmp_name); - #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - tmp_name += "/"; - get_bootstamp(tmp_name, true); + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + tmp_name += "/"; + get_bootstamp(tmp_name, true); #endif } @@ -131,22 +138,22 @@ inline void create_tmp_and_clean_old(std::string &tmp_name) } } - #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - tmp_folder(tmp_name); + #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) + tmp_folder(tmp_name); - //If fails, check that it's because already exists - if(!create_directory(tmp_name.c_str())){ - error_info info(system_error_code()); - if(info.get_error_code() != already_exists_error){ - throw interprocess_exception(info); + //If fails, check that it's because already exists + if(!create_directory(tmp_name.c_str())){ + error_info info(system_error_code()); + if(info.get_error_code() != already_exists_error){ + throw interprocess_exception(info); + } } - } - //Now erase all old directories created in the previous boot sessions - std::string subdir = tmp_name; - subdir.erase(0, root_tmp_name.size()+1); - delete_subdirectories(root_tmp_name, subdir.c_str()); + //Now erase all old directories created in the previous boot sessions + std::string subdir = tmp_name; + subdir.erase(0, root_tmp_name.size()+1); + delete_subdirectories(root_tmp_name, subdir.c_str()); #else - tmp_name = root_tmp_name; + tmp_name = root_tmp_name; #endif } diff --git a/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp b/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp index ef646fbef..56bd0e56c 100644 --- a/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/transform_iterator.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -27,7 +27,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { template struct operator_arrow_proxy @@ -77,7 +77,7 @@ class transform_iterator {} //Constructors - transform_iterator& operator++() + transform_iterator& operator++() { increment(); return *this; } transform_iterator operator++(int) @@ -87,7 +87,7 @@ class transform_iterator return result; } - transform_iterator& operator--() + transform_iterator& operator--() { decrement(); return *this; } transform_iterator operator--(int) @@ -186,7 +186,7 @@ make_transform_iterator(Iterator it, UnaryFunc fun) return transform_iterator(it, fun); } -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp b/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp index 2cfa0be29..ade623f1e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/type_traits.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // (C) Copyright John Maddock 2000. -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ #include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { struct nat{}; @@ -117,6 +117,12 @@ struct remove_volatile typedef T type; }; +template +struct remove_const_volatile +{ + typedef typename remove_const::type>::type type; +}; + template struct is_same { @@ -136,8 +142,15 @@ struct is_same static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); }; +template +struct is_cv_same +{ + static const bool value = is_same< typename remove_const_volatile::type + , typename remove_const_volatile::type >::value; +}; + } // namespace ipcdetail -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/utilities.hpp b/project/jni/boost/include/boost/interprocess/detail/utilities.hpp index 625a9159d..3b486ddcf 100644 --- a/project/jni/boost/include/boost/interprocess/detail/utilities.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/utilities.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. +// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. @@ -31,11 +31,13 @@ #include #include #include +#include #include #include +#include namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -86,7 +88,10 @@ inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple) template struct ct_rounded_size { - static const std::size_t value = ((OrigSize-1)/RoundTo+1)*RoundTo; + BOOST_STATIC_ASSERT((RoundTo != 0)); + static const std::size_t intermediate_value = (OrigSize-1)/RoundTo+1; + BOOST_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo); + static const std::size_t value = intermediate_value*RoundTo; }; // Gennaro Prota wrote this. Thanks! @@ -133,14 +138,67 @@ addressof(T& v) &const_cast(reinterpret_cast(v))); } +template +struct sqrt_size_type_max +{ + static const SizeType value = (SizeType(1) << (sizeof(SizeType)*(CHAR_BIT/2)))-1; +}; + +template +inline bool multiplication_overflows(SizeType a, SizeType b) +{ + const SizeType sqrt_size_max = sqrt_size_type_max::value; + return //Fast runtime check + ( (a | b) > sqrt_size_max && + //Slow division check + b && a > SizeType(-1)/b + ); +} + +template +inline bool size_overflows(SizeType count) +{ + //Compile time-check + BOOST_STATIC_ASSERT(SztSizeOfType <= SizeType(-1)); + //Runtime check + return multiplication_overflows(SizeType(SztSizeOfType), count); +} + +template +class pointer_size_t_caster +{ + public: + explicit pointer_size_t_caster(std::size_t sz) + : m_ptr(reinterpret_cast(sz)) + {} + + explicit pointer_size_t_caster(RawPointer p) + : m_ptr(p) + {} + + std::size_t size() const + { return reinterpret_cast(m_ptr); } + + RawPointer pointer() const + { return m_ptr; } + + private: + RawPointer m_ptr; +}; + + +template +inline bool sum_overflows(SizeType a, SizeType b) +{ return SizeType(-1) - a < b; } + //Anti-exception node eraser template class value_eraser { public: - value_eraser(Cont & cont, typename Cont::iterator it) + value_eraser(Cont & cont, typename Cont::iterator it) : m_cont(cont), m_index_it(it), m_erase(true){} - ~value_eraser() + ~value_eraser() { if(m_erase) m_cont.erase(m_index_it); } void release() { m_erase = false; } @@ -151,7 +209,7 @@ class value_eraser bool m_erase; }; -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp b/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp index 1e6c4216e..5f2a94a31 100644 --- a/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/variadic_templates_tools.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -21,7 +21,7 @@ #include //std::size_t namespace boost { -namespace interprocess { +namespace interprocess { namespace ipcdetail { template @@ -136,7 +136,7 @@ struct index_tuple{}; template > struct build_number_seq; -template +template struct build_number_seq > : build_number_seq > {}; diff --git a/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp b/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp index b420c3d67..078eef10e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/win32_api.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -21,7 +21,7 @@ #include #include -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined (_MSC_VER) && (_MSC_VER >= 1200) # pragma once # pragma comment( lib, "advapi32.lib" ) # pragma comment( lib, "oleaut32.lib" ) @@ -46,9 +46,11 @@ namespace winapi { //Some used constants static const unsigned long infinite_time = 0xFFFFFFFF; static const unsigned long error_already_exists = 183L; +static const unsigned long error_invalid_handle = 6L; static const unsigned long error_sharing_violation = 32L; static const unsigned long error_file_not_found = 2u; static const unsigned long error_no_more_files = 18u; +static const unsigned long error_not_locked = 158L; //Retries in CreateFile, see http://support.microsoft.com/kb/316609 static const unsigned int error_sharing_violation_tries = 3u; static const unsigned int error_sharing_violation_sleep_ms = 250u; @@ -60,6 +62,7 @@ static const unsigned long mutex_all_access = (0x000F0000L)|(0x00100000L)|0x static const unsigned long page_readonly = 0x02; static const unsigned long page_readwrite = 0x04; static const unsigned long page_writecopy = 0x08; +static const unsigned long page_noaccess = 0x01; static const unsigned long standard_rights_required = 0x000F0000L; static const unsigned long section_query = 0x0001; @@ -137,7 +140,14 @@ static const unsigned long lang_neutral = (unsigned long)0x00; static const unsigned long sublang_default = (unsigned long)0x01; static const unsigned long invalid_file_size = (unsigned long)0xFFFFFFFF; static const unsigned long invalid_file_attributes = ((unsigned long)-1); -static void * const invalid_handle_value = (void*)(long)(-1); +static void * const invalid_handle_value = ((void*)(long)(-1)); + +static const unsigned long file_type_char = 0x0002L; +static const unsigned long file_type_disk = 0x0001L; +static const unsigned long file_type_pipe = 0x0003L; +static const unsigned long file_type_remote = 0x8000L; +static const unsigned long file_type_unknown = 0x0000L; + static const unsigned long create_new = 1; static const unsigned long create_always = 2; static const unsigned long open_existing = 3; @@ -159,7 +169,6 @@ static const long BootAndSystemstampLength = 16; static const long BootstampLength = 8; static const unsigned long MaxPath = 260; - //Keys static void * const hkey_local_machine = (void*)(unsigned long*)(long)(0x80000002); static unsigned long key_query_value = 0x0001; @@ -179,6 +188,27 @@ const signed long WBEM_INFINITE_BIPC = 0xffffffffL; const signed long RPC_E_TOO_LATE_BIPC = 0x80010119L; const signed long S_OK_BIPC = 0L; const signed long S_FALSE_BIPC = 1; +const signed long RPC_E_CHANGED_MODE_BIPC = 0x80010106L; +const unsigned long COINIT_APARTMENTTHREADED_BIPC = 0x2; +const unsigned long COINIT_MULTITHREADED_BIPC = 0x0; +const unsigned long COINIT_DISABLE_OLE1DDE_BIPC = 0x4; +const unsigned long COINIT_SPEED_OVER_MEMORY_BIPC = 0x4; + +//If the user needs to change default COM initialization model, +//it can define BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL to one of these: +// +// COINIT_APARTMENTTHREADED_BIPC +// COINIT_MULTITHREADED_BIPC +// COINIT_DISABLE_OLE1DDE_BIPC +// COINIT_SPEED_OVER_MEMORY_BIPC +#if !defined(BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL) + #define BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL COINIT_APARTMENTTHREADED_BIPC +#elif (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_APARTMENTTHREADED_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_MULTITHREADED_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_DISABLE_OLE1DDE_BIPC) &&\ + (BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL != COINIT_SPEED_OVER_MEMORY_BIPC) + #error "Wrong value for BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL macro" +#endif } //namespace winapi { } //namespace interprocess { @@ -211,161 +241,159 @@ struct wchar_variant } value; }; - struct IUnknown_BIPC - { - public: - virtual long __stdcall QueryInterface( - /* [in] */ const GUID_BIPC &riid, - /* [iid_is][out] */ void **ppvObject) = 0; - - virtual unsigned long __stdcall AddRef( void) = 0; - - virtual unsigned long __stdcall Release( void) = 0; - }; +struct IUnknown_BIPC +{ + public: + virtual long __stdcall QueryInterface( + const GUID_BIPC &riid, // [in] + void **ppvObject) = 0; // [iid_is][out] + + virtual unsigned long __stdcall AddRef (void) = 0; + virtual unsigned long __stdcall Release(void) = 0; +}; struct IWbemClassObject_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall GetQualifierSet( + virtual long __stdcall GetQualifierSet( /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall Get( + + virtual long __stdcall Get( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [unique][in][out] */ wchar_variant *pVal, /* [unique][in][out] */ long *pType, /* [unique][in][out] */ long *plFlavor) = 0; - - virtual long __stdcall Put( + + virtual long __stdcall Put( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pVal, /* [in] */ long Type) = 0; - - virtual long __stdcall Delete( + + virtual long __stdcall Delete( /* [string][in] */ const wchar_t * wszName) = 0; - - virtual long __stdcall GetNames( + + virtual long __stdcall GetNames( /* [string][in] */ const wchar_t * wszQualifierName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pQualifierVal, /* [out] */ void * *pNames) = 0; - - virtual long __stdcall BeginEnumeration( + + virtual long __stdcall BeginEnumeration( /* [in] */ long lEnumFlags) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lFlags, /* [unique][in][out] */ wchar_t * *strName, /* [unique][in][out] */ wchar_variant *pVal, /* [unique][in][out] */ long *pType, /* [unique][in][out] */ long *plFlavor) = 0; - + virtual long __stdcall EndEnumeration( void) = 0; - - virtual long __stdcall GetPropertyQualifierSet( + + virtual long __stdcall GetPropertyQualifierSet( /* [string][in] */ const wchar_t * wszProperty, /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall Clone( + + virtual long __stdcall Clone( /* [out] */ IWbemClassObject_BIPC **ppCopy) = 0; - - virtual long __stdcall GetObjectText( + + virtual long __stdcall GetObjectText( /* [in] */ long lFlags, /* [out] */ wchar_t * *pstrObjectText) = 0; - - virtual long __stdcall SpawnDerivedClass( + + virtual long __stdcall SpawnDerivedClass( /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppNewClass) = 0; - - virtual long __stdcall SpawnInstance( + + virtual long __stdcall SpawnInstance( /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppNewInstance) = 0; - - virtual long __stdcall CompareTo( + + virtual long __stdcall CompareTo( /* [in] */ long lFlags, /* [in] */ IWbemClassObject_BIPC *pCompareTo) = 0; - - virtual long __stdcall GetPropertyOrigin( + + virtual long __stdcall GetPropertyOrigin( /* [string][in] */ const wchar_t * wszName, /* [out] */ wchar_t * *pstrClassName) = 0; - - virtual long __stdcall InheritsFrom( + + virtual long __stdcall InheritsFrom( /* [in] */ const wchar_t * strAncestor) = 0; - - virtual long __stdcall GetMethod( + + virtual long __stdcall GetMethod( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [out] */ IWbemClassObject_BIPC **ppInSignature, /* [out] */ IWbemClassObject_BIPC **ppOutSignature) = 0; - - virtual long __stdcall PutMethod( + + virtual long __stdcall PutMethod( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ IWbemClassObject_BIPC *pInSignature, /* [in] */ IWbemClassObject_BIPC *pOutSignature) = 0; - - virtual long __stdcall DeleteMethod( + + virtual long __stdcall DeleteMethod( /* [string][in] */ const wchar_t * wszName) = 0; - - virtual long __stdcall BeginMethodEnumeration( + + virtual long __stdcall BeginMethodEnumeration( /* [in] */ long lEnumFlags) = 0; - - virtual long __stdcall NextMethod( + + virtual long __stdcall NextMethod( /* [in] */ long lFlags, /* [unique][in][out] */ wchar_t * *pstrName, /* [unique][in][out] */ IWbemClassObject_BIPC **ppInSignature, /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutSignature) = 0; - + virtual long __stdcall EndMethodEnumeration( void) = 0; - - virtual long __stdcall GetMethodQualifierSet( + + virtual long __stdcall GetMethodQualifierSet( /* [string][in] */ const wchar_t * wszMethod, /* [out] */ void **ppQualSet) = 0; - - virtual long __stdcall GetMethodOrigin( + + virtual long __stdcall GetMethodOrigin( /* [string][in] */ const wchar_t * wszMethodName, /* [out] */ wchar_t * *pstrClassName) = 0; - -}; +}; struct IWbemContext_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall Clone( + virtual long __stdcall Clone( /* [out] */ IWbemContext_BIPC **ppNewCopy) = 0; - - virtual long __stdcall GetNames( + + virtual long __stdcall GetNames( /* [in] */ long lFlags, /* [out] */ void * *pNames) = 0; - - virtual long __stdcall BeginEnumeration( + + virtual long __stdcall BeginEnumeration( /* [in] */ long lFlags) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lFlags, /* [out] */ wchar_t * *pstrName, /* [out] */ wchar_variant *pValue) = 0; - + virtual long __stdcall EndEnumeration( void) = 0; - - virtual long __stdcall SetValue( + + virtual long __stdcall SetValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [in] */ wchar_variant *pValue) = 0; - - virtual long __stdcall GetValue( + + virtual long __stdcall GetValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags, /* [out] */ wchar_variant *pValue) = 0; - - virtual long __stdcall DeleteValue( + + virtual long __stdcall DeleteValue( /* [string][in] */ const wchar_t * wszName, /* [in] */ long lFlags) = 0; - + virtual long __stdcall DeleteAll( void) = 0; - + }; @@ -373,157 +401,157 @@ struct IEnumWbemClassObject_BIPC : public IUnknown_BIPC { public: virtual long __stdcall Reset( void) = 0; - - virtual long __stdcall Next( + + virtual long __stdcall Next( /* [in] */ long lTimeout, /* [in] */ unsigned long uCount, /* [length_is][size_is][out] */ IWbemClassObject_BIPC **apObjects, /* [out] */ unsigned long *puReturned) = 0; - - virtual long __stdcall NextAsync( + + virtual long __stdcall NextAsync( /* [in] */ unsigned long uCount, /* [in] */ void *pSink) = 0; - - virtual long __stdcall Clone( + + virtual long __stdcall Clone( /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall Skip( + + virtual long __stdcall Skip( /* [in] */ long lTimeout, /* [in] */ unsigned long nCount) = 0; - + }; struct IWbemServices_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall OpenNamespace( + virtual long __stdcall OpenNamespace( /* [in] */ const wchar_t * strNamespace, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppWorkingNamespace, /* [unique][in][out] */ void **ppResult) = 0; - - virtual long __stdcall CancelAsyncCall( + + virtual long __stdcall CancelAsyncCall( /* [in] */ void *pSink) = 0; - - virtual long __stdcall QueryObjectSink( + + virtual long __stdcall QueryObjectSink( /* [in] */ long lFlags, /* [out] */ void **ppResponseHandler) = 0; - - virtual long __stdcall GetObject( + + virtual long __stdcall GetObject( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppObject, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall GetObjectAsync( + + virtual long __stdcall GetObjectAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall PutClass( + + virtual long __stdcall PutClass( /* [in] */ IWbemClassObject_BIPC *pObject, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall PutClassAsync( + + virtual long __stdcall PutClassAsync( /* [in] */ IWbemClassObject_BIPC *pObject, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall DeleteClass( + + virtual long __stdcall DeleteClass( /* [in] */ const wchar_t * strClass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall DeleteClassAsync( + + virtual long __stdcall DeleteClassAsync( /* [in] */ const wchar_t * strClass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall CreateClassEnum( + + virtual long __stdcall CreateClassEnum( /* [in] */ const wchar_t * strSuperclass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall CreateClassEnumAsync( + + virtual long __stdcall CreateClassEnumAsync( /* [in] */ const wchar_t * strSuperclass, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall PutInstance( + + virtual long __stdcall PutInstance( /* [in] */ void *pInst, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall PutInstanceAsync( + + virtual long __stdcall PutInstanceAsync( /* [in] */ void *pInst, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall DeleteInstance( + + virtual long __stdcall DeleteInstance( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall DeleteInstanceAsync( + + virtual long __stdcall DeleteInstanceAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall CreateInstanceEnum( + + virtual long __stdcall CreateInstanceEnum( /* [in] */ const wchar_t * strFilter, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall CreateInstanceEnumAsync( + + virtual long __stdcall CreateInstanceEnumAsync( /* [in] */ const wchar_t * strFilter, /* [in] */ long lFlags, /* [in] */ void *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecQuery( + + virtual long __stdcall ExecQuery( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [out] */ IEnumWbemClassObject_BIPC **ppEnum) = 0; - virtual long __stdcall ExecQueryAsync( + virtual long __stdcall ExecQueryAsync( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecNotificationQuery( + + virtual long __stdcall ExecNotificationQuery( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [out] */ void **ppEnum) = 0; - - virtual long __stdcall ExecNotificationQueryAsync( + + virtual long __stdcall ExecNotificationQueryAsync( /* [in] */ const wchar_t * strQueryLanguage, /* [in] */ const wchar_t * strQuery, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ void *pResponseHandler) = 0; - - virtual long __stdcall ExecMethod( + + virtual long __stdcall ExecMethod( /* [in] */ const wchar_t * strObjectPath, /* [in] */ const wchar_t * strMethodName, /* [in] */ long lFlags, @@ -531,21 +559,21 @@ public: /* [in] */ IWbemClassObject_BIPC *pInParams, /* [unique][in][out] */ IWbemClassObject_BIPC **ppOutParams, /* [unique][in][out] */ void **ppCallResult) = 0; - - virtual long __stdcall ExecMethodAsync( + + virtual long __stdcall ExecMethodAsync( /* [in] */ const wchar_t * strObjectPath, /* [in] */ const wchar_t * strMethodName, /* [in] */ long lFlags, /* [in] */ IWbemContext_BIPC *pCtx, /* [in] */ IWbemClassObject_BIPC *pInParams, /* [in] */ void *pResponseHandler) = 0; - + }; struct IWbemLocator_BIPC : public IUnknown_BIPC { public: - virtual long __stdcall ConnectServer( + virtual long __stdcall ConnectServer( /* [in] */ const wchar_t * strNetworkResource, /* [in] */ const wchar_t * strUser, /* [in] */ const wchar_t * strPassword, @@ -554,12 +582,10 @@ public: /* [in] */ const wchar_t * strAuthority, /* [in] */ void *pCtx, /* [out] */ IWbemServices_BIPC **ppNamespace) = 0; - + }; - - -struct interprocess_overlapped +struct interprocess_overlapped { unsigned long *internal; unsigned long *internal_high; @@ -574,9 +600,22 @@ struct interprocess_overlapped void *h_event; }; +struct interprocess_semaphore_basic_information +{ + unsigned int count; // current semaphore count + unsigned int limit; // max semaphore count +}; + +struct interprocess_section_basic_information +{ + void * base_address; + unsigned long section_attributes; + __int64 section_size; +}; + struct interprocess_filetime -{ - unsigned long dwLowDateTime; +{ + unsigned long dwLowDateTime; unsigned long dwHighDateTime; }; @@ -622,7 +661,7 @@ struct system_info { struct interprocess_memory_basic_information { - void * BaseAddress; + void * BaseAddress; void * AllocationBase; unsigned long AllocationProtect; unsigned long RegionSize; @@ -631,14 +670,14 @@ struct interprocess_memory_basic_information unsigned long Type; }; -typedef struct _interprocess_acl +struct interprocess_acl { unsigned char AclRevision; unsigned char Sbz1; unsigned short AclSize; unsigned short AceCount; unsigned short Sbz2; -} interprocess_acl; +}; typedef struct _interprocess_security_descriptor { @@ -695,6 +734,10 @@ enum file_information_class_t { file_maximum_information }; +enum semaphore_information_class { + semaphore_basic_information = 0 +}; + struct file_name_information_t { unsigned long FileNameLength; wchar_t FileName[1]; @@ -779,6 +822,12 @@ enum object_information_class object_data_information }; +enum section_information_class +{ + section_basic_information, + section_image_information +}; + struct object_name_information_t { unicode_string_t Name; @@ -803,6 +852,7 @@ extern "C" __declspec(dllimport) int __stdcall DuplicateHandle , void *hTargetProcessHandle, void **lpTargetHandle , unsigned long dwDesiredAccess, int bInheritHandle , unsigned long dwOptions); +extern "C" __declspec(dllimport) long __stdcall GetFileType(void *hFile); extern "C" __declspec(dllimport) void *__stdcall FindFirstFileA(const char *lpFileName, win32_find_data_t *lpFindFileData); extern "C" __declspec(dllimport) int __stdcall FindNextFileA(void *hFindFile, win32_find_data_t *lpFindFileData); extern "C" __declspec(dllimport) int __stdcall FindClose(void *hFindFile); @@ -824,11 +874,13 @@ extern "C" __declspec(dllimport) int __stdcall DeleteFileA (const char *); extern "C" __declspec(dllimport) int __stdcall MoveFileExA (const char *, const char *, unsigned long); extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::size_t); +extern "C" __declspec(dllimport) int __stdcall VirtualUnlock (void *, std::size_t); +extern "C" __declspec(dllimport) int __stdcall VirtualProtect (void *, std::size_t, unsigned long, unsigned long *); extern "C" __declspec(dllimport) int __stdcall FlushFileBuffers (void *); extern "C" __declspec(dllimport) int __stdcall GetFileSizeEx (void *, __int64 *size); extern "C" __declspec(dllimport) unsigned long __stdcall FormatMessageA - (unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId, - unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize, + (unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId, + unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize, std::va_list *Arguments); extern "C" __declspec(dllimport) void *__stdcall LocalFree (void *); extern "C" __declspec(dllimport) unsigned long __stdcall GetFileAttributesA(const char *); @@ -844,6 +896,7 @@ extern "C" __declspec(dllimport) int __stdcall UnlockFile(void *hnd, unsigned lo extern "C" __declspec(dllimport) int __stdcall LockFileEx(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall UnlockFileEx(void *hnd, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall WriteFile(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped); +extern "C" __declspec(dllimport) int __stdcall ReadFile(void *hnd, void *buffer, unsigned long bytes_to_read, unsigned long *bytes_read, interprocess_overlapped* overlapped); extern "C" __declspec(dllimport) int __stdcall InitializeSecurityDescriptor(interprocess_security_descriptor *pSecurityDescriptor, unsigned long dwRevision); extern "C" __declspec(dllimport) int __stdcall SetSecurityDescriptorDacl(interprocess_security_descriptor *pSecurityDescriptor, int bDaclPresent, interprocess_acl *pDacl, int bDaclDefaulted); extern "C" __declspec(dllimport) void *__stdcall LoadLibraryA(const char *); @@ -858,17 +911,17 @@ extern "C" __declspec(dllimport) long __stdcall RegCloseKey(void *); extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(__int64 *lpPerformanceCount); //COM API -extern "C" __declspec(dllimport) long __stdcall CoInitialize(void *pvReserved); +extern "C" __declspec(dllimport) long __stdcall CoInitializeEx(void *pvReserved, unsigned long dwCoInit); extern "C" __declspec(dllimport) long __stdcall CoInitializeSecurity( - void* pSecDesc, - long cAuthSvc, - void *asAuthSvc, - void *pReserved1, - unsigned long dwAuthnLevel, - unsigned long dwImpLevel, - void *pAuthList, - unsigned long dwCapabilities, - void *pReserved3 ); + void* pSecDesc, + long cAuthSvc, + void * asAuthSvc, + void *pReserved1, + unsigned long dwAuthnLevel, + unsigned long dwImpLevel, + void *pAuthList, + unsigned long dwCapabilities, + void *pReserved3 ); extern "C" __declspec(dllimport) long __stdcall CoSetProxyBlanket( IUnknown_BIPC *pProxy, @@ -889,10 +942,12 @@ extern "C" __declspec(dllimport) void __stdcall CoUninitialize(void); //API function typedefs //Pointer to functions -typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); -typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass ); -typedef long (__stdcall * NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *); -typedef long (__stdcall * NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *); +typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); +typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass ); +typedef long (__stdcall *NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *); +typedef long (__stdcall *NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *); +typedef long (__stdcall *NtQuerySemaphore_t)(void*, unsigned int info_class, interprocess_semaphore_basic_information *pinfo, unsigned int info_size, unsigned int *ret_len); +typedef long (__stdcall *NtQuerySection_t)(void*, section_information_class, interprocess_section_basic_information *pinfo, unsigned long info_size, unsigned long *ret_len); typedef long (__stdcall *NtQueryInformationFile_t)(void *,io_status_block_t *,void *, long, int); typedef long (__stdcall *NtOpenFile_t)(void*,unsigned long ,object_attributes_t*,io_status_block_t*,unsigned long,unsigned long); typedef long (__stdcall *NtClose_t) (void*); @@ -977,6 +1032,12 @@ inline bool duplicate_current_process_handle , lpTargetHandle, 0, 0 , duplicate_same_access); } + +inline unsigned long get_file_type(void *hFile) +{ + return GetFileType(hFile); +} + /* inline void get_system_time_as_file_time(interprocess_filetime *filetime) { GetSystemTimeAsFileTime(filetime); } @@ -1000,13 +1061,16 @@ inline int unmap_view_of_file(void *address) inline void *open_or_create_semaphore(const char *name, long initial_count, long maximum_count, interprocess_security_attributes *attr) { return CreateSemaphoreA(attr, initial_count, maximum_count, name); } +inline void *open_semaphore(const char *name) +{ return OpenSemaphoreA(semaphore_all_access, 0, name); } + inline int release_semaphore(void *handle, long release_count, long *prev_count) { return ReleaseSemaphore(handle, release_count, prev_count); } class interprocess_all_access_security { interprocess_security_attributes sa; - interprocess_security_descriptor sd; + interprocess_security_descriptor sd; bool initialized; public: @@ -1027,16 +1091,21 @@ class interprocess_all_access_security { return &sa; } }; -inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name, interprocess_security_attributes *psec) +inline void * create_file_mapping (void * handle, unsigned long access, unsigned __int64 file_offset, const char * name, interprocess_security_attributes *psec) { - return CreateFileMappingA (handle, psec, access, high_size, low_size, name); + const unsigned long high_size(file_offset >> 32), low_size((boost::uint32_t)file_offset); + return CreateFileMappingA (handle, psec, access, high_size, low_size, name); } inline void * open_file_mapping (unsigned long access, const char *name) { return OpenFileMappingA (access, 0, name); } -inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned long highoffset, unsigned long lowoffset, std::size_t numbytes, void *base_addr) -{ return MapViewOfFileEx(handle, file_access, highoffset, lowoffset, numbytes, base_addr); } +inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned __int64 offset, std::size_t numbytes, void *base_addr) +{ + const unsigned long offset_low = (unsigned long)(offset & ((unsigned __int64)0xFFFFFFFF)); + const unsigned long offset_high = offset >> 32; + return MapViewOfFileEx(handle, file_access, offset_high, offset_low, numbytes, base_addr); +} inline void *create_file(const char *name, unsigned long access, unsigned long creation_flags, unsigned long attributes, interprocess_security_attributes *psec) { @@ -1051,7 +1120,7 @@ inline void *create_file(const char *name, unsigned long access, unsigned long c if (error_sharing_violation != get_last_error()){ return handle; } - Sleep(error_sharing_violation_sleep_ms); + sleep(error_sharing_violation_sleep_ms); } return invalid_handle_value; } @@ -1068,6 +1137,12 @@ inline void get_system_info(system_info *info) inline bool flush_view_of_file(void *base_addr, std::size_t numbytes) { return 0 != FlushViewOfFile(base_addr, numbytes); } +inline bool virtual_unlock(void *base_addr, std::size_t numbytes) +{ return 0 != VirtualUnlock(base_addr, numbytes); } + +inline bool virtual_protect(void *base_addr, std::size_t numbytes, unsigned long flNewProtect, unsigned long &lpflOldProtect) +{ return 0 != VirtualProtect(base_addr, numbytes, flNewProtect, &lpflOldProtect); } + inline bool flush_file_buffers(void *handle) { return 0 != FlushFileBuffers(handle); } @@ -1075,9 +1150,9 @@ inline bool get_file_size(void *handle, __int64 &size) { return 0 != GetFileSizeEx(handle, &size); } inline bool create_directory(const char *name) -{ +{ interprocess_all_access_security sec; - return 0 != CreateDirectoryA(name, sec.get_attributes()); + return 0 != CreateDirectoryA(name, sec.get_attributes()); } inline bool remove_directory(const char *lpPathName) @@ -1101,6 +1176,9 @@ inline bool unlock_file_ex(void *hnd, unsigned long reserved, unsigned long size inline bool write_file(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped) { return 0 != WriteFile(hnd, buffer, bytes_to_write, bytes_written, overlapped); } +inline bool read_file(void *hnd, void *buffer, unsigned long bytes_to_read, unsigned long *bytes_read, interprocess_overlapped* overlapped) +{ return 0 != ReadFile(hnd, buffer, bytes_to_read, bytes_read, overlapped); } + inline bool get_file_information_by_handle(void *hnd, interprocess_by_handle_file_information *info) { return 0 != GetFileInformationByHandle(hnd, info); } @@ -1176,7 +1254,7 @@ inline void rtl_init_empty_unicode_string(unicode_string_t *ucStr, wchar_t *buf, template struct function_address_holder { - enum { NtSetInformationFile, NtQuerySystemInformation, NtQueryObject, NumFunction }; + enum { NtSetInformationFile, NtQuerySystemInformation, NtQueryObject, NtQuerySemaphore, NtQuerySection, NumFunction }; enum { NtDll_dll, NumModule }; private: @@ -1213,7 +1291,7 @@ struct function_address_holder static void *get_address_from_dll(const unsigned int id) { assert(id < (unsigned int)NumFunction); - const char *function[] = { "NtSetInformationFile", "NtQuerySystemInformation", "NtQueryObject" }; + const char *function[] = { "NtSetInformationFile", "NtQuerySystemInformation", "NtQueryObject", "NtQuerySemaphore", "NtQuerySection" }; bool compile_check[sizeof(function)/sizeof(function[0]) == NumFunction]; (void)compile_check; return get_proc_address(get_module(NtDll_dll), function[id]); @@ -1264,7 +1342,7 @@ struct library_unloader //pszFilename must have room for at least MaxPath+1 characters inline bool get_file_name_from_handle_function - (void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &out_length) + (void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &out_length) { if(length <= MaxPath){ return false; @@ -1285,17 +1363,17 @@ inline bool get_file_name_from_handle_function bool bSuccess = false; // Create a file mapping object. - void * hFileMap = create_file_mapping(hFile, page_readonly, 0, 1, 0, 0); + void * hFileMap = create_file_mapping(hFile, page_readonly, 1, 0, 0); if(hFileMap){ // Create a file mapping to get the file name. - void* pMem = map_view_of_file_ex(hFileMap, file_map_read, 0, 0, 1, 0); + void* pMem = map_view_of_file_ex(hFileMap, file_map_read, 0, 1, 0); if (pMem){ //out_length = pfGMFN(get_current_process(), pMem, pszFilename, MaxPath); out_length = get_mapped_file_name(get_current_process(), pMem, pszFilename, MaxPath); if(out_length){ bSuccess = true; - } + } unmap_view_of_file(pMem); } close_handle(hFileMap); @@ -1307,7 +1385,6 @@ inline bool get_file_name_from_handle_function inline bool get_system_time_of_day_information(system_timeofday_information &info) { NtQuerySystemInformation_t pNtQuerySystemInformation = (NtQuerySystemInformation_t) - //get_proc_address(get_module_handle("ntdll.dll"), "NtQuerySystemInformation"); dll_func::get(dll_func::NtQuerySystemInformation); unsigned long res; long status = pNtQuerySystemInformation(system_time_of_day_information, &info, sizeof(info), &res); @@ -1384,9 +1461,12 @@ inline bool get_boot_and_system_time_wstr(wchar_t *bootsystemstamp, std::size_t class handle_closer { void *handle_; + handle_closer(const handle_closer &); + handle_closer& operator=(const handle_closer &); public: - handle_closer(void *handle) : handle_(handle){} - ~handle_closer(){ close_handle(handle_); } + explicit handle_closer(void *handle) : handle_(handle){} + ~handle_closer() + { close_handle(handle_); } }; union ntquery_mem_t @@ -1401,81 +1481,92 @@ union ntquery_mem_t inline bool unlink_file(const char *filename) { - if(!delete_file(filename)){ - try{ - NtSetInformationFile_t pNtSetInformationFile = - //(NtSetInformationFile_t)get_proc_address(get_module_handle("ntdll.dll"), "NtSetInformationFile"); - (NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile); - if(!pNtSetInformationFile){ - return false; - } + //Don't try to optimize doing a DeleteFile first + //as there are interactions with permissions and + //in-use files. + // + //if(!delete_file(filename)){ + // (...) + // - NtQueryObject_t pNtQueryObject = - //(NtQueryObject_t)get_proc_address(get_module_handle("ntdll.dll"), "NtQueryObject"); - (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject); - - //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths - void *fh = create_file(filename, generic_read | delete_access, open_existing, - file_flag_backup_semantics | file_flag_delete_on_close, 0); - if(fh == invalid_handle_value){ - return false; - } - - handle_closer h_closer(fh); - - std::auto_ptr pmem(new ntquery_mem_t); - file_rename_information_t *pfri = &pmem->ren.info; - const std::size_t RenMaxNumChars = - ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t); - - //Obtain file name - unsigned long size; - if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){ - return false; - } - - //Copy filename to the rename member - std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length); - std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t); - - //Second step: obtain the complete native-nt filename - //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){ - //return 0; - //} - - //Add trailing mark - if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){ - return false; - } - - //Search '\\' character to replace it - for(std::size_t i = filename_string_length; i != 0; --filename_string_length){ - if(pmem->ren.info.FileName[--i] == L'\\') - break; - } - - //Add random number - std::size_t s = RenMaxNumChars - filename_string_length; - if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){ - return false; - } - filename_string_length += s; - - //Fill rename information (FileNameLength is in bytes) - pfri->FileNameLength = static_cast(sizeof(wchar_t)*(filename_string_length)); - pfri->Replace = 1; - pfri->RootDir = 0; - - //Final step: change the name of the in-use file: - io_status_block_t io; - if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){ - return false; - } - return true; - } - catch(...){ + //This functions tries to emulate UNIX unlink semantics in windows. + // + //- Open the file and mark the handle as delete-on-close + //- Rename the file to an arbitrary name based on a random number + //- Close the handle. If there are no file users, it will be deleted. + // Otherwise it will be used by already connected handles but the + // file name can't be used to open this file again + try{ + NtSetInformationFile_t pNtSetInformationFile = + (NtSetInformationFile_t)dll_func::get(dll_func::NtSetInformationFile); + if(!pNtSetInformationFile){ return false; } + + NtQueryObject_t pNtQueryObject = + (NtQueryObject_t)dll_func::get(dll_func::NtQueryObject); + + //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths + void *fh = create_file(filename, generic_read | delete_access, open_existing, + file_flag_backup_semantics | file_flag_delete_on_close, 0); + if(fh == invalid_handle_value){ + return false; + } + + handle_closer h_closer(fh); + + std::auto_ptr pmem(new ntquery_mem_t); + file_rename_information_t *pfri = &pmem->ren.info; + const std::size_t RenMaxNumChars = + ((char*)pmem.get() - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t); + + //Obtain file name + unsigned long size; + if(pNtQueryObject(fh, object_name_information, pmem.get(), sizeof(ntquery_mem_t), &size)){ + return false; + } + + //Copy filename to the rename member + std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length); + std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t); + + //Second step: obtain the complete native-nt filename + //if(!get_file_name_from_handle_function(fh, pfri->FileName, RenMaxNumChars, filename_string_length)){ + //return 0; + //} + + //Add trailing mark + if((RenMaxNumChars-filename_string_length) < (SystemTimeOfDayInfoLength*2)){ + return false; + } + + //Search '\\' character to replace it + for(std::size_t i = filename_string_length; i != 0; --filename_string_length){ + if(pmem->ren.info.FileName[--i] == L'\\') + break; + } + + //Add random number + std::size_t s = RenMaxNumChars - filename_string_length; + if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){ + return false; + } + filename_string_length += s; + + //Fill rename information (FileNameLength is in bytes) + pfri->FileNameLength = static_cast(sizeof(wchar_t)*(filename_string_length)); + pfri->Replace = 1; + pfri->RootDir = 0; + + //Final step: change the name of the in-use file: + io_status_block_t io; + if(0 != pNtSetInformationFile(fh, &io, pfri, sizeof(ntquery_mem_t::ren_t), file_rename_information)){ + return false; + } + return true; + } + catch(...){ + return false; } return true; } @@ -1493,116 +1584,77 @@ struct reg_closer inline void get_shared_documents_folder(std::string &s) { s.clear(); - //void *hAdvapi = load_library("Advapi32.dll"); - //if (hAdvapi){ - //library_unloader unloader(hAdvapi); - // Pointer to function RegOpenKeyA - //RegOpenKeyEx_t pRegOpenKey = - //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA"); - //if (pRegOpenKey){ - // Pointer to function RegCloseKey - //RegCloseKey_t pRegCloseKey = - //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey"); - //if (pRegCloseKey){ - // Pointer to function RegQueryValueA - //RegQueryValueEx_t pRegQueryValue = - //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA"); - //if (pRegQueryValue){ - //Open the key - void *key; - //if ((*pRegOpenKey)( hkey_local_machine - //, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - //, 0 - //, key_query_value - //, &key) == 0){ - //reg_closer key_closer(pRegCloseKey, key); - if (reg_open_key_ex( hkey_local_machine - , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); + void *key; + if (reg_open_key_ex( hkey_local_machine + , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" + , 0 + , key_query_value + , &key) == 0){ + reg_closer key_closer(key); - //Obtain the value - unsigned long size; - unsigned long type; - const char *const reg_value = "Common AppData"; - //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); - long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); - if(!err){ - //Size includes terminating NULL - s.resize(size); - //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err) - s.erase(s.end()-1); - (void)err; - } - } - //} - //} - //} - //} + //Obtain the value + unsigned long size; + unsigned long type; + const char *const reg_value = "Common AppData"; + //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); + long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); + if(!err){ + //Size includes terminating NULL + s.resize(size); + //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + if(!err) + s.erase(s.end()-1); + (void)err; + } + } } - inline void get_registry_value(const char *folder, const char *value_key, std::vector &s) { s.clear(); - //void *hAdvapi = load_library("Advapi32.dll"); - //if (hAdvapi){ - //library_unloader unloader(hAdvapi); - // Pointer to function RegOpenKeyA - //RegOpenKeyEx_t pRegOpenKey = - //(RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA"); - //if (pRegOpenKey){ - // Pointer to function RegCloseKey - //RegCloseKey_t pRegCloseKey = - //(RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey"); - //if (pRegCloseKey){ - // Pointer to function RegQueryValueA - //RegQueryValueEx_t pRegQueryValue = - //(RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA"); - //if (pRegQueryValue){ - //Open the key - void *key; - //if ((*pRegOpenKey)( hkey_local_machine - //, folder - //, 0 - //, key_query_value - //, &key) == 0){ - //reg_closer key_closer(pRegCloseKey, key); - if (reg_open_key_ex( hkey_local_machine - , folder - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); + void *key; + if (reg_open_key_ex( hkey_local_machine + , folder + , 0 + , key_query_value + , &key) == 0){ + reg_closer key_closer(key); - //Obtain the value - unsigned long size; - unsigned long type; - const char *const reg_value = value_key; - //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); - long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); - if(!err){ - //Size includes terminating NULL - s.resize(size); - //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err) - s.erase(s.end()-1); - (void)err; - } - } - //} - //} - //} - //} + //Obtain the value + unsigned long size; + unsigned long type; + const char *const reg_value = value_key; + //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); + long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); + if(!err){ + //Size includes terminating NULL + s.resize(size); + //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + if(!err) + s.erase(s.end()-1); + (void)err; + } + } } struct co_uninitializer -{ ~co_uninitializer() { CoUninitialize(); } }; +{ + co_uninitializer(bool b_uninitialize) + : m_b_uninitialize(b_uninitialize) + {} + + ~co_uninitializer() + { + if(m_b_uninitialize){ + CoUninitialize(); + } + } + + private: + const bool m_b_uninitialize; +}; template struct com_releaser @@ -1615,29 +1667,32 @@ struct com_releaser inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_class, const wchar_t *wmi_class_var) { //See example http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx - long co_init_ret = CoInitialize(0); - if(co_init_ret != S_OK_BIPC && co_init_ret != S_FALSE_BIPC) + // + //See BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL definition if you need to change the + //default value of this macro in your application + long co_init_ret = CoInitializeEx(0, BOOST_INTERPROCESS_WINDOWS_COINIT_MODEL); + if(co_init_ret != S_OK_BIPC && co_init_ret != S_FALSE_BIPC && co_init_ret != RPC_E_CHANGED_MODE_BIPC) return false; - co_uninitializer co_initialize_end; + co_uninitializer co_initialize_end(co_init_ret != RPC_E_CHANGED_MODE_BIPC); (void)co_initialize_end; bool bRet = false; long sec_init_ret = CoInitializeSecurity - ( 0 //pVoid - ,-1 //cAuthSvc - , 0 //asAuthSvc - , 0 //pReserved1 - , RPC_C_AUTHN_LEVEL_PKT_BIPC //dwAuthnLevel - , RPC_C_IMP_LEVEL_IMPERSONATE_BIPC //dwImpLevel - , 0 //pAuthList - , EOAC_NONE_BIPC //dwCapabilities - , 0 //pReserved3 + ( 0 //pVoid + ,-1 //cAuthSvc + , 0 //asAuthSvc + , 0 //pReserved1 + , RPC_C_AUTHN_LEVEL_PKT_BIPC //dwAuthnLevel + , RPC_C_IMP_LEVEL_IMPERSONATE_BIPC //dwImpLevel + , 0 //pAuthList + , EOAC_NONE_BIPC //dwCapabilities + , 0 //pReserved3 ); if( 0 == sec_init_ret || RPC_E_TOO_LATE_BIPC == sec_init_ret) { IWbemLocator_BIPC * pIWbemLocator = 0; const wchar_t * bstrNamespace = L"root\\cimv2"; - + if( 0 != CoCreateInstance( CLSID_WbemAdministrativeLocator, 0, @@ -1645,7 +1700,7 @@ inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_ IID_IUnknown, (void **)&pIWbemLocator)){ return false; } - + com_releaser IWbemLocator_releaser(pIWbemLocator); IWbemServices_BIPC *pWbemServices = 0; @@ -1677,7 +1732,7 @@ inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_ ){ return false; } - + com_releaser IWbemServices_releaser(pWbemServices); strValue.clear(); @@ -1757,9 +1812,40 @@ inline bool is_directory(const char *path) (attrib & file_attribute_directory)); } -} //namespace winapi +inline bool get_file_mapping_size(void *file_mapping_hnd, __int64 &size) +{ + NtQuerySection_t pNtQuerySection = + (NtQuerySection_t)dll_func::get(dll_func::NtQuerySection); + //Obtain file name + interprocess_section_basic_information info; + unsigned long ntstatus = + pNtQuerySection(file_mapping_hnd, section_basic_information, &info, sizeof(info), 0); + if(ntstatus){ + return false; + } + size = info.section_size; + return true; +} + +inline bool get_semaphore_info(void *handle, long &count, long &limit) +{ + winapi::interprocess_semaphore_basic_information info; + winapi::NtQuerySemaphore_t pNtQuerySemaphore = + (winapi::NtQuerySemaphore_t)dll_func::get(winapi::dll_func::NtQuerySemaphore); + unsigned int ret_len; + long status = pNtQuerySemaphore(handle, winapi::semaphore_basic_information, &info, sizeof(info), &ret_len); + if(status){ + return false; + } + count = info.count; + limit = info.limit; + return true; +} + + +} //namespace winapi } //namespace interprocess -} //namespace boost +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp b/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp new file mode 100644 index 000000000..194e566aa --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/detail/windows_intermodule_singleton.hpp @@ -0,0 +1,306 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP +#define BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include + +#if !defined(BOOST_INTERPROCESS_WINDOWS) + #error "This header can't be included from non-windows operating systems" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace ipcdetail{ + +namespace intermodule_singleton_helpers { + +//This global map will be implemented using 3 sync primitives: +// +//1) A named mutex that will implement global mutual exclusion between +// threads from different modules/dlls +// +//2) A semaphore that will act as a global counter for modules attached to the global map +// so that the global map can be destroyed when the last module is detached. +// +//3) A semaphore that will be hacked to hold the address of a heap-allocated map in the +// max and current semaphore count. +class windows_semaphore_based_map +{ + typedef std::map map_type; + + public: + windows_semaphore_based_map() + { + map_type *m = new map_type; + boost::uint32_t initial_count = 0; + boost::uint32_t max_count = 0; + + //Windows user address space sizes: + //32 bit windows: [32 bit processes] 2GB or 3GB (31/32 bits) + //64 bit windows: [32 bit processes] 2GB or 4GB (31/32 bits) + // [64 bit processes] 2GB or 8TB (31/43 bits) + // + //Windows semaphores use 'long' parameters (32 bits in LLP64 data model) and + //those values can't be negative, so we have 31 bits to store something + //in max_count and initial count parameters. + //Also, max count must be bigger than 0 and bigger or equal than initial count. + if(sizeof(void*) == sizeof(boost::uint32_t)){ + //This means that for 32 bit processes, a semaphore count (31 usable bits) is + //enough to store 4 byte aligned memory (4GB -> 32 bits - 2 bits = 30 bits). + //The max count will hold the pointer value and current semaphore count + //will be zero. + // + //Relying in UB with a cast through union, but all known windows compilers + //accept this (C11 also accepts this). + union caster_union + { + void *addr; + boost::uint32_t addr_uint32; + } caster; + caster.addr = m; + //memory is at least 4 byte aligned in windows + BOOST_ASSERT((caster.addr_uint32 & boost::uint32_t(3)) == 0); + max_count = caster.addr_uint32 >> 2; + } + else if(sizeof(void*) == sizeof(boost::uint64_t)){ + //Relying in UB with a cast through union, but all known windows compilers + //accept this (C11 accepts this). + union caster_union + { + void *addr; + boost::uint64_t addr_uint64; + } caster; + caster.addr = m; + //We'll encode the address using 30 bits in each 32 bit high and low parts. + //High part will be the sem max count, low part will be the sem initial count. + //(restrictions: max count > 0, initial count >= 0 and max count >= initial count): + // + // - Low part will be shifted two times (4 byte alignment) so that top + // two bits are cleared (the top one for sign, the next one to + // assure low part value is always less than the high part value. + // - The top bit of the high part will be cleared and the next bit will be 1 + // (so high part is always bigger than low part due to the quasi-top bit). + // + // This means that the addresses we can store must be 4 byte aligned + // and less than 1 ExbiBytes ( 2^60 bytes, ~1 ExaByte). User-level address space in Windows 64 + // is much less than this (8TB, 2^43 bytes): "1 EByte (or it was 640K?) ought to be enough for anybody" ;-). + caster.addr = m; + BOOST_ASSERT((caster.addr_uint64 & boost::uint64_t(3)) == 0); + max_count = boost::uint32_t(caster.addr_uint64 >> 32); + initial_count = boost::uint32_t(caster.addr_uint64); + initial_count = initial_count/4; + //Make sure top two bits are zero + BOOST_ASSERT((max_count & boost::uint32_t(0xC0000000)) == 0); + //Set quasi-top bit + max_count |= boost::uint32_t(0x40000000); + } + bool created = false; + const permissions & perm = permissions(); + std::string pid_creation_time, name; + get_pid_creation_time_str(pid_creation_time); + name = "bipc_gmap_sem_lock_"; + name += pid_creation_time; + bool success = m_mtx_lock.open_or_create(name.c_str(), perm); + name = "bipc_gmap_sem_count_"; + name += pid_creation_time; + scoped_lock lck(m_mtx_lock); + { + success = success && m_sem_count.open_or_create + ( name.c_str(), static_cast(0), winapi_semaphore_wrapper::MaxCount, perm, created); + name = "bipc_gmap_sem_map_"; + name += pid_creation_time; + success = success && m_sem_map.open_or_create + (name.c_str(), initial_count, max_count, perm, created); + if(!success){ + //winapi_xxx wrappers do the cleanup... + throw int(0); + } + if(!created){ + delete m; + } + else{ + BOOST_ASSERT(&get_map_unlocked() == m); + } + m_sem_count.post(); + } + } + + map_type &get_map_unlocked() + { + if(sizeof(void*) == sizeof(boost::uint32_t)){ + union caster_union + { + void *addr; + boost::uint32_t addr_uint32; + } caster; + caster.addr = 0; + caster.addr_uint32 = m_sem_map.limit(); + caster.addr_uint32 = caster.addr_uint32 << 2; + return *static_cast(caster.addr); + } + else{ + union caster_union + { + void *addr; + boost::uint64_t addr_uint64; + } caster; + boost::uint32_t max_count(m_sem_map.limit()), initial_count(m_sem_map.value()); + //Clear quasi-top bit + max_count &= boost::uint32_t(0xBFFFFFFF); + caster.addr_uint64 = max_count; + caster.addr_uint64 = caster.addr_uint64 << 32; + caster.addr_uint64 |= boost::uint64_t(initial_count) << 2; + return *static_cast(caster.addr); + } + } + + ref_count_ptr *find(const char *name) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + map_type::iterator it = map.find(std::string(name)); + if(it != map.end()){ + return &it->second; + } + else{ + return 0; + } + } + + ref_count_ptr * insert(const char *name, const ref_count_ptr &ref) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + map_type::iterator it = map.insert(map_type::value_type(std::string(name), ref)).first; + return &it->second; + } + + bool erase(const char *name) + { + scoped_lock lck(m_mtx_lock); + map_type &map = this->get_map_unlocked(); + return map.erase(std::string(name)) != 0; + } + + template + void atomic_func(F &f) + { + scoped_lock lck(m_mtx_lock); + f(); + } + + ~windows_semaphore_based_map() + { + scoped_lock lck(m_mtx_lock); + m_sem_count.wait(); + if(0 == m_sem_count.value()){ + delete &this->get_map_unlocked(); + } + //First close sems to protect this with the external mutex + m_sem_map.close(); + m_sem_count.close(); + //Once scoped_lock unlocks the mutex, the destructor will close the handle... + } + + private: + winapi_mutex_wrapper m_mtx_lock; + winapi_semaphore_wrapper m_sem_map; + winapi_semaphore_wrapper m_sem_count; +}; + +template<> +struct thread_safe_global_map_dependant +{ + static void apply_gmem_erase_logic(const char *, const char *){} + + static bool remove_old_gmem() + { return true; } + + struct lock_file_logic + { + lock_file_logic(windows_semaphore_based_map &) + : retry_with_new_map(false) + {} + + void operator()(void){} + bool retry() const { return retry_with_new_map; } + private: + const bool retry_with_new_map; + }; + + static void construct_map(void *addr) + { + ::new (addr)windows_semaphore_based_map; + } + + struct unlink_map_logic + { + unlink_map_logic(windows_semaphore_based_map &) + {} + void operator()(){} + }; + + static ref_count_ptr *find(windows_semaphore_based_map &map, const char *name) + { + return map.find(name); + } + + static ref_count_ptr * insert(windows_semaphore_based_map &map, const char *name, const ref_count_ptr &ref) + { + return map.insert(name, ref); + } + + static bool erase(windows_semaphore_based_map &map, const char *name) + { + return map.erase(name); + } + + template + static void atomic_func(windows_semaphore_based_map &map, F &f) + { + map.atomic_func(f); + } +}; + +} //namespace intermodule_singleton_helpers { + +template +class windows_intermodule_singleton + : public intermodule_singleton_impl + < C + , LazyInit + , Phoenix + , intermodule_singleton_helpers::windows_semaphore_based_map + > +{}; + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif //#ifndef BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP diff --git a/project/jni/boost/include/boost/interprocess/detail/workaround.hpp b/project/jni/boost/include/boost/interprocess/detail/workaround.hpp index 160873875..44269fb2e 100644 --- a/project/jni/boost/include/boost/interprocess/detail/workaround.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/workaround.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -13,43 +13,34 @@ #include -#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) - -#define BOOST_INTERPROCESS_WINDOWS - -/* -#if !defined(_MSC_EXTENSIONS) -#error "Turn on Microsoft language extensions (_MSC_EXTENSIONS) to be able to call Windows API functions" -#endif -*/ - -#endif - -#if !defined(BOOST_INTERPROCESS_WINDOWS) - +#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + #define BOOST_INTERPROCESS_WINDOWS + #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION + #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME +#else #include - #if ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0) - //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it. - //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work. - # if !defined(__CYGWIN__) && !defined(__APPLE__) - # define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED - # endif + #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0) + //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it. + //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seem to work. + #if !defined(__CYGWIN__) && !defined(__APPLE__) + #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED + #endif #endif - - #if ((_POSIX_BARRIERS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_BARRIERS - # endif - #if ((_POSIX_SEMAPHORES - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES - # if defined(__CYGWIN__) - #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK - # endif + #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_BARRIERS + #endif + + #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES + #if defined(__CYGWIN__) + #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK + #endif //Some platforms have a limited (name length) named semaphore support #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__) - # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES - #endif + #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES + #endif #if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\ ((defined _V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\ @@ -60,87 +51,119 @@ ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\ ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64)) #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T - #else #endif //Check for XSI shared memory objects. They are available in nearly all UNIX platforms #if !defined(__QNXNTO__) && !defined(ANDROID) - # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS #endif - #if ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS #else - //VMS and MACOS don't define it but the have shm_open/close interface - # if defined(__vms) - # if __CRTL_VER >= 70200000 - # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS - # endif - //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX - # elif defined (__APPLE__) -// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS -// # define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW - # endif + //VMS and MACOS don't define it but they have shm_open/close interface + #if defined(__vms) + #if __CRTL_VER >= 70200000 + #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + #endif + //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX + #elif defined (__APPLE__) + //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS + //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW + #endif #endif //Now check if we have only XSI shared memory #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\ !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) - //# define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY + //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY #endif - #if ((_POSIX_TIMEOUTS - 0) > 0) - # define BOOST_INTERPROCESS_POSIX_TIMEOUTS - #endif - + #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0) + #define BOOST_INTERPROCESS_POSIX_TIMEOUTS + #endif #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS //Some systems have filesystem-based resources, so the //portable "/shmname" format does not work due to permission issues //For those systems we need to form a path to a temporary directory: // hp-ux tru64 vms freebsd - #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) - #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) + #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + //Some systems have "jailed" environments where shm usage is restricted at runtime + //and temporary file file based shm is possible in those executions. #elif defined(__FreeBSD__) - #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY #endif #endif #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES #if defined(__osf__) || defined(__vms) - #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES + #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES #endif #endif - #if ((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500) - #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES + #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \ + (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)) + #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES #endif -#endif + #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) + #define BOOST_INTERPROCESS_BSD_DERIVATIVE + #include + #if defined(CTL_KERN) && defined (KERN_BOOTTIME) + //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME + #endif + #endif +#endif //!defined(BOOST_INTERPROCESS_WINDOWS) -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ - && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) -#define BOOST_INTERPROCESS_PERFECT_FORWARDING +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #define BOOST_INTERPROCESS_PERFECT_FORWARDING #endif //Now declare some Boost.Interprocess features depending on the implementation - #if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK) - -#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES - -#endif - -#if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK) - -#define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES -#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES - + #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES + #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES #endif // Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set #ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS -#define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000 + #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000 +#endif + +//Other switches +//BOOST_INTERPROCESS_MSG_QUEUE_USES_CIRC_INDEX +//message queue uses a circular queue as index instead of an array (better performance) +//Boost version < 1.52 uses an array, so undef this if you want to communicate +//with processes compiled with those versions. +#define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX + +//Inline attributes +#if defined(_MSC_VER) + #define BOOST_INTERPROCESS_ALWAYS_INLINE __forceinline +#elif defined (__GNUC__) + #define BOOST_INTERPROCESS_ALWAYS_INLINE __attribute__((__always_inline__)) +#else + #define BOOST_INTERPROCESS_ALWAYS_INLINE inline +#endif + +#if defined(_MSC_VER) + #define BOOST_INTERPROCESS_NEVER_INLINE __declspec(noinline) +#elif defined (__GNUC__) + #define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__)) +#endif + +#if defined(BOOST_NO_CXX11_NOEXCEPT) + #if defined(BOOST_MSVC) + #define BOOST_INTERPROCESS_NOEXCEPT throw() + #else + #define BOOST_INTERPROCESS_NOEXCEPT + #endif + #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) +#else + #define BOOST_INTERPROCESS_NOEXCEPT noexcept + #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x) #endif #include diff --git a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp index d2e2bf2ce..b2a27501d 100644 --- a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_device.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -46,7 +46,7 @@ class xsi_shared_memory_device { /// @cond BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper) - /// @endcond + /// @endcond public: @@ -74,10 +74,10 @@ class xsi_shared_memory_device { this->swap(moved); } xsi_shared_memory_device &operator=(BOOST_RV_REF(xsi_shared_memory_device) moved) - { + { xsi_shared_memory_device tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memory_device. Does not throw @@ -168,7 +168,7 @@ inline xsi_shared_memory_device::xsi_shared_memory_device() : m_shm(), m_mode(invalid_mode), m_name() {} -inline xsi_shared_memory_device::~xsi_shared_memory_device() +inline xsi_shared_memory_device::~xsi_shared_memory_device() {} inline const char *xsi_shared_memory_device::get_name() const @@ -178,7 +178,7 @@ inline void xsi_shared_memory_device::swap(xsi_shared_memory_device &other) { m_shm.swap(other.m_shm); std::swap(m_mode, other.m_mode); - m_name.swap(other.m_name); + m_name.swap(other.m_name); } inline mapping_handle_t xsi_shared_memory_device::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp index d74d9664a..51af830fb 100644 --- a/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -40,7 +40,7 @@ class xsi_shared_memory_file_wrapper { /// @cond BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper) - /// @endcond + /// @endcond public: xsi_shared_memory_file_wrapper() : xsi_shared_memory() {} @@ -61,10 +61,10 @@ class xsi_shared_memory_file_wrapper { this->swap(moved); } xsi_shared_memory_file_wrapper &operator=(BOOST_RV_REF(xsi_shared_memory_file_wrapper) moved) - { + { xsi_shared_memory_file_wrapper tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memory_file_wrapper. Does not throw diff --git a/project/jni/boost/include/boost/interprocess/errors.hpp b/project/jni/boost/include/boost/interprocess/errors.hpp index e36b8e4e6..345ca311f 100644 --- a/project/jni/boost/include/boost/interprocess/errors.hpp +++ b/project/jni/boost/include/boost/interprocess/errors.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -11,7 +11,7 @@ ////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 Beman Dawes -// Copyright (C) 2001 Dietmar Kuehl +// Copyright (C) 2001 Dietmar Kuehl // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy // at http://www.boost.org/LICENSE_1_0.txt) @@ -64,16 +64,16 @@ inline int system_error_code() // artifact of POSIX and WINDOWS error reporting inline void fill_system_message(int sys_err_code, std::string &str) { void *lpMsgBuf; - winapi::format_message( - winapi::format_message_allocate_buffer | - winapi::format_message_from_system | + winapi::format_message( + winapi::format_message_allocate_buffer | + winapi::format_message_from_system | winapi::format_message_ignore_inserts, 0, sys_err_code, winapi::make_lang_id(winapi::lang_neutral, winapi::sublang_default), // Default language reinterpret_cast(&lpMsgBuf), 0, - 0 + 0 ); str += static_cast(lpMsgBuf); winapi::local_free( lpMsgBuf ); // free the buffer @@ -123,7 +123,7 @@ typedef int native_error_t; struct ec_xlate { native_error_t sys_ec; - error_code_t ec; + error_code_t ec; }; static const ec_xlate ec_table[] = @@ -183,9 +183,9 @@ static const ec_xlate ec_table[] = }; inline error_code_t lookup_error(native_error_t err) -{ +{ const ec_xlate *cur = &ec_table[0], - *end = cur + sizeof(ec_table)/sizeof(ec_xlate); + *end = cur + sizeof(ec_table)/sizeof(ec_xlate); for (;cur != end; ++cur ){ if ( err == cur->sys_ec ) return cur->ec; } diff --git a/project/jni/boost/include/boost/interprocess/exceptions.hpp b/project/jni/boost/include/boost/interprocess/exceptions.hpp index a4f196f0b..b9ab45bec 100644 --- a/project/jni/boost/include/boost/interprocess/exceptions.hpp +++ b/project/jni/boost/include/boost/interprocess/exceptions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/file_mapping.hpp b/project/jni/boost/include/boost/interprocess/file_mapping.hpp index 3bad98fca..58428604c 100644 --- a/project/jni/boost/include/boost/interprocess/file_mapping.hpp +++ b/project/jni/boost/include/boost/interprocess/file_mapping.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -41,27 +41,27 @@ class file_mapping //!Does not throw file_mapping(); - //!Opens a file mapping of file "filename", starting in offset - //!"file_offset", and the mapping's size will be "size". The mapping + //!Opens a file mapping of file "filename", starting in offset + //!"file_offset", and the mapping's size will be "size". The mapping //!can be opened for read-only "read_only" or read-write "read_write" //!modes. Throws interprocess_exception on error. file_mapping(const char *filename, mode_t mode); - //!Moves the ownership of "moved"'s file mapping object to *this. - //!After the call, "moved" does not represent any file mapping object. + //!Moves the ownership of "moved"'s file mapping object to *this. + //!After the call, "moved" does not represent any file mapping object. //!Does not throw file_mapping(BOOST_RV_REF(file_mapping) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s file mapping to *this. - //!After the call, "moved" does not represent any file mapping. + //!After the call, "moved" does not represent any file mapping. //!Does not throw file_mapping &operator=(BOOST_RV_REF(file_mapping) moved) { file_mapping tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to file_mappings. @@ -100,21 +100,21 @@ class file_mapping /// @endcond }; -inline file_mapping::file_mapping() +inline file_mapping::file_mapping() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline file_mapping::~file_mapping() +inline file_mapping::~file_mapping() { this->priv_close(); } inline const char *file_mapping::get_name() const { return m_filename.c_str(); } inline void file_mapping::swap(file_mapping &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t file_mapping::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp index bac387e26..52bf88ac7 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/flat_map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp index 966239290..b1abededf 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/iset_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -34,17 +34,17 @@ namespace interprocess { template struct iset_index_aux { - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; - typedef typename + typedef typename segment_manager_base::void_pointer void_pointer; typedef typename bi::make_set_base_hook < bi::void_pointer , bi::optimize_size >::type derivation_hook; - typedef typename MapConfig::template + typedef typename MapConfig::template intrusive_value_type::type value_type; typedef std::less value_compare; typedef typename bi::make_set @@ -82,20 +82,20 @@ class iset_index struct intrusive_key_value_less { bool operator()(const intrusive_compare_key_type &i, const value_type &b) const - { + { std::size_t blen = b.name_length(); - return (i.m_len < blen) || - (i.m_len == blen && - std::char_traits::compare + return (i.m_len < blen) || + (i.m_len == blen && + std::char_traits::compare (i.mp_str, b.name(), i.m_len) < 0); } bool operator()(const value_type &b, const intrusive_compare_key_type &i) const - { + { std::size_t blen = b.name_length(); - return (blen < i.m_len) || + return (blen < i.m_len) || (blen == i.m_len && - std::char_traits::compare + std::char_traits::compare (b.name(), i.mp_str, i.m_len) < 0); } }; @@ -143,7 +143,7 @@ struct is_intrusive_index /// @endcond } //namespace interprocess { -} //namespace boost +} //namespace boost #include diff --git a/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp index ef1ae79d3..a23c8461d 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/iunordered_set_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -35,17 +35,17 @@ namespace boost { namespace interprocess { template struct iunordered_set_index_aux { - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; - typedef typename + typedef typename segment_manager_base::void_pointer void_pointer; typedef typename bi::make_unordered_set_base_hook < bi::void_pointer >::type derivation_hook; - typedef typename MapConfig::template + typedef typename MapConfig::template intrusive_value_type::type value_type; typedef typename MapConfig:: @@ -58,23 +58,23 @@ struct iunordered_set_index_aux struct equal_function { bool operator()(const intrusive_compare_key_type &i, const value_type &b) const - { + { return (i.m_len == b.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (i.mp_str, b.name(), i.m_len) == 0); } bool operator()(const value_type &b, const intrusive_compare_key_type &i) const - { + { return (i.m_len == b.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (i.mp_str, b.name(), i.m_len) == 0); } bool operator()(const value_type &b1, const value_type &b2) const - { + { return (b1.name_length() == b2.name_length()) && - (std::char_traits::compare + (std::char_traits::compare (b1.name(), b2.name(), b1.name_length()) == 0); } }; @@ -119,7 +119,7 @@ struct iunordered_set_index_aux /// @endcond //!Index type based in boost::intrusive::set. -//!Just derives from boost::intrusive::set +//!Just derives from boost::intrusive::set //!and defines the interface needed by managed memory segments template class iunordered_set_index @@ -135,9 +135,9 @@ class iunordered_set_index typedef typename index_aux::equal_function equal_function; typedef typename index_aux::hash_function hash_function; typedef typename MapConfig::char_type char_type; - typedef typename + typedef typename iunordered_set_index_aux::allocator_type allocator_type; - typedef typename + typedef typename iunordered_set_index_aux::allocator_holder allocator_holder; /// @endcond @@ -190,7 +190,7 @@ class iunordered_set_index bucket_ptr shunk_p = alloc.allocation_command (boost::interprocess::shrink_in_place | boost::interprocess::nothrow_allocation, received_size, received_size, received_size, buckets).first; - BOOST_ASSERT(buckets == shunk_p); + BOOST_ASSERT(buckets == shunk_p); (void)shunk_p; bucket_ptr buckets_init = buckets + received_size; for(size_type i = 0; i < (old_size - received_size); ++i){ @@ -290,7 +290,7 @@ class iunordered_set_index size_type cur_size = this->size(); size_type cur_count = this->bucket_count(); bucket_ptr old_p = this->bucket_pointer(); - + if(!this->size() && old_p != bucket_ptr(&this->init_bucket)){ this->rehash(bucket_traits(bucket_ptr(&this->init_bucket), 1)); destroy_buckets(this->alloc, old_p, cur_count); @@ -337,7 +337,7 @@ class iunordered_set_index //Strong guarantee: if something goes wrong //we should remove the insertion. // - //We can use the iterator because the hash function + //We can use the iterator because the hash function //can't throw and this means that "reserve" will //throw only because of the memory allocation: //the iterator has not been invalidated. diff --git a/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp index ffea73e8d..409e4c97a 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -48,7 +48,7 @@ struct map_index_aux } //namespace ipcdetail { -//!Index type based in boost::interprocess::map. Just derives from boost::interprocess::map +//!Index type based in boost::interprocess::map. Just derives from boost::interprocess::map //!and defines the interface needed by managed memory segments template class map_index diff --git a/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp index 81c88be79..1e1d670d7 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/null_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -16,7 +16,7 @@ #include //!\file -//!Describes a null index adaptor, so that if we don't want to construct +//!Describes a null index adaptor, so that if we don't want to construct //!named objects, we can use this null index type to save resources. namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp b/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp index a14fa1d4a..2fce665d4 100644 --- a/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp +++ b/project/jni/boost/include/boost/interprocess/indexes/unordered_map_index.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -69,7 +69,7 @@ class unordered_map_index /// @cond typedef unordered_map_index_aux index_aux; typedef typename index_aux::index_t base_type; - typedef typename + typedef typename MapConfig::segment_manager_base segment_manager_base; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp b/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp index 2b3e3eba0..42f170a65 100644 --- a/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp +++ b/project/jni/boost/include/boost/interprocess/interprocess_fwd.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -214,7 +214,7 @@ template class IndexType> class basic_managed_shared_memory; -typedef basic_managed_shared_memory +typedef basic_managed_shared_memory ,iset_index> @@ -238,7 +238,7 @@ template class IndexType> class basic_managed_windows_shared_memory; -typedef basic_managed_windows_shared_memory +typedef basic_managed_windows_shared_memory ,iset_index> @@ -259,7 +259,7 @@ template class IndexType> class basic_managed_xsi_shared_memory; -typedef basic_managed_xsi_shared_memory +typedef basic_managed_xsi_shared_memory ,iset_index> diff --git a/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp b/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp index d3846afb7..90ca0af81 100644 --- a/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp +++ b/project/jni/boost/include/boost/interprocess/ipc/message_queue.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -42,6 +42,12 @@ namespace boost{ namespace interprocess{ +namespace ipcdetail +{ + template + class msg_queue_initialization_func_t; +} + //!A class that allows sending messages //!between processes. template @@ -66,24 +72,24 @@ class message_queue_t //!the maximum number of messages will be "max_num_msg" and the maximum message size //!will be "max_msg_size". Throws on error and if the queue was previously created. message_queue_t(create_only_t create_only, - const char *name, - size_type max_num_msg, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm = permissions()); - //!Opens or creates a process shared message queue with name "name". - //!If the queue is created, the maximum number of messages will be "max_num_msg" - //!and the maximum message size will be "max_msg_size". If queue was previously + //!Opens or creates a process shared message queue with name "name". + //!If the queue is created, the maximum number of messages will be "max_num_msg" + //!and the maximum message size will be "max_msg_size". If queue was previously //!created the queue will be opened and "max_num_msg" and "max_msg_size" parameters //!are ignored. Throws on error. message_queue_t(open_or_create_t open_or_create, - const char *name, - size_type max_num_msg, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm = permissions()); - //!Opens a previously created process shared message queue with name "name". - //!If the queue was not previously created or there are no free resources, + //!Opens a previously created process shared message queue with name "name". + //!If the queue was not previously created or there are no free resources, //!throws an error. message_queue_t(open_only_t open_only, const char *name); @@ -95,65 +101,65 @@ class message_queue_t //!this resource. The resource can still be opened again calling //!the open constructor overload. To erase the message queue from the system //!use remove(). - ~message_queue_t(); + ~message_queue_t(); - //!Sends a message stored in buffer "buffer" with size "buffer_size" in the + //!Sends a message stored in buffer "buffer" with size "buffer_size" in the //!message queue with priority "priority". If the message queue is full - //!the sender is blocked. Throws interprocess_error on error.*/ - void send (const void *buffer, size_type buffer_size, + //!the sender is blocked. Throws interprocess_error on error. + void send (const void *buffer, size_type buffer_size, unsigned int priority); - //!Sends a message stored in buffer "buffer" with size "buffer_size" through the + //!Sends a message stored in buffer "buffer" with size "buffer_size" through the //!message queue with priority "priority". If the message queue is full //!the sender is not blocked and returns false, otherwise returns true. //!Throws interprocess_error on error. - bool try_send (const void *buffer, size_type buffer_size, + bool try_send (const void *buffer, size_type buffer_size, unsigned int priority); - //!Sends a message stored in buffer "buffer" with size "buffer_size" in the + //!Sends a message stored in buffer "buffer" with size "buffer_size" in the //!message queue with priority "priority". If the message queue is full //!the sender retries until time "abs_time" is reached. Returns true if //!the message has been successfully sent. Returns false if timeout is reached. //!Throws interprocess_error on error. - bool timed_send (const void *buffer, size_type buffer_size, + bool timed_send (const void *buffer, size_type buffer_size, unsigned int priority, const boost::posix_time::ptime& abs_time); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver is blocked. Throws interprocess_error on error. - void receive (void *buffer, size_type buffer_size, + void receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver is not blocked and returns false, otherwise returns true. //!Throws interprocess_error on error. - bool try_receive (void *buffer, size_type buffer_size, + bool try_receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority); - //!Receives a message from the message queue. The message is stored in buffer - //!"buffer", which has size "buffer_size". The received message has size + //!Receives a message from the message queue. The message is stored in buffer + //!"buffer", which has size "buffer_size". The received message has size //!"recvd_size" and priority "priority". If the message queue is empty //!the receiver retries until time "abs_time" is reached. Returns true if //!the message has been successfully sent. Returns false if timeout is reached. //!Throws interprocess_error on error. - bool timed_receive (void *buffer, size_type buffer_size, + bool timed_receive (void *buffer, size_type buffer_size, size_type &recvd_size,unsigned int &priority, const boost::posix_time::ptime &abs_time); //!Returns the maximum number of messages allowed by the queue. The message - //!queue must be opened or created previously. Otherwise, returns 0. + //!queue must be opened or created previously. Otherwise, returns 0. //!Never throws size_type get_max_msg() const; //!Returns the maximum size of message allowed by the queue. The message - //!queue must be opened or created previously. Otherwise, returns 0. + //!queue must be opened or created previously. Otherwise, returns 0. //!Never throws size_type get_max_msg_size() const; - //!Returns the number of messages currently stored. + //!Returns the number of messages currently stored. //!Never throws size_type get_num_msg(); @@ -161,23 +167,26 @@ class message_queue_t //!Returns false on error. Never throws static bool remove(const char *name); - /// @cond + /// @cond private: typedef boost::posix_time::ptime ptime; + + friend class ipcdetail::msg_queue_initialization_func_t; + bool do_receive(block_t block, - void *buffer, size_type buffer_size, + void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const ptime &abs_time); bool do_send(block_t block, - const void *buffer, size_type buffer_size, + const void *buffer, size_type buffer_size, unsigned int priority, const ptime &abs_time); //!Returns the needed memory size for the shared message queue. //!Never throws static size_type get_mem_size(size_type max_msg_size, size_type max_num_msg); - - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; /// @endcond }; @@ -187,7 +196,7 @@ namespace ipcdetail { //!This header is the prefix of each message in the queue template -class msg_hdr_t +class msg_hdr_t { typedef VoidPointer void_pointer; typedef typename boost::intrusive:: @@ -212,36 +221,55 @@ class priority_functor rebind_pointer >::type msg_hdr_ptr_t; public: - bool operator()(const msg_hdr_ptr_t &msg1, + bool operator()(const msg_hdr_ptr_t &msg1, const msg_hdr_ptr_t &msg2) const { return msg1->priority < msg2->priority; } }; -//!This header is placed in the beginning of the shared memory and contains -//!the data to control the queue. This class initializes the shared memory +//!This header is placed in the beginning of the shared memory and contains +//!the data to control the queue. This class initializes the shared memory //!in the following way: in ascending memory address with proper alignment //!fillings: //! -//!-> mq_hdr_t: +//!-> mq_hdr_t: //! Main control block that controls the rest of the elements //! //!-> offset_ptr index [max_num_msg] -//! An array of pointers with size "max_num_msg" called index. Each pointer -//! points to a preallocated message. The elements of this array are +//! An array of pointers with size "max_num_msg" called index. Each pointer +//! points to a preallocated message. Elements of this array are //! reordered in runtime in the following way: //! -//! When the current number of messages is "cur_num_msg", the first +//! IF BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX is defined: +//! +//! When the current number of messages is "cur_num_msg", the array +//! is treated like a circular buffer. Starting from position "cur_first_msg" +//! "cur_num_msg" in a circular way, pointers point to inserted messages and the rest +//! point to free messages. Those "cur_num_msg" pointers are +//! ordered by the priority of the pointed message and by insertion order +//! if two messages have the same priority. So the next message to be +//! used in a "receive" is pointed by index [(cur_first_msg + cur_num_msg-1)%max_num_msg] +//! and the first free message ready to be used in a "send" operation is +//! [cur_first_msg] if circular buffer is extended from front, +//! [(cur_first_msg + cur_num_msg)%max_num_msg] otherwise. +//! +//! This transforms the index in a circular buffer with an embedded free +//! message queue. +//! +//! ELSE (BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX is NOT defined): +//! +//! When the current number of messages is "cur_num_msg", the first //! "cur_num_msg" pointers point to inserted messages and the rest //! point to free messages. The first "cur_num_msg" pointers are -//! ordered by the priority of the pointed message and by insertion order -//! if two messages have the same priority. So the next message to be +//! ordered by the priority of the pointed message and by insertion order +//! if two messages have the same priority. So the next message to be //! used in a "receive" is pointed by index [cur_num_msg-1] and the first free //! message ready to be used in a "send" operation is index [cur_num_msg]. -//! This transforms index in a fixed size priority queue with an embedded free +//! +//! This transforms the index in a fixed size priority queue with an embedded free //! message queue. //! //!-> struct message_t -//! { +//! { //! msg_hdr_t header; //! char[max_msg_size] data; //! } messages [max_num_msg]; @@ -252,7 +280,7 @@ class priority_functor template class mq_hdr_t : public ipcdetail::priority_functor -{ +{ typedef VoidPointer void_pointer; typedef msg_hdr_t msg_header; typedef typename boost::intrusive:: @@ -264,22 +292,22 @@ class mq_hdr_t typedef typename boost::intrusive:: pointer_traits::template rebind_pointer::type msg_hdr_ptr_ptr_t; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; public: - //!Constructor. This object must be constructed in the beginning of the + //!Constructor. This object must be constructed in the beginning of the //!shared memory of the size returned by the function "get_mem_size". //!This constructor initializes the needed resources and creates - //!the internal structures like the priority index. This can throw.*/ + //!the internal structures like the priority index. This can throw. mq_hdr_t(size_type max_num_msg, size_type max_msg_size) - : m_max_num_msg(max_num_msg), + : m_max_num_msg(max_num_msg), m_max_msg_size(max_msg_size), m_cur_num_msg(0) + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) + ,m_cur_first_msg(0u) + #endif { this->initialize_memory(); } - //!Returns the inserted message with top priority - msg_header * top_msg() - { return mp_index[m_cur_num_msg-1].get(); } - //!Returns true if the message queue is full bool is_full() const { return m_cur_num_msg == m_max_num_msg; } @@ -292,51 +320,223 @@ class mq_hdr_t void free_top_msg() { --m_cur_num_msg; } - //!Returns the first free msg of the free message queue - msg_header * free_msg() - { return mp_index[m_cur_num_msg].get(); } + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) - //!Inserts the first free message in the priority queue - void queue_free_msg() - { - //Get free msg - msg_hdr_ptr_t free = mp_index[m_cur_num_msg]; - //Get priority queue's range - msg_hdr_ptr_t *it = &mp_index[0], *it_end = &mp_index[m_cur_num_msg]; - //Check where the free message should be placed - it = std::lower_bound(it, it_end, free, static_cast&>(*this)); - //Make room in that position - std::copy_backward(it, it_end, it_end+1); - //Insert the free message in the correct position - *it = free; - ++m_cur_num_msg; + typedef msg_hdr_ptr_t *iterator; + + size_type end_pos() const + { + const size_type space_until_bufend = m_max_num_msg - m_cur_first_msg; + return space_until_bufend > m_cur_num_msg + ? m_cur_first_msg + m_cur_num_msg : m_cur_num_msg - space_until_bufend; } - //!Returns the number of bytes needed to construct a message queue with - //!"max_num_size" maximum number of messages and "max_msg_size" maximum + //!Returns the inserted message with top priority + msg_header &top_msg() + { + size_type pos = this->end_pos(); + return *mp_index[pos ? --pos : m_max_num_msg - 1]; + } + + //!Returns the inserted message with bottom priority + msg_header &bottom_msg() + { return *mp_index[m_cur_first_msg]; } + + iterator inserted_ptr_begin() const + { return &mp_index[m_cur_first_msg]; } + + iterator inserted_ptr_end() const + { return &mp_index[this->end_pos()]; } + + iterator lower_bound(const msg_hdr_ptr_t & value, priority_functor func) + { + iterator begin(this->inserted_ptr_begin()), end(this->inserted_ptr_end()); + if(end < begin){ + iterator idx_end = &mp_index[m_max_num_msg]; + iterator ret = std::lower_bound(begin, idx_end, value, func); + if(idx_end == ret){ + iterator idx_beg = &mp_index[0]; + ret = std::lower_bound(idx_beg, end, value, func); + //sanity check, these cases should not call lower_bound (optimized out) + assert(ret != end); + assert(ret != begin); + return ret; + } + else{ + return ret; + } + } + else{ + return std::lower_bound(begin, end, value, func); + } + } + + msg_header & insert_at(iterator where) + { + iterator it_inserted_ptr_end = this->inserted_ptr_end(); + iterator it_inserted_ptr_beg = this->inserted_ptr_begin(); + if(where == it_inserted_ptr_end){ + ++m_cur_num_msg; + return **it_inserted_ptr_end; + } + else if(where == it_inserted_ptr_beg){ + //unsigned integer guarantees underflow + m_cur_first_msg = m_cur_first_msg ? m_cur_first_msg : m_max_num_msg; + --m_cur_first_msg; + ++m_cur_num_msg; + return *mp_index[m_cur_first_msg]; + } + else{ + size_type pos = where - &mp_index[0]; + size_type circ_pos = pos >= m_cur_first_msg ? pos - m_cur_first_msg : pos + (m_max_num_msg - m_cur_first_msg); + //Check if it's more efficient to move back or move front + if(circ_pos < m_cur_num_msg/2){ + //The queue can't be full so m_cur_num_msg == 0 or m_cur_num_msg <= pos + //indicates two step insertion + if(!pos){ + pos = m_max_num_msg; + where = &mp_index[m_max_num_msg-1]; + } + else{ + --where; + } + const bool unique_segment = m_cur_first_msg && m_cur_first_msg <= pos; + const size_type first_segment_beg = unique_segment ? m_cur_first_msg : 1u; + const size_type first_segment_end = pos; + const size_type second_segment_beg = unique_segment || !m_cur_first_msg ? m_max_num_msg : m_cur_first_msg; + const size_type second_segment_end = m_max_num_msg; + const msg_hdr_ptr_t backup = *(&mp_index[0] + (unique_segment ? first_segment_beg : second_segment_beg) - 1); + + //First segment + if(!unique_segment){ + std::copy( &mp_index[0] + second_segment_beg + , &mp_index[0] + second_segment_end + , &mp_index[0] + second_segment_beg - 1); + mp_index[m_max_num_msg-1] = mp_index[0]; + } + std::copy( &mp_index[0] + first_segment_beg + , &mp_index[0] + first_segment_end + , &mp_index[0] + first_segment_beg - 1); + *where = backup; + m_cur_first_msg = m_cur_first_msg ? m_cur_first_msg : m_max_num_msg; + --m_cur_first_msg; + ++m_cur_num_msg; + return **where; + } + else{ + //The queue can't be full so end_pos < m_cur_first_msg + //indicates two step insertion + const size_type pos_end = this->end_pos(); + const bool unique_segment = pos < pos_end; + const size_type first_segment_beg = pos; + const size_type first_segment_end = unique_segment ? pos_end : m_max_num_msg-1; + const size_type second_segment_beg = 0u; + const size_type second_segment_end = unique_segment ? 0u : pos_end; + const msg_hdr_ptr_t backup = *it_inserted_ptr_end; + + //First segment + if(!unique_segment){ + std::copy_backward( &mp_index[0] + second_segment_beg + , &mp_index[0] + second_segment_end + , &mp_index[0] + second_segment_end + 1); + mp_index[0] = mp_index[m_max_num_msg-1]; + } + std::copy_backward( &mp_index[0] + first_segment_beg + , &mp_index[0] + first_segment_end + , &mp_index[0] + first_segment_end + 1); + *where = backup; + ++m_cur_num_msg; + return **where; + } + } + } + + #else + + typedef msg_hdr_ptr_t *iterator; + + //!Returns the inserted message with top priority + msg_header &top_msg() + { return *mp_index[m_cur_num_msg-1]; } + + //!Returns the inserted message with bottom priority + msg_header &bottom_msg() + { return *mp_index[0]; } + + iterator inserted_ptr_begin() const + { return &mp_index[0]; } + + iterator inserted_ptr_end() const + { return &mp_index[m_cur_num_msg]; } + + iterator lower_bound(const msg_hdr_ptr_t & value, priority_functor func) + { return std::lower_bound(this->inserted_ptr_begin(), this->inserted_ptr_end(), value, func); } + + msg_header & insert_at(iterator pos) + { + const msg_hdr_ptr_t backup = *inserted_ptr_end(); + std::copy_backward(pos, inserted_ptr_end(), inserted_ptr_end()+1); + *pos = backup; + ++m_cur_num_msg; + return **pos; + } + + #endif + + //!Inserts the first free message in the priority queue + msg_header & queue_free_msg(unsigned int priority) + { + //Get priority queue's range + iterator it (inserted_ptr_begin()), it_end(inserted_ptr_end()); + //Optimize for non-priority usage + if(m_cur_num_msg && priority > this->bottom_msg().priority){ + //Check for higher priority than all stored messages + if(priority > this->top_msg().priority){ + it = it_end; + } + else{ + //Since we don't now which free message we will pick + //build a dummy header for searches + msg_header dummy_hdr; + dummy_hdr.priority = priority; + + //Get free msg + msg_hdr_ptr_t dummy_ptr(&dummy_hdr); + + //Check where the free message should be placed + it = this->lower_bound(dummy_ptr, static_cast&>(*this)); + } + + } + //Insert the free message in the correct position + return this->insert_at(it); + } + + //!Returns the number of bytes needed to construct a message queue with + //!"max_num_size" maximum number of messages and "max_msg_size" maximum //!message size. Never throws. static size_type get_mem_size (size_type max_msg_size, size_type max_num_msg) { - const size_type + const size_type msg_hdr_align = ::boost::alignment_of::value, index_align = ::boost::alignment_of::value, r_hdr_size = ipcdetail::ct_rounded_size::value, - r_index_size = ipcdetail::get_rounded_size(sizeof(msg_hdr_ptr_t)*max_num_msg, msg_hdr_align), + r_index_size = ipcdetail::get_rounded_size(max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align), r_max_msg_size = ipcdetail::get_rounded_size(max_msg_size, msg_hdr_align) + sizeof(msg_header); - return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) + - ipcdetail::managed_open_or_create_impl::ManagedOpenOrCreateUserOffset; + return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) + + open_create_impl_t::ManagedOpenOrCreateUserOffset; } //!Initializes the memory structures to preallocate messages and constructs the //!message index. Never throws. void initialize_memory() { - const size_type + const size_type msg_hdr_align = ::boost::alignment_of::value, index_align = ::boost::alignment_of::value, r_hdr_size = ipcdetail::ct_rounded_size::value, - r_index_size = ipcdetail::get_rounded_size(sizeof(msg_hdr_ptr_t)*m_max_num_msg, msg_hdr_align), + r_index_size = ipcdetail::get_rounded_size(m_max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align), r_max_msg_size = ipcdetail::get_rounded_size(m_max_msg_size, msg_hdr_align) + sizeof(msg_header); //Pointer to the index @@ -345,7 +545,7 @@ class mq_hdr_t //Pointer to the first message header msg_header *msg_hdr = reinterpret_cast - (reinterpret_cast(this)+r_hdr_size+r_index_size); + (reinterpret_cast(this)+r_hdr_size+r_index_size); //Initialize the pointer to the index mp_index = index; @@ -373,13 +573,17 @@ class mq_hdr_t interprocess_condition m_cond_recv; //Condition block senders when the queue is full interprocess_condition m_cond_send; + #if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX) + //Current start offset in the circular index + size_type m_cur_first_msg; + #endif }; -//!This is the atomic functor to be executed when creating or opening +//!This is the atomic functor to be executed when creating or opening //!shared memory. Never throws template -class initialization_func_t +class msg_queue_initialization_func_t { public: typedef typename boost::intrusive:: @@ -388,7 +592,7 @@ class initialization_func_t typedef typename boost::intrusive::pointer_traits::difference_type difference_type; typedef typename boost::make_unsigned::type size_type; - initialization_func_t(size_type maxmsg = 0, + msg_queue_initialization_func_t(size_type maxmsg = 0, size_type maxmsgsize = 0) : m_maxmsg (maxmsg), m_maxmsgsize(maxmsgsize) {} @@ -403,12 +607,19 @@ class initialization_func_t new (mptr) mq_hdr_t(m_maxmsg, m_maxmsgsize); } BOOST_CATCH(...){ - return false; + return false; } BOOST_CATCH_END } return true; } + + std::size_t get_min_size() const + { + return mq_hdr_t::get_mem_size(m_maxmsgsize, m_maxmsg) + - message_queue_t::open_create_impl_t::ManagedOpenOrCreateUserOffset; + } + const size_type m_maxmsg; const size_type m_maxmsgsize; }; @@ -425,49 +636,48 @@ inline typename message_queue_t::size_type message_queue_t::get_mem_size(max_msg_size, max_num_msg); } template -inline message_queue_t::message_queue_t(create_only_t create_only, - const char *name, - size_type max_num_msg, +inline message_queue_t::message_queue_t(create_only_t, + const char *name, + size_type max_num_msg, size_type max_msg_size, const permissions &perm) //Create shared memory and execute functor atomically - : m_shmem(create_only, - name, - get_mem_size(max_msg_size, max_num_msg), - read_write, - static_cast(0), - //Prepare initialization functor - ipcdetail::initialization_func_t (max_num_msg, max_msg_size), - perm) -{} - -template -inline message_queue_t::message_queue_t(open_or_create_t open_or_create, - const char *name, - size_type max_num_msg, - size_type max_msg_size, - const permissions &perm) - //Create shared memory and execute functor atomically - : m_shmem(open_or_create, - name, + : m_shmem(create_only, + name, get_mem_size(max_msg_size, max_num_msg), read_write, static_cast(0), //Prepare initialization functor - ipcdetail::initialization_func_t (max_num_msg, max_msg_size), + ipcdetail::msg_queue_initialization_func_t (max_num_msg, max_msg_size), perm) {} template -inline message_queue_t::message_queue_t(open_only_t open_only, - const char *name) +inline message_queue_t::message_queue_t(open_or_create_t, + const char *name, + size_type max_num_msg, + size_type max_msg_size, + const permissions &perm) + //Create shared memory and execute functor atomically + : m_shmem(open_or_create, + name, + get_mem_size(max_msg_size, max_num_msg), + read_write, + static_cast(0), + //Prepare initialization functor + ipcdetail::msg_queue_initialization_func_t (max_num_msg, max_msg_size), + perm) +{} + +template +inline message_queue_t::message_queue_t(open_only_t, const char *name) //Create shared memory and execute functor atomically - : m_shmem(open_only, + : m_shmem(open_only, name, read_write, static_cast(0), //Prepare initialization functor - ipcdetail::initialization_func_t ()) + ipcdetail::msg_queue_initialization_func_t ()) {} template @@ -494,7 +704,7 @@ inline bool message_queue_t::timed_send template inline bool message_queue_t::do_send(block_t block, - const void *buffer, size_type buffer_size, + const void *buffer, size_type buffer_size, unsigned int priority, const boost::posix_time::ptime &abs_time) { ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); @@ -503,13 +713,13 @@ inline bool message_queue_t::do_send(block_t block, throw interprocess_exception(size_error); } + bool was_empty = false; //--------------------------------------------- scoped_lock lock(p_hdr->m_mutex); //--------------------------------------------- { //If the queue is full execute blocking logic if (p_hdr->is_full()) { - switch(block){ case non_blocking : return false; @@ -536,47 +746,47 @@ inline bool message_queue_t::do_send(block_t block, break; } } - - //Get the first free message from free message queue - ipcdetail::msg_hdr_t *free_msg = p_hdr->free_msg(); - if (free_msg == 0) { - throw interprocess_exception("boost::interprocess::message_queue corrupted"); - } + + was_empty = p_hdr->is_empty(); + //Insert the first free message in the priority queue + ipcdetail::msg_hdr_t &free_msg_hdr = p_hdr->queue_free_msg(priority); + + //Sanity check, free msgs are always cleaned when received + assert(free_msg_hdr.priority == 0); + assert(free_msg_hdr.len == 0); //Copy control data to the free message - free_msg->priority = priority; - free_msg->len = buffer_size; + free_msg_hdr.priority = priority; + free_msg_hdr.len = buffer_size; //Copy user buffer to the message - std::memcpy(free_msg->data(), buffer, buffer_size); - -// bool was_empty = p_hdr->is_empty(); - //Insert the first free message in the priority queue - p_hdr->queue_free_msg(); - - //If this message changes the queue empty state, notify it to receivers -// if (was_empty){ - p_hdr->m_cond_recv.notify_one(); -// } + std::memcpy(free_msg_hdr.data(), buffer, buffer_size); } // Lock end + //Notify outside lock to avoid contention. This might produce some + //spurious wakeups, but it's usually far better than notifying inside. + //If this message changes the queue empty state, notify it to receivers + if (was_empty){ + p_hdr->m_cond_recv.notify_one(); + } + return true; } template -inline void message_queue_t::receive(void *buffer, size_type buffer_size, +inline void message_queue_t::receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority) { this->do_receive(blocking, buffer, buffer_size, recvd_size, priority, ptime()); } template inline bool - message_queue_t::try_receive(void *buffer, size_type buffer_size, + message_queue_t::try_receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority) { return this->do_receive(non_blocking, buffer, buffer_size, recvd_size, priority, ptime()); } template inline bool - message_queue_t::timed_receive(void *buffer, size_type buffer_size, + message_queue_t::timed_receive(void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const boost::posix_time::ptime &abs_time) { @@ -590,7 +800,7 @@ inline bool template inline bool message_queue_t::do_receive(block_t block, - void *buffer, size_type buffer_size, + void *buffer, size_type buffer_size, size_type &recvd_size, unsigned int &priority, const boost::posix_time::ptime &abs_time) { @@ -600,6 +810,7 @@ inline bool throw interprocess_exception(size_error); } + bool was_full = false; //--------------------------------------------- scoped_lock lock(p_hdr->m_mutex); //--------------------------------------------- @@ -635,51 +846,52 @@ inline bool } } - //Thre is at least message ready to pick, get the top one - ipcdetail::msg_hdr_t *top_msg = p_hdr->top_msg(); - - //Paranoia check - if (top_msg == 0) { - throw interprocess_exception("boost::interprocess::message_queue corrupted"); - } + //There is at least one message ready to pick, get the top one + ipcdetail::msg_hdr_t &top_msg = p_hdr->top_msg(); //Get data from the message - recvd_size = top_msg->len; - priority = top_msg->priority; + recvd_size = top_msg.len; + priority = top_msg.priority; + + //Some cleanup to ease debugging + top_msg.len = 0; + top_msg.priority = 0; //Copy data to receiver's bufers - std::memcpy(buffer, top_msg->data(), recvd_size); + std::memcpy(buffer, top_msg.data(), recvd_size); -// bool was_full = p_hdr->is_full(); + was_full = p_hdr->is_full(); //Free top message and put it in the free message list p_hdr->free_top_msg(); - - //If this reception changes the queue full state, notify senders -// if (was_full){ - p_hdr->m_cond_send.notify_one(); -// } } //Lock end + //Notify outside lock to avoid contention. This might produce some + //spurious wakeups, but it's usually far better than notifying inside. + //If this reception changes the queue full state, notify senders + if (was_full){ + p_hdr->m_cond_send.notify_one(); + } + return true; } template inline typename message_queue_t::size_type message_queue_t::get_max_msg() const -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); return p_hdr ? p_hdr->m_max_num_msg : 0; } template inline typename message_queue_t::size_type message_queue_t::get_max_msg_size() const -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); - return p_hdr ? p_hdr->m_max_msg_size : 0; + return p_hdr ? p_hdr->m_max_msg_size : 0; } template inline typename message_queue_t::size_type message_queue_t::get_num_msg() -{ +{ ipcdetail::mq_hdr_t *p_hdr = static_cast*>(m_shmem.get_user_address()); if(p_hdr){ //--------------------------------------------- @@ -688,7 +900,7 @@ inline typename message_queue_t::size_type message_queue_tm_cur_num_msg; } - return 0; + return 0; } template diff --git a/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp b/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp index a2cf47f4e..1f4a1995f 100644 --- a/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_external_buffer.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -23,34 +23,34 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include //!\file -//!Describes a named user memory allocation user class. +//!Describes a named user memory allocation user class. namespace boost { namespace interprocess { -//!A basic user memory named object creation class. Inherits all -//!basic functionality from +//!A basic user memory named object creation class. Inherits all +//!basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_external_buffer +class basic_managed_external_buffer : public ipcdetail::basic_managed_memory_impl { /// @cond - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_external_buffer) /// @endcond - + public: typedef typename base_t::size_type size_type; diff --git a/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp index 74869bb1f..868fdc556 100644 --- a/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_heap_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -24,32 +24,32 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include //!\file -//!Describes a named heap memory allocation user class. +//!Describes a named heap memory allocation user class. namespace boost { namespace interprocess { -//!A basic heap memory named object creation class. Initializes the -//!heap memory segment. Inherits all basic functionality from +//!A basic heap memory named object creation class. Initializes the +//!heap memory segment. Inherits all basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_heap_memory +class basic_managed_heap_memory : public ipcdetail::basic_managed_memory_impl { /// @cond private: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl base_t; BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_managed_heap_memory) /// @endcond @@ -90,16 +90,16 @@ class basic_managed_heap_memory } //!Tries to resize internal heap memory so that - //!we have room for more objects. - //!WARNING: If memory is reallocated, all the objects will + //!we have room for more objects. + //!WARNING: If memory is reallocated, all the objects will //!be binary-copied to the new buffer. To be able to use //!this function, all pointers constructed in this buffer //!must be offset pointers. Otherwise, the result is undefined. //!Returns true if the growth has been successful, so you will - //!have some extra bytes to allocate new objects. If returns + //!have some extra bytes to allocate new objects. If returns //!false, the heap allocation has failed. bool grow(size_type extra_bytes) - { + { //If memory is reallocated, data will //be automatically copied BOOST_TRY{ @@ -129,7 +129,7 @@ class basic_managed_heap_memory private: //!Frees resources. Never throws. void priv_close() - { + { base_t::destroy_impl(); std::vector().swap(m_heapmem); } diff --git a/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp b/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp index 218fa9783..a802119a6 100644 --- a/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_mapped_file.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -26,44 +26,48 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include namespace boost { namespace interprocess { +namespace ipcdetail { -//!A basic mapped file named object creation class. Initializes the -//!mapped file. Inherits all basic functionality from +template +struct mfile_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < file_wrapper, AllocationAlgorithm::Alignment, true, false> type; +}; + +} //namespace ipcdetail { + +//!A basic mapped file named object creation class. Initializes the +//!mapped file. Inherits all basic functionality from //!basic_managed_memory_impl template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_mapped_file +class basic_managed_mapped_file : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset - > + ,ipcdetail::mfile_open_or_create::type::ManagedOpenOrCreateUserOffset> { /// @cond public: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset - > base_t; + ipcdetail::mfile_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; typedef ipcdetail::file_wrapper device_type; typedef typename base_t::size_type size_type; private: - typedef ipcdetail::create_open_func create_open_func_t; - typedef ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper - , AllocationAlgorithm::Alignment> managed_open_or_create_type; + typedef ipcdetail::create_open_func create_open_func_t; basic_managed_mapped_file *get_this_pointer() { return this; } @@ -75,16 +79,16 @@ class basic_managed_mapped_file public: //functions - //!Creates mapped file and creates and places the segment manager. + //!Creates mapped file and creates and places the segment manager. //!This can throw. basic_managed_mapped_file() {} - //!Creates mapped file and creates and places the segment manager. + //!Creates mapped file and creates and places the segment manager. //!This can throw. - basic_managed_mapped_file(create_only_t create_only, const char *name, + basic_managed_mapped_file(create_only_t, const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_mfile(create_only, name, size, read_write, addr, + : m_mfile(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -92,40 +96,40 @@ class basic_managed_mapped_file //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_mapped_file (open_or_create_t open_or_create, - const char *name, size_type size, + basic_managed_mapped_file (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) : m_mfile(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created mapped file and its segment manager. //!This can throw. - basic_managed_mapped_file (open_only_t open_only, const char* name, + basic_managed_mapped_file (open_only_t, const char* name, const void *addr = 0) : m_mfile(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created mapped file and its segment manager //!in copy_on_write mode. //!This can throw. - basic_managed_mapped_file (open_copy_on_write_t, const char* name, + basic_managed_mapped_file (open_copy_on_write_t, const char* name, const void *addr = 0) - : m_mfile(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), + : m_mfile(open_only, name, copy_on_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created mapped file and its segment manager //!in read-only mode. //!This can throw. - basic_managed_mapped_file (open_read_only_t, const char* name, + basic_managed_mapped_file (open_read_only_t, const char* name, const void *addr = 0) - : m_mfile(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), + : m_mfile(open_only, name, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -167,8 +171,8 @@ class basic_managed_mapped_file bool flush() { return m_mfile.flush(); } - //!Tries to resize mapped file so that we have room for - //!more objects. + //!Tries to resize mapped file so that we have room for + //!more objects. //! //!This function is not synchronized so no other thread or process should //!be reading or writing the file @@ -205,7 +209,7 @@ class basic_managed_mapped_file } private: - managed_open_or_create_type m_mfile; + typename ipcdetail::mfile_open_or_create::type m_mfile; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp index cec9591be..c20f39ca3 100644 --- a/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -25,37 +25,43 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include namespace boost { - namespace interprocess { -//!A basic shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +namespace ipcdetail { + +template +struct shmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < shared_memory_object, AllocationAlgorithm::Alignment, true, false> type; +}; + +} //namespace ipcdetail { + +//!A basic shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl*/ template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_shared_memory +class basic_managed_shared_memory : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> - , private ipcdetail::managed_open_or_create_impl + ,ipcdetail::shmem_open_or_create::type::ManagedOpenOrCreateUserOffset> + , private ipcdetail::shmem_open_or_create::type { /// @cond - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> base_t; - typedef ipcdetail::managed_open_or_create_impl - base2_t; + ipcdetail::shmem_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; + typedef typename ipcdetail::shmem_open_or_create::type base2_t; typedef ipcdetail::create_open_func create_open_func_t; @@ -87,12 +93,12 @@ class basic_managed_shared_memory basic_managed_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. - basic_managed_shared_memory(create_only_t create_only, const char *name, + basic_managed_shared_memory(create_only_t, const char *name, size_type size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(create_only, name, size, read_write, addr, + , base2_t(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -100,44 +106,44 @@ class basic_managed_shared_memory //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_shared_memory (open_or_create_t open_or_create, - const char *name, size_type size, + basic_managed_shared_memory (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!in copy_on_write mode. //!This can throw. - basic_managed_shared_memory (open_copy_on_write_t, const char* name, + basic_managed_shared_memory (open_copy_on_write_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, copy_on_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, copy_on_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!in read-only mode. //!This can throw. - basic_managed_shared_memory (open_read_only_t, const char* name, + basic_managed_shared_memory (open_read_only_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, read_only, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!This can throw. - basic_managed_shared_memory (open_only_t open_only, const char* name, + basic_managed_shared_memory (open_only_t, const char* name, const void *addr = 0) : base_t() - , base2_t(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -168,7 +174,7 @@ class basic_managed_shared_memory } //!Tries to resize the managed shared memory object so that we have - //!room for more objects. + //!room for more objects. //! //!This function is not synchronized so no other thread or process should //!be reading or writing the file @@ -187,12 +193,6 @@ class basic_managed_shared_memory return base_t::template shrink_to_fit (shmname); } - - bool flush() - { - return this->base2_t::flush(); - } - /// @cond //!Tries to find a previous named allocation address. Returns a memory diff --git a/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp index 959194cc1..e553a707c 100644 --- a/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_windows_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -25,15 +25,26 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include namespace boost { namespace interprocess { -//!A basic managed windows shared memory creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from +namespace ipcdetail { + +template +struct wshmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl + < windows_shared_memory, AllocationAlgorithm::Alignment, false, false> type; +}; + +} //namespace ipcdetail { + +//!A basic managed windows shared memory creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl //!Unlike basic_managed_shared_memory, it has //!no kernel persistence and the shared memory is destroyed @@ -45,25 +56,20 @@ namespace interprocess { //!basic_managed_shared_memory can't communicate between them. template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_windows_shared_memory +class basic_managed_windows_shared_memory : public ipcdetail::basic_managed_memory_impl < CharType, AllocationAlgorithm, IndexType - , ipcdetail::managed_open_or_create_impl - < windows_shared_memory - , AllocationAlgorithm::Alignment - , false>::ManagedOpenOrCreateUserOffset - > + , ipcdetail::wshmem_open_or_create::type::ManagedOpenOrCreateUserOffset> { /// @cond private: - typedef ipcdetail::basic_managed_memory_impl + typedef ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> base_t; + ipcdetail::wshmem_open_or_create::type::ManagedOpenOrCreateUserOffset> base_t; typedef ipcdetail::create_open_func create_open_func_t; basic_managed_windows_shared_memory *get_this_pointer() @@ -82,12 +88,12 @@ class basic_managed_windows_shared_memory basic_managed_windows_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. basic_managed_windows_shared_memory - (create_only_t create_only, const char *name, + (create_only_t, const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_wshm(create_only, name, size, read_write, addr, + : m_wshm(create_only, name, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -96,21 +102,21 @@ class basic_managed_windows_shared_memory //!segment. //!This can throw. basic_managed_windows_shared_memory - (open_or_create_t open_or_create, - const char *name, size_type size, + (open_or_create_t, + const char *name, size_type size, const void *addr = 0, const permissions &perm = permissions()) - : m_wshm(open_or_create, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), + : m_wshm(open_or_create, name, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!This can throw. basic_managed_windows_shared_memory - (open_only_t open_only, const char* name, const void *addr = 0) - : m_wshm(open_only, name, read_write, addr, - create_open_func_t(get_this_pointer(), + (open_only_t, const char* name, const void *addr = 0) + : m_wshm(open_only, name, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -119,7 +125,7 @@ class basic_managed_windows_shared_memory //!This can throw. basic_managed_windows_shared_memory (open_copy_on_write_t, const char* name, const void *addr = 0) - : m_wshm(open_only, name, copy_on_write, addr, + : m_wshm(open_only, name, copy_on_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -129,7 +135,7 @@ class basic_managed_windows_shared_memory basic_managed_windows_shared_memory (open_read_only_t, const char* name, const void *addr = 0) : base_t() - , m_wshm(open_only, name, read_only, addr, + , m_wshm(open_only, name, read_only, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} @@ -181,8 +187,7 @@ class basic_managed_windows_shared_memory } private: - ipcdetail::managed_open_or_create_impl< windows_shared_memory - , AllocationAlgorithm::Alignment, false> m_wshm; + typename ipcdetail::wshmem_open_or_create::type m_wshm; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp index 960192025..4ec7eba8d 100644 --- a/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/managed_xsi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,7 +28,7 @@ #include //These includes needed to fulfill default template parameters of //predeclarations in interprocess_fwd.hpp -#include +#include #include #include @@ -36,32 +36,39 @@ namespace boost { namespace interprocess { -//!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the -//!shared memory segment. Inherits all basic functionality from -//!basic_managed_memory_impl*/ +namespace ipcdetail { + +template +struct xsishmem_open_or_create +{ + typedef ipcdetail::managed_open_or_create_impl //!FileBased, StoreDevice + < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> type; +}; + +} //namespace ipcdetail { + +//!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the +//!shared memory segment. Inherits all basic functionality from +//!basic_managed_memory_impl template < - class CharType, - class AllocationAlgorithm, + class CharType, + class AllocationAlgorithm, template class IndexType > -class basic_managed_xsi_shared_memory +class basic_managed_xsi_shared_memory : public ipcdetail::basic_managed_memory_impl ::ManagedOpenOrCreateUserOffset> - , private ipcdetail::managed_open_or_create_impl - + ,ipcdetail::xsishmem_open_or_create::type::ManagedOpenOrCreateUserOffset> + , private ipcdetail::xsishmem_open_or_create::type { /// @cond public: typedef xsi_shared_memory_file_wrapper device_type; public: - typedef ipcdetail::managed_open_or_create_impl - base2_t; - typedef ipcdetail::basic_managed_memory_impl + typedef typename ipcdetail::xsishmem_open_or_create::type base2_t; + typedef ipcdetail::basic_managed_memory_impl base_t; @@ -92,12 +99,12 @@ class basic_managed_xsi_shared_memory basic_managed_xsi_shared_memory() {} - //!Creates shared memory and creates and places the segment manager. + //!Creates shared memory and creates and places the segment manager. //!This can throw. - basic_managed_xsi_shared_memory(create_only_t create_only, const xsi_key &key, + basic_managed_xsi_shared_memory(create_only_t, const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(create_only, key, size, read_write, addr, + , base2_t(create_only, key, size, read_write, addr, create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm) {} @@ -105,33 +112,33 @@ class basic_managed_xsi_shared_memory //!segment was not created. If segment was created it connects to the //!segment. //!This can throw. - basic_managed_xsi_shared_memory (open_or_create_t open_or_create, - const xsi_key &key, std::size_t size, + basic_managed_xsi_shared_memory (open_or_create_t, + const xsi_key &key, std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() - , base2_t(open_or_create, key, size, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_or_create, key, size, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. //!in read-only mode. //!This can throw. - basic_managed_xsi_shared_memory (open_read_only_t, const xsi_key &key, + basic_managed_xsi_shared_memory (open_read_only_t, const xsi_key &key, const void *addr = 0) : base_t() - , base2_t(open_only, key, read_only, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, key, read_only, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} //!Connects to a created shared memory and its segment manager. //!This can throw. - basic_managed_xsi_shared_memory (open_only_t open_only, const xsi_key &key, + basic_managed_xsi_shared_memory (open_only_t, const xsi_key &key, const void *addr = 0) : base_t() - , base2_t(open_only, key, read_write, addr, - create_open_func_t(get_this_pointer(), + , base2_t(open_only, key, read_write, addr, + create_open_func_t(get_this_pointer(), ipcdetail::DoOpen)) {} diff --git a/project/jni/boost/include/boost/interprocess/mapped_region.hpp b/project/jni/boost/include/boost/interprocess/mapped_region.hpp index eae3f3622..6a3366f49 100644 --- a/project/jni/boost/include/boost/interprocess/mapped_region.hpp +++ b/project/jni/boost/include/boost/interprocess/mapped_region.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -20,10 +20,23 @@ #include #include #include -#include +#include +//Some Unixes use caddr_t instead of void * in madvise +// SunOS Tru64 HP-UX AIX +#if defined(sun) || defined(__sun) || defined(__osf__) || defined(__osf) || defined(_hpux) || defined(hpux) || defined(_AIX) +#define BOOST_INTERPROCESS_MADVISE_USES_CADDR_T +#include +#endif -#if (defined BOOST_INTERPROCESS_WINDOWS) +//A lot of UNIXes have destructive semantics for MADV_DONTNEED, so +//we need to be careful to allow it. +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) +#define BOOST_INTERPROCESS_MADV_DONTNEED_HAS_NONDESTRUCTIVE_SEMANTICS +#endif + +#if defined (BOOST_INTERPROCESS_WINDOWS) # include +# include #else # ifdef BOOST_HAS_UNISTD_H # include @@ -48,6 +61,13 @@ namespace boost { namespace interprocess { /// @cond + +//Solaris declares madvise only in some configurations but defines MADV_XXX, a bit confusing. +//Predeclare it here to avoid any compilation error +#if (defined(sun) || defined(__sun)) && defined(MADV_NORMAL) +extern "C" int madvise(caddr_t, size_t, int); +#endif + namespace ipcdetail{ class interprocess_tester; } namespace ipcdetail{ class raw_mapped_region_creator; } @@ -55,6 +75,10 @@ namespace ipcdetail{ class raw_mapped_region_creator; } //!The mapped_region class represents a portion or region created from a //!memory_mappable object. +//! +//!The OS can map a region bigger than the requested one, as region must +//!be multiple of the page size, but mapped_region will always refer to +//!the region specified by the user. class mapped_region { /// @cond @@ -65,9 +89,15 @@ class mapped_region public: //!Creates a mapping region of the mapped memory "mapping", starting in - //!offset "offset", and the mapping's size will be "size". The mapping - //!can be opened for read-only "read_only" or read-write - //!"read_write. + //!offset "offset", and the mapping's size will be "size". The mapping + //!can be opened for read only, read-write or copy-on-write. + //! + //!If an address is specified, both the offset and the address must be + //!multiples of the page size. + //! + //!The OS could allocate more pages than size/page_size(), but get_address() + //!will always return the address passed in this function (if not null) and + //!get_size() will return the specified size. template mapped_region(const MemoryMappable& mapping ,mode_t mode @@ -75,8 +105,8 @@ class mapped_region ,std::size_t size = 0 ,const void *address = 0); - //!Default constructor. Default constructor. Address will be 0 (nullptr). - //!Size and offset will be 0. + //!Default constructor. Address will be 0 (nullptr). + //!Size will be 0. //!Does not throw mapped_region(); @@ -84,12 +114,12 @@ class mapped_region //!region and "other" will be left in default constructor state. mapped_region(BOOST_RV_REF(mapped_region) other) #if defined (BOOST_INTERPROCESS_WINDOWS) - : m_base(0), m_size(0), m_offset(0) - , m_extra_offset(0) + : m_base(0), m_size(0) + , m_page_offset(0) , m_mode(read_only) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) #else - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only), m_is_xsi(false) #endif { this->swap(other); } @@ -106,33 +136,67 @@ class mapped_region return *this; } - //!Returns the size of the mapping. Note for windows users: If - //!windows_shared_memory is mapped using 0 as the size, it returns 0 - //!because the size is unknown. Never throws. + //!Swaps the mapped_region with another + //!mapped region + void swap(mapped_region &other); + + //!Returns the size of the mapping. Never throws. std::size_t get_size() const; //!Returns the base address of the mapping. //!Never throws. void* get_address() const; - //!Returns the offset of the mapping from the beginning of the - //!mapped memory. Never throws. - offset_t get_offset() const; - - //!Returns the mode of the mapping used to construct the mapped file. + //!Returns the mode of the mapping used to construct the mapped region. //!Never throws. mode_t get_mode() const; - //!Flushes to the disk a byte range within the mapped memory. - //!Never throws - bool flush(std::size_t mapping_offset = 0, std::size_t numbytes = 0); + //!Flushes to the disk a byte range within the mapped memory. + //!If 'async' is true, the function will return before flushing operation is completed + //!If 'async' is false, function will return once data has been written into the underlying + //!device (i.e., in mapped files OS cached information is written to disk). + //!Never throws. Returns false if operation could not be performed. + bool flush(std::size_t mapping_offset = 0, std::size_t numbytes = 0, bool async = true); - //!Swaps the mapped_region with another - //!mapped region - void swap(mapped_region &other); + //!Shrinks current mapped region. If after shrinking there is no longer need for a previously + //!mapped memory page, accessing that page can trigger a segmentation fault. + //!Depending on the OS, this operation might fail (XSI shared memory), it can decommit storage + //!and free a portion of the virtual address space (e.g.POSIX) or this + //!function can release some physical memory wihout freeing any virtual address space(Windows). + //!Returns true on success. Never throws. + bool shrink_by(std::size_t bytes, bool from_back = true); + + //!This enum specifies region usage behaviors that an application can specify + //!to the mapped region implementation. + enum advice_types{ + //!Specifies that the application has no advice to give on its behavior with respect to + //!the region. It is the default characteristic if no advice is given for a range of memory. + advice_normal, + //!Specifies that the application expects to access the region sequentially from + //!lower addresses to higher addresses. The implementation can lower the priority of + //!preceding pages within the region once a page have been accessed. + advice_sequential, + //!Specifies that the application expects to access the region in a random order, + //!and prefetching is likely not advantageous. + advice_random, + //!Specifies that the application expects to access the region in the near future. + //!The implementation can prefetch pages of the region. + advice_willneed, + //!Specifies that the application expects that it will not access the region in the near future. + //!The implementation can unload pages within the range to save system resources. + advice_dontneed + }; + + //!Advises the implementation on the expected behavior of the application with respect to the data + //!in the region. The implementation may use this information to optimize handling of the region data. + //!This function has no effect on the semantics of access to memory in the region, although it may affect + //!the performance of access. + //!If the advise type is not known to the implementation, the function returns false. True otherwise. + bool advise(advice_types advise); //!Returns the size of the page. This size is the minimum memory that - //!will be used by the system when mapping a memory mappable source. + //!will be used by the system when mapping a memory mappable source and + //!will restrict the address and the offset to map. static std::size_t get_page_size(); /// @cond @@ -140,6 +204,14 @@ class mapped_region //!Closes a previously opened memory mapping. Never throws void priv_close(); + void* priv_map_address() const; + std::size_t priv_map_size() const; + bool priv_flush_param_check(std::size_t mapping_offset, void *&addr, std::size_t &numbytes) const; + bool priv_shrink_param_check(std::size_t bytes, bool from_back, void *&shrink_page_start, std::size_t &shrink_page_bytes); + static void priv_size_from_mapping_size + (offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size); + static offset_t priv_page_offset_addr_fixup(offset_t page_offset, const void *&addr); + template struct page_size_holder { @@ -149,11 +221,10 @@ class mapped_region void* m_base; std::size_t m_size; - offset_t m_offset; - offset_t m_extra_offset; + std::size_t m_page_offset; mode_t m_mode; - #if (defined BOOST_INTERPROCESS_WINDOWS) - file_handle_t m_file_mapping_hnd; + #if defined(BOOST_INTERPROCESS_WINDOWS) + file_handle_t m_file_or_mapping_hnd; #else bool m_is_xsi; #endif @@ -161,6 +232,10 @@ class mapped_region friend class ipcdetail::interprocess_tester; friend class ipcdetail::raw_mapped_region_creator; void dont_close_on_destruction(); + #if defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + template + static void destroy_syncs_in_range(const void *addr, std::size_t size); + #endif /// @endcond }; @@ -175,20 +250,106 @@ inline mapped_region::~mapped_region() inline std::size_t mapped_region::get_size() const { return m_size; } -inline offset_t mapped_region::get_offset() const -{ return m_offset; } - inline mode_t mapped_region::get_mode() const { return m_mode; } inline void* mapped_region::get_address() const { return m_base; } +inline void* mapped_region::priv_map_address() const +{ return static_cast(m_base) - m_page_offset; } + +inline std::size_t mapped_region::priv_map_size() const +{ return m_size + m_page_offset; } + +inline bool mapped_region::priv_flush_param_check + (std::size_t mapping_offset, void *&addr, std::size_t &numbytes) const +{ + //Check some errors + if(m_base == 0) + return false; + + if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){ + return false; + } + + //Update flush size if the user does not provide it + if(numbytes == 0){ + numbytes = m_size - mapping_offset; + } + addr = (char*)this->priv_map_address() + mapping_offset; + numbytes += m_page_offset; + return true; +} + +inline bool mapped_region::priv_shrink_param_check + (std::size_t bytes, bool from_back, void *&shrink_page_start, std::size_t &shrink_page_bytes) +{ + //Check some errors + if(m_base == 0 || bytes > m_size){ + return false; + } + else if(bytes == m_size){ + this->priv_close(); + return true; + } + else{ + const std::size_t page_size = mapped_region::get_page_size(); + if(from_back){ + const std::size_t new_pages = (m_size + m_page_offset - bytes - 1)/page_size + 1; + shrink_page_start = static_cast(this->priv_map_address()) + new_pages*page_size; + shrink_page_bytes = m_page_offset + m_size - new_pages*page_size; + m_size -= bytes; + } + else{ + shrink_page_start = this->priv_map_address(); + m_page_offset += bytes; + shrink_page_bytes = (m_page_offset/page_size)*page_size; + m_page_offset = m_page_offset % page_size; + m_size -= bytes; + m_base = static_cast(m_base) + bytes; + assert(shrink_page_bytes%page_size == 0); + } + return true; + } +} + +inline void mapped_region::priv_size_from_mapping_size + (offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size) +{ + //Check if mapping size fits in the user address space + //as offset_t is the maximum file size and its signed. + if(mapping_size < offset || + boost::uintmax_t(mapping_size - (offset - page_offset)) > + boost::uintmax_t(std::size_t(-1))){ + error_info err(size_error); + throw interprocess_exception(err); + } + size = static_cast(mapping_size - (offset - page_offset)); +} + +inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, const void *&address) +{ + //We can't map any offset so we have to obtain system's + //memory granularity + const std::size_t page_size = mapped_region::get_page_size(); + + //We calculate the difference between demanded and valid offset + //(always less than a page in std::size_t, thus, representable by std::size_t) + const std::size_t page_offset = + static_cast(offset - (offset / page_size) * page_size); + //Update the mapping address + if(address){ + address = static_cast(address) - page_offset; + } + return page_offset; +} + #if defined (BOOST_INTERPROCESS_WINDOWS) inline mapped_region::mapped_region() - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) {} template @@ -206,169 +367,177 @@ inline mapped_region::mapped_region ,offset_t offset ,std::size_t size ,const void *address) - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode) - , m_file_mapping_hnd(ipcdetail::invalid_file()) + : m_base(0), m_size(0), m_page_offset(0), m_mode(mode) + , m_file_or_mapping_hnd(ipcdetail::invalid_file()) { mapping_handle_t mhandle = mapping.get_mapping_handle(); - file_handle_t native_mapping_handle = 0; - - //Set accesses - unsigned long file_map_access = 0; - unsigned long map_access = 0; - - switch(mode) { - case read_only: - case read_private: - file_map_access |= winapi::page_readonly; - map_access |= winapi::file_map_read; - break; - case read_write: - file_map_access |= winapi::page_readwrite; - map_access |= winapi::file_map_write; - break; - case copy_on_write: - file_map_access |= winapi::page_writecopy; - map_access |= winapi::file_map_copy; - break; - default: - { - error_info err(mode_error); + file_handle_t native_mapping_handle = 0; + + //Set accesses + //For "create_file_mapping" + unsigned long protection = 0; + //For "mapviewoffile" + unsigned long map_access = 0; + + switch(mode) + { + case read_only: + case read_private: + protection |= winapi::page_readonly; + map_access |= winapi::file_map_read; + break; + case read_write: + protection |= winapi::page_readwrite; + map_access |= winapi::file_map_write; + break; + case copy_on_write: + protection |= winapi::page_writecopy; + map_access |= winapi::file_map_copy; + break; + default: + { + error_info err(mode_error); + throw interprocess_exception(err); + } + break; + } + + //For file mapping (including emulated shared memory through temporary files), + //the device is a file handle so we need to obtain file's size and call create_file_mapping + //to obtain the mapping handle. + //For files we don't need the file mapping after mapping the memory, as the file is there + //so we'll program the handle close + void * handle_to_close = winapi::invalid_handle_value; + if(!mhandle.is_shm){ + //Create mapping handle + native_mapping_handle = winapi::create_file_mapping + ( ipcdetail::file_handle_from_mapping_handle(mapping.get_mapping_handle()) + , protection, 0, 0, 0); + + //Check if all is correct + if(!native_mapping_handle){ + error_info err = winapi::get_last_error(); throw interprocess_exception(err); } - break; - } + handle_to_close = native_mapping_handle; + } + else{ + //For windows_shared_memory the device handle is already a mapping handle + //and we need to maintain it + native_mapping_handle = mhandle.handle; + } + //RAII handle close on scope exit + const winapi::handle_closer close_handle(handle_to_close); + (void)close_handle; - if(!mhandle.is_shm){ - //Update mapping size if the user does not specify it + const offset_t page_offset = priv_page_offset_addr_fixup(offset, address); + + //Obtain mapping size if user provides 0 size if(size == 0){ - __int64 total_size; - if(!winapi::get_file_size - (ipcdetail::file_handle_from_mapping_handle - (mapping.get_mapping_handle()), total_size)){ - error_info err(winapi::get_last_error()); + offset_t mapping_size; + if(!winapi::get_file_mapping_size(native_mapping_handle, mapping_size)){ + error_info err = winapi::get_last_error(); throw interprocess_exception(err); } - - if(static_cast(total_size) > - (std::numeric_limits::max)()){ - error_info err(size_error); - throw interprocess_exception(err); - } - size = static_cast(total_size - offset); + //This can throw + priv_size_from_mapping_size(mapping_size, offset, page_offset, size); } - //Create file mapping - native_mapping_handle = - winapi::create_file_mapping - (ipcdetail::file_handle_from_mapping_handle(mapping.get_mapping_handle()), file_map_access, 0, 0, 0, 0); - //Check if all is correct - if(!native_mapping_handle){ + //Map with new offsets and size + void *base = winapi::map_view_of_file_ex + (native_mapping_handle, + map_access, + offset - page_offset, + static_cast(page_offset + size), + const_cast(address)); + //Check error + if(!base){ error_info err = winapi::get_last_error(); - this->priv_close(); throw interprocess_exception(err); } + + //Calculate new base for the user + m_base = static_cast(base) + page_offset; + m_page_offset = page_offset; + m_size = size; } - - //We can't map any offset so we have to obtain system's - //memory granularity - unsigned long granularity = 0; - unsigned long foffset_low; - unsigned long foffset_high; - - winapi::system_info info; - get_system_info(&info); - granularity = info.dwAllocationGranularity; - - //Now we calculate valid offsets - foffset_low = (unsigned long)(offset / granularity) * granularity; - foffset_high = (unsigned long)(((offset / granularity) * granularity) >> 32); - - //We calculate the difference between demanded and valid offset - m_extra_offset = (offset - (offset / granularity) * granularity); - - //Store user values in memory - m_offset = offset; - m_size = size; - - //Update the mapping address - if(address){ - address = static_cast(address) - m_extra_offset; - } - - if(mhandle.is_shm){ - //Windows shared memory needs the duplication of the handle if we want to - //make mapped_region independent from the mappable device - if(!winapi::duplicate_current_process_handle(mhandle.handle, &m_file_mapping_hnd)){ - error_info err = winapi::get_last_error(); - this->priv_close(); - throw interprocess_exception(err); - } - native_mapping_handle = m_file_mapping_hnd; - } - - //Map with new offsets and size - m_base = winapi::map_view_of_file_ex - (native_mapping_handle, - map_access, - foffset_high, - foffset_low, - m_size ? static_cast(m_extra_offset + m_size) : 0, - const_cast(address)); - - if(!mhandle.is_shm){ - //For files we don't need the file mapping anymore - winapi::close_handle(native_mapping_handle); - } - - //Check error - if(!m_base){ + //Windows shared memory needs the duplication of the handle if we want to + //make mapped_region independent from the mappable device + // + //For mapped files, we duplicate the file handle to be able to FlushFileBuffers + if(!winapi::duplicate_current_process_handle(mhandle.handle, &m_file_or_mapping_hnd)){ error_info err = winapi::get_last_error(); this->priv_close(); throw interprocess_exception(err); } - - //Calculate new base for the user - m_base = static_cast(m_base) + m_extra_offset; } -inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes) +inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool async) { - //Check some errors - if(m_base == 0) - return false; - - if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){ + void *addr; + if(!this->priv_flush_param_check(mapping_offset, addr, numbytes)){ return false; } - - //Update flush size if the user does not provide it - if(m_size == 0){ - numbytes = 0; - } - else if(numbytes == 0){ - numbytes = m_size - mapping_offset; - } - //Flush it all - return winapi::flush_view_of_file - (static_cast(m_base)+mapping_offset, - static_cast(numbytes)); + if(!winapi::flush_view_of_file(addr, numbytes)){ + return false; + } + //m_file_or_mapping_hnd can be a file handle or a mapping handle. + //so flushing file buffers has only sense for files... + else if(async && m_file_or_mapping_hnd != winapi::invalid_handle_value && + winapi::get_file_type(m_file_or_mapping_hnd) == winapi::file_type_disk){ + return winapi::flush_file_buffers(m_file_or_mapping_hnd); + } + return true; +} + +inline bool mapped_region::shrink_by(std::size_t bytes, bool from_back) +{ + void *shrink_page_start; + std::size_t shrink_page_bytes; + if(!this->priv_shrink_param_check(bytes, from_back, shrink_page_start, shrink_page_bytes)){ + return false; + } + else if(shrink_page_bytes){ + //In Windows, we can't decommit the storage or release the virtual address space, + //the best we can do is try to remove some memory from the process working set. + //With a bit of luck we can free some physical memory. + unsigned long old_protect_ignored; + bool b_ret = winapi::virtual_unlock(shrink_page_start, shrink_page_bytes) + || (winapi::get_last_error() == winapi::error_not_locked); + (void)old_protect_ignored; + //Change page protection to forbid any further access + b_ret = b_ret && winapi::virtual_protect + (shrink_page_start, shrink_page_bytes, winapi::page_noaccess, old_protect_ignored); + return b_ret; + } + else{ + return true; + } +} + +inline bool mapped_region::advise(advice_types) +{ + //Windows has no madvise/posix_madvise equivalent + return false; } inline void mapped_region::priv_close() { if(m_base){ - winapi::unmap_view_of_file(static_cast(m_base) - m_extra_offset); + void *addr = this->priv_map_address(); + #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + mapped_region::destroy_syncs_in_range<0>(addr, m_size); + #endif + winapi::unmap_view_of_file(addr); m_base = 0; } - #if (defined BOOST_INTERPROCESS_WINDOWS) - if(m_file_mapping_hnd != ipcdetail::invalid_file()){ - winapi::close_handle(m_file_mapping_hnd); - m_file_mapping_hnd = ipcdetail::invalid_file(); - } - #endif + if(m_file_or_mapping_hnd != ipcdetail::invalid_file()){ + winapi::close_handle(m_file_or_mapping_hnd); + m_file_or_mapping_hnd = ipcdetail::invalid_file(); + } } inline void mapped_region::dont_close_on_destruction() @@ -377,7 +546,7 @@ inline void mapped_region::dont_close_on_destruction() #else //#if (defined BOOST_INTERPROCESS_WINDOWS) inline mapped_region::mapped_region() - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(read_only), m_is_xsi(false) {} template @@ -391,7 +560,7 @@ inline mapped_region::mapped_region , offset_t offset , std::size_t size , const void *address) - : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(mode), m_is_xsi(false) + : m_base(0), m_size(0), m_page_offset(0), m_mode(mode), m_is_xsi(false) { mapping_handle_t map_hnd = mapping.get_mapping_handle(); @@ -430,33 +599,36 @@ inline mapped_region::mapped_region } //Update members m_base = base; - m_offset = offset; m_size = size; m_mode = mode; - m_extra_offset = 0; + m_page_offset = 0; m_is_xsi = true; return; } #endif //ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + + //We calculate the difference between demanded and valid offset + const offset_t page_offset = priv_page_offset_addr_fixup(offset, address); + if(size == 0){ struct ::stat buf; if(0 != fstat(map_hnd.handle, &buf)){ error_info err(system_error_code()); throw interprocess_exception(err); } - std::size_t filesize = (std::size_t)buf.st_size; - if((std::size_t)offset >= filesize){ - error_info err(size_error); - throw interprocess_exception(err); - } - - filesize -= offset; - size = filesize; + //This can throw + priv_size_from_mapping_size(buf.st_size, offset, page_offset, size); } //Create new mapping int prot = 0; - int flags = 0; + int flags = + #ifdef MAP_NOSYNC + //Avoid excessive syncing in BSD systems + MAP_NOSYNC; + #else + 0; + #endif switch(mode) { @@ -488,35 +660,23 @@ inline mapped_region::mapped_region break; } - //We calculate the difference between demanded and valid offset - const std::size_t page_size = this->get_page_size(); - const offset_t extra_offset = offset - (offset / page_size) * page_size; - - - //Update the mapping address - if(address){ - address = static_cast(address) - extra_offset; - } - //Map it to the address space void* base = mmap ( const_cast(address) - , static_cast(extra_offset + size) + , static_cast(page_offset + size) , prot , flags , mapping.get_mapping_handle().handle - , offset - extra_offset); + , offset - page_offset); //Check if mapping was successful if(base == MAP_FAILED){ error_info err = system_error_code(); - this->priv_close(); throw interprocess_exception(err); } //Calculate new base for the user - m_base = static_cast(base) + extra_offset; - m_extra_offset = extra_offset; - m_offset = offset; + m_base = static_cast(base) + page_offset; + m_page_offset = page_offset; m_size = size; //Check for fixed mapping error @@ -527,17 +687,107 @@ inline mapped_region::mapped_region } } -inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes) +inline bool mapped_region::shrink_by(std::size_t bytes, bool from_back) { - if(mapping_offset >= m_size || (mapping_offset+numbytes)> m_size){ + void *shrink_page_start = 0; + std::size_t shrink_page_bytes = 0; + if(m_is_xsi || !this->priv_shrink_param_check(bytes, from_back, shrink_page_start, shrink_page_bytes)){ return false; } + else if(shrink_page_bytes){ + //In UNIX we can decommit and free virtual address space. + return 0 == munmap(shrink_page_start, shrink_page_bytes); + } + else{ + return true; + } +} - if(numbytes == 0){ - numbytes = m_size - mapping_offset; +inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbytes, bool async) +{ + void *addr; + if(m_is_xsi || !this->priv_flush_param_check(mapping_offset, addr, numbytes)){ + return false; } //Flush it all - return msync(static_cast(m_base)+mapping_offset, numbytes, MS_ASYNC) == 0; + return msync(addr, numbytes, async ? MS_ASYNC : MS_SYNC) == 0; +} + +inline bool mapped_region::advise(advice_types advice) +{ + int unix_advice = 0; + //Modes; 0: none, 2: posix, 1: madvise + const unsigned int mode_none = 0; + const unsigned int mode_padv = 1; + const unsigned int mode_madv = 2; + unsigned int mode = mode_none; + //Choose advice either from POSIX (preferred) or native Unix + switch(advice){ + case advice_normal: + #if defined(POSIX_MADV_NORMAL) + unix_advice = POSIX_MADV_NORMAL; + mode = mode_padv; + #elif defined(MADV_NORMAL) + unix_advice = MADV_NORMAL; + mode = mode_madv; + #endif + break; + case advice_sequential: + #if defined(POSIX_MADV_SEQUENTIAL) + unix_advice = POSIX_MADV_SEQUENTIAL; + mode = mode_padv; + #elif defined(MADV_SEQUENTIAL) + unix_advice = MADV_SEQUENTIAL; + mode = mode_madv; + #endif + break; + case advice_random: + #if defined(POSIX_MADV_RANDOM) + unix_advice = POSIX_MADV_RANDOM; + mode = mode_padv; + #elif defined(MADV_RANDOM) + unix_advice = MADV_RANDOM; + mode = mode_madv; + #endif + break; + case advice_willneed: + #if defined(POSIX_MADV_WILLNEED) + unix_advice = POSIX_MADV_WILLNEED; + mode = mode_padv; + #elif defined(MADV_WILLNEED) + unix_advice = MADV_WILLNEED; + mode = mode_madv; + #endif + break; + case advice_dontneed: + #if defined(POSIX_MADV_DONTNEED) + unix_advice = POSIX_MADV_DONTNEED; + mode = mode_padv; + #elif defined(MADV_DONTNEED) && defined(BOOST_INTERPROCESS_MADV_DONTNEED_HAS_NONDESTRUCTIVE_SEMANTICS) + unix_advice = MADV_DONTNEED; + mode = mode_madv; + #endif + break; + default: + return false; + } + switch(mode){ + #if defined(POSIX_MADV_NORMAL) + case mode_padv: + return 0 == posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice); + #endif + #if defined(MADV_NORMAL) + case mode_madv: + return 0 == madvise( + #if defined(BOOST_INTERPROCESS_MADVISE_USES_CADDR_T) + (caddr_t) + #endif + this->priv_map_address(), this->priv_map_size(), unix_advice); + #endif + default: + return false; + + } } inline void mapped_region::priv_close() @@ -551,7 +801,7 @@ inline void mapped_region::priv_close() return; } #endif //#ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS - munmap(static_cast(m_base) - m_extra_offset, m_size + m_extra_offset); + munmap(this->priv_map_address(), this->priv_map_size()); m_base = 0; } } @@ -577,11 +827,10 @@ inline void mapped_region::swap(mapped_region &other) { ipcdetail::do_swap(this->m_base, other.m_base); ipcdetail::do_swap(this->m_size, other.m_size); - ipcdetail::do_swap(this->m_offset, other.m_offset); - ipcdetail::do_swap(this->m_extra_offset, other.m_extra_offset); + ipcdetail::do_swap(this->m_page_offset, other.m_page_offset); ipcdetail::do_swap(this->m_mode, other.m_mode); #if (defined BOOST_INTERPROCESS_WINDOWS) - ipcdetail::do_swap(this->m_file_mapping_hnd, other.m_file_mapping_hnd); + ipcdetail::do_swap(this->m_file_or_mapping_hnd, other.m_file_or_mapping_hnd); #else ipcdetail::do_swap(this->m_is_xsi, other.m_is_xsi); #endif @@ -592,6 +841,9 @@ struct null_mapped_region_function { bool operator()(void *, std::size_t , bool) const { return true; } + + std::size_t get_min_size() const + { return 0; } }; /// @endcond @@ -603,3 +855,32 @@ struct null_mapped_region_function #endif //BOOST_INTERPROCESS_MAPPED_REGION_HPP +#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) + +#ifndef BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP +#define BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP + +#if defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) +# include +# include + +namespace boost { +namespace interprocess { + +template +inline void mapped_region::destroy_syncs_in_range(const void *addr, std::size_t size) +{ + ipcdetail::sync_handles &handles = + ipcdetail::windows_intermodule_singleton::get(); + handles.destroy_syncs_in_range(addr, size); +} + +} //namespace interprocess { +} //namespace boost { + +#endif //defined(BOOST_INTERPROCESS_WINDOWS) && !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) + +#endif //#ifdef BOOST_INTERPROCESS_MAPPED_REGION_EXT_HPP + +#endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) + diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp index d609f46ae..a6936ec3d 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,37 @@ namespace boost { namespace interprocess { namespace ipcdetail { +template +class basic_multiallocation_chain + : public boost::container::container_detail:: + basic_multiallocation_chain +{ + BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain) + typedef boost::container::container_detail:: + basic_multiallocation_chain base_t; + public: + + basic_multiallocation_chain() + : base_t() + {} + + basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other) + : base_t(::boost::move(static_cast(other))) + {} + + basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other) + { + this->base_t::operator=(::boost::move(static_cast(other))); + return *this; + } + + void *pop_front() + { + return boost::interprocess::ipcdetail::to_raw_pointer(this->base_t::pop_front()); + } +}; + + //!This class implements several allocation functions shared by different algorithms //!(aligned allocation, multiple allocation...). template @@ -81,15 +113,15 @@ class memory_algorithm_common static size_type multiple_of_units(size_type size) { return get_rounded_size(size, Alignment); } - static multiallocation_chain allocate_many - (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements) + static void allocate_many + (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) { - return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0); + return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0, chain); } - static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain) + static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) { - return this_type::priv_deallocate_many(memory_algo, boost::move(chain)); + return this_type::priv_deallocate_many(memory_algo, chain); } static bool calculate_lcm_and_needs_backwards_lcmed @@ -117,7 +149,7 @@ class memory_algorithm_common lcm_val = max; //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the + //and minbytes if maxbytes can't be achieved, calculate the //biggest of all possibilities current_forward = get_truncated_size_po2(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; @@ -176,7 +208,7 @@ class memory_algorithm_common lcm_val = lcm(max, min); } //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the + //and minbytes if maxbytes can't be achieved, calculate the //biggest of all possibilities current_forward = get_truncated_size(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; @@ -187,19 +219,20 @@ class memory_algorithm_common return true; } - static multiallocation_chain allocate_many + static void allocate_many ( MemoryAlgorithm *memory_algo , const size_type *elem_sizes , size_type n_elements - , size_type sizeof_element) + , size_type sizeof_element + , multiallocation_chain &chain) { - return this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element); + this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element, chain); } static void* allocate_aligned (MemoryAlgorithm *memory_algo, size_type nbytes, size_type alignment) { - + //Ensure power of 2 if ((alignment & (alignment - size_type(1u))) != 0){ //Alignment is not power of two @@ -215,7 +248,7 @@ class memory_algorithm_common if(nbytes > UsableByPreviousChunk) nbytes -= UsableByPreviousChunk; - + //We can find a aligned portion if we allocate a block that has alignment //nbytes + alignment bytes or more. size_type minimum_allocation = max_value @@ -223,13 +256,13 @@ class memory_algorithm_common //Since we will split that block, we must request a bit more memory //if the alignment is near the beginning of the buffer, because otherwise, //there is no space for a new block before the alignment. - // + // // ____ Aligned here // | // ----------------------------------------------------- - // | MBU | + // | MBU | // ----------------------------------------------------- - size_type request = + size_type request = minimum_allocation + (2*MinBlockUnits*Alignment - AllocatedCtrlBytes //prevsize - UsableByPreviousChunk ); @@ -263,7 +296,7 @@ class memory_algorithm_common } //Buffer not aligned, find the aligned part. - // + // // ____ Aligned here // | // ----------------------------------------------------- @@ -324,7 +357,7 @@ class memory_algorithm_common return memory_algo->priv_get_user_buffer(second); } - static bool try_shrink + static bool try_shrink (MemoryAlgorithm *memory_algo, void *ptr ,const size_type max_size, const size_type preferred_size ,size_type &received_size) @@ -361,8 +394,8 @@ class memory_algorithm_common if(old_user_units == preferred_user_units) return true; - size_type shrunk_user_units = - ((BlockCtrlUnits - AllocatedCtrlUnits) > preferred_user_units) + size_type shrunk_user_units = + ((BlockCtrlUnits - AllocatedCtrlUnits) >= preferred_user_units) ? (BlockCtrlUnits - AllocatedCtrlUnits) : preferred_user_units; @@ -380,7 +413,7 @@ class memory_algorithm_common return true; } - static bool shrink + static bool shrink (MemoryAlgorithm *memory_algo, void *ptr ,const size_type max_size, const size_type preferred_size ,size_type &received_size) @@ -389,7 +422,7 @@ class memory_algorithm_common block_ctrl *block = memory_algo->priv_get_block(ptr); size_type old_block_units = (size_type)block->m_size; - if(!try_shrink + if(!try_shrink (memory_algo, ptr, max_size, preferred_size, received_size)){ return false; } @@ -416,11 +449,12 @@ class memory_algorithm_common } private: - static multiallocation_chain priv_allocate_many + static void priv_allocate_many ( MemoryAlgorithm *memory_algo , const size_type *elem_sizes , size_type n_elements - , size_type sizeof_element) + , size_type sizeof_element + , multiallocation_chain &chain) { //Note: sizeof_element == 0 indicates that we want to //allocate n_elements of the same size "*elem_sizes" @@ -436,111 +470,114 @@ class memory_algorithm_common } else{ for(size_type i = 0; i < n_elements; ++i){ + if(multiplication_overflows(elem_sizes[i], sizeof_element)){ + total_request_units = 0; + break; + } elem_units = memory_algo->priv_get_total_units(elem_sizes[i]*sizeof_element); elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; + if(sum_overflows(total_request_units, elem_units)){ + total_request_units = 0; + break; + } total_request_units += elem_units; } } - multiallocation_chain chain; + if(total_request_units && !multiplication_overflows(total_request_units, Alignment)){ + size_type low_idx = 0; + while(low_idx < n_elements){ + size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; + size_type min_allocation = (!sizeof_element) + ? elem_units + : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); + min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type low_idx = 0; - while(low_idx < n_elements){ - size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type min_allocation = (!sizeof_element) - ? elem_units - : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - - size_type received_size; - std::pair ret = memory_algo->priv_allocate - (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0); - if(!ret.first){ - break; - } - - block_ctrl *block = memory_algo->priv_get_block(ret.first); - size_type received_units = (size_type)block->m_size; - char *block_address = reinterpret_cast(block); - - size_type total_used_units = 0; -// block_ctrl *prev_block = 0; - while(total_used_units < received_units){ - if(sizeof_element){ - elem_units = memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; - } - if(total_used_units + elem_units > received_units) + size_type received_size; + std::pair ret = memory_algo->priv_allocate + (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0); + if(!ret.first){ break; - total_request_units -= elem_units; - //This is the position where the new block must be created - block_ctrl *new_block = reinterpret_cast(block_address); - assert_alignment(new_block); + } - //The last block should take all the remaining space - if((low_idx + 1) == n_elements || - (total_used_units + elem_units + - ((!sizeof_element) - ? elem_units - : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units)) - ) > received_units){ - //By default, the new block will use the rest of the buffer - new_block->m_size = received_units - total_used_units; - memory_algo->priv_mark_new_allocated_block(new_block); + block_ctrl *block = memory_algo->priv_get_block(ret.first); + size_type received_units = (size_type)block->m_size; + char *block_address = reinterpret_cast(block); - //If the remaining units are bigger than needed and we can - //split it obtaining a new free memory block do it. - if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){ - size_type shrunk_received; - size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - bool shrink_ok = shrink - (memory_algo - ,memory_algo->priv_get_user_buffer(new_block) - ,shrunk_request - ,shrunk_request - ,shrunk_received); - (void)shrink_ok; - //Shrink must always succeed with passed parameters - BOOST_ASSERT(shrink_ok); - //Some sanity checks - BOOST_ASSERT(shrunk_request == shrunk_received); - BOOST_ASSERT(elem_units == ((shrunk_request-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits)); - //"new_block->m_size" must have been reduced to elem_units by "shrink" - BOOST_ASSERT(new_block->m_size == elem_units); - //Now update the total received units with the reduction - received_units = elem_units + total_used_units; + size_type total_used_units = 0; + while(total_used_units < received_units){ + if(sizeof_element){ + elem_units = memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); + elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; } - } - else{ - new_block->m_size = elem_units; - memory_algo->priv_mark_new_allocated_block(new_block); - } + if(total_used_units + elem_units > received_units) + break; + total_request_units -= elem_units; + //This is the position where the new block must be created + block_ctrl *new_block = reinterpret_cast(block_address); + assert_alignment(new_block); - block_address += new_block->m_size*Alignment; - total_used_units += (size_type)new_block->m_size; - //Check we have enough room to overwrite the intrusive pointer - BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); - void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0); - chain.push_back(p); - ++low_idx; - //prev_block = new_block; + //The last block should take all the remaining space + if((low_idx + 1) == n_elements || + (total_used_units + elem_units + + ((!sizeof_element) + ? elem_units + : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units)) + ) > received_units){ + //By default, the new block will use the rest of the buffer + new_block->m_size = received_units - total_used_units; + memory_algo->priv_mark_new_allocated_block(new_block); + + //If the remaining units are bigger than needed and we can + //split it obtaining a new free memory block do it. + if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){ + size_type shrunk_received; + size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; + bool shrink_ok = shrink + (memory_algo + ,memory_algo->priv_get_user_buffer(new_block) + ,shrunk_request + ,shrunk_request + ,shrunk_received); + (void)shrink_ok; + //Shrink must always succeed with passed parameters + BOOST_ASSERT(shrink_ok); + //Some sanity checks + BOOST_ASSERT(shrunk_request == shrunk_received); + BOOST_ASSERT(elem_units == ((shrunk_request-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits)); + //"new_block->m_size" must have been reduced to elem_units by "shrink" + BOOST_ASSERT(new_block->m_size == elem_units); + //Now update the total received units with the reduction + received_units = elem_units + total_used_units; + } + } + else{ + new_block->m_size = elem_units; + memory_algo->priv_mark_new_allocated_block(new_block); + } + + block_address += new_block->m_size*Alignment; + total_used_units += (size_type)new_block->m_size; + //Check we have enough room to overwrite the intrusive pointer + BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); + void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0); + chain.push_back(p); + ++low_idx; + } + //Sanity check + BOOST_ASSERT(total_used_units == received_units); + } + + if(low_idx != n_elements){ + priv_deallocate_many(memory_algo, chain); } - //Sanity check - BOOST_ASSERT(total_used_units == received_units); } - - if(low_idx != n_elements){ - priv_deallocate_many(memory_algo, boost::move(chain)); - } - return boost::move(chain); } - static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain) + static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) { while(!chain.empty()){ - void *addr = to_raw_pointer(chain.front()); - chain.pop_front(); - memory_algo->priv_deallocate(addr); + memory_algo->priv_deallocate(to_raw_pointer(chain.pop_front())); } } }; diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp index 378cd82fd..1fb95a5bd 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -60,7 +60,7 @@ class simple_seq_fit_impl simple_seq_fit_impl(); simple_seq_fit_impl(const simple_seq_fit_impl &); simple_seq_fit_impl &operator=(const simple_seq_fit_impl &); - + typedef typename boost::intrusive:: pointer_traits::template rebind_pointer::type char_ptr; @@ -93,10 +93,10 @@ class simple_seq_fit_impl public: //!Offset pointer to the next block. block_ctrl_ptr m_next; - //!This block's memory size (including block_ctrl + //!This block's memory size (including block_ctrl //!header) in BasicSize units size_type m_size; - + size_type get_user_bytes() const { return this->m_size*Alignment - BlockCtrlBytes; } @@ -126,7 +126,7 @@ class simple_seq_fit_impl typedef ipcdetail::memory_algorithm_common algo_impl_t; public: - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl) //!offset that the allocator should not use at all. simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes); @@ -145,27 +145,25 @@ class simple_seq_fit_impl /// @cond //!Multiple element allocation, same size - multiallocation_chain - allocate_many(size_type elem_bytes, size_type num_elements) + void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_bytes, num_elements); + algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain); } //!Multiple element allocation, different size - multiallocation_chain - allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element) + void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element); + algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain); } //!Multiple element deallocation - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); /// @endcond @@ -197,12 +195,12 @@ class simple_seq_fit_impl template std::pair allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr = 0); std::pair raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr = 0, size_type sizeof_object = 1); //!Returns the size of the buffer previously allocated pointed by ptr @@ -306,7 +304,7 @@ simple_seq_fit_impl size_type uint_this = (std::size_t)this_ptr; size_type uint_aligned_this = uint_this/Alignment*Alignment; size_type this_disalignment = (uint_this - uint_aligned_this); - size_type block1_off = + size_type block1_off = ipcdetail::get_rounded_size(sizeof(simple_seq_fit_impl) + extra_hdr_bytes + this_disalignment, Alignment) - this_disalignment; algo_impl_t::assert_alignment(this_disalignment + block1_off); @@ -322,7 +320,7 @@ simple_seq_fit_impl size_type uint_this = (std::size_t)this; size_type uint_aligned_this = uint_this/Alignment*Alignment; size_type this_disalignment = (uint_this - uint_aligned_this); - size_type old_end = + size_type old_end = ipcdetail::get_truncated_size(m_header.m_size + this_disalignment, Alignment) - this_disalignment; algo_impl_t::assert_alignment(old_end + this_disalignment); @@ -331,11 +329,11 @@ simple_seq_fit_impl template inline simple_seq_fit_impl:: - simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes) + simple_seq_fit_impl(size_type segment_size, size_type extra_hdr_bytes) { //Initialize sizes and counters m_header.m_allocated = 0; - m_header.m_size = size; + m_header.m_size = segment_size; m_header.m_extra_hdr_bytes = extra_hdr_bytes; //Initialize pointers @@ -344,7 +342,7 @@ inline simple_seq_fit_impl:: m_header.m_root.m_next = reinterpret_cast ((reinterpret_cast(this) + block1_off)); algo_impl_t::assert_alignment(ipcdetail::to_raw_pointer(m_header.m_root.m_next)); - m_header.m_root.m_next->m_size = (size - block1_off)/Alignment; + m_header.m_root.m_next->m_size = (segment_size - block1_off)/Alignment; m_header.m_root.m_next->m_next = &m_header.m_root; } @@ -426,7 +424,7 @@ void simple_seq_fit_impl::shrink_to_fit() (void)addr; BOOST_ASSERT(addr); BOOST_ASSERT(received_size == last_units*Alignment - AllocatedCtrlBytes); - + //Shrink it m_header.m_size /= Alignment; m_header.m_size -= last->m_size; @@ -462,19 +460,19 @@ void *simple_seq_fit_impl:: } template -inline void simple_seq_fit_impl::priv_add_segment(void *addr, size_type size) -{ +inline void simple_seq_fit_impl::priv_add_segment(void *addr, size_type segment_size) +{ algo_impl_t::assert_alignment(addr); //Check size - BOOST_ASSERT(!(size < MinBlockSize)); - if(size < MinBlockSize) + BOOST_ASSERT(!(segment_size < MinBlockSize)); + if(segment_size < MinBlockSize) return; //Construct big block using the new segment block_ctrl *new_block = static_cast(addr); - new_block->m_size = size/Alignment; + new_block->m_size = segment_size/Alignment; new_block->m_next = 0; //Simulate this block was previously allocated - m_header.m_allocated += new_block->m_size*Alignment; + m_header.m_allocated += new_block->m_size*Alignment; //Return block and insert it in the free block list this->priv_deallocate(priv_get_user_buffer(new_block)); } @@ -488,7 +486,7 @@ template inline typename simple_seq_fit_impl::size_type simple_seq_fit_impl::get_free_memory() const { - return m_header.m_size - m_header.m_allocated - + return m_header.m_size - m_header.m_allocated - algo_impl_t::multiple_of_units(sizeof(*this) + m_header.m_extra_hdr_bytes); } @@ -523,7 +521,7 @@ inline void simple_seq_fit_impl::zero_free_memory() //Iterate through all free portions do{ - //Just clear user the memory part reserved for the user + //Just clear user the memory part reserved for the user std::memset( priv_get_user_buffer(block) , 0 , block->get_user_bytes()); @@ -583,19 +581,19 @@ inline void* simple_seq_fit_impl:: template inline void* simple_seq_fit_impl:: allocate_aligned(size_type nbytes, size_type alignment) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- return algo_impl_t:: - allocate_aligned(this, nbytes, alignment); + allocate_aligned(this, nbytes, alignment); } template template inline std::pair simple_seq_fit_impl:: allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr) { std::pair ret = priv_allocation_command @@ -608,7 +606,7 @@ inline std::pair simple_seq_fit_impl:: template inline std::pair simple_seq_fit_impl:: raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects, - size_type preferred_objects,size_type &received_objects, + size_type preferred_objects,size_type &received_objects, void *reuse_ptr, size_type sizeof_object) { if(!sizeof_object) @@ -627,7 +625,7 @@ inline std::pair simple_seq_fit_impl:: template inline std::pair simple_seq_fit_impl:: priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size, size_type &received_size, + size_type preferred_size, size_type &received_size, void *reuse_ptr, size_type sizeof_object) { command &= ~boost::interprocess::expand_bwd; @@ -653,8 +651,7 @@ inline std::pair simple_seq_fit_impl:: template inline typename simple_seq_fit_impl::size_type -simple_seq_fit_impl:: - size(const void *ptr) const +simple_seq_fit_impl::size(const void *ptr) const { //We need no synchronization since this block is not going //to be modified @@ -696,9 +693,9 @@ void* simple_seq_fit_impl:: return 0; } - size_type needs_backwards = + size_type needs_backwards = ipcdetail::get_rounded_size(preferred_size - extra_forward, Alignment); - + if(!only_preferred_backwards){ max_value(ipcdetail::get_rounded_size(min_size - extra_forward, Alignment) ,min_value(prev->get_user_bytes(), needs_backwards)); @@ -710,16 +707,16 @@ void* simple_seq_fit_impl:: if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){ BOOST_ASSERT(0); } - + //We need a minimum size to split the previous one if((prev->get_user_bytes() - needs_backwards) > 2*BlockCtrlBytes){ block_ctrl *new_block = reinterpret_cast (reinterpret_cast(reuse) - needs_backwards - BlockCtrlBytes); new_block->m_next = 0; - new_block->m_size = + new_block->m_size = BlockCtrlUnits + (needs_backwards + extra_forward)/Alignment; - prev->m_size = + prev->m_size = (prev->get_total_bytes() - needs_backwards)/Alignment - BlockCtrlUnits; received_size = needs_backwards + extra_forward; m_header.m_allocated += needs_backwards + BlockCtrlBytes; @@ -744,15 +741,13 @@ void* simple_seq_fit_impl:: template inline void simple_seq_fit_impl:: - deallocate_many(typename simple_seq_fit_impl::multiallocation_chain chain) + deallocate_many(typename simple_seq_fit_impl::multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- while(!chain.empty()){ - void *addr = chain.front(); - chain.pop_front(); - this->priv_deallocate(addr); + this->priv_deallocate(to_raw_pointer(chain.pop_front())); } } @@ -775,7 +770,7 @@ std::pair simple_seq_fit_impl:: ,void *reuse_ptr) { if(command & boost::interprocess::shrink_in_place){ - bool success = + bool success = algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size); return std::pair ((success ? reuse_ptr : 0), true); } @@ -885,7 +880,7 @@ inline typename simple_seq_fit_impl::block_ctrl * } template -inline +inline std::pair::block_ctrl * ,typename simple_seq_fit_impl::block_ctrl *> simple_seq_fit_impl:: @@ -969,7 +964,7 @@ inline bool simple_seq_fit_impl:: //We can fill expand. Merge both blocks, block->m_next = next_block->m_next; block->m_size = merged_size; - + //Find the previous free block of next_block block_ctrl *prev = &m_header.m_root; while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){ @@ -978,7 +973,7 @@ inline bool simple_seq_fit_impl:: //Now insert merged block in the free list //This allows reusing allocation logic in this function - m_header.m_allocated -= old_block_size*Alignment; + m_header.m_allocated -= old_block_size*Alignment; prev->m_next = block; //Now use check and allocate to do the allocation logic @@ -992,7 +987,7 @@ inline bool simple_seq_fit_impl:: BOOST_ASSERT(0); return false; } - return true; + return true; } template inline @@ -1006,7 +1001,7 @@ void* simple_seq_fit_impl::priv_check_and_allocate bool found = false; if (block->m_size > upper_nunits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first's size will be "units" //the second's size will be "block->m_size-units" size_type total_size = block->m_size; @@ -1057,7 +1052,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Let's get free block list. List is always sorted //by memory address to allow block merging. - //Pointer next always points to the first + //Pointer next always points to the first //(lower address) block block_ctrl * prev = &m_header.m_root; block_ctrl * pos = ipcdetail::to_raw_pointer(m_header.m_root.m_next); @@ -1071,9 +1066,9 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) size_type total_size = Alignment*block->m_size; BOOST_ASSERT(m_header.m_allocated >= total_size); - + //Update used memory count - m_header.m_allocated -= total_size; + m_header.m_allocated -= total_size; //Let's find the previous and the next block of the block to deallocate //This ordering comparison must be done with original pointers @@ -1087,7 +1082,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Try to combine with upper block char *block_char_ptr = reinterpret_cast(ipcdetail::to_raw_pointer(block)); - if ((block_char_ptr + Alignment*block->m_size) == + if ((block_char_ptr + Alignment*block->m_size) == reinterpret_cast(ipcdetail::to_raw_pointer(pos))){ block->m_size += pos->m_size; block->m_next = pos->m_next; @@ -1098,7 +1093,7 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) //Try to combine with lower block if ((reinterpret_cast(ipcdetail::to_raw_pointer(prev)) - + Alignment*prev->m_size) == + + Alignment*prev->m_size) == block_char_ptr){ diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp index f6f0c03a1..7853ede8e 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/rbtree_best_fit.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -88,8 +88,7 @@ class rbtree_best_fit typedef MutexFamily mutex_family; //!Pointer type to be used with the rest of the Interprocess framework typedef VoidPointer void_pointer; - typedef boost::container::container_detail:: - basic_multiallocation_chain multiallocation_chain; + typedef ipcdetail::basic_multiallocation_chain multiallocation_chain; typedef typename boost::intrusive::pointer_traits::difference_type difference_type; typedef typename boost::make_unsigned::type size_type; @@ -105,7 +104,7 @@ class rbtree_best_fit struct SizeHolder { - //!This block's memory size (including block_ctrl + //!This block's memory size (including block_ctrl //!header) in Alignment units size_type m_prev_size : sizeof(size_type)*CHAR_BIT; size_type m_size : sizeof(size_type)*CHAR_BIT - 2; @@ -132,7 +131,7 @@ class rbtree_best_fit { return size < block.m_size; } bool operator()(const block_ctrl &block, size_type size) const - { return block.m_size < size; } + { return block.m_size < size; } }; //!Shared mutex to protect memory allocate/deallocate @@ -157,13 +156,13 @@ class rbtree_best_fit } m_header; friend class ipcdetail::memory_algorithm_common; - + typedef ipcdetail::memory_algorithm_common algo_impl_t; public: /// @endcond - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit) //!offset that the allocator should not use at all. rbtree_best_fit (size_type size, size_type extra_hdr_bytes); @@ -184,27 +183,25 @@ class rbtree_best_fit //Experimental. Dont' use //!Multiple element allocation, same size - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) + void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain) { - //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_bytes, num_elements); + algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain); } //!Multiple element allocation, different size - multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element) + void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { - //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element); + algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain); } //!Multiple element allocation, different size - void deallocate_many(multiallocation_chain chain); + void deallocate_many(multiallocation_chain &chain); /// @endcond @@ -238,12 +235,12 @@ class rbtree_best_fit template std::pair allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr = 0); std::pair raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object, - size_type preferred_object,size_type &received_object, + size_type preferred_object,size_type &received_object, void *reuse_ptr = 0, size_type sizeof_object = 1); //!Returns the size of the buffer previously allocated pointed by ptr @@ -263,7 +260,7 @@ class rbtree_best_fit std::pair priv_allocation_command(boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr, size_type sizeof_object); @@ -339,7 +336,7 @@ class rbtree_best_fit void priv_add_segment(void *addr, size_type size); public: - + static const size_type Alignment = !MemAlignment ? size_type(::boost::alignment_of< ::boost::detail::max_align>::value) : size_type(MemAlignment) @@ -370,7 +367,7 @@ class rbtree_best_fit /// @cond template -inline typename rbtree_best_fit::size_type +inline typename rbtree_best_fit::size_type rbtree_best_fit ::priv_first_block_offset_from_this(const void *this_ptr, size_type extra_hdr_bytes) { @@ -385,29 +382,29 @@ inline typename rbtree_best_fit::size_ty template void rbtree_best_fit:: - priv_add_segment(void *addr, size_type size) -{ + priv_add_segment(void *addr, size_type segment_size) +{ //Check alignment algo_impl_t::check_alignment(addr); //Check size - BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes)); + BOOST_ASSERT(segment_size >= (BlockCtrlBytes + EndCtrlBlockBytes)); //Initialize the first big block and the "end" node block_ctrl *first_big_block = new(addr)block_ctrl; - first_big_block->m_size = size/Alignment - EndCtrlBlockUnits; + first_big_block->m_size = segment_size/Alignment - EndCtrlBlockUnits; BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits); //The "end" node is just a node of size 0 with the "end" bit set - block_ctrl *end_block = static_cast + block_ctrl *end_block = static_cast (new (reinterpret_cast(addr) + first_big_block->m_size*Alignment)SizeHolder); //This will overwrite the prev part of the "end" node priv_mark_as_free_block (first_big_block); #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - first_big_block->m_prev_size = end_block->m_size = + first_big_block->m_prev_size = end_block->m_size = (reinterpret_cast(first_big_block) - reinterpret_cast(end_block))/Alignment; #else - first_big_block->m_prev_size = end_block->m_size = + first_big_block->m_prev_size = end_block->m_size = (reinterpret_cast(end_block) - reinterpret_cast(first_big_block))/Alignment; #endif end_block->m_allocated = 1; @@ -444,25 +441,25 @@ inline typename rbtree_best_fit::block_c { size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); const size_type original_first_block_size = m_header.m_size/Alignment*Alignment - block1_off/Alignment*Alignment - EndCtrlBlockBytes; - block_ctrl *end_block = reinterpret_cast + block_ctrl *end_block = reinterpret_cast (reinterpret_cast(this) + block1_off + original_first_block_size); return end_block; } template inline rbtree_best_fit:: - rbtree_best_fit(size_type size, size_type extra_hdr_bytes) + rbtree_best_fit(size_type segment_size, size_type extra_hdr_bytes) { //Initialize the header m_header.m_allocated = 0; - m_header.m_size = size; + m_header.m_size = segment_size; m_header.m_extra_hdr_bytes = extra_hdr_bytes; //Now write calculate the offset of the first big block that will //cover the whole segment - BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size); + BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= segment_size); size_type block1_off = priv_first_block_offset_from_this(this, extra_hdr_bytes); - priv_add_segment(reinterpret_cast(this) + block1_off, size - block1_off); + priv_add_segment(reinterpret_cast(this) + block1_off, segment_size - block1_off); } template @@ -479,7 +476,7 @@ void rbtree_best_fit::grow(size_type ext //Get the address of the first block block_ctrl *first_block = priv_first_block(); block_ctrl *old_end_block = priv_end_block(); - size_type old_border_offset = (size_type)(reinterpret_cast(old_end_block) - + size_type old_border_offset = (size_type)(reinterpret_cast(old_end_block) - reinterpret_cast(this)) + EndCtrlBlockBytes; //Update managed buffer's size @@ -500,10 +497,10 @@ void rbtree_best_fit::grow(size_type ext //between them new_end_block->m_allocated = 1; #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - new_end_block->m_size = (reinterpret_cast(first_block) - + new_end_block->m_size = (reinterpret_cast(first_block) - reinterpret_cast(new_end_block))/Alignment; #else - new_end_block->m_size = (reinterpret_cast(new_end_block) - + new_end_block->m_size = (reinterpret_cast(new_end_block) - reinterpret_cast(first_block))/Alignment; #endif first_block->m_prev_size = new_end_block->m_size; @@ -512,7 +509,7 @@ void rbtree_best_fit::grow(size_type ext //The old end block is the new block block_ctrl *new_block = old_end_block; - new_block->m_size = (reinterpret_cast(new_end_block) - + new_block->m_size = (reinterpret_cast(new_end_block) - reinterpret_cast(new_block))/Alignment; BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_as_allocated_block(new_block); @@ -568,18 +565,18 @@ void rbtree_best_fit::shrink_to_fit() //Erase block from the free tree, since we will erase it m_header.m_imultiset.erase(Imultiset::s_iterator_to(*last_block)); - size_type shrunk_border_offset = (size_type)(reinterpret_cast(last_block) - + size_type shrunk_border_offset = (size_type)(reinterpret_cast(last_block) - reinterpret_cast(this)) + EndCtrlBlockBytes; - + block_ctrl *new_end_block = last_block; algo_impl_t::assert_alignment(new_end_block); //Write new end block attributes #ifdef BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP - new_end_block->m_size = first_block->m_prev_size = + new_end_block->m_size = first_block->m_prev_size = (reinterpret_cast(first_block) - reinterpret_cast(new_end_block))/Alignment; #else - new_end_block->m_size = first_block->m_prev_size = + new_end_block->m_size = first_block->m_prev_size = (reinterpret_cast(new_end_block) - reinterpret_cast(first_block))/Alignment; #endif @@ -604,7 +601,7 @@ template typename rbtree_best_fit::size_type rbtree_best_fit::get_free_memory() const { - return m_header.m_size - m_header.m_allocated - + return m_header.m_size - m_header.m_allocated - priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); } @@ -614,7 +611,7 @@ rbtree_best_fit:: get_min_size (size_type extra_hdr_bytes) { return (algo_impl_t::ceil_units(sizeof(rbtree_best_fit)) + - algo_impl_t::ceil_units(extra_hdr_bytes) + + algo_impl_t::ceil_units(extra_hdr_bytes) + MinBlockUnits + EndCtrlBlockUnits)*Alignment; } @@ -625,13 +622,13 @@ inline bool rbtree_best_fit:: //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - size_type block1_off = + size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); - return m_header.m_allocated == 0 && + return m_header.m_allocated == 0 && m_header.m_imultiset.begin() != m_header.m_imultiset.end() && (++m_header.m_imultiset.begin()) == m_header.m_imultiset.end() - && m_header.m_imultiset.begin()->m_size == + && m_header.m_imultiset.begin()->m_size == (m_header.m_size - block1_off - EndCtrlBlockBytes)/Alignment; } @@ -659,7 +656,7 @@ bool rbtree_best_fit:: return false; } - size_type block1_off = + size_type block1_off = priv_first_block_offset_from_this(this, m_header.m_extra_hdr_bytes); //Check free bytes are less than size @@ -672,7 +669,7 @@ bool rbtree_best_fit:: template inline void* rbtree_best_fit:: allocate(size_type nbytes) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- @@ -684,18 +681,18 @@ inline void* rbtree_best_fit:: template inline void* rbtree_best_fit:: allocate_aligned(size_type nbytes, size_type alignment) -{ +{ //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - return algo_impl_t::allocate_aligned(this, nbytes, alignment); + return algo_impl_t::allocate_aligned(this, nbytes, alignment); } template template inline std::pair rbtree_best_fit:: allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, T *reuse_ptr) { std::pair ret = priv_allocation_command @@ -708,7 +705,7 @@ inline std::pair rbtree_best_fit inline std::pair rbtree_best_fit:: raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects, - size_type preferred_objects,size_type &received_objects, + size_type preferred_objects,size_type &received_objects, void *reuse_ptr, size_type sizeof_object) { if(!sizeof_object) @@ -728,7 +725,7 @@ inline std::pair rbtree_best_fit inline std::pair rbtree_best_fit:: priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size, - size_type preferred_size,size_type &received_size, + size_type preferred_size,size_type &received_size, void *reuse_ptr, size_type sizeof_object) { std::pair ret; @@ -815,7 +812,7 @@ void* rbtree_best_fit:: //Obtain the real size of the block block_ctrl *reuse = priv_get_block(reuse_ptr); - //Sanity check + //Sanity check //BOOST_ASSERT(reuse->m_size == priv_tail_size(reuse)); algo_impl_t::assert_alignment(reuse); @@ -859,12 +856,12 @@ void* rbtree_best_fit:: (reinterpret_cast(reuse) - needs_backwards_aligned); //Free old previous buffer - new_block->m_size = + new_block->m_size = AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment; BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_as_allocated_block(new_block); - prev_block->m_size = (reinterpret_cast(new_block) - + prev_block->m_size = (reinterpret_cast(new_block) - reinterpret_cast(prev_block))/Alignment; BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits); priv_mark_as_free_block(prev_block); @@ -875,7 +872,7 @@ void* rbtree_best_fit:: { imultiset_iterator prev_block_it(Imultiset::s_iterator_to(*prev_block)); imultiset_iterator was_smaller_it(prev_block_it); - if(prev_block_it != m_header.m_imultiset.begin() && + if(prev_block_it != m_header.m_imultiset.begin() && (--(was_smaller_it = prev_block_it))->m_size > prev_block->m_size){ m_header.m_imultiset.erase(prev_block_it); m_header.m_imultiset.insert(m_header.m_imultiset.begin(), *prev_block); @@ -884,7 +881,7 @@ void* rbtree_best_fit:: received_size = needs_backwards_aligned + received_size; m_header.m_allocated += needs_backwards_aligned; - + //Check alignment algo_impl_t::assert_alignment(new_block); @@ -930,12 +927,12 @@ void* rbtree_best_fit:: template inline void rbtree_best_fit:: - deallocate_many(typename rbtree_best_fit::multiallocation_chain chain) + deallocate_many(typename rbtree_best_fit::multiallocation_chain &chain) { //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - algo_impl_t::deallocate_many(this, boost::move(chain)); + algo_impl_t::deallocate_many(this, chain); } template @@ -951,7 +948,7 @@ std::pair rbtree_best_fit: //command &= (~boost::interprocess::expand_bwd); if(command & boost::interprocess::shrink_in_place){ - bool success = + bool success = algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size); return std::pair ((success ? reuse_ptr : 0), true); } @@ -1044,7 +1041,7 @@ bool rbtree_best_fit:: //The block must be marked as allocated and the sizes must be equal BOOST_ASSERT(priv_is_allocated_block(block)); //BOOST_ASSERT(old_block_units == priv_tail_size(block)); - + //Put this to a safe value received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk; if(received_size >= preferred_size || received_size >= min_size) @@ -1084,7 +1081,7 @@ bool rbtree_best_fit:: //Check if we can split the next one in two parts if((merged_units - intended_units) >= BlockCtrlUnits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first one will be merged and //the second's size will be the remaining space BOOST_ASSERT(next_block->m_size == priv_next_block(next_block)->m_prev_size); @@ -1098,9 +1095,9 @@ bool rbtree_best_fit:: //overwrite the tree hook of the old next block. So we first erase the //old if needed and we'll insert the new one after creating the new next imultiset_iterator old_next_block_it(Imultiset::s_iterator_to(*next_block)); - const bool size_invariants_broken = + const bool size_invariants_broken = (next_block->m_size - rem_units ) < BlockCtrlUnits || - (old_next_block_it != m_header.m_imultiset.begin() && + (old_next_block_it != m_header.m_imultiset.begin() && (--imultiset_iterator(old_next_block_it))->m_size > rem_units); if(size_invariants_broken){ m_header.m_imultiset.erase(old_next_block_it); @@ -1267,7 +1264,7 @@ void* rbtree_best_fit::priv_check_and_al algo_impl_t::assert_alignment(block); if (block->m_size >= upper_nunits){ - //This block is bigger than needed, split it in + //This block is bigger than needed, split it in //two blocks, the first's size will be "units" and //the second's size "block->m_size-units" size_type block_old_size = block->m_size; @@ -1298,7 +1295,7 @@ void* rbtree_best_fit::priv_check_and_al m_header.m_imultiset.erase(it_old); m_header.m_imultiset.insert(m_header.m_imultiset.begin(), *rem_block); } - + } else if (block->m_size >= nunits){ m_header.m_imultiset.erase(it_old); @@ -1318,9 +1315,9 @@ void* rbtree_best_fit::priv_check_and_al //Clear the memory occupied by the tree hook, since this won't be //cleared with zero_free_memory TreeHook *t = static_cast(block); - //Just clear the memory part reserved for the user + //Just clear the memory part reserved for the user std::size_t tree_hook_offset_in_block = (char*)t - (char*)block; - //volatile char *ptr = + //volatile char *ptr = char *ptr = reinterpret_cast(block)+tree_hook_offset_in_block; const std::size_t s = BlockCtrlBytes - tree_hook_offset_in_block; std::memset(ptr, 0, s); @@ -1344,7 +1341,7 @@ void rbtree_best_fit::priv_deallocate(vo if(!addr) return; block_ctrl *block = priv_get_block(addr); - + //The blocks must be marked as allocated and the sizes must be equal BOOST_ASSERT(priv_is_allocated_block(block)); // BOOST_ASSERT(block->m_size == priv_tail_size(block)); diff --git a/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp b/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp index 5cc92c110..ba50c166e 100644 --- a/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp +++ b/project/jni/boost/include/boost/interprocess/mem_algo/simple_seq_fit.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -31,7 +31,7 @@ namespace interprocess { //!This class implements the simple sequential fit algorithm with a simply //!linked list of free buffers. template -class simple_seq_fit +class simple_seq_fit : public ipcdetail::simple_seq_fit_impl { /// @cond @@ -41,11 +41,11 @@ class simple_seq_fit public: typedef typename base_t::size_type size_type; - //!Constructor. "size" is the total size of the managed memory segment, + //!Constructor. "size" is the total size of the managed memory segment, //!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit) //!offset that the allocator should not use at all.*/ - simple_seq_fit (size_type size, size_type extra_hdr_bytes) - : base_t(size, extra_hdr_bytes){} + simple_seq_fit(size_type segment_size, size_type extra_hdr_bytes) + : base_t(segment_size, extra_hdr_bytes){} }; } //namespace interprocess { diff --git a/project/jni/boost/include/boost/interprocess/offset_ptr.hpp b/project/jni/boost/include/boost/interprocess/offset_ptr.hpp index 4187543d5..752c43586 100644 --- a/project/jni/boost/include/boost/interprocess/offset_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/offset_ptr.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -44,6 +44,175 @@ struct has_trivial_destructor; namespace interprocess { +/// @cond +namespace ipcdetail { + + template + union offset_ptr_internal + { + explicit offset_ptr_internal(OffsetType off) + : m_offset(off) + {} + OffsetType m_offset; //Distance between this object and pointee address + typename ::boost::aligned_storage + < sizeof(OffsetType) + , (OffsetAlignment == offset_type_alignment) ? + ::boost::alignment_of::value : OffsetAlignment + >::type alignment_helper; + }; + + //Note: using the address of a local variable to point to another address + //is not standard conforming and this can be optimized-away by the compiler. + //Non-inlining is a method to remain illegal but correct + + //Undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_XXX if your compiler can inline + //this code without breaking the library + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_raw_pointer + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + void * offset_ptr_to_raw_pointer(const volatile void *this_ptr, std::size_t offset) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + if(offset == 1){ + return 0; + } + else{ + caster_t caster((void*)this_ptr); + return caster_t(caster.size() + offset).pointer(); + } + #else + caster_t caster((void*)this_ptr); + return caster_t((caster.size() + offset) & -std::size_t(offset != 1)).pointer(); + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + #endif + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_offset + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + //Branchless seems slower in x86 + //#define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + std::size_t offset_ptr_to_offset(const volatile void *ptr, const volatile void *this_ptr) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + //offset == 1 && ptr != 0 is not legal for this pointer + if(!ptr){ + return 1; + } + else{ + caster_t this_caster((void*)this_ptr); + caster_t ptr_caster((void*)ptr); + std::size_t offset = ptr_caster.size() - this_caster.size(); + BOOST_ASSERT(offset != 1); + return offset; + } + #else + caster_t this_caster((void*)this_ptr); + caster_t ptr_caster((void*)ptr); + std::size_t offset = (ptr_caster.size() - this_caster.size() - 1) & -std::size_t(ptr != 0); + ++offset; + return offset; + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF + #endif + + //////////////////////////////////////////////////////////////////////// + // + // offset_ptr_to_offset_from_other + // + //////////////////////////////////////////////////////////////////////// + #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + //Branchless seems slower in x86 + //#define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + + template + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + BOOST_INTERPROCESS_NEVER_INLINE + #elif defined(NDEBUG) + inline + #endif + std::size_t offset_ptr_to_offset_from_other + (const volatile void *this_ptr, const volatile void *other_ptr, std::size_t other_offset) + { + typedef pointer_size_t_caster caster_t; + #ifndef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + if(other_offset == 1){ + return 1; + } + else{ + caster_t this_caster((void*)this_ptr); + caster_t other_caster((void*)other_ptr); + std::size_t offset = other_caster.size() - this_caster.size() + other_offset; + BOOST_ASSERT(offset != 1); + return offset; + } + #else + caster_t this_caster((void*)this_ptr); + caster_t other_caster((void*)other_ptr); + std::size_t offset = (other_caster.size() - this_caster.size()) & -std::size_t(other_offset != 1); + offset += other_offset; + return offset; + #endif + } + + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + #undef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER + #endif + #ifdef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + #undef BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_OFF_FROM_OTHER + #endif + + //////////////////////////////////////////////////////////////////////// + // + // Let's assume cast to void and cv cast don't change any target address + // + //////////////////////////////////////////////////////////////////////// + template + struct offset_ptr_maintains_address + { + static const bool value = ipcdetail::is_cv_same::value + || ipcdetail::is_cv_same::value; + }; + +} //namespace ipcdetail { +/// @endcond + //!A smart pointer that stores the offset between between the pointer and the //!the object it points. This allows offset allows special properties, since //!the pointer is independent from the address address of the pointee, if the @@ -74,69 +243,111 @@ class offset_ptr public: //Public Functions + //!Default constructor (null pointer). + //!Never throws. + offset_ptr() + : internal(1) + {} + //!Constructor from raw pointer (allows "0" pointer conversion). //!Never throws. - offset_ptr(pointer ptr = 0) { this->set_offset(ptr); } + offset_ptr(pointer ptr) + : internal(static_cast(ipcdetail::offset_ptr_to_offset<0>(ptr, this))) + {} //!Constructor from other pointer. //!Never throws. template offset_ptr( T *ptr - , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) - { this->set_offset(static_cast(ptr)); } + , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr), this))) + {} //!Constructor from other offset_ptr //!Never throws. - offset_ptr(const offset_ptr& ptr) - { this->set_offset(ptr.get()); } + offset_ptr(const offset_ptr& ptr) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.internal.m_offset))) + {} - //!Constructor from other offset_ptr. If pointers of pointee types are + //!Constructor from other offset_ptr. If pointers of pointee types are //!convertible, offset_ptrs will be convertibles. Never throws. - template - offset_ptr( const offset_ptr &ptr - , typename ipcdetail::enable_if< ipcdetail::is_convertible >::type * = 0) - { this->set_offset(static_cast(ptr.get())); } + template + offset_ptr( const offset_ptr &ptr + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + , typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && ipcdetail::offset_ptr_maintains_address::value + >::type * = 0 + #endif + ) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.get_offset()))) + {} + + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + + //!Constructor from other offset_ptr. If pointers of pointee types are + //!convertible, offset_ptrs will be convertibles. Never throws. + template + offset_ptr( const offset_ptr &ptr + , typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && !ipcdetail::offset_ptr_maintains_address::value + >::type * = 0) + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr.get()), this))) + {} + + #endif //!Emulates static_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::static_cast_tag) - { this->set_offset(static_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(static_cast(r.get()), this))) + {} //!Emulates const_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::const_cast_tag) - { this->set_offset(const_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(const_cast(r.get()), this))) + {} //!Emulates dynamic_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::dynamic_cast_tag) - { this->set_offset(dynamic_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(dynamic_cast(r.get()), this))) + {} //!Emulates reinterpret_cast operator. //!Never throws. template offset_ptr(const offset_ptr & r, ipcdetail::reinterpret_cast_tag) - { this->set_offset(reinterpret_cast(r.get())); } + : internal(static_cast + (ipcdetail::offset_ptr_to_offset<0>(reinterpret_cast(r.get()), this))) + {} //!Obtains raw pointer from offset. //!Never throws. - pointer get()const - { return this->to_raw_pointer(); } + pointer get() const + { return (pointer)ipcdetail::offset_ptr_to_raw_pointer<0>(this, this->internal.m_offset); } offset_type get_offset() const - { return internal.m_offset; } + { return this->internal.m_offset; } //!Pointer-like -> operator. It can return 0 pointer. //!Never throws. - pointer operator->() const + pointer operator->() const { return this->get(); } - //!Dereferencing operator, if it is a null offset_ptr behavior + //!Dereferencing operator, if it is a null offset_ptr behavior //! is undefined. Never throws. - reference operator* () const + reference operator* () const { pointer p = this->get(); reference r = *p; @@ -145,27 +356,57 @@ class offset_ptr //!Indexing operator. //!Never throws. - template - reference operator[](T idx) const + reference operator[](difference_type idx) const { return this->get()[idx]; } //!Assignment from pointer (saves extra conversion). //!Never throws. offset_ptr& operator= (pointer from) - { this->set_offset(from); return *this; } + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset<0>(from, this)); + return *this; + } //!Assignment from other offset_ptr. //!Never throws. - offset_ptr& operator= (const offset_ptr & pt) - { pointer p(pt.get()); (void)p; this->set_offset(p); return *this; } + offset_ptr& operator= (const offset_ptr & ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.internal.m_offset)); + return *this; + } - //!Assignment from related offset_ptr. If pointers of pointee types + //!Assignment from related offset_ptr. If pointers of pointee types //! are assignable, offset_ptrs will be assignable. Never throws. - template - typename ipcdetail::enable_if, offset_ptr&>::type - operator= (const offset_ptr & ptr) - { this->set_offset(static_cast(ptr.get())); return *this; } - + template + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + typename ipcdetail::enable_if_c< ipcdetail::is_convertible::value + && ipcdetail::offset_ptr_maintains_address::value + , offset_ptr&>::type + #else + offset_ptr& + #endif + operator= (const offset_ptr &ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset_from_other<0>(this, &ptr, ptr.get_offset())); + return *this; + } + + #ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED + template + typename ipcdetail::enable_if_c::value + && !ipcdetail::offset_ptr_maintains_address::value + , offset_ptr&>::type + operator= (const offset_ptr &ptr) + { + this->internal.m_offset = + static_cast(ipcdetail::offset_ptr_to_offset<0>(static_cast(ptr.get()), this)); + return *this; + } + #endif + //!offset_ptr += difference_type. //!Never throws. offset_ptr &operator+= (difference_type offset) @@ -173,39 +414,46 @@ class offset_ptr //!offset_ptr -= difference_type. //!Never throws. - template - offset_ptr &operator-= (T offset) + offset_ptr &operator-= (difference_type offset) { this->dec_offset(offset * sizeof (PointedType)); return *this; } //!++offset_ptr. //!Never throws. - offset_ptr& operator++ (void) + offset_ptr& operator++ (void) { this->inc_offset(sizeof (PointedType)); return *this; } //!offset_ptr++. //!Never throws. offset_ptr operator++ (int) - { offset_ptr temp(*this); ++*this; return temp; } + { + offset_ptr tmp(*this); + this->inc_offset(sizeof (PointedType)); + return tmp; + } //!--offset_ptr. //!Never throws. - offset_ptr& operator-- (void) + offset_ptr& operator-- (void) { this->dec_offset(sizeof (PointedType)); return *this; } //!offset_ptr--. //!Never throws. offset_ptr operator-- (int) - { offset_ptr temp(*this); --*this; return temp; } + { + offset_ptr tmp(*this); + this->dec_offset(sizeof (PointedType)); + return tmp; + } //!safe bool conversion operator. //!Never throws. - operator unspecified_bool_type() const - { return this->get()? &self_t::unspecified_bool_type_func : 0; } + operator unspecified_bool_type() const + { return this->internal.m_offset != 1? &self_t::unspecified_bool_type_func : 0; } - //!Not operator. Not needed in theory, but improves portability. + //!Not operator. Not needed in theory, but improves portability. //!Never throws bool operator! () const - { return this->get() == 0; } + { return this->internal.m_offset == 1; } //!Compatibility with pointer_traits //! @@ -220,23 +468,23 @@ class offset_ptr //!difference_type + offset_ptr //!operation - friend offset_ptr operator+(difference_type diff, const offset_ptr& right) - { offset_ptr tmp(right); tmp += diff; return tmp; } + friend offset_ptr operator+(difference_type diff, offset_ptr right) + { right += diff; return right; } //!offset_ptr + difference_type //!operation - friend offset_ptr operator+(const offset_ptr& left, difference_type diff) - { offset_ptr tmp(left); tmp += diff; return tmp; } + friend offset_ptr operator+(offset_ptr left, difference_type diff) + { left += diff; return left; } //!offset_ptr - diff //!operation - friend offset_ptr operator-(const offset_ptr &left, difference_type diff) - { offset_ptr tmp(left); tmp -= diff; return tmp; } + friend offset_ptr operator-(offset_ptr left, difference_type diff) + { left -= diff; return left; } //!offset_ptr - diff //!operation - friend offset_ptr operator-(difference_type diff, const offset_ptr &right) - { offset_ptr tmp(right); tmp -= diff; return tmp; } + friend offset_ptr operator-(difference_type diff, offset_ptr right) + { right -= diff; return right; } //!offset_ptr - offset_ptr //!operation @@ -309,114 +557,64 @@ class offset_ptr private: /// @cond - - //Note: using the address of a local variable to point to another address - //is not standard conforming and this can be optimized-away by the compiler. - //Non-inlining is a method to remain illegal and correct - #if defined(_MSC_VER) - __declspec(noinline) //this workaround is needed for MSVC compilers - #elif defined (__GNUC__)//this workaround is needed for GCC - __attribute__((__noinline__)) - #endif - void set_offset(const PointedType *ptr) - { - #if defined (__GNUC__) - //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect") - #endif - //offset == 1 && ptr != 0 is not legal for this pointer - if(!ptr){ - internal.m_offset = 1; - } - else{ - internal.m_offset = (OffsetType)((const char*)ptr - (const char*)(this)); - BOOST_ASSERT(internal.m_offset != 1); - } - } - - #if defined(_MSC_VER) && (_MSC_VER >= 1400) - __declspec(noinline) - #elif defined (__GNUC__) - __attribute__((__noinline__)) - #endif - PointedType * to_raw_pointer() const - { - #if defined (__GNUC__) - //asm(""); //Prevents the function to be optimized-away (provokes an special "side-effect") - #endif - return static_cast( - static_cast( - (internal.m_offset == 1) ? - 0 : - (const_cast(reinterpret_cast(this)) + internal.m_offset) - ) - ); - } - void inc_offset(DifferenceType bytes) { internal.m_offset += bytes; } void dec_offset(DifferenceType bytes) { internal.m_offset -= bytes; } - union internal_type{ - OffsetType m_offset; //Distance between this object and pointee address - typename ::boost::aligned_storage - < sizeof(OffsetType) - , (OffsetAlignment == offset_type_alignment) ? - ::boost::alignment_of::value : OffsetAlignment - >::type alignment_helper; - } internal; + ipcdetail::offset_ptr_internal internal; /// @endcond }; //!operator<< //!for offset ptr -template -inline std::basic_ostream & operator<< +template +inline std::basic_ostream & operator<< (std::basic_ostream & os, offset_ptr const & p) { return os << p.get_offset(); } -//!operator>> +//!operator>> //!for offset ptr -template -inline std::basic_istream & operator>> +template +inline std::basic_istream & operator>> (std::basic_istream & is, offset_ptr & p) { return is >> p.get_offset(); } //!Simulation of static_cast between pointers. Never throws. template -inline boost::interprocess::offset_ptr +inline boost::interprocess::offset_ptr static_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::static_cast_tag()); + (r, boost::interprocess::ipcdetail::static_cast_tag()); } //!Simulation of const_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr const_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::const_cast_tag()); + (r, boost::interprocess::ipcdetail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. Never throws. template -inline boost::interprocess::offset_ptr +inline boost::interprocess::offset_ptr dynamic_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::dynamic_cast_tag()); + (r, boost::interprocess::ipcdetail::dynamic_cast_tag()); } //!Simulation of reinterpret_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr reinterpret_pointer_cast(const boost::interprocess::offset_ptr & r) -{ +{ return boost::interprocess::offset_ptr - (r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); + (r, boost::interprocess::ipcdetail::reinterpret_cast_tag()); } } //namespace interprocess { @@ -425,29 +623,29 @@ inline boost::interprocess::offset_ptr //!has_trivial_constructor<> == true_type specialization for optimizations template -struct has_trivial_constructor< boost::interprocess::offset_ptr > +struct has_trivial_constructor< boost::interprocess::offset_ptr > { static const bool value = true; }; ///has_trivial_destructor<> == true_type specialization for optimizations template -struct has_trivial_destructor< boost::interprocess::offset_ptr > +struct has_trivial_destructor< boost::interprocess::offset_ptr > { static const bool value = true; }; -//#if !defined(_MSC_VER) || (_MSC_VER >= 1400) + namespace interprocess { -//#endif -//!to_raw_pointer() enables boost::mem_fn to recognize offset_ptr. + +//!to_raw_pointer() enables boost::mem_fn to recognize offset_ptr. //!Never throws. template inline T * to_raw_pointer(boost::interprocess::offset_ptr const & p) -{ return p.get(); } -//#if !defined(_MSC_VER) || (_MSC_VER >= 1400) +{ return ipcdetail::to_raw_pointer(p); } + } //namespace interprocess -//#endif + /// @endcond } //namespace boost { @@ -479,28 +677,34 @@ struct pointer_plus_bits; template struct pointer_plus_bits, NumBits> { - typedef boost::interprocess::offset_ptr pointer; + typedef boost::interprocess::offset_ptr pointer; + typedef ::boost::interprocess::pointer_size_t_caster caster_t; //Bits are stored in the lower bits of the pointer except the LSB, //because this bit is used to represent the null pointer. - static const std::size_t Mask = ((std::size_t(1) << NumBits)-1)<<1u; + static const std::size_t Mask = ((std::size_t(1) << NumBits) - 1) << 1u; static pointer get_pointer(const pointer &n) - { return reinterpret_cast(std::size_t(n.get()) & ~std::size_t(Mask)); } - - static void set_pointer(pointer &n, pointer p) { - std::size_t pint = std::size_t(p.get()); - BOOST_ASSERT(0 == (std::size_t(pint) & Mask)); - n = reinterpret_cast(pint | (std::size_t(n.get()) & std::size_t(Mask))); + caster_t caster(n.get()); + return pointer(caster_t(caster.size() & ~Mask).pointer()); + } + + static void set_pointer(pointer &n, const pointer &p) + { + caster_t n_caster(n.get()); + caster_t p_caster(p.get()); + BOOST_ASSERT(0 == (p_caster.size() & Mask)); + n = caster_t(p_caster.size() | (n_caster.size() & Mask)).pointer(); } static std::size_t get_bits(const pointer &n) - { return(std::size_t(n.get()) & std::size_t(Mask)) >> 1u; } + { return (caster_t(n.get()).size() & Mask) >> 1u; } static void set_bits(pointer &n, std::size_t b) { BOOST_ASSERT(b < (std::size_t(1) << NumBits)); - n = reinterpret_cast(std::size_t(get_pointer(n).get()) | (b << 1u)); + caster_t n_caster(n.get()); + n = caster_t((n_caster.size() & ~Mask) | (b << 1u)).pointer(); } }; @@ -510,8 +714,6 @@ struct pointer_plus_bits, NumBits> template struct pointer_to_other; - - //Backwards compatibility with pointer_to_other template struct pointer_to_other diff --git a/project/jni/boost/include/boost/interprocess/permissions.hpp b/project/jni/boost/include/boost/interprocess/permissions.hpp index 745f8a8e0..4266b24af 100644 --- a/project/jni/boost/include/boost/interprocess/permissions.hpp +++ b/project/jni/boost/include/boost/interprocess/permissions.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/segment_manager.hpp b/project/jni/boost/include/boost/interprocess/segment_manager.hpp index 442469599..a0f948f6c 100644 --- a/project/jni/boost/include/boost/interprocess/segment_manager.hpp +++ b/project/jni/boost/include/boost/interprocess/segment_manager.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -69,9 +69,9 @@ class segment_manager_base typedef typename MemoryAlgorithm::void_pointer void_pointer; typedef typename MemoryAlgorithm::mutex_family mutex_family; typedef MemoryAlgorithm memory_algorithm; - + /// @cond - + //Experimental. Don't use typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain; typedef typename MemoryAlgorithm::difference_type difference_type; @@ -88,14 +88,14 @@ class segment_manager_base //!"size" is the size of the memory segment where //!the basic segment manager is being constructed. //! - //!"reserved_bytes" is the number of bytes + //!"reserved_bytes" is the number of bytes //!after the end of the memory algorithm object itself //!that the memory algorithm will exclude from //!dynamic allocation //! //!Can throw - segment_manager_base(size_type size, size_type reserved_bytes) - : MemoryAlgorithm(size, reserved_bytes) + segment_manager_base(size_type sz, size_type reserved_bytes) + : MemoryAlgorithm(sz, reserved_bytes) { BOOST_ASSERT((sizeof(segment_manager_base) == sizeof(MemoryAlgorithm))); } @@ -115,7 +115,7 @@ class segment_manager_base static size_type get_min_size (size_type size) { return MemoryAlgorithm::get_min_size(size); } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Never throws void * allocate (size_type nbytes, std::nothrow_t) { return MemoryAlgorithm::allocate(nbytes); } @@ -123,64 +123,65 @@ class segment_manager_base /// @cond //Experimental. Dont' use. - //!Allocates n_elements of - //!elem_size bytes. Throws bad_alloc on failure. - multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements) + //!Allocates n_elements of elem_bytes bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) { - multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements)); - if(mem.empty()) throw bad_alloc(); - return boost::move(mem); + size_type prev_size = chain.size(); + MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); + if(!elem_bytes || chain.size() == prev_size){ + throw bad_alloc(); + } } - //!Allocates n_elements, each one of - //!element_lenghts[i]*sizeof_element bytes. Throws bad_alloc on failure. - multiallocation_chain allocate_many - (const size_type *element_lenghts, size_type n_elements, size_type sizeof_element = 1) + //!Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. + //!Throws bad_alloc on failure. chain.size() is not increased on failure. + void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) { - multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element)); - if(mem.empty()) throw bad_alloc(); - return boost::move(mem); + size_type prev_size = chain.size(); + MemoryAlgorithm::allocate_many(element_lengths, n_elements, sizeof_element, chain); + if(!sizeof_element || chain.size() == prev_size){ + throw bad_alloc(); + } } - //!Allocates n_elements of - //!elem_size bytes. Returns a default constructed iterator on failure. - multiallocation_chain allocate_many - (size_type elem_bytes, size_type num_elements, std::nothrow_t) - { return MemoryAlgorithm::allocate_many(elem_bytes, num_elements); } + //!Allocates n_elements of elem_bytes bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) + { MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); } //!Allocates n_elements, each one of - //!element_lenghts[i]*sizeof_element bytes. - //!Returns a default constructed iterator on failure. - multiallocation_chain allocate_many - (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, std::nothrow_t) - { return MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element); } + //!element_lengths[i]*sizeof_element bytes. + //!Non-throwing version. chain.size() is not increased on failure. + void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain) + { MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element, chain); } - //!Deallocates elements pointed by the - //!multiallocation iterator range. - void deallocate_many(multiallocation_chain chain) - { MemoryAlgorithm::deallocate_many(boost::move(chain)); } + //!Deallocates all elements contained in chain. + //!Never throws. + void deallocate_many(multiallocation_chain &chain) + { MemoryAlgorithm::deallocate_many(chain); } /// @endcond //!Allocates nbytes bytes. Throws boost::interprocess::bad_alloc //!on failure void * allocate(size_type nbytes) - { + { void * ret = MemoryAlgorithm::allocate(nbytes); if(!ret) throw bad_alloc(); return ret; } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Never throws void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t) { return MemoryAlgorithm::allocate_aligned(nbytes, alignment); } - //!Allocates nbytes bytes. This function is only used in + //!Allocates nbytes bytes. This function is only used in //!single-segment management. Throws bad_alloc when fails void * allocate_aligned(size_type nbytes, size_type alignment) - { + { void * ret = MemoryAlgorithm::allocate_aligned(nbytes, alignment); if(!ret) throw bad_alloc(); @@ -269,7 +270,7 @@ class segment_manager_base throw bad_alloc(); } else{ - return 0; + return 0; } } @@ -293,7 +294,7 @@ class segment_manager_base void prot_anonymous_destroy(const void *object, ipcdetail::in_place_interface &table) { - //Get control data from associated with this object + //Get control data from associated with this object typedef ipcdetail::block_header block_header_t; block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment); @@ -318,9 +319,9 @@ class segment_manager_base //!This object is placed in the beginning of memory segment and //!implements the allocation (named or anonymous) of portions //!of the segment. This object contains two indexes that -//!maintain an association between a name and a portion of the segment. +//!maintain an association between a name and a portion of the segment. //! -//!The first index contains the mappings for normal named objects using the +//!The first index contains the mappings for normal named objects using the //!char type specified in the template parameter. //! //!The second index contains the association for unique instances. The key will @@ -336,7 +337,7 @@ template class IndexType> class segment_manager : public segment_manager_base -{ +{ /// @cond //Non-copyable segment_manager(); @@ -407,8 +408,8 @@ class segment_manager //!"size" is the size of the memory segment where //!the segment manager is being constructed. //!Can throw - segment_manager(size_type size) - : Base(size, priv_get_reserved_bytes()) + explicit segment_manager(size_type segment_size) + : Base(segment_size, priv_get_reserved_bytes()) , m_header(static_cast(get_this_pointer())) { (void) anonymous_instance; (void) unique_instance; @@ -446,7 +447,7 @@ class segment_manager //!Returns throwing "construct" proxy //!object template - typename construct_proxy::type + typename construct_proxy::type construct(char_ptr_holder_t name) { return typename construct_proxy::type (this, name, false, true); } @@ -466,39 +467,39 @@ class segment_manager //!Returns no throwing "search or construct" //!proxy object template - typename construct_proxy::type + typename construct_proxy::type find_or_construct(char_ptr_holder_t name, std::nothrow_t) { return typename construct_proxy::type (this, name, true, false); } //!Returns throwing "construct from iterators" proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type construct_it(char_ptr_holder_t name) { return typename construct_iter_proxy::type (this, name, false, true); } //!Returns throwing "search or construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name) { return typename construct_iter_proxy::type (this, name, true, true); } //!Returns no throwing "construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type construct_it(char_ptr_holder_t name, std::nothrow_t) { return typename construct_iter_proxy::type (this, name, false, false); } //!Returns no throwing "search or construct from iterators" //!proxy object template - typename construct_iter_proxy::type + typename construct_iter_proxy::type find_or_construct_it(char_ptr_holder_t name, std::nothrow_t) { return typename construct_iter_proxy::type (this, name, true, false); } - //!Calls object function blocking recursive interprocess_mutex and guarantees that - //!no new named_alloc or destroy will be executed by any process while + //!Calls object function blocking recursive interprocess_mutex and guarantees that + //!no new named_alloc or destroy will be executed by any process while //!executing the object function call*/ template void atomic_func(Func &f) @@ -571,22 +572,22 @@ class segment_manager static instance_type get_instance_type(const T *ptr) { return priv_get_instance_type(block_header_t::block_header_from_value(ptr)); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" named objects in the managed memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_named_objects(size_type num) - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - m_header.m_named_index.reserve(num); + m_header.m_named_index.reserve(num); } - //!Preallocates needed index resources to optimize the + //!Preallocates needed index resources to optimize the //!creation of "num" unique objects in the managed memory segment. //!Can throw boost::interprocess::bad_alloc if there is no enough memory. void reserve_unique_objects(size_type num) - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- @@ -596,32 +597,32 @@ class segment_manager //!Calls shrink_to_fit in both named and unique object indexes //!to try to free unused memory from those indexes. void shrink_to_fit_indexes() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - m_header.m_named_index.shrink_to_fit(); - m_header.m_unique_index.shrink_to_fit(); + m_header.m_named_index.shrink_to_fit(); + m_header.m_unique_index.shrink_to_fit(); } //!Returns the number of named objects stored in //!the segment. size_type get_num_named_objects() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - return m_header.m_named_index.size(); + return m_header.m_named_index.size(); } //!Returns the number of unique objects stored in //!the segment. size_type get_num_unique_objects() - { + { //------------------------------- scoped_lock guard(m_header); //------------------------------- - return m_header.m_unique_index.size(); + return m_header.m_unique_index.size(); } //!Obtains the minimum size needed by the @@ -693,13 +694,13 @@ class segment_manager /// @cond - //!Generic named/anonymous new function. Offers all the possibilities, - //!such as throwing, search before creating, and the constructor is + //!Generic named/anonymous new function. Offers all the possibilities, + //!such as throwing, search before creating, and the constructor is //!encapsulated in an object function. template - T *generic_construct(const CharType *name, - size_type num, - bool try2find, + T *generic_construct(const CharType *name, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table) { @@ -713,20 +714,20 @@ class segment_manager //!returned pair is 0. template std::pair priv_find_impl (const CharType* name, bool lock) - { + { //The name can't be null, no anonymous object can be found by name BOOST_ASSERT(name != 0); ipcdetail::placement_destroy table; - size_type size; + size_type sz; void *ret; if(name == reinterpret_cast(-1)){ - ret = priv_generic_find (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), lock); + ret = priv_generic_find (typeid(T).name(), m_header.m_unique_index, table, sz, is_intrusive_t(), lock); } else{ - ret = priv_generic_find (name, m_header.m_named_index, table, size, is_intrusive_t(), lock); + ret = priv_generic_find (name, m_header.m_named_index, table, sz, is_intrusive_t(), lock); } - return std::pair(static_cast(ret), size); + return std::pair(static_cast(ret), sz); } //!Tries to find a previous unique allocation. Returns the address @@ -737,13 +738,13 @@ class segment_manager { ipcdetail::placement_destroy table; size_type size; - void *ret = priv_generic_find(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock); + void *ret = priv_generic_find(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock); return std::pair(static_cast(ret), size); } - void *priv_generic_construct(const CharType *name, - size_type num, - bool try2find, + void *priv_generic_construct(const CharType *name, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table) { @@ -805,7 +806,7 @@ class segment_manager return 0; } CharType *name = static_cast(ctrl_data->template name()); - + //Sanity checks BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharType)); BOOST_ASSERT(ctrl_data->m_num_char == std::char_traits::length(name)); @@ -837,7 +838,7 @@ class segment_manager template void *priv_generic_find - (const CharT* name, + (const CharT* name, IndexType > &index, ipcdetail::in_place_interface &table, size_type &length, @@ -877,7 +878,7 @@ class segment_manager template void *priv_generic_find - (const CharT* name, + (const CharT* name, IndexType > &index, ipcdetail::in_place_interface &table, size_type &length, @@ -941,7 +942,7 @@ class segment_manager } template - bool priv_generic_named_destroy(const CharT *name, + bool priv_generic_named_destroy(const CharT *name, IndexType > &index, ipcdetail::in_place_interface &table, ipcdetail::true_ is_intrusive_index) @@ -951,7 +952,7 @@ class segment_manager typedef ipcdetail::index_key index_key_t; typedef typename index_type::iterator index_it; typedef typename index_type::value_type intrusive_value_type; - + //------------------------------- scoped_lock guard(m_header); //------------------------------- @@ -972,7 +973,7 @@ class segment_manager void *memory = iv; void *values = ctrl_data->value(); std::size_t num = ctrl_data->m_value_bytes/table.size; - + //Sanity check BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char()); @@ -992,7 +993,7 @@ class segment_manager } template - bool priv_generic_named_destroy(const CharT *name, + bool priv_generic_named_destroy(const CharT *name, IndexType > &index, ipcdetail::in_place_interface &table, ipcdetail::false_ is_intrusive_index) @@ -1006,7 +1007,7 @@ class segment_manager scoped_lock guard(m_header); //------------------------------- //Try to find the name in the index - index_it it = index.find(key_type (name, + index_it it = index.find(key_type (name, std::char_traits::length(name))); //If not found, return false @@ -1033,7 +1034,7 @@ class segment_manager char *stored_name = static_cast(static_cast(const_cast(it->first.name()))); (void)stored_name; - //Check if the distance between the name pointer and the memory pointer + //Check if the distance between the name pointer and the memory pointer //is correct (this can detect incorrect type in destruction) std::size_t num = ctrl_data->m_value_bytes/table.size; void *values = ctrl_data->value(); @@ -1070,8 +1071,8 @@ class segment_manager template void * priv_generic_named_construct(unsigned char type, const CharT *name, - size_type num, - bool try2find, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table, IndexType > &index, @@ -1095,12 +1096,12 @@ class segment_manager //------------------------------- //Insert the node. This can throw. //First, we want to know if the key is already present before - //we allocate any memory, and if the key is not present, we + //we allocate any memory, and if the key is not present, we //want to allocate all memory in a single buffer that will //contain the name and the user buffer. // //Since equal_range(key) + insert(hint, value) approach is - //quite inefficient in container implementations + //quite inefficient in container implementations //(they re-test if the position is correct), I've chosen //to insert the node, do an ugly un-const cast and modify //the key (which is a smart pointer) to an equivalent one @@ -1138,7 +1139,7 @@ class segment_manager } //Allocates buffer for name + data, this can throw (it hurts) - void *buffer_ptr; + void *buffer_ptr; //Check if there is enough memory if(dothrow){ @@ -1149,7 +1150,7 @@ class segment_manager buffer_ptr = this->allocate (block_info.template total_size_with_header(), std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } //Now construct the intrusive hook plus the header @@ -1184,7 +1185,7 @@ class segment_manager //the memory allocation as the intrusive value is built in that //memory value_eraser v_eraser(index, it); - + //Construct array, this can throw ipcdetail::array_construct(ptr, num, table); @@ -1197,10 +1198,10 @@ class segment_manager //!Generic named new function for //!named functions template - void * priv_generic_named_construct(unsigned char type, + void * priv_generic_named_construct(unsigned char type, const CharT *name, - size_type num, - bool try2find, + size_type num, + bool try2find, bool dothrow, ipcdetail::in_place_interface &table, IndexType > &index, @@ -1227,12 +1228,12 @@ class segment_manager //------------------------------- //Insert the node. This can throw. //First, we want to know if the key is already present before - //we allocate any memory, and if the key is not present, we + //we allocate any memory, and if the key is not present, we //want to allocate all memory in a single buffer that will //contain the name and the user buffer. // //Since equal_range(key) + insert(hint, value) approach is - //quite inefficient in container implementations + //quite inefficient in container implementations //(they re-test if the position is correct), I've chosen //to insert the node, do an ugly un-const cast and modify //the key (which is a smart pointer) to an equivalent one @@ -1265,7 +1266,7 @@ class segment_manager value_eraser v_eraser(index, it); //Allocates buffer for name + data, this can throw (it hurts) - void *buffer_ptr; + void *buffer_ptr; block_header_t * hdr; //Allocate and construct the headers @@ -1277,7 +1278,7 @@ class segment_manager else{ buffer_ptr = this->allocate(total_size, std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } index_it *idr = new(buffer_ptr) index_it(it); hdr = block_header_t::template from_first_header(idr); @@ -1289,7 +1290,7 @@ class segment_manager else{ buffer_ptr = this->allocate(block_info.total_size(), std::nothrow_t()); if(!buffer_ptr) - return 0; + return 0; } hdr = static_cast(buffer_ptr); } @@ -1303,7 +1304,7 @@ class segment_manager std::char_traits::copy(name_ptr, name, namelen+1); //Do the ugly cast, please mama, forgive me! - //This new key points to an identical string, so it must have the + //This new key points to an identical string, so it must have the //same position than the overwritten key according to the predicate const_cast(it->first).name(name_ptr); it->second.m_ptr = hdr; @@ -1346,7 +1347,7 @@ class segment_manager { named_index_t m_named_index; unique_index_t m_unique_index; - + header_t(Base *restricted_segment_mngr) : m_named_index (restricted_segment_mngr) , m_unique_index(restricted_segment_mngr) diff --git a/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp b/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp index 7c8fcf61b..c501ee1a8 100644 --- a/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp +++ b/project/jni/boost/include/boost/interprocess/shared_memory_object.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,7 +28,7 @@ #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY) # include //System V shared memory... #elif defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) -# include //O_CREAT, O_*... +# include //O_CREAT, O_*... # include //shm_xxx # include //ftruncate, close # include //mode_t, S_IRWXG, S_IRWXO, S_IRWXU, @@ -71,26 +71,26 @@ class shared_memory_object shared_memory_object(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); } - //!Tries to open a shared memory object with name "name", with the access mode "mode". + //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. shared_memory_object(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw shared_memory_object(BOOST_RV_REF(shared_memory_object) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved) - { + { shared_memory_object tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps the shared_memory_objects. Does not throw @@ -99,7 +99,7 @@ class shared_memory_object //!Erases a shared memory object from the system. //!Returns false on error. Never throws static bool remove(const char *name); - + //!Sets the size of the shared memory mapping void truncate(offset_t length); @@ -142,11 +142,11 @@ class shared_memory_object /// @cond -inline shared_memory_object::shared_memory_object() +inline shared_memory_object::shared_memory_object() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} -inline shared_memory_object::~shared_memory_object() +inline shared_memory_object::~shared_memory_object() { this->priv_close(); } @@ -157,10 +157,10 @@ inline bool shared_memory_object::get_size(offset_t &size) const { return ipcdetail::get_file_size((file_handle_t)m_handle, size); } inline void shared_memory_object::swap(shared_memory_object &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_filename.swap(other.m_filename); + m_filename.swap(other.m_filename); } inline mapping_handle_t shared_memory_object::get_mapping_handle() const @@ -268,7 +268,7 @@ inline bool use_filesystem_based_posix() } //shared_memory_object_detail inline bool shared_memory_object::priv_open_or_create - (ipcdetail::create_enum_t type, + (ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm) { diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp index 4aba77297..8447bf1b3 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/deleter.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -26,9 +26,9 @@ //!Describes the functor to delete objects from the segment. namespace boost { -namespace interprocess { +namespace interprocess { -//!A deleter that uses the segment manager's destroy_ptr +//!A deleter that uses the segment manager's destroy_ptr //!function to destroy the passed pointer resource. //! //!This deleter is used @@ -56,7 +56,7 @@ class deleter { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); } }; -} //namespace interprocess { +} //namespace interprocess { } //namespace boost { #include diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp index 0150ef6c0..f0006fb1b 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/shared_count.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Peter Dimov and Multi Media Ltd. 2001, 2002, 2003 // (C) Copyright Peter Dimov 2004-2005 -// (C) Copyright Ion Gaztanaga 2006-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include // std::less @@ -99,7 +99,7 @@ class shared_count counted_impl_allocator alloc(a); m_pi = alloc.allocate(1); //Anti-exception deallocator - scoped_ptr > deallocator(m_pi, alloc); //It's more correct to use VoidAllocator::construct but @@ -116,7 +116,7 @@ class shared_count } ~shared_count() // nothrow - { + { if(m_pi) m_pi->release(); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp index 24d96ee48..d03965cdc 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. +// (C) Copyright Ion Gaztanaga 2007-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp index edb39eeeb..74f65f181 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp @@ -9,7 +9,7 @@ // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // Copyright 2004-2005 Peter Dimov -// Copyright 2007-2011 Ion Gaztanaga +// Copyright 2007-2012 Ion Gaztanaga // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp index 4e2e664c8..2d29ae62b 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -63,10 +63,10 @@ struct scoped_ptr_dealloc_functor { if (ptr) priv_deallocate(ptr, alloc_version()); } }; - + template -class sp_counted_impl_pd +class sp_counted_impl_pd : public sp_counted_base , boost::container::allocator_traits::template portable_rebind_alloc< sp_counted_impl_pd >::type @@ -122,7 +122,7 @@ class sp_counted_impl_pd this_pointer this_ptr (this); //Do it now! scoped_ptr< this_type, scoped_ptr_dealloc_functor > - deleter(this_ptr, a_copy); + deleter_ptr(this_ptr, a_copy); typedef typename this_allocator::value_type value_type; ipcdetail::to_raw_pointer(this_ptr)->~value_type(); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp index 9c8c7918f..d9f16aece 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/enable_shared_from_this.hpp // // (C) Copyright Peter Dimov 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp index 3f086f536..897c5da4e 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/intrusive_ptr.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/intrusive_ptr.hpp // // (C) Copyright Peter Dimov 2001, 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -33,12 +33,12 @@ namespace interprocess { //!The intrusive_ptr class template stores a pointer to an object //!with an embedded reference count. intrusive_ptr is parameterized on -//!T (the type of the object pointed to) and VoidPointer(a void pointer type +//!T (the type of the object pointed to) and VoidPointer(a void pointer type //!that defines the type of pointer that intrusive_ptr will store). //!intrusive_ptr defines a class with a T* member whereas //!intrusive_ptr > defines a class with a offset_ptr member. //!Relies on unqualified calls to: -//! +//! //! void intrusive_ptr_add_ref(T * p); //! void intrusive_ptr_release(T * p); //! @@ -69,7 +69,7 @@ class intrusive_ptr intrusive_ptr(): m_ptr(0) {} - //!Constructor. Copies pointer and if "p" is not zero and + //!Constructor. Copies pointer and if "p" is not zero and //!"add_ref" is true calls intrusive_ptr_add_ref(to_raw_pointer(p)). //!Does not throw intrusive_ptr(const pointer &p, bool add_ref = true): m_ptr(p) @@ -101,7 +101,7 @@ class intrusive_ptr if(m_ptr != 0) intrusive_ptr_release(ipcdetail::to_raw_pointer(m_ptr)); } - //!Assignment operator. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment operator. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw intrusive_ptr & operator=(intrusive_ptr const & rhs) { @@ -109,7 +109,7 @@ class intrusive_ptr return *this; } - //!Assignment from related. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment from related. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw template intrusive_ptr & operator= (intrusive_ptr const & rhs) @@ -118,14 +118,14 @@ class intrusive_ptr return *this; } - //!Assignment from pointer. Equivalent to intrusive_ptr(r).swap(*this). + //!Assignment from pointer. Equivalent to intrusive_ptr(r).swap(*this). //!Does not throw intrusive_ptr & operator=(pointer rhs) { this_type(rhs).swap(*this); return *this; } - + //!Returns a reference to the internal pointer. //!Does not throw pointer &get() @@ -175,7 +175,7 @@ class intrusive_ptr //!Returns a.get() == b.get(). //!Does not throw template inline -bool operator==(intrusive_ptr const & a, +bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) { return a.get() == b.get(); } @@ -217,11 +217,11 @@ bool operator!=(const typename intrusive_ptr::pointer &a, //!Returns a.get() < b.get(). //!Does not throw template inline -bool operator<(intrusive_ptr const & a, +bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) -{ +{ return std::less::pointer>() - (a.get(), b.get()); + (a.get(), b.get()); } //!Exchanges the contents of the two intrusive_ptrs. @@ -233,7 +233,7 @@ void swap(intrusive_ptr & lhs, // operator<< template -inline std::basic_ostream & operator<< +inline std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p) { os << p.get(); return os; } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp index 1885838ff..8a2ba363f 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/scoped_ptr.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // (C) Copyright Peter Dimov 2001, 2002 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -27,14 +27,14 @@ namespace boost { namespace interprocess { -//!scoped_ptr stores a pointer to a dynamically allocated object. +//!scoped_ptr stores a pointer to a dynamically allocated object. //!The object pointed to is guaranteed to be deleted, either on destruction //!of the scoped_ptr, or via an explicit reset. The user can avoid this //!deletion using release(). -//!scoped_ptr is parameterized on T (the type of the object pointed to) and +//!scoped_ptr is parameterized on T (the type of the object pointed to) and //!Deleter (the functor to be executed to delete the internal pointer). -//!The internal pointer will be of the same pointer type as typename -//!Deleter::pointer type (that is, if typename Deleter::pointer is +//!The internal pointer will be of the same pointer type as typename +//!Deleter::pointer type (that is, if typename Deleter::pointer is //!offset_ptr, the internal pointer will be offset_ptr). template class scoped_ptr @@ -60,10 +60,10 @@ class scoped_ptr : Deleter(d), m_ptr(p) // throws if pointer/Deleter copy ctor throws {} - //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. + //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. //!calling the operator() of the stored deleter. Never throws ~scoped_ptr() - { + { if(m_ptr){ Deleter &del = static_cast(*this); del(m_ptr); diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp index 61829078e..302eb149f 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/shared_ptr.hpp @@ -4,7 +4,7 @@ // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // (C) Copyright Peter Dimov 2001, 2002, 2003 -// (C) Copyright Ion Gaztanaga 2006-2011. +// (C) Copyright Ion Gaztanaga 2006-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -52,7 +52,7 @@ inline void sp_enable_shared_from_this (shared_count const & pn ,enable_shared_from_this *pe ,T *ptr) - + { (void)ptr; if(pe != 0){ @@ -66,17 +66,17 @@ inline void sp_enable_shared_from_this(shared_count c } // namespace ipcdetail -//!shared_ptr stores a pointer to a dynamically allocated object. -//!The object pointed to is guaranteed to be deleted when the last shared_ptr pointing to +//!shared_ptr stores a pointer to a dynamically allocated object. +//!The object pointed to is guaranteed to be deleted when the last shared_ptr pointing to //!it is destroyed or reset. //! -//!shared_ptr is parameterized on +//!shared_ptr is parameterized on //!T (the type of the object pointed to), VoidAllocator (the void allocator to be used -//!to allocate the auxiliary data) and Deleter (the deleter whose +//!to allocate the auxiliary data) and Deleter (the deleter whose //!operator() will be used to delete the object. //! -//!The internal pointer will be of the same pointer type as typename -//!VoidAllocator::pointer type (that is, if typename VoidAllocator::pointer is +//!The internal pointer will be of the same pointer type as typename +//!VoidAllocator::pointer type (that is, if typename VoidAllocator::pointer is //!offset_ptr, the internal pointer will be offset_ptr). //! //!Because the implementation uses reference counting, cycles of shared_ptr @@ -125,7 +125,7 @@ class shared_ptr //!Requirements: Deleter and A's copy constructor must not throw. explicit shared_ptr(const pointer&p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) : m_pn(p, a, d) - { + { //Check that the pointer passed is of the same type that //the pointer the allocator defines or it's a raw pointer typedef typename boost::intrusive:: @@ -134,25 +134,30 @@ class shared_ptr BOOST_STATIC_ASSERT((ipcdetail::is_same::value) || (ipcdetail::is_pointer::value)); - ipcdetail::sp_enable_shared_from_this( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) ); + ipcdetail::sp_enable_shared_from_this( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) ); } + //!Copy constructs a shared_ptr. If r is empty, constructs an empty shared_ptr. Otherwise, constructs + //!a shared_ptr that shares ownership with r. Never throws. + shared_ptr(const shared_ptr &r) + : m_pn(r.m_pn) // never throws + {} - //!Constructs a shared_ptr that shares ownership with r and stores p. + //!Constructs a shared_ptr that shares ownership with other and stores p. //!Postconditions: get() == p && use_count() == r.use_count(). //!Throws: nothing. shared_ptr(const shared_ptr &other, const pointer &p) : m_pn(other.m_pn, p) {} - //!If r is empty, constructs an empty shared_ptr. Otherwise, constructs + //!If r is empty, constructs an empty shared_ptr. Otherwise, constructs //!a shared_ptr that shares ownership with r. Never throws. template shared_ptr(shared_ptr const & r) : m_pn(r.m_pn) // never throws {} - //!Constructs a shared_ptr that shares ownership with r and stores + //!Constructs a shared_ptr that shares ownership with r and stores //!a copy of the pointer stored in r. template explicit shared_ptr(weak_ptr const & r) @@ -170,19 +175,19 @@ class shared_ptr template shared_ptr(shared_ptr const & r, ipcdetail::static_cast_tag) : m_pn( pointer(static_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) {} template shared_ptr(shared_ptr const & r, ipcdetail::const_cast_tag) : m_pn( pointer(const_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) {} template shared_ptr(shared_ptr const & r, ipcdetail::dynamic_cast_tag) : m_pn( pointer(dynamic_cast(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) + , r.m_pn) { if(!m_pn.to_raw_pointer()){ // need to allocate new counter -- the cast failed m_pn = ipcdetail::shared_count(); @@ -218,15 +223,15 @@ class shared_ptr //!This is equivalent to: //!this_type().swap(*this); void reset() - { - this_type().swap(*this); + { + this_type().swap(*this); } //!This is equivalent to: //!this_type(p, a, d).swap(*this); template void reset(const Pointer &p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) - { + { //Check that the pointer passed is of the same type that //the pointer the allocator defines or it's a raw pointer typedef typename boost::intrusive:: @@ -234,7 +239,7 @@ class shared_ptr rebind_pointer::type ParameterPointer; BOOST_STATIC_ASSERT((ipcdetail::is_same::value) || (ipcdetail::is_pointer::value)); - this_type(p, a, d).swap(*this); + this_type(p, a, d).swap(*this); } template @@ -248,12 +253,12 @@ class shared_ptr reference operator* () const // never throws { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return *m_pn.to_raw_pointer(); } - //!Returns the pointer pointing + //!Returns the pointer pointing //!to the owned object pointer operator-> () const // never throws { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return m_pn.to_raw_pointer(); } - //!Returns the pointer pointing + //!Returns the pointer pointing //!to the owned object pointer get() const // never throws { return m_pn.to_raw_pointer(); } @@ -292,7 +297,7 @@ class shared_ptr /// @cond - template + template bool _internal_less(shared_ptr const & rhs) const { return m_pn < rhs.m_pn; } @@ -311,19 +316,19 @@ class shared_ptr /// @endcond }; // shared_ptr -template inline +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) { return a.get() == b.get(); } -template inline +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) { return a.get() != b.get(); } -template inline +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) { return a._internal_less(b); } -template inline +template inline void swap(shared_ptr & a, shared_ptr & b) { a.swap(b); } @@ -331,11 +336,11 @@ template inline shared_ptr static_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::static_cast_tag()); } -template inline +template inline shared_ptr const_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::const_cast_tag()); } -template inline +template inline shared_ptr dynamic_pointer_cast(shared_ptr const & r) { return shared_ptr(r, ipcdetail::dynamic_cast_tag()); } @@ -346,7 +351,7 @@ T * to_raw_pointer(shared_ptr const & p) // operator<< template inline -std::basic_ostream & operator<< +std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) { os << p.get(); return os; } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp index 547038b69..e6503e262 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/unique_ptr.hpp @@ -5,7 +5,7 @@ // This file is the adaptation for Interprocess of // Howard Hinnant's unique_ptr emulation code. // -// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -272,20 +272,20 @@ class unique_ptr //!Returns: A reference to the stored deleter. //! //!Throws: nothing. - deleter_reference get_deleter() + deleter_reference get_deleter() { return ptr_.second(); } //!Returns: A const reference to the stored deleter. //! //!Throws: nothing. - deleter_const_reference get_deleter() const + deleter_const_reference get_deleter() const { return ptr_.second(); } //!Returns: An unspecified value that, when used in boolean //!contexts, is equivalent to get() != 0. //! //!Throws: nothing. - operator int nat::*() const + operator int nat::*() const { return ptr_.first() ? &nat::for_bool_ : 0; } //!Postcondition: get() == 0. @@ -328,7 +328,7 @@ class unique_ptr BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_ptr) template unique_ptr(unique_ptr&); template unique_ptr(U&, typename ipcdetail::unique_ptr_error::type = 0); - + template unique_ptr& operator=(unique_ptr&); template typename ipcdetail::unique_ptr_error::type operator=(U&); /// @endcond @@ -539,7 +539,7 @@ template inline typename managed_unique_ptr::type make_managed_unique_ptr(T *constructed_object, ManagedMemory &managed_memory) { - return typename managed_unique_ptr::type + return typename managed_unique_ptr::type (constructed_object, managed_memory.template get_deleter()); } diff --git a/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp b/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp index 7126d055a..99c8a6319 100644 --- a/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp +++ b/project/jni/boost/include/boost/interprocess/smart_ptr/weak_ptr.hpp @@ -3,7 +3,7 @@ // This file is the adaptation for Interprocess of boost/weak_ptr.hpp // // (C) Copyright Peter Dimov 2001, 2002, 2003 -// (C) Copyright Ion Gaztanaga 2006-2011. +// (C) Copyright Ion Gaztanaga 2006-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -31,7 +31,7 @@ namespace boost{ namespace interprocess{ //!The weak_ptr class template stores a "weak reference" to an object -//!that's already managed by a shared_ptr. To access the object, a weak_ptr +//!that's already managed by a shared_ptr. To access the object, a weak_ptr //!can be converted to a shared_ptr using the shared_ptr constructor or the //!member function lock. When the last shared_ptr to the object goes away //!and the object is deleted, the attempt to obtain a shared_ptr from the @@ -99,11 +99,11 @@ class weak_ptr template weak_ptr(weak_ptr const & r) : m_pn(r.m_pn) // never throws - { + { //Construct a temporary shared_ptr so that nobody //can destroy the value while constructing this const shared_ptr &ref = r.lock(); - m_pn.set_pointer(ref.get()); + m_pn.set_pointer(ref.get()); } //!Effects: If r is empty, constructs an empty weak_ptr; otherwise, @@ -126,7 +126,7 @@ class weak_ptr //!implied guarantees) via different means, without creating a temporary. template weak_ptr & operator=(weak_ptr const & r) // never throws - { + { //Construct a temporary shared_ptr so that nobody //can destroy the value while constructing this const shared_ptr &ref = r.lock(); @@ -174,7 +174,7 @@ class weak_ptr //!testing purposes, not for production code. long use_count() const // never throws { return m_pn.use_count(); } - + //!Returns: Returns: use_count() == 0. //! //!Throws: nothing. @@ -196,10 +196,10 @@ class weak_ptr { ipcdetail::do_swap(m_pn, other.m_pn); } /// @cond - template + template bool _internal_less(weak_ptr const & rhs) const { return m_pn < rhs.m_pn; } - + template void _internal_assign(const ipcdetail::shared_count & pn2) { @@ -216,7 +216,7 @@ class weak_ptr /// @endcond }; // weak_ptr -template inline +template inline bool operator<(weak_ptr const & a, weak_ptr const & b) { return a._internal_less(b); } diff --git a/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp b/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp index 834b3d1e0..9a2681abf 100644 --- a/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp +++ b/project/jni/boost/include/boost/interprocess/streams/bufferstream.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -8,7 +8,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005. +// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005-2012. // Changed internal SGI string to a buffer. Added efficient // internal buffer get/set/swap functions, so that we can obtain/establish the // internal buffer without any reallocation or copy. Kill those temporaries! @@ -42,7 +42,7 @@ #include #include #include -#include // char traits +#include // char traits #include // ptrdiff_t #include #include @@ -53,7 +53,7 @@ namespace boost { namespace interprocess { //!a basic_xbufferstream. The elements are transmitted from a to a fixed //!size buffer template -class basic_bufferbuf +class basic_bufferbuf : public std::basic_streambuf { public: @@ -74,24 +74,24 @@ class basic_bufferbuf //!Constructor. Assigns formatting buffer. //!Does not throw. - explicit basic_bufferbuf(CharT *buffer, std::size_t length, + explicit basic_bufferbuf(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) - : base_t(), m_mode(mode), m_buffer(buffer), m_length(length) + : base_t(), m_mode(mode), m_buffer(buf), m_length(length) { this->set_pointers(); } virtual ~basic_bufferbuf(){} public: - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return std::pair(m_buffer, m_length); } //!Sets the underlying buffer to a new value //!Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buffer = buffer; m_length = length; this->set_pointers(); } + void buffer(CharT *buf, std::size_t length) + { m_buffer = buf; m_length = length; this->set_pointers(); } /// @cond private: @@ -172,13 +172,13 @@ class basic_bufferbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { bool in = false; bool out = false; - - const std::ios_base::openmode inout = + + const std::ios_base::openmode inout = std::ios_base::in | std::ios_base::out; if((mode & inout) == inout) { @@ -205,7 +205,7 @@ class basic_bufferbuf newoff = static_cast(m_length); break; case std::ios_base::cur: - newoff = in ? static_cast(this->gptr() - this->eback()) + newoff = in ? static_cast(this->gptr() - this->eback()) : static_cast(this->pptr() - this->pbase()); break; default: @@ -237,7 +237,7 @@ class basic_bufferbuf return pos_type(off); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -275,10 +275,10 @@ class basic_ibufferstream //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_ibufferstream(const CharT *buffer, std::size_t length, - std::ios_base::openmode mode = std::ios_base::in) - : basic_ios_t(), base_t(0), - m_buf(const_cast(buffer), length, mode | std::ios_base::in) + basic_ibufferstream(const CharT *buf, std::size_t length, + std::ios_base::openmode mode = std::ios_base::in) + : basic_ios_t(), base_t(0), + m_buf(const_cast(buf), length, mode | std::ios_base::in) { basic_ios_t::init(&m_buf); } ~basic_ibufferstream(){}; @@ -289,15 +289,15 @@ class basic_ibufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(const CharT *buffer, std::size_t length) - { m_buf.buffer(const_cast(buffer), length); } + void buffer(const CharT *buf, std::size_t length) + { m_buf.buffer(const_cast(buf), length); } /// @cond private: @@ -333,10 +333,10 @@ class basic_obufferstream //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_obufferstream(CharT *buffer, std::size_t length, + basic_obufferstream(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::out) - : basic_ios_t(), base_t(0), - m_buf(buffer, length, mode | std::ios_base::out) + : basic_ios_t(), base_t(0), + m_buf(buf, length, mode | std::ios_base::out) { basic_ios_t::init(&m_buf); } ~basic_obufferstream(){} @@ -347,15 +347,15 @@ class basic_obufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buf.buffer(buffer, length); } + void buffer(CharT *buf, std::size_t length) + { m_buf.buffer(buf, length); } /// @cond private: @@ -367,7 +367,7 @@ class basic_obufferstream //!A basic_iostream class that uses a fixed size character buffer //!as its formatting buffer. template -class basic_bufferstream +class basic_bufferstream : public std::basic_iostream { @@ -388,17 +388,17 @@ class basic_bufferstream public: //!Constructor. //!Does not throw. - basic_bufferstream(std::ios_base::openmode mode + basic_bufferstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } //!Constructor. Assigns formatting buffer. //!Does not throw. - basic_bufferstream(CharT *buffer, std::size_t length, + basic_bufferstream(CharT *buf, std::size_t length, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) - : basic_ios_t(), base_t(0), m_buf(buffer, length, mode) + : basic_ios_t(), base_t(0), m_buf(buf, length, mode) { basic_ios_t::init(&m_buf); } ~basic_bufferstream(){} @@ -409,15 +409,15 @@ class basic_bufferstream basic_bufferbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. - void buffer(CharT *buffer, std::size_t length) - { m_buf.buffer(buffer, length); } + void buffer(CharT *buf, std::size_t length) + { m_buf.buffer(buf, length); } /// @cond private: diff --git a/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp b/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp index 83041f2b2..0c9f540e3 100644 --- a/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp +++ b/project/jni/boost/include/boost/interprocess/streams/vectorstream.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -8,7 +8,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005. +// This file comes from SGI's sstream file. Modified by Ion Gaztanaga 2005-2012. // Changed internal SGI string to a generic, templatized vector. Added efficient // internal buffer get/set/swap functions, so that we can obtain/establish the // internal buffer without any reallocation or copy. Kill those temporaries! @@ -30,7 +30,7 @@ //!This file defines basic_vectorbuf, basic_ivectorstream, //!basic_ovectorstream, and basic_vectorstreamclasses. These classes //!represent streamsbufs and streams whose sources or destinations are -//!STL-like vectors that can be swapped with external vectors to avoid +//!STL-like vectors that can be swapped with external vectors to avoid //!unnecessary allocations/copies. #ifndef BOOST_INTERPROCESS_VECTORSTREAM_HPP @@ -43,7 +43,7 @@ #include #include #include -#include // char traits +#include // char traits #include // ptrdiff_t #include #include @@ -51,9 +51,9 @@ namespace boost { namespace interprocess { //!A streambuf class that controls the transmission of elements to and from -//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. +//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. //!It holds a character vector specified by CharVector template parameter -//!as its formatting buffer. The vector must have contiguous storage, like +//!as its formatting buffer. The vector must have contiguous storage, like //!std::vector, boost::interprocess::vector or boost::interprocess::basic_string template class basic_vectorbuf @@ -96,11 +96,11 @@ class basic_vectorbuf public: - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) - { + { if (this->m_mode & std::ios_base::out){ //Update high water if necessary //And resize vector to remove extra size @@ -118,8 +118,8 @@ class basic_vectorbuf //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const - { + const vector_type &vector() const + { if (this->m_mode & std::ios_base::out){ if (mp_high_water < base_t::pptr()){ //Restore the vector's size if necessary @@ -137,13 +137,13 @@ class basic_vectorbuf const_cast(this)->base_t::pbump(old_pos); } } - return m_vect; + return m_vect; } //!Preallocates memory from the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's memory allocation throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { if (this->m_mode & std::ios_base::out && size > m_vect.size()){ typename vector_type::difference_type write_pos = base_t::pptr() - base_t::pbase(); @@ -282,7 +282,7 @@ class basic_vectorbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { //Get seek mode @@ -325,7 +325,7 @@ class basic_vectorbuf newoff = limit; break; case std::ios_base::cur: - newoff = in ? static_cast(this->gptr() - this->eback()) + newoff = in ? static_cast(this->gptr() - this->eback()) : static_cast(this->pptr() - this->pbase()); break; default: @@ -350,7 +350,7 @@ class basic_vectorbuf return pos_type(newoff); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -413,7 +413,7 @@ class basic_ivectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -421,18 +421,18 @@ class basic_ivectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf().clear(); } }; @@ -488,7 +488,7 @@ class basic_ovectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -496,13 +496,13 @@ class basic_ovectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } }; @@ -534,7 +534,7 @@ class basic_vectorstream public: //!Constructor. Throws if vector_type default //!constructor throws. - basic_vectorstream(std::ios_base::openmode mode + basic_vectorstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } @@ -554,7 +554,7 @@ class basic_vectorstream basic_vectorbuf* rdbuf() const { return const_cast*>(&m_buf); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -562,18 +562,18 @@ class basic_vectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf.vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf.reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf.clear(); } /// @cond diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp new file mode 100644 index 000000000..09643b408 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/condition_algorithm_8a.hpp @@ -0,0 +1,394 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP +#define BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// +// Condition variable algorithm taken from pthreads-win32 discussion. +// +// The algorithm was developed by Alexander Terekhov in colaboration with +// Louis Thomas. +// +// Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL +// +// semBlockLock - bin.semaphore +// semBlockQueue - semaphore +// mtxExternal - mutex or CS +// mtxUnblockLock - mutex or CS +// nWaitersGone - int +// nWaitersBlocked - int +// nWaitersToUnblock - int +// +// wait( timeout ) { +// +// [auto: register int result ] // error checking omitted +// [auto: register int nSignalsWasLeft ] +// [auto: register int nWaitersWasGone ] +// +// sem_wait( semBlockLock ); +// nWaitersBlocked++; +// sem_post( semBlockLock ); +// +// unlock( mtxExternal ); +// bTimedOut = sem_wait( semBlockQueue,timeout ); +// +// lock( mtxUnblockLock ); +// if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { +// if ( bTimedOut ) { // timeout (or canceled) +// if ( 0 != nWaitersBlocked ) { +// nWaitersBlocked--; +// } +// else { +// nWaitersGone++; // count spurious wakeups. +// } +// } +// if ( 0 == --nWaitersToUnblock ) { +// if ( 0 != nWaitersBlocked ) { +// sem_post( semBlockLock ); // open the gate. +// nSignalsWasLeft = 0; // do not open the gate +// // below again. +// } +// else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { +// nWaitersGone = 0; +// } +// } +// } +// else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or +// // spurious semaphore :-) +// sem_wait( semBlockLock ); +// nWaitersBlocked -= nWaitersGone; // something is going on here +// // - test of timeouts? :-) +// sem_post( semBlockLock ); +// nWaitersGone = 0; +// } +// unlock( mtxUnblockLock ); +// +// if ( 1 == nSignalsWasLeft ) { +// if ( 0 != nWaitersWasGone ) { +// // sem_adjust( semBlockQueue,-nWaitersWasGone ); +// while ( nWaitersWasGone-- ) { +// sem_wait( semBlockQueue ); // better now than spurious later +// } +// } sem_post( semBlockLock ); // open the gate +// } +// +// lock( mtxExternal ); +// +// return ( bTimedOut ) ? ETIMEOUT : 0; +// } +// +// signal(bAll) { +// +// [auto: register int result ] +// [auto: register int nSignalsToIssue] +// +// lock( mtxUnblockLock ); +// +// if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! +// if ( 0 == nWaitersBlocked ) { // NO-OP +// return unlock( mtxUnblockLock ); +// } +// if (bAll) { +// nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; +// nWaitersBlocked = 0; +// } +// else { +// nSignalsToIssue = 1; +// nWaitersToUnblock++; +// nWaitersBlocked--; +// } +// } +// else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! +// sem_wait( semBlockLock ); // close the gate +// if ( 0 != nWaitersGone ) { +// nWaitersBlocked -= nWaitersGone; +// nWaitersGone = 0; +// } +// if (bAll) { +// nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; +// nWaitersBlocked = 0; +// } +// else { +// nSignalsToIssue = nWaitersToUnblock = 1; +// nWaitersBlocked--; +// } +// } +// else { // NO-OP +// return unlock( mtxUnblockLock ); +// } +// +// unlock( mtxUnblockLock ); +// sem_post( semBlockQueue,nSignalsToIssue ); +// return result; +// } +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + + +// Required interface for ConditionMembers +// class ConditionMembers +// { +// typedef implementation_defined semaphore_type; +// typedef implementation_defined mutex_type; +// typedef implementation_defined integer_type; +// +// integer_type &get_nwaiters_blocked() +// integer_type &get_nwaiters_gone() +// integer_type &get_nwaiters_to_unblock() +// semaphore_type &get_sem_block_queue() +// semaphore_type &get_sem_block_lock() +// mutex_type &get_mtx_unblock_lock() +// }; +// +// Must be initialized as following +// +// get_nwaiters_blocked() == 0 +// get_nwaiters_gone() == 0 +// get_nwaiters_to_unblock() == 0 +// get_sem_block_queue() == initial count 0 +// get_sem_block_lock() == initial count 1 +// get_mtx_unblock_lock() (unlocked) +// +template +class condition_algorithm_8a +{ + private: + condition_algorithm_8a(); + ~condition_algorithm_8a(); + condition_algorithm_8a(const condition_algorithm_8a &); + condition_algorithm_8a &operator=(const condition_algorithm_8a &); + + typedef typename ConditionMembers::semaphore_type semaphore_type; + typedef typename ConditionMembers::mutex_type mutex_type; + typedef typename ConditionMembers::integer_type integer_type; + + public: + template + static bool wait ( ConditionMembers &data, Lock &lock + , bool timeout_enabled, const boost::posix_time::ptime &abs_time); + static void signal(ConditionMembers &data, bool broadcast); +}; + +template +inline void condition_algorithm_8a::signal(ConditionMembers &data, bool broadcast) +{ + integer_type nsignals_to_issue; + + { + scoped_lock locker(data.get_mtx_unblock_lock()); + + if ( 0 != data.get_nwaiters_to_unblock() ) { // the gate is closed!!! + if ( 0 == data.get_nwaiters_blocked() ) { // NO-OP + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + return; + } + if (broadcast) { + data.get_nwaiters_to_unblock() += nsignals_to_issue = data.get_nwaiters_blocked(); + data.get_nwaiters_blocked() = 0; + } + else { + nsignals_to_issue = 1; + data.get_nwaiters_to_unblock()++; + data.get_nwaiters_blocked()--; + } + } + else if ( data.get_nwaiters_blocked() > data.get_nwaiters_gone() ) { // HARMLESS RACE CONDITION! + data.get_sem_block_lock().wait(); // close the gate + if ( 0 != data.get_nwaiters_gone() ) { + data.get_nwaiters_blocked() -= data.get_nwaiters_gone(); + data.get_nwaiters_gone() = 0; + } + if (broadcast) { + nsignals_to_issue = data.get_nwaiters_to_unblock() = data.get_nwaiters_blocked(); + data.get_nwaiters_blocked() = 0; + } + else { + nsignals_to_issue = data.get_nwaiters_to_unblock() = 1; + data.get_nwaiters_blocked()--; + } + } + else { // NO-OP + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + return; + } + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + } + data.get_sem_block_queue().post(nsignals_to_issue); +} + +template +template +inline bool condition_algorithm_8a::wait + ( ConditionMembers &data + , Lock &lock + , bool tout_enabled + , const boost::posix_time::ptime &abs_time + ) +{ + //Initialize to avoid warnings + integer_type nsignals_was_left = 0; + integer_type nwaiters_was_gone = 0; + + data.get_sem_block_lock().wait(); + ++data.get_nwaiters_blocked(); + data.get_sem_block_lock().post(); + + //Unlock external lock and program for relock + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + + bool bTimedOut = tout_enabled + ? !data.get_sem_block_queue().timed_wait(abs_time) + : (data.get_sem_block_queue().wait(), false); + + { + scoped_lock locker(data.get_mtx_unblock_lock()); + if ( 0 != (nsignals_was_left = data.get_nwaiters_to_unblock()) ) { + if ( bTimedOut ) { // timeout (or canceled) + if ( 0 != data.get_nwaiters_blocked() ) { + data.get_nwaiters_blocked()--; + } + else { + data.get_nwaiters_gone()++; // count spurious wakeups. + } + } + if ( 0 == --data.get_nwaiters_to_unblock() ) { + if ( 0 != data.get_nwaiters_blocked() ) { + data.get_sem_block_lock().post(); // open the gate. + nsignals_was_left = 0; // do not open the gate below again. + } + else if ( 0 != (nwaiters_was_gone = data.get_nwaiters_gone()) ) { + data.get_nwaiters_gone() = 0; + } + } + } + else if ( (std::numeric_limits::max)()/2 + == ++data.get_nwaiters_gone() ) { // timeout/canceled or spurious semaphore :-) + data.get_sem_block_lock().wait(); + data.get_nwaiters_blocked() -= data.get_nwaiters_gone(); // something is going on here - test of timeouts? :-) + data.get_sem_block_lock().post(); + data.get_nwaiters_gone() = 0; + } + //locker's destructor triggers data.get_mtx_unblock_lock().unlock() + } + + if ( 1 == nsignals_was_left ) { + if ( 0 != nwaiters_was_gone ) { + // sem_adjust( data.get_sem_block_queue(),-nwaiters_was_gone ); + while ( nwaiters_was_gone-- ) { + data.get_sem_block_queue().wait(); // better now than spurious later + } + } + data.get_sem_block_lock().post(); // open the gate + } + + //lock.lock(); called from unlocker destructor + + return ( bTimedOut ) ? false : true; +} + + +template +class condition_8a_wrapper +{ + //Non-copyable + condition_8a_wrapper(const condition_8a_wrapper &); + condition_8a_wrapper &operator=(const condition_8a_wrapper &); + + ConditionMembers m_data; + typedef ipcdetail::condition_algorithm_8a algo_type; + + public: + + condition_8a_wrapper(){} + + ~condition_8a_wrapper(){} + + ConditionMembers & get_members() + { return m_data; } + + const ConditionMembers & get_members() const + { return m_data; } + + void notify_one() + { algo_type::signal(m_data, false); } + + void notify_all() + { algo_type::signal(m_data, true); } + + template + void wait(L& lock) + { + if (!lock) + throw lock_exception(); + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + void wait(L& lock, Pr pred) + { + if (!lock) + throw lock_exception(); + + while (!pred()) + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock); + return true; + } + if (!lock) + throw lock_exception(); + return algo_type::wait(m_data, lock, true, abs_time); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock, pred); + return true; + } + if (!lock) + throw lock_exception(); + while (!pred()){ + if (!algo_type::wait(m_data, lock, true, abs_time)) + return pred(); + } + return true; + } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp new file mode 100644 index 000000000..a276f826b --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/condition_any_algorithm.hpp @@ -0,0 +1,224 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP +#define BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// +// Condition variable 'any' (able to use any type of external mutex) +// +// The code is based on Howard E. Hinnant's ISO C++ N2406 paper. +// Many thanks to Howard for his support and comments. +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + +// Required interface for ConditionAnyMembers +// class ConditionAnyMembers +// { +// typedef implementation_defined mutex_type; +// typedef implementation_defined condvar_type; +// +// condvar &get_condvar() +// mutex_type &get_mutex() +// }; +// +// Must be initialized as following +// +// get_condvar() [no threads blocked] +// get_mutex() [unlocked] + +template +class condition_any_algorithm +{ + private: + condition_any_algorithm(); + ~condition_any_algorithm(); + condition_any_algorithm(const condition_any_algorithm &); + condition_any_algorithm &operator=(const condition_any_algorithm &); + + typedef typename ConditionAnyMembers::mutex_type mutex_type; + typedef typename ConditionAnyMembers::condvar_type condvar_type; + + template + static void do_wait(ConditionAnyMembers &data, Lock& lock); + + template + static bool do_timed_wait(ConditionAnyMembers &data, Lock& lock, const boost::posix_time::ptime &abs_time); + + public: + template + static bool wait ( ConditionAnyMembers &data, Lock &mut + , bool timeout_enabled, const boost::posix_time::ptime &abs_time); + static void signal( ConditionAnyMembers &data, bool broadcast); +}; + +template +void condition_any_algorithm::signal(ConditionAnyMembers &data, bool broadcast) +{ + scoped_lock internal_lock(data.get_mutex()); + if(broadcast){ + data.get_condvar().notify_all(); + } + else{ + data.get_condvar().notify_one(); + } +} + +template +template +bool condition_any_algorithm::wait + ( ConditionAnyMembers &data + , Lock &lock + , bool tout_enabled + , const boost::posix_time::ptime &abs_time) +{ + if(tout_enabled){ + return condition_any_algorithm::do_timed_wait(data, lock, abs_time); + } + else{ + condition_any_algorithm::do_wait(data, lock); + return true; + } +} + +template +template +void condition_any_algorithm::do_wait + (ConditionAnyMembers &data, Lock& lock) +{ + //lock internal before unlocking external to avoid race with a notifier + scoped_lock internal_lock(data.get_mutex()); + { + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + { //unlock internal first to avoid deadlock with near simultaneous waits + scoped_lock internal_unlock; + internal_lock.swap(internal_unlock); + data.get_condvar().wait(internal_unlock); + } + } +} + +template +template +bool condition_any_algorithm::do_timed_wait + (ConditionAnyMembers &data, Lock& lock, const boost::posix_time::ptime &abs_time) +{ + //lock internal before unlocking external to avoid race with a notifier + scoped_lock internal_lock(data.get_mutex()); + { + //Unlock external lock and program for relock + lock_inverter inverted_lock(lock); + scoped_lock > external_unlock(inverted_lock); + { //unlock internal first to avoid deadlock with near simultaneous waits + scoped_lock internal_unlock; + internal_lock.swap(internal_unlock); + return data.get_condvar().timed_wait(internal_unlock, abs_time); + } + } +} + + +template +class condition_any_wrapper +{ + //Non-copyable + condition_any_wrapper(const condition_any_wrapper &); + condition_any_wrapper &operator=(const condition_any_wrapper &); + + ConditionAnyMembers m_data; + typedef ipcdetail::condition_any_algorithm algo_type; + + public: + + condition_any_wrapper(){} + + ~condition_any_wrapper(){} + + ConditionAnyMembers & get_members() + { return m_data; } + + const ConditionAnyMembers & get_members() const + { return m_data; } + + void notify_one() + { algo_type::signal(m_data, false); } + + void notify_all() + { algo_type::signal(m_data, true); } + + template + void wait(L& lock) + { + if (!lock) + throw lock_exception(); + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + void wait(L& lock, Pr pred) + { + if (!lock) + throw lock_exception(); + + while (!pred()) + algo_type::wait(m_data, lock, false, boost::posix_time::ptime()); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock); + return true; + } + if (!lock) + throw lock_exception(); + return algo_type::wait(m_data, lock, true, abs_time); + } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(lock, pred); + return true; + } + if (!lock) + throw lock_exception(); + while (!pred()){ + if (!algo_type::wait(m_data, lock, true, abs_time)) + return pred(); + } + return true; + } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp b/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp new file mode 100644 index 000000000..fbb003aa0 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/detail/locks.hpp @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_LOCKS_HPP +#define BOOST_INTERPROCESS_DETAIL_LOCKS_HPP + +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +template +class internal_mutex_lock +{ + typedef void (internal_mutex_lock::*unspecified_bool_type)(); + public: + + typedef typename Lock::mutex_type::internal_mutex_type mutex_type; + + + internal_mutex_lock(Lock &l) + : l_(l) + {} + + mutex_type* mutex() const + { return l_ ? &l_.mutex()->internal_mutex() : 0; } + + void lock() { l_.lock(); } + + void unlock() { l_.unlock(); } + + operator unspecified_bool_type() const + { return l_ ? &internal_mutex_lock::lock : 0; } + + private: + Lock &l_; +}; + +template +class lock_inverter +{ + Lock &l_; + public: + lock_inverter(Lock &l) + : l_(l) + {} + void lock() { l_.unlock(); } + void unlock() { l_.lock(); } +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_LOCKS_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp index a60b814a4..ef1c68a44 100644 --- a/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/file_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -53,21 +53,21 @@ class file_lock //!exist or there are no operating system resources. file_lock(const char *name); - //!Moves the ownership of "moved"'s file mapping object to *this. - //!After the call, "moved" does not represent any file mapping object. + //!Moves the ownership of "moved"'s file mapping object to *this. + //!After the call, "moved" does not represent any file mapping object. //!Does not throw file_lock(BOOST_RV_REF(file_lock) moved) : m_file_hnd(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s file mapping to *this. - //!After the call, "moved" does not represent any file mapping. + //!After the call, "moved" does not represent any file mapping. //!Does not throw file_lock &operator=(BOOST_RV_REF(file_lock) moved) - { + { file_lock tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Closes a file lock. Does not throw. @@ -81,7 +81,7 @@ class file_lock m_file_hnd = other.m_file_hnd; other.m_file_hnd = tmp; } - + //Exclusive locking //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, @@ -101,12 +101,12 @@ class file_lock //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, or sharable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -120,21 +120,21 @@ class file_lock //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership of the - //! mutex this succeeds. + //! mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive ownership of - //! the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); /// @cond @@ -171,7 +171,7 @@ class file_lock bool timed_acquire_file_lock_sharable (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime &abs_time) - { + { //Obtain current count and target time boost::posix_time::ptime now = microsec_clock::universal_time(); using namespace boost::detail; diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp index b0e74fc34..c30e870d7 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,9 +31,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -54,6 +55,11 @@ class named_condition; //!This class is a condition variable that can be placed in shared memory or //!memory mapped files. +//!Destroys the object of type std::condition_variable_any +//! +//!Unlike std::condition_variable in C++11, it is NOT safe to invoke the destructor if all +//!threads have been only notified. It is required that they have exited their respective wait +//!functions. class interprocess_condition { /// @cond @@ -62,15 +68,18 @@ class interprocess_condition interprocess_condition &operator=(const interprocess_condition &); friend class named_condition; /// @endcond + public: //!Constructs a interprocess_condition. On error throws interprocess_exception. - interprocess_condition(){} + interprocess_condition() + {} //!Destroys *this //!liberating system resources. - ~interprocess_condition(){} + ~interprocess_condition() + {} - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect. void notify_one() { m_condition.notify_one(); } @@ -80,15 +89,14 @@ class interprocess_condition void notify_all() { m_condition.notify_all(); } - //!Releases the lock on the interprocess_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock) - { - if (!lock) - throw lock_exception(); - this->do_wait(*lock.mutex()); + { + ipcdetail::internal_mutex_lock internal_lock(lock); + m_condition.wait(internal_lock); } //!The same as: @@ -96,58 +104,34 @@ class interprocess_condition template void wait(L& lock, Pr pred) { - if (!lock) - throw lock_exception(); - - while (!pred()) - this->do_wait(*lock.mutex()); + ipcdetail::internal_mutex_lock internal_lock(lock); + m_condition.wait(internal_lock, pred); } - //!Releases the lock on the interprocess_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(abs_time, *lock.mutex()); + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_condition.timed_wait(internal_lock, abs_time); } - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - while (!pred()){ - if (!this->do_timed_wait(abs_time, *lock.mutex())) - return pred(); - } - - return true; + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_condition.timed_wait(internal_lock, abs_time, pred); } /// @cond - void do_wait(interprocess_mutex &mut) - { m_condition.do_wait(mut.mutex); } - - bool do_timed_wait(const boost::posix_time::ptime &abs_time, interprocess_mutex &mut) - { return m_condition.do_timed_wait(abs_time, mut.mutex); } - private: #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp new file mode 100644 index 000000000..dd2079467 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_condition_any.hpp @@ -0,0 +1,129 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +/// @cond + +#include +#include + +#include +#include +#include +#include +#include + +/// @endcond + +//!\file +//!Describes process-shared variables interprocess_condition_any class + +namespace boost { + +namespace posix_time +{ class ptime; } + +namespace interprocess { + +//!This class is a condition variable that can be placed in shared memory or +//!memory mapped files. +//! +//!The interprocess_condition_any class is a generalization of interprocess_condition. +//!Whereas interprocess_condition works only on Locks with mutex_type == interprocess_mutex +//!interprocess_condition_any can operate on any user-defined lock that meets the BasicLockable +//!requirements (lock()/unlock() member functions). +//! +//!Unlike std::condition_variable_any in C++11, it is NOT safe to invoke the destructor if all +//!threads have been only notified. It is required that they have exited their respective wait +//!functions. +class interprocess_condition_any +{ + /// @cond + //Non-copyable + interprocess_condition_any(const interprocess_condition_any &); + interprocess_condition_any &operator=(const interprocess_condition_any &); + + class members + { + public: + typedef interprocess_condition condvar_type; + typedef interprocess_mutex mutex_type; + + condvar_type &get_condvar() { return m_cond; } + mutex_type &get_mutex() { return m_mut; } + + private: + condvar_type m_cond; + mutex_type m_mut; + }; + + ipcdetail::condition_any_wrapper m_cond; + + /// @endcond + public: + //!Constructs a interprocess_condition_any. On error throws interprocess_exception. + interprocess_condition_any(){} + + //!Destroys *this + //!liberating system resources. + ~interprocess_condition_any(){} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect. + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { m_cond.wait(lock, pred); } + + //!Releases the lock on the interprocess_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } +}; + +} //namespace interprocess +} // namespace boost + +#include + +#endif // BOOST_INTERPROCESS_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp index 478cf78cc..5615e8b9a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -31,9 +31,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -61,7 +61,7 @@ namespace interprocess { class interprocess_condition; -//!Wraps a interprocess_mutex that can be placed in shared memory and can be +//!Wraps a interprocess_mutex that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_mutex { @@ -70,6 +70,25 @@ class interprocess_mutex interprocess_mutex(const interprocess_mutex &); interprocess_mutex &operator=(const interprocess_mutex &); friend class interprocess_condition; + + public: + #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) + #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION + typedef ipcdetail::spin_mutex internal_mutex_type; + private: + friend class ipcdetail::robust_emulation_helpers::mutex_traits; + void take_ownership(){ m_mutex.take_ownership(); } + public: + #elif defined(BOOST_INTERPROCESS_USE_POSIX) + #undef BOOST_INTERPROCESS_USE_POSIX + typedef ipcdetail::posix_mutex internal_mutex_type; + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + #undef BOOST_INTERPROCESS_USE_WINDOWS + typedef ipcdetail::windows_mutex internal_mutex_type; + #else + #error "Unknown platform for interprocess_mutex" + #endif + /// @endcond public: @@ -98,32 +117,25 @@ class interprocess_mutex //!Effects: The calling thread will try to obtain exclusive ownership of the //! mutex if it can do so in until the specified time is reached. If the //! mutex supports recursive locking, the mutex must be unlocked the same - //! number of times it is locked. + //! number of times it is locked. //!Returns: If the thread acquires ownership of the mutex, returns true, if - //! the timeout expires returns false. + //! the timeout expires returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: interprocess_exception on error. void unlock(); - /// @cond - private: - #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) - #undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION - friend class ipcdetail::robust_emulation_helpers::mutex_traits; - void take_ownership(){ mutex.take_ownership(); } - ipcdetail::spin_mutex mutex; - #elif defined(BOOST_INTERPROCESS_USE_POSIX) - #undef BOOST_INTERPROCESS_USE_POSIX - ipcdetail::posix_mutex mutex; - #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) - #undef BOOST_INTERPROCESS_USE_WINDOWS - ipcdetail::windows_mutex mutex; - #else - #error "Unknown platform for interprocess_mutex" - #endif + /// @cond + internal_mutex_type &internal_mutex() + { return m_mutex; } + + const internal_mutex_type &internal_mutex() const + { return m_mutex; } + + private: + internal_mutex_type m_mutex; /// @endcond }; @@ -144,23 +156,25 @@ inline void interprocess_mutex::lock() boost::posix_time::ptime wait_time = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::milliseconds(BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS); - if (!mutex.timed_lock(wait_time)) + if (!m_mutex.timed_lock(wait_time)) { - throw interprocess_exception(timeout_when_locking_error, "Interprocess mutex timeout when locking. Possible deadlock: owner died without unlocking?"); + throw interprocess_exception(timeout_when_locking_error + , "Interprocess mutex timeout when locking. Possible deadlock: " + "owner died without unlocking?"); } #else - mutex.lock(); + m_mutex.lock(); #endif } inline bool interprocess_mutex::try_lock() -{ return mutex.try_lock(); } +{ return m_mutex.try_lock(); } inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time) -{ return mutex.timed_lock(abs_time); } +{ return m_mutex.timed_lock(abs_time); } inline void interprocess_mutex::unlock() -{ mutex.unlock(); } +{ m_mutex.unlock(); } } //namespace interprocess { } //namespace boost { diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp index 308819ff2..1c5dad370 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -43,9 +43,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -72,8 +72,8 @@ class mutex_traits; namespace boost { namespace interprocess { -//!Wraps a interprocess_mutex that can be placed in shared memory and can be -//!shared between processes. Allows several locking calls by the same +//!Wraps a interprocess_mutex that can be placed in shared memory and can be +//!shared between processes. Allows several locking calls by the same //!process. Allows timed lock tries class interprocess_recursive_mutex { @@ -99,7 +99,7 @@ class interprocess_recursive_mutex //!Throws: interprocess_exception on error. void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. The mutex must be unlocked //!the same number of times it is locked. //!Throws: interprocess_exception if a severe error is found diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp index 4ffcdcf69..2fe058183 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -29,9 +29,9 @@ #include #define BOOST_INTERPROCESS_USE_POSIX //Experimental... -//#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) -// #include -// #define BOOST_INTERPROCESS_USE_WINDOWS +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #elif !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION @@ -45,7 +45,7 @@ namespace boost { namespace interprocess { -//!Wraps a interprocess_semaphore that can be placed in shared memory and can be +//!Wraps a interprocess_semaphore that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_semaphore { @@ -55,7 +55,7 @@ class interprocess_semaphore interprocess_semaphore &operator=(const interprocess_semaphore &); /// @endcond public: - //!Creates a interprocess_semaphore with the given initial count. + //!Creates a interprocess_semaphore with the given initial count. //!interprocess_exception if there is an error.*/ interprocess_semaphore(unsigned int initialCount); @@ -69,7 +69,7 @@ class interprocess_semaphore void post(); //!Decrements the interprocess_semaphore. If the interprocess_semaphore value is not greater than zero, - //!then the calling process/thread blocks until it can decrement the counter. + //!then the calling process/thread blocks until it can decrement the counter. //!If there is an error an interprocess_exception exception is thrown. void wait(); @@ -95,7 +95,7 @@ class interprocess_semaphore #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) #undef BOOST_INTERPROCESS_USE_WINDOWS ipcdetail::windows_semaphore m_sem; - #else + #else #undef BOOST_INTERPROCESS_USE_POSIX ipcdetail::posix_semaphore m_sem; #endif //#if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp new file mode 100644 index 000000000..98eeea415 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_sharable_mutex.hpp @@ -0,0 +1,347 @@ +////////////////////////////////////////////////////////////////////////////// +// Code based on Howard Hinnant's shared_mutex class +// +// (C) Copyright Howard Hinnant 2007-2010. Distributed under the Boost +// Software License, Version 1.0. (see http://www.boost.org/LICENSE_1_0.txt) +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP +#define BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + + +//!\file +//!Describes interprocess_sharable_mutex class + +namespace boost { +namespace interprocess { + +//!Wraps a interprocess_sharable_mutex that can be placed in shared memory and can be +//!shared between processes. Allows timed lock tries +class interprocess_sharable_mutex +{ + //Non-copyable + interprocess_sharable_mutex(const interprocess_sharable_mutex &); + interprocess_sharable_mutex &operator=(const interprocess_sharable_mutex &); + + friend class interprocess_condition; + public: + + //!Constructs the sharable lock. + //!Throws interprocess_exception on error. + interprocess_sharable_mutex(); + + //!Destroys the sharable lock. + //!Does not throw. + ~interprocess_sharable_mutex(); + + //Exclusive locking + + //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, + //! and if another thread has exclusive or sharable ownership of + //! the mutex, it waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! without waiting. If no other thread has exclusive or sharable + //! ownership of the mutex this succeeds. + //!Returns: If it can acquire exclusive ownership immediately returns true. + //! If it has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! waiting if necessary until no other thread has exclusive or sharable + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock(); + + //Sharable locking + + //!Effects: The calling thread tries to obtain sharable ownership of the mutex, + //! and if another thread has exclusive ownership of the mutex, + //! waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! without waiting. If no other thread has exclusive ownership + //! of the mutex this succeeds. + //!Returns: If it can acquire sharable ownership immediately returns true. If it + //! has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! waiting if necessary until no other thread has exclusive + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock_sharable(); + + /// @cond + private: + typedef scoped_lock scoped_lock_t; + + //Pack all the control data in a word to be able + //to use atomic instructions in the future + struct control_word_t + { + unsigned exclusive_in : 1; + unsigned num_shared : sizeof(unsigned)*CHAR_BIT-1; + } m_ctrl; + + interprocess_mutex m_mut; + interprocess_condition m_first_gate; + interprocess_condition m_second_gate; + + private: + //Rollback structures for exceptions or failure return values + struct exclusive_rollback + { + exclusive_rollback(control_word_t &ctrl + ,interprocess_condition &first_gate) + : mp_ctrl(&ctrl), m_first_gate(first_gate) + {} + + void release() + { mp_ctrl = 0; } + + ~exclusive_rollback() + { + if(mp_ctrl){ + mp_ctrl->exclusive_in = 0; + m_first_gate.notify_all(); + } + } + control_word_t *mp_ctrl; + interprocess_condition &m_first_gate; + }; + + template + struct base_constants_t + { + static const unsigned max_readers + = ~(unsigned(1) << (sizeof(unsigned)*CHAR_BIT-1)); + }; + typedef base_constants_t<0> constants; + /// @endcond +}; + +/// @cond + +template +const unsigned interprocess_sharable_mutex::base_constants_t::max_readers; + +inline interprocess_sharable_mutex::interprocess_sharable_mutex() +{ + this->m_ctrl.exclusive_in = 0; + this->m_ctrl.num_shared = 0; +} + +inline interprocess_sharable_mutex::~interprocess_sharable_mutex() +{} + +inline void interprocess_sharable_mutex::lock() +{ + scoped_lock_t lck(m_mut); + + //The exclusive lock must block in the first gate + //if an exclusive lock has been acquired + while (this->m_ctrl.exclusive_in){ + this->m_first_gate.wait(lck); + } + + //Mark that exclusive lock has been acquired + this->m_ctrl.exclusive_in = 1; + + //Prepare rollback + exclusive_rollback rollback(this->m_ctrl, this->m_first_gate); + + //Now wait until all readers are gone + while (this->m_ctrl.num_shared){ + this->m_second_gate.wait(lck); + } + rollback.release(); +} + +inline bool interprocess_sharable_mutex::try_lock() +{ + scoped_lock_t lck(m_mut, try_to_lock); + + //If we can't lock or any has there is any exclusive + //or sharable mark return false; + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared){ + return false; + } + this->m_ctrl.exclusive_in = 1; + return true; +} + +inline bool interprocess_sharable_mutex::timed_lock + (const boost::posix_time::ptime &abs_time) +{ + if(abs_time == boost::posix_time::pos_infin){ + this->lock(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; + + //The exclusive lock must block in the first gate + //if an exclusive lock has been acquired + while (this->m_ctrl.exclusive_in){ + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in){ + return false; + } + break; + } + } + + //Mark that exclusive lock has been acquired + this->m_ctrl.exclusive_in = 1; + + //Prepare rollback + exclusive_rollback rollback(this->m_ctrl, this->m_first_gate); + + //Now wait until all readers are gone + while (this->m_ctrl.num_shared){ + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_shared){ + return false; + } + break; + } + } + rollback.release(); + return true; +} + +inline void interprocess_sharable_mutex::unlock() +{ + scoped_lock_t lck(m_mut); + this->m_ctrl.exclusive_in = 0; + this->m_first_gate.notify_all(); +} + +//Sharable locking + +inline void interprocess_sharable_mutex::lock_sharable() +{ + scoped_lock_t lck(m_mut); + + //The sharable lock must block in the first gate + //if an exclusive lock has been acquired + //or there are too many sharable locks + while(this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + this->m_first_gate.wait(lck); + } + + //Increment sharable count + ++this->m_ctrl.num_shared; +} + +inline bool interprocess_sharable_mutex::try_lock_sharable() +{ + scoped_lock_t lck(m_mut, try_to_lock); + + //The sharable lock must fail + //if an exclusive lock has been acquired + //or there are too many sharable locks + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + return false; + } + + //Increment sharable count + ++this->m_ctrl.num_shared; + return true; +} + +inline bool interprocess_sharable_mutex::timed_lock_sharable + (const boost::posix_time::ptime &abs_time) +{ + if(abs_time == boost::posix_time::pos_infin){ + this->lock_sharable(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; + + //The sharable lock must block in the first gate + //if an exclusive lock has been acquired + //or there are too many sharable locks + while (this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in + || this->m_ctrl.num_shared == constants::max_readers){ + return false; + } + break; + } + } + + //Increment sharable count + ++this->m_ctrl.num_shared; + return true; +} + +inline void interprocess_sharable_mutex::unlock_sharable() +{ + scoped_lock_t lck(m_mut); + //Decrement sharable count + --this->m_ctrl.num_shared; + if (this->m_ctrl.num_shared == 0){ + this->m_second_gate.notify_one(); + } + //Check if there are blocked sharables because of + //there were too many sharables + else if(this->m_ctrl.num_shared == (constants::max_readers-1)){ + this->m_first_gate.notify_all(); + } +} + +/// @endcond + +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp index 048407f4b..0ba6b4a9b 100644 --- a/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/interprocess_upgradable_mutex.hpp @@ -1,6 +1,8 @@ -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// Code based on Howard Hinnant's upgrade_mutex class +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -30,7 +32,7 @@ namespace boost { namespace interprocess { -//!Wraps a interprocess_upgradable_mutex that can be placed in shared memory and can be +//!Wraps a interprocess_upgradable_mutex that can be placed in shared memory and can be //!shared between processes. Allows timed lock tries class interprocess_upgradable_mutex { @@ -67,13 +69,13 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -87,21 +89,21 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -115,7 +117,7 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -124,74 +126,74 @@ class interprocess_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release their sharable lock. + //! sharable ownership release their sharable lock. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. */ bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! upgradable ownership. This operation will fail if there are threads with sharable - //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //! or upgradable ownership, but it will maintain sharable ownership. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock_upgradable(); @@ -249,7 +251,7 @@ class interprocess_upgradable_mutex if(mp_ctrl){ //Recover upgradable lock mp_ctrl->upgradable_in = 1; - ++mp_ctrl->num_upr_shar; + ++mp_ctrl->num_upr_shar; //Execute the second half of exclusive locking mp_ctrl->exclusive_in = 0; } @@ -260,7 +262,7 @@ class interprocess_upgradable_mutex template struct base_constants_t { - static const unsigned max_readers + static const unsigned max_readers = ~(unsigned(3) << (sizeof(unsigned)*CHAR_BIT-2)); }; typedef base_constants_t<0> constants; @@ -284,12 +286,12 @@ inline interprocess_upgradable_mutex::~interprocess_upgradable_mutex() inline void interprocess_upgradable_mutex::lock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The exclusive lock must block in the first gate //if an exclusive or upgradable lock has been acquired while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Mark that exclusive lock has been acquired @@ -300,19 +302,19 @@ inline void interprocess_upgradable_mutex::lock() //Now wait until all readers are gone while (this->m_ctrl.num_upr_shar){ - this->m_second_gate.wait(lock); + this->m_second_gate.wait(lck); } rollback.release(); } inline bool interprocess_upgradable_mutex::try_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); - //If we can't lock or any has there is any exclusive, upgradable + //If we can't lock or any has there is any exclusive, upgradable //or sharable mark return false; - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar){ return false; } @@ -327,14 +329,18 @@ inline bool interprocess_upgradable_mutex::timed_lock this->lock(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The exclusive lock must block in the first gate //if an exclusive or upgradable lock has been acquired while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ - if(!this->m_first_gate.timed_wait(lock, abs_time)) - return !(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ + return false; + } + break; + } } //Mark that exclusive lock has been acquired @@ -345,8 +351,11 @@ inline bool interprocess_upgradable_mutex::timed_lock //Now wait until all readers are gone while (this->m_ctrl.num_upr_shar){ - if(!this->m_second_gate.timed_wait(lock, abs_time)){ - return !(this->m_ctrl.num_upr_shar); + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_upr_shar){ + return false; + } + break; } } rollback.release(); @@ -355,7 +364,7 @@ inline bool interprocess_upgradable_mutex::timed_lock inline void interprocess_upgradable_mutex::unlock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); this->m_ctrl.exclusive_in = 0; this->m_first_gate.notify_all(); } @@ -364,14 +373,14 @@ inline void interprocess_upgradable_mutex::unlock() inline void interprocess_upgradable_mutex::lock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The upgradable lock must block in the first gate //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks while(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Mark that upgradable lock has been acquired @@ -382,14 +391,14 @@ inline void interprocess_upgradable_mutex::lock_upgradable() inline bool interprocess_upgradable_mutex::try_lock_upgradable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The upgradable lock must fail //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks - if(!lock.owns() - || this->m_ctrl.exclusive_in - || this->m_ctrl.upgradable_in + if(!lck.owns() + || this->m_ctrl.exclusive_in + || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ return false; } @@ -408,19 +417,22 @@ inline bool interprocess_upgradable_mutex::timed_lock_upgradable this->lock_upgradable(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The upgradable lock must block in the first gate //if an exclusive or upgradable lock has been acquired //or there are too many sharable locks - while(this->m_ctrl.exclusive_in + while(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - if(!this->m_first_gate.timed_wait(lock, abs_time)){ - return!(this->m_ctrl.exclusive_in - || this->m_ctrl.upgradable_in - || this->m_ctrl.num_upr_shar == constants::max_readers); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if((this->m_ctrl.exclusive_in + || this->m_ctrl.upgradable_in + || this->m_ctrl.num_upr_shar == constants::max_readers)){ + return false; + } + break; } } @@ -433,7 +445,7 @@ inline bool interprocess_upgradable_mutex::timed_lock_upgradable inline void interprocess_upgradable_mutex::unlock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Mark that upgradable lock has been acquired //And add upgradable to the sharable count this->m_ctrl.upgradable_in = 0; @@ -445,14 +457,14 @@ inline void interprocess_upgradable_mutex::unlock_upgradable() inline void interprocess_upgradable_mutex::lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //The sharable lock must block in the first gate //if an exclusive lock has been acquired //or there are too many sharable locks while(this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - this->m_first_gate.wait(lock); + this->m_first_gate.wait(lck); } //Increment sharable count @@ -461,12 +473,12 @@ inline void interprocess_upgradable_mutex::lock_sharable() inline bool interprocess_upgradable_mutex::try_lock_sharable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The sharable lock must fail //if an exclusive lock has been acquired //or there are too many sharable locks - if(!lock.owns() + if(!lck.owns() || this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ return false; @@ -484,17 +496,20 @@ inline bool interprocess_upgradable_mutex::timed_lock_sharable this->lock_sharable(); return true; } - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //The sharable lock must block in the first gate //if an exclusive lock has been acquired //or there are too many sharable locks while (this->m_ctrl.exclusive_in || this->m_ctrl.num_upr_shar == constants::max_readers){ - if(!this->m_first_gate.timed_wait(lock, abs_time)){ - return!(this->m_ctrl.exclusive_in - || this->m_ctrl.num_upr_shar == constants::max_readers); + if(!this->m_first_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.exclusive_in + || this->m_ctrl.num_upr_shar == constants::max_readers){ + return false; + } + break; } } @@ -505,7 +520,7 @@ inline bool interprocess_upgradable_mutex::timed_lock_sharable inline void interprocess_upgradable_mutex::unlock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Decrement sharable count --this->m_ctrl.num_upr_shar; if (this->m_ctrl.num_upr_shar == 0){ @@ -522,7 +537,7 @@ inline void interprocess_upgradable_mutex::unlock_sharable() inline void interprocess_upgradable_mutex::unlock_and_lock_upgradable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as exclusive this->m_ctrl.exclusive_in = 0; //Mark it as upgradable @@ -535,7 +550,7 @@ inline void interprocess_upgradable_mutex::unlock_and_lock_upgradable() inline void interprocess_upgradable_mutex::unlock_and_lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as exclusive this->m_ctrl.exclusive_in = 0; //The sharable count should be 0 so increment it @@ -546,7 +561,7 @@ inline void interprocess_upgradable_mutex::unlock_and_lock_sharable() inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Unmark it as upgradable (we don't have to decrement count) this->m_ctrl.upgradable_in = 0; //Notify readers/upgradable that they can enter @@ -557,11 +572,11 @@ inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable() inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock() { - scoped_lock_t lock(m_mut); + scoped_lock_t lck(m_mut); //Simulate unlock_upgradable() without //notifying sharables. this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; //Execute the second half of exclusive locking this->m_ctrl.exclusive_in = 1; @@ -569,22 +584,22 @@ inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock() upgradable_to_exclusive_rollback rollback(m_ctrl); while (this->m_ctrl.num_upr_shar){ - this->m_second_gate.wait(lock); + this->m_second_gate.wait(lck); } rollback.release(); } inline bool interprocess_upgradable_mutex::try_unlock_upgradable_and_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //Check if there are no readers - if(!lock.owns() + if(!lck.owns() || this->m_ctrl.num_upr_shar != 1){ return false; } //Now unlock upgradable and mark exclusive this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; this->m_ctrl.exclusive_in = 1; return true; } @@ -592,13 +607,17 @@ inline bool interprocess_upgradable_mutex::try_unlock_upgradable_and_lock() inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock (const boost::posix_time::ptime &abs_time) { - scoped_lock_t lock(m_mut, abs_time); - if(!lock.owns()) return false; + if(abs_time == boost::posix_time::pos_infin){ + this->unlock_upgradable_and_lock(); + return true; + } + scoped_lock_t lck(m_mut, abs_time); + if(!lck.owns()) return false; //Simulate unlock_upgradable() without //notifying sharables. this->m_ctrl.upgradable_in = 0; - --this->m_ctrl.num_upr_shar; + --this->m_ctrl.num_upr_shar; //Execute the second half of exclusive locking this->m_ctrl.exclusive_in = 1; @@ -606,8 +625,11 @@ inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock upgradable_to_exclusive_rollback rollback(m_ctrl); while (this->m_ctrl.num_upr_shar){ - if(!this->m_second_gate.timed_wait(lock, abs_time)){ - return !(this->m_ctrl.num_upr_shar); + if(!this->m_second_gate.timed_wait(lck, abs_time)){ + if(this->m_ctrl.num_upr_shar){ + return false; + } + break; } } rollback.release(); @@ -616,12 +638,12 @@ inline bool interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); - //If we can't lock or any has there is any exclusive, upgradable + //If we can't lock or any has there is any exclusive, upgradable //or sharable mark return false; - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in || this->m_ctrl.num_upr_shar != 1){ return false; @@ -633,12 +655,12 @@ inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock() inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock_upgradable() { - scoped_lock_t lock(m_mut, try_to_lock); + scoped_lock_t lck(m_mut, try_to_lock); //The upgradable lock must fail //if an exclusive or upgradable lock has been acquired - if(!lock.owns() - || this->m_ctrl.exclusive_in + if(!lck.owns() + || this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){ return false; } diff --git a/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp b/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp index 74f3399a4..1139d83a1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/lock_options.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp b/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp index a9215e24f..0636de0d4 100644 --- a/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/mutex_family.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -29,7 +29,7 @@ namespace boost { namespace interprocess { -//!Describes interprocess_mutex family to use with Interprocess framework +//!Describes interprocess_mutex family to use with Interprocess framework //!based on boost::interprocess synchronization objects. struct mutex_family { @@ -37,7 +37,7 @@ struct mutex_family typedef boost::interprocess::interprocess_recursive_mutex recursive_mutex_type; }; -//!Describes interprocess_mutex family to use with Interprocess frameworks +//!Describes interprocess_mutex family to use with Interprocess frameworks //!based on null operation synchronization objects. struct null_mutex_family { diff --git a/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp index c5529eda6..7c570f4ba 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -22,7 +22,13 @@ #include #include #include -#include +#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif //!\file //!Describes a named condition class for inter-process synchronization @@ -50,7 +56,7 @@ class named_condition //!If the condition can't be created throws interprocess_exception named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global condition with a name. + //!Opens or creates a global condition with a name. //!If the condition is created, this call is equivalent to //!named_condition(create_only_t, ... ) //!If the condition is already created, this call is equivalent @@ -71,7 +77,7 @@ class named_condition //!use remove(). ~named_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect.*/ void notify_one(); @@ -79,8 +85,8 @@ class named_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock); @@ -90,16 +96,16 @@ class named_condition template void wait(L& lock, Pr pred); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time); - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred); @@ -110,7 +116,12 @@ class named_condition /// @cond private: - ipcdetail::shm_named_condition m_cond; + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_condition condition_type; + #else + typedef ipcdetail::shm_named_condition condition_type; + #endif + condition_type m_cond; friend class ipcdetail::interprocess_tester; void dont_close_on_destruction() @@ -143,24 +154,38 @@ inline void named_condition::notify_all() template inline void named_condition::wait(L& lock) -{ m_cond.wait(lock); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock); +} template inline void named_condition::wait(L& lock, Pr pred) -{ m_cond.wait(lock, pred); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock, pred); +} template inline bool named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) -{ return m_cond.timed_wait(lock, abs_time); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time); +} template inline bool named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) -{ return m_cond.timed_wait(lock, abs_time, pred); } +{ + ipcdetail::internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time, pred); +} inline bool named_condition::remove(const char *name) -{ return ipcdetail::shm_named_condition::remove(name); } +{ + return condition_type::remove(name); +} /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp new file mode 100644 index 000000000..f8f204bc1 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/named_condition_any.hpp @@ -0,0 +1,151 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif + +//!\file +//!Describes a named condition class for inter-process synchronization + +namespace boost { +namespace interprocess { + +/// @cond +namespace ipcdetail{ class interprocess_tester; } +/// @endcond + +//! A global condition variable that can be created by name. +//! This condition variable is designed to work with named_mutex and +//! can't be placed in shared memory or memory mapped files. +class named_condition_any +{ + /// @cond + //Non-copyable + named_condition_any(); + named_condition_any(const named_condition_any &); + named_condition_any &operator=(const named_condition_any &); + /// @endcond + public: + //!Creates a global condition with a name. + //!If the condition can't be created throws interprocess_exception + named_condition_any(create_only_t, const char *name, const permissions &perm = permissions()) + : m_cond(create_only_t(), name, perm) + {} + + //!Opens or creates a global condition with a name. + //!If the condition is created, this call is equivalent to + //!named_condition_any(create_only_t, ... ) + //!If the condition is already created, this call is equivalent + //!named_condition_any(open_only_t, ... ) + //!Does not throw + named_condition_any(open_or_create_t, const char *name, const permissions &perm = permissions()) + : m_cond(open_or_create_t(), name, perm) + {} + + //!Opens a global condition with a name if that condition is previously + //!created. If it is not previously created this function throws + //!interprocess_exception. + named_condition_any(open_only_t, const char *name) + : m_cond(open_only_t(), name) + {} + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~named_condition_any() + {} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect.*/ + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { return m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { return m_cond.wait(lock, pred); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } + + //!Erases a named condition from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name) + { return condition_any_type::remove(name); } + + /// @cond + private: + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_condition_any condition_any_type; + #else + typedef ipcdetail::shm_named_condition_any condition_any_type; + #endif + condition_any_type m_cond; + + friend class ipcdetail::interprocess_tester; + void dont_close_on_destruction() + { ipcdetail::interprocess_tester::dont_close_on_destruction(m_cond); } + /// @endcond +}; + +} //namespace interprocess +} //namespace boost + +#include + +#endif // BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp index 3e56b8179..7deb400ab 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -24,7 +24,11 @@ #include #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) -#include + #include + #define BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #else #include #endif @@ -37,7 +41,7 @@ namespace interprocess { class named_condition; -//!A mutex with a global name, so it can be found from different +//!A mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named_mutex. class named_mutex @@ -56,7 +60,7 @@ class named_mutex //!Throws interprocess_exception on error. named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global mutex with a name. + //!Opens or creates a global mutex with a name. //!If the mutex is created, this call is equivalent to //!named_mutex(create_only_t, ... ) //!If the mutex is already created, this call is equivalent @@ -85,7 +89,7 @@ class named_mutex //!Throws interprocess_exception if a severe error is found void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found bool try_lock(); @@ -104,16 +108,20 @@ class named_mutex friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - typedef ipcdetail::posix_named_mutex impl_t; - impl_t m_mut; - #else - typedef ipcdetail::shm_named_mutex impl_t; - impl_t m_mut; public: - interprocess_mutex *mutex() const - { return m_mut.mutex(); } + #if defined(BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES) + typedef ipcdetail::posix_named_mutex internal_mutex_type; + #undef BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_mutex internal_mutex_type; + #undef BOOST_INTERPROCESS_USE_WINDOWS + #else + typedef ipcdetail::shm_named_mutex internal_mutex_type; #endif + internal_mutex_type &internal_mutex() + { return m_mut; } + + internal_mutex_type m_mut; /// @endcond }; @@ -151,7 +159,7 @@ inline bool named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { return m_mut.timed_lock(abs_time); } inline bool named_mutex::remove(const char *name) -{ return impl_t::remove(name); } +{ return internal_mutex_type::remove(name); } /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp index 28768cea6..5849a92d6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -20,7 +20,12 @@ #include #include #include -#include +#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS +#else + #include +#endif //!\file //!Describes a named named_recursive_mutex class for inter-process synchronization @@ -32,7 +37,7 @@ namespace interprocess { namespace ipcdetail{ class interprocess_tester; } /// @endcond -//!A recursive mutex with a global name, so it can be found from different +//!A recursive mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named_recursive_mutex. class named_recursive_mutex @@ -49,7 +54,7 @@ class named_recursive_mutex //!If the recursive_mutex can't be created throws interprocess_exception named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global recursive_mutex with a name. + //!Opens or creates a global recursive_mutex with a name. //!If the recursive_mutex is created, this call is equivalent to //!named_recursive_mutex(create_only_t, ... ) //!If the recursive_mutex is already created, this call is equivalent @@ -78,7 +83,7 @@ class named_recursive_mutex //!Throws interprocess_exception if a severe error is found. void lock(); - //!Tries to lock the named_recursive_mutex, returns false when named_recursive_mutex + //!Tries to lock the named_recursive_mutex, returns false when named_recursive_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found. bool try_lock(); @@ -97,7 +102,12 @@ class named_recursive_mutex friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - typedef ipcdetail::shm_named_recursive_mutex impl_t; + #if defined(BOOST_INTERPROCESS_USE_WINDOWS) + typedef ipcdetail::windows_named_recursive_mutex impl_t; + #undef BOOST_INTERPROCESS_USE_WINDOWS + #else + typedef ipcdetail::shm_named_recursive_mutex impl_t; + #endif impl_t m_mut; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp index 33e06964f..147724588 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -25,6 +25,10 @@ #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES) #include +//Experimental... +#elif !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_WINDOWS) + #include + #define BOOST_INTERPROCESS_USE_WINDOWS #else #include #endif @@ -35,8 +39,8 @@ namespace boost { namespace interprocess { -//!A semaphore with a global name, so it can be found from different -//!processes. Allows several resource sharing patterns and efficient +//!A semaphore with a global name, so it can be found from different +//!processes. Allows several resource sharing patterns and efficient //!acknowledgment mechanisms. class named_semaphore { @@ -49,11 +53,11 @@ class named_semaphore /// @endcond public: - //!Creates a global semaphore with a name, and an initial count. + //!Creates a global semaphore with a name, and an initial count. //!If the semaphore can't be created throws interprocess_exception named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); - //!Opens or creates a global semaphore with a name, and an initial count. + //!Opens or creates a global semaphore with a name, and an initial count. //!If the semaphore is created, this call is equivalent to //!named_semaphore(create_only_t, ...) //!If the semaphore is already created, this call is equivalent to @@ -80,7 +84,7 @@ class named_semaphore void post(); //!Decrements the semaphore. If the semaphore value is not greater than zero, - //!then the calling process/thread blocks until it can decrement the counter. + //!then the calling process/thread blocks until it can decrement the counter. //!If there is an error an interprocess_exception exception is thrown. void wait(); @@ -106,9 +110,12 @@ class named_semaphore void dont_close_on_destruction(); #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES) - typedef ipcdetail::posix_named_semaphore impl_t; + typedef ipcdetail::posix_named_semaphore impl_t; + #elif defined(BOOST_INTERPROCESS_USE_WINDOWS) + #undef BOOST_INTERPROCESS_USE_WINDOWS + typedef ipcdetail::windows_named_semaphore impl_t; #else - typedef ipcdetail::shm_named_semaphore impl_t; + typedef ipcdetail::shm_named_semaphore impl_t; #endif impl_t m_sem; /// @endcond diff --git a/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp new file mode 100644 index 000000000..6ebcebfd2 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/named_sharable_mutex.hpp @@ -0,0 +1,230 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP +#define BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!\file +//!Describes a named sharable mutex class for inter-process synchronization + +namespace boost { +namespace interprocess { + +/// @cond +namespace ipcdetail{ class interprocess_tester; } +/// @endcond + +class named_condition; + +//!A sharable mutex with a global name, so it can be found from different +//!processes. This mutex can't be placed in shared memory, and +//!each process should have it's own named sharable mutex. +class named_sharable_mutex +{ + /// @cond + //Non-copyable + named_sharable_mutex(); + named_sharable_mutex(const named_sharable_mutex &); + named_sharable_mutex &operator=(const named_sharable_mutex &); + /// @endcond + public: + + //!Creates a global sharable mutex with a name. + //!If the sharable mutex can't be created throws interprocess_exception + named_sharable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); + + //!Opens or creates a global sharable mutex with a name. + //!If the sharable mutex is created, this call is equivalent to + //!named_sharable_mutex(create_only_t, ...) + //!If the sharable mutex is already created, this call is equivalent to + //!named_sharable_mutex(open_only_t, ... ). + named_sharable_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); + + //!Opens a global sharable mutex with a name if that sharable mutex + //!is previously. + //!created. If it is not previously created this function throws + //!interprocess_exception. + named_sharable_mutex(open_only_t open_only, const char *name); + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~named_sharable_mutex(); + + //Exclusive locking + + //!Effects: The calling thread tries to obtain exclusive ownership of the mutex, + //! and if another thread has exclusive or sharable ownership of + //! the mutex, it waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! without waiting. If no other thread has exclusive or sharable + //! ownership of the mutex this succeeds. + //!Returns: If it can acquire exclusive ownership immediately returns true. + //! If it has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock(); + + //!Effects: The calling thread tries to acquire exclusive ownership of the mutex + //! waiting if necessary until no other thread has exclusive, or sharable + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock(); + + //Sharable locking + + //!Effects: The calling thread tries to obtain sharable ownership of the mutex, + //! and if another thread has exclusive ownership of the mutex, + //! waits until it can obtain the ownership. + //!Throws: interprocess_exception on error. + void lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! without waiting. If no other thread has exclusive ownership + //! of the mutex this succeeds. + //!Returns: If it can acquire sharable ownership immediately returns true. If it + //! has to wait, returns false. + //!Throws: interprocess_exception on error. + bool try_lock_sharable(); + + //!Effects: The calling thread tries to acquire sharable ownership of the mutex + //! waiting if necessary until no other thread has exclusive + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //!Throws: interprocess_exception on error. + bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); + + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Throws: An exception derived from interprocess_exception on error. + void unlock_sharable(); + + //!Erases a named sharable mutex from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name); + + /// @cond + private: + friend class ipcdetail::interprocess_tester; + void dont_close_on_destruction(); + + interprocess_sharable_mutex *mutex() const + { return static_cast(m_shmem.get_user_address()); } + + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; + typedef ipcdetail::named_creation_functor construct_func_t; + /// @endcond +}; + +/// @cond + +inline named_sharable_mutex::~named_sharable_mutex() +{} + +inline named_sharable_mutex::named_sharable_mutex + (create_only_t, const char *name, const permissions &perm) + : m_shmem (create_only + ,name + ,sizeof(interprocess_sharable_mutex) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoCreate) + ,perm) +{} + +inline named_sharable_mutex::named_sharable_mutex + (open_or_create_t, const char *name, const permissions &perm) + : m_shmem (open_or_create + ,name + ,sizeof(interprocess_sharable_mutex) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoOpenOrCreate) + ,perm) +{} + +inline named_sharable_mutex::named_sharable_mutex + (open_only_t, const char *name) + : m_shmem (open_only + ,name + ,read_write + ,0 + ,construct_func_t(ipcdetail::DoOpen)) +{} + +inline void named_sharable_mutex::dont_close_on_destruction() +{ ipcdetail::interprocess_tester::dont_close_on_destruction(m_shmem); } + +inline void named_sharable_mutex::lock() +{ this->mutex()->lock(); } + +inline void named_sharable_mutex::unlock() +{ this->mutex()->unlock(); } + +inline bool named_sharable_mutex::try_lock() +{ return this->mutex()->try_lock(); } + +inline bool named_sharable_mutex::timed_lock + (const boost::posix_time::ptime &abs_time) +{ return this->mutex()->timed_lock(abs_time); } + +inline void named_sharable_mutex::lock_sharable() +{ this->mutex()->lock_sharable(); } + +inline void named_sharable_mutex::unlock_sharable() +{ this->mutex()->unlock_sharable(); } + +inline bool named_sharable_mutex::try_lock_sharable() +{ return this->mutex()->try_lock_sharable(); } + +inline bool named_sharable_mutex::timed_lock_sharable + (const boost::posix_time::ptime &abs_time) +{ return this->mutex()->timed_lock_sharable(abs_time); } + +inline bool named_sharable_mutex::remove(const char *name) +{ return shared_memory_object::remove(name); } + +/// @endcond + +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp index 61c6bb408..95e0ed509 100644 --- a/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/named_upgradable_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -38,7 +38,7 @@ namespace ipcdetail{ class interprocess_tester; } class named_condition; -//!A upgradable mutex with a global name, so it can be found from different +//!A upgradable mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named upgradable mutex. class named_upgradable_mutex @@ -52,11 +52,11 @@ class named_upgradable_mutex /// @endcond public: - //!Creates a global upgradable mutex with a name. + //!Creates a global upgradable mutex with a name. //!If the upgradable mutex can't be created throws interprocess_exception named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global upgradable mutex with a name, and an initial count. + //!Opens or creates a global upgradable mutex with a name. //!If the upgradable mutex is created, this call is equivalent to //!named_upgradable_mutex(create_only_t, ...) //!If the upgradable mutex is already created, this call is equivalent to @@ -95,13 +95,13 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -115,21 +115,21 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -143,7 +143,7 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -152,69 +152,75 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release it. + //! sharable ownership release it. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The thread atomically releases sharable ownership and tries to acquire + //! upgradable ownership. This operation will fail if there are threads with sharable + //! or upgradable ownership, but it will maintain sharable ownership. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock_upgradable(); //!Erases a named upgradable mutex from the system. @@ -229,7 +235,8 @@ class named_upgradable_mutex interprocess_upgradable_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -244,8 +251,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -257,8 +263,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) @@ -288,13 +293,7 @@ inline bool named_upgradable_mutex::try_lock() inline bool named_upgradable_mutex::timed_lock (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock(); - return true; - } - return this->mutex()->timed_lock(abs_time); -} +{ return this->mutex()->timed_lock(abs_time); } inline void named_upgradable_mutex::lock_upgradable() { this->mutex()->lock_upgradable(); } @@ -307,13 +306,7 @@ inline bool named_upgradable_mutex::try_lock_upgradable() inline bool named_upgradable_mutex::timed_lock_upgradable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_upgradable(); - return true; - } - return this->mutex()->timed_lock_upgradable(abs_time); -} +{ return this->mutex()->timed_lock_upgradable(abs_time); } inline void named_upgradable_mutex::lock_sharable() { this->mutex()->lock_sharable(); } @@ -326,13 +319,7 @@ inline bool named_upgradable_mutex::try_lock_sharable() inline bool named_upgradable_mutex::timed_lock_sharable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_sharable(); - return true; - } - return this->mutex()->timed_lock_sharable(abs_time); -} +{ return this->mutex()->timed_lock_sharable(abs_time); } inline void named_upgradable_mutex::unlock_and_lock_upgradable() { this->mutex()->unlock_and_lock_upgradable(); } diff --git a/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp index afe444ed3..d9f69a695 100644 --- a/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/null_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp index 213e4ce8b..2deea0f71 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ class posix_condition //!liberating system resources. ~posix_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect. void notify_one(); @@ -52,8 +52,8 @@ class posix_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the posix_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the posix_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock) @@ -75,9 +75,9 @@ class posix_condition this->do_wait(*lock.mutex()); } - //!Releases the lock on the posix_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the posix_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template @@ -92,8 +92,8 @@ class posix_condition return this->do_timed_wait(abs_time, *lock.mutex()); } - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) @@ -145,21 +145,21 @@ inline posix_condition::~posix_condition() { int res = 0; res = pthread_cond_destroy(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::notify_one() { int res = 0; res = pthread_cond_signal(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::notify_all() { int res = 0; res = pthread_cond_broadcast(&m_condition); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline void posix_condition::do_wait(posix_mutex &mut) @@ -167,7 +167,7 @@ inline void posix_condition::do_wait(posix_mutex &mut) pthread_mutex_t* pmutex = &mut.m_mut; int res = 0; res = pthread_cond_wait(&m_condition, pmutex); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } inline bool posix_condition::do_timed_wait diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp index 22e2ec04b..344c5e90a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include @@ -80,7 +80,7 @@ inline posix_mutex::posix_mutex() mut.release(); } -inline posix_mutex::~posix_mutex() +inline posix_mutex::~posix_mutex() { int res = pthread_mutex_destroy(&m_mut); BOOST_ASSERT(res == 0);(void)res; @@ -88,7 +88,7 @@ inline posix_mutex::~posix_mutex() inline void posix_mutex::lock() { - if (pthread_mutex_lock(&m_mut) != 0) + if (pthread_mutex_lock(&m_mut) != 0) throw lock_exception(); } @@ -140,6 +140,7 @@ inline void posix_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); + (void)res; BOOST_ASSERT(res == 0); } diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp index 931c731ef..1b03b7def 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp index f0327a461..0b7ca8bba 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp index c09ce200c..9e989d58b 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/pthread_helpers.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace interprocess { @@ -29,7 +29,7 @@ namespace ipcdetail{ #if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED //!Makes pthread_mutexattr_t cleanup easy when using exceptions - struct mutexattr_wrapper + struct mutexattr_wrapper { //!Constructor mutexattr_wrapper(bool recursive = false) @@ -51,7 +51,7 @@ namespace ipcdetail{ }; //!Makes pthread_condattr_t cleanup easy when using exceptions - struct condattr_wrapper + struct condattr_wrapper { //!Constructor condattr_wrapper() @@ -86,7 +86,7 @@ namespace ipcdetail{ void release() {mp_mut = 0; } - private: + private: pthread_mutex_t *mp_mut; }; @@ -94,7 +94,7 @@ namespace ipcdetail{ class condition_initializer { public: - condition_initializer(pthread_cond_t &cond, pthread_condattr_t &cond_attr) + condition_initializer(pthread_cond_t &cond, pthread_condattr_t &cond_attr) : mp_cond(&cond) { if(pthread_cond_init(mp_cond, &cond_attr)!= 0) @@ -105,7 +105,7 @@ namespace ipcdetail{ void release() { mp_cond = 0; } - private: + private: pthread_cond_t *mp_cond; }; @@ -114,7 +114,7 @@ namespace ipcdetail{ #if defined(BOOST_INTERPROCESS_POSIX_BARRIERS) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) //!Makes pthread_barrierattr_t cleanup easy when using exceptions - struct barrierattr_wrapper + struct barrierattr_wrapper { //!Constructor barrierattr_wrapper() @@ -138,8 +138,8 @@ namespace ipcdetail{ { public: //!Constructor. Takes barrier attributes to initialize the barrier - barrier_initializer(pthread_barrier_t &mut, - pthread_barrierattr_t &mut_attr, + barrier_initializer(pthread_barrier_t &mut, + pthread_barrierattr_t &mut_attr, int count) : mp_barrier(&mut) { @@ -151,7 +151,7 @@ namespace ipcdetail{ void release() {mp_barrier = 0; } - private: + private: pthread_barrier_t *mp_barrier; }; diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp index 7d787353b..3e20dc707 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp index baa670fa9..385d714fb 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -78,7 +78,7 @@ inline posix_recursive_mutex::~posix_recursive_mutex() inline void posix_recursive_mutex::lock() { - if (pthread_mutex_lock(&m_mut) != 0) + if (pthread_mutex_lock(&m_mut) != 0) throw lock_exception(); } @@ -130,7 +130,7 @@ inline void posix_recursive_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); - BOOST_ASSERT(res == 0); + BOOST_ASSERT(res == 0); (void)res; } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp index b7f62cc42..5d7dfa8d6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp index 1aeef4766..f6aef56ea 100644 --- a/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -18,7 +18,7 @@ #include #include -#include //O_CREAT, O_*... +#include //O_CREAT, O_*... #include //close #include //std::string #include //sem_* family, SEM_VALUE_MAX @@ -42,7 +42,7 @@ namespace interprocess { namespace ipcdetail { inline bool semaphore_open - (sem_t *&handle, create_enum_t type, const char *origname, + (sem_t *&handle, create_enum_t type, const char *origname, unsigned int count = 0, const permissions &perm = permissions()) { std::string name; @@ -103,7 +103,7 @@ inline bool semaphore_open inline void semaphore_close(sem_t *handle) { int ret = sem_close(handle); - if(ret != 0){ + if(ret != 0){ BOOST_ASSERT(0); } } @@ -138,7 +138,7 @@ inline void semaphore_init(sem_t *handle, unsigned int initialCount) inline void semaphore_destroy(sem_t *handle) { int ret = sem_destroy(handle); - if(ret != 0){ + if(ret != 0){ BOOST_ASSERT(0); } } diff --git a/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp index bfef63a30..5709f6ff6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/scoped_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -89,7 +89,7 @@ class scoped_lock : mp_mutex(&m), m_locked(true) {} - //!Effects: m.try_lock(). + //!Effects: m.try_lock(). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.try_lock() executed within the constructor. //!Notes: The constructor will take ownership of the mutex if it can do @@ -101,7 +101,7 @@ class scoped_lock : mp_mutex(&m), m_locked(mp_mutex->try_lock()) {} - //!Effects: m.timed_lock(abs_time). + //!Effects: m.timed_lock(abs_time). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock(abs_time) executed within the constructor. //!Notes: The constructor will take ownership of the mutex if it can do @@ -128,7 +128,7 @@ class scoped_lock { mp_mutex = scop.release(); } //!Effects: If upgr.owns() then calls unlock_upgradable_and_lock() on the - //! referenced mutex. upgr.release() is called. + //! referenced mutex. upgr.release() is called. //!Postconditions: mutex() == the value upgr.mutex() had before the construction. //! upgr.mutex() == 0. owns() == upgr.owns() before the construction. //! upgr.owns() == false after the construction. @@ -155,12 +155,12 @@ class scoped_lock //!Effects: If upgr.owns() then calls try_unlock_upgradable_and_lock() on the //!referenced mutex: //! a)if try_unlock_upgradable_and_lock() returns true then mutex() obtains - //! the value from upgr.release() and owns() is set to true. + //! the value from upgr.release() and owns() is set to true. //! b)if try_unlock_upgradable_and_lock() returns false then upgr is - //! unaffected and this scoped_lock construction as the same effects as - //! a default construction. + //! unaffected and this scoped_lock construction as the same effects as + //! a default construction. //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false + //! and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex //! ownership from upgr immediately, while changing the lock type from a //! "read lock" to a "write lock". If the "read lock" isn't held in the @@ -186,12 +186,12 @@ class scoped_lock //!Effects: If upgr.owns() then calls timed_unlock_upgradable_and_lock(abs_time) //! on the referenced mutex: //! a)if timed_unlock_upgradable_and_lock(abs_time) returns true then mutex() - //! obtains the value from upgr.release() and owns() is set to true. + //! obtains the value from upgr.release() and owns() is set to true. //! b)if timed_unlock_upgradable_and_lock(abs_time) returns false then upgr //! is unaffected and this scoped_lock construction as the same effects //! as a default construction. //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false + //! and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex ownership //! from upgr immediately, while changing the lock type from a "read lock" to a //! "write lock". If the "read lock" isn't held in the first place, the mutex @@ -214,14 +214,14 @@ class scoped_lock } //!Effects: If shar.owns() then calls try_unlock_sharable_and_lock() on the - //!referenced mutex. + //!referenced mutex. //! a)if try_unlock_sharable_and_lock() returns true then mutex() obtains - //! the value from shar.release() and owns() is set to true. + //! the value from shar.release() and owns() is set to true. //! b)if try_unlock_sharable_and_lock() returns false then shar is //! unaffected and this scoped_lock construction has the same - //! effects as a default construction. + //! effects as a default construction. //! c)Else shar.owns() is false. mutex() obtains the value from - //! shar.release() and owns() is set to false + //! shar.release() and owns() is set to false //!Notes: This construction will not block. It will try to obtain mutex //! ownership from shar immediately, while changing the lock type from a //! "read lock" to a "write lock". If the "read lock" isn't held in the @@ -253,13 +253,13 @@ class scoped_lock } //!Effects: If owns() before the call, then unlock() is called on mutex(). - //! *this gets the state of scop and scop gets set to a default constructed state. + //! *this gets the state of scop and scop gets set to a default constructed state. //!Notes: With a recursive mutex it is possible that both this and scop own //! the same mutex before the assignment. In this case, this will own the //! mutex after the assignment (and scop will not), but the mutex's lock //! count will be decremented by one. scoped_lock &operator=(BOOST_RV_REF(scoped_lock) scop) - { + { if(this->owns()) this->unlock(); m_locked = scop.owns(); @@ -281,7 +281,7 @@ class scoped_lock } //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls try_lock() on the referenced mutex. + //! exception. Calls try_lock() on the referenced mutex. //!Postconditions: owns() == the value returned from mutex()->try_lock(). //!Notes: The scoped_lock changes from a state of not owning the mutex, to //! owning the mutex, but only if blocking was not required. If the @@ -348,8 +348,8 @@ class scoped_lock m_locked = false; return mut; } - - //!Effects: Swaps state with moved lock. + + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap( scoped_lock &other) { @@ -359,7 +359,7 @@ class scoped_lock /// @cond private: - mutex_type *mp_mutex; + mutex_type *mp_mutex; bool m_locked; /// @endcond }; diff --git a/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp index c8b7c1d26..113019572 100644 --- a/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/sharable_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -67,7 +67,7 @@ class sharable_lock {} //!Effects: m.lock_sharable(). - //!Postconditions: owns() == true and mutex() == &m. + //!Postconditions: owns() == true and mutex() == &m. //!Notes: The constructor will take sharable-ownership of the mutex. If //! another thread already owns the mutex with exclusive ownership //! (scoped_lock), this thread will block until the mutex is released. @@ -104,7 +104,7 @@ class sharable_lock : mp_mutex(&m), m_locked(false) { m_locked = mp_mutex->try_lock_sharable(); } - //!Effects: m.timed_lock_sharable(abs_time) + //!Effects: m.timed_lock_sharable(abs_time) //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock_sharable() executed within the constructor. //!Notes: The constructor will take sharable-ownership of the mutex if it @@ -132,7 +132,7 @@ class sharable_lock //! referenced mutex. //!Postconditions: mutex() == the value upgr.mutex() had before the construction. //! upgr.mutex() == 0 owns() == the value of upgr.owns() before construction. - //! upgr.owns() == false after the construction. + //! upgr.owns() == false after the construction. //!Notes: If upgr is locked, this constructor will lock this sharable_lock while //! unlocking upgr. Only a moved sharable_lock's will match this //! signature. An non-moved upgradable_lock can be moved with the expression: @@ -156,7 +156,7 @@ class sharable_lock //! scop.mutex() == 0 owns() == scop.owns() before the constructor. After the //! construction, scop.owns() == false. //!Notes: If scop is locked, this constructor will transfer the exclusive ownership - //! to a sharable-ownership of this sharable_lock. + //! to a sharable-ownership of this sharable_lock. //! Only a moved scoped_lock's will match this //! signature. An non-moved scoped_lock can be moved with the expression: //! "boost::move(lock);". @@ -184,12 +184,12 @@ class sharable_lock } //!Effects: If owns() before the call, then unlock_sharable() is called on mutex(). - //! *this gets the state of upgr and upgr gets set to a default constructed state. + //! *this gets the state of upgr and upgr gets set to a default constructed state. //!Notes: With a recursive mutex it is possible that both this and upgr own the mutex //! before the assignment. In this case, this will own the mutex after the assignment //! (and upgr will not), but the mutex's lock count will be decremented by one. sharable_lock &operator=(BOOST_RV_REF(sharable_lock) upgr) - { + { if(this->owns()) this->unlock(); m_locked = upgr.owns(); @@ -203,7 +203,7 @@ class sharable_lock //!Notes: The sharable_lock changes from a state of not owning the //! mutex, to owning the mutex, blocking if necessary. void lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); mp_mutex->lock_sharable(); @@ -219,7 +219,7 @@ class sharable_lock //! mutex_type does not support try_lock_sharable(), this function will //! fail at compile time if instantiated, but otherwise have no effect. bool try_lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->try_lock_sharable(); @@ -236,7 +236,7 @@ class sharable_lock //! timed_lock_sharable(), this function will fail at compile time if //! instantiated, but otherwise have no effect. bool timed_lock(const boost::posix_time::ptime& abs_time) - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->timed_lock_sharable(abs_time); @@ -282,7 +282,7 @@ class sharable_lock return mut; } - //!Effects: Swaps state with moved lock. + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap(sharable_lock &other) { diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp index 0d67c2575..bec1b600d 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -28,9 +28,12 @@ #include #include #include -#if defined BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES -#include -#include +#if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) + #include + #include + #include +#else + #include #endif @@ -42,7 +45,7 @@ namespace interprocess { namespace ipcdetail { /// @cond -namespace ipcdetail{ class interprocess_tester; } +class interprocess_tester; /// @endcond //! A global condition variable that can be created by name. @@ -61,7 +64,7 @@ class shm_named_condition //!If the condition can't be created throws interprocess_exception shm_named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global condition with a name. + //!Opens or creates a global condition with a name. //!If the condition is created, this call is equivalent to //!shm_named_condition(create_only_t, ... ) //!If the condition is already created, this call is equivalent @@ -82,7 +85,7 @@ class shm_named_condition //!use remove(). ~shm_named_condition(); - //!If there is a thread waiting on *this, change that + //!If there is a thread waiting on *this, change that //!thread's state to ready. Otherwise there is no effect.*/ void notify_one(); @@ -90,8 +93,8 @@ class shm_named_condition //!If there are no waiting threads, notify_all() has no effect. void notify_all(); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to //!this->notify_one() or this->notify_all(), and then reacquires the lock. template void wait(L& lock); @@ -101,16 +104,16 @@ class shm_named_condition template void wait(L& lock, Pr pred); - //!Releases the lock on the named_mutex object associated with lock, blocks - //!the current thread of execution until readied by a call to - //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, //!and then reacquires the lock. //!Returns: false if time abs_time is reached, otherwise true. template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time); - //!The same as: while (!pred()) { - //! if (!timed_wait(lock, abs_time)) return pred(); + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); //! } return true; template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred); @@ -122,103 +125,36 @@ class shm_named_condition /// @cond private: - struct condition_holder - { - interprocess_condition cond_; - //If named_mutex is implemented using semaphores - //we need to store an additional mutex - #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - interprocess_mutex mutex_; - #endif - }; - - interprocess_condition *condition() const - { return &static_cast(m_shmem.get_user_address())->cond_; } - - template - class lock_inverter - { - Lock &l_; - public: - lock_inverter(Lock &l) - : l_(l) - {} - void lock() { l_.unlock(); } - void unlock() { l_.lock(); } - }; - #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - interprocess_mutex *mutex() const - { return &static_cast(m_shmem.get_user_address())->mutex_; } + class internal_condition_members + { + public: + typedef interprocess_mutex mutex_type; + typedef interprocess_condition condvar_type; + + condvar_type& get_condvar() { return m_cond; } + mutex_type& get_mutex() { return m_mtx; } - template - void do_wait(Lock& lock) - { - //shm_named_condition only works with named_mutex - BOOST_STATIC_ASSERT((is_convertible::value == true)); - - //lock internal before unlocking external to avoid race with a notifier - scoped_lock internal_lock(*this->mutex()); - lock_inverter inverted_lock(lock); - scoped_lock > external_unlock(inverted_lock); + private: + mutex_type m_mtx; + condvar_type m_cond; + }; - //unlock internal first to avoid deadlock with near simultaneous waits - scoped_lock internal_unlock; - internal_lock.swap(internal_unlock); - this->condition()->wait(internal_unlock); - } + typedef ipcdetail::condition_any_wrapper internal_condition; + #else //defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) + typedef interprocess_condition internal_condition; + #endif //defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) - template - bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time) - { - //shm_named_condition only works with named_mutex - BOOST_STATIC_ASSERT((is_convertible::value == true)); - //lock internal before unlocking external to avoid race with a notifier - scoped_lock internal_lock(*this->mutex(), abs_time); - if(!internal_lock) return false; - lock_inverter inverted_lock(lock); - scoped_lock > external_unlock(inverted_lock); - - //unlock internal first to avoid deadlock with near simultaneous waits - scoped_lock internal_unlock; - internal_lock.swap(internal_unlock); - return this->condition()->timed_wait(internal_unlock, abs_time); - } - #else - template - class lock_wrapper - { - typedef void (lock_wrapper::*unspecified_bool_type)(); - public: - - typedef interprocess_mutex mutex_type; - - lock_wrapper(Lock &l) - : l_(l) - {} - - mutex_type* mutex() const - { return l_.mutex()->mutex(); } - - void lock() { l_.lock(); } - - void unlock() { l_.unlock(); } - - operator unspecified_bool_type() const - { return l_ ? &lock_wrapper::lock : 0; } - - private: - Lock &l_; - }; - #endif + internal_condition m_cond; friend class boost::interprocess::ipcdetail::interprocess_tester; void dont_close_on_destruction(); - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; template friend class boost::interprocess::ipcdetail::named_creation_functor; - typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; + typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -230,9 +166,8 @@ inline shm_named_condition::~shm_named_condition() inline shm_named_condition::shm_named_condition(create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name - ,sizeof(condition_holder) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate) @@ -242,9 +177,8 @@ inline shm_named_condition::shm_named_condition(create_only_t, const char *name, inline shm_named_condition::shm_named_condition(open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name - ,sizeof(condition_holder) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate) @@ -265,102 +199,65 @@ inline void shm_named_condition::dont_close_on_destruction() #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) inline void shm_named_condition::notify_one() -{ - scoped_lock internal_lock(*this->mutex()); - this->condition()->notify_one(); -} +{ m_cond.notify_one(); } inline void shm_named_condition::notify_all() -{ - scoped_lock internal_lock(*this->mutex()); - this->condition()->notify_all(); -} +{ m_cond.notify_all(); } template inline void shm_named_condition::wait(L& lock) -{ - if (!lock) - throw lock_exception(); - this->do_wait(lock); -} +{ m_cond.wait(lock); } template inline void shm_named_condition::wait(L& lock, Pr pred) -{ - if (!lock) - throw lock_exception(); - while (!pred()) - this->do_wait(lock); -} +{ m_cond.wait(lock, pred); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(lock, abs_time); -} +{ return m_cond.timed_wait(lock, abs_time); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - - while (!pred()){ - if(!this->do_timed_wait(lock, abs_time)){ - return pred(); - } - } - return true; -} +{ return m_cond.timed_wait(lock, abs_time, pred); } #else inline void shm_named_condition::notify_one() -{ this->condition()->notify_one(); } +{ m_cond.notify_one(); } inline void shm_named_condition::notify_all() -{ this->condition()->notify_all(); } +{ m_cond.notify_all(); } template inline void shm_named_condition::wait(L& lock) { - lock_wrapper newlock(lock); - this->condition()->wait(newlock); + internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock); } template inline void shm_named_condition::wait(L& lock, Pr pred) { - lock_wrapper newlock(lock); - this->condition()->wait(newlock, pred); + internal_mutex_lock internal_lock(lock); + m_cond.wait(internal_lock, pred); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time) { - lock_wrapper newlock(lock); - return this->condition()->timed_wait(newlock, abs_time); + internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time); } template inline bool shm_named_condition::timed_wait (L& lock, const boost::posix_time::ptime &abs_time, Pr pred) { - lock_wrapper newlock(lock); - return this->condition()->timed_wait(newlock, abs_time, pred); + internal_mutex_lock internal_lock(lock); + return m_cond.timed_wait(internal_lock, abs_time, pred); } #endif diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp new file mode 100644 index 000000000..7bac854c9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_condition_any.hpp @@ -0,0 +1,191 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//!\file +//!Describes process-shared variables interprocess_condition class + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +/// @cond +class interprocess_tester; +/// @endcond + +//! A global condition variable that can be created by name. +//! This condition variable is designed to work with named_mutex and +//! can't be placed in shared memory or memory mapped files. +class shm_named_condition_any +{ + /// @cond + //Non-copyable + shm_named_condition_any(); + shm_named_condition_any(const shm_named_condition_any &); + shm_named_condition_any &operator=(const shm_named_condition_any &); + /// @endcond + public: + //!Creates a global condition with a name. + //!If the condition can't be created throws interprocess_exception + shm_named_condition_any(create_only_t create_only, const char *name, const permissions &perm = permissions()) + : m_shmem (create_only + ,name + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(DoCreate) + ,perm) + {} + + //!Opens or creates a global condition with a name. + //!If the condition is created, this call is equivalent to + //!shm_named_condition_any(create_only_t, ... ) + //!If the condition is already created, this call is equivalent + //!shm_named_condition_any(open_only_t, ... ) + //!Does not throw + shm_named_condition_any(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()) + : m_shmem (open_or_create + ,name + ,sizeof(internal_condition) + + open_create_impl_t::ManagedOpenOrCreateUserOffset + ,read_write + ,0 + ,construct_func_t(DoOpenOrCreate) + ,perm) + {} + + //!Opens a global condition with a name if that condition is previously + //!created. If it is not previously created this function throws + //!interprocess_exception. + shm_named_condition_any(open_only_t open_only, const char *name) + : m_shmem (open_only + ,name + ,read_write + ,0 + ,construct_func_t(DoOpen)) + {} + + //!Destroys *this and indicates that the calling process is finished using + //!the resource. The destructor function will deallocate + //!any system resources allocated by the system for use by this process for + //!this resource. The resource can still be opened again calling + //!the open constructor overload. To erase the resource from the system + //!use remove(). + ~shm_named_condition_any() + {} + + //!If there is a thread waiting on *this, change that + //!thread's state to ready. Otherwise there is no effect.*/ + void notify_one() + { m_cond.notify_one(); } + + //!Change the state of all threads waiting on *this to ready. + //!If there are no waiting threads, notify_all() has no effect. + void notify_all() + { m_cond.notify_all(); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), and then reacquires the lock. + template + void wait(L& lock) + { m_cond.wait(lock); } + + //!The same as: + //!while (!pred()) wait(lock) + template + void wait(L& lock, Pr pred) + { m_cond.wait(lock, pred); } + + //!Releases the lock on the named_mutex object associated with lock, blocks + //!the current thread of execution until readied by a call to + //!this->notify_one() or this->notify_all(), or until time abs_time is reached, + //!and then reacquires the lock. + //!Returns: false if time abs_time is reached, otherwise true. + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_cond.timed_wait(lock, abs_time); } + + //!The same as: while (!pred()) { + //! if (!timed_wait(lock, abs_time)) return pred(); + //! } return true; + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_cond.timed_wait(lock, abs_time, pred); } + + //!Erases a named condition from the system. + //!Returns false on error. Never throws. + static bool remove(const char *name) + { return shared_memory_object::remove(name); } + + /// @cond + private: + + class internal_condition_members + { + public: + typedef interprocess_mutex mutex_type; + typedef interprocess_condition condvar_type; + + condvar_type& get_condvar() { return m_cond; } + mutex_type& get_mutex() { return m_mtx; } + + private: + mutex_type m_mtx; + condvar_type m_cond; + }; + + typedef ipcdetail::condition_any_wrapper internal_condition; + + internal_condition m_cond; + + friend class boost::interprocess::ipcdetail::interprocess_tester; + void dont_close_on_destruction() + { interprocess_tester::dont_close_on_destruction(m_shmem); } + + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; + + template friend class boost::interprocess::ipcdetail::named_creation_functor; + typedef boost::interprocess::ipcdetail::named_creation_functor construct_func_t; + /// @endcond +}; + +} //namespace ipcdetail +} //namespace interprocess +} //namespace boost + +#include + +#endif // BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp index 11a1db1d6..cdfff99bf 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_creation_functor.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2007-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -38,7 +38,7 @@ class named_creation_functor { new(address)T(m_arg); } bool operator()(void *address, std::size_t, bool created) const - { + { switch(m_creation_type){ case DoOpen: return true; @@ -56,6 +56,10 @@ class named_creation_functor break; } } + + std::size_t get_min_size() const + { return sizeof(T); } + private: create_enum_t m_creation_type; Arg m_arg; diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp index a71eb4fe6..9532f8d8d 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -37,7 +37,7 @@ namespace ipcdetail { class named_condition; -//!A mutex with a global name, so it can be found from different +//!A mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named mutex. class shm_named_mutex @@ -56,7 +56,7 @@ class shm_named_mutex //!Throws interprocess_exception on error. shm_named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global mutex with a name. + //!Opens or creates a global mutex with a name. //!If the mutex is created, this call is equivalent to //!shm_named_mutex(create_only_t, ... ) //!If the mutex is already created, this call is equivalent @@ -85,7 +85,7 @@ class shm_named_mutex //!Throws interprocess_exception if a severe error is found void lock(); - //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex + //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found bool try_lock(); @@ -100,14 +100,15 @@ class shm_named_mutex static bool remove(const char *name); /// @cond - interprocess_mutex *mutex() const - { return static_cast(m_shmem.get_user_address()); } + typedef interprocess_mutex internal_mutex_type; + interprocess_mutex &internal_mutex() + { return *static_cast(m_shmem.get_user_address()); } private: friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); - - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -124,8 +125,7 @@ inline shm_named_mutex::shm_named_mutex(create_only_t, const char *name, const p : m_shmem (create_only ,name ,sizeof(interprocess_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -136,8 +136,7 @@ inline shm_named_mutex::shm_named_mutex(open_or_create_t, const char *name, cons : m_shmem (open_or_create ,name ,sizeof(interprocess_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) @@ -153,13 +152,13 @@ inline shm_named_mutex::shm_named_mutex(open_only_t, const char *name) {} inline void shm_named_mutex::lock() -{ this->mutex()->lock(); } +{ this->internal_mutex().lock(); } inline void shm_named_mutex::unlock() -{ this->mutex()->unlock(); } +{ this->internal_mutex().unlock(); } inline bool shm_named_mutex::try_lock() -{ return this->mutex()->try_lock(); } +{ return this->internal_mutex().try_lock(); } inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { @@ -167,7 +166,7 @@ inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time this->lock(); return true; } - return this->mutex()->timed_lock(abs_time); + return this->internal_mutex().timed_lock(abs_time); } inline bool shm_named_mutex::remove(const char *name) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp index 461c97eb3..0250e3108 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -51,7 +51,7 @@ class shm_named_recursive_mutex //!If the recursive_mutex can't be created throws interprocess_exception shm_named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global recursive_mutex with a name. + //!Opens or creates a global recursive_mutex with a name. //!If the recursive_mutex is created, this call is equivalent to //!shm_named_recursive_mutex(create_only_t, ... ) //!If the recursive_mutex is already created, this call is equivalent @@ -80,7 +80,7 @@ class shm_named_recursive_mutex //!Throws interprocess_exception if a severe error is found. void lock(); - //!Tries to lock the shm_named_recursive_mutex, returns false when shm_named_recursive_mutex + //!Tries to lock the shm_named_recursive_mutex, returns false when shm_named_recursive_mutex //!is already locked, returns true when success. //!Throws interprocess_exception if a severe error is found. bool try_lock(); @@ -101,8 +101,8 @@ class shm_named_recursive_mutex interprocess_recursive_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef named_creation_functor construct_func_t; /// @endcond }; @@ -117,8 +117,7 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const : m_shmem (create_only ,name ,sizeof(interprocess_recursive_mutex) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate) @@ -129,8 +128,7 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, co : m_shmem (open_or_create ,name ,sizeof(interprocess_recursive_mutex) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp index c6d3830db..ebd7e0982 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -65,7 +65,8 @@ class shm_named_semaphore interprocess_semaphore *semaphore() const { return static_cast(m_shmem.get_user_address()); } - managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef named_creation_functor construct_func_t; /// @endcond }; @@ -81,8 +82,7 @@ inline shm_named_semaphore::shm_named_semaphore : m_shmem (create_only ,name ,sizeof(interprocess_semaphore) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoCreate, initialCount) @@ -94,8 +94,7 @@ inline shm_named_semaphore::shm_named_semaphore : m_shmem (open_or_create ,name ,sizeof(interprocess_semaphore) + - managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(DoOpenOrCreate, initialCount) diff --git a/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp index 338fa98f7..26a0747e6 100644 --- a/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/shm/named_upgradable_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -38,7 +38,7 @@ namespace ipcdetail{ class interprocess_tester; } class named_condition; -//!A upgradable mutex with a global name, so it can be found from different +//!A upgradable mutex with a global name, so it can be found from different //!processes. This mutex can't be placed in shared memory, and //!each process should have it's own named upgradable mutex. class named_upgradable_mutex @@ -52,11 +52,11 @@ class named_upgradable_mutex /// @endcond public: - //!Creates a global upgradable mutex with a name. + //!Creates a global upgradable mutex with a name. //!If the upgradable mutex can't be created throws interprocess_exception named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); - //!Opens or creates a global upgradable mutex with a name, and an initial count. + //!Opens or creates a global upgradable mutex with a name, and an initial count. //!If the upgradable mutex is created, this call is equivalent to //!named_upgradable_mutex(create_only_t, ...) //!If the upgradable mutex is already created, this call is equivalent to @@ -95,13 +95,13 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire exclusive ownership of the mutex //! waiting if necessary until no other thread has exclusive, sharable or - //! upgradable ownership of the mutex or abs_time is reached. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! upgradable ownership of the mutex or abs_time is reached. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have exclusive ownership of the mutex. - //!Effects: The calling thread releases the exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. + //!Effects: The calling thread releases the exclusive ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock(); @@ -115,21 +115,21 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! without waiting. If no other thread has exclusive ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire sharable ownership immediately returns true. If it - //! has to wait, returns false. + //! has to wait, returns false. //!Throws: interprocess_exception on error. bool try_lock_sharable(); //!Effects: The calling thread tries to acquire sharable ownership of the mutex //! waiting if necessary until no other thread has exclusive - //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. + //! ownership of the mutex or abs_time is reached. + //!Returns: If acquires sharable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_sharable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. - //!Effects: The calling thread releases the sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. + //!Effects: The calling thread releases the sharable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_sharable(); @@ -143,7 +143,7 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! without waiting. If no other thread has exclusive or upgradable ownership - //! of the mutex this succeeds. + //! of the mutex this succeeds. //!Returns: If it can acquire upgradable ownership immediately returns true. //! If it has to wait, returns false. //!Throws: interprocess_exception on error. @@ -152,66 +152,66 @@ class named_upgradable_mutex //!Effects: The calling thread tries to acquire upgradable ownership of the mutex //! waiting if necessary until no other thread has exclusive or upgradable //! ownership of the mutex or abs_time is reached. - //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. + //!Returns: If acquires upgradable ownership, returns true. Otherwise returns false. //!Throws: interprocess_exception on error. bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have upgradable ownership of the mutex. - //!Effects: The calling thread releases the upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. + //!Effects: The calling thread releases the upgradable ownership of the mutex. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable(); //Demotions - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! upgradable ownership. This operation is non-blocking. + //! upgradable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_upgradable(); - //!Precondition: The thread must have exclusive ownership of the mutex. + //!Precondition: The thread must have exclusive ownership of the mutex. //!Effects: The thread atomically releases exclusive ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_and_lock_sharable(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires - //! sharable ownership. This operation is non-blocking. + //! sharable ownership. This operation is non-blocking. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock_sharable(); //Promotions - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and acquires //! exclusive ownership. This operation will block until all threads with - //! sharable ownership release it. + //! sharable ownership release it. //!Throws: An exception derived from interprocess_exception on error. void unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to //! acquire exclusive ownership. This operation will fail if there are threads - //! with sharable ownership, but it will maintain upgradable ownership. + //! with sharable ownership, but it will maintain upgradable ownership. //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_upgradable_and_lock(); - //!Precondition: The thread must have upgradable ownership of the mutex. + //!Precondition: The thread must have upgradable ownership of the mutex. //!Effects: The thread atomically releases upgradable ownership and tries to acquire //! exclusive ownership, waiting if necessary until abs_time. This operation will //! fail if there are threads with sharable ownership or timeout reaches, but it - //! will maintain upgradable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //! will maintain upgradable ownership. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time); - //!Precondition: The thread must have sharable ownership of the mutex. + //!Precondition: The thread must have sharable ownership of the mutex. //!Effects: The thread atomically releases sharable ownership and tries to acquire //! exclusive ownership. This operation will fail if there are threads with sharable //! or upgradable ownership, but it will maintain sharable ownership. - //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. + //!Returns: If acquires exclusive ownership, returns true. Otherwise returns false. //!Throws: An exception derived from interprocess_exception on error. bool try_unlock_sharable_and_lock(); @@ -229,7 +229,8 @@ class named_upgradable_mutex interprocess_upgradable_mutex *mutex() const { return static_cast(m_shmem.get_user_address()); } - ipcdetail::managed_open_or_create_impl m_shmem; + typedef ipcdetail::managed_open_or_create_impl open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor construct_func_t; /// @endcond }; @@ -244,8 +245,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -257,8 +257,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp index 5a37d9be2..7c3306d09 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -110,7 +110,7 @@ inline spin_condition::spin_condition() } inline spin_condition::~spin_condition() -{ +{ //Trivial destructor } @@ -126,15 +126,15 @@ inline void spin_condition::notify_all() inline void spin_condition::notify(boost::uint32_t command) { - //This mutex guarantees that no other thread can enter to the + //This mutex guarantees that no other thread can enter to the //do_timed_wait method logic, so that thread count will be //constant until the function writes a NOTIFY_ALL command. - //It also guarantees that no other notification can be signaled + //It also guarantees that no other notification can be signaled //on this spin_condition before this one ends m_enter_mut.lock(); //Return if there are no waiters - if(!atomic_read32(&m_num_waiters)) { + if(!atomic_read32(&m_num_waiters)) { m_enter_mut.unlock(); return; } @@ -167,18 +167,18 @@ inline bool spin_condition::do_timed_wait template inline bool spin_condition::do_timed_wait(bool tout_enabled, - const boost::posix_time::ptime &abs_time, + const boost::posix_time::ptime &abs_time, InterprocessMutex &mut) { boost::posix_time::ptime now = microsec_clock::universal_time(); - + if(tout_enabled){ if(now >= abs_time) return false; } typedef boost::interprocess::scoped_lock InternalLock; - //The enter mutex guarantees that while executing a notification, - //no other thread can execute the do_timed_wait method. + //The enter mutex guarantees that while executing a notification, + //no other thread can execute the do_timed_wait method. { //--------------------------------------------------------------- InternalLock lock; @@ -205,8 +205,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, //By default, we suppose that no timeout has happened bool timed_out = false, unlock_enter_mut= false; - - //Loop until a notification indicates that the thread should + + //Loop until a notification indicates that the thread should //exit or timeout occurs while(1){ //The thread sleeps/spins until a spin_condition commands a notification @@ -229,8 +229,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, //There is an ongoing notification, we will try again later continue; } - //No notification in execution, since enter mutex is locked. - //We will execute time-out logic, so we will decrement count, + //No notification in execution, since enter mutex is locked. + //We will execute time-out logic, so we will decrement count, //release the enter mutex and return false. break; } @@ -253,7 +253,7 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, continue; } else if(result == NOTIFY_ONE){ - //If it was a NOTIFY_ONE command, only this thread should + //If it was a NOTIFY_ONE command, only this thread should //exit. This thread has atomically marked command as sleep before //so no other thread will exit. //Decrement wait count. @@ -262,8 +262,8 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, break; } else{ - //If it is a NOTIFY_ALL command, all threads should return - //from do_timed_wait function. Decrement wait count. + //If it is a NOTIFY_ALL command, all threads should return + //from do_timed_wait function. Decrement wait count. unlock_enter_mut = 1 == atomic_dec32(const_cast(&m_num_waiters)); //Check if this is the last thread of notify_all waiters //Only the last thread will release the mutex @@ -275,7 +275,7 @@ inline bool spin_condition::do_timed_wait(bool tout_enabled, } } - //Unlock the enter mutex if it is a single notification, if this is + //Unlock the enter mutex if it is a single notification, if this is //the last notified thread in a notify_all or a timeout has occurred if(unlock_enter_mut){ m_enter_mut.unlock(); diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp index ef0b47d95..94c26a16a 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -45,15 +45,15 @@ class spin_mutex volatile boost::uint32_t m_s; }; -inline spin_mutex::spin_mutex() - : m_s(0) +inline spin_mutex::spin_mutex() + : m_s(0) { //Note that this class is initialized to zero. //So zeroed memory can be interpreted as an //initialized mutex } -inline spin_mutex::~spin_mutex() +inline spin_mutex::~spin_mutex() { //Trivial destructor } @@ -73,7 +73,7 @@ inline void spin_mutex::lock(void) inline bool spin_mutex::try_lock(void) { - boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast(&m_s), 1, 0); + boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast(&m_s), 1, 0); return m_s == 1 && prev_s == 0; } diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp index 05ad65eac..38e9dcaa1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -68,7 +68,7 @@ class spin_recursive_mutex volatile boost::uint32_t m_s; }; -inline spin_recursive_mutex::spin_recursive_mutex() +inline spin_recursive_mutex::spin_recursive_mutex() : m_nLockCount(0), m_nOwner(ipcdetail::get_invalid_systemwide_thread_id()){} inline spin_recursive_mutex::~spin_recursive_mutex(){} @@ -83,7 +83,7 @@ inline void spin_recursive_mutex::lock() if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; } else{ @@ -103,7 +103,7 @@ inline bool spin_recursive_mutex::try_lock() if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; return true; } @@ -129,7 +129,7 @@ inline bool spin_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception throw interprocess_exception("boost::interprocess::spin_recursive_mutex recursive lock overflow"); - } + } ++m_nLockCount; return true; } diff --git a/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp index 1b8cac35a..a5ba3b1b1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/spin/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp b/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp index 93c2ed6bc..6b766fd67 100644 --- a/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/upgradable_lock.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -85,7 +85,7 @@ class upgradable_lock : mp_mutex(&m), m_locked(true) {} - //!Effects: m.try_lock_upgradable(). + //!Effects: m.try_lock_upgradable(). //!Postconditions: mutex() == &m. owns() == the return value of the //! m.try_lock_upgradable() executed within the constructor. //!Notes: The constructor will take upgradable-ownership of the mutex @@ -97,7 +97,7 @@ class upgradable_lock : mp_mutex(&m), m_locked(false) { m_locked = mp_mutex->try_lock_upgradable(); } - //!Effects: m.timed_lock_upgradable(abs_time) + //!Effects: m.timed_lock_upgradable(abs_time) //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock_upgradable() executed within the constructor. //!Notes: The constructor will take upgradable-ownership of the mutex if it @@ -123,7 +123,7 @@ class upgradable_lock : mp_mutex(0), m_locked(upgr.owns()) { mp_mutex = upgr.release(); } - //!Effects: If scop.owns(), m_.unlock_and_lock_upgradable(). + //!Effects: If scop.owns(), m_.unlock_and_lock_upgradable(). //!Postconditions: mutex() == the value scop.mutex() had before the construction. //! scop.mutex() == 0. owns() == scop.owns() before the constructor. After the //! construction, scop.owns() == false. @@ -146,12 +146,12 @@ class upgradable_lock } //!Effects: If shar.owns() then calls try_unlock_sharable_and_lock_upgradable() - //! on the referenced mutex. + //! on the referenced mutex. //! a)if try_unlock_sharable_and_lock_upgradable() returns true then mutex() - //! obtains the value from shar.release() and owns() is set to true. + //! obtains the value from shar.release() and owns() is set to true. //! b)if try_unlock_sharable_and_lock_upgradable() returns false then shar is //! unaffected and this upgradable_lock construction has the same - //! effects as a default construction. + //! effects as a default construction. //! c)Else shar.owns() is false. mutex() obtains the value from shar.release() //! and owns() is set to false. //!Notes: This construction will not block. It will try to obtain mutex @@ -207,7 +207,7 @@ class upgradable_lock //!Notes: The sharable_lock changes from a state of not owning the mutex, //! to owning the mutex, blocking if necessary. void lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); mp_mutex->lock_upgradable(); @@ -223,7 +223,7 @@ class upgradable_lock //! mutex_type does not support try_lock_upgradable(), this function will //! fail at compile time if instantiated, but otherwise have no effect. bool try_lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->try_lock_upgradable(); @@ -240,7 +240,7 @@ class upgradable_lock //! timed_lock_upgradable(abs_time), this function will fail at compile //! time if instantiated, but otherwise have no effect. bool timed_lock(const boost::posix_time::ptime& abs_time) - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->timed_lock_upgradable(abs_time); @@ -286,7 +286,7 @@ class upgradable_lock return mut; } - //!Effects: Swaps state with moved lock. + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap(upgradable_lock &other) { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp index 167b8730c..627795172 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/condition.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -20,133 +20,8 @@ #include #include #include -#include -#include +#include -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -// -// Condition variable algorithm taken from pthreads-win32 discussion. -// -// The algorithm was developed by Alexander Terekhov in colaboration with -// Louis Thomas. -// -// Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL -// -// semBlockLock - bin.semaphore -// semBlockQueue - semaphore -// mtxExternal - mutex or CS -// mtxUnblockLock - mutex or CS -// nWaitersGone - int -// nWaitersBlocked - int -// nWaitersToUnblock - int -// -// wait( timeout ) { -// -// [auto: register int result ] // error checking omitted -// [auto: register int nSignalsWasLeft ] -// [auto: register int nWaitersWasGone ] -// -// sem_wait( semBlockLock ); -// nWaitersBlocked++; -// sem_post( semBlockLock ); -// -// unlock( mtxExternal ); -// bTimedOut = sem_wait( semBlockQueue,timeout ); -// -// lock( mtxUnblockLock ); -// if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { -// if ( bTimedOut ) { // timeout (or canceled) -// if ( 0 != nWaitersBlocked ) { -// nWaitersBlocked--; -// } -// else { -// nWaitersGone++; // count spurious wakeups. -// } -// } -// if ( 0 == --nWaitersToUnblock ) { -// if ( 0 != nWaitersBlocked ) { -// sem_post( semBlockLock ); // open the gate. -// nSignalsWasLeft = 0; // do not open the gate -// // below again. -// } -// else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { -// nWaitersGone = 0; -// } -// } -// } -// else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or -// // spurious semaphore :-) -// sem_wait( semBlockLock ); -// nWaitersBlocked -= nWaitersGone; // something is going on here -// // - test of timeouts? :-) -// sem_post( semBlockLock ); -// nWaitersGone = 0; -// } -// unlock( mtxUnblockLock ); -// -// if ( 1 == nSignalsWasLeft ) { -// if ( 0 != nWaitersWasGone ) { -// // sem_adjust( semBlockQueue,-nWaitersWasGone ); -// while ( nWaitersWasGone-- ) { -// sem_wait( semBlockQueue ); // better now than spurious later -// } -// } sem_post( semBlockLock ); // open the gate -// } -// -// lock( mtxExternal ); -// -// return ( bTimedOut ) ? ETIMEOUT : 0; -// } -// -// signal(bAll) { -// -// [auto: register int result ] -// [auto: register int nSignalsToIssue] -// -// lock( mtxUnblockLock ); -// -// if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! -// if ( 0 == nWaitersBlocked ) { // NO-OP -// return unlock( mtxUnblockLock ); -// } -// if (bAll) { -// nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; -// nWaitersBlocked = 0; -// } -// else { -// nSignalsToIssue = 1; -// nWaitersToUnblock++; -// nWaitersBlocked--; -// } -// } -// else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! -// sem_wait( semBlockLock ); // close the gate -// if ( 0 != nWaitersGone ) { -// nWaitersBlocked -= nWaitersGone; -// nWaitersGone = 0; -// } -// if (bAll) { -// nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; -// nWaitersBlocked = 0; -// } -// else { -// nSignalsToIssue = nWaitersToUnblock = 1; -// nWaitersBlocked--; -// } -// } -// else { // NO-OP -// return unlock( mtxUnblockLock ); -// } -// -// unlock( mtxUnblockLock ); -// sem_post( semBlockQueue,nSignalsToIssue ); -// return result; -// } -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// namespace boost { namespace interprocess { @@ -156,224 +31,83 @@ class windows_condition { windows_condition(const windows_condition &); windows_condition &operator=(const windows_condition &); - public: - windows_condition(); - ~windows_condition(); - void notify_one(); - void notify_all(); + public: + windows_condition() + : m_condition_data() + {} + + ~windows_condition() + {} + + void notify_one() + { m_condition_data.notify_one(); } + + void notify_all() + { m_condition_data.notify_all(); } template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) - { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock); - return true; - } - if (!lock) - throw lock_exception(); - return this->do_timed_wait(abs_time, *lock.mutex()); - } + { return m_condition_data.timed_wait(lock, abs_time); } template bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) - { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(lock, pred); - return true; - } - if (!lock) - throw lock_exception(); - while (!pred()){ - if (!this->do_timed_wait(abs_time, *lock.mutex())) - return pred(); - } - return true; - } + { return m_condition_data.timed_wait(lock, abs_time, pred); } template void wait(L& lock) - { - if (!lock) - throw lock_exception(); - do_wait(*lock.mutex()); - } + { m_condition_data.wait(lock); } template void wait(L& lock, Pr pred) - { - if (!lock) - throw lock_exception(); - - while (!pred()) - do_wait(*lock.mutex()); - } - - template - void do_wait(InterprocessMutex &mut); - - template - bool do_timed_wait(const boost::posix_time::ptime &abs_time, InterprocessMutex &mut); + { m_condition_data.wait(lock, pred); } private: - template - bool do_timed_wait(bool timeout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mut); - void do_signal (bool broadcast); + struct condition_data + { + typedef boost::int32_t integer_type; + typedef windows_semaphore semaphore_type; + typedef windows_mutex mutex_type; - boost::int32_t m_nwaiters_blocked; - boost::int32_t m_nwaiters_gone; - boost::int32_t m_nwaiters_to_unblock; - windows_semaphore m_sem_block_queue; - windows_semaphore m_sem_block_lock; - windows_mutex m_mtx_unblock_lock; + condition_data() + : m_nwaiters_blocked(0) + , m_nwaiters_gone(0) + , m_nwaiters_to_unblock(0) + , m_sem_block_queue(0) + , m_sem_block_lock(1) + , m_mtx_unblock_lock() + {} + + integer_type &get_nwaiters_blocked() + { return m_nwaiters_blocked; } + + integer_type &get_nwaiters_gone() + { return m_nwaiters_gone; } + + integer_type &get_nwaiters_to_unblock() + { return m_nwaiters_to_unblock; } + + semaphore_type &get_sem_block_queue() + { return m_sem_block_queue; } + + semaphore_type &get_sem_block_lock() + { return m_sem_block_lock; } + + mutex_type &get_mtx_unblock_lock() + { return m_mtx_unblock_lock; } + + boost::int32_t m_nwaiters_blocked; + boost::int32_t m_nwaiters_gone; + boost::int32_t m_nwaiters_to_unblock; + windows_semaphore m_sem_block_queue; + windows_semaphore m_sem_block_lock; + windows_mutex m_mtx_unblock_lock; + }; + + ipcdetail::condition_8a_wrapper m_condition_data; }; -inline windows_condition::windows_condition() - : m_nwaiters_blocked(0) - , m_nwaiters_gone(0) - , m_nwaiters_to_unblock(0) - , m_sem_block_queue(0) - , m_sem_block_lock(1) - , m_mtx_unblock_lock() -{} - -inline windows_condition::~windows_condition() -{} - -inline void windows_condition::notify_one() -{ this->do_signal(false); } - -inline void windows_condition::notify_all() -{ this->do_signal(true); } - -inline void windows_condition::do_signal(bool broadcast) -{ - boost::int32_t nsignals_to_issue; - - { - scoped_lock locker(m_mtx_unblock_lock); - - if ( 0 != m_nwaiters_to_unblock ) { // the gate is closed!!! - if ( 0 == m_nwaiters_blocked ) { // NO-OP - //locker's destructor triggers m_mtx_unblock_lock.unlock() - return; - } - if (broadcast) { - m_nwaiters_to_unblock += nsignals_to_issue = m_nwaiters_blocked; - m_nwaiters_blocked = 0; - } - else { - nsignals_to_issue = 1; - m_nwaiters_to_unblock++; - m_nwaiters_blocked--; - } - } - else if ( m_nwaiters_blocked > m_nwaiters_gone ) { // HARMLESS RACE CONDITION! - m_sem_block_lock.wait(); // close the gate - if ( 0 != m_nwaiters_gone ) { - m_nwaiters_blocked -= m_nwaiters_gone; - m_nwaiters_gone = 0; - } - if (broadcast) { - nsignals_to_issue = m_nwaiters_to_unblock = m_nwaiters_blocked; - m_nwaiters_blocked = 0; - } - else { - nsignals_to_issue = m_nwaiters_to_unblock = 1; - m_nwaiters_blocked--; - } - } - else { // NO-OP - //locker's destructor triggers m_mtx_unblock_lock.unlock() - return; - } - //locker's destructor triggers m_mtx_unblock_lock.unlock() - } - m_sem_block_queue.post(nsignals_to_issue); -} - -template -inline void windows_condition::do_wait(InterprocessMutex &mut) -{ this->do_timed_wait(false, boost::posix_time::ptime(), mut); } - -template -inline bool windows_condition::do_timed_wait - (const boost::posix_time::ptime &abs_time, InterprocessMutex &mut) -{ return this->do_timed_wait(true, abs_time, mut); } - -template -inline bool windows_condition::do_timed_wait - (bool tout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mtxExternal) -{ - //Initialize to avoid warnings - boost::int32_t nsignals_was_left = 0; - boost::int32_t nwaiters_was_gone = 0; - - m_sem_block_lock.wait(); - ++m_nwaiters_blocked; - m_sem_block_lock.post(); - - struct scoped_unlock - { - InterprocessMutex & mut; - scoped_unlock(InterprocessMutex & m) - : mut(m) - { m.unlock(); } - - ~scoped_unlock() - { mut.lock(); } - } unlocker(mtxExternal); - - - bool bTimedOut = tout_enabled ? !m_sem_block_queue.timed_wait(abs_time) : (m_sem_block_queue.wait(), false); - - { - scoped_lock locker(m_mtx_unblock_lock); - if ( 0 != (nsignals_was_left = m_nwaiters_to_unblock) ) { - if ( bTimedOut ) { // timeout (or canceled) - if ( 0 != m_nwaiters_blocked ) { - m_nwaiters_blocked--; - } - else { - m_nwaiters_gone++; // count spurious wakeups. - } - } - if ( 0 == --m_nwaiters_to_unblock ) { - if ( 0 != m_nwaiters_blocked ) { - m_sem_block_lock.post(); // open the gate. - nsignals_was_left = 0; // do not open the gate below again. - } - else if ( 0 != (nwaiters_was_gone = m_nwaiters_gone) ) { - m_nwaiters_gone = 0; - } - } - } - else if ( (std::numeric_limits::max)()/2 - == ++m_nwaiters_gone ) { // timeout/canceled or spurious semaphore :-) - m_sem_block_lock.wait(); - m_nwaiters_blocked -= m_nwaiters_gone; // something is going on here - test of timeouts? :-) - m_sem_block_lock.post(); - m_nwaiters_gone = 0; - } - //locker's destructor triggers m_mtx_unblock_lock.unlock() - } - - if ( 1 == nsignals_was_left ) { - if ( 0 != nwaiters_was_gone ) { - // sem_adjust( m_sem_block_queue,-nwaiters_was_gone ); - while ( nwaiters_was_gone-- ) { - m_sem_block_queue.wait(); // better now than spurious later - } - } - m_sem_block_lock.post(); // open the gate - } - - //mtxExternal.lock(); called from unlocker - - return ( bTimedOut ) ? false : true; -} - } //namespace ipcdetail } //namespace interprocess } //namespace boost diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp index 5eca52233..7da70f4d5 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -19,8 +19,9 @@ #include #include #include -#include +#include #include +#include #include @@ -47,85 +48,61 @@ class windows_mutex const sync_id id_; }; -inline windows_mutex::windows_mutex() - : id_() +inline windows_mutex::windows_mutex() + : id_(this) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //Create mutex with the initial count bool open_or_created; - handles.obtain_mutex(this->id_, &open_or_created); + (void)handles.obtain_mutex(this->id_, &open_or_created); //The mutex must be created, never opened assert(open_or_created); assert(open_or_created && winapi::get_last_error() != winapi::error_already_exists); (void)open_or_created; } -inline windows_mutex::~windows_mutex() +inline windows_mutex::~windows_mutex() { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); handles.destroy_handle(this->id_); } inline void windows_mutex::lock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + mut.lock(); } inline bool windows_mutex::try_lock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, 0); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.try_lock(); } inline bool windows_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->lock(); - return true; - } - boost::posix_time::ptime now - = boost::posix_time::microsec_clock::universal_time(); - - unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds(); sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - unsigned long ret = winapi::wait_for_single_object(hnd, ms); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.timed_lock(abs_time); } inline void windows_mutex::unlock(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_mutex(this->id_); - int ret = winapi::release_mutex(hnd); - (void)ret; - assert(ret); + winapi_mutex_functions mut(handles.obtain_mutex(this->id_)); + return mut.unlock(); } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp new file mode 100644 index 000000000..472448234 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition.hpp @@ -0,0 +1,34 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +typedef windows_named_condition_any windows_named_condition; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp new file mode 100644 index 000000000..0d3b915b3 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_condition_any.hpp @@ -0,0 +1,241 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class windows_named_condition_any +{ + /// @cond + + //Non-copyable + windows_named_condition_any(); + windows_named_condition_any(const windows_named_condition_any &); + windows_named_condition_any &operator=(const windows_named_condition_any &); + /// @endcond + + public: + windows_named_condition_any + (create_only_t, const char *name, const permissions &perm) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); + } + + windows_named_condition_any + (open_or_create_t, const char *name, const permissions &perm) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); + } + + windows_named_condition_any(open_only_t, const char *name) + : m_condition_data() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); + } + + ~windows_named_condition_any() + { + named_cond_callbacks callbacks(m_condition_data.get_members()); + m_named_sync.close(callbacks); + } + + void notify_one() + { m_condition_data.notify_one(); } + + void notify_all() + { m_condition_data.notify_all(); } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time) + { return m_condition_data.timed_wait(lock, abs_time); } + + template + bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred) + { return m_condition_data.timed_wait(lock, abs_time, pred); } + + template + void wait(L& lock) + { m_condition_data.wait(lock); } + + template + void wait(L& lock, Pr pred) + { m_condition_data.wait(lock, pred); } + + static bool remove(const char *name) + { return windows_named_sync::remove(name); } + + /// @cond + private: + + void windows_named_condition_any::dont_close_on_destruction() + {} + + friend class interprocess_tester; + + struct condition_data + { + typedef boost::int32_t integer_type; + typedef winapi_semaphore_wrapper semaphore_type; + typedef winapi_mutex_wrapper mutex_type; + + integer_type &get_nwaiters_blocked() + { return m_nwaiters_blocked; } + + integer_type &get_nwaiters_gone() + { return m_nwaiters_gone; } + + integer_type &get_nwaiters_to_unblock() + { return m_nwaiters_to_unblock; } + + semaphore_type &get_sem_block_queue() + { return m_sem_block_queue; } + + semaphore_type &get_sem_block_lock() + { return m_sem_block_lock; } + + mutex_type &get_mtx_unblock_lock() + { return m_mtx_unblock_lock; } + + integer_type m_nwaiters_blocked; + integer_type m_nwaiters_gone; + integer_type m_nwaiters_to_unblock; + winapi_semaphore_wrapper m_sem_block_queue; + winapi_semaphore_wrapper m_sem_block_lock; + winapi_mutex_wrapper m_mtx_unblock_lock; + }; + + ipcdetail::condition_8a_wrapper m_condition_data; + + class named_cond_callbacks : public windows_named_sync_interface + { + typedef __int64 sem_count_t; + mutable sem_count_t sem_counts [2]; + + public: + named_cond_callbacks(condition_data &cond_data) + : m_condition_data(cond_data) + {} + + virtual std::size_t get_data_size() const + { return sizeof(sem_counts); } + + virtual const void *buffer_with_final_data_to_file() + { + sem_counts[0] = m_condition_data.m_sem_block_queue.value(); + sem_counts[1] = m_condition_data.m_sem_block_lock.value(); + return &sem_counts; + } + + virtual const void *buffer_with_init_data_to_file() + { + sem_counts[0] = 0; + sem_counts[1] = 1; + return &sem_counts; + } + + virtual void *buffer_to_store_init_data_from_file() + { return &sem_counts; } + + virtual bool open(create_enum_t, const char *id_name) + { + m_condition_data.m_nwaiters_blocked = 0; + m_condition_data.m_nwaiters_gone = 0; + m_condition_data.m_nwaiters_to_unblock = 0; + + //Now open semaphores and mutex. + //Use local variables + swap to guarantee consistent + //initialization and cleanup in case any opening fails + permissions perm; + perm.set_unrestricted(); + std::string aux_str = "Global\\bipc.cond."; + aux_str += id_name; + std::size_t pos = aux_str.size(); + + //sem_block_queue + aux_str += "_bq"; + winapi_semaphore_wrapper sem_block_queue; + bool created; + if(!sem_block_queue.open_or_create + (aux_str.c_str(), sem_counts[0], winapi_semaphore_wrapper::MaxCount, perm, created)) + return false; + aux_str.erase(pos); + + //sem_block_lock + aux_str += "_bl"; + winapi_semaphore_wrapper sem_block_lock; + if(!sem_block_lock.open_or_create + (aux_str.c_str(), sem_counts[1], winapi_semaphore_wrapper::MaxCount, perm, created)) + return false; + aux_str.erase(pos); + + //mtx_unblock_lock + aux_str += "_ul"; + winapi_mutex_wrapper mtx_unblock_lock; + if(!mtx_unblock_lock.open_or_create(aux_str.c_str(), perm)) + return false; + + //All ok, commit data + m_condition_data.m_sem_block_queue.swap(sem_block_queue); + m_condition_data.m_sem_block_lock.swap(sem_block_lock); + m_condition_data.m_mtx_unblock_lock.swap(mtx_unblock_lock); + return true; + } + + virtual void close() + { + m_condition_data.m_sem_block_queue.close(); + m_condition_data.m_sem_block_lock.close(); + m_condition_data.m_mtx_unblock_lock.close(); + m_condition_data.m_nwaiters_blocked = 0; + m_condition_data.m_nwaiters_gone = 0; + m_condition_data.m_nwaiters_to_unblock = 0; + } + + virtual ~named_cond_callbacks() + {} + + private: + condition_data &m_condition_data; + }; + + windows_named_sync m_named_sync; + /// @endcond +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp new file mode 100644 index 000000000..8ea6b3e1e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_mutex.hpp @@ -0,0 +1,175 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + + +class windows_named_mutex +{ + /// @cond + + //Non-copyable + windows_named_mutex(); + windows_named_mutex(const windows_named_mutex &); + windows_named_mutex &operator=(const windows_named_mutex &); + /// @endcond + + public: + windows_named_mutex(create_only_t, const char *name, const permissions &perm = permissions()); + + windows_named_mutex(open_or_create_t, const char *name, const permissions &perm = permissions()); + + windows_named_mutex(open_only_t, const char *name); + + ~windows_named_mutex(); + + void unlock(); + void lock(); + bool try_lock(); + bool timed_lock(const boost::posix_time::ptime &abs_time); + + static bool remove(const char *name); + + /// @cond + private: + friend class interprocess_tester; + void dont_close_on_destruction(); + winapi_mutex_wrapper m_mtx_wrapper; + windows_named_sync m_named_sync; + + class named_mut_callbacks : public windows_named_sync_interface + { + public: + named_mut_callbacks(winapi_mutex_wrapper &mtx_wrapper) + : m_mtx_wrapper(mtx_wrapper) + {} + + virtual std::size_t get_data_size() const + { return 0u; } + + virtual const void *buffer_with_init_data_to_file() + { return 0; } + + virtual const void *buffer_with_final_data_to_file() + { return 0; } + + virtual void *buffer_to_store_init_data_from_file() + { return 0; } + + virtual bool open(create_enum_t, const char *id_name) + { + std::string aux_str = "Global\\bipc.mut."; + aux_str += id_name; + // + permissions mut_perm; + mut_perm.set_unrestricted(); + return m_mtx_wrapper.open_or_create(aux_str.c_str(), mut_perm); + } + + virtual void close() + { + m_mtx_wrapper.close(); + } + + virtual ~named_mut_callbacks() + {} + + private: + winapi_mutex_wrapper& m_mtx_wrapper; + }; + /// @endcond +}; + +inline windows_named_mutex::~windows_named_mutex() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.close(callbacks); +} + +inline void windows_named_mutex::dont_close_on_destruction() +{} + +inline windows_named_mutex::windows_named_mutex + (create_only_t, const char *name, const permissions &perm) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); +} + +inline windows_named_mutex::windows_named_mutex + (open_or_create_t, const char *name, const permissions &perm) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); +} + +inline windows_named_mutex::windows_named_mutex(open_only_t, const char *name) + : m_mtx_wrapper() +{ + named_mut_callbacks callbacks(m_mtx_wrapper); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); +} + +inline void windows_named_mutex::unlock() +{ + m_mtx_wrapper.unlock(); +} + +inline void windows_named_mutex::lock() +{ + m_mtx_wrapper.lock(); +} + +inline bool windows_named_mutex::try_lock() +{ + return m_mtx_wrapper.try_lock(); +} + +inline bool windows_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time) +{ + return m_mtx_wrapper.timed_lock(abs_time); +} + +inline bool windows_named_mutex::remove(const char *name) +{ + return windows_named_sync::remove(name); +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP \ No newline at end of file diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp new file mode 100644 index 000000000..cb2ef79ac --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_recursive_mutex.hpp @@ -0,0 +1,58 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP +#define BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + +class windows_named_recursive_mutex + //Windows mutexes based on CreateMutex are already recursive... + : public windows_named_mutex +{ + /// @cond + + //Non-copyable + windows_named_recursive_mutex(); + windows_named_recursive_mutex(const windows_named_mutex &); + windows_named_recursive_mutex &operator=(const windows_named_mutex &); + /// @endcond + + public: + windows_named_recursive_mutex(create_only_t, const char *name, const permissions &perm = permissions()) + : windows_named_mutex(create_only_t(), name, perm) + {} + + windows_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm = permissions()) + : windows_named_mutex(open_or_create_t(), name, perm) + {} + + windows_named_recursive_mutex(open_only_t, const char *name) + : windows_named_mutex(open_only_t(), name) + {} +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp new file mode 100644 index 000000000..8f48d4df9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_semaphore.hpp @@ -0,0 +1,178 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + + + +class windows_named_semaphore +{ + /// @cond + + //Non-copyable + windows_named_semaphore(); + windows_named_semaphore(const windows_named_semaphore &); + windows_named_semaphore &operator=(const windows_named_semaphore &); + /// @endcond + + public: + windows_named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); + + windows_named_semaphore(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); + + windows_named_semaphore(open_only_t, const char *name); + + ~windows_named_semaphore(); + + void post(); + void wait(); + bool try_wait(); + bool timed_wait(const boost::posix_time::ptime &abs_time); + + static bool remove(const char *name); + + /// @cond + private: + friend class interprocess_tester; + void dont_close_on_destruction(); + winapi_semaphore_wrapper m_sem_wrapper; + windows_named_sync m_named_sync; + + class named_sem_callbacks : public windows_named_sync_interface + { + public: + typedef __int64 sem_count_t; + named_sem_callbacks(winapi_semaphore_wrapper &sem_wrapper, sem_count_t sem_cnt) + : m_sem_wrapper(sem_wrapper), m_sem_count(sem_cnt) + {} + + virtual std::size_t get_data_size() const + { return sizeof(sem_count_t); } + + virtual const void *buffer_with_final_data_to_file() + { return &m_sem_count; } + + virtual const void *buffer_with_init_data_to_file() + { return &m_sem_count; } + + virtual void *buffer_to_store_init_data_from_file() + { return &m_sem_count; } + + virtual bool open(create_enum_t, const char *id_name) + { + std::string aux_str = "Global\\bipc.sem."; + aux_str += id_name; + // + permissions sem_perm; + sem_perm.set_unrestricted(); + bool created; + return m_sem_wrapper.open_or_create + ( aux_str.c_str(), static_cast(m_sem_count) + , winapi_semaphore_wrapper::MaxCount, sem_perm, created); + } + + virtual void close() + { + m_sem_wrapper.close(); + } + + virtual ~named_sem_callbacks() + {} + + private: + sem_count_t m_sem_count; + winapi_semaphore_wrapper& m_sem_wrapper; + }; + + /// @endcond +}; + +inline windows_named_semaphore::~windows_named_semaphore() +{ + named_sem_callbacks callbacks(m_sem_wrapper, m_sem_wrapper.value()); + m_named_sync.close(callbacks); +} + +inline void windows_named_semaphore::dont_close_on_destruction() +{} + +inline windows_named_semaphore::windows_named_semaphore + (create_only_t, const char *name, unsigned int initial_count, const permissions &perm) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, initial_count); + m_named_sync.open_or_create(DoCreate, name, perm, callbacks); +} + +inline windows_named_semaphore::windows_named_semaphore + (open_or_create_t, const char *name, unsigned int initial_count, const permissions &perm) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, initial_count); + m_named_sync.open_or_create(DoOpenOrCreate, name, perm, callbacks); +} + +inline windows_named_semaphore::windows_named_semaphore(open_only_t, const char *name) + : m_sem_wrapper() +{ + named_sem_callbacks callbacks(m_sem_wrapper, 0); + m_named_sync.open_or_create(DoOpen, name, permissions(), callbacks); +} + +inline void windows_named_semaphore::post() +{ + m_sem_wrapper.post(); +} + +inline void windows_named_semaphore::wait() +{ + m_sem_wrapper.wait(); +} + +inline bool windows_named_semaphore::try_wait() +{ + return m_sem_wrapper.try_wait(); +} + +inline bool windows_named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time) +{ + return m_sem_wrapper.timed_wait(abs_time); +} + +inline bool windows_named_semaphore::remove(const char *name) +{ + return windows_named_sync::remove(name); +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp new file mode 100644 index 000000000..41f299f8e --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/named_sync.hpp @@ -0,0 +1,215 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP +#define BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class windows_named_sync_interface +{ + public: + virtual std::size_t get_data_size() const = 0; + virtual const void *buffer_with_final_data_to_file() = 0; + virtual const void *buffer_with_init_data_to_file() = 0; + virtual void *buffer_to_store_init_data_from_file() = 0; + virtual bool open(create_enum_t creation_type, const char *id_name) = 0; + virtual void close() = 0; + virtual ~windows_named_sync_interface() = 0; +}; + +inline windows_named_sync_interface::~windows_named_sync_interface() +{} + +class windows_named_sync +{ + /// @cond + + //Non-copyable + windows_named_sync(const windows_named_sync &); + windows_named_sync &operator=(const windows_named_sync &); + /// @endcond + + public: + windows_named_sync(); + void open_or_create(create_enum_t creation_type, const char *name, const permissions &perm, windows_named_sync_interface &sync_interface); + void close(windows_named_sync_interface &sync_interface); + + static bool remove(const char *name); + + /// @cond + private: + void *m_file_hnd; + + /// @endcond +}; + +inline windows_named_sync::windows_named_sync() + : m_file_hnd(winapi::invalid_handle_value) +{} + +inline void windows_named_sync::close(windows_named_sync_interface &sync_interface) +{ + const std::size_t buflen = sync_interface.get_data_size(); + const std::size_t sizeof_file_info = sizeof(sync_id::internal_type) + buflen; + winapi::interprocess_overlapped overlapped; + if(winapi::lock_file_ex + (m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){ + if(winapi::set_file_pointer_ex(m_file_hnd, sizeof(sync_id::internal_type), 0, winapi::file_begin)){ + const void *buf = sync_interface.buffer_with_final_data_to_file(); + + unsigned long written_or_read = 0; + if(winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0)){ + //... + } + } + } + sync_interface.close(); + if(m_file_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_file_hnd); + m_file_hnd = winapi::invalid_handle_value; + } +} + +inline void windows_named_sync::open_or_create + ( create_enum_t creation_type + , const char *name + , const permissions &perm + , windows_named_sync_interface &sync_interface) +{ + std::string aux_str(name); + m_file_hnd = winapi::invalid_handle_value; + //Use a file to emulate POSIX lifetime semantics. After this logic + //we'll obtain the ID of the native handle to open in aux_str + { + create_tmp_and_clean_old_and_get_filename(name, aux_str); + //Create a file with required permissions. + m_file_hnd = winapi::create_file + ( aux_str.c_str() + , winapi::generic_read | winapi::generic_write + , creation_type == DoOpen ? winapi::open_existing : + (creation_type == DoCreate ? winapi::create_new : winapi::open_always) + , 0 + , (winapi::interprocess_security_attributes*)perm.get_permissions()); + + //Obtain OS error in case something has failed + error_info err; + bool success = false; + if(m_file_hnd != winapi::invalid_handle_value){ + //Now lock the file + const std::size_t buflen = sync_interface.get_data_size(); + typedef __int64 unique_id_type; + const std::size_t sizeof_file_info = sizeof(unique_id_type) + buflen; + winapi::interprocess_overlapped overlapped; + if(winapi::lock_file_ex + (m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){ + __int64 filesize = 0; + //Obtain the unique id to open the native semaphore. + //If file size was created + if(winapi::get_file_size(m_file_hnd, filesize)){ + unsigned long written_or_read = 0; + unique_id_type unique_id_val; + if(static_cast(filesize) != sizeof_file_info){ + winapi::set_end_of_file(m_file_hnd); + winapi::query_performance_counter(&unique_id_val); + const void *buf = sync_interface.buffer_with_init_data_to_file(); + //Write unique ID in file. This ID will be used to calculate the semaphore name + if(winapi::write_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) && + written_or_read == sizeof(unique_id_val) && + winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0) && + written_or_read == buflen ){ + success = true; + } + winapi::get_file_size(m_file_hnd, filesize); + assert(std::size_t(filesize) == sizeof_file_info); + } + else{ + void *buf = sync_interface.buffer_to_store_init_data_from_file(); + if(winapi::read_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) && + written_or_read == sizeof(unique_id_val) && + winapi::read_file(m_file_hnd, buf, buflen, &written_or_read, 0) && + written_or_read == buflen ){ + success = true; + } + } + if(success){ + //Now create a global semaphore name based on the unique id + char unique_id_name[sizeof(unique_id_val)*2+1]; + std::size_t name_suffix_length = sizeof(unique_id_name); + bytes_to_str(&unique_id_val, sizeof(unique_id_val), &unique_id_name[0], name_suffix_length); + success = sync_interface.open(creation_type, unique_id_name); + } + } + + //Obtain OS error in case something has failed + err = system_error_code(); + + //If this fails we have no possible rollback so don't check the return + if(!winapi::unlock_file_ex(m_file_hnd, 0, sizeof_file_info, 0, &overlapped)){ + err = system_error_code(); + } + } + else{ + //Obtain OS error in case something has failed + err = system_error_code(); + } + } + else{ + err = system_error_code(); + } + + if(!success){ + if(m_file_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_file_hnd); + m_file_hnd = winapi::invalid_handle_value; + } + //Throw as something went wrong + throw interprocess_exception(err); + } + } +} + +inline bool windows_named_sync::remove(const char *name) +{ + try{ + //Make sure a temporary path is created for shared memory + std::string semfile; + ipcdetail::tmp_filename(name, semfile); + return winapi::unlink_file(semfile.c_str()); + } + catch(...){ + return false; + } +} + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp index 9565cb6fb..2b4797e17 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/recursive_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp index d5835ceec..a8625a6bf 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -19,8 +19,9 @@ #include #include #include -#include +#include #include +#include #include @@ -46,11 +47,11 @@ class windows_semaphore const sync_id id_; }; -inline windows_semaphore::windows_semaphore(unsigned int initialCount) - : id_() +inline windows_semaphore::windows_semaphore(unsigned int initialCount) + : id_(this) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //Force smeaphore creation with the initial count bool open_or_created; handles.obtain_semaphore(this->id_, initialCount, &open_or_created); @@ -60,72 +61,46 @@ inline windows_semaphore::windows_semaphore(unsigned int initialCount) (void)open_or_created; } -inline windows_semaphore::~windows_semaphore() +inline windows_semaphore::~windows_semaphore() { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); handles.destroy_handle(this->id_); } inline void windows_semaphore::wait(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, winapi::infinite_time); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + sem.wait(); } inline bool windows_semaphore::try_wait(void) { sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, 0); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + return sem.try_wait(); } inline bool windows_semaphore::timed_wait(const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ - this->wait(); - return true; - } - boost::posix_time::ptime now - = boost::posix_time::microsec_clock::universal_time(); - - unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds(); sync_handles &handles = - intermodule_singleton::get(); + windows_intermodule_singleton::get(); //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - unsigned long ret = winapi::wait_for_single_object(hnd, ms); - if(ret == winapi::wait_failed){ - error_info err(winapi::get_last_error()); - throw interprocess_exception(err); - } - return ret != winapi::wait_timeout; + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + return sem.timed_wait(abs_time); } inline void windows_semaphore::post(long release_count) { sync_handles &handles = - intermodule_singleton::get(); - //This can throw - void *hnd = handles.obtain_semaphore(this->id_, 0); - long prev_count; - int ret = winapi::release_semaphore(hnd, release_count, &prev_count); - (void)ret; - assert(ret); + windows_intermodule_singleton::get(); + winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, 0)); + sem.post(release_count); } } //namespace ipcdetail { diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp index 89c4aeda0..92d8e55a1 100644 --- a/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/windows/sync_utils.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -21,7 +21,16 @@ #include #include #include -#include +#include +#include + +//Shield against external warnings +#include + #include +#include + + +#include #include namespace boost { @@ -32,6 +41,7 @@ inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *ou { const std::size_t need_mem = mem_length*2+1; if(out_length < need_mem){ + out_length = need_mem; return false; } @@ -49,40 +59,57 @@ inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *ou return true; } -struct sync_id +class sync_id { - sync_id() - { winapi::query_performance_counter(&rand); } + public: + typedef __int64 internal_type; + sync_id(const void *map_addr) + : map_addr_(map_addr) + { winapi::query_performance_counter(&rand_); } - __int64 rand; + explicit sync_id(internal_type val, const void *map_addr) + : map_addr_(map_addr) + { rand_ = val; } + + const internal_type &internal_pod() const + { return rand_; } + + internal_type &internal_pod() + { return rand_; } + + const void *map_address() const + { return map_addr_; } friend std::size_t hash_value(const sync_id &m) - { return boost::hash_value(m.rand); } + { return boost::hash_value(m.rand_); } friend bool operator==(const sync_id &l, const sync_id &r) - { return l.rand == r.rand; } + { return l.rand_ == r.rand_ && l.map_addr_ == r.map_addr_; } + + private: + internal_type rand_; + const void * const map_addr_; }; -/* -#define BOOST_NO_LONG_LONG ss -#if defined(BOOST_NO_LONG_LONG) - -#error "defined(BOOST_NO_LONG_LONG)" -#else -#error "NOT defined(BOOST_NO_LONG_LONG)" -#endif -*/ class sync_handles { public: enum type { MUTEX, SEMAPHORE }; private: - typedef boost::unordered_map map_type; + struct address_less + { + bool operator()(sync_id const * const l, sync_id const * const r) const + { return l->map_address() < r->map_address(); } + }; + + typedef boost::unordered_map umap_type; + typedef boost::container::map map_type; static const std::size_t LengthOfGlobal = sizeof("Global\\boost.ipc")-1; static const std::size_t StrSize = LengthOfGlobal + (sizeof(sync_id)*2+1); typedef char NameBuf[StrSize]; + void fill_name(NameBuf &name, const sync_id &id) { const char *n = "Global\\boost.ipc"; @@ -92,13 +119,12 @@ class sync_handles ++i; } while(n[i]); std::size_t len = sizeof(NameBuf) - LengthOfGlobal; - bytes_to_str(&id.rand, sizeof(id.rand), &name[LengthOfGlobal], len); + bytes_to_str(&id.internal_pod(), sizeof(id.internal_pod()), &name[LengthOfGlobal], len); } - void erase_and_throw_if_error(void *hnd_val, const sync_id &id) + void throw_if_error(void *hnd_val) { if(!hnd_val){ - map_.erase(id); error_info err(winapi::get_last_error()); throw interprocess_exception(err); } @@ -108,58 +134,95 @@ class sync_handles { NameBuf name; fill_name(name, id); - void *hnd_val = winapi::open_or_create_semaphore - (name, (long)initial_count, (long)(((unsigned long)(-1))>>1), unrestricted_security.get_attributes()); - erase_and_throw_if_error(hnd_val, id); - return hnd_val; + permissions unrestricted_security; + unrestricted_security.set_unrestricted(); + winapi_semaphore_wrapper sem_wrapper; + bool created; + sem_wrapper.open_or_create + (name, (long)initial_count, winapi_semaphore_wrapper::MaxCount, unrestricted_security, created); + throw_if_error(sem_wrapper.handle()); + return sem_wrapper.release(); } void* open_or_create_mutex(const sync_id &id) { NameBuf name; fill_name(name, id); - void *hnd_val = winapi::open_or_create_mutex - (name, false, unrestricted_security.get_attributes()); - erase_and_throw_if_error(hnd_val, id); - return hnd_val; + permissions unrestricted_security; + unrestricted_security.set_unrestricted(); + winapi_mutex_wrapper mtx_wrapper; + mtx_wrapper.open_or_create(name, unrestricted_security); + throw_if_error(mtx_wrapper.handle()); + return mtx_wrapper.release(); } public: void *obtain_mutex(const sync_id &id, bool *popen_created = 0) { + umap_type::value_type v(id, (void*)0); scoped_lock lock(mtx_); - void *&hnd_val = map_[id]; + umap_type::iterator it = umap_.insert(v).first; + void *&hnd_val = it->second; if(!hnd_val){ + map_[&it->first] = it; hnd_val = open_or_create_mutex(id); if(popen_created) *popen_created = true; } + else if(popen_created){ + *popen_created = false; + } return hnd_val; } void *obtain_semaphore(const sync_id &id, unsigned int initial_count, bool *popen_created = 0) { + umap_type::value_type v(id, (void*)0); scoped_lock lock(mtx_); - void *&hnd_val = map_[id]; + umap_type::iterator it = umap_.insert(v).first; + void *&hnd_val = it->second; if(!hnd_val){ + map_[&it->first] = it; hnd_val = open_or_create_semaphore(id, initial_count); if(popen_created) *popen_created = true; } + else if(popen_created){ + *popen_created = false; + } return hnd_val; } void destroy_handle(const sync_id &id) { scoped_lock lock(mtx_); - map_type::iterator it = map_.find(id); - if(it != map_.end()){ + umap_type::iterator it = umap_.find(id); + umap_type::iterator itend = umap_.end(); + + if(it != itend){ winapi::close_handle(it->second); - map_.erase(it); + const map_type::key_type &k = &it->first; + map_.erase(k); + umap_.erase(it); + } + } + + void destroy_syncs_in_range(const void *addr, std::size_t size) + { + const sync_id low_id(addr); + const sync_id hig_id(static_cast(addr)+size); + scoped_lock lock(mtx_); + map_type::iterator itlow(map_.lower_bound(&low_id)), + ithig(map_.lower_bound(&hig_id)); + while(itlow != ithig){ + void * const hnd = umap_[*itlow->first]; + winapi::close_handle(hnd); + umap_.erase(*itlow->first); + itlow = map_.erase(itlow); } } private: - winapi::interprocess_all_access_security unrestricted_security; spin_mutex mtx_; + umap_type umap_; map_type map_; }; diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp new file mode 100644 index 000000000..0be96011c --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp @@ -0,0 +1,163 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP +#define BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class winapi_mutex_functions +{ + /// @cond + + //Non-copyable + winapi_mutex_functions(const winapi_mutex_functions &); + winapi_mutex_functions &operator=(const winapi_mutex_functions &); + /// @endcond + + public: + winapi_mutex_functions(void *mtx_hnd) + : m_mtx_hnd(mtx_hnd) + {} + + void unlock() + { + winapi::release_mutex(m_mtx_hnd); + } + + void lock() + { + if(winapi::wait_for_single_object(m_mtx_hnd, winapi::infinite_time) != winapi::wait_object_0){ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool try_lock() + { + unsigned long ret = winapi::wait_for_single_object(m_mtx_hnd, 0); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool timed_lock(const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->lock(); + return true; + } + + unsigned long ret = winapi::wait_for_single_object + (m_mtx_hnd, (abs_time - microsec_clock::universal_time()).total_milliseconds()); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + /// @cond + protected: + void *m_mtx_hnd; + /// @endcond +}; + +//Swappable mutex wrapper +class winapi_mutex_wrapper + : public winapi_mutex_functions +{ + /// @cond + + //Non-copyable + winapi_mutex_wrapper(const winapi_mutex_wrapper &); + winapi_mutex_wrapper &operator=(const winapi_mutex_wrapper &); + /// @endcond + + public: + winapi_mutex_wrapper(void *mtx_hnd = winapi::invalid_handle_value) + : winapi_mutex_functions(mtx_hnd) + {} + + ~winapi_mutex_wrapper() + { this->close(); } + + void *release() + { + void *hnd = m_mtx_hnd; + m_mtx_hnd = winapi::invalid_handle_value; + return hnd; + } + + void *handle() const + { return m_mtx_hnd; } + + bool open_or_create(const char *name, const permissions &perm) + { + if(m_mtx_hnd == winapi::invalid_handle_value){ + m_mtx_hnd = winapi::open_or_create_mutex + ( name + , false + , (winapi::interprocess_security_attributes*)perm.get_permissions() + ); + return m_mtx_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + void close() + { + if(m_mtx_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_mtx_hnd); + m_mtx_hnd = winapi::invalid_handle_value; + } + } + + void swap(winapi_mutex_wrapper &other) + { void *tmp = m_mtx_hnd; m_mtx_hnd = other.m_mtx_hnd; other.m_mtx_hnd = tmp; } +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp new file mode 100644 index 000000000..de5185ac9 --- /dev/null +++ b/project/jni/boost/include/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp @@ -0,0 +1,198 @@ + ////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP +#define BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace interprocess { +namespace ipcdetail { + +class winapi_semaphore_functions +{ + /// @cond + + //Non-copyable + winapi_semaphore_functions(const winapi_semaphore_functions &); + winapi_semaphore_functions &operator=(const winapi_semaphore_functions &); + /// @endcond + + public: + winapi_semaphore_functions(void *hnd) + : m_sem_hnd(hnd) + {} + + void post(long count = 1) + { + long prev_count; + winapi::release_semaphore(m_sem_hnd, count, &prev_count); + } + + void wait() + { + if(winapi::wait_for_single_object(m_sem_hnd, winapi::infinite_time) != winapi::wait_object_0){ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool try_wait() + { + unsigned long ret = winapi::wait_for_single_object(m_sem_hnd, 0); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + bool timed_wait(const boost::posix_time::ptime &abs_time) + { + if(abs_time == boost::posix_time::pos_infin){ + this->wait(); + return true; + } + + unsigned long ret = winapi::wait_for_single_object + (m_sem_hnd, (abs_time - microsec_clock::universal_time()).total_milliseconds()); + if(ret == winapi::wait_object_0){ + return true; + } + else if(ret == winapi::wait_timeout){ + return false; + } + else{ + error_info err = system_error_code(); + throw interprocess_exception(err); + } + } + + long value() const + { + long l_count, l_limit; + if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit)) + return 0; + return l_count; + } + + long limit() const + { + long l_count, l_limit; + if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit)) + return 0; + return l_limit; + } + + /// @cond + protected: + void *m_sem_hnd; + /// @endcond +}; + + +//Swappable semaphore wrapper +class winapi_semaphore_wrapper + : public winapi_semaphore_functions +{ + winapi_semaphore_wrapper(const winapi_semaphore_wrapper &); + winapi_semaphore_wrapper &operator=(const winapi_semaphore_wrapper &); + + public: + + //Long is 32 bits in windows + static const long MaxCount = long(0x7FFFFFFF); + + winapi_semaphore_wrapper(void *hnd = winapi::invalid_handle_value) + : winapi_semaphore_functions(hnd) + {} + + ~winapi_semaphore_wrapper() + { this->close(); } + + void *release() + { + void *hnd = m_sem_hnd; + m_sem_hnd = winapi::invalid_handle_value; + return hnd; + } + + void *handle() const + { return m_sem_hnd; } + + bool open_or_create( const char *name + , long sem_count + , long max_count + , const permissions &perm + , bool &created) + { + if(m_sem_hnd == winapi::invalid_handle_value){ + m_sem_hnd = winapi::open_or_create_semaphore + ( name + , sem_count + , max_count + , (winapi::interprocess_security_attributes*)perm.get_permissions() + ); + created = winapi::get_last_error() != winapi::error_already_exists; + return m_sem_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + bool open_semaphore(const char *name) + { + if(m_sem_hnd == winapi::invalid_handle_value){ + m_sem_hnd = winapi::open_semaphore(name); + return m_sem_hnd != winapi::invalid_handle_value; + } + else{ + return false; + } + } + + void close() + { + if(m_sem_hnd != winapi::invalid_handle_value){ + winapi::close_handle(m_sem_hnd); + m_sem_hnd = winapi::invalid_handle_value; + } + } + + void swap(winapi_semaphore_wrapper &other) + { void *tmp = m_sem_hnd; m_sem_hnd = other.m_sem_hnd; other.m_sem_hnd = tmp; } +}; + +} //namespace ipcdetail { +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP diff --git a/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp b/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp index 266e7c5da..deb429a3c 100644 --- a/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp b/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp index 3dffdcc2e..f69f9cda8 100644 --- a/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp +++ b/project/jni/boost/include/boost/interprocess/sync/xsi/xsi_named_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -62,20 +62,20 @@ class xsi_named_mutex xsi_named_mutex(open_or_create_t, const char *path, boost::uint8_t id, int perm = 0666) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, path, id, perm); } - //!Moves the ownership of "moved"'s named mutex to *this. - //!After the call, "moved" does not represent any named mutex + //!Moves the ownership of "moved"'s named mutex to *this. + //!After the call, "moved" does not represent any named mutex //!Does not throw xsi_named_mutex(BOOST_RV_REF(xsi_named_mutex) moved) { this->swap(moved); } //!Moves the ownership of "moved"'s named mutex to *this. - //!After the call, "moved" does not represent any named mutex. + //!After the call, "moved" does not represent any named mutex. //!Does not throw xsi_named_mutex &operator=(BOOST_RV_REF(xsi_named_mutex) moved) - { + { xsi_named_mutex tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_named_mutex. Does not throw @@ -126,11 +126,11 @@ class xsi_named_mutex /// @cond -inline xsi_named_mutex::xsi_named_mutex() +inline xsi_named_mutex::xsi_named_mutex() : m_semid(-1), m_key(-1), m_id(0), m_perm(0), m_path() {} -inline xsi_named_mutex::~xsi_named_mutex() +inline xsi_named_mutex::~xsi_named_mutex() { this->priv_close(); } inline const char *xsi_named_mutex::get_path() const @@ -142,7 +142,7 @@ inline void xsi_named_mutex::swap(xsi_named_mutex &other) std::swap(m_id, other.m_id); std::swap(m_semid, other.m_semid); std::swap(m_perm, other.m_perm); - m_path.swap(other.m_path); + m_path.swap(other.m_path); } inline mapping_handle_t xsi_named_mutex::get_mapping_handle() const diff --git a/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp index 9a8b3f47d..f2195ac2f 100644 --- a/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/windows_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -72,26 +72,26 @@ class windows_shared_memory windows_shared_memory(open_or_create_t, const char *name, mode_t mode, std::size_t size, const permissions& perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, size, perm); } - //!Tries to open a shared memory object with name "name", with the access mode "mode". + //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. windows_shared_memory(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, 0, permissions()); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw windows_shared_memory(BOOST_RV_REF(windows_shared_memory) moved) : m_handle(0) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved) - { + { windows_shared_memory tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps to shared_memory_objects. Does not throw @@ -129,21 +129,21 @@ class windows_shared_memory /// @cond -inline windows_shared_memory::windows_shared_memory() +inline windows_shared_memory::windows_shared_memory() : m_handle(0) {} -inline windows_shared_memory::~windows_shared_memory() +inline windows_shared_memory::~windows_shared_memory() { this->priv_close(); } inline const char *windows_shared_memory::get_name() const { return m_name.c_str(); } inline void windows_shared_memory::swap(windows_shared_memory &other) -{ +{ std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); - m_name.swap(other.m_name); + m_name.swap(other.m_name); } inline mapping_handle_t windows_shared_memory::get_mapping_handle() const @@ -157,22 +157,26 @@ inline bool windows_shared_memory::priv_open_or_create { m_name = filename ? filename : ""; - unsigned long file_map_access = 0; + unsigned long protection = 0; unsigned long map_access = 0; switch(mode) { + //"protection" is for "create_file_mapping" + //"map_access" is for "open_file_mapping" + //Add section query (strange that read or access does not grant it...) + //to obtain the size of the mapping. copy_on_write is equal to section_query. case read_only: - file_map_access |= winapi::page_readonly; - map_access |= winapi::file_map_read; + protection |= winapi::page_readonly; + map_access |= winapi::file_map_read | winapi::section_query; break; case read_write: - file_map_access |= winapi::page_readwrite; - map_access |= winapi::file_map_write; + protection |= winapi::page_readwrite; + map_access |= winapi::file_map_write | winapi::section_query; break; case copy_on_write: - file_map_access |= winapi::page_writecopy; - map_access |= winapi::file_map_copy; + protection |= winapi::page_writecopy; + map_access |= winapi::file_map_copy; break; default: { @@ -184,16 +188,13 @@ inline bool windows_shared_memory::priv_open_or_create switch(type){ case ipcdetail::DoOpen: - m_handle = winapi::open_file_mapping - (map_access, filename); + m_handle = winapi::open_file_mapping(map_access, filename); break; case ipcdetail::DoCreate: case ipcdetail::DoOpenOrCreate: { - __int64 s = size; - unsigned long high_size(s >> 32), low_size((boost::uint32_t)s); m_handle = winapi::create_file_mapping - ( winapi::invalid_handle_value, file_map_access, high_size, low_size, filename + ( winapi::invalid_handle_value, protection, size, filename , (winapi::interprocess_security_attributes*)perm.get_permissions()); } break; diff --git a/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp b/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp index 3d09c7739..11cfe1d10 100644 --- a/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp +++ b/project/jni/boost/include/boost/interprocess/xsi_shared_memory.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -78,21 +78,21 @@ class xsi_shared_memory xsi_shared_memory(open_only_t, const xsi_key &key) { this->priv_open_or_create(ipcdetail::DoOpen, key, permissions(), 0); } - //!Moves the ownership of "moved"'s shared memory object to *this. - //!After the call, "moved" does not represent any shared memory object. + //!Moves the ownership of "moved"'s shared memory object to *this. + //!After the call, "moved" does not represent any shared memory object. //!Does not throw xsi_shared_memory(BOOST_RV_REF(xsi_shared_memory) moved) : m_shmid(-1) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. - //!After the call, "moved" does not represent any shared memory. + //!After the call, "moved" does not represent any shared memory. //!Does not throw xsi_shared_memory &operator=(BOOST_RV_REF(xsi_shared_memory) moved) - { + { xsi_shared_memory tmp(boost::move(moved)); this->swap(tmp); - return *this; + return *this; } //!Swaps two xsi_shared_memorys. Does not throw @@ -129,11 +129,11 @@ class xsi_shared_memory /// @cond -inline xsi_shared_memory::xsi_shared_memory() +inline xsi_shared_memory::xsi_shared_memory() : m_shmid(-1) {} -inline xsi_shared_memory::~xsi_shared_memory() +inline xsi_shared_memory::~xsi_shared_memory() {} inline int xsi_shared_memory::get_shmid() const diff --git a/project/jni/boost/include/boost/intrusive/any_hook.hpp b/project/jni/boost/include/boost/intrusive/any_hook.hpp index cccc820e7..7d60de001 100644 --- a/project/jni/boost/include/boost/intrusive/any_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/any_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -50,7 +50,7 @@ struct make_any_base_hook Options... #endif >::type packed_options; - + typedef detail::generic_hook < get_any_node_algo , typename packed_options::tag @@ -63,13 +63,13 @@ struct make_any_base_hook //! Derive a class from this hook in order to store objects of that class //! in an intrusive container. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<> and //! \c link_mode<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its //! unique tag. //! //! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link). @@ -94,27 +94,27 @@ class any_base_hook public: //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. any_base_hook(); //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_base_hook(const any_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_base_hook& operator=(const any_base_hook& ); @@ -122,17 +122,17 @@ class any_base_hook //! Effects: If link_mode is \c normal_link, the destructor does //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a container an assertion is raised. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~any_base_hook(); //! Precondition: link_mode must be \c safe_link. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c container::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; #endif }; @@ -148,7 +148,7 @@ struct make_any_member_hook { /// @cond typedef typename pack_options - < hook_defaults, + < hook_defaults, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) O1, O2, O3 #else @@ -168,10 +168,10 @@ struct make_any_member_hook //! Store this hook in a class to be inserted //! in an intrusive container. -//! +//! //! The hook admits the following options: \c void_pointer<> and //! \c link_mode<>. -//! +//! //! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link). //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -194,27 +194,27 @@ class any_member_hook public: //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. any_member_hook(); //! Effects: If link_mode is or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_member_hook(const any_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. any_member_hook& operator=(const any_member_hook& ); @@ -222,17 +222,17 @@ class any_member_hook //! Effects: If link_mode is \c normal_link, the destructor does //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a container an assertion is raised. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~any_member_hook(); //! Precondition: link_mode must be \c safe_link. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c container::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; #endif }; @@ -336,8 +336,8 @@ struct any_to_unordered_set_hook {}; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avl_set.hpp b/project/jni/boost/include/boost/intrusive/avl_set.hpp index 92baf473c..9e17aa7e4 100644 --- a/project/jni/boost/include/boost/intrusive/avl_set.hpp +++ b/project/jni/boost/include/boost/intrusive/avl_set.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -22,9 +22,9 @@ namespace boost { namespace intrusive { -//! The class template avl_set is an intrusive container, that mimics most of +//! The class template avl_set is an intrusive container, that mimics most of //! the interface of std::set as described in the C++ standard. -//! +//! //! The template parameter \c T is the type to be managed by the container. //! The user can specify additional options and if no options are provided //! default options are used. @@ -79,30 +79,30 @@ class avl_set_impl /// @endcond public: - //! Effects: Constructs an empty avl_set. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty avl_set. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor of the value_compare object throws. - avl_set_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + //! or the copy constructor of the value_compare object throws. + explicit avl_set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : tree_(cmp, v_traits) {} - //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. //! cmp must be a comparison function that induces a strict weak ordering. - //! - //! Effects: Constructs an empty avl_set and inserts elements from + //! + //! Effects: Constructs an empty avl_set and inserts elements from //! [b, e). - //! - //! Complexity: Linear in N if [b, e) is already sorted using + //! + //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is std::distance(last, first). - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. + //! or the copy constructor/operator() of the value_compare object throws. template avl_set_impl( Iterator b, Iterator e , const value_compare &cmp = value_compare() @@ -111,135 +111,135 @@ class avl_set_impl {} //! Effects: to-do - //! - avl_set_impl(BOOST_RV_REF(avl_set_impl) x) + //! + avl_set_impl(BOOST_RV_REF(avl_set_impl) x) : tree_(::boost::move(x.tree_)) {} //! Effects: to-do - //! - avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x) + //! + avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x) { tree_ = ::boost::move(x.tree_); return *this; } - //! Effects: Detaches all elements from this. The objects in the avl_set + //! Effects: Detaches all elements from this. The objects in the avl_set //! are not deleted (i.e. no destructors are called). - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - ~avl_set_impl() + ~avl_set_impl() {} //! Effects: Returns an iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return tree_.cbegin(); } //! Effects: Returns an iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return tree_.cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return tree_.crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return tree_.crend(); } //! Precondition: end_iterator must be a valid end iterator //! of avl_set. - //! + //! //! Effects: Returns a const reference to the avl_set associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avl_set_impl &container_from_end_iterator(iterator end_iterator) { @@ -250,11 +250,11 @@ class avl_set_impl //! Precondition: end_iterator must be a valid end const_iterator //! of avl_set. - //! + //! //! Effects: Returns a const reference to the set associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator) { @@ -264,11 +264,11 @@ class avl_set_impl } //! Precondition: it must be a valid iterator of set. - //! + //! //! Effects: Returns a reference to the set associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avl_set_impl &container_from_iterator(iterator it) { @@ -278,11 +278,11 @@ class avl_set_impl } //! Precondition: it must be a valid const_iterator of set. - //! + //! //! Effects: Returns a const reference to the set associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avl_set_impl &container_from_iterator(const_iterator it) { @@ -292,42 +292,42 @@ class avl_set_impl } //! Effects: Returns the key_compare object used by the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If key_compare copy-constructor throws. key_compare key_comp() const { return tree_.value_comp(); } //! Effects: Returns the value_compare object used by the avl_set. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return tree_.value_comp(); } //! Effects: Returns true is the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return tree_.empty(); } //! Effects: Returns the number of elements stored in the avl_set. - //! + //! //! Complexity: Linear to elements contained in *this if, //! constant-time size option is enabled. Constant-time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { return tree_.size(); } //! Effects: Swaps the contents of two sets. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the swap() call for the comparison functor //! found using ADL throws. Strong guarantee. void swap(avl_set_impl& other) @@ -337,22 +337,22 @@ class avl_set_impl //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer) { tree_.clone_from(src.tree_, cloner, disposer); } //! Requires: value must be an lvalue - //! + //! //! Effects: Treaps to inserts value into the avl_set. //! //! Returns: If the value @@ -360,39 +360,39 @@ class avl_set_impl //! iterator to the new value and true. If there is an equivalent value //! returns a pair containing an iterator to the already present value //! and false. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. std::pair insert(reference value) { return tree_.insert_unique(value); } //! Requires: value must be an lvalue - //! - //! Effects: Treaps to to insert x into the avl_set, using "hint" + //! + //! Effects: Treaps to to insert x into the avl_set, using "hint" //! as a hint to where it will be inserted. //! - //! Returns: An iterator that points to the position where the + //! Returns: An iterator that points to the position where the //! new element was inserted into the avl_set. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(const_iterator hint, reference value) { return tree_.insert_unique(hint, value); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the avl_set, using //! a user provided key instead of the value itself. //! @@ -401,16 +401,16 @@ class avl_set_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! node that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that + //! than the value_type and this function offers the possibility to use that //! part to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use @@ -424,12 +424,12 @@ class avl_set_impl (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) { return tree_.insert_unique_check(key, key_value_comp, commit_data); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the avl_set, using - //! a user provided key instead of the value itself, using "hint" + //! a user provided key instead of the value itself, using "hint" //! as a hint to where it will be inserted. //! //! Returns: If there is an equivalent value @@ -437,23 +437,23 @@ class avl_set_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! constructing that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that key + //! than the value_type and this function offers the possibility to use that key //! to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use //! "insert_commit" to insert the object in constant-time. This can give a total //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). - //! + //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the avl_set. template @@ -466,33 +466,33 @@ class avl_set_impl //! must have been obtained from a previous call to "insert_check". //! No objects should have been inserted or erased from the avl_set between //! the "insert_check" that filled "commit_data" and the call to "insert_commit". - //! + //! //! Effects: Inserts the value in the avl_set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Returns: An iterator to the newly inserted object. - //! + //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. iterator insert_commit(reference value, const insert_commit_data &commit_data) { return tree_.insert_unique_commit(value, commit_data); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a range into the avl_set. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template @@ -505,11 +505,11 @@ class avl_set_impl //! inserted key according to the predicate. //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" or "value" is not unique tree ordering and uniqueness //! invariants will be broken respectively. @@ -522,11 +522,11 @@ class avl_set_impl //! any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than or equal to the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -539,11 +539,11 @@ class avl_set_impl //! than any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than or equal to the the mimum inserted key tree ordering or uniqueness //! invariants will be broken. @@ -553,41 +553,41 @@ class avl_set_impl void push_front(reference value) { tree_.push_front(value); } - //! Effects: Erases the element pointed to by pos. - //! + //! Effects: Erases the element pointed to by pos. + //! //! Complexity: Average complexity is constant time. - //! + //! //! Returns: An iterator to the element after the erased element. //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) { return tree_.erase(i); } - //! Effects: Erases the range pointed to by b end e. - //! - //! Complexity: Average complexity for erase range is at most + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Returns: An iterator to the element after the erased elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { return tree_.erase(b, e); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size()) + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -595,13 +595,13 @@ class avl_set_impl //! Effects: Erases all the elements that compare equal with //! the given key and the given comparison functor. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If the comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -614,16 +614,16 @@ class avl_set_impl //! Requires: Disposer::operator()(pointer) shouldn't throw. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Returns: An iterator to the element after the erased element. - //! + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -639,14 +639,14 @@ class avl_set_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Returns: An iterator to the element after the erased elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -657,13 +657,13 @@ class avl_set_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: If the internal value_compare ordering function throws. - //! + //! //! Complexity: O(log(size() + this->count(value)). Basic guarantee. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -677,11 +677,11 @@ class avl_set_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -693,26 +693,26 @@ class avl_set_impl { return tree_.erase_and_dispose(key, comp, disposer); } //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() { return tree_.clear(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. - //! + //! //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -720,20 +720,20 @@ class avl_set_impl { return tree_.clear_and_dispose(disposer); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If the internal value_compare ordering function throws. size_type count(const_reference value) const { return tree_.find(value) != end(); } //! Effects: Returns the number of contained elements with the same key //! compared with the given comparison functor. - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If comp ordering function throws. template size_type count(const KeyType& key, KeyValueCompare comp) const @@ -741,9 +741,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator lower_bound(const_reference value) { return tree_.lower_bound(value); } @@ -753,13 +753,13 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -769,9 +769,9 @@ class avl_set_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator lower_bound(const_reference value) const { return tree_.lower_bound(value); } @@ -781,13 +781,13 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -797,9 +797,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator upper_bound(const_reference value) { return tree_.upper_bound(value); } @@ -809,11 +809,11 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -825,9 +825,9 @@ class avl_set_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator upper_bound(const_reference value) const { return tree_.upper_bound(value); } @@ -837,11 +837,11 @@ class avl_set_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -851,11 +851,11 @@ class avl_set_impl const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const { return tree_.upper_bound(key, comp); } - //! Effects: Finds an iterator to the first element whose value is + //! Effects: Finds an iterator to the first element whose value is //! "value" or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator find(const_reference value) { return tree_.find(value); } @@ -864,12 +864,12 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds an iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -879,11 +879,11 @@ class avl_set_impl iterator find(const KeyType& key, KeyValueCompare comp) { return tree_.find(key, comp); } - //! Effects: Finds a const_iterator to the first element whose value is + //! Effects: Finds a const_iterator to the first element whose value is //! "value" or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator find(const_reference value) const { return tree_.find(value); } @@ -892,12 +892,12 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a const_iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -910,9 +910,9 @@ class avl_set_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) { return tree_.equal_range(value); } @@ -921,13 +921,13 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -940,9 +940,9 @@ class avl_set_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) const @@ -952,13 +952,13 @@ class avl_set_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -969,16 +969,101 @@ class avl_set_impl equal_range(const KeyType& key, KeyValueCompare comp) const { return tree_.equal_range(key, comp); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair + bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair + bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -986,14 +1071,14 @@ class avl_set_impl //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static const_iterator s_iterator_to(const_reference value) @@ -1001,48 +1086,48 @@ class avl_set_impl //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return tree_.iterator_to(value); } //! Requires: value must be an lvalue and shall be in a avl_set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return tree_.iterator_to(value); } //! Requires: value shall not be in a avl_set/avl_multiset. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) { tree_type::init_node(value); } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -1052,14 +1137,14 @@ class avl_set_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -1233,9 +1318,9 @@ class avl_set #endif -//! The class template avl_multiset is an intrusive container, that mimics most of +//! The class template avl_multiset is an intrusive container, that mimics most of //! the interface of std::avl_multiset as described in the C++ standard. -//! +//! //! The template parameter \c T is the type to be managed by the container. //! The user can specify additional options and if no options are provided //! default options are used. @@ -1289,30 +1374,30 @@ class avl_multiset_impl /// @endcond public: - //! Effects: Constructs an empty avl_multiset. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty avl_multiset. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. - avl_multiset_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + //! or the copy constructor/operator() of the value_compare object throws. + explicit avl_multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : tree_(cmp, v_traits) {} - //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. //! cmp must be a comparison function that induces a strict weak ordering. - //! - //! Effects: Constructs an empty avl_multiset and inserts elements from + //! + //! Effects: Constructs an empty avl_multiset and inserts elements from //! [b, e). - //! + //! //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is the distance between first and last - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) - //! or the copy constructor/operator() of the value_compare object throws. + //! or the copy constructor/operator() of the value_compare object throws. template avl_multiset_impl( Iterator b, Iterator e , const value_compare &cmp = value_compare() @@ -1321,135 +1406,135 @@ class avl_multiset_impl {} //! Effects: to-do - //! - avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x) + //! + avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x) : tree_(::boost::move(x.tree_)) {} //! Effects: to-do - //! - avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x) + //! + avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x) { tree_ = ::boost::move(x.tree_); return *this; } - //! Effects: Detaches all elements from this. The objects in the avl_multiset + //! Effects: Detaches all elements from this. The objects in the avl_multiset //! are not deleted (i.e. no destructors are called). - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - ~avl_multiset_impl() + ~avl_multiset_impl() {} //! Effects: Returns an iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return tree_.begin(); } //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return tree_.cbegin(); } //! Effects: Returns an iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return tree_.end(); } //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return tree_.cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return tree_.rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return tree_.crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return tree_.rend(); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return tree_.crend(); } //! Precondition: end_iterator must be a valid end iterator //! of avl_multiset. - //! + //! //! Effects: Returns a const reference to the avl_multiset associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avl_multiset_impl &container_from_end_iterator(iterator end_iterator) { @@ -1460,11 +1545,11 @@ class avl_multiset_impl //! Precondition: end_iterator must be a valid end const_iterator //! of avl_multiset. - //! + //! //! Effects: Returns a const reference to the avl_multiset associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator) { @@ -1474,11 +1559,11 @@ class avl_multiset_impl } //! Precondition: it must be a valid iterator of multiset. - //! + //! //! Effects: Returns a const reference to the multiset associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avl_multiset_impl &container_from_iterator(iterator it) { @@ -1488,11 +1573,11 @@ class avl_multiset_impl } //! Precondition: it must be a valid const_iterator of multiset. - //! + //! //! Effects: Returns a const reference to the multiset associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avl_multiset_impl &container_from_iterator(const_iterator it) { @@ -1502,42 +1587,42 @@ class avl_multiset_impl } //! Effects: Returns the key_compare object used by the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If key_compare copy-constructor throws. key_compare key_comp() const { return tree_.value_comp(); } //! Effects: Returns the value_compare object used by the avl_multiset. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return tree_.value_comp(); } //! Effects: Returns true is the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return tree_.empty(); } //! Effects: Returns the number of elements stored in the avl_multiset. - //! + //! //! Complexity: Linear to elements contained in *this if, //! constant-time size option is enabled. Constant-time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { return tree_.size(); } //! Effects: Swaps the contents of two avl_multisets. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the swap() call for the comparison functor //! found using ADL throws. Strong guarantee. void swap(avl_multiset_impl& other) @@ -1547,69 +1632,69 @@ class avl_multiset_impl //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer) { tree_.clone_from(src.tree_, cloner, disposer); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the avl_multiset. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(reference value) { return tree_.insert_equal(value); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts x into the avl_multiset, using pos as a hint to //! where it will be inserted. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert(const_iterator hint, reference value) { return tree_.insert_equal(hint, value); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a range into the avl_multiset. - //! + //! //! Returns: An iterator that points to the position where the new //! element was inserted. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template @@ -1622,11 +1707,11 @@ class avl_multiset_impl //! inserted key according to the predicate. //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" or "value" is not unique tree ordering and uniqueness //! invariants will be broken respectively. @@ -1639,11 +1724,11 @@ class avl_multiset_impl //! any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than or equal to the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -1656,11 +1741,11 @@ class avl_multiset_impl //! than any inserted key according to the predicate. //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than or equal to the the mimum inserted key tree ordering or uniqueness //! invariants will be broken. @@ -1670,41 +1755,41 @@ class avl_multiset_impl void push_front(reference value) { tree_.push_front(value); } - //! Effects: Erases the element pointed to by pos. - //! + //! Effects: Erases the element pointed to by pos. + //! //! Complexity: Average complexity is constant time. - //! + //! //! Returns: An iterator to the element after the erased element. //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) { return tree_.erase(i); } - //! Effects: Erases the range pointed to by b end e. + //! Effects: Erases the range pointed to by b end e. //! //! Returns: An iterator to the element after the erased elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { return tree_.erase(b, e); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -1712,13 +1797,13 @@ class avl_multiset_impl //! Effects: Erases all the elements that compare equal with //! the given key and the given comparison functor. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1733,14 +1818,14 @@ class avl_multiset_impl //! //! Returns: An iterator to the element after the erased element. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -1758,12 +1843,12 @@ class avl_multiset_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -1774,13 +1859,13 @@ class avl_multiset_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(value)). - //! + //! //! Throws: If the internal value_compare ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1794,11 +1879,11 @@ class avl_multiset_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + this->count(key, comp)). - //! + //! //! Throws: If comp ordering function throws. Basic guarantee. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -1810,26 +1895,26 @@ class avl_multiset_impl { return tree_.erase_and_dispose(key, comp, disposer); } //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() { return tree_.clear(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. - //! + //! //! Effects: Erases all the elements of the container. - //! + //! //! Complexity: Linear to the number of elements on the container. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -1837,20 +1922,20 @@ class avl_multiset_impl { return tree_.clear_and_dispose(disposer); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If the internal value_compare ordering function throws. size_type count(const_reference value) const { return tree_.count(value); } //! Effects: Returns the number of contained elements with the same key //! compared with the given comparison functor. - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: If comp ordering function throws. template size_type count(const KeyType& key, KeyValueCompare comp) const @@ -1858,9 +1943,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator lower_bound(const_reference value) { return tree_.lower_bound(value); } @@ -1870,13 +1955,13 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -1886,9 +1971,9 @@ class avl_multiset_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator lower_bound(const_reference value) const { return tree_.lower_bound(value); } @@ -1898,13 +1983,13 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is not less than k or + //! key according to the comparison functor is not less than k or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. - //! + //! //! Note: This function is used when constructing a value_type //! is expensive and the value_type can be compared with a cheaper //! key type. Usually this key is part of the value_type. @@ -1914,9 +1999,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator upper_bound(const_reference value) { return tree_.upper_bound(value); } @@ -1926,11 +2011,11 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns an iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1942,9 +2027,9 @@ class avl_multiset_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator upper_bound(const_reference value) const { return tree_.upper_bound(value); } @@ -1954,11 +2039,11 @@ class avl_multiset_impl //! that is used in the ordering functor. //! //! Effects: Returns a const_iterator to the first element whose - //! key according to the comparison functor is greater than key or + //! key according to the comparison functor is greater than key or //! end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1968,11 +2053,11 @@ class avl_multiset_impl const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const { return tree_.upper_bound(key, comp); } - //! Effects: Finds an iterator to the first element whose value is + //! Effects: Finds an iterator to the first element whose value is //! "value" or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. iterator find(const_reference value) { return tree_.find(value); } @@ -1981,12 +2066,12 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds an iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -1996,11 +2081,11 @@ class avl_multiset_impl iterator find(const KeyType& key, KeyValueCompare comp) { return tree_.find(key, comp); } - //! Effects: Finds a const_iterator to the first element whose value is + //! Effects: Finds a const_iterator to the first element whose value is //! "value" or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. const_iterator find(const_reference value) const { return tree_.find(value); } @@ -2009,12 +2094,12 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a const_iterator to the first element whose key is - //! "key" according to the comparison functor or end() if that element + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element //! does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2027,9 +2112,9 @@ class avl_multiset_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) { return tree_.equal_range(value); } @@ -2038,13 +2123,13 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2057,9 +2142,9 @@ class avl_multiset_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. std::pair equal_range(const_reference value) const @@ -2069,13 +2154,13 @@ class avl_multiset_impl //! value_compare. Usually key is the part of the value_type //! that is used in the ordering functor. //! - //! Effects: Finds a range containing all elements whose key is k - //! according to the comparison functor or an empty range + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range //! that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: If comp ordering function throws. //! //! Note: This function is used when constructing a value_type @@ -2086,16 +2171,101 @@ class avl_multiset_impl equal_range(const KeyType& key, KeyValueCompare comp) const { return tree_.equal_range(key, comp); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair + bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_value, upper_value, left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair + bounded_range + (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { return tree_.bounded_range(lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_multiset //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -2103,14 +2273,14 @@ class avl_multiset_impl //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_multiset that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static const_iterator s_iterator_to(const_reference value) @@ -2118,48 +2288,48 @@ class avl_multiset_impl //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the avl_multiset //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return tree_.iterator_to(value); } //! Requires: value must be an lvalue and shall be in a avl_multiset of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! avl_multiset that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return tree_.iterator_to(value); } //! Requires: value shall not be in a avl_multiset/avl_multiset. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) { tree_type::init_node(value); } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -2169,14 +2339,14 @@ class avl_multiset_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -2290,7 +2460,7 @@ template template #endif class avl_multiset - : public make_avl_multiset diff --git a/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp b/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp index 23b1f0bd8..825921f50 100644 --- a/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/avl_set_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -61,16 +61,16 @@ struct make_avl_set_base_hook typedef implementation_defined type; }; -//! Derive a class from avl_set_base_hook in order to store objects in -//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain +//! Derive a class from avl_set_base_hook in order to store objects in +//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain //! the avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<>, //! \c link_mode<> and \c optimize_size<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its //! unique tag. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -99,27 +99,27 @@ class avl_set_base_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. avl_set_base_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_base_hook(const avl_set_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_base_hook& operator=(const avl_set_base_hook& ); @@ -128,37 +128,37 @@ class avl_set_base_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~avl_set_base_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(avl_set_base_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; @@ -195,7 +195,7 @@ struct make_avl_set_member_hook //! Put a public data member avl_set_member_hook in order to store objects of this class in //! an avl_set/avl_multiset. avl_set_member_hook holds the data necessary for maintaining the //! avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. -//! +//! //! The hook admits the following options: \c void_pointer<>, //! \c link_mode<> and \c optimize_size<>. //! @@ -225,27 +225,27 @@ class avl_set_member_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. avl_set_member_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_member_hook(const avl_set_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. avl_set_member_hook& operator=(const avl_set_member_hook& ); @@ -254,43 +254,43 @@ class avl_set_member_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~avl_set_member_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(avl_set_member_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avltree.hpp b/project/jni/boost/include/boost/intrusive/avltree.hpp index 20903ddef..b6311c403 100644 --- a/project/jni/boost/include/boost/intrusive/avltree.hpp +++ b/project/jni/boost/include/boost/intrusive/avltree.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -65,7 +65,7 @@ struct avl_set_defaults //! The class template avltree is an intrusive AVL tree container, that //! is used to construct intrusive avl_set and avl_multiset containers. -//! The no-throw guarantee holds only, if the value_compare object +//! The no-throw guarantee holds only, if the value_compare object //! doesn't throw. //! //! The template parameter \c T is the type to be managed by the container. @@ -89,7 +89,7 @@ class avltree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits @@ -134,7 +134,7 @@ class avltree_impl //noncopyable, movable BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl) - enum { safemode_or_autounlink = + enum { safemode_or_autounlink = (int)real_value_traits::link_mode == (int)auto_unlink || (int)real_value_traits::link_mode == (int)safe_link }; @@ -160,7 +160,7 @@ class avltree_impl {} node_plus_pred_t node_plus_pred_; } data_; - + const value_compare &priv_comp() const { return data_.node_plus_pred_.get(); } @@ -212,18 +212,18 @@ class avltree_impl typedef typename node_algorithms::insert_commit_data insert_commit_data; - //! Effects: Constructs an empty tree. - //! - //! Complexity: Constant. - //! + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) //! or the copy constructor of the value_compare object throws. Basic guarantee. - avltree_impl( const value_compare &cmp = value_compare() - , const value_traits &v_traits = value_traits()) + explicit avltree_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) : data_(cmp, v_traits) - { - node_algorithms::init_header(this->priv_header_ptr()); + { + node_algorithms::init_header(this->priv_header_ptr()); this->priv_size_traits().set_size(size_type(0)); } @@ -235,7 +235,7 @@ class avltree_impl //! //! Complexity: Linear in N if [b, e) is already sorted using //! comp and otherwise N * log N, where N is the distance between first and last. - //! + //! //! Throws: If value_traits::node_traits::node //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) //! or the copy constructor/operator() of the value_compare object throws. Basic guarantee. @@ -254,58 +254,58 @@ class avltree_impl } //! Effects: to-do - //! + //! avltree_impl(BOOST_RV_REF(avltree_impl) x) : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits())) { - node_algorithms::init_header(this->priv_header_ptr()); + node_algorithms::init_header(this->priv_header_ptr()); this->priv_size_traits().set_size(size_type(0)); this->swap(x); } //! Effects: to-do - //! - avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) + //! + avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) { this->swap(x); return *this; } - //! Effects: Detaches all elements from this. The objects in the set - //! are not deleted (i.e. no destructors are called), but the nodes according to - //! the value_traits template parameter are reinitialized and thus can be reused. - //! + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! //! Complexity: Linear to elements contained in *this. - //! + //! //! Throws: Nothing. - ~avltree_impl() + ~avltree_impl() {} //! Effects: Returns an iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator begin() { return iterator (node_traits::get_left(this->priv_header_ptr()), this); } //! Effects: Returns a const_iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator begin() const { return cbegin(); } //! Effects: Returns a const_iterator pointing to the beginning of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cbegin() const { return const_iterator (node_traits::get_left(this->priv_header_ptr()), this); } //! Effects: Returns an iterator pointing to the end of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator end() { return iterator (this->priv_header_ptr(), this); } @@ -313,138 +313,138 @@ class avltree_impl //! Effects: Returns a const_iterator pointing to the end of the tree. //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator end() const { return cend(); } //! Effects: Returns a const_iterator pointing to the end of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator cend() const { return const_iterator (uncast(this->priv_header_ptr()), this); } //! Effects: Returns a reverse_iterator pointing to the beginning of the //! reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rbegin() { return reverse_iterator(end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. reverse_iterator rend() { return reverse_iterator(begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } //! Precondition: end_iterator must be a valid end iterator //! of avltree. - //! + //! //! Effects: Returns a const reference to the avltree associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static avltree_impl &container_from_end_iterator(iterator end_iterator) { return priv_container_from_end_iterator(end_iterator); } //! Precondition: end_iterator must be a valid end const_iterator //! of avltree. - //! + //! //! Effects: Returns a const reference to the avltree associated to the end iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant. static const avltree_impl &container_from_end_iterator(const_iterator end_iterator) { return priv_container_from_end_iterator(end_iterator); } //! Precondition: it must be a valid iterator //! of rbtree. - //! + //! //! Effects: Returns a const reference to the tree associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static avltree_impl &container_from_iterator(iterator it) { return priv_container_from_iterator(it); } //! Precondition: it must be a valid end const_iterator //! of rbtree. - //! + //! //! Effects: Returns a const reference to the tree associated to the iterator - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Logarithmic. static const avltree_impl &container_from_iterator(const_iterator it) { return priv_container_from_iterator(it); } //! Effects: Returns the value_compare object used by the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If value_compare copy-constructor throws. value_compare value_comp() const { return priv_comp(); } //! Effects: Returns true if the container is empty. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. bool empty() const { return node_algorithms::unique(this->priv_header_ptr()); } //! Effects: Returns the number of elements stored in the tree. - //! + //! //! Complexity: Linear to elements contained in *this //! if constant-time size option is disabled. Constant time otherwise. - //! + //! //! Throws: Nothing. size_type size() const { @@ -456,9 +456,9 @@ class avltree_impl } //! Effects: Swaps the contents of two avltrees. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: If the comparison functor's swap call throws. void swap(avltree_impl& other) { @@ -475,14 +475,14 @@ class avltree_impl } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the tree before the upper bound. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_equal(reference value) @@ -500,16 +500,16 @@ class avltree_impl //! Requires: value must be an lvalue, and "hint" must be //! a valid iterator. - //! + //! //! Effects: Inserts x into the tree, using "hint" as a hint to //! where it will be inserted. If "hint" is the upper_bound //! the insertion takes constant time (two comparisons in the worst case) - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if t is inserted immediately before hint. - //! + //! //! Throws: If the internal value_compare ordering function throws. Strong guarantee. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_equal(const_iterator hint, reference value) @@ -525,38 +525,38 @@ class avltree_impl return ret; } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Inserts a each element of a range into the tree //! before the upper bound of the key of each element. - //! + //! //! Complexity: Insert range is in general O(N * log(N)), where N is the //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template void insert_equal(Iterator b, Iterator e) { - iterator end(this->end()); + iterator iend(this->end()); for (; b != e; ++b) - this->insert_equal(end, *b); + this->insert_equal(iend, *b); } //! Requires: value must be an lvalue - //! + //! //! Effects: Inserts value into the tree if the value //! is not already present. - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. std::pair insert_unique(reference value) @@ -570,16 +570,16 @@ class avltree_impl //! Requires: value must be an lvalue, and "hint" must be //! a valid iterator - //! + //! //! Effects: Tries to insert x into the tree, using "hint" as a hint //! to where it will be inserted. - //! + //! //! Complexity: Logarithmic in general, but it is amortized //! constant time (two comparisons in the worst case) //! if t is inserted immediately before hint. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. iterator insert_unique(const_iterator hint, reference value) @@ -591,26 +591,26 @@ class avltree_impl return insert_unique_commit(value, commit_data); } - //! Requires: Dereferencing iterator must yield an lvalue + //! Requires: Dereferencing iterator must yield an lvalue //! of type value_type. - //! + //! //! Effects: Tries to insert each element of a range into the tree. - //! - //! Complexity: Insert range is in general O(N * log(N)), where N is the - //! size of the range. However, it is linear in N if the range is already sorted + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted //! by value_comp(). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Does not affect the validity of iterators and references. //! No copy-constructors are called. template void insert_unique(Iterator b, Iterator e) { if(this->empty()){ - iterator end(this->end()); + iterator iend(this->end()); for (; b != e; ++b) - this->insert_unique(end, *b); + this->insert_unique(iend, *b); } else{ for (; b != e; ++b) @@ -618,10 +618,10 @@ class avltree_impl } } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the container, using //! a user provided key instead of the value itself. //! @@ -630,16 +630,16 @@ class avltree_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! node that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that + //! than the value_type and this function offers the possibility to use that //! part to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use @@ -654,18 +654,18 @@ class avltree_impl { detail::key_nodeptr_comp comp(key_value_comp, this); - std::pair ret = + std::pair ret = (node_algorithms::insert_unique_check (this->priv_header_ptr(), key, comp, commit_data)); return std::pair(iterator(ret.first, this), ret.second); } - //! Requires: key_value_comp must be a comparison function that induces + //! Requires: key_value_comp must be a comparison function that induces //! the same strict weak ordering as value_compare. The difference is that //! key_value_comp compares an arbitrary key with the contained values. - //! + //! //! Effects: Checks if a value can be inserted in the container, using - //! a user provided key instead of the value itself, using "hint" + //! a user provided key instead of the value itself, using "hint" //! as a hint to where it will be inserted. //! //! Returns: If there is an equivalent value @@ -673,23 +673,23 @@ class avltree_impl //! and false. If the value can be inserted returns true in the returned //! pair boolean and fills "commit_data" that is meant to be used with //! the "insert_commit" function. - //! + //! //! Complexity: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. //! //! Throws: If the key_value_comp ordering function throws. Strong guarantee. - //! + //! //! Notes: This function is used to improve performance when constructing //! a value_type is expensive: if there is an equivalent value //! the constructed object must be discarded. Many times, the part of the //! constructing that is used to impose the order is much cheaper to construct - //! than the value_type and this function offers the possibility to use that key + //! than the value_type and this function offers the possibility to use that key //! to check if the insertion will be successful. //! //! If the check is successful, the user can construct the value_type and use //! "insert_commit" to insert the object in constant-time. This can give a total //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). - //! + //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. template @@ -699,7 +699,7 @@ class avltree_impl { detail::key_nodeptr_comp comp(key_value_comp, this); - std::pair ret = + std::pair ret = (node_algorithms::insert_unique_check (this->priv_header_ptr(), hint.pointed_node(), key, comp, commit_data)); return std::pair(iterator(ret.first, this), ret.second); @@ -709,16 +709,16 @@ class avltree_impl //! must have been obtained from a previous call to "insert_check". //! No objects should have been inserted or erased from the container between //! the "insert_check" that filled "commit_data" and the call to "insert_commit". - //! + //! //! Effects: Inserts the value in the avl_set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Returns: An iterator to the newly inserted object. - //! + //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. @@ -738,11 +738,11 @@ class avltree_impl //! once inserted according to the predicate //! //! Effects: Inserts x into the tree before "pos". - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if "pos" is not //! the successor of "value" tree ordering invariant will be broken. //! This is a low-level function to be used only for performance reasons @@ -762,11 +762,11 @@ class avltree_impl //! than the greatest inserted key //! //! Effects: Inserts x into the tree in the last position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! less than the greatest inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -785,11 +785,11 @@ class avltree_impl //! than the minimum inserted key //! //! Effects: Inserts x into the tree in the first position. - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This function does not check preconditions so if value is //! greater than the minimum inserted key tree ordering invariant will be broken. //! This function is slightly more efficient than using "insert_before". @@ -804,12 +804,12 @@ class avltree_impl this->priv_size_traits().increment(); } - //! Effects: Erases the element pointed to by pos. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator i) @@ -826,26 +826,26 @@ class avltree_impl return ret.unconst(); } - //! Effects: Erases the range pointed to by b end e. - //! - //! Complexity: Average complexity for erase range is at most + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. iterator erase(const_iterator b, const_iterator e) { size_type n; return private_erase(b, e, n); } //! Effects: Erases all the elements with the given value. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. size_type erase(const_reference value) @@ -855,11 +855,11 @@ class avltree_impl //! according to the comparison functor "comp". //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -877,14 +877,14 @@ class avltree_impl //! Requires: Disposer::operator()(pointer) shouldn't throw. //! - //! Effects: Erases the element pointed to by pos. + //! Effects: Erases the element pointed to by pos. //! Disposer::operator()(pointer) is called for the removed element. - //! - //! Complexity: Average complexity for erase element is constant time. - //! + //! + //! Complexity: Average complexity for erase element is constant time. + //! //! Throws: Nothing. - //! - //! Note: Invalidates the iterators + //! + //! Note: Invalidates the iterators //! to the erased elements. template iterator erase_and_dispose(const_iterator i, Disposer disposer) @@ -905,12 +905,12 @@ class avltree_impl //! //! Effects: Erases the range pointed to by b end e. //! Disposer::operator()(pointer) is called for the removed elements. - //! - //! Complexity: Average complexity for erase range is at most + //! + //! Complexity: Average complexity for erase range is at most //! O(log(size() + N)), where N is the number of elements in the range. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -921,13 +921,13 @@ class avltree_impl //! //! Effects: Erases all the elements with the given value. //! Disposer::operator()(pointer) is called for the removed elements. - //! + //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. template @@ -946,11 +946,11 @@ class avltree_impl //! Disposer::operator()(pointer) is called for the removed elements. //! //! Returns: The number of erased elements. - //! + //! //! Complexity: O(log(size() + N). - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators //! to the erased elements. template @@ -966,13 +966,13 @@ class avltree_impl return n; } - //! Effects: Erases all of the elements. - //! + //! Effects: Erases all of the elements. + //! //! Complexity: Linear to the number of elements on the container. //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. void clear() @@ -990,9 +990,9 @@ class avltree_impl //! each node to be erased. //! Complexity: Average complexity for is at most O(log(size() + N)), //! where N is the number of elements in the container. - //! + //! //! Throws: Nothing. - //! + //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. Calls N times to disposer functor. template @@ -1005,19 +1005,19 @@ class avltree_impl } //! Effects: Returns the number of contained elements with the given value - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given value. - //! + //! //! Throws: Nothing. size_type count(const_reference value) const { return this->count(value, priv_comp()); } //! Effects: Returns the number of contained elements with the given key - //! + //! //! Complexity: Logarithmic to the number of elements contained plus lineal //! to number of objects with the given key. - //! + //! //! Throws: Nothing. template size_type count(const KeyType &key, KeyValueCompare comp) const @@ -1028,27 +1028,27 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator lower_bound(const_reference value) { return this->lower_bound(value, priv_comp()); } //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator lower_bound(const_reference value) const { return this->lower_bound(value, priv_comp()); } //! Effects: Returns an iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator lower_bound(const KeyType &key, KeyValueCompare comp) @@ -1061,9 +1061,9 @@ class avltree_impl //! Effects: Returns a const iterator to the first element whose //! key is not less than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const @@ -1076,9 +1076,9 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator upper_bound(const_reference value) { return this->upper_bound(value, priv_comp()); } @@ -1088,7 +1088,7 @@ class avltree_impl //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator upper_bound(const KeyType &key, KeyValueCompare comp) @@ -1101,9 +1101,9 @@ class avltree_impl //! Effects: Returns an iterator to the first element whose //! key is greater than k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator upper_bound(const_reference value) const { return this->upper_bound(value, priv_comp()); } @@ -1113,7 +1113,7 @@ class avltree_impl //! does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const @@ -1124,20 +1124,20 @@ class avltree_impl (this->priv_header_ptr(), key, key_node_comp), this); } - //! Effects: Finds an iterator to the first element whose key is + //! Effects: Finds an iterator to the first element whose key is //! k or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. iterator find(const_reference value) { return this->find(value, priv_comp()); } - //! Effects: Finds an iterator to the first element whose key is + //! Effects: Finds an iterator to the first element whose key is //! k or end() if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template iterator find(const KeyType &key, KeyValueCompare comp) @@ -1148,20 +1148,20 @@ class avltree_impl (node_algorithms::find(this->priv_header_ptr(), key, key_node_comp), this); } - //! Effects: Finds a const_iterator to the first element whose key is + //! Effects: Finds a const_iterator to the first element whose key is //! k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. const_iterator find(const_reference value) const { return this->find(value, priv_comp()); } - //! Effects: Finds a const_iterator to the first element whose key is + //! Effects: Finds a const_iterator to the first element whose key is //! k or end() if that element does not exist. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template const_iterator find(const KeyType &key, KeyValueCompare comp) const @@ -1175,9 +1175,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. std::pair equal_range(const_reference value) { return this->equal_range(value, priv_comp()); } @@ -1185,9 +1185,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template std::pair equal_range(const KeyType &key, KeyValueCompare comp) @@ -1202,9 +1202,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. std::pair equal_range(const_reference value) const @@ -1213,9 +1213,9 @@ class avltree_impl //! Effects: Finds a range containing all elements whose key is k or //! an empty range that indicates the position where those elements would be //! if they there is no elements with key k. - //! + //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. template std::pair @@ -1228,19 +1228,117 @@ class avltree_impl return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); } + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) + { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::bounded_range + (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Requires: 'lower_value' must not be greater than 'upper_value'. If + //! 'lower_value' == 'upper_value', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the predicate throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_value and upper_value. + std::pair bounded_range + (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const + { return this->bounded_range(lower_value, upper_value, priv_comp(), left_closed, right_closed); } + + //! Requires: KeyValueCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise + //! + //! second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + std::pair bounded_range + (const KeyType &lower_key, const KeyType &upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::bounded_range + (this->priv_header_ptr(), lower_key, upper_key, key_node_comp, left_closed, right_closed)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + //! Requires: Disposer::operator()(pointer) shouldn't throw. //! Cloner should yield to nodes equivalent to the original nodes. //! //! Effects: Erases all the elements from *this - //! calling Disposer::operator()(pointer), clones all the + //! calling Disposer::operator()(pointer), clones all the //! elements from src calling Cloner::operator()(const_reference ) //! and inserts them on *this. Copies the predicate from the source container. //! //! If cloner throws, all cloned elements are unlinked and disposed //! calling Disposer::operator()(pointer). - //! + //! //! Complexity: Linear to erased plus inserted elements. - //! + //! //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. template void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer) @@ -1261,11 +1359,11 @@ class avltree_impl } //! Effects: Unlinks the leftmost node from the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -1284,14 +1382,14 @@ class avltree_impl //! Requires: replace_this must be a valid iterator of *this //! and with_this must not be inserted in any tree. - //! + //! //! Effects: Replaces replace_this in its position in the //! tree with with_this. The tree does not need to be rebalanced. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! with_this is not equivalent to *replace_this according to the //! ordering rules. This function is faster than erasing and inserting @@ -1307,14 +1405,14 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. static iterator s_iterator_to(reference value) @@ -1325,17 +1423,17 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. - //! + //! //! Note: This static function is available only if the value traits //! is stateless. - static const_iterator s_iterator_to(const_reference value) + static const_iterator s_iterator_to(const_reference value) { BOOST_STATIC_ASSERT((!stateful_value_traits)); return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); @@ -1343,37 +1441,37 @@ class avltree_impl //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid iterator i belonging to the set //! that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. iterator iterator_to(reference value) { return iterator (value_traits::to_node_ptr(value), this); } //! Requires: value must be an lvalue and shall be in a set of //! appropriate type. Otherwise the behavior is undefined. - //! + //! //! Effects: Returns: a valid const_iterator i belonging to the //! set that points to the value - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. const_iterator iterator_to(const_reference value) const { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } //! Requires: value shall not be in a tree. - //! + //! //! Effects: init_node puts the hook of a value in a well-known default //! state. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This function puts the hook in the well-known default state //! used by auto_unlink and safe hooks. static void init_node(reference value) @@ -1381,12 +1479,12 @@ class avltree_impl /* //! Effects: removes x from a tree of the appropriate type. It has no effect, - //! if x is not in such a tree. - //! + //! if x is not in such a tree. + //! //! Throws: Nothing. - //! + //! //! Complexity: Constant time. - //! + //! //! Note: This static function is only usable with the "safe mode" //! hook and non-constant time size lists. Otherwise, the user must use //! the non-static "erase(reference )" member. If the user calls @@ -1396,7 +1494,7 @@ class avltree_impl static void remove_node(T& value) { //This function is only usable for safe mode hooks and non-constant - //time lists. + //time lists. //BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size))); BOOST_STATIC_ASSERT((!constant_time_size)); BOOST_STATIC_ASSERT((boost::is_convertible::value)); @@ -1680,8 +1778,8 @@ class avltree #endif -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp b/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp index 9b917c767..11463c71f 100644 --- a/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/avltree_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Daniel K. O. 2005. -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -45,25 +45,25 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_parent(const_node_ptr n); -//! +//! //! static void set_parent(node_ptr n, node_ptr parent); //! //! static node_ptr get_left(const_node_ptr n); -//! +//! //! static void set_left(node_ptr n, node_ptr left); //! //! static node_ptr get_right(const_node_ptr n); -//! +//! //! static void set_right(node_ptr n, node_ptr right); -//! +//! //! static balance get_balance(const_node_ptr n); -//! +//! //! static void set_balance(node_ptr n, balance b); -//! +//! //! static balance negative(); -//! +//! //! static balance zero(); -//! +//! //! static balance positive(); template class avltree_algorithms @@ -88,7 +88,7 @@ class avltree_algorithms avltree_node_cloner(F f) : base_t(f) {} - + node_ptr operator()(const node_ptr &p) { node_ptr n = base_t::get()(p); @@ -120,27 +120,27 @@ class avltree_algorithms //! Requires: header1 and header2 must be the header nodes //! of two trees. - //! - //! Effects: Swaps two trees. After the function header1 will contain + //! + //! Effects: Swaps two trees. After the function header1 will contain //! links to the second tree and header2 will have links to the first tree. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. static void swap_tree(const node_ptr & header1, const node_ptr & header2) { return tree_algorithms::swap_tree(header1, header2); } //! Requires: node1 and node2 can't be header nodes //! of two trees. - //! + //! //! Effects: Swaps two nodes. After the function node1 will be inserted //! in the position node2 before the function. node2 will be inserted in the //! position node1 had before the function. - //! - //! Complexity: Logarithmic. - //! + //! + //! Complexity: Logarithmic. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! node1 and node2 are not equivalent according to the ordering rules. //! @@ -149,22 +149,22 @@ class avltree_algorithms { if(node1 == node2) return; - + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); swap_nodes(node1, header1, node2, header2); } //! Requires: node1 and node2 can't be header nodes //! of two trees with header header1 and header2. - //! + //! //! Effects: Swaps two nodes. After the function node1 will be inserted //! in the position node2 before the function. node2 will be inserted in the //! position node1 had before the function. - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! node1 and node2 are not equivalent according to the ordering rules. //! @@ -176,20 +176,20 @@ class avltree_algorithms tree_algorithms::swap_nodes(node1, header1, node2, header2); //Swap balance balance c = NodeTraits::get_balance(node1); - NodeTraits::set_balance(node1, NodeTraits::get_balance(node2)); - NodeTraits::set_balance(node2, c); + NodeTraits::set_balance(node1, NodeTraits::get_balance(node2)); + NodeTraits::set_balance(node2, c); } //! Requires: node_to_be_replaced must be inserted in a tree //! and new_node must not be inserted in a tree. - //! + //! //! Effects: Replaces node_to_be_replaced in its position in the //! tree with new_node. The tree does not need to be rebalanced - //! - //! Complexity: Logarithmic. - //! + //! + //! Complexity: Logarithmic. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting @@ -205,14 +205,14 @@ class avltree_algorithms //! Requires: node_to_be_replaced must be inserted in a tree //! with header "header" and new_node must not be inserted in a tree. - //! + //! //! Effects: Replaces node_to_be_replaced in its position in the //! tree with new_node. The tree does not need to be rebalanced - //! - //! Complexity: Constant. - //! + //! + //! Complexity: Constant. + //! //! Throws: Nothing. - //! + //! //! Note: This function will break container ordering invariants if //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting @@ -222,15 +222,15 @@ class avltree_algorithms static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node) { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); - NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); + NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); } //! Requires: node is a tree node but not the header. - //! + //! //! Effects: Unlinks the node and rebalances the tree. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. static void unlink(const node_ptr & node) { @@ -243,14 +243,14 @@ class avltree_algorithms } //! Requires: header is the header of a tree. - //! + //! //! Effects: Unlinks the leftmost node from the tree, and //! updates the header link to the new leftmost node. - //! + //! //! Complexity: Average complexity is constant time. - //! + //! //! Throws: Nothing. - //! + //! //! Notes: This function breaks the tree and the tree can //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step @@ -260,51 +260,51 @@ class avltree_algorithms //! Requires: node is a node of the tree or an node initialized //! by init(...). - //! + //! //! Effects: Returns true if the node is initialized by init(). - //! + //! //! Complexity: Constant time. - //! + //! //! Throws: Nothing. static bool unique(const const_node_ptr & node) { return tree_algorithms::unique(node); } //! Requires: node is a node of the tree but it's not the header. - //! + //! //! Effects: Returns the number of nodes of the subtree. - //! + //! //! Complexity: Linear time. - //! + //! //! Throws: Nothing. static std::size_t count(const const_node_ptr & node) { return tree_algorithms::count(node); } //! Requires: header is the header node of the tree. - //! + //! //! Effects: Returns the number of nodes above the header. - //! + //! //! Complexity: Linear time. - //! + //! //! Throws: Nothing. static std::size_t size(const const_node_ptr & header) { return tree_algorithms::size(header); } //! Requires: p is a node from the tree except the header. - //! + //! //! Effects: Returns the next node of the tree. - //! + //! //! Complexity: Average constant time. - //! + //! //! Throws: Nothing. static node_ptr next_node(const node_ptr & p) { return tree_algorithms::next_node(p); } //! Requires: p is a node from the tree except the leftmost node. - //! + //! //! Effects: Returns the previous node of the tree. - //! + //! //! Complexity: Average constant time. - //! + //! //! Throws: Nothing. static node_ptr prev_node(const node_ptr & p) { return tree_algorithms::prev_node(p); } @@ -312,9 +312,9 @@ class avltree_algorithms //! Requires: node must not be part of any tree. //! //! Effects: After the function unique(node) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. @@ -325,25 +325,25 @@ class avltree_algorithms //! //! Effects: Initializes the header to represent an empty tree. //! unique(header) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. static void init_header(const node_ptr & header) { tree_algorithms::init_header(header); - NodeTraits::set_balance(header, NodeTraits::zero()); + NodeTraits::set_balance(header, NodeTraits::zero()); } //! Requires: header must be the header of a tree, z a node //! of that tree and z != header. //! //! Effects: Erases node "z" from the tree with header "header". - //! + //! //! Complexity: Amortized constant time. - //! + //! //! Throws: Nothing. static node_ptr erase(const node_ptr & header, const node_ptr & z) { @@ -361,18 +361,18 @@ class avltree_algorithms //! object taking a node_ptr and returning a new cloned node of it. "disposer" must //! take a node_ptr and shouldn't throw. //! - //! Effects: First empties target tree calling + //! Effects: First empties target tree calling //! void disposer::operator()(const node_ptr &) for every node of the tree //! except the header. - //! + //! //! Then, duplicates the entire tree pointed by "source_header" cloning each - //! source node with node_ptr Cloner::operator()(const node_ptr &) to obtain + //! source node with node_ptr Cloner::operator()(const node_ptr &) to obtain //! the nodes of the target tree. If "cloner" throws, the cloned target nodes //! are disposed using void disposer(const node_ptr &). - //! + //! //! Complexity: Linear to the number of element of the source tree plus the. //! number of elements of tree target tree when calling this function. - //! + //! //! Throws: If cloner functor throws. If this happens target nodes are disposed. template static void clone @@ -385,13 +385,13 @@ class avltree_algorithms //! Requires: "disposer" must be an object function //! taking a node_ptr parameter and shouldn't throw. //! - //! Effects: Empties the target tree calling + //! Effects: Empties the target tree calling //! void disposer::operator()(const node_ptr &) for every node of the tree //! except the header. - //! + //! //! Complexity: Linear to the number of element of the source tree plus the. //! number of elements of tree target tree when calling this function. - //! + //! //! Throws: If cloner functor throws. If this happens target nodes are disposed. template static void clear_and_dispose(const node_ptr & header, Disposer disposer) @@ -407,7 +407,7 @@ class avltree_algorithms //! not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr lower_bound @@ -423,7 +423,7 @@ class avltree_algorithms //! than "key" according to "comp" or "header" if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr upper_bound @@ -439,7 +439,7 @@ class avltree_algorithms //! "key" according to "comp" or "header" if that element does not exist. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr find @@ -457,13 +457,38 @@ class avltree_algorithms //! if they there are no equivalent elements. //! //! Complexity: Logarithmic. - //! + //! //! Throws: If "comp" throws. template static std::pair equal_range (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) { return tree_algorithms::equal_range(header, key, comp); } + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! 'lower_key' must not be greater than 'upper_key' according to 'comp'. If + //! 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be false. + //! + //! Effects: Returns an a pair with the following criteria: + //! + //! first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise + //! + //! second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Note: This function can be more efficient than calling upper_bound + //! and lower_bound for lower_key and upper_key. + template + static std::pair bounded_range + (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + , bool left_closed, bool right_closed) + { return tree_algorithms::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); } + //! Requires: "h" must be the header node of a tree. //! NodePtrCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the @@ -471,10 +496,10 @@ class avltree_algorithms //! //! Effects: Inserts new_node into the tree before the upper bound //! according to "comp". - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal_upper_bound @@ -492,10 +517,10 @@ class avltree_algorithms //! //! Effects: Inserts new_node into the tree before the lower bound //! according to "comp". - //! + //! //! Complexity: Average complexity for insert element is at //! most logarithmic. - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal_lower_bound @@ -511,14 +536,14 @@ class avltree_algorithms //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from //! the "header"'s tree. - //! + //! //! Effects: Inserts new_node into the tree, using "hint" as a hint to //! where it will be inserted. If "hint" is the upper_bound //! the insertion takes constant time (two comparisons in the worst case). //! //! Complexity: Logarithmic in general, but it is amortized //! constant time if new_node is inserted immediately before "hint". - //! + //! //! Throws: If "comp" throws. template static node_ptr insert_equal @@ -534,13 +559,13 @@ class avltree_algorithms //! "pos" must be an iterator pointing to the successor to "new_node" //! once inserted according to the order of already inserted nodes. This function does not //! check "pos" and this precondition must be guaranteed by the caller. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "pos" is not the successor of the newly inserted "new_node" //! tree invariants might be broken. static node_ptr insert_before @@ -554,13 +579,13 @@ class avltree_algorithms //! Requires: "header" must be the header node of a tree. //! "new_node" must be, according to the used ordering no less than the //! greatest inserted key. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "new_node" is less than the greatest inserted key //! tree invariants are broken. This function is slightly faster than //! using "insert_before". @@ -573,13 +598,13 @@ class avltree_algorithms //! Requires: "header" must be the header node of a tree. //! "new_node" must be, according to the used ordering, no greater than the //! lowest inserted key. - //! + //! //! Effects: Inserts new_node into the tree before "pos". //! //! Complexity: Constant-time. - //! + //! //! Throws: Nothing. - //! + //! //! Note: If "new_node" is greater than the lowest inserted key //! tree invariants are broken. This function is slightly faster than //! using "insert_before". @@ -593,7 +618,7 @@ class avltree_algorithms //! KeyNodePtrCompare is a function object that induces a strict weak //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares KeyType with a node_ptr. - //! + //! //! Effects: Checks if there is an equivalent node to "key" in the //! tree according to "comp" and obtains the needed information to realize //! a constant-time node insertion if there is no equivalent node. @@ -604,11 +629,11 @@ class avltree_algorithms //! in the returned pair's boolean and fills "commit_data" that is meant to //! be used with the "insert_commit" function to achieve a constant-time //! insertion function. - //! + //! //! Complexity: Average complexity is at most logarithmic. //! //! Throws: If "comp" throws. - //! + //! //! Notes: This function is used to improve performance when constructing //! a node is expensive and the user does not want to have two equivalent nodes //! in the tree: if there is an equivalent value @@ -634,12 +659,12 @@ class avltree_algorithms //! ordering compatible with the strict weak ordering used to create the //! the tree. NodePtrCompare compares KeyType with a node_ptr. //! "hint" is node from the "header"'s tree. - //! + //! //! Effects: Checks if there is an equivalent node to "key" in the //! tree according to "comp" using "hint" as a hint to where it should be //! inserted and obtains the needed information to realize - //! a constant-time node insertion if there is no equivalent node. - //! If "hint" is the upper_bound the function has constant time + //! a constant-time node insertion if there is no equivalent node. + //! If "hint" is the upper_bound the function has constant time //! complexity (two comparisons in the worst case). //! //! Returns: If there is an equivalent value @@ -648,12 +673,12 @@ class avltree_algorithms //! in the returned pair's boolean and fills "commit_data" that is meant to //! be used with the "insert_commit" function to achieve a constant-time //! insertion function. - //! + //! //! Complexity: Average complexity is at most logarithmic, but it is //! amortized constant time if new_node should be inserted immediately before "hint". //! //! Throws: If "comp" throws. - //! + //! //! Notes: This function is used to improve performance when constructing //! a node is expensive and the user does not want to have two equivalent nodes //! in the tree: if there is an equivalent value @@ -678,16 +703,16 @@ class avltree_algorithms //! "commit_data" must have been obtained from a previous call to //! "insert_unique_check". No objects should have been inserted or erased //! from the set between the "insert_unique_check" that filled "commit_data" - //! and the call to "insert_commit". - //! - //! + //! and the call to "insert_commit". + //! + //! //! Effects: Inserts new_node in the set using the information obtained //! from the "commit_data" that a previous "insert_check" filled. //! //! Complexity: Constant time. //! //! Throws: Nothing. - //! + //! //! Notes: This function has only sense if a "insert_unique_check" has been //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. @@ -703,7 +728,7 @@ class avltree_algorithms //! Effects: Returns a pointer to the header node of the tree. //! //! Complexity: Logarithmic. - //! + //! //! Throws: Nothing. static node_ptr get_header(const node_ptr & n) { return tree_algorithms::get_header(n); } @@ -712,11 +737,11 @@ class avltree_algorithms private: //! Requires: p is a node of a tree. - //! + //! //! Effects: Returns true if p is the header of the tree. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. static bool is_header(const const_node_ptr & p) { return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); } @@ -727,7 +752,7 @@ class avltree_algorithms for (node_ptr root = NodeTraits::get_parent(header); x != root; root = NodeTraits::get_parent(header)) { const balance x_parent_balance = NodeTraits::get_balance(x_parent); if(x_parent_balance == NodeTraits::zero()){ - NodeTraits::set_balance(x_parent, + NodeTraits::set_balance(x_parent, (x == NodeTraits::get_right(x_parent) ? NodeTraits::negative() : NodeTraits::positive())); break; // the height didn't change, let's stop here } @@ -935,8 +960,8 @@ class avltree_algorithms /// @endcond }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp b/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp index bf8e2de09..682426a96 100644 --- a/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/bs_set_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -63,16 +63,16 @@ struct make_bs_set_base_hook typedef implementation_defined type; }; -//! Derive a class from bs_set_base_hook in order to store objects in -//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain +//! Derive a class from bs_set_base_hook in order to store objects in +//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain //! the bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. -//! +//! //! The hook admits the following options: \c tag<>, \c void_pointer<>, //! \c link_mode<>. //! -//! \c tag<> defines a tag to identify the node. -//! The same tag value can be used in different classes, but if a class is -//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its //! unique tag. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -99,27 +99,27 @@ class bs_set_base_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. bs_set_base_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_base_hook(const bs_set_base_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_base_hook& operator=(const bs_set_base_hook& ); @@ -128,37 +128,37 @@ class bs_set_base_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~bs_set_base_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(bs_set_base_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; @@ -198,7 +198,7 @@ struct make_bs_set_member_hook //! Put a public data member bs_set_member_hook in order to store objects of this class in //! a bs_set/bs_multiset. bs_set_member_hook holds the data necessary for maintaining the //! bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. -//! +//! //! The hook admits the following options: \c void_pointer<>, \c link_mode<>. //! //! \c void_pointer<> is the pointer type that will be used internally in the hook @@ -224,27 +224,27 @@ class bs_set_member_hook public: //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. bs_set_member_hook(); //! Effects: If link_mode is \c auto_unlink or \c safe_link //! initializes the node to an unlinked state. The argument is ignored. - //! - //! Throws: Nothing. - //! + //! + //! Throws: Nothing. + //! //! Rationale: Providing a copy-constructor - //! makes classes using the hook STL-compliant without forcing the + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_member_hook(const bs_set_member_hook& ); //! Effects: Empty function. The argument is ignored. - //! - //! Throws: Nothing. - //! - //! Rationale: Providing an assignment operator - //! makes classes using the hook STL-compliant without forcing the + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the //! user to do some additional work. \c swap can be used to emulate //! move-semantics. bs_set_member_hook& operator=(const bs_set_member_hook& ); @@ -253,43 +253,43 @@ class bs_set_member_hook //! nothing (ie. no code is generated). If link_mode is \c safe_link and the //! object is stored in a set an assertion is raised. If link_mode is //! \c auto_unlink and \c is_linked() is true, the node is unlinked. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. ~bs_set_member_hook(); - //! Effects: Swapping two nodes swaps the position of the elements - //! related to those nodes in one or two containers. That is, if the node - //! this is part of the element e1, the node x is part of the element e2 - //! and both elements are included in the containers s1 and s2, then after - //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 - //! at the position of e1. If one element is not in a container, then - //! after the swap-operation the other element is not in a container. - //! Iterators to e1 and e2 related to those nodes are invalidated. + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. //! - //! Complexity: Constant + //! Complexity: Constant //! - //! Throws: Nothing. + //! Throws: Nothing. void swap_nodes(bs_set_member_hook &other); //! Precondition: link_mode must be \c safe_link or \c auto_unlink. //! //! Returns: true, if the node belongs to a container, false - //! otherwise. This function can be used to test whether \c set::iterator_to - //! will return a valid iterator. + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. //! - //! Complexity: Constant + //! Complexity: Constant bool is_linked() const; //! Effects: Removes the node if it's inserted in a container. //! This function is only allowed if link_mode is \c auto_unlink. - //! - //! Throws: Nothing. + //! + //! Throws: Nothing. void unlink(); #endif }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp b/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp index c5de423b6..5add320c8 100644 --- a/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/circular_list_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -40,11 +40,11 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_previous(const_node_ptr n); -//! +//! //! static void set_previous(node_ptr n, node_ptr prev); -//! +//! //! static node_ptr get_next(const_node_ptr n); -//! +//! //! static void set_next(node_ptr n, node_ptr next); template class circular_list_algorithms @@ -57,9 +57,9 @@ class circular_list_algorithms //! Effects: Constructs an non-used list element, so that //! inited(this_node) == true - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init(const node_ptr &this_node) { @@ -69,20 +69,20 @@ class circular_list_algorithms //! Effects: Returns true is "this_node" is in a non-used state //! as if it was initialized by the "init" function. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. - static bool inited(const const_node_ptr &this_node) + static bool inited(const const_node_ptr &this_node) { return !NodeTraits::get_next(this_node); } //! Effects: Constructs an empty list, making this_node the only //! node of the circular list: //! NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node) //! == this_node. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init_header(const node_ptr &this_node) { @@ -92,12 +92,12 @@ class circular_list_algorithms //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns true is "this_node" is the only node of a circular list: //! return NodeTraits::get_next(this_node) == this_node - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static bool unique(const const_node_ptr &this_node) { @@ -106,14 +106,14 @@ class circular_list_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the number of nodes in a circular list. If the circular list //! is empty, returns 1. - //! - //! Complexity: Linear - //! + //! + //! Complexity: Linear + //! //! Throws: Nothing. - static std::size_t count(const const_node_ptr &this_node) + static std::size_t count(const const_node_ptr &this_node) { std::size_t result = 0; const_node_ptr p = this_node; @@ -125,11 +125,11 @@ class circular_list_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Unlinks the node from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static node_ptr unlink(const node_ptr &this_node) { @@ -146,11 +146,11 @@ class circular_list_algorithms } //! Requires: b and e must be nodes of the same circular list or an empty range. - //! + //! //! Effects: Unlinks the node [b, e) from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void unlink(const node_ptr &b, const node_ptr &e) { @@ -162,11 +162,11 @@ class circular_list_algorithms } //! Requires: nxt_node must be a node of a circular list. - //! + //! //! Effects: Links this_node before nxt_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_before(const node_ptr &nxt_node, const node_ptr &this_node) { @@ -174,18 +174,18 @@ class circular_list_algorithms NodeTraits::set_previous(this_node, prev); NodeTraits::set_next(this_node, nxt_node); //nxt_node might be an alias for prev->next_ - //so use it before update it before NodeTraits::set_next(prev, ...) + //so use it before NodeTraits::set_next(prev, ...) //is called and the reference changes it's value NodeTraits::set_previous(nxt_node, this_node); NodeTraits::set_next(prev, this_node); } //! Requires: prev_node must be a node of a circular list. - //! + //! //! Effects: Links this_node after prev_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_after(const node_ptr &prev_node, const node_ptr &this_node) { @@ -201,13 +201,13 @@ class circular_list_algorithms //! Requires: this_node and other_node must be nodes inserted //! in circular lists or be empty circular lists. - //! + //! //! Effects: Swaps the position of the nodes: this_node is inserted in //! other_nodes position in the second circular list and the other_node is inserted //! in this_node's position in the first circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. /* static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) @@ -248,22 +248,22 @@ class circular_list_algorithms */ //Watanabe version - private: - static void swap_prev(const node_ptr &this_node, const node_ptr &other_node) - { - node_ptr temp(NodeTraits::get_previous(this_node)); - NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); - NodeTraits::set_previous(other_node, temp); - } - static void swap_next(const node_ptr &this_node, const node_ptr &other_node) - { - node_ptr temp(NodeTraits::get_next(this_node)); - NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); - NodeTraits::set_next(other_node, temp); - } + private: + static void swap_prev(const node_ptr &this_node, const node_ptr &other_node) + { + node_ptr temp(NodeTraits::get_previous(this_node)); + NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); + NodeTraits::set_previous(other_node, temp); + } + static void swap_next(const node_ptr &this_node, const node_ptr &other_node) + { + node_ptr temp(NodeTraits::get_next(this_node)); + NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); + NodeTraits::set_next(other_node, temp); + } - public: - static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) + public: + static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) { if (other_node == this_node) return; @@ -276,15 +276,15 @@ class circular_list_algorithms init_header(other_node); } - node_ptr next_this(NodeTraits::get_next(this_node)); - node_ptr prev_this(NodeTraits::get_previous(this_node)); - node_ptr next_other(NodeTraits::get_next(other_node)); - node_ptr prev_other(NodeTraits::get_previous(other_node)); - //these first two swaps must happen before the other two - swap_prev(next_this, next_other); - swap_next(prev_this, prev_other); - swap_next(this_node, other_node); - swap_prev(this_node, other_node); + node_ptr next_this(NodeTraits::get_next(this_node)); + node_ptr prev_this(NodeTraits::get_previous(this_node)); + node_ptr next_other(NodeTraits::get_next(other_node)); + node_ptr prev_other(NodeTraits::get_previous(other_node)); + //these first two swaps must happen before the other two + swap_prev(next_this, next_other); + swap_next(prev_this, prev_other); + swap_next(this_node, other_node); + swap_prev(this_node, other_node); if(this_inited){ init(other_node); @@ -295,14 +295,14 @@ class circular_list_algorithms } //! Requires: b and e must be nodes of the same circular list or an empty range. - //! and p must be a node of a different circular list or may not be an iterator in + //! and p must be a node of a different circular list or may not be an iterator in // [b, e). - //! + //! //! Effects: Removes the nodes from [b, e) range from their circular list and inserts //! them before p in p's circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e) { @@ -321,13 +321,13 @@ class circular_list_algorithms //! Requires: i must a node of a circular list //! and p must be a node of a different circular list. - //! + //! //! Effects: Removes the node i from its circular list and inserts - //! it before p in p's circular list. + //! it before p in p's circular list. //! If p == i or p == NodeTraits::get_next(i), this function is a null operation. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer(const node_ptr &p, const node_ptr &i) { @@ -345,16 +345,16 @@ class circular_list_algorithms } } - //! Effects: Reverses the order of elements in the list. - //! + //! Effects: Reverses the order of elements in the list. + //! //! Throws: Nothing. - //! + //! //! Complexity: This function is linear time. static void reverse(const node_ptr &p) { node_ptr f(NodeTraits::get_next(p)); node_ptr i(NodeTraits::get_next(f)), e(p); - + while(i != e) { node_ptr n = i; i = NodeTraits::get_next(i); @@ -364,9 +364,9 @@ class circular_list_algorithms } //! Effects: Moves the node p n positions towards the end of the list. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of moved positions. static void move_backwards(const node_ptr &p, std::size_t n) { @@ -384,9 +384,9 @@ class circular_list_algorithms } //! Effects: Moves the node p n positions towards the beginning of the list. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of moved positions. static void move_forward(const node_ptr &p, std::size_t n) { @@ -405,8 +405,8 @@ class circular_list_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp b/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp index b843590c1..fc3848e83 100644 --- a/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/circular_slist_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -42,7 +42,7 @@ namespace intrusive { //! Static functions: //! //! static node_ptr get_next(const_node_ptr n); -//! +//! //! static void set_next(node_ptr n, node_ptr next); template class circular_slist_algorithms @@ -64,37 +64,37 @@ class circular_slist_algorithms //! Effects: Constructs an non-used list element, putting the next //! pointer to null: //! NodeTraits::get_next(this_node) == node_ptr() - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init(node_ptr this_node); //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns true is "this_node" is the only node of a circular list: //! or it's a not inserted node: //! return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node - //! + //! //! Complexity: Constant - //! + //! //! Throws: Nothing. static bool unique(const_node_ptr this_node); //! Effects: Returns true is "this_node" has the same state as //! if it was inited using "init(node_ptr)" - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static bool inited(const_node_ptr this_node); //! Requires: prev_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Unlinks the next node of prev_node from the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void unlink_after(node_ptr prev_node); @@ -103,28 +103,28 @@ class circular_slist_algorithms //! //! Effects: Unlinks the range (prev_node, last_node) from the circular list. //! - //! Complexity: Constant + //! Complexity: Constant //! //! Throws: Nothing. static void unlink_after(node_ptr prev_node, node_ptr last_node); //! Requires: prev_node must be a node of a circular list. - //! + //! //! Effects: Links this_node after prev_node in the circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void link_after(node_ptr prev_node, node_ptr this_node); //! Requires: b and e must be nodes of the same circular list or an empty range. //! and p must be a node of a different circular list. - //! + //! //! Effects: Removes the nodes from (b, e] range from their circular list and inserts //! them after p in p's circular list. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void transfer_after(node_ptr p, node_ptr b, node_ptr e); @@ -133,57 +133,56 @@ class circular_slist_algorithms //! Effects: Constructs an empty list, making this_node the only //! node of the circular list: //! NodeTraits::get_next(this_node) == this_node. - //! - //! Complexity: Constant - //! + //! + //! Complexity: Constant + //! //! Throws: Nothing. static void init_header(const node_ptr &this_node) - { NodeTraits::set_next(this_node, this_node); } + { NodeTraits::set_next(this_node, this_node); } //! Requires: this_node and prev_init_node must be in the same circular list. - //! + //! //! Effects: Returns the previous node of this_node in the circular list starting. //! the search from prev_init_node. The first node checked for equality //! is NodeTraits::get_next(prev_init_node). - //! + //! //! Complexity: Linear to the number of elements between prev_init_node and this_node. - //! + //! //! Throws: Nothing. static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node) { return base_t::get_previous_node(prev_init_node, this_node); } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the previous node of this_node in the circular list. - //! + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. static node_ptr get_previous_node(const node_ptr & this_node) { return base_t::get_previous_node(this_node, this_node); } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the previous node of the previous node of this_node in the circular list. - //! + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. static node_ptr get_previous_previous_node(const node_ptr & this_node) { return get_previous_previous_node(this_node, this_node); } - //! Requires: this_node and prev_prev_init_node must be in the same circular list. - //! + //! Requires: this_node and p must be in the same circular list. + //! //! Effects: Returns the previous node of the previous node of this_node in the - //! circular list starting. the search from prev_init_node. The first node checked - //! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)). - //! + //! circular list starting. the search from p. The first node checked + //! for equality is NodeTraits::get_next((NodeTraits::get_next(p)). + //! //! Complexity: Linear to the number of elements in the circular list. - //! + //! //! Throws: Nothing. - static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node) + static node_ptr get_previous_previous_node(node_ptr p, const node_ptr & this_node) { - node_ptr p = prev_prev_init_node; node_ptr p_next = NodeTraits::get_next(p); node_ptr p_next_next = NodeTraits::get_next(p_next); while (this_node != p_next_next){ @@ -195,14 +194,14 @@ class circular_slist_algorithms } //! Requires: this_node must be in a circular list or be an empty circular list. - //! + //! //! Effects: Returns the number of nodes in a circular list. If the circular list //! is empty, returns 1. - //! - //! Complexity: Linear - //! + //! + //! Complexity: Linear + //! //! Throws: Nothing. - static std::size_t count(const const_node_ptr & this_node) + static std::size_t count(const const_node_ptr & this_node) { std::size_t result = 0; const_node_ptr p = this_node; @@ -214,11 +213,11 @@ class circular_slist_algorithms } //! Requires: this_node must be in a circular list, be an empty circular list or be inited. - //! + //! //! Effects: Unlinks the node from the circular list. - //! - //! Complexity: Linear to the number of elements in the circular list - //! + //! + //! Complexity: Linear to the number of elements in the circular list + //! //! Throws: Nothing. static void unlink(const node_ptr & this_node) { @@ -227,24 +226,24 @@ class circular_slist_algorithms } //! Requires: nxt_node must be a node of a circular list. - //! + //! //! Effects: Links this_node before nxt_node in the circular list. - //! - //! Complexity: Linear to the number of elements in the circular list. - //! + //! + //! Complexity: Linear to the number of elements in the circular list. + //! //! Throws: Nothing. static void link_before (const node_ptr & nxt_node, const node_ptr & this_node) { base_t::link_after(get_previous_node(nxt_node), this_node); } //! Requires: this_node and other_node must be nodes inserted //! in circular lists or be empty circular lists. - //! + //! //! Effects: Swaps the position of the nodes: this_node is inserted in //! other_nodes position in the second circular list and the other_node is inserted //! in this_node's position in the first circular list. - //! - //! Complexity: Linear to number of elements of both lists - //! + //! + //! Complexity: Linear to number of elements of both lists + //! //! Throws: Nothing. static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node) { @@ -279,14 +278,14 @@ class circular_slist_algorithms } } - //! Effects: Reverses the order of elements in the list. - //! + //! Effects: Reverses the order of elements in the list. + //! //! Throws: Nothing. - //! + //! //! Complexity: This function is linear to the contained elements. static void reverse(const node_ptr & p) { - node_ptr i = NodeTraits::get_next(p), e(p); + node_ptr i = NodeTraits::get_next(p), e(p); for (;;) { node_ptr nxt(NodeTraits::get_next(i)); if (nxt == e) @@ -301,7 +300,7 @@ class circular_slist_algorithms //! Null if n leads to no movement. //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of elements plus the number moved positions. static node_ptr move_backwards(const node_ptr & p, std::size_t n) { @@ -348,12 +347,12 @@ class circular_slist_algorithms } //! Effects: Moves the node p n positions towards the beginning of the list. - //! + //! //! Returns: The previous node of p after the function if there has been any movement, //! Null if n leads equals to no movement. - //! + //! //! Throws: Nothing. - //! + //! //! Complexity: Linear to the number of elements plus the number moved positions. static node_ptr move_forward(const node_ptr & p, std::size_t n) { @@ -382,7 +381,7 @@ class circular_slist_algorithms std::size_t new_before_last_pos = (distance - (n % distance))% distance; //If the shift is a multiple of the size there is nothing to do if(!new_before_last_pos) return node_ptr(); - + for( new_last = p ; new_before_last_pos-- ; new_last = node_traits::get_next(new_last)){ @@ -397,8 +396,8 @@ class circular_slist_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp b/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp index 38c5aa57c..0aae01b61 100644 --- a/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp +++ b/project/jni/boost/include/boost/intrusive/derivation_value_traits.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -47,7 +47,7 @@ struct derivation_value_traits static const_node_ptr to_node_ptr(const_reference value) { return node_ptr(&value); } - static pointer to_value_ptr(const node_ptr &n) + static pointer to_value_ptr(const node_ptr &n) { // This still fails in gcc < 4.4 so forget about it // using ::boost::static_pointer_cast; @@ -64,7 +64,7 @@ struct derivation_value_traits } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP diff --git a/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp index bda9ad3c4..b274135a9 100644 --- a/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -100,10 +100,10 @@ struct any_unordered_node_traits { n->node_ptr_2 = prev; } static std::size_t get_hash(const const_node_ptr & n) - { return n->size_t_1; } + { return n->size_t_1; } static void set_hash(const node_ptr & n, std::size_t h) - { n->size_t_1 = h; } + { n->size_t_1 = h; } }; @@ -255,9 +255,9 @@ class any_algorithms //! Requires: node must not be part of any tree. //! //! Effects: After the function unique(node) == true. - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. @@ -265,9 +265,9 @@ class any_algorithms { node->node_ptr_1 = 0; }; //! Effects: Returns true if node is in the same state as if called init(node) - //! + //! //! Complexity: Constant. - //! + //! //! Throws: Nothing. static bool inited(const const_node_ptr & node) { return !node->node_ptr_1; }; @@ -289,8 +289,8 @@ class any_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/assert.hpp b/project/jni/boost/include/boost/intrusive/detail/assert.hpp index cfe392bfb..33de97f70 100644 --- a/project/jni/boost/include/boost/intrusive/detail/assert.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/assert.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -11,7 +11,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP -#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP +#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP #if defined(_MSC_VER)&&(_MSC_VER>=1200) #pragma once diff --git a/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp b/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp index dc600e669..f6aefcba0 100644 --- a/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/avltree_node.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -68,19 +68,28 @@ struct default_avltree_node_traits_impl typedef typename node::balance balance; - static const node_ptr & get_parent(const const_node_ptr & n) + static node_ptr get_parent(const const_node_ptr & n) + { return n->parent_; } + + static node_ptr get_parent(const node_ptr & n) { return n->parent_; } static void set_parent(const node_ptr & n, const node_ptr & p) { n->parent_ = p; } - static const node_ptr & get_left(const const_node_ptr & n) + static node_ptr get_left(const const_node_ptr & n) + { return n->left_; } + + static node_ptr get_left(const node_ptr & n) { return n->left_; } static void set_left(const node_ptr & n, const node_ptr & l) { n->left_ = l; } - static const node_ptr & get_right(const const_node_ptr & n) + static node_ptr get_right(const const_node_ptr & n) + { return n->right_; } + + static node_ptr get_right(const node_ptr & n) { return n->right_; } static void set_right(const node_ptr & n, const node_ptr & r) @@ -89,6 +98,9 @@ struct default_avltree_node_traits_impl static balance get_balance(const const_node_ptr & n) { return n->balance_; } + static balance get_balance(const node_ptr & n) + { return n->balance_; } + static void set_balance(const node_ptr & n, balance b) { n->balance_ = b; } @@ -125,13 +137,13 @@ struct compact_avltree_node_traits_impl static void set_parent(const node_ptr & n, const node_ptr & p) { ptr_bit::set_pointer(n->parent_, p); } - static const node_ptr & get_left(const const_node_ptr & n) + static node_ptr get_left(const const_node_ptr & n) { return n->left_; } static void set_left(const node_ptr & n, const node_ptr & l) { n->left_ = l; } - static const node_ptr & get_right(const const_node_ptr & n) + static node_ptr get_right(const const_node_ptr & n) { return n->right_; } static void set_right(const node_ptr & n, const node_ptr & r) @@ -172,13 +184,13 @@ struct avltree_node_traits , OptimizeSize && max_pointer_plus_bits < VoidPointer - , detail::alignment_of >::value + , detail::alignment_of >::value >::value >= 2u > {}; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp b/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp index 6765dfa05..1b5c27fff 100644 --- a/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/clear_on_destructor_base.hpp @@ -1,6 +1,6 @@ //////} // /////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp b/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp index 15d6b3ff2..166f78d43 100644 --- a/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/common_slist_algorithms.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -31,9 +31,8 @@ class common_slist_algorithms typedef typename NodeTraits::const_node_ptr const_node_ptr; typedef NodeTraits node_traits; - static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node) + static node_ptr get_previous_node(node_ptr p, const node_ptr & this_node) { - node_ptr p = prev_init_node; for( node_ptr p_next ; this_node != (p_next = NodeTraits::get_next(p)) ; p = p_next){ @@ -44,11 +43,11 @@ class common_slist_algorithms return p; } - static void init_header(const node_ptr & this_node) - { NodeTraits::set_next(this_node, this_node); } + static void init_header(const node_ptr & this_node) + { NodeTraits::set_next(this_node, this_node); } - static void init(const node_ptr & this_node) - { NodeTraits::set_next(this_node, node_ptr()); } + static void init(const node_ptr & this_node) + { NodeTraits::set_next(this_node, node_ptr()); } static bool unique(const const_node_ptr & this_node) { @@ -56,7 +55,7 @@ class common_slist_algorithms return !next || next == this_node; } - static bool inited(const const_node_ptr & this_node) + static bool inited(const const_node_ptr & this_node) { return !NodeTraits::get_next(this_node); } static void unlink_after(const node_ptr & prev_node) @@ -80,7 +79,7 @@ class common_slist_algorithms NodeTraits::set_next(bp, b); NodeTraits::set_next(be, p); } - + static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be) { if (bp != bb && bp != be && bb != be) { @@ -95,8 +94,8 @@ class common_slist_algorithms }; } //namespace detail -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp b/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp index bb126fcdf..7d153368a 100644 --- a/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/config_begin.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,10 +20,10 @@ #pragma warning (push) // //'function' : resolved overload was found by argument-dependent lookup - //A function found by argument-dependent lookup (Koenig lookup) was eventually + //A function found by argument-dependent lookup (Koenig lookup) was eventually //chosen by overload resolution. // - //In Visual C++ .NET and earlier compilers, a different function would have + //In Visual C++ .NET and earlier compilers, a different function would have //been called. To pick the original function, use an explicitly qualified name. // diff --git a/project/jni/boost/include/boost/intrusive/detail/config_end.hpp b/project/jni/boost/include/boost/intrusive/detail/config_end.hpp index 4277cb576..d653030da 100644 --- a/project/jni/boost/include/boost/intrusive/detail/config_end.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/config_end.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp b/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp index d4c2d1593..850d07432 100644 --- a/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/ebo_functor_holder.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Joaquin M Lopez Munoz 2006-2009 +// (C) Copyright Joaquin M Lopez Munoz 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp b/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp index e00a7efcf..08cee2d56 100644 --- a/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/function_detector.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2009. +// (C) Copyright Ion Gaztanaga 2009-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -15,7 +15,7 @@ /////////////////////////////////////////////////////////////////////////////// // Copyright 2007 Alexandre Courpron // -// Permission to use, copy, modify, redistribute and sell this software, +// Permission to use, copy, modify, redistribute and sell this software, // provided that this copyright notice appears on all copies of the software. /////////////////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ namespace function_detector { public : \ static const int check = NotFound + (sizeof(Test(0, 0)) - sizeof(NotFoundType));\ };\ -}}} //namespace boost::intrusive::function_detector { +}}} //namespace boost::intrusive::function_detector { #define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \ ::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\ diff --git a/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp b/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp index fc35610b8..5ddd52074 100644 --- a/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/generic_hook.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -143,7 +143,7 @@ class generic_hook typedef Tag tag; typedef typename GetNodeAlgorithms::type::node_traits node_traits; static const bool is_base_hook = !detail::is_same::value; - static const bool safemode_or_autounlink = + static const bool safemode_or_autounlink = (int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link; }; @@ -163,14 +163,14 @@ class generic_hook } } - generic_hook(const generic_hook& ) + generic_hook(const generic_hook& ) { if(boost_intrusive_tags::safemode_or_autounlink){ node_algorithms::init(this->this_ptr()); } } - generic_hook& operator=(const generic_hook& ) + generic_hook& operator=(const generic_hook& ) { return *this; } ~generic_hook() @@ -179,13 +179,13 @@ class generic_hook (*this, detail::link_dispatch()); } - void swap_nodes(generic_hook &other) + void swap_nodes(generic_hook &other) { node_algorithms::swap_nodes (this->this_ptr(), other.this_ptr()); } - bool is_linked() const + bool is_linked() const { //is_linked() can be only used in safe-mode or auto-unlink BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink )); @@ -201,8 +201,8 @@ class generic_hook }; } //namespace detail -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp b/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp index 33811e321..5651b4c17 100644 --- a/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -10,7 +10,7 @@ // sample.h -#if !BOOST_PP_IS_ITERATING +#if !defined(BOOST_PP_IS_ITERATING) #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED @@ -18,10 +18,11 @@ #include #include #include + #include #include #include - //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and //wrong SFINAE for GCC 4.2/4.3 #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED @@ -85,7 +86,7 @@ void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); }; - struct Base : public Type, public BaseMixin { Base(); }; + struct Base : public ::boost::intrusive::detail::remove_cv::type, public BaseMixin { Base(); }; template class Helper{}; template @@ -113,7 +114,7 @@ }; //! - #if !defined(_MSC_VER) || (_MSC_VER != 1600) + #if !defined(_MSC_VER) || (_MSC_VER < 1600) #if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) @@ -121,16 +122,16 @@ struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) { - //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and //wrong SFINAE for GCC 4.2/4.3 static const bool value = true; }; - #else + #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) //Special case for 0 args template< class F - , std::size_t N = + , std::size_t N = sizeof((boost::move_detail::declval(). BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) @@ -156,15 +157,15 @@ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); - template + template static boost_intrusive_has_member_function_callable_with::no_type Test(...); - + static const bool value = sizeof(Test< Fun >(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; - #endif + #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) - #else //#if !defined(_MSC_VER) || (_MSC_VER != 1600) + #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) template struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) @@ -180,7 +181,7 @@ static const bool value = sizeof(Test(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; - #endif //#if !defined(_MSC_VER) || (_MSC_VER != 1600) + #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) @@ -196,7 +197,7 @@ //Special case for 0 args template< class F - , std::size_t N = + , std::size_t N = sizeof((boost::move_detail::declval(). BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) @@ -222,9 +223,9 @@ static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); - template + template static boost_intrusive_has_member_function_callable_with::no_type Test(...); - + static const bool value = sizeof(Test< Fun >(0)) == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); }; diff --git a/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp b/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp index ac6ab8194..86e607460 100644 --- a/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/hashtable_node.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2009 +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -40,7 +40,7 @@ struct prime_list_holder template const std::size_t prime_list_holder::prime_list[] = { - 3ul, 7ul, 11ul, 17ul, 29ul, + 3ul, 7ul, 11ul, 17ul, 29ul, 53ul, 97ul, 193ul, 389ul, 769ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, @@ -180,9 +180,9 @@ class hashtable_iterator { return hashtable_iterator(this->slist_it(), this->get_container()); } public: - hashtable_iterator& operator++() + hashtable_iterator& operator++() { this->increment(); return *this; } - + hashtable_iterator operator++(int) { hashtable_iterator result (*this); @@ -219,7 +219,7 @@ class hashtable_iterator size_type buckets_len = cont->bucket_count(); ++slist_it_; - if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() && + if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() && slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){ //Now get the bucket_impl from the iterator const bucket_type &b = static_cast diff --git a/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp b/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp index e38f4de45..8677c666d 100644 --- a/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/is_stateful_value_traits.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2009-2009. +// (C) Copyright Ion Gaztanaga 2009-2012. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/project/jni/boost/include/boost/intrusive/detail/list_node.hpp b/project/jni/boost/include/boost/intrusive/detail/list_node.hpp index df99912dd..32274e65a 100644 --- a/project/jni/boost/include/boost/intrusive/detail/list_node.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/list_node.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -44,20 +44,26 @@ struct list_node_traits typedef typename pointer_traits :: template rebind_pointer::type const_node_ptr; - static const node_ptr &get_previous(const const_node_ptr & n) + static node_ptr get_previous(const const_node_ptr & n) + { return n->prev_; } + + static node_ptr get_previous(const node_ptr & n) { return n->prev_; } static void set_previous(const node_ptr & n, const node_ptr & prev) { n->prev_ = prev; } - static const node_ptr &get_next(const const_node_ptr & n) + static node_ptr get_next(const const_node_ptr & n) + { return n->next_; } + + static node_ptr get_next(const node_ptr & n) { return n->next_; } static void set_next(const node_ptr & n, const node_ptr & next) { n->next_ = next; } }; -// list_iterator provides some basic functions for a +// list_iterator provides some basic functions for a // node oriented bidirectional iterator: template class list_iterator @@ -76,7 +82,7 @@ class list_iterator typedef typename node_traits::node_ptr node_ptr; typedef typename pointer_traits:: template rebind_pointer::type void_pointer; - static const bool store_container_ptr = + static const bool store_container_ptr = detail::store_cont_ptr_on_it::value; public: @@ -103,14 +109,14 @@ class list_iterator { members_.nodeptr_ = node; return static_cast(*this); } public: - list_iterator& operator++() + list_iterator& operator++() { node_ptr p = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = p; - //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); - return static_cast (*this); + //members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return static_cast (*this); } - + list_iterator operator++(int) { list_iterator result (*this); @@ -118,12 +124,12 @@ class list_iterator return result; } - list_iterator& operator--() - { - members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); - return static_cast (*this); + list_iterator& operator--() + { + members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); + return static_cast (*this); } - + list_iterator operator--(int) { list_iterator result (*this); @@ -182,8 +188,8 @@ class list_iterator } members_; }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include diff --git a/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp b/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp index ad026c6d6..7f69f91a1 100644 --- a/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp +++ b/project/jni/boost/include/boost/intrusive/detail/memory_util.hpp @@ -6,7 +6,7 @@ // ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -149,7 +149,7 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) template struct first_param { typedef void type; }; -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template