Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android
Conflicts: project/jni/application/commandergenius/AndroidAppSettings.cfg project/jni/application/commandergenius/AndroidData/keen1.zip project/jni/application/commandergenius/AndroidData/keen4.zip project/jni/application/commandergenius/AndroidData/keen7.zip project/jni/application/vcmi/AndroidAppSettings.cfg
This commit is contained in:
8
bugs.txt
8
bugs.txt
@@ -3,6 +3,8 @@ Known bugs
|
||||
|
||||
- With 4:3 screen aspect ratio the on-screen buttons are not shown on the inactive part of screen.
|
||||
|
||||
- Put video at the center of the screen with 4:3 aspect ratio option
|
||||
|
||||
- Calling SDL_SetVideoMode() with SDL 1.3 several times makes it crash.
|
||||
|
||||
- Calling SDL_Init()/SDL_Quit() several times will make SDL 1.2 crash.
|
||||
@@ -11,15 +13,13 @@ Known bugs
|
||||
|
||||
- 32-bpp color mode does not work with SW video surface, 24-bpp and 32-bpp mode does not work with SDL_HWSURFACE.
|
||||
|
||||
- Option SdlVideoResizeKeepAspect has no effect
|
||||
|
||||
Requested features
|
||||
==================
|
||||
|
||||
- Support for resuming download of partially-downloaded files.
|
||||
|
||||
- Perform a check for free space available on SD card before writing there, and write to the internal storage if SD card is unplugged.
|
||||
|
||||
- Force SW video mode from AndroidAppSettings.cfg, ignore SDL_HWSURFACE if app does not explicitly support it.
|
||||
|
||||
- Split Settings.java into several files
|
||||
|
||||
- Show/hide screen controls with longpress on Text Edit button.
|
||||
|
||||
84
build.sh
84
build.sh
@@ -3,6 +3,13 @@
|
||||
|
||||
install_apk=false
|
||||
run_apk=false
|
||||
sign_apk=false
|
||||
build_release=false
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
|
||||
shift
|
||||
sign_apk=true
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-i" ]; then
|
||||
shift
|
||||
@@ -15,7 +22,12 @@ if [ "$#" -gt 0 -a "$1" = "-r" ]; then
|
||||
run_apk=true
|
||||
fi
|
||||
|
||||
[ -e local.properties ] || {
|
||||
if [ "$#" -gt 0 -a "$1" = "release" ]; then
|
||||
shift
|
||||
build_release=true
|
||||
fi
|
||||
|
||||
[ -e project/local.properties ] || {
|
||||
android update project -p project || exit 1
|
||||
rm -f project/src/Globals.java
|
||||
}
|
||||
@@ -23,14 +35,16 @@ fi
|
||||
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
|
||||
NDKBUILDPATH=$PATH
|
||||
export `grep "AppFullName=" AndroidAppSettings.cfg`
|
||||
if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null && \
|
||||
if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null 2>&1 && \
|
||||
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
|
||||
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] && \
|
||||
[ -z "`find project/jni/application/src/AndroidData/* -cnewer project/src/Globals.java`" ] ) ; then true ; else
|
||||
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] ) ; then true ; else
|
||||
./changeAppSettings.sh -a
|
||||
sleep 1
|
||||
touch project/src/Globals.java
|
||||
fi
|
||||
if $build_release ; then
|
||||
sed -i 's/android:debuggable="true"/android:debuggable="false"/g' project/AndroidManifest.xml
|
||||
fi
|
||||
|
||||
MYARCH=linux-x86
|
||||
NCPU=4
|
||||
@@ -51,31 +65,39 @@ rm -r -f project/bin/* # New Android SDK introduced some lame-ass optimizations
|
||||
./AndroidPreBuild.sh || { echo "AndroidPreBuild.sh returned with error" ; exit 1 ; }
|
||||
cd ../../../..
|
||||
}
|
||||
|
||||
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 && \
|
||||
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
echo Stripping libapplication.so by hand && \
|
||||
rm obj/local/armeabi/libapplication.so && \
|
||||
cp jni/application/src/libapplication.so obj/local/armeabi/ && \
|
||||
cp jni/application/src/libapplication.so libs/armeabi/ && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
|
||||
|| true ; } && \
|
||||
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
echo Stripping libapplication-armeabi-v7a.so by hand && \
|
||||
rm obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
|
||||
|| true ; } && \
|
||||
cd .. && ./copyAssets.sh && cd project && \
|
||||
ant debug && \
|
||||
$install_apk && [ -n "`adb devices | tail -n +2`" ] && \
|
||||
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
|
||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; true ; } && \
|
||||
$run_apk && {
|
||||
ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity"
|
||||
RUN_APK="adb shell am start -n $ActivityName"
|
||||
echo "Running $ActivityName on the USB-connected device:"
|
||||
echo "$RUN_APK"
|
||||
eval $RUN_APK
|
||||
}
|
||||
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
echo Stripping libapplication.so by hand && \
|
||||
rm obj/local/armeabi/libapplication.so && \
|
||||
cp jni/application/src/libapplication.so obj/local/armeabi/ && \
|
||||
cp jni/application/src/libapplication.so libs/armeabi/ && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
|
||||
|| true ; } && \
|
||||
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
echo Stripping libapplication-armeabi-v7a.so by hand && \
|
||||
rm obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
|
||||
|| true ; } && \
|
||||
cd .. && ./copyAssets.sh && cd project && \
|
||||
{ if $build_release ; then \
|
||||
ant release || exit 1 ; \
|
||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
|
||||
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk ; \
|
||||
else \
|
||||
ant debug ; \
|
||||
fi ; } && \
|
||||
{ if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
|
||||
$install_apk && [ -n "`adb devices | tail -n +2`" ] && \
|
||||
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
|
||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; true ; } && \
|
||||
$run_apk && { \
|
||||
ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
|
||||
RUN_APK="adb shell am start -n $ActivityName" ; \
|
||||
echo "Running $ActivityName on the USB-connected device:" ; \
|
||||
echo "$RUN_APK" ; \
|
||||
eval $RUN_APK ; \
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ fi
|
||||
if [ -z "$AUTO" -o -z "$MinimumScreenSize" ]; then
|
||||
echo
|
||||
echo "Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens"
|
||||
echo -n "Minimum screen size that application supports: (s)mall / (n)ormal / (l)arge ($MinimumScreenSize): "
|
||||
echo -n "Minimum screen size that application supports: (s)mall / (m)edium / (l)arge ($MinimumScreenSize): "
|
||||
read var
|
||||
if [ -n "$var" ] ; then
|
||||
MinimumScreenSize="$var"
|
||||
@@ -662,6 +662,7 @@ echo CompatibilityHacksStaticInit=$CompatibilityHacksStaticInit >> AndroidAppSet
|
||||
echo CompatibilityHacksTextInputEmulatesHwKeyboard=$CompatibilityHacksTextInputEmulatesHwKeyboard >> AndroidAppSettings.cfg
|
||||
echo CompatibilityHacksPreventAudioChopping=$CompatibilityHacksPreventAudioChopping >> AndroidAppSettings.cfg
|
||||
echo CompatibilityHacksAppIgnoresAudioBufferSize=$CompatibilityHacksAppIgnoresAudioBufferSize >> AndroidAppSettings.cfg
|
||||
echo CompatibilityHacksAdditionalPreloadedSharedLibraries=\"$CompatibilityHacksAdditionalPreloadedSharedLibraries\" >> AndroidAppSettings.cfg
|
||||
echo AppUsesMouse=$AppUsesMouse >> AndroidAppSettings.cfg
|
||||
echo AppNeedsTwoButtonMouse=$AppNeedsTwoButtonMouse >> AndroidAppSettings.cfg
|
||||
echo ShowMouseCursor=$ShowMouseCursor >> AndroidAppSettings.cfg
|
||||
@@ -879,7 +880,7 @@ fi
|
||||
|
||||
LibrariesToLoad="\\\"sdl-$LibSdlVersion\\\""
|
||||
StaticLibraries=`grep 'APP_AVAILABLE_STATIC_LIBS' project/jni/SettingsTemplate.mk | sed 's/.*=\(.*\)/\1/'`
|
||||
for lib in $CompiledLibraries; do
|
||||
for lib in $CompiledLibraries $CompatibilityHacksAdditionalPreloadedSharedLibraries; do
|
||||
process=true
|
||||
for lib1 in $StaticLibraries; do
|
||||
if [ "$lib" = "$lib1" ]; then process=false; fi
|
||||
|
||||
@@ -8,7 +8,7 @@ APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' |
|
||||
tar -c -z --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
|
||||
-f $APPNAME-$APPVER-src.tar.gz \
|
||||
`git ls-files --exclude-standard | grep -v '^project/jni/application/.*'` \
|
||||
`find project/jni/application -maxdepth 1 -type f` \
|
||||
`find project/jni/application -maxdepth 1 -type f -o -type l` \
|
||||
project/jni/application/src \
|
||||
project/jni/application/`readlink project/jni/application/src` \
|
||||
project/AndroidManifest.xml project/src
|
||||
|
||||
@@ -674,6 +674,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
|
||||
String cfglog = "";
|
||||
int idx = 0;
|
||||
int selectidx = -1;
|
||||
|
||||
Log.v("SDL", "Desired GL config: " + "R" + mRedSize + "G" + mGreenSize + "B" + mBlueSize + "A" + mAlphaSize + " depth " + mDepthSize + " stencil " + mStencilSize + " type " + (mIsGles2 ? "GLES2" : "GLES"));
|
||||
for(EGLConfig config : configs) {
|
||||
if ( config == null )
|
||||
continue;
|
||||
@@ -699,12 +701,16 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
|
||||
int distance = Math.abs(r - mRedSize)
|
||||
+ Math.abs(g - mGreenSize)
|
||||
+ Math.abs(b - mBlueSize) + Math.abs(a - mAlphaSize);
|
||||
int dist2 = distance;
|
||||
if( (d > 0) != (mDepthSize > 0) )
|
||||
distance += (d > 0) ? 5 : 1; // Small penalty if we don't need zbuffer but it is present
|
||||
if( (s > 0) == (mStencilSize > 0) )
|
||||
distance += (s > 0) ? 5 : 1;
|
||||
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;
|
||||
int dist4 = distance;
|
||||
if( (rendertype & desiredtype) == 0 )
|
||||
distance += 5;
|
||||
int dist5 = distance;
|
||||
if( caveat == EGL10.EGL_SLOW_CONFIG )
|
||||
distance += 4;
|
||||
if( caveat == EGL10.EGL_NON_CONFORMANT_CONFIG ) // dunno what that means, probably R and B channels swapped
|
||||
@@ -726,7 +732,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;
|
||||
cfgcur += " pos " + distance + " (" + dist2 + "," + dist3 + "," + dist4 + "," + dist5 + ")";
|
||||
Log.v("SDL", "GL config " + idx + ": " + cfgcur);
|
||||
if (distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
@@ -890,6 +896,14 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
|
||||
/*
|
||||
* Create an EGL surface we can render into.
|
||||
*/
|
||||
/*
|
||||
// This does not have any effect on Galaxy Note
|
||||
int [] attribList = new int[4];
|
||||
attribList[0] = mEgl.EGL_RENDER_BUFFER;
|
||||
attribList[1] = mEgl.EGL_SINGLE_BUFFER;
|
||||
attribList[2] = mEgl.EGL_NONE;
|
||||
attribList[3] = mEgl.EGL_NONE;
|
||||
*/
|
||||
mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay,
|
||||
mEglConfig, holder, null);
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ import android.os.Message;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.view.Display;
|
||||
import android.text.InputType;
|
||||
|
||||
public class MainActivity extends Activity
|
||||
{
|
||||
@@ -293,8 +294,10 @@ public class MainActivity extends Activity
|
||||
_tv = null;
|
||||
_inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
_videoLayout = new FrameLayout(this);
|
||||
SetLayerType.get().setLayerType(_videoLayout);
|
||||
setContentView(_videoLayout);
|
||||
mGLView = new DemoGLSurfaceView(this);
|
||||
SetLayerType.get().setLayerType(mGLView);
|
||||
_videoLayout.addView(mGLView);
|
||||
mGLView.setFocusableInTouchMode(true);
|
||||
mGLView.setFocusable(true);
|
||||
@@ -418,13 +421,35 @@ public class MainActivity extends Activity
|
||||
_parent.hideScreenKeyboard();
|
||||
return true;
|
||||
}
|
||||
if ((sendBackspace && event.getAction() == KeyEvent.ACTION_UP) && (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_CLEAR))
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_CLEAR)
|
||||
{
|
||||
synchronized(textInput) {
|
||||
DemoRenderer.nativeTextInput( 8, 0 ); // Send backspace to native code
|
||||
if (sendBackspace && event.getAction() == KeyEvent.ACTION_UP)
|
||||
{
|
||||
synchronized(textInput) {
|
||||
DemoRenderer.nativeTextInput( 8, 0 ); // Send backspace to native code
|
||||
}
|
||||
}
|
||||
// EditText deletes two characters at a time, here's a hacky fix
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN && (event.getFlags() | KeyEvent.FLAG_SOFT_KEYBOARD) != 0)
|
||||
{
|
||||
EditText t = (EditText) v;
|
||||
int start = t.getSelectionStart(); //get cursor starting position
|
||||
int end = t.getSelectionEnd(); //get cursor ending position
|
||||
if ( start < 0 )
|
||||
return true;
|
||||
if ( end < 0 || end == start )
|
||||
{
|
||||
start --;
|
||||
if ( start < 0 )
|
||||
return true;
|
||||
end = start + 1;
|
||||
}
|
||||
t.setText(t.getText().toString().substring(0, start) + t.getText().toString().substring(end));
|
||||
t.setSelection(start);
|
||||
return true;
|
||||
}
|
||||
return false; // and proceed to delete text in keyboard input field
|
||||
}
|
||||
//System.out.println("Key " + keyCode + " flags " + event.getFlags() + " action " + event.getAction());
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -433,7 +458,8 @@ public class MainActivity extends Activity
|
||||
_screenKeyboard.setOnKeyListener(new simpleKeyListener(this, sendBackspace));
|
||||
_screenKeyboard.setHint(R.string.text_edit_click_here);
|
||||
_screenKeyboard.setText(oldText);
|
||||
_screenKeyboard.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.NONE, false));
|
||||
//_screenKeyboard.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.NONE, false));
|
||||
_screenKeyboard.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
_screenKeyboard.setFocusableInTouchMode(true);
|
||||
_screenKeyboard.setFocusable(true);
|
||||
_screenKeyboard.requestFocus();
|
||||
@@ -812,15 +838,18 @@ public class MainActivity extends Activity
|
||||
}
|
||||
|
||||
// ----- VCMI hack -----
|
||||
String [] binaryZipNames = { "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries.zip" };
|
||||
for(String binaryZip: binaryZipNames)
|
||||
{
|
||||
try {
|
||||
//System.out.println("libSDL: Extracting binaries");
|
||||
System.out.println("libSDL: Trying to extract binaries from assets " + binaryZip);
|
||||
|
||||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
for( int i = 0; ; i++ )
|
||||
{
|
||||
InputStream in2 = getAssets().open("binaries.zip" + String.format("%02d", i));
|
||||
InputStream in2 = getAssets().open(binaryZip + String.format("%02d", i));
|
||||
if( in == null )
|
||||
in = in2;
|
||||
else
|
||||
@@ -832,7 +861,7 @@ public class MainActivity extends Activity
|
||||
try
|
||||
{
|
||||
if( in == null )
|
||||
in = getAssets().open("binaries.zip");
|
||||
in = getAssets().open(binaryZip);
|
||||
}
|
||||
catch( IOException eee ) {}
|
||||
}
|
||||
@@ -911,6 +940,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
//System.out.println("libSDL: Error: " + eee.toString());
|
||||
}
|
||||
}
|
||||
// ----- VCMI hack -----
|
||||
|
||||
};
|
||||
@@ -1029,3 +1059,38 @@ abstract class DimSystemStatusBar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class SetLayerType
|
||||
{
|
||||
public static SetLayerType get()
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)
|
||||
return SetLayerTypeHoneycomb.Holder.sInstance;
|
||||
else
|
||||
return SetLayerTypeDummy.Holder.sInstance;
|
||||
}
|
||||
public abstract void setLayerType(final View view);
|
||||
|
||||
private static class SetLayerTypeHoneycomb extends SetLayerType
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final SetLayerTypeHoneycomb sInstance = new SetLayerTypeHoneycomb();
|
||||
}
|
||||
public void setLayerType(final View view)
|
||||
{
|
||||
view.setLayerType(android.view.View.LAYER_TYPE_NONE, null);
|
||||
//view.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
}
|
||||
private static class SetLayerTypeDummy extends SetLayerType
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final SetLayerTypeDummy sInstance = new SetLayerTypeDummy();
|
||||
}
|
||||
public void setLayerType(final View view)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ import android.app.AlarmManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.net.Uri;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import android.graphics.Color;
|
||||
|
||||
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
|
||||
class Settings
|
||||
@@ -299,23 +300,25 @@ class Settings
|
||||
Globals.BrokenLibCMessageShown = settingsFile.readBoolean();
|
||||
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
|
||||
int cfgVersion = settingsFile.readInt();
|
||||
|
||||
settingsLoaded = true;
|
||||
|
||||
System.out.println("libSDL: Settings.Load(): loaded settings successfully");
|
||||
settingsFile.close();
|
||||
|
||||
System.out.println("libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion());
|
||||
if( cfgVersion < p.getApplicationVersion() )
|
||||
if( cfgVersion != p.getApplicationVersion() )
|
||||
{
|
||||
DeleteFilesOnUpgrade();
|
||||
if( Globals.ResetSdlConfigForThisVersion )
|
||||
{
|
||||
System.out.println("libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file");
|
||||
// Delete settings file, and restart the application
|
||||
settingsFile.close();
|
||||
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||
}
|
||||
Save(p);
|
||||
}
|
||||
|
||||
settingsLoaded = true;
|
||||
|
||||
System.out.println("libSDL: Settings.Load(): loaded settings successfully");
|
||||
settingsFile.close();
|
||||
return;
|
||||
|
||||
} catch( FileNotFoundException e ) {
|
||||
@@ -627,7 +630,7 @@ class Settings
|
||||
{
|
||||
Globals.DownloadToSdcard = (item != 0);
|
||||
Globals.DataDir = Globals.DownloadToSdcard ?
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/app-data/" + Globals.class.getPackage().getName() :
|
||||
SdcardAppPath.getPath(p) :
|
||||
p.getFilesDir().getAbsolutePath();
|
||||
goBack(p);
|
||||
}
|
||||
@@ -2192,8 +2195,10 @@ class Settings
|
||||
{
|
||||
MainActivity p;
|
||||
FrameLayout layout = null;
|
||||
ImageView imgs[] = new ImageView[Globals.ScreenKbControlsLayout.length];
|
||||
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,
|
||||
@@ -2211,7 +2216,27 @@ class Settings
|
||||
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 = 0;
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
{
|
||||
int buttons2[] = {
|
||||
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
|
||||
};
|
||||
buttons = buttons2;
|
||||
}
|
||||
setupButton(true);
|
||||
}
|
||||
|
||||
@@ -2238,11 +2263,28 @@ class Settings
|
||||
if( imgs[currentButton] == null )
|
||||
{
|
||||
imgs[currentButton] = new ImageView(p);
|
||||
imgs[currentButton].setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
imgs[currentButton].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
imgs[currentButton].setScaleType(ImageView.ScaleType.MATRIX);
|
||||
bmps[currentButton] = BitmapFactory.decodeResource( p.getResources(), buttons[currentButton] );
|
||||
imgs[currentButton].setImageBitmap(bmps[currentButton]);
|
||||
layout.addView(imgs[currentButton]);
|
||||
boundary.bringToFront();
|
||||
}
|
||||
if( Globals.ScreenKbControlsLayout[currentButton][0] == Globals.ScreenKbControlsLayout[currentButton][2] ||
|
||||
Globals.ScreenKbControlsLayout[currentButton][1] == Globals.ScreenKbControlsLayout[currentButton][3] )
|
||||
{
|
||||
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) {}
|
||||
Globals.ScreenKbControlsLayout[currentButton][0] = displayX / 2 - displayX / 6;
|
||||
Globals.ScreenKbControlsLayout[currentButton][2] = displayX / 2 + displayX / 6;
|
||||
Globals.ScreenKbControlsLayout[currentButton][1] = displayY / 2 - displayY / 4;
|
||||
Globals.ScreenKbControlsLayout[currentButton][3] = displayY / 2 + displayY / 4;
|
||||
}
|
||||
Matrix m = new Matrix();
|
||||
RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight());
|
||||
@@ -2250,11 +2292,15 @@ class Settings
|
||||
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 onTouchEvent(final MotionEvent ev)
|
||||
{
|
||||
if(Globals.ScreenKbControlsLayout.length >= currentButton)
|
||||
if(currentButton >= Globals.ScreenKbControlsLayout.length)
|
||||
{
|
||||
setupButton(false);
|
||||
return;
|
||||
@@ -2284,6 +2330,10 @@ class Settings
|
||||
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);
|
||||
|
||||
if( ev.getAction() == MotionEvent.ACTION_UP )
|
||||
setupButton(false);
|
||||
|
||||
@@ -2,7 +2,7 @@ APP_PROJECT_PATH := $(call my-dir)/..
|
||||
|
||||
APP_STL := gnustl_static
|
||||
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
|
||||
APP_PLATFORM := android-9 # Android 2.3.0 or newer, includes EGL headers
|
||||
APP_PLATFORM := android-14 # Android 4.0, it should be backward compatible to previous versions
|
||||
|
||||
include jni/Settings.mk
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=y
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=y
|
||||
@@ -29,13 +29,13 @@ AppUsesAccelerometer=y
|
||||
AppUsesMultitouch=y
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
|
||||
AppTouchscreenKeyboardKeysAmount=0
|
||||
AppTouchscreenKeyboardKeysAmount=6
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions='OptionalDownloadConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
MultiABI=y
|
||||
AppMinimumRAM=0
|
||||
AppVersionCode=101
|
||||
AppVersionName="1.01"
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
#include <math.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_image.h>
|
||||
#include <SDL/SDL_screenkeyboard.h>
|
||||
|
||||
#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
@@ -438,9 +439,11 @@ int main(int argc, char* argv[])
|
||||
struct TouchPointer_t { int x; int y; int pressure; int pressed; } touchPointers[MAX_POINTERS];
|
||||
int accel[2], screenjoy[2];
|
||||
SDL_Surface *mouse[4];
|
||||
int screenKeyboardShown = 0;
|
||||
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
@@ -632,7 +635,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
if(evt.type == SDL_KEYUP || evt.type == SDL_KEYDOWN)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL key event: evt %s state %s key %d scancode %d mod %d unicode %d", evt.type == SDL_KEYUP ? "UP " : "DOWN" , evt.key.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.key.keysym.sym, (int)evt.key.keysym.scancode, (int)evt.key.keysym.mod, (int)evt.key.keysym.unicode);
|
||||
__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;
|
||||
}
|
||||
@@ -671,6 +674,11 @@ int main(int argc, char* argv[])
|
||||
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);
|
||||
|
||||
@@ -17,7 +17,7 @@ CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
@@ -37,8 +37,8 @@ HiddenMenuOptions=''
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppMinimumRAM=32
|
||||
AppVersionCode=100005
|
||||
AppVersionName="1.0 RC-5"
|
||||
AppVersionCode=100011
|
||||
AppVersionName="1.0 Release"
|
||||
ResetSdlConfigForThisVersion=n
|
||||
DeleteFilesOnUpgrade="%"
|
||||
CompiledLibraries="tremor ogg"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,10 +13,10 @@ LOCAL_PATH=`dirname $0`
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
prefix=$LOCAL_PATH/../freetype
|
||||
exec_prefix=$LOCAL_PATH/../../obj/local/armeabi
|
||||
#exec_prefix=$LOCAL_PATH/../../obj/local/armeabi # Breaks armeabi-v7a build
|
||||
exec_prefix_set=no
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
#libdir=${exec_prefix}/lib
|
||||
enable_shared=
|
||||
wl=-Wl,
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
@@ -146,7 +146,7 @@ if test "$echo_libs" = "yes" ; then
|
||||
fi
|
||||
libs="-lfreetype "
|
||||
if test "$libdir" != "/usr/lib" && test "$libdir" != "/usr/lib64"; then
|
||||
echo -L$libdir $rpath $libs
|
||||
echo $rpath $libs #-L$libdir
|
||||
else
|
||||
echo $libs
|
||||
fi
|
||||
|
||||
@@ -14,6 +14,10 @@ SwVideoMode=y
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=y
|
||||
CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=y
|
||||
ShowMouseCursor=n
|
||||
@@ -21,7 +25,7 @@ ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesAccelerometer=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="LCTRL c NO_REMAP NO_REMAP e"
|
||||
@@ -32,9 +36,11 @@ StartupMenuButtonTimeout=2000
|
||||
HiddenMenuOptions=''
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=y
|
||||
AppMinimumRAM=0
|
||||
AppVersionCode=0701
|
||||
AppVersionName="0.7.0.1"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
DeleteFilesOnUpgrade="%"
|
||||
CompiledLibraries="sdl_mixer sdl_ttf ogg vorbis openal png python"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-fexceptions -finline-functions -O3 -DSTATIC_LINK=Yes -DHAVE_SNPRINTF'
|
||||
@@ -42,3 +48,7 @@ AppLdflags=''
|
||||
AppSubdirsBuild='gemrb/gemrb/*'
|
||||
AppCmdline='GemRB'
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
MinimumScreenSize=m
|
||||
AdmobPublisherId=n
|
||||
AdmobTestDeviceId=
|
||||
AdmobBannerSize=
|
||||
|
||||
@@ -5,10 +5,10 @@ AppName="OpenArena"
|
||||
AppFullName=ws.openarena.sdl
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
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:vm.zip"
|
||||
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"
|
||||
VideoDepthBpp=24
|
||||
NeedDepthBuffer=y
|
||||
NeedStencilBuffer=y
|
||||
NeedStencilBuffer=n
|
||||
NeedGles2=n
|
||||
SwVideoMode=n
|
||||
SdlVideoResize=y
|
||||
@@ -25,21 +25,21 @@ ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=y
|
||||
AppUsesAccelerometer=y
|
||||
AppUsesAccelerometer=n
|
||||
AppUsesMultitouch=y
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
|
||||
AppTouchscreenKeyboardKeysAmount=3
|
||||
AppTouchscreenKeyboardKeysAmount=5
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="SLASH BACKSPACE TAB RETURN UNKNOWN UNKNOWN UNKNOWN UNKNOWN UNKNOWN UNKNOWN"
|
||||
RedefinedKeysScreenKb="SLASH BACKSPACE TAB END LCTRL SPACE UNKNOWN UNKNOWN UNKNOWN UNKNOWN"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=y
|
||||
AppMinimumRAM=350
|
||||
AppVersionCode=08804
|
||||
AppVersionName="0.8.8.04"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
AppMinimumRAM=300
|
||||
AppVersionCode=08818
|
||||
AppVersionName="0.8.8.18"
|
||||
ResetSdlConfigForThisVersion=n
|
||||
DeleteFilesOnUpgrade="libsdl-DownloadFinished-10.flag"
|
||||
CompiledLibraries="sdl_mixer sdl_image freetype curl vorbis ogg"
|
||||
CustomBuildScript=y
|
||||
|
||||
@@ -3,16 +3,19 @@
|
||||
LOCAL_PATH=`dirname $0`
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
[ "$1" = "armeabi" ] && (
|
||||
mkdir -p AndroidData
|
||||
[ -e libapplication.so ] || ln -s libapplication-armeabi.so libapplication.so
|
||||
make -j8 -C vm BUILD_MISSIONPACK=0 || exit 1
|
||||
cd vm/build/release-linux-`uname -m`/baseq3
|
||||
rm -f ../../../../AndroidData/binaries.zip ../../../../AndroidData/vm.zip
|
||||
zip -r ../../../../AndroidData/vm.zip vm
|
||||
cd ../../../android
|
||||
zip ../../AndroidData/vm.zip *
|
||||
)
|
||||
if [ "$1" = "armeabi" ]; then (
|
||||
mkdir -p AndroidData
|
||||
[ -e libapplication.so ] || ln -s libapplication-armeabi.so libapplication.so
|
||||
make -j8 -C vm BUILD_MISSIONPACK=0 || exit 1
|
||||
cd vm/build/release-linux-`uname -m`/baseq3
|
||||
#rm -f ../../../../AndroidData/binaries.zip ../../../../AndroidData/pak7-android.pk3
|
||||
zip -r ../../../../AndroidData/pak7-android.pk3 vm
|
||||
cd ../../../android
|
||||
zip -r ../../AndroidData/pak7-android.pk3 *
|
||||
ln -sf ../engine/misc/quake3-tango.png ../../AndroidData/logo.png
|
||||
exit 0
|
||||
) || exit 1
|
||||
fi
|
||||
|
||||
env NO_SHARED_LIBS=1 BUILD_EXECUTABLE=1 V=1 ../setEnvironment-armeabi.sh make -C vm -j8 PLATFORM=android ARCH=$1 USE_LOCAL_HEADERS=0 BUILD_MISSIONPACK=0 || exit 1
|
||||
|
||||
|
||||
Submodule project/jni/application/openarena/engine updated: f298c6ef3e...d005816c5b
@@ -1,2 +1,3 @@
|
||||
#!/bin/sh
|
||||
adb shell rm /sdcard/Android/data/ws.openarena.sdl/files/libsdl-DownloadFinished-10.flag
|
||||
adb shell rm -r /sdcard/Android/data/ws.openarena.sdl/files/.openarena
|
||||
|
||||
Submodule project/jni/application/openarena/vm updated: 4a39bfea3f...3546f88fcf
@@ -17,6 +17,7 @@ CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=y
|
||||
ShowMouseCursor=n
|
||||
|
||||
@@ -1,34 +1,54 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=16
|
||||
AppSettingVersion=17
|
||||
LibSdlVersion=1.2
|
||||
AppName="Pachi el marciano"
|
||||
AppFullName=net.sourceforge.dragontech.pachi
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="Game data is 30 Mb|http://sourceforge.net/projects/libsdl-android/files/Pachi/pachi.zip/download"
|
||||
VideoDepthBpp=16
|
||||
NeedDepthBuffer=n
|
||||
NeedStencilBuffer=n
|
||||
NeedGles2=n
|
||||
SwVideoMode=y
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
NeedDepthBuffer=n
|
||||
CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesAccelerometer=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN"
|
||||
AppTouchscreenKeyboardKeysAmount=1
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="SPACE RETURN"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions=''
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppVersionCode=104
|
||||
AppVersionName="1.04"
|
||||
AppMinimumRAM=0
|
||||
AppVersionCode=106
|
||||
AppVersionName="1.06"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
DeleteFilesOnUpgrade="%"
|
||||
CompiledLibraries="sdl_mixer"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-O2 -finline-functions -Wno-write-strings'
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild=''
|
||||
AppUseCrystaXToolchain=n
|
||||
AppCmdline=''
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
MinimumScreenSize=n
|
||||
AdmobPublisherId=n
|
||||
AdmobTestDeviceId=
|
||||
AdmobBannerSize=
|
||||
|
||||
@@ -4,7 +4,7 @@ LOCAL_PATH=`dirname $0`
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
prefix=$LOCAL_PATH/../sdl-1.2
|
||||
exec_prefix=$LOCAL_PATH/../../obj/local/armeabi
|
||||
#exec_prefix=$LOCAL_PATH/../../obj/local/armeabi # Breaks armeabi-v7a build
|
||||
exec_prefix_set=no
|
||||
|
||||
#usage="\
|
||||
@@ -50,11 +50,11 @@ while test $# -gt 0; do
|
||||
echo -I${prefix}/include -D_GNU_SOURCE=1 -D_REENTRANT
|
||||
;;
|
||||
--libs)
|
||||
echo -L${exec_prefix} -lsdl-1.2
|
||||
echo -lsdl-1.2 #-L${exec_prefix}
|
||||
;;
|
||||
--static-libs)
|
||||
# --libs|--static-libs)
|
||||
echo -L${exec_prefix} -lsdl-1.2
|
||||
echo -lsdl-1.2 #-L${exec_prefix}
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
|
||||
@@ -21,7 +21,7 @@ NDK=`readlink -f $NDK`
|
||||
#echo NDK $NDK
|
||||
GCCPREFIX=arm-linux-androideabi
|
||||
GCCVER=4.6
|
||||
PLATFORMVER=android-8
|
||||
PLATFORMVER=android-14
|
||||
LOCAL_PATH=`dirname $0`
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
ARCH=armeabi-v7a
|
||||
@@ -44,10 +44,10 @@ MISSING_INCLUDE=
|
||||
MISSING_LIB=
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables \
|
||||
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi \
|
||||
-march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
|
||||
-DANDROID -Wa,--noexecstack -g -O2 -DNDEBUG -g \
|
||||
-fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
|
||||
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb \
|
||||
-Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
|
||||
-DANDROID -O2 -g -finline-functions -Wa,--noexecstack \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
@@ -55,30 +55,33 @@ CFLAGS="\
|
||||
`echo $APP_MODULES | sed \"s@\([-a-zA-Z0-9_.]\+\)@-isystem$LOCAL_PATH/../\1/include@g\"` \
|
||||
$MISSING_INCLUDE $CFLAGS"
|
||||
|
||||
SHARED="-shared -Wl,-soname,libapplication.so"
|
||||
|
||||
if [ -z "$SHARED_LIBRARY_NAME" ]; then
|
||||
SHARED_LIBRARY_NAME=libapplication.so
|
||||
fi
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
if [ -n "$BUILD_EXECUTABLE" ]; then
|
||||
SHARED=
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
fi
|
||||
if [ -n "$NO_SHARED_LIBS" ]; then
|
||||
APP_SHARED_LIBS=
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \
|
||||
-L$LOCAL_PATH/../../obj/local/$ARCH \
|
||||
`echo $APP_SHARED_LIBS | sed \"s@\([-a-zA-Z0-9_.]\+\)@$LOCAL_PATH/../../obj/local/$ARCH/lib\1.so@g\"` \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libGLESv1_CM.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libdl.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/liblog.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libz.so \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-lc -lm -lGLESv1_CM -ldl -llog -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-L$LOCAL_PATH/../../obj/local/$ARCH \
|
||||
-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack \
|
||||
-Wl,-rpath-link=$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib -lsupc++ \
|
||||
-no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$MISSING_LIB $LDFLAGS"
|
||||
|
||||
#echo env CFLAGS=\""$CFLAGS"\" LDFLAGS=\""$LDFLAGS"\" "$@"
|
||||
|
||||
@@ -21,7 +21,7 @@ NDK=`readlink -f $NDK`
|
||||
#echo NDK $NDK
|
||||
GCCPREFIX=arm-linux-androideabi
|
||||
GCCVER=4.6
|
||||
PLATFORMVER=android-8
|
||||
PLATFORMVER=android-14
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
@@ -48,41 +48,43 @@ MISSING_INCLUDE=
|
||||
MISSING_LIB=
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi \
|
||||
-march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm/usr/include -Wa,--noexecstack \
|
||||
-DANDROID \
|
||||
-DNDEBUG -O2 -g \
|
||||
-fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
|
||||
-no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb \
|
||||
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
|
||||
-DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
-isystem$LOCAL_PATH/../sdl-1.2/include \
|
||||
`echo $APP_MODULES | sed \"s@\([-a-zA-Z0-9_.]\+\)@-isystem$LOCAL_PATH/../\1/include@g\"` \
|
||||
$MISSING_INCLUDE $CFLAGS"
|
||||
|
||||
SHARED="-shared -Wl,-soname,libapplication.so"
|
||||
if [ -z "$SHARED_LIBRARY_NAME" ]; then
|
||||
SHARED_LIBRARY_NAME=libapplication.so
|
||||
fi
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
if [ -n "$BUILD_EXECUTABLE" ]; then
|
||||
SHARED=
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
fi
|
||||
if [ -n "$NO_SHARED_LIBS" ]; then
|
||||
APP_SHARED_LIBS=
|
||||
fi
|
||||
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \
|
||||
-L$LOCAL_PATH/../../obj/local/$ARCH \
|
||||
`echo $APP_SHARED_LIBS | sed \"s@\([-a-zA-Z0-9_.]\+\)@$LOCAL_PATH/../../obj/local/$ARCH/lib\1.so@g\"` \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libGLESv1_CM.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libdl.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/liblog.so \
|
||||
$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib/libz.so \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-lc -lm -lGLESv1_CM -ldl -llog -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-L$LOCAL_PATH/../../obj/local/$ARCH -Wl,--no-undefined -Wl,-z,noexecstack \
|
||||
-Wl,-rpath-link=$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib -lsupc++ \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$MISSING_LIB $LDFLAGS"
|
||||
|
||||
#echo env CFLAGS=\""$CFLAGS"\" LDFLAGS=\""$LDFLAGS"\" "$@"
|
||||
|
||||
@@ -16,14 +16,16 @@ SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsTextInput=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=y
|
||||
AppUsesAccelerometer=y
|
||||
AppUsesAccelerometer=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP"
|
||||
@@ -34,6 +36,7 @@ StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions='OptionalDownloadConfig DisplaySizeConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppMinimumRAM=0
|
||||
AppVersionCode=06108
|
||||
AppVersionName="0.6.1.08"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
|
||||
11
project/jni/application/teeworlds/readme.txt
Normal file
11
project/jni/application/teeworlds/readme.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Quick compilation guide for Debian/Ubuntu (Windows is not supported, MacOsX should be okay though):
|
||||
Download SDL Git repo from https://github.com/pelya/commandergenius,
|
||||
install latest Android SDK, Android NDK r8b or newer, and "ant" tool (sudo apt-get install ant),
|
||||
then launch commands:
|
||||
git submodule update --init project/jni/application/teeworlds/src
|
||||
rm project/jni/application/src # ignore the error
|
||||
ln -s teeworlds project/jni/application/src
|
||||
./changeAppSettings.sh -a
|
||||
android update project -p project
|
||||
./build.sh
|
||||
That should do it.
|
||||
@@ -16,6 +16,8 @@ SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=n
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=y
|
||||
ShowMouseCursor=n
|
||||
@@ -34,6 +36,7 @@ StartupMenuButtonTimeout=500
|
||||
HiddenMenuOptions='OptionalDownloadConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppMinimumRAM=0
|
||||
AppVersionCode=101
|
||||
AppVersionName="1.01"
|
||||
ResetSdlConfigForThisVersion=n
|
||||
|
||||
@@ -579,18 +579,6 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if(adSize.w == 0 || adSize.h == 0)
|
||||
SDL_ANDROID_GetAdvertisementParams(NULL, &adSize);
|
||||
int adX = abs(x_offs / 100) % (physicalW - adSize.w);
|
||||
int adY = abs(y_offs / 80) % (physicalH - adSize.h);
|
||||
SDL_ANDROID_SetAdvertisementPosition(adX, adY);
|
||||
SDL_Rect adRect;
|
||||
adRect.x = adX * SCREEN_W / physicalW;
|
||||
adRect.w = adSize.w * SCREEN_W / physicalW;
|
||||
adRect.y = adY * SCREEN_H / physicalH;
|
||||
adRect.h = adSize.h * SCREEN_H / physicalH;
|
||||
SDL_FillRect(screen, &adRect, 0xff0);
|
||||
|
||||
print_num(screen, font, screen->w-37, screen->h-12, fps);
|
||||
++fps_count;
|
||||
|
||||
@@ -607,6 +595,7 @@ int main(int argc, char* argv[])
|
||||
SDL_FillRect(screen, &r, 0xaaaaaa);
|
||||
print_num(screen, font, r.x, r.y, i+1);
|
||||
}
|
||||
int adX, adY;
|
||||
int mx, my;
|
||||
int b = SDL_GetMouseState(&mx, &my);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Mouse buttons: %d", b);
|
||||
@@ -620,7 +609,26 @@ int main(int argc, char* argv[])
|
||||
color |= 0x1f0;
|
||||
if( b & SDL_BUTTON_MMASK )
|
||||
color |= 0x0f;
|
||||
|
||||
adX = mx * physicalW / SCREEN_W - adSize.w - 10;
|
||||
adY = my * physicalH / SCREEN_H - adSize.h - 10;
|
||||
SDL_ANDROID_SetAdvertisementPosition(adX, adY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(adSize.w == 0 || adSize.h == 0)
|
||||
SDL_ANDROID_GetAdvertisementParams(NULL, &adSize);
|
||||
adX = abs(x_offs / 100) % (physicalW - adSize.w);
|
||||
adY = abs(y_offs / 80) % (physicalH - adSize.h);
|
||||
SDL_ANDROID_SetAdvertisementPosition(adX, adY);
|
||||
}
|
||||
SDL_Rect adRect;
|
||||
adRect.x = adX * SCREEN_W / physicalW;
|
||||
adRect.w = adSize.w * SCREEN_W / physicalW;
|
||||
adRect.y = adY * SCREEN_H / physicalH;
|
||||
adRect.h = adSize.h * SCREEN_H / physicalH;
|
||||
SDL_FillRect(screen, &adRect, 0xff0);
|
||||
|
||||
r.x = mx;
|
||||
r.y = my;
|
||||
r.w = 30;
|
||||
|
||||
10
project/jni/application/vcmi-r2387/.gitignore
vendored
Normal file
10
project/jni/application/vcmi-r2387/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
libvcmi.so
|
||||
libvcmi.a
|
||||
AI
|
||||
Scripting
|
||||
debug
|
||||
out
|
||||
vcmiserver
|
||||
vcmiserver.zip
|
||||
build.log
|
||||
AndroidData/binaries.zip
|
||||
55
project/jni/application/vcmi-r2387/AndroidAppSettings.cfg
Normal file
55
project/jni/application/vcmi-r2387/AndroidAppSettings.cfg
Normal file
@@ -0,0 +1,55 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=17
|
||||
LibSdlVersion=1.2
|
||||
AppName="VCMI"
|
||||
AppFullName=eu.vcmi
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="!Data files|data1.zip^!Data files|data2.zip^!Data files|data3.zip^"
|
||||
VideoDepthBpp=16
|
||||
NeedDepthBuffer=n
|
||||
NeedStencilBuffer=n
|
||||
NeedGles2=n
|
||||
SwVideoMode=y
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=y
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
CompatibilityHacksPreventAudioChopping=n
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=n
|
||||
CompatibilityHacksAdditionalPreloadedSharedLibraries="vcmi"
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=y
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppUsesAccelerometer=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="LALT RETURN NO_REMAP NO_REMAP E"
|
||||
AppTouchscreenKeyboardKeysAmount=0
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions='OptionalDownloadConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=y
|
||||
AppMinimumRAM=64
|
||||
AppVersionCode=08605
|
||||
AppVersionName="0.86.05"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag libsdl-DownloadFinished-1.flag libsdl-DownloadFinished-2.flag libsdl-DownloadFinished-3.flag libsdl-DownloadFinished-4.flag libsdl-DownloadFinished-5.flag"
|
||||
CompiledLibraries="mad sdl_mixer sdl_image sdl_ttf avutil avcore avcodec avformat swscale boost_program_options boost_filesystem boost_iostreams boost_system boost_thread android"
|
||||
CustomBuildScript=y
|
||||
AppCflags=''
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild=''
|
||||
AppCmdline=''
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
MinimumScreenSize=s
|
||||
AdmobPublisherId=n
|
||||
AdmobTestDeviceId=
|
||||
AdmobBannerSize=
|
||||
7
project/jni/application/vcmi-r2387/AndroidBuild.sh
Executable file
7
project/jni/application/vcmi-r2387/AndroidBuild.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# For some reason I'm getting errors with "make -j4"
|
||||
make -k ARCH=$1 || exit 1
|
||||
[ -f libapplication-$1.so ] || exit 1
|
||||
[ -e libapplication.so ] || ln -s libapplication-armeabi.so libapplication.so
|
||||
exit 0
|
||||
BIN
project/jni/application/vcmi-r2387/AndroidData/data1.zip
Normal file
BIN
project/jni/application/vcmi-r2387/AndroidData/data1.zip
Normal file
Binary file not shown.
BIN
project/jni/application/vcmi-r2387/AndroidData/data2.zip
Normal file
BIN
project/jni/application/vcmi-r2387/AndroidData/data2.zip
Normal file
Binary file not shown.
BIN
project/jni/application/vcmi-r2387/AndroidData/data3.zip
Normal file
BIN
project/jni/application/vcmi-r2387/AndroidData/data3.zip
Normal file
Binary file not shown.
99
project/jni/application/vcmi-r2387/Makefile
Normal file
99
project/jni/application/vcmi-r2387/Makefile
Normal file
@@ -0,0 +1,99 @@
|
||||
ifeq ($(ARCH),)
|
||||
ARCH:=armeabi
|
||||
endif
|
||||
|
||||
$(shell mkdir -p $(ARCH)/AI debug/$(ARCH)/AI $(ARCH)/Scripting debug/$(ARCH)/Scripting \
|
||||
$(ARCH)/out/vcmi/lib $(ARCH)/out/vcmi/server $(ARCH)/out/vcmi/AI/StupidAI \
|
||||
$(ARCH)/out/vcmi/AI/GeniusAI $(ARCH)/out/vcmi/client $(ARCH)/out/vcmi/Scripting/ERM)
|
||||
|
||||
LOCAL_PATH:=$(shell dirname $0)
|
||||
LOCAL_PATH:=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
SOURCES_LIB:=$(wildcard vcmi/lib/*.cpp vcmi/CConsoleHandler.cpp vcmi/CThreadHelper.cpp)
|
||||
OBJS_LIB:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_LIB))
|
||||
|
||||
SOURCES_SERVER:=$(wildcard vcmi/server/*.cpp)
|
||||
OBJS_SERVER:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_SERVER))
|
||||
|
||||
SOURCES_STUPIDAI:=$(wildcard vcmi/AI/StupidAI/*.cpp)
|
||||
OBJS_STUPIDAI:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_STUPIDAI))
|
||||
|
||||
SOURCES_GENIUSAI:=$(filter-out %/ExpertSystem.cpp, $(wildcard vcmi/AI/GeniusAI/*.cpp))
|
||||
OBJS_GENIUSAI:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_GENIUSAI))
|
||||
|
||||
SOURCES_ERM:=$(wildcard vcmi/Scripting/ERM/*.cpp)
|
||||
OBJS_ERM:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_ERM))
|
||||
|
||||
SOURCES_CLIENT:=$(wildcard vcmi/client/*.cpp vcmi/CCallback.cpp)
|
||||
OBJS_CLIENT:=$(patsubst %.cpp, $(ARCH)/out/%.o, $(SOURCES_CLIENT))
|
||||
|
||||
all: AndroidData/binaries-$(ARCH).zip libapplication-$(ARCH).so
|
||||
|
||||
AndroidData/binaries-$(ARCH).zip: $(ARCH)/vcmiserver $(ARCH)/AI/libGeniusAI.so $(ARCH)/AI/libStupidAI.so $(ARCH)/Scripting/libvcmiERM.so # $(ARCH)/libvcmi.so
|
||||
rm -f $@
|
||||
cd $(ARCH) && zip -r ../$@ $(foreach F, $^, $(patsubst $(ARCH)/%,%,$(F)))
|
||||
|
||||
$(OBJS_SERVER) $(OBJS_LIB) $(OBJS_GENIUSAI) $(OBJS_STUPIDAI) $(OBJS_CLIENT) $(OBJS_ERM): $(ARCH)/out/%.o: %.cpp
|
||||
../setEnvironment-$(ARCH).sh sh -c \
|
||||
"\$$CXX \
|
||||
-c \$$CXXFLAGS -Ivcmi -Ivcmi/lib \
|
||||
-DDATA_DIR=\\\"/sdcard/Android/data/eu.vcmi/files\\\" \
|
||||
-DBIN_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-DLIB_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-DWITH_AVCODEC_DECODE_VIDEO2=1 \
|
||||
-Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress \
|
||||
$< -o $@"
|
||||
# -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address
|
||||
|
||||
#ALLOW_UNRESOLVED_SYMBOLS=1
|
||||
LINK_LIB= \
|
||||
env NO_SHARED_LIBS=1 SHARED_LIBRARY_NAME=`basename $@` ../setEnvironment-$(ARCH).sh sh -c \
|
||||
"echo SHARED_LIBRARY_NAME \$$SHARED_LIBRARY_NAME && \$$CXX \
|
||||
-Wl,--whole-archive $^ -Wl,--no-whole-archive -o $@ \
|
||||
\$$LDFLAGS -L$(ARCH) \
|
||||
-lboost_filesystem -lboost_iostreams -lboost_system -lboost_thread && \
|
||||
cp $@ debug/$@ && \
|
||||
\$$STRIP --strip-unneeded $@"
|
||||
|
||||
#$(ARCH)/libvcmi.a: $(OBJS_LIB)
|
||||
# ar rcs $@ $^
|
||||
|
||||
$(ARCH)/libvcmi.so: $(OBJS_LIB)
|
||||
$(LINK_LIB)
|
||||
|
||||
-lvcmi: $(ARCH)/libvcmi.so
|
||||
cp -f $^ ../../../libs/$^
|
||||
|
||||
.PHONY: -lvcmi
|
||||
|
||||
$(ARCH)/AI/libGeniusAI.so: $(OBJS_GENIUSAI) -lvcmi
|
||||
$(LINK_LIB)
|
||||
|
||||
$(ARCH)/AI/libStupidAI.so: $(OBJS_STUPIDAI) -lvcmi
|
||||
$(LINK_LIB)
|
||||
|
||||
$(ARCH)/Scripting/libvcmiERM.so: $(OBJS_ERM) -lvcmi
|
||||
$(LINK_LIB)
|
||||
|
||||
$(ARCH)/vcmiserver: $(OBJS_SERVER) -lvcmi
|
||||
env BUILD_EXECUTABLE=1 NO_SHARED_LIBS=1 ../setEnvironment-$(ARCH).sh sh -c \
|
||||
"\$$CXX \
|
||||
-Wl,--whole-archive $^ -Wl,--no-whole-archive -o $@ \
|
||||
\$$LDFLAGS -L$(ARCH) -Wl,-rpath,/data/data/eu.vcmi/lib \
|
||||
-lboost_filesystem -lboost_iostreams -lboost_system -lboost_thread && \
|
||||
cp $@ debug/$@ && \
|
||||
\$$STRIP --strip-unneeded $@"
|
||||
|
||||
libapplication-$(ARCH).so: $(OBJS_CLIENT) -lvcmi
|
||||
env ../setEnvironment-$(ARCH).sh sh -c \
|
||||
"\$$CXX \
|
||||
-Wl,--whole-archive $^ -Wl,--no-whole-archive -o $@ \
|
||||
\$$LDFLAGS -L$(ARCH) \
|
||||
-lboost_filesystem -lboost_iostreams -lboost_system -lboost_thread -lboost_program_options && \
|
||||
cp $@ debug/$@"
|
||||
# No need to strip, it's done inside build.sh script
|
||||
|
||||
clean:
|
||||
rm -rf armeabi* debug AndroidData/binaries-*.zip libapplication*.so
|
||||
|
||||
.PHONY: clean
|
||||
BIN
project/jni/application/vcmi-r2387/icon.png
Normal file
BIN
project/jni/application/vcmi-r2387/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
14
project/jni/application/vcmi-r2387/readme.txt
Normal file
14
project/jni/application/vcmi-r2387/readme.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Quick compilation guide:
|
||||
Download my GIT repo from https://github.com/pelya/commandergenius,
|
||||
then install Android SDK from http://developer.android.com,
|
||||
NDK r8d from http://crystax.net/ and "ant" tool, then launch commands
|
||||
android update project -p project
|
||||
rm project/jni/application/src
|
||||
ln -s vcmi project/jni/application/src
|
||||
echo > project/jni/application/vcmi/libvcmi.so
|
||||
then download VCMI revision 2387 into the dir project/jni/application/vcmi/vcmi
|
||||
(or create a symlink to it if you already have downloaded it), then apply patch vcmi-android.diff,
|
||||
then launch build.sh.
|
||||
|
||||
To run it you should have complete installation of Heroes 3: Wake of Gods on your SD card on your device,
|
||||
in the directory Android/data/eu.vcmi/files
|
||||
1
project/jni/application/vcmi-r2387/vcmi
Symbolic link
1
project/jni/application/vcmi-r2387/vcmi
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../../vcmi
|
||||
1590
project/jni/application/vcmi-r2387/vcmi-android.diff
Normal file
1590
project/jni/application/vcmi-r2387/vcmi-android.diff
Normal file
File diff suppressed because it is too large
Load Diff
@@ -37,13 +37,13 @@ HiddenMenuOptions='KeyboardConfigMainMenu AudioConfig OptionalDownloadConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppMinimumRAM=64
|
||||
AppVersionCode=08604
|
||||
AppVersionName="0.86.04"
|
||||
AppVersionCode=09000
|
||||
AppVersionName="0.90.00"
|
||||
ResetSdlConfigForThisVersion=y
|
||||
DeleteFilesOnUpgrade=""
|
||||
CompiledLibraries="mad sdl_mixer sdl_image sdl_ttf avutil avcore avcodec avformat swscale boost_program_options boost_filesystem boost_iostreams boost_system boost_thread vcmi android"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-DDATA_DIR=\"/sdcard/app-data/eu.vcmi\" -DBIN_DIR=\"/data/data/eu.vcmi/files\" -DLIB_DIR=\"/data/data/eu.vcmi/files\" -DWITH_AVCODEC_DECODE_VIDEO2=1 -Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress'
|
||||
CustomBuildScript=y
|
||||
AppCflags='-DM_DATA_DIR=\"/sdcard/app-data/eu.vcmi\" -DM_BIN_DIR=\"/data/data/eu.vcmi/files\" -DM_LIB_DIR=\"/data/data/eu.vcmi/files\" -DWITH_AVCODEC_DECODE_VIDEO2=1 -Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress'
|
||||
AppLdflags='-lz -Ljni/application/vcmi -lvcmi'
|
||||
AppSubdirsBuild='vcmi/client vcmi/CCallback.cpp'
|
||||
AppCmdline=''
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ $(shell rm -f ../../../obj/local/armeabi/libvcmi.so)
|
||||
LOCAL_PATH=$(shell dirname $0)
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
GCC_PREFIX=$(if $(shell which ndk-build | grep 'android-ndk-r5'),arm-linux-androideabi,arm-eabi)
|
||||
GCC_PREFIX=$(if $(shell which ndk-build | grep 'android-ndk-r8'),arm-linux-androideabi,arm-eabi)
|
||||
|
||||
SOURCES_LIB=$(wildcard vcmi/lib/*.cpp vcmi/lib/Filesystem/*.cpp vcmi/CConsoleHandler.cpp vcmi/CThreadHelper.cpp)
|
||||
OBJS_LIB=$(patsubst %.cpp, out/%.o, $(SOURCES_LIB))
|
||||
@@ -39,7 +39,10 @@ OBJS_VCAI=$(patsubst %.cpp, out/%.o, $(SOURCES_VCAI))
|
||||
SOURCES_ERM=$(wildcard vcmi/Scripting/ERM/*.cpp)
|
||||
OBJS_ERM=$(patsubst %.cpp, out/%.o, $(SOURCES_ERM))
|
||||
|
||||
all: AndroidData/binaries.zip
|
||||
SOURCES_CLIENT=$(wildcard vcmi/client/*.cpp vcmi/CCallback.cpp)
|
||||
OBJS_CLIENT=$(patsubst %.cpp, out/%.o, $(SOURCES_CLIENT))
|
||||
|
||||
all: AndroidData/binaries.zip libapplication.so
|
||||
|
||||
AndroidData/binaries.zip: vcmiserver AI/libGeniusAI.so AI/libStupidAI.so Scripting/libvcmiERM.so
|
||||
rm -f $@
|
||||
@@ -48,10 +51,10 @@ AndroidData/binaries.zip: vcmiserver AI/libGeniusAI.so AI/libStupidAI.so Scripti
|
||||
$(OBJS_SERVER) $(OBJS_LIB) $(OBJS_BATTLEAI) $(OBJS_EMPTYAI) $(OBJS_FUZZYLITE) $(OBJS_STUPIDAI) $(OBJS_VCAI) $(OBJS_CLIENT) $(OBJS_ERM): out/%.o: %.cpp
|
||||
../setEnvironment.sh sh -c \
|
||||
"$(GCC_PREFIX)-g++ \
|
||||
-c \$$CXXFLAGS -Ivcmi -Ivcmi/lib \
|
||||
-DDATA_DIR=\\\"/sdcard/app-data/eu.vcmi\\\" \
|
||||
-DBIN_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-DLIB_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-c \$$CXXFLAGS -Ivcmi -std=c++11 -Ivcmi/lib \
|
||||
-DM_DATA_DIR=\\\"/sdcard/app-data/eu.vcmi\\\" \
|
||||
-DM_BIN_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-DM_LIB_DIR=\\\"/data/data/eu.vcmi/files\\\" \
|
||||
-DWITH_AVCODEC_DECODE_VIDEO2=1 \
|
||||
-Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress \
|
||||
$< -o $@"
|
||||
@@ -87,6 +90,11 @@ Scripting/libvcmiERM.so: $(OBJS_ERM) -lvcmi
|
||||
libvcmi.so: $(OBJS_LIB)
|
||||
$(LINK_LIB)
|
||||
|
||||
libapplication.so: $(OBJS_CLIENT) libvcmi.so
|
||||
env BUILD_EXECUTABLE=1 ../setEnvironment.sh sh -c \
|
||||
"$(GCC_PREFIX)-g++ $^ -o $@ \
|
||||
\$$LDFLAGS -L. -lvcmi -lboost_filesystem -lboost_iostreams -lboost_system -lboost_thread"
|
||||
|
||||
clean:
|
||||
rm -rf out debug *.so vcmiserver* AndroidData/vcmiserver* libapplication.so AI Scripting
|
||||
|
||||
|
||||
@@ -7,18 +7,7 @@ ifneq ($(LOCAL_MODULE),boost)
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
ifneq ($(NDK_R5_TOOLCHAIN),)
|
||||
LOCAL_SRC_FILES := lib/arm-linux-androideabi-4.4.3/lib$(LOCAL_MODULE).a
|
||||
LOCAL_SRC_FILES := lib/arm-linux-androideabi-4.6/lib$(LOCAL_MODULE).a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
else
|
||||
LOCAL_SRC_FILES := dummy.c
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
$(abspath $(LOCAL_PATH)/../../obj/local/armeabi/lib$(LOCAL_MODULE).a): $(LOCAL_PATH)/lib/arm-eabi-4.4.0/lib$(LOCAL_MODULE).a OVERRIDE_CUSTOM_LIB
|
||||
cp -f $< $@
|
||||
$(abspath $(LOCAL_PATH)/../../obj/local/armeabi-v7a/lib$(LOCAL_MODULE).a): $(LOCAL_PATH)/lib/arm-eabi-4.4.0/lib$(LOCAL_MODULE).a OVERRIDE_CUSTOM_LIB
|
||||
cp -f $< $@
|
||||
.PHONY: OVERRIDE_CUSTOM_LIB
|
||||
OVERRIDE_CUSTOM_LIB:
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
int
|
||||
SDL_main(int argc, char *argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)
|
||||
#endif
|
||||
|
||||
#define BOOST_ACCUMULATORS_GCC_VERSION \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <limits>
|
||||
#include <functional>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
@@ -277,6 +278,8 @@ namespace boost { namespace numeric
|
||||
struct as_min_base
|
||||
: std::unary_function<Arg, typename remove_const<Arg>::type>
|
||||
{
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
|
||||
|
||||
typename remove_const<Arg>::type operator ()(Arg &) const
|
||||
{
|
||||
return (std::numeric_limits<typename remove_const<Arg>::type>::min)();
|
||||
@@ -287,6 +290,8 @@ namespace boost { namespace numeric
|
||||
struct as_min_base<Arg, typename enable_if<is_floating_point<Arg> >::type>
|
||||
: std::unary_function<Arg, typename remove_const<Arg>::type>
|
||||
{
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
|
||||
|
||||
typename remove_const<Arg>::type operator ()(Arg &) const
|
||||
{
|
||||
return -(std::numeric_limits<typename remove_const<Arg>::type>::max)();
|
||||
@@ -297,6 +302,8 @@ namespace boost { namespace numeric
|
||||
struct as_max_base
|
||||
: std::unary_function<Arg, typename remove_const<Arg>::type>
|
||||
{
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized);
|
||||
|
||||
typename remove_const<Arg>::type operator ()(Arg &) const
|
||||
{
|
||||
return (std::numeric_limits<typename remove_const<Arg>::type>::max)();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <boost/accumulators/statistics/skewness.hpp>
|
||||
#include <boost/accumulators/statistics/stats.hpp>
|
||||
#include <boost/accumulators/statistics/sum.hpp>
|
||||
#include <boost/accumulators/statistics/sum_kahan.hpp>
|
||||
#include <boost/accumulators/statistics/tail.hpp>
|
||||
#include <boost/accumulators/statistics/tail_quantile.hpp>
|
||||
#include <boost/accumulators/statistics/tail_mean.hpp>
|
||||
@@ -48,6 +49,7 @@
|
||||
#include <boost/accumulators/statistics/weighted_p_square_quantile.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_skewness.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_sum.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_sum_kahan.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_tail_quantile.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_tail_mean.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_tail_variate_means.hpp>
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// sum_kahan.hpp
|
||||
//
|
||||
// Copyright 2010 Gaetano Mendola, 2011 Simon West. Distributed under the 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_SUM_KAHAN_HPP_EAN_26_07_2010
|
||||
#define BOOST_ACCUMULATORS_STATISTICS_SUM_KAHAN_HPP_EAN_26_07_2010
|
||||
|
||||
#include <boost/accumulators/framework/accumulator_base.hpp>
|
||||
#include <boost/accumulators/framework/parameters/sample.hpp>
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/sum.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_sum_kahan.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
|
||||
namespace impl
|
||||
{
|
||||
|
||||
#if _MSC_VER > 1400
|
||||
# pragma float_control(push)
|
||||
# pragma float_control(precise, on)
|
||||
#endif
|
||||
|
||||
template<typename Sample, typename Tag>
|
||||
struct sum_kahan_impl
|
||||
: accumulator_base
|
||||
{
|
||||
typedef Sample result_type;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// sum_kahan_impl
|
||||
/**
|
||||
@brief Kahan summation algorithm
|
||||
|
||||
The Kahan summation algorithm reduces the numerical error obtained with standard
|
||||
sequential sum.
|
||||
|
||||
*/
|
||||
template<typename Args>
|
||||
sum_kahan_impl(Args const & args)
|
||||
: sum(args[parameter::keyword<Tag>::get() | Sample()]),
|
||||
compensation(boost::numeric_cast<Sample>(0.0))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename Args>
|
||||
void
|
||||
#if BOOST_ACCUMULATORS_GCC_VERSION > 40305
|
||||
__attribute__((__optimize__("no-associative-math")))
|
||||
#endif
|
||||
operator ()(Args const & args)
|
||||
{
|
||||
const Sample myTmp1 = args[parameter::keyword<Tag>::get()] - this->compensation;
|
||||
const Sample myTmp2 = this->sum + myTmp1;
|
||||
this->compensation = (myTmp2 - this->sum) - myTmp1;
|
||||
this->sum = myTmp2;
|
||||
}
|
||||
|
||||
result_type result(dont_care) const
|
||||
{
|
||||
return this->sum;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample sum;
|
||||
Sample compensation;
|
||||
};
|
||||
|
||||
#if _MSC_VER > 1400
|
||||
# pragma float_control(pop)
|
||||
#endif
|
||||
|
||||
} // namespace impl
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// tag::sum_kahan
|
||||
// tag::sum_of_weights_kahan
|
||||
// tag::sum_of_variates_kahan
|
||||
//
|
||||
namespace tag
|
||||
{
|
||||
|
||||
struct sum_kahan
|
||||
: depends_on<>
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef impl::sum_kahan_impl< mpl::_1, tag::sample > impl;
|
||||
};
|
||||
|
||||
struct sum_of_weights_kahan
|
||||
: depends_on<>
|
||||
{
|
||||
typedef mpl::true_ is_weight_accumulator;
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef accumulators::impl::sum_kahan_impl<mpl::_2, tag::weight> impl;
|
||||
};
|
||||
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct sum_of_variates_kahan
|
||||
: depends_on<>
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef mpl::always<accumulators::impl::sum_kahan_impl<VariateType, VariateTag> > impl;
|
||||
};
|
||||
|
||||
} // namespace tag
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// extract::sum_kahan
|
||||
// extract::sum_of_weights_kahan
|
||||
// extract::sum_of_variates_kahan
|
||||
//
|
||||
namespace extract
|
||||
{
|
||||
extractor<tag::sum_kahan> const sum_kahan = {};
|
||||
extractor<tag::sum_of_weights_kahan> const sum_of_weights_kahan = {};
|
||||
extractor<tag::abstract_sum_of_variates> const sum_of_variates_kahan = {};
|
||||
|
||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_kahan)
|
||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_weights_kahan)
|
||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_variates_kahan)
|
||||
} // namespace extract
|
||||
|
||||
using extract::sum_kahan;
|
||||
using extract::sum_of_weights_kahan;
|
||||
using extract::sum_of_variates_kahan;
|
||||
|
||||
// sum(kahan) -> sum_kahan
|
||||
template<>
|
||||
struct as_feature<tag::sum(kahan)>
|
||||
{
|
||||
typedef tag::sum_kahan type;
|
||||
};
|
||||
|
||||
// sum_of_weights(kahan) -> sum_of_weights_kahan
|
||||
template<>
|
||||
struct as_feature<tag::sum_of_weights(kahan)>
|
||||
{
|
||||
typedef tag::sum_of_weights_kahan type;
|
||||
};
|
||||
|
||||
// So that sum_kahan can be automatically substituted with
|
||||
// weighted_sum_kahan when the weight parameter is non-void.
|
||||
template<>
|
||||
struct as_weighted_feature<tag::sum_kahan>
|
||||
{
|
||||
typedef tag::weighted_sum_kahan type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct feature_of<tag::weighted_sum_kahan>
|
||||
: feature_of<tag::sum>
|
||||
{};
|
||||
|
||||
// for the purposes of feature-based dependency resolution,
|
||||
// sum_kahan provides the same feature as sum
|
||||
template<>
|
||||
struct feature_of<tag::sum_kahan>
|
||||
: feature_of<tag::sum>
|
||||
{
|
||||
};
|
||||
|
||||
// for the purposes of feature-based dependency resolution,
|
||||
// sum_of_weights_kahan provides the same feature as sum_of_weights
|
||||
template<>
|
||||
struct feature_of<tag::sum_of_weights_kahan>
|
||||
: feature_of<tag::sum_of_weights>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct feature_of<tag::sum_of_variates_kahan<VariateType, VariateTag> >
|
||||
: feature_of<tag::abstract_sum_of_variates>
|
||||
{
|
||||
};
|
||||
|
||||
}} // namespace boost::accumulators
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_QUANTILE_HPP_DE_01_01_2006
|
||||
#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_QUANTILE_HPP_DE_01_01_2006
|
||||
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// weighted_sum_kahan.hpp
|
||||
//
|
||||
// Copyright 2011 Simon West. Distributed under the 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_SUM_KAHAN_HPP_EAN_11_05_2011
|
||||
#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_SUM_KAHAN_HPP_EAN_11_05_2011
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/accumulators/framework/accumulator_base.hpp>
|
||||
#include <boost/accumulators/framework/extractor.hpp>
|
||||
#include <boost/accumulators/numeric/functional.hpp>
|
||||
#include <boost/accumulators/framework/parameters/sample.hpp>
|
||||
#include <boost/accumulators/framework/parameters/weight.hpp>
|
||||
#include <boost/accumulators/framework/accumulators/external_accumulator.hpp>
|
||||
#include <boost/accumulators/framework/depends_on.hpp>
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/weighted_sum.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
|
||||
namespace impl
|
||||
{
|
||||
#if _MSC_VER > 1400
|
||||
# pragma float_control(push)
|
||||
# pragma float_control(precise, on)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// weighted_sum_kahan_impl
|
||||
template<typename Sample, typename Weight, typename Tag>
|
||||
struct weighted_sum_kahan_impl
|
||||
: accumulator_base
|
||||
{
|
||||
typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample;
|
||||
|
||||
// for boost::result_of
|
||||
typedef weighted_sample result_type;
|
||||
|
||||
template<typename Args>
|
||||
weighted_sum_kahan_impl(Args const &args)
|
||||
: weighted_sum_(
|
||||
args[parameter::keyword<Tag>::get() | Sample()] * numeric::one<Weight>::value),
|
||||
compensation(boost::numeric_cast<weighted_sample>(0.0))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename Args>
|
||||
void
|
||||
#if BOOST_ACCUMULATORS_GCC_VERSION > 40305
|
||||
__attribute__((__optimize__("no-associative-math")))
|
||||
#endif
|
||||
operator ()(Args const &args)
|
||||
{
|
||||
const weighted_sample myTmp1 = args[parameter::keyword<Tag>::get()] * args[weight] - this->compensation;
|
||||
const weighted_sample myTmp2 = this->weighted_sum_ + myTmp1;
|
||||
this->compensation = (myTmp2 - this->weighted_sum_) - myTmp1;
|
||||
this->weighted_sum_ = myTmp2;
|
||||
|
||||
}
|
||||
|
||||
result_type result(dont_care) const
|
||||
{
|
||||
return this->weighted_sum_;
|
||||
}
|
||||
|
||||
private:
|
||||
weighted_sample weighted_sum_;
|
||||
weighted_sample compensation;
|
||||
};
|
||||
|
||||
#if _MSC_VER > 1400
|
||||
# pragma float_control(pop)
|
||||
#endif
|
||||
|
||||
} // namespace impl
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// tag::weighted_sum_kahan
|
||||
// tag::weighted_sum_of_variates_kahan
|
||||
//
|
||||
namespace tag
|
||||
{
|
||||
struct weighted_sum_kahan
|
||||
: depends_on<>
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef accumulators::impl::weighted_sum_kahan_impl<mpl::_1, mpl::_2, tag::sample> impl;
|
||||
};
|
||||
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct weighted_sum_of_variates_kahan
|
||||
: depends_on<>
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
typedef accumulators::impl::weighted_sum_kahan_impl<VariateType, mpl::_2, VariateTag> impl;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// extract::weighted_sum_kahan
|
||||
// extract::weighted_sum_of_variates_kahan
|
||||
//
|
||||
namespace extract
|
||||
{
|
||||
extractor<tag::weighted_sum_kahan> const weighted_sum_kahan = {};
|
||||
extractor<tag::abstract_weighted_sum_of_variates> const weighted_sum_of_variates_kahan = {};
|
||||
|
||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum_kahan)
|
||||
BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum_of_variates_kahan)
|
||||
}
|
||||
|
||||
using extract::weighted_sum_kahan;
|
||||
using extract::weighted_sum_of_variates_kahan;
|
||||
|
||||
// weighted_sum(kahan) -> weighted_sum_kahan
|
||||
template<>
|
||||
struct as_feature<tag::weighted_sum(kahan)>
|
||||
{
|
||||
typedef tag::weighted_sum_kahan type;
|
||||
};
|
||||
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct feature_of<tag::weighted_sum_of_variates_kahan<VariateType, VariateTag> >
|
||||
: feature_of<tag::abstract_weighted_sum_of_variates>
|
||||
{
|
||||
};
|
||||
|
||||
}} // namespace boost::accumulators
|
||||
|
||||
#endif
|
||||
@@ -109,6 +109,10 @@ namespace tag
|
||||
struct sum_of_weights;
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct sum_of_variates;
|
||||
struct sum_kahan;
|
||||
struct sum_of_weights_kahan;
|
||||
template<typename VariateType, typename VariateTag>
|
||||
struct sum_of_variates_kahan;
|
||||
template<typename LeftRight>
|
||||
struct tail;
|
||||
template<typename LeftRight>
|
||||
@@ -263,6 +267,9 @@ namespace impl
|
||||
template<typename Sample, typename Tag = tag::sample>
|
||||
struct sum_impl;
|
||||
|
||||
template<typename Sample, typename Tag>
|
||||
struct sum_kahan_impl;
|
||||
|
||||
template<typename Sample, typename LeftRight>
|
||||
struct tail_impl;
|
||||
|
||||
@@ -338,6 +345,9 @@ namespace impl
|
||||
template<typename Sample, typename Weight, typename Tag>
|
||||
struct weighted_sum_impl;
|
||||
|
||||
template<typename Sample, typename Weight, typename Tag>
|
||||
struct weighted_sum_kahan_impl;
|
||||
|
||||
template<typename Sample, typename Weight, typename LeftRight>
|
||||
struct non_coherent_weighted_tail_mean_impl;
|
||||
|
||||
@@ -414,6 +424,9 @@ struct quadratic {};
|
||||
struct regular {};
|
||||
struct for_median {};
|
||||
|
||||
// modifier for sum_kahan, sum_of_weights_kahan, sum_of_variates_kahan, weighted_sum_kahan
|
||||
struct kahan {};
|
||||
|
||||
}} // namespace boost::accumulators
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <locale>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
@@ -37,7 +39,7 @@ namespace boost {
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::tolower( Ch);
|
||||
return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::tolower<CharT>( Ch, *m_Loc );
|
||||
#endif
|
||||
@@ -57,7 +59,7 @@ namespace boost {
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper( Ch);
|
||||
return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::toupper<CharT>( Ch, *m_Loc );
|
||||
#endif
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
// Use fixed storage
|
||||
::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size);
|
||||
::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -206,7 +206,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
// Copy the data
|
||||
::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size);
|
||||
::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -74,17 +74,17 @@ namespace boost {
|
||||
const InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult )
|
||||
{
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,14 +137,14 @@ namespace boost {
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return Input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// replace implementation ----------------------------------------------------//
|
||||
@@ -189,12 +189,12 @@ namespace boost {
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
::boost::algorithm::detail::find_format_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
::boost::algorithm::detail::find_format_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -84,18 +84,18 @@ namespace boost {
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult )
|
||||
{
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find_format_all_copy implementation ----------------------------------------------//
|
||||
@@ -161,15 +161,15 @@ namespace boost {
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return Input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find_format_all implementation ------------------------------------------------//
|
||||
@@ -257,13 +257,13 @@ namespace boost {
|
||||
FindResultT FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
::boost::algorithm::detail::find_format_all_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
::boost::algorithm::detail::find_format_all_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace boost {
|
||||
{
|
||||
iterator_range<ForwardIteratorT>::operator=(FindResult);
|
||||
if( !this->empty() ) {
|
||||
m_FormatResult=m_Formatter(FindResult);
|
||||
m_FormatResult=m_Formatter(FindResult);
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
||||
@@ -87,6 +87,31 @@ namespace boost {
|
||||
}
|
||||
};
|
||||
|
||||
// dissect format functor ----------------------------------------------------//
|
||||
|
||||
// dissect format functor
|
||||
template<typename FinderT>
|
||||
struct dissect_formatF
|
||||
{
|
||||
public:
|
||||
// Construction
|
||||
dissect_formatF(FinderT Finder) :
|
||||
m_Finder(Finder) {}
|
||||
|
||||
// Operation
|
||||
template<typename RangeT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
operator()(const RangeT& Replace) const
|
||||
{
|
||||
return m_Finder(::boost::begin(Replace), ::boost::end(Replace));
|
||||
}
|
||||
|
||||
private:
|
||||
FinderT m_Finder;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
@@ -259,7 +259,11 @@ namespace boost {
|
||||
m_End(End),
|
||||
m_bEof(false)
|
||||
{
|
||||
increment();
|
||||
// force the correct behavior for empty sequences and yield at least one token
|
||||
if(Begin!=End)
|
||||
{
|
||||
increment();
|
||||
}
|
||||
}
|
||||
//! Constructor
|
||||
/*!
|
||||
@@ -278,7 +282,11 @@ namespace boost {
|
||||
m_Next=::boost::begin(lit_col);
|
||||
m_End=::boost::end(lit_col);
|
||||
|
||||
increment();
|
||||
// force the correct behavior for empty sequences and yield at least one token
|
||||
if(m_Next!=m_End)
|
||||
{
|
||||
increment();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace boost {
|
||||
|
||||
//! Constant formatter
|
||||
/*!
|
||||
Construct the \c const_formatter. Const formatter always returns
|
||||
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
|
||||
@@ -55,7 +55,7 @@ namespace boost {
|
||||
|
||||
//! Identity formatter
|
||||
/*!
|
||||
Construct the \c identity_formatter. Identity formatter always returns
|
||||
Constructs an \c identity_formatter. Identity formatter always returns
|
||||
the parameter.
|
||||
|
||||
\return An instance of the \c identity_formatter object.
|
||||
@@ -73,7 +73,7 @@ namespace boost {
|
||||
|
||||
//! Empty formatter
|
||||
/*!
|
||||
Construct the \c empty_formatter. Empty formatter always returns an empty
|
||||
Constructs an \c empty_formatter. Empty formatter always returns an empty
|
||||
sequence.
|
||||
|
||||
\param Input container used to select a correct value_type for the
|
||||
@@ -89,6 +89,22 @@ namespace boost {
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>();
|
||||
}
|
||||
|
||||
//! Empty formatter
|
||||
/*!
|
||||
Constructs a \c dissect_formatter. Dissect formatter uses a specified finder
|
||||
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
|
||||
\return An instance of the \c dissect_formatter object.
|
||||
*/
|
||||
template<typename FinderT>
|
||||
inline detail::dissect_formatF< FinderT >
|
||||
dissect_formatter(const FinderT& Finder)
|
||||
{
|
||||
return detail::dissect_formatF<FinderT>(Finder);
|
||||
}
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
@@ -96,6 +112,7 @@ namespace boost {
|
||||
using algorithm::const_formatter;
|
||||
using algorithm::identity_formatter;
|
||||
using algorithm::empty_formatter;
|
||||
using algorithm::dissect_formatter;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
217
project/jni/boost/include/boost/algorithm/string/trim_all.hpp
Normal file
217
project/jni/boost/include/boost/algorithm/string/trim_all.hpp
Normal file
@@ -0,0 +1,217 @@
|
||||
// Boost string_algo library trim.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-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 http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_TRIM_ALL_HPP
|
||||
#define BOOST_STRING_TRIM_ALL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <locale>
|
||||
|
||||
/*! \file
|
||||
Defines trim_all algorithms.
|
||||
|
||||
Just like \c trim, \c trim_all removes all trailing and leading spaces from a
|
||||
sequence (string). In addition, spaces in the middle of the sequence are truncated
|
||||
to just one character. Space is recognized using given locales.
|
||||
|
||||
\c trim_fill acts as trim_all, but the spaces in the middle are replaces with
|
||||
a user-define sequence of character.
|
||||
|
||||
Parametric (\c _if) variants use a predicate (functor) to select which characters
|
||||
are to be trimmed..
|
||||
Functions take a selection predicate as a parameter, which is used to determine
|
||||
whether a character is a space. Common predicates are provided in classification.hpp header.
|
||||
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// multi line trim ----------------------------------------------- //
|
||||
|
||||
//! Trim All - parametric
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
compress all other spaces to a single character.
|
||||
The result is a trimmed copy of the input
|
||||
|
||||
\param Input An input sequence
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT, typename PredicateT>
|
||||
inline SequenceT trim_all_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
return
|
||||
::boost::find_format_all_copy(
|
||||
::boost::trim_copy_if(Input, IsSpace),
|
||||
::boost::token_finder(IsSpace, ::boost::token_compress_on),
|
||||
::boost::dissect_formatter(::boost::head_finder(1)));
|
||||
}
|
||||
|
||||
|
||||
//! Trim All
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
compress all other spaces to a single character.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
*/
|
||||
template<typename SequenceT, typename PredicateT>
|
||||
inline void trim_all_if(SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
::boost::trim_if(Input, IsSpace);
|
||||
::boost::find_format_all(
|
||||
Input,
|
||||
::boost::token_finder(IsSpace, ::boost::token_compress_on),
|
||||
::boost::dissect_formatter(::boost::head_finder(1)));
|
||||
}
|
||||
|
||||
|
||||
//! Trim All
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
compress all other spaces to a single character.
|
||||
The result is a trimmed copy of the input
|
||||
|
||||
\param Input An input sequence
|
||||
\param Loc A locale used for 'space' classification
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT trim_all_copy(const SequenceT& Input, const std::locale& Loc =std::locale())
|
||||
{
|
||||
return trim_all_copy_if(Input, ::boost::is_space(Loc));
|
||||
}
|
||||
|
||||
|
||||
//! Trim All
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
compress all other spaces to a single character.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param Loc A locale used for 'space' classification
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline void trim_all(SequenceT& Input, const std::locale& Loc =std::locale())
|
||||
{
|
||||
trim_all_if(Input, ::boost::is_space(Loc));
|
||||
}
|
||||
|
||||
|
||||
//! Trim Fill - parametric
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
replace all every block of consecutive spaces with a fill string
|
||||
defined by user.
|
||||
The result is a trimmed copy of the input
|
||||
|
||||
\param Input An input sequence
|
||||
\param Fill A string used to fill the inner spaces
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT, typename PredicateT>
|
||||
inline SequenceT trim_fill_copy_if(const SequenceT& Input, const RangeT& Fill, PredicateT IsSpace)
|
||||
{
|
||||
return
|
||||
::boost::find_format_all_copy(
|
||||
::boost::trim_copy_if(Input, IsSpace),
|
||||
::boost::token_finder(IsSpace, ::boost::token_compress_on),
|
||||
::boost::const_formatter(::boost::as_literal(Fill)));
|
||||
}
|
||||
|
||||
|
||||
//! Trim Fill
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
replace all every block of consecutive spaces with a fill string
|
||||
defined by user.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param Fill A string used to fill the inner spaces
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT, typename PredicateT>
|
||||
inline void trim_fill_if(SequenceT& Input, const RangeT& Fill, PredicateT IsSpace)
|
||||
{
|
||||
::boost::trim_if(Input, IsSpace);
|
||||
::boost::find_format_all(
|
||||
Input,
|
||||
::boost::token_finder(IsSpace, ::boost::token_compress_on),
|
||||
::boost::const_formatter(::boost::as_literal(Fill)));
|
||||
}
|
||||
|
||||
|
||||
//! Trim Fill
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
replace all every block of consecutive spaces with a fill string
|
||||
defined by user.
|
||||
The result is a trimmed copy of the input
|
||||
|
||||
\param Input An input sequence
|
||||
\param Fill A string used to fill the inner spaces
|
||||
\param Loc A locale used for 'space' classification
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT trim_fill_copy(const SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
|
||||
{
|
||||
return trim_fill_copy_if(Input, Fill, ::boost::is_space(Loc));
|
||||
}
|
||||
|
||||
|
||||
//! Trim Fill
|
||||
/*!
|
||||
Remove all leading and trailing spaces from the input and
|
||||
replace all every block of consecutive spaces with a fill string
|
||||
defined by user.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param Fill A string used to fill the inner spaces
|
||||
\param Loc A locale used for 'space' classification
|
||||
\return A trimmed copy of the input
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void trim_fill(SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
|
||||
{
|
||||
trim_fill_if(Input, Fill, ::boost::is_space(Loc));
|
||||
}
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::trim_all;
|
||||
using algorithm::trim_all_if;
|
||||
using algorithm::trim_all_copy;
|
||||
using algorithm::trim_all_copy_if;
|
||||
using algorithm::trim_fill;
|
||||
using algorithm::trim_fill_if;
|
||||
using algorithm::trim_fill_copy;
|
||||
using algorithm::trim_fill_copy_if;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_TRIM_ALL_HPP
|
||||
@@ -17,7 +17,7 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <exception>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <string>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp> // size_t
|
||||
#include <boost/noncopyable.hpp>
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
public:
|
||||
library_version_type(): t(0) {};
|
||||
explicit library_version_type(const unsigned int & t_) : t(t_){
|
||||
assert(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
library_version_type(const library_version_type & t_) :
|
||||
t(t_.t)
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
// should be private - but MPI fails if it's not!!!
|
||||
version_type(): t(0) {};
|
||||
explicit version_type(const unsigned int & t_) : t(t_){
|
||||
assert(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
version_type(const version_type & t_) :
|
||||
t(t_.t)
|
||||
@@ -113,10 +113,10 @@ public:
|
||||
// should be private - but then can't use BOOST_STRONG_TYPE below
|
||||
class_id_type() : t(0) {};
|
||||
explicit class_id_type(const int t_) : t(t_){
|
||||
assert(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
explicit class_id_type(const std::size_t t_) : t(t_){
|
||||
// assert(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
// BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
class_id_type(const class_id_type & t_) :
|
||||
t(t_.t)
|
||||
@@ -151,7 +151,7 @@ private:
|
||||
public:
|
||||
object_id_type(): t(0) {};
|
||||
explicit object_id_type(const unsigned int & t_) : t(t_){
|
||||
assert(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
object_id_type(const object_id_type & t_) :
|
||||
t(t_.t)
|
||||
@@ -254,7 +254,7 @@ BOOST_ARCHIVE_SIGNATURE();
|
||||
#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
|
||||
class D : public T { \
|
||||
public: \
|
||||
explicit D(const T t) : T(t){} \
|
||||
explicit D(const T tt) : T(tt){} \
|
||||
}; \
|
||||
/**/
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
|
||||
// include these to trap a change in binary format which
|
||||
// isn't specifically handled
|
||||
BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool));
|
||||
// upto 32K classes
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
|
||||
@@ -83,6 +82,19 @@ public:
|
||||
// binary files don't include the optional information
|
||||
void load_override(class_id_optional_type & /* t */, int){}
|
||||
|
||||
void load_override(tracking_type & t, int /*version*/){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
int_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
else{
|
||||
bool x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
}
|
||||
void load_override(class_id_type & t, int version){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
@@ -134,10 +146,23 @@ public:
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
uint_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(5) < lvt){
|
||||
uint_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(2) < lvt){
|
||||
// upto 255 versions
|
||||
unsigned char x=0;
|
||||
* this->This() >> x;
|
||||
t = version_type(x);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
@@ -147,7 +172,8 @@ public:
|
||||
|
||||
void load_override(boost::serialization::item_version_type & t, int version){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
// if(boost::archive::library_version_type(7) < lvt){
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
this->detail_common_iarchive::load_override(t, version);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <iosfwd>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <cstring> // std::memcpy
|
||||
#include <cstddef> // std::size_t
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
void load(bool & t){
|
||||
load_binary(& t, sizeof(t));
|
||||
int i = t;
|
||||
assert(0 == i || 1 == i);
|
||||
BOOST_ASSERT(0 == i || 1 == i);
|
||||
(void)i; // warning suppression for release builds.
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
|
||||
@@ -151,7 +151,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
|
||||
std::size_t count
|
||||
){
|
||||
// note: an optimizer should eliminate the following for char files
|
||||
assert(
|
||||
BOOST_ASSERT(
|
||||
static_cast<std::streamsize>(count / sizeof(Elem))
|
||||
<= boost::integer_traits<std::streamsize>::const_max
|
||||
);
|
||||
@@ -165,7 +165,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
// note: an optimizer should eliminate the following for char files
|
||||
assert(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
|
||||
BOOST_ASSERT(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
|
||||
s = static_cast<std::streamsize>(count % sizeof(Elem));
|
||||
if(0 < s){
|
||||
// if(is.fail())
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
|
||||
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
|
||||
|
||||
#include <iosfwd>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <streambuf> // basic_streambuf
|
||||
#include <string>
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
// trap usage of invalid uninitialized boolean which would
|
||||
// otherwise crash on load.
|
||||
void save(const bool t){
|
||||
assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
BOOST_ASSERT(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
save_binary(& t, sizeof(t));
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
|
||||
@@ -146,7 +146,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
//assert(
|
||||
//BOOST_ASSERT(
|
||||
// static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count
|
||||
//);
|
||||
// note: if the following assertions fail
|
||||
@@ -160,7 +160,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
// figure number of elements to output - round up
|
||||
count = ( count + sizeof(Elem) - 1)
|
||||
/ sizeof(Elem);
|
||||
assert(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
std::streamsize scount = m_sb.sputn(
|
||||
static_cast<const Elem *>(address),
|
||||
static_cast<std::streamsize>(count)
|
||||
@@ -173,7 +173,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
// static_cast<const BOOST_DEDUCED_TYPENAME OStream::char_type *>(address),
|
||||
// count
|
||||
//);
|
||||
//assert(os.good());
|
||||
//BOOST_ASSERT(os.good());
|
||||
}
|
||||
|
||||
} //namespace boost
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <boost/config/no_tr1/cmath.hpp> // isnan
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
void save(const bool t){
|
||||
// trap usage of invalid uninitialized boolean which would
|
||||
// otherwise crash on load.
|
||||
assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
BOOST_ASSERT(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
) :
|
||||
m_eti(& eti)
|
||||
{
|
||||
assert(NULL != & eti);
|
||||
BOOST_ASSERT(NULL != & eti);
|
||||
}
|
||||
public:
|
||||
inline bool
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -186,7 +186,7 @@ BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
const void * x
|
||||
) const {
|
||||
assert(NULL != x);
|
||||
BOOST_ASSERT(NULL != x);
|
||||
// make sure call is routed through the highest interface that might
|
||||
// be specialized by the user.
|
||||
T * t = static_cast<T *>(const_cast<void *>(x));
|
||||
@@ -384,7 +384,7 @@ struct save_pointer_type {
|
||||
|
||||
// retrieve the true type of the object pointed to
|
||||
// if this assertion fails its an error in this library
|
||||
assert(NULL != this_type);
|
||||
BOOST_ASSERT(NULL != this_type);
|
||||
|
||||
const boost::serialization::extended_type_info * true_type =
|
||||
i.get_derived_extended_type_info(t);
|
||||
@@ -433,12 +433,12 @@ struct save_pointer_type {
|
||||
archive_serializer_map<Archive>
|
||||
>::get_const_instance().find(*true_type)
|
||||
);
|
||||
assert(NULL != bpos);
|
||||
BOOST_ASSERT(NULL != bpos);
|
||||
if(NULL == bpos)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::unregistered_class,
|
||||
bpos->get_debug_info()
|
||||
"derived class not registered or exported"
|
||||
)
|
||||
);
|
||||
ar.save_pointer(vp, bpos);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t, NULL
|
||||
#include <cstring> // memcpy
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
if(0 == count)
|
||||
return;
|
||||
|
||||
assert(
|
||||
BOOST_ASSERT(
|
||||
static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)())
|
||||
> (count + sizeof(CharType) - 1)/sizeof(CharType)
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
@@ -32,7 +32,7 @@ basic_text_oarchive<Archive>::newtoken()
|
||||
{
|
||||
switch(delimiter){
|
||||
default:
|
||||
assert(false);
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
case eol:
|
||||
this->This()->put('\n');
|
||||
|
||||
@@ -55,26 +55,8 @@
|
||||
# pragma warning (disable : 4786) // too long name, harmless warning
|
||||
#endif
|
||||
|
||||
//#define BOOST_SPIRIT_DEBUG
|
||||
#include <boost/spirit/core/non_terminal/rule.hpp>
|
||||
|
||||
// the following hack is to evade a bogus error generated by using the
|
||||
// word "arg" when bind.hpp has been included
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
#define arg xarg
|
||||
#endif
|
||||
|
||||
// spirit stuff
|
||||
#if (defined __BORLANDC__) && (__BORLANDC__ < 0x593) \
|
||||
|| (defined _MSC_VER) && (_MSC_VER <= 1300)
|
||||
#include <boost/spirit/utility/chset.hpp>
|
||||
#else
|
||||
#include <boost/spirit/include/classic_rule.hpp>
|
||||
#include <boost/spirit/include/classic_chset.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
#undef arg
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
@@ -97,12 +79,12 @@ public:
|
||||
private:
|
||||
typedef BOOST_DEDUCED_TYPENAME std::basic_istream<CharType> IStream;
|
||||
typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType> StringType;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::chset<CharType> chset_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::chlit<CharType> chlit_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::scanner<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chset<CharType> chset_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chlit<CharType> chlit_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::scanner<
|
||||
BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator
|
||||
> scanner_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::rule<scanner_t> rule_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::rule<scanner_t> rule_t;
|
||||
// Start grammar definition
|
||||
rule_t
|
||||
Reference,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace std{
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/detail/workaround.hpp> // Dinkumware and RogueWave
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <exception>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
msg = "attempt to decode a value not in base64 char set";
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
@@ -49,7 +49,7 @@ struct from_6_bit {
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789"
|
||||
"+/";
|
||||
assert(t < 64);
|
||||
BOOST_ASSERT(t < 64);
|
||||
return lookup_table[static_cast<size_t>(t)];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
@@ -39,7 +39,7 @@ template<class CharType>
|
||||
struct to_6_bit {
|
||||
typedef CharType result_type;
|
||||
CharType operator()(CharType t) const{
|
||||
const char lookup_table[] = {
|
||||
const signed char lookup_table[] = {
|
||||
-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,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
@@ -47,7 +47,7 @@ struct tri_state {
|
||||
} m_state;
|
||||
// convert to bool
|
||||
operator bool (){
|
||||
assert(is_indeterminant != m_state);
|
||||
BOOST_ASSERT(is_indeterminant != m_state);
|
||||
return is_true == m_state ? true : false;
|
||||
}
|
||||
// assign from bool
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <exception>
|
||||
#endif //BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
msg = "invalid multbyte/wide char conversion";
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // for wctomb()
|
||||
|
||||
@@ -90,9 +90,9 @@ class mb_from_wchar
|
||||
#else
|
||||
m_bend = std::wctomb(m_buffer, value);
|
||||
#endif
|
||||
assert(-1 != m_bend);
|
||||
assert((std::size_t)m_bend <= sizeof(m_buffer));
|
||||
assert(m_bend > 0);
|
||||
BOOST_ASSERT(-1 != m_bend);
|
||||
BOOST_ASSERT((std::size_t)m_bend <= sizeof(m_buffer));
|
||||
BOOST_ASSERT(m_bend > 0);
|
||||
m_bnext = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters
|
||||
// or 3 8 bit characters
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cctype>
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // mblen
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <exception>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
@@ -87,7 +87,8 @@ protected:
|
||||
init();
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
text_iarchive_impl(std::istream & is, unsigned int flags);
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
// don't import inline definitions! leave this as a reminder.
|
||||
//BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~text_iarchive_impl(){};
|
||||
};
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ protected:
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
text_oarchive_impl(std::ostream & os, unsigned int flags);
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
// don't import inline definitions! leave this as a reminder.
|
||||
//BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~text_oarchive_impl(){};
|
||||
public:
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <cstdlib> // getenv
|
||||
#include <cstddef> // NULL
|
||||
//#include <cassert>
|
||||
//#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
@@ -38,7 +38,7 @@ inline const char * tmpdir(){
|
||||
if(NULL == dirname)
|
||||
dirname = std::getenv("TEMP");
|
||||
if(NULL == dirname){
|
||||
//assert(false); // no temp directory found
|
||||
//BOOST_ASSERT(false); // no temp directory found
|
||||
dirname = ".";
|
||||
}
|
||||
return dirname;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user