mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
41
ports/android/AndroidManifest.xml
Normal file
41
ports/android/AndroidManifest.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- BEGIN_INCLUDE(manifest) -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.ServoAndroid"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<!-- This is the platform API where NativeActivity was introduced. -->
|
||||
<uses-sdk android:minSdkVersion="18"
|
||||
android:targetSdkVersion="18" />
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"></uses-feature>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- This .apk has no Java code itself, so set hasCode to false. -->
|
||||
<!-- Add the flag android:debuggable="true" to the application tag to enable use of ndk-gdb -->
|
||||
<application android:label="@string/app_name" android:hasCode="false" android:debuggable="true">
|
||||
|
||||
<!-- Our activity is the built-in NativeActivity framework class.
|
||||
This will take care of integrating with our NDK code. -->
|
||||
<activity android:name="android.app.NativeActivity"
|
||||
android:label="@string/app_name"
|
||||
android:exported="true"
|
||||
android:hasCode="false"
|
||||
android:hardwareAccelerated="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<!-- Tell NativeActivity the name of or .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="ServoAndroid" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
<!-- END_INCLUDE(manifest) -->
|
20
ports/android/Makefile
Normal file
20
ports/android/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
.PHONY: all
|
||||
all:
|
||||
NDK_DEBUG=1 $(ANDROID_NDK)/ndk-build -B
|
||||
find ../../target ! \( -type d -name dist -prune \) -name libmozjs.so | \
|
||||
xargs -I {} cp -f {} libs/armeabi
|
||||
find ../../target ! \( -type d -name dist -prune \) -name 'libservo-*.so' | \
|
||||
xargs -I {} cp -f {} libs/armeabi/libservo.so
|
||||
find ../../rust/lib/rustlib/arm-linux-androideabi/lib \
|
||||
-name '*.so' -type f -size +1c | \
|
||||
xargs -I {} cp -f {} libs/armeabi
|
||||
cp -a extlibs/* libs/armeabi
|
||||
$(ANDROID_SDK)/tools/android update project \
|
||||
--name ServoAndroid \
|
||||
--target "android-18" \
|
||||
--path .
|
||||
ant debug
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
$(ANDROID_SDK)/platform-tools/adb install -r bin/ServoAndroid-debug.apk
|
92
ports/android/build.xml
Normal file
92
ports/android/build.xml
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="ServoAndroid" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
22
ports/android/include/GL/freeglut.h
Normal file
22
ports/android/include/GL/freeglut.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef __FREEGLUT_H__
|
||||
#define __FREEGLUT_H__
|
||||
|
||||
/*
|
||||
* freeglut.h
|
||||
*
|
||||
* The freeglut library include file
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "freeglut_std.h"
|
||||
#include "freeglut_ext.h"
|
||||
|
||||
/*** END OF FILE ***/
|
||||
|
||||
#endif /* __FREEGLUT_H__ */
|
252
ports/android/include/GL/freeglut_ext.h
Normal file
252
ports/android/include/GL/freeglut_ext.h
Normal file
|
@ -0,0 +1,252 @@
|
|||
#ifndef __FREEGLUT_EXT_H__
|
||||
#define __FREEGLUT_EXT_H__
|
||||
|
||||
/*
|
||||
* freeglut_ext.h
|
||||
*
|
||||
* The non-GLUT-compatible extensions to the freeglut library include file
|
||||
*
|
||||
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
|
||||
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
|
||||
* Creation date: Thu Dec 2 1999
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Additional GLUT Key definitions for the Special key function
|
||||
*/
|
||||
#define GLUT_KEY_NUM_LOCK 0x006D
|
||||
#define GLUT_KEY_BEGIN 0x006E
|
||||
#define GLUT_KEY_DELETE 0x006F
|
||||
#define GLUT_KEY_SHIFT_L 0x0070
|
||||
#define GLUT_KEY_SHIFT_R 0x0071
|
||||
#define GLUT_KEY_CTRL_L 0x0072
|
||||
#define GLUT_KEY_CTRL_R 0x0073
|
||||
#define GLUT_KEY_ALT_L 0x0074
|
||||
#define GLUT_KEY_ALT_R 0x0075
|
||||
|
||||
/*
|
||||
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
|
||||
*/
|
||||
#define GLUT_ACTION_EXIT 0
|
||||
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
|
||||
#define GLUT_ACTION_CONTINUE_EXECUTION 2
|
||||
|
||||
/*
|
||||
* Create a new rendering context when the user opens a new window?
|
||||
*/
|
||||
#define GLUT_CREATE_NEW_CONTEXT 0
|
||||
#define GLUT_USE_CURRENT_CONTEXT 1
|
||||
|
||||
/*
|
||||
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
|
||||
*/
|
||||
#define GLUT_FORCE_INDIRECT_CONTEXT 0
|
||||
#define GLUT_ALLOW_DIRECT_CONTEXT 1
|
||||
#define GLUT_TRY_DIRECT_CONTEXT 2
|
||||
#define GLUT_FORCE_DIRECT_CONTEXT 3
|
||||
|
||||
/*
|
||||
* GLUT API Extension macro definitions -- the glutGet parameters
|
||||
*/
|
||||
#define GLUT_INIT_STATE 0x007C
|
||||
|
||||
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
|
||||
|
||||
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
|
||||
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
|
||||
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
|
||||
|
||||
#define GLUT_VERSION 0x01FC
|
||||
|
||||
#define GLUT_RENDERING_CONTEXT 0x01FD
|
||||
#define GLUT_DIRECT_RENDERING 0x01FE
|
||||
|
||||
#define GLUT_FULL_SCREEN 0x01FF
|
||||
|
||||
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
|
||||
|
||||
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
|
||||
|
||||
/*
|
||||
* New tokens for glutInitDisplayMode.
|
||||
* Only one GLUT_AUXn bit may be used at a time.
|
||||
* Value 0x0400 is defined in OpenGLUT.
|
||||
*/
|
||||
#define GLUT_AUX 0x1000
|
||||
|
||||
#define GLUT_AUX1 0x1000
|
||||
#define GLUT_AUX2 0x2000
|
||||
#define GLUT_AUX3 0x4000
|
||||
#define GLUT_AUX4 0x8000
|
||||
|
||||
/*
|
||||
* Context-related flags, see freeglut_state.c
|
||||
* Set the requested OpenGL version
|
||||
*/
|
||||
#define GLUT_INIT_MAJOR_VERSION 0x0200
|
||||
#define GLUT_INIT_MINOR_VERSION 0x0201
|
||||
#define GLUT_INIT_FLAGS 0x0202
|
||||
#define GLUT_INIT_PROFILE 0x0203
|
||||
|
||||
/*
|
||||
* Flags for glutInitContextFlags, see freeglut_init.c
|
||||
*/
|
||||
#define GLUT_DEBUG 0x0001
|
||||
#define GLUT_FORWARD_COMPATIBLE 0x0002
|
||||
|
||||
|
||||
/*
|
||||
* Flags for glutInitContextProfile, see freeglut_init.c
|
||||
*/
|
||||
#define GLUT_CORE_PROFILE 0x0001
|
||||
#define GLUT_COMPATIBILITY_PROFILE 0x0002
|
||||
|
||||
/*
|
||||
* Process loop function, see freeglut_main.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
|
||||
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
|
||||
FGAPI void FGAPIENTRY glutExit ( void );
|
||||
|
||||
/*
|
||||
* Window management functions, see freeglut_window.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
|
||||
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
|
||||
|
||||
/*
|
||||
* Window-specific callback functions, see freeglut_callbacks.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
|
||||
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
|
||||
/* And also a destruction callback for menus */
|
||||
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
|
||||
|
||||
/*
|
||||
* State setting and retrieval functions, see freeglut_state.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
|
||||
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
|
||||
/* A.Donev: User-data manipulation */
|
||||
FGAPI void* FGAPIENTRY glutGetWindowData( void );
|
||||
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
|
||||
FGAPI void* FGAPIENTRY glutGetMenuData( void );
|
||||
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
|
||||
|
||||
/*
|
||||
* Font stuff, see freeglut_font.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
|
||||
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
|
||||
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
|
||||
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
|
||||
|
||||
/*
|
||||
* Geometry functions, see freeglut_geometry.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
|
||||
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
|
||||
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
|
||||
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
|
||||
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
|
||||
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
|
||||
|
||||
/*
|
||||
* Extension functions, see freeglut_ext.c
|
||||
*/
|
||||
typedef void (*GLUTproc)();
|
||||
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
|
||||
|
||||
/*
|
||||
* Multi-touch/multi-pointer extensions
|
||||
*/
|
||||
|
||||
#define GLUT_HAS_MULTI 1
|
||||
|
||||
/* TODO: add device_id paramater,
|
||||
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
|
||||
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
|
||||
|
||||
/*
|
||||
* Joystick functions, see freeglut_joystick.c
|
||||
*/
|
||||
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
|
||||
/* If you have a serious need for these functions in your application, please either
|
||||
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
|
||||
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
|
||||
* "js" library.
|
||||
*/
|
||||
int glutJoystickGetNumAxes( int ident );
|
||||
int glutJoystickGetNumButtons( int ident );
|
||||
int glutJoystickNotWorking( int ident );
|
||||
float glutJoystickGetDeadBand( int ident, int axis );
|
||||
void glutJoystickSetDeadBand( int ident, int axis, float db );
|
||||
float glutJoystickGetSaturation( int ident, int axis );
|
||||
void glutJoystickSetSaturation( int ident, int axis, float st );
|
||||
void glutJoystickSetMinRange( int ident, float *axes );
|
||||
void glutJoystickSetMaxRange( int ident, float *axes );
|
||||
void glutJoystickSetCenter( int ident, float *axes );
|
||||
void glutJoystickGetMinRange( int ident, float *axes );
|
||||
void glutJoystickGetMaxRange( int ident, float *axes );
|
||||
void glutJoystickGetCenter( int ident, float *axes );
|
||||
|
||||
/*
|
||||
* Initialization functions, see freeglut_init.c
|
||||
*/
|
||||
/* to get the typedef for va_list */
|
||||
#include <stdarg.h>
|
||||
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
|
||||
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
|
||||
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
|
||||
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
|
||||
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
|
||||
|
||||
/* OpenGL >= 2.0 support */
|
||||
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
|
||||
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
|
||||
|
||||
/* Mobile platforms lifecycle */
|
||||
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
|
||||
FGAPI void FGAPIENTRY glutPauseFunc(void (* callback)());
|
||||
FGAPI void FGAPIENTRY glutResumeFunc(void (* callback)());
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the display mode definitions
|
||||
*/
|
||||
#define GLUT_CAPTIONLESS 0x0400
|
||||
#define GLUT_BORDERLESS 0x0800
|
||||
#define GLUT_SRGB 0x1000
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** END OF FILE ***/
|
||||
|
||||
#endif /* __FREEGLUT_EXT_H__ */
|
656
ports/android/include/GL/freeglut_std.h
Normal file
656
ports/android/include/GL/freeglut_std.h
Normal file
|
@ -0,0 +1,656 @@
|
|||
#ifndef __FREEGLUT_STD_H__
|
||||
#define __FREEGLUT_STD_H__
|
||||
|
||||
/*
|
||||
* freeglut_std.h
|
||||
*
|
||||
* The GLUT-compatible part of the freeglut library include file
|
||||
*
|
||||
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
|
||||
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
|
||||
* Creation date: Thu Dec 2 1999
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Under windows, we have to differentiate between static and dynamic libraries
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
/* #pragma may not be supported by some compilers.
|
||||
* Discussion by FreeGLUT developers suggests that
|
||||
* Visual C++ specific code involving pragmas may
|
||||
* need to move to a separate header. 24th Dec 2003
|
||||
*/
|
||||
|
||||
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
|
||||
* pragmas or to 0 to exclude library pragmas.
|
||||
* The default behavior depends on the compiler/platform.
|
||||
*/
|
||||
# ifndef FREEGLUT_LIB_PRAGMAS
|
||||
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
|
||||
# define FREEGLUT_LIB_PRAGMAS 1
|
||||
# else
|
||||
# define FREEGLUT_LIB_PRAGMAS 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
|
||||
/* Windows static library */
|
||||
# ifdef FREEGLUT_STATIC
|
||||
|
||||
# define FGAPI
|
||||
# define FGAPIENTRY
|
||||
|
||||
/* Link with Win32 static freeglut lib */
|
||||
# if FREEGLUT_LIB_PRAGMAS
|
||||
# ifdef NDEBUG
|
||||
# pragma comment (lib, "freeglut_static.lib")
|
||||
# else
|
||||
# pragma comment (lib, "freeglut_staticd.lib")
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Windows shared library (DLL) */
|
||||
# else
|
||||
|
||||
# define FGAPIENTRY __stdcall
|
||||
# if defined(FREEGLUT_EXPORTS)
|
||||
# define FGAPI __declspec(dllexport)
|
||||
# else
|
||||
# define FGAPI __declspec(dllimport)
|
||||
|
||||
/* Link with Win32 shared freeglut lib */
|
||||
# if FREEGLUT_LIB_PRAGMAS
|
||||
# ifdef NDEBUG
|
||||
# pragma comment (lib, "freeglut.lib")
|
||||
# else
|
||||
# pragma comment (lib, "freeglutd.lib")
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
/* Drag in other Windows libraries as required by FreeGLUT */
|
||||
# if FREEGLUT_LIB_PRAGMAS
|
||||
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
|
||||
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
|
||||
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
|
||||
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
|
||||
# pragma comment (lib, "user32.lib") /* link Windows user lib */
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* Non-Windows definition of FGAPI and FGAPIENTRY */
|
||||
# define FGAPI
|
||||
# define FGAPIENTRY
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The freeglut and GLUT API versions
|
||||
*/
|
||||
#define FREEGLUT 1
|
||||
#define GLUT_API_VERSION 4
|
||||
#define GLUT_XLIB_IMPLEMENTATION 13
|
||||
/* Deprecated:
|
||||
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
|
||||
#define FREEGLUT_VERSION_2_0 1
|
||||
|
||||
/*
|
||||
* Always include OpenGL and GLU headers
|
||||
*/
|
||||
/* Note: FREEGLUT_GLES1 and FREEGLUT_GLES2 are only used to cleanly
|
||||
bootstrap headers inclusion here; use GLES constants directly
|
||||
(e.g. GL_ES_VERSION_2_0) for all other needs */
|
||||
#ifdef FREEGLUT_GLES2
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES2/gl2.h>
|
||||
#elif FREEGLUT_GLES1
|
||||
# include <EGL/egl.h>
|
||||
# include <GLES/gl.h>
|
||||
#elif __APPLE__
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glu.h>
|
||||
#else
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the special key codes:
|
||||
*/
|
||||
#define GLUT_KEY_F1 0x0001
|
||||
#define GLUT_KEY_F2 0x0002
|
||||
#define GLUT_KEY_F3 0x0003
|
||||
#define GLUT_KEY_F4 0x0004
|
||||
#define GLUT_KEY_F5 0x0005
|
||||
#define GLUT_KEY_F6 0x0006
|
||||
#define GLUT_KEY_F7 0x0007
|
||||
#define GLUT_KEY_F8 0x0008
|
||||
#define GLUT_KEY_F9 0x0009
|
||||
#define GLUT_KEY_F10 0x000A
|
||||
#define GLUT_KEY_F11 0x000B
|
||||
#define GLUT_KEY_F12 0x000C
|
||||
#define GLUT_KEY_LEFT 0x0064
|
||||
#define GLUT_KEY_UP 0x0065
|
||||
#define GLUT_KEY_RIGHT 0x0066
|
||||
#define GLUT_KEY_DOWN 0x0067
|
||||
#define GLUT_KEY_PAGE_UP 0x0068
|
||||
#define GLUT_KEY_PAGE_DOWN 0x0069
|
||||
#define GLUT_KEY_HOME 0x006A
|
||||
#define GLUT_KEY_END 0x006B
|
||||
#define GLUT_KEY_INSERT 0x006C
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- mouse state definitions
|
||||
*/
|
||||
#define GLUT_LEFT_BUTTON 0x0000
|
||||
#define GLUT_MIDDLE_BUTTON 0x0001
|
||||
#define GLUT_RIGHT_BUTTON 0x0002
|
||||
#define GLUT_DOWN 0x0000
|
||||
#define GLUT_UP 0x0001
|
||||
#define GLUT_LEFT 0x0000
|
||||
#define GLUT_ENTERED 0x0001
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the display mode definitions
|
||||
*/
|
||||
#define GLUT_RGB 0x0000
|
||||
#define GLUT_RGBA 0x0000
|
||||
#define GLUT_INDEX 0x0001
|
||||
#define GLUT_SINGLE 0x0000
|
||||
#define GLUT_DOUBLE 0x0002
|
||||
#define GLUT_ACCUM 0x0004
|
||||
#define GLUT_ALPHA 0x0008
|
||||
#define GLUT_DEPTH 0x0010
|
||||
#define GLUT_STENCIL 0x0020
|
||||
#define GLUT_MULTISAMPLE 0x0080
|
||||
#define GLUT_STEREO 0x0100
|
||||
#define GLUT_LUMINANCE 0x0200
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- windows and menu related definitions
|
||||
*/
|
||||
#define GLUT_MENU_NOT_IN_USE 0x0000
|
||||
#define GLUT_MENU_IN_USE 0x0001
|
||||
#define GLUT_NOT_VISIBLE 0x0000
|
||||
#define GLUT_VISIBLE 0x0001
|
||||
#define GLUT_HIDDEN 0x0000
|
||||
#define GLUT_FULLY_RETAINED 0x0001
|
||||
#define GLUT_PARTIALLY_RETAINED 0x0002
|
||||
#define GLUT_FULLY_COVERED 0x0003
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- fonts definitions
|
||||
*
|
||||
* Steve Baker suggested to make it binary compatible with GLUT:
|
||||
*/
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
|
||||
# define GLUT_STROKE_ROMAN ((void *)0x0000)
|
||||
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
|
||||
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
|
||||
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
|
||||
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
|
||||
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
|
||||
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
|
||||
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
|
||||
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
|
||||
#else
|
||||
/*
|
||||
* I don't really know if it's a good idea... But here it goes:
|
||||
*/
|
||||
extern void* glutStrokeRoman;
|
||||
extern void* glutStrokeMonoRoman;
|
||||
extern void* glutBitmap9By15;
|
||||
extern void* glutBitmap8By13;
|
||||
extern void* glutBitmapTimesRoman10;
|
||||
extern void* glutBitmapTimesRoman24;
|
||||
extern void* glutBitmapHelvetica10;
|
||||
extern void* glutBitmapHelvetica12;
|
||||
extern void* glutBitmapHelvetica18;
|
||||
|
||||
/*
|
||||
* Those pointers will be used by following definitions:
|
||||
*/
|
||||
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
|
||||
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
|
||||
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
|
||||
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
|
||||
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
|
||||
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
|
||||
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
|
||||
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
|
||||
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutGet parameters
|
||||
*/
|
||||
#define GLUT_WINDOW_X 0x0064
|
||||
#define GLUT_WINDOW_Y 0x0065
|
||||
#define GLUT_WINDOW_WIDTH 0x0066
|
||||
#define GLUT_WINDOW_HEIGHT 0x0067
|
||||
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
|
||||
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
|
||||
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
|
||||
#define GLUT_WINDOW_RED_SIZE 0x006B
|
||||
#define GLUT_WINDOW_GREEN_SIZE 0x006C
|
||||
#define GLUT_WINDOW_BLUE_SIZE 0x006D
|
||||
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
|
||||
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
|
||||
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
|
||||
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
|
||||
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
|
||||
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
|
||||
#define GLUT_WINDOW_RGBA 0x0074
|
||||
#define GLUT_WINDOW_PARENT 0x0075
|
||||
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
|
||||
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
|
||||
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
|
||||
#define GLUT_WINDOW_STEREO 0x0079
|
||||
#define GLUT_WINDOW_CURSOR 0x007A
|
||||
|
||||
#define GLUT_SCREEN_WIDTH 0x00C8
|
||||
#define GLUT_SCREEN_HEIGHT 0x00C9
|
||||
#define GLUT_SCREEN_WIDTH_MM 0x00CA
|
||||
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
|
||||
#define GLUT_MENU_NUM_ITEMS 0x012C
|
||||
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
|
||||
#define GLUT_INIT_WINDOW_X 0x01F4
|
||||
#define GLUT_INIT_WINDOW_Y 0x01F5
|
||||
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
|
||||
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
|
||||
#define GLUT_INIT_DISPLAY_MODE 0x01F8
|
||||
#define GLUT_ELAPSED_TIME 0x02BC
|
||||
#define GLUT_WINDOW_FORMAT_ID 0x007B
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutDeviceGet parameters
|
||||
*/
|
||||
#define GLUT_HAS_KEYBOARD 0x0258
|
||||
#define GLUT_HAS_MOUSE 0x0259
|
||||
#define GLUT_HAS_SPACEBALL 0x025A
|
||||
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
|
||||
#define GLUT_HAS_TABLET 0x025C
|
||||
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
|
||||
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
|
||||
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
|
||||
#define GLUT_NUM_DIALS 0x0260
|
||||
#define GLUT_NUM_TABLET_BUTTONS 0x0261
|
||||
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
|
||||
#define GLUT_DEVICE_KEY_REPEAT 0x0263
|
||||
#define GLUT_HAS_JOYSTICK 0x0264
|
||||
#define GLUT_OWNS_JOYSTICK 0x0265
|
||||
#define GLUT_JOYSTICK_BUTTONS 0x0266
|
||||
#define GLUT_JOYSTICK_AXES 0x0267
|
||||
#define GLUT_JOYSTICK_POLL_RATE 0x0268
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutLayerGet parameters
|
||||
*/
|
||||
#define GLUT_OVERLAY_POSSIBLE 0x0320
|
||||
#define GLUT_LAYER_IN_USE 0x0321
|
||||
#define GLUT_HAS_OVERLAY 0x0322
|
||||
#define GLUT_TRANSPARENT_INDEX 0x0323
|
||||
#define GLUT_NORMAL_DAMAGED 0x0324
|
||||
#define GLUT_OVERLAY_DAMAGED 0x0325
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutVideoResizeGet parameters
|
||||
*/
|
||||
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
|
||||
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
|
||||
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
|
||||
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
|
||||
#define GLUT_VIDEO_RESIZE_X 0x038A
|
||||
#define GLUT_VIDEO_RESIZE_Y 0x038B
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutUseLayer parameters
|
||||
*/
|
||||
#define GLUT_NORMAL 0x0000
|
||||
#define GLUT_OVERLAY 0x0001
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutGetModifiers parameters
|
||||
*/
|
||||
#define GLUT_ACTIVE_SHIFT 0x0001
|
||||
#define GLUT_ACTIVE_CTRL 0x0002
|
||||
#define GLUT_ACTIVE_ALT 0x0004
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the glutSetCursor parameters
|
||||
*/
|
||||
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
|
||||
#define GLUT_CURSOR_LEFT_ARROW 0x0001
|
||||
#define GLUT_CURSOR_INFO 0x0002
|
||||
#define GLUT_CURSOR_DESTROY 0x0003
|
||||
#define GLUT_CURSOR_HELP 0x0004
|
||||
#define GLUT_CURSOR_CYCLE 0x0005
|
||||
#define GLUT_CURSOR_SPRAY 0x0006
|
||||
#define GLUT_CURSOR_WAIT 0x0007
|
||||
#define GLUT_CURSOR_TEXT 0x0008
|
||||
#define GLUT_CURSOR_CROSSHAIR 0x0009
|
||||
#define GLUT_CURSOR_UP_DOWN 0x000A
|
||||
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
|
||||
#define GLUT_CURSOR_TOP_SIDE 0x000C
|
||||
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
|
||||
#define GLUT_CURSOR_LEFT_SIDE 0x000E
|
||||
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
|
||||
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
|
||||
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
|
||||
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
|
||||
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
|
||||
#define GLUT_CURSOR_INHERIT 0x0064
|
||||
#define GLUT_CURSOR_NONE 0x0065
|
||||
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- RGB color component specification definitions
|
||||
*/
|
||||
#define GLUT_RED 0x0000
|
||||
#define GLUT_GREEN 0x0001
|
||||
#define GLUT_BLUE 0x0002
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- additional keyboard and joystick definitions
|
||||
*/
|
||||
#define GLUT_KEY_REPEAT_OFF 0x0000
|
||||
#define GLUT_KEY_REPEAT_ON 0x0001
|
||||
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
|
||||
|
||||
#define GLUT_JOYSTICK_BUTTON_A 0x0001
|
||||
#define GLUT_JOYSTICK_BUTTON_B 0x0002
|
||||
#define GLUT_JOYSTICK_BUTTON_C 0x0004
|
||||
#define GLUT_JOYSTICK_BUTTON_D 0x0008
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- game mode definitions
|
||||
*/
|
||||
#define GLUT_GAME_MODE_ACTIVE 0x0000
|
||||
#define GLUT_GAME_MODE_POSSIBLE 0x0001
|
||||
#define GLUT_GAME_MODE_WIDTH 0x0002
|
||||
#define GLUT_GAME_MODE_HEIGHT 0x0003
|
||||
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
|
||||
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
|
||||
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
|
||||
|
||||
/*
|
||||
* Initialization functions, see fglut_init.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
|
||||
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
|
||||
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
|
||||
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
|
||||
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
|
||||
|
||||
/*
|
||||
* Process loop function, see freeglut_main.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutMainLoop( void );
|
||||
|
||||
/*
|
||||
* Window management functions, see freeglut_window.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
|
||||
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
|
||||
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
|
||||
FGAPI void FGAPIENTRY glutSetWindow( int window );
|
||||
FGAPI int FGAPIENTRY glutGetWindow( void );
|
||||
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
|
||||
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
|
||||
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
|
||||
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
|
||||
FGAPI void FGAPIENTRY glutShowWindow( void );
|
||||
FGAPI void FGAPIENTRY glutHideWindow( void );
|
||||
FGAPI void FGAPIENTRY glutIconifyWindow( void );
|
||||
FGAPI void FGAPIENTRY glutPushWindow( void );
|
||||
FGAPI void FGAPIENTRY glutPopWindow( void );
|
||||
FGAPI void FGAPIENTRY glutFullScreen( void );
|
||||
|
||||
/*
|
||||
* Display-connected functions, see freeglut_display.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
|
||||
FGAPI void FGAPIENTRY glutPostRedisplay( void );
|
||||
FGAPI void FGAPIENTRY glutSwapBuffers( void );
|
||||
|
||||
/*
|
||||
* Mouse cursor functions, see freeglut_cursor.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
|
||||
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
|
||||
|
||||
/*
|
||||
* Overlay stuff, see freeglut_overlay.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
|
||||
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
|
||||
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
|
||||
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
|
||||
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
|
||||
FGAPI void FGAPIENTRY glutShowOverlay( void );
|
||||
FGAPI void FGAPIENTRY glutHideOverlay( void );
|
||||
|
||||
/*
|
||||
* Menu stuff, see freeglut_menu.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
|
||||
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
|
||||
FGAPI int FGAPIENTRY glutGetMenu( void );
|
||||
FGAPI void FGAPIENTRY glutSetMenu( int menu );
|
||||
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
|
||||
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
|
||||
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
|
||||
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
|
||||
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
|
||||
FGAPI void FGAPIENTRY glutAttachMenu( int button );
|
||||
FGAPI void FGAPIENTRY glutDetachMenu( int button );
|
||||
|
||||
/*
|
||||
* Global callback functions, see freeglut_callbacks.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
|
||||
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
|
||||
|
||||
/*
|
||||
* Window-specific callback functions, see freeglut_callbacks.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
|
||||
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
|
||||
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
|
||||
|
||||
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
|
||||
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
|
||||
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
|
||||
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
|
||||
|
||||
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
|
||||
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
|
||||
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
|
||||
|
||||
/*
|
||||
* State setting and retrieval functions, see freeglut_state.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutGet( GLenum query );
|
||||
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
|
||||
FGAPI int FGAPIENTRY glutGetModifiers( void );
|
||||
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
|
||||
|
||||
/*
|
||||
* Font stuff, see freeglut_font.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
|
||||
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
|
||||
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
|
||||
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
|
||||
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
|
||||
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
|
||||
|
||||
/*
|
||||
* Geometry functions, see freeglut_geometry.c
|
||||
*/
|
||||
|
||||
FGAPI void FGAPIENTRY glutWireCube( double size );
|
||||
FGAPI void FGAPIENTRY glutSolidCube( double size );
|
||||
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
|
||||
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
|
||||
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
|
||||
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
|
||||
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
|
||||
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
|
||||
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
|
||||
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
|
||||
FGAPI void FGAPIENTRY glutWireOctahedron( void );
|
||||
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
|
||||
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
|
||||
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
|
||||
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
|
||||
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
|
||||
|
||||
/*
|
||||
* Teapot rendering functions, found in freeglut_teapot.c
|
||||
* NB: front facing polygons have clockwise winding, not counter clockwise
|
||||
*/
|
||||
/* TODO: doesn't work with GLES1 yet */
|
||||
#ifndef EGL_VERSION_1_0
|
||||
FGAPI void FGAPIENTRY glutWireTeapot( GLdouble size );
|
||||
FGAPI void FGAPIENTRY glutSolidTeapot( GLdouble size );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Game mode functions, see freeglut_gamemode.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
|
||||
FGAPI int FGAPIENTRY glutEnterGameMode( void );
|
||||
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
|
||||
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
|
||||
|
||||
/*
|
||||
* Video resize functions, see freeglut_videoresize.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
|
||||
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
|
||||
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
|
||||
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
|
||||
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
|
||||
|
||||
/*
|
||||
* Colormap functions, see freeglut_misc.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
|
||||
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
|
||||
FGAPI void FGAPIENTRY glutCopyColormap( int window );
|
||||
|
||||
/*
|
||||
* Misc keyboard and joystick functions, see freeglut_misc.c
|
||||
*/
|
||||
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
|
||||
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
|
||||
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
|
||||
|
||||
/*
|
||||
* Misc functions, see freeglut_misc.c
|
||||
*/
|
||||
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
|
||||
FGAPI void FGAPIENTRY glutReportErrors( void );
|
||||
|
||||
/* Comment from glut.h of classic GLUT:
|
||||
|
||||
Win32 has an annoying issue where there are multiple C run-time
|
||||
libraries (CRTs). If the executable is linked with a different CRT
|
||||
from the GLUT DLL, the GLUT DLL will not share the same CRT static
|
||||
data seen by the executable. In particular, atexit callbacks registered
|
||||
in the executable will not be called if GLUT calls its (different)
|
||||
exit routine). GLUT is typically built with the
|
||||
"/MD" option (the CRT with multithreading DLL support), but the Visual
|
||||
C++ linker default is "/ML" (the single threaded CRT).
|
||||
|
||||
One workaround to this issue is requiring users to always link with
|
||||
the same CRT as GLUT is compiled with. That requires users supply a
|
||||
non-standard option. GLUT 3.7 has its own built-in workaround where
|
||||
the executable's "exit" function pointer is covertly passed to GLUT.
|
||||
GLUT then calls the executable's exit function pointer to ensure that
|
||||
any "atexit" calls registered by the application are called if GLUT
|
||||
needs to exit.
|
||||
|
||||
Note that the __glut*WithExit routines should NEVER be called directly.
|
||||
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
|
||||
|
||||
/* to get the prototype for exit() */
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
|
||||
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
|
||||
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
|
||||
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
|
||||
#ifndef FREEGLUT_BUILDING_LIB
|
||||
#if defined(__GNUC__)
|
||||
#define FGUNUSED __attribute__((unused))
|
||||
#else
|
||||
#define FGUNUSED
|
||||
#endif
|
||||
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
|
||||
#define glutInit glutInit_ATEXIT_HACK
|
||||
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
|
||||
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
|
||||
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
|
||||
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** END OF FILE ***/
|
||||
|
||||
#endif /* __FREEGLUT_STD_H__ */
|
||||
|
21
ports/android/include/GL/glut.h
Normal file
21
ports/android/include/GL/glut.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef __GLUT_H__
|
||||
#define __GLUT_H__
|
||||
|
||||
/*
|
||||
* glut.h
|
||||
*
|
||||
* The freeglut library include file
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "freeglut_std.h"
|
||||
|
||||
/*** END OF FILE ***/
|
||||
|
||||
#endif /* __GLUT_H__ */
|
43
ports/android/jni/Android.mk
Normal file
43
ports/android/jni/Android.mk
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := freeglut
|
||||
LOCAL_SRC_FILES := libfreeglut-gles2.a
|
||||
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := ServoAndroid
|
||||
|
||||
LOCAL_SRC_FILES := common.cpp android-dl.cpp main.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/../include
|
||||
|
||||
LOCAL_CXXFLAGS := -DFREEGLUT_GLES2 -gstabs+
|
||||
|
||||
LOCAL_LDLIBS := -ldl -llog -landroid -lGLESv2 -lGLESv1_CM -lEGL
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := android_native_app_glue freeglut
|
||||
LOCAL_SHARED_LIBRARIES := libdl
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,android/native_app_glue)
|
3
ports/android/jni/Application.mk
Normal file
3
ports/android/jni/Application.mk
Normal file
|
@ -0,0 +1,3 @@
|
|||
APP_PLATFORM := android-18
|
||||
APP_STL := stlport_static
|
||||
APP_CPPFLAGS += -lstdc++
|
472
ports/android/jni/android-dl.cpp
Normal file
472
ports/android/jni/android-dl.cpp
Normal file
|
@ -0,0 +1,472 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License or as specified alternatively below. You may obtain a copy of
|
||||
* the License at http: *www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* Major Contributor(s):
|
||||
* Copyright (C) 2011 Tor Lillqvist <tml@iki.fi> (initial developer)
|
||||
* Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer)
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* For minor contributions see the git repository.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
||||
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
||||
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
||||
* instead of those above.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <linux/elf.h>
|
||||
|
||||
#include "android-dl.h"
|
||||
#include "common.h"
|
||||
|
||||
/* The library paths. */
|
||||
const char **library_locations;
|
||||
|
||||
static char last_error[1024] = {0};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void set_error(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
vsnprintf(last_error, sizeof(last_error), format, args);
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, last_error);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#define SET_ERROR(format, ...) set_error("%s: " format, __FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
static char *
|
||||
read_section(int fd,
|
||||
Elf32_Shdr *shdr)
|
||||
{
|
||||
char *result = (char*)malloc(shdr->sh_size);
|
||||
if (lseek(fd, shdr->sh_offset, SEEK_SET) < 0) {
|
||||
close(fd);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
if (read(fd, result, shdr->sh_size) < (int) shdr->sh_size) {
|
||||
close(fd);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
char **
|
||||
android_dlneeds(const char *library)
|
||||
{
|
||||
int i, fd;
|
||||
int n_needed;
|
||||
char **result;
|
||||
char *shstrtab;
|
||||
char *dynstr = NULL;
|
||||
Elf32_Ehdr hdr;
|
||||
Elf32_Shdr shdr;
|
||||
Elf32_Dyn dyn;
|
||||
|
||||
/* Open library and read ELF header */
|
||||
|
||||
fd = open(library, O_RDONLY);
|
||||
|
||||
if (fd == -1) {
|
||||
SET_ERROR("Could not open library %s: %s", library, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (read(fd, &hdr, sizeof(hdr)) < (int) sizeof(hdr)) {
|
||||
set_error("Could not read ELF header of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Read in .shstrtab */
|
||||
|
||||
if (lseek(fd, hdr.e_shoff + hdr.e_shstrndx * sizeof(shdr), SEEK_SET) < 0) {
|
||||
set_error("Could not seek to .shstrtab section header of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
if (read(fd, &shdr, sizeof(shdr)) < (int) sizeof(shdr)) {
|
||||
set_error("Could not read section header of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
shstrtab = read_section(fd, &shdr);
|
||||
if (shstrtab == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Read section headers, looking for .dynstr section */
|
||||
|
||||
if (lseek(fd, hdr.e_shoff, SEEK_SET) < 0) {
|
||||
set_error("Could not seek to section headers of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < hdr.e_shnum; i++) {
|
||||
if (read(fd, &shdr, sizeof(shdr)) < (int) sizeof(shdr)) {
|
||||
set_error("Could not read section header of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
if (shdr.sh_type == SHT_STRTAB &&
|
||||
strcmp(shstrtab + shdr.sh_name, ".dynstr") == 0) {
|
||||
dynstr = read_section(fd, &shdr);
|
||||
if (dynstr == NULL) {
|
||||
free(shstrtab);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == hdr.e_shnum) {
|
||||
set_error("No .dynstr section in %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Read section headers, looking for .dynamic section */
|
||||
|
||||
if (lseek(fd, hdr.e_shoff, SEEK_SET) < 0) {
|
||||
SET_ERROR("Could not seek to section headers of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < hdr.e_shnum; i++) {
|
||||
if (read(fd, &shdr, sizeof(shdr)) < (int) sizeof(shdr)) {
|
||||
SET_ERROR("Could not read section header of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
if (shdr.sh_type == SHT_DYNAMIC) {
|
||||
size_t dynoff;
|
||||
|
||||
/* Count number of DT_NEEDED entries */
|
||||
n_needed = 0;
|
||||
if (lseek(fd, shdr.sh_offset, SEEK_SET) < 0) {
|
||||
SET_ERROR("Could not seek to .dynamic section of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
for (dynoff = 0; dynoff < shdr.sh_size; dynoff += sizeof(dyn)) {
|
||||
if (read(fd, &dyn, sizeof(dyn)) < (int) sizeof(dyn)) {
|
||||
SET_ERROR("Could not read .dynamic entry of %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
if (dyn.d_tag == DT_NEEDED)
|
||||
n_needed++;
|
||||
}
|
||||
|
||||
/* LOGI("Found %d DT_NEEDED libs", n_needed); */
|
||||
|
||||
result = (char**)malloc((n_needed+1) * sizeof(char *));
|
||||
|
||||
n_needed = 0;
|
||||
if (lseek(fd, shdr.sh_offset, SEEK_SET) < 0) {
|
||||
SET_ERROR("Could not seek to .dynamic section of %s", library);
|
||||
close(fd);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
for (dynoff = 0; dynoff < shdr.sh_size; dynoff += sizeof(dyn)) {
|
||||
if (read(fd, &dyn, sizeof(dyn)) < (int) sizeof(dyn)) {
|
||||
SET_ERROR("Could not read .dynamic entry in %s", library);
|
||||
close(fd);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
if (dyn.d_tag == DT_NEEDED) {
|
||||
LOGI("needs: %s\n", dynstr + dyn.d_un.d_val);
|
||||
result[n_needed] = strdup(dynstr + dyn.d_un.d_val);
|
||||
n_needed++;
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
if (dynstr)
|
||||
free(dynstr);
|
||||
free(shstrtab);
|
||||
result[n_needed] = NULL;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
SET_ERROR("Could not find .dynamic section in %s", library);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
void *
|
||||
android_dlopen(const char *library)
|
||||
{
|
||||
//added by aydin.kim - parse ld_library_path
|
||||
char *libraries[256];
|
||||
int i1 = 0, icnt = 0;
|
||||
|
||||
char ld_library_path[1024];
|
||||
char* library_path = getenv("LD_LIBRARY_PATH");
|
||||
strcpy(ld_library_path, library_path);
|
||||
|
||||
// LOGI("LD_LIBRARY_PATH is : %s", ld_library_path);
|
||||
libraries[i1] = strtok(ld_library_path, ":");
|
||||
//LOGI("library : %s", libraries[i1]);
|
||||
while(libraries[i1]) {
|
||||
libraries[++i1] = strtok(NULL, ":");
|
||||
//LOGI("library : %s", libraries[i1]);
|
||||
}
|
||||
icnt = i1;
|
||||
|
||||
library_locations = (const char**)malloc((icnt+2) * sizeof(char *));
|
||||
for(int j = 0; j < icnt+2; j++)
|
||||
library_locations[j] = NULL;
|
||||
if(library_locations == NULL) {
|
||||
SET_ERROR("Cannot allocate library locations");
|
||||
return 0;
|
||||
}
|
||||
library_locations[0] = "/data/data/com.example.ServoAndroid/lib";
|
||||
// LOGI("added library path : %s", library_locations[0]);
|
||||
for(int i = 0; i < icnt; i++ ) {
|
||||
library_locations[i+1] = strdup(libraries[i]);
|
||||
// LOGI("added library path : %s", library_locations[i+1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* We should *not* try to just dlopen() the bare library name
|
||||
* first, as the stupid dynamic linker remembers for each library
|
||||
* basename if loading it has failed. Thus if you try loading it
|
||||
* once, and it fails because of missing needed libraries, and
|
||||
* your load those, and then try again, it fails with an
|
||||
* infuriating message "failed to load previously" in the log.
|
||||
*
|
||||
* We *must* first dlopen() all needed libraries, recursively. It
|
||||
* shouldn't matter if we dlopen() a library that already is
|
||||
* loaded, dlopen() just returns the same value then.
|
||||
*/
|
||||
|
||||
struct loadedLib {
|
||||
const char *name;
|
||||
void *handle;
|
||||
struct loadedLib *next;
|
||||
};
|
||||
static struct loadedLib *loaded_libraries = NULL;
|
||||
|
||||
struct loadedLib *rover;
|
||||
struct loadedLib *new_loaded_lib;
|
||||
|
||||
struct stat st;
|
||||
void *p;
|
||||
char *full_name = NULL;
|
||||
char **needed;
|
||||
int i;
|
||||
int found;
|
||||
|
||||
struct timeval tv0, tv1, tvdiff;
|
||||
|
||||
rover = loaded_libraries;
|
||||
while (rover != NULL &&
|
||||
strcmp(rover->name, library) != 0)
|
||||
rover = rover->next;
|
||||
|
||||
if (rover != NULL)
|
||||
return rover->handle;
|
||||
|
||||
/* LOGI("android_dlopen(%s)", library); */
|
||||
|
||||
found = 0;
|
||||
if (library[0] == '/') {
|
||||
full_name = strdup(library);
|
||||
|
||||
if (stat(full_name, &st) == 0 &&
|
||||
S_ISREG(st.st_mode)) {
|
||||
found = 1;
|
||||
} else {
|
||||
free(full_name);
|
||||
full_name = NULL;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; !found && library_locations[i] != NULL; i++) {
|
||||
full_name = (char*)malloc(strlen(library_locations[i]) + 1 + strlen(library) + 1);
|
||||
strcpy(full_name, library_locations[i]);
|
||||
strcat(full_name, "/");
|
||||
strcat(full_name, library);
|
||||
|
||||
if (stat(full_name, &st) == 0 &&
|
||||
S_ISREG(st.st_mode)) {
|
||||
found = 1;
|
||||
} else {
|
||||
free(full_name);
|
||||
full_name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
SET_ERROR("Library %s not found", library);
|
||||
assert(full_name == NULL); // full_name was freed above if !found
|
||||
return NULL;
|
||||
}
|
||||
|
||||
needed = android_dlneeds(full_name);
|
||||
if (needed == NULL) {
|
||||
free(full_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; needed[i] != NULL; i++) {
|
||||
if (android_dlopen(needed[i]) == NULL) {
|
||||
free_ptrarray((void **) needed);
|
||||
free(full_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
free_ptrarray((void **) needed);
|
||||
|
||||
gettimeofday(&tv0, NULL);
|
||||
p = dlopen(full_name, RTLD_LOCAL);
|
||||
gettimeofday(&tv1, NULL);
|
||||
timersub(&tv1, &tv0, &tvdiff);
|
||||
LOGI("dlopen(%s) = %p, %ld.%03lds",
|
||||
full_name, p,
|
||||
(long) tvdiff.tv_sec, (long) tvdiff.tv_usec / 1000);
|
||||
if (p == NULL)
|
||||
SET_ERROR("Error from dlopen(%s): %s", full_name, dlerror());
|
||||
free(full_name);
|
||||
full_name = NULL;
|
||||
|
||||
new_loaded_lib = (struct loadedLib*)malloc(sizeof(*new_loaded_lib));
|
||||
new_loaded_lib->name = strdup(library);
|
||||
new_loaded_lib->handle = p;
|
||||
|
||||
new_loaded_lib->next = loaded_libraries;
|
||||
loaded_libraries = new_loaded_lib;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
void *
|
||||
android_dlsym(void *handle,
|
||||
const char *symbol)
|
||||
{
|
||||
void *p = dlsym(handle, symbol);
|
||||
if (p == NULL)
|
||||
set_error("%s(%p,%s): %s", __FUNCTION__, handle, symbol, dlerror());
|
||||
return p;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
int
|
||||
android_dladdr(void *addr,
|
||||
Dl_info *info)
|
||||
{
|
||||
FILE *maps;
|
||||
char line[200];
|
||||
int result;
|
||||
int found;
|
||||
|
||||
result = dladdr(addr, info);
|
||||
if (result == 0) {
|
||||
/* LOGI("dladdr(%p) = 0", addr); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
maps = fopen("/proc/self/maps", "r");
|
||||
if (maps == NULL) {
|
||||
SET_ERROR("Could not open /proc/self/maps: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
found = 0;
|
||||
while (fgets(line, sizeof(line), maps) != NULL &&
|
||||
line[strlen(line)-1] == '\n') {
|
||||
void *lo, *hi;
|
||||
char file[sizeof(line)];
|
||||
file[0] = '\0';
|
||||
if (sscanf(line, "%x-%x %*s %*x %*x:%*x %*d %[^\n]", (unsigned *) &lo, (unsigned *) &hi, file) == 3) {
|
||||
/* LOGI("got %p-%p: %s", lo, hi, file); */
|
||||
if (addr >= lo && addr < hi) {
|
||||
if (info->dli_fbase != lo) {
|
||||
SET_ERROR("Base for %s in /proc/self/maps %p doesn't match what dladdr() said", file, lo);
|
||||
fclose(maps);
|
||||
return 0;
|
||||
}
|
||||
/* LOGI("dladdr(%p) = { %s:%p, %s:%p }: %s",
|
||||
addr,
|
||||
info->dli_fname, info->dli_fbase,
|
||||
info->dli_sname ? info->dli_sname : "(none)", info->dli_saddr,
|
||||
file); */
|
||||
info->dli_fname = strdup(file);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
SET_ERROR("Did not find %p in /proc/self/maps", addr);
|
||||
fclose(maps);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
int
|
||||
android_dlclose(void *handle)
|
||||
{
|
||||
/* As we don't know when the reference count for a dlopened shared
|
||||
* object drops to zero, we wouldn't know when to remove it from
|
||||
* our list, so we can't call dlclose().
|
||||
*/
|
||||
LOGI("ll_dlclose(%p)", handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
const char *
|
||||
android_dl_get_last_error()
|
||||
{
|
||||
return last_error;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
|
29
ports/android/jni/android-dl.h
Normal file
29
ports/android/jni/android-dl.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
char ** android_dlneeds(const char *library);
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
void * android_dlopen(const char *library);
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
void * android_dlsym(void *handle, const char *symbol);
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
int android_dladdr(void *addr, Dl_info *info);
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
int android_dlclose(void *handle);
|
||||
|
||||
__attribute__ ((visibility("default")))
|
||||
const char * android_dl_get_last_error();
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
14
ports/android/jni/common.cpp
Normal file
14
ports/android/jni/common.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "common.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void free_ptrarray(void **pa)
|
||||
{
|
||||
void **rover = pa;
|
||||
|
||||
while (*rover != NULL)
|
||||
free(*rover++);
|
||||
|
||||
free(pa);
|
||||
}
|
||||
|
||||
|
18
ports/android/jni/common.h
Normal file
18
ports/android/jni/common.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
#include <android/log.h>
|
||||
|
||||
#undef LOGI
|
||||
#undef LOGW
|
||||
|
||||
#define LOG_TAG "android-dl"
|
||||
#define LOGI(message, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "%s: " message, __FUNCTION__, ##__VA_ARGS__)
|
||||
#define LOGW(message, ...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "%s: " message, __FUNCTION__, ##__VA_ARGS__)
|
||||
#define LOGE(message, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "%s: " message, __FUNCTION__, ##__VA_ARGS__)
|
||||
#define LOGF(message, ...) __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, "%s: " message, __FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
/* Defines the signature of the function that's callable through Java dlcall */
|
||||
typedef int (*android_dlcall_func_t)(int, const char **);
|
||||
|
||||
void free_ptrarray(void **pa);
|
||||
|
||||
|
BIN
ports/android/jni/libfreeglut-gles2-old.a
Normal file
BIN
ports/android/jni/libfreeglut-gles2-old.a
Normal file
Binary file not shown.
BIN
ports/android/jni/libfreeglut-gles2.a
Normal file
BIN
ports/android/jni/libfreeglut-gles2.a
Normal file
Binary file not shown.
191
ports/android/jni/main.cpp
Normal file
191
ports/android/jni/main.cpp
Normal file
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <GL/freeglut.h>
|
||||
#include <GL/freeglut_ext.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <android/sensor.h>
|
||||
#include <android/log.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#include <android-dl.h>
|
||||
|
||||
#define LOG(prio, tag, a, args...) __android_log_print(prio, tag, "[%s::%d]"#a"",__FUNCTION__, __LINE__, ##args);
|
||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
|
||||
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
|
||||
|
||||
typedef void (*fty_glutMainLoopEvent)();
|
||||
typedef void (*fty_glutInit)(int*, char**);
|
||||
typedef void (*fty_glutInitDisplayMode)(unsigned int);
|
||||
typedef int (*fty_glutCreateWindow)(const char*);
|
||||
typedef void (*fty_glutDestroyWindow)(int);
|
||||
typedef void (*fty_glutPostRedisplay)();
|
||||
typedef void (*fty_glutSwapBuffers)();
|
||||
typedef int (*fty_glutGetWindow)();
|
||||
typedef void (*fty_glutSetWindow)(int);
|
||||
typedef void (*fty_glutReshapeWindow)(int ,int);
|
||||
typedef void (*fty_glutDisplayFunc)(void (*)());
|
||||
typedef void (*fty_glutReshapeFunc)(void (*)(int, int));
|
||||
typedef void (*fty_glutTimerFunc)(unsigned int, void (*)(int), int);
|
||||
typedef int (*fty_glutGet)(unsigned int);
|
||||
typedef void (*fty_glutKeyboardFunc)(void (*)(unsigned char, int, int));
|
||||
typedef void (*fty_glutMouseFunc)(void (*)(int, int, int, int));
|
||||
typedef void (*fty_glutMouseWheelFunc)(void (*)(int, int, int, int));
|
||||
typedef void (*fty_glutSetWindowTitle)(char const*);
|
||||
typedef void (*fty_glutIdleFunc)(void(*)());
|
||||
typedef void (*fty_glutInitWindowSize)(int, int);
|
||||
typedef int (*fty_glutGetModifiers)();
|
||||
|
||||
#define REGISTER_FUNCTION(lib, function)\
|
||||
void (*reg_fn_##function)(fty_##function);\
|
||||
*(void**)(®_fn_##function) = dlsym(lib, "reg_fn_" #function);\
|
||||
if (function == NULL) {\
|
||||
LOGW("could not find reg_fn_" #function " from " #lib);\
|
||||
return;\
|
||||
} else {\
|
||||
LOGI("loaded reg_fn_" #function " from " #lib);\
|
||||
reg_fn_##function(function);\
|
||||
LOGI("registerd "#function);\
|
||||
}\
|
||||
|
||||
static void init_servo()
|
||||
{
|
||||
LOGI("initializing native application for Servo");
|
||||
|
||||
setenv("RUST_LOG", "servo,gfx,msg,util,layers,js,glut,std,rt,extra", 1);
|
||||
|
||||
// setenv("SERVO_URL", "/mnt/sdcard/html/demo.html", 1);
|
||||
// setenv("RUST_THREADS", "1", 1);
|
||||
|
||||
// char* size_stack = getenv("RUST_MIN_STACK");
|
||||
// char* rust_log = getenv("RUST_LOG");
|
||||
// char* servo_url = getenv("SERVO_URL");
|
||||
|
||||
// LOGI("Stack Size is : %s", size_stack);
|
||||
// LOGI("RUST_LOG flag is : %s", rust_log);
|
||||
// LOGI("loading url is : %s", servo_url);
|
||||
|
||||
|
||||
LOGI("load servo library");
|
||||
void* libservo = android_dlopen("/data/data/com.example.ServoAndroid/lib/libservo.so");
|
||||
if (libservo == NULL) {
|
||||
LOGW("failed to load servo lib: %s", dlerror());
|
||||
return;
|
||||
}
|
||||
|
||||
REGISTER_FUNCTION(libservo, glutMainLoopEvent);
|
||||
REGISTER_FUNCTION(libservo, glutInit);
|
||||
REGISTER_FUNCTION(libservo, glutInitDisplayMode);
|
||||
REGISTER_FUNCTION(libservo, glutCreateWindow);
|
||||
REGISTER_FUNCTION(libservo, glutDestroyWindow);
|
||||
REGISTER_FUNCTION(libservo, glutPostRedisplay);
|
||||
REGISTER_FUNCTION(libservo, glutSwapBuffers);
|
||||
REGISTER_FUNCTION(libservo, glutGetWindow);
|
||||
REGISTER_FUNCTION(libservo, glutSetWindow);
|
||||
REGISTER_FUNCTION(libservo, glutReshapeWindow);
|
||||
REGISTER_FUNCTION(libservo, glutDisplayFunc);
|
||||
REGISTER_FUNCTION(libservo, glutReshapeFunc);
|
||||
REGISTER_FUNCTION(libservo, glutTimerFunc);
|
||||
REGISTER_FUNCTION(libservo, glutGet);
|
||||
REGISTER_FUNCTION(libservo, glutKeyboardFunc);
|
||||
REGISTER_FUNCTION(libservo, glutMouseFunc);
|
||||
REGISTER_FUNCTION(libservo, glutMouseWheelFunc);
|
||||
REGISTER_FUNCTION(libservo, glutSetWindowTitle);
|
||||
REGISTER_FUNCTION(libservo, glutIdleFunc);
|
||||
REGISTER_FUNCTION(libservo, glutInitWindowSize);
|
||||
REGISTER_FUNCTION(libservo, glutGetModifiers);
|
||||
|
||||
void (*main)(int, char**);
|
||||
*(void**)(&main) = dlsym(libservo, "android_start");
|
||||
if (main) {
|
||||
LOGI("go into android_start()");
|
||||
static const char* argv[] = {"servo", "/mnt/sdcard/html/about-mozilla.html"};
|
||||
(*main)(2, (char **)argv);
|
||||
return;
|
||||
}
|
||||
LOGW("could not find android_start() in the libServo shared library");
|
||||
}
|
||||
|
||||
extern "C" void *stderr_thread(void *) {
|
||||
int pipes[2];
|
||||
pipe(pipes);
|
||||
dup2(pipes[1], STDERR_FILENO);
|
||||
FILE *inputFile = fdopen(pipes[0], "r");
|
||||
char readBuffer[1024];
|
||||
while (1) {
|
||||
fgets(readBuffer, sizeof(readBuffer), inputFile);
|
||||
__android_log_write(2, "stderr", readBuffer);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern "C" void *stdout_thread(void *) {
|
||||
int pipes[2];
|
||||
pipe(pipes);
|
||||
dup2(pipes[1], STDOUT_FILENO);
|
||||
FILE *inputFile = fdopen(pipes[0], "r");
|
||||
char readBuffer[1024];
|
||||
while (1) {
|
||||
fgets(readBuffer, sizeof(readBuffer), inputFile);
|
||||
__android_log_write(2, "stdout", readBuffer);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pthread_t stderr_tid = -1;
|
||||
pthread_t stdout_tid = -1;
|
||||
|
||||
static void init_std_threads() {
|
||||
pthread_create(&stderr_tid, NULL, stderr_thread, NULL);
|
||||
pthread_create(&stdout_tid, NULL, stdout_thread, NULL);
|
||||
}
|
||||
|
||||
static void shutdown_std_threads() {
|
||||
// FIXME(larsberg): this needs to change to signal the threads
|
||||
// to exit, as pthread_cancel is not implemented on Android.
|
||||
}
|
||||
|
||||
|
||||
const int W = 2560;
|
||||
const int H = 1600;
|
||||
|
||||
static int init_display() {
|
||||
LOGI("initialize GLUT window");
|
||||
|
||||
glutInitWindowSize(W, H);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
init_display();
|
||||
init_std_threads();
|
||||
init_servo();
|
||||
shutdown_std_threads();
|
||||
|
||||
return 0;
|
||||
}
|
20
ports/android/proguard-project.txt
Normal file
20
ports/android/proguard-project.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
14
ports/android/project.properties
Normal file
14
ports/android/project.properties
Normal file
|
@ -0,0 +1,14 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-18
|
4
ports/android/res/values/strings.xml
Normal file
4
ports/android/res/values/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">ServoAndroid</string>
|
||||
</resources>
|
499
ports/cef/Cargo.lock
generated
Normal file
499
ports/cef/Cargo.lock
generated
Normal file
|
@ -0,0 +1,499 @@
|
|||
[root]
|
||||
name = "embedding"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"gfx 0.0.1",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14)",
|
||||
"glut 0.0.1 (git+https://github.com/servo/rust-glut#d351eed425464c58671c6ec33445ee896fd42ff1)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#c9bd679428e8e83e585702a949d593bda8ac04d6)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679)",
|
||||
"macros 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"script 0.0.1",
|
||||
"servo 0.0.1",
|
||||
"sharegl 0.1.0 (git+https://github.com/servo/sharegl#3706681b9f8ba3581220c875630118a0961e5ca2)",
|
||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c)",
|
||||
"style 0.0.1",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alert"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e"
|
||||
dependencies = [
|
||||
"cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa#f5da9ccfaeb701ff1b5ab9e1784e999d04530e8f)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "azure"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"skia-sys 0.0.20130412 (git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "canvas"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-cocoa#f5da9ccfaeb701ff1b5ab9e1784e999d04530e8f"
|
||||
|
||||
[[package]]
|
||||
name = "compositing"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"alert 0.1.0 (git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"gfx 0.0.1",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14)",
|
||||
"glut 0.0.1 (git+https://github.com/servo/rust-glut#d351eed425464c58671c6ec33445ee896fd42ff1)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679)",
|
||||
"layout_traits 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"script_traits 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_foundation"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff"
|
||||
|
||||
[[package]]
|
||||
name = "core_graphics"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f"
|
||||
dependencies = [
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b"
|
||||
|
||||
[[package]]
|
||||
name = "encoding"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7"
|
||||
|
||||
[[package]]
|
||||
name = "expat-sys"
|
||||
version = "2.1.0"
|
||||
source = "git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357c58df3a1"
|
||||
|
||||
[[package]]
|
||||
name = "fontconfig"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-fontconfig#6e02b6df7815dc4bf1f8ef20b926e717891f8544"
|
||||
dependencies = [
|
||||
"fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig#1fc43065f581d70133d819070177094434cc3144)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fontconfig-sys"
|
||||
version = "2.11.1"
|
||||
source = "git+https://github.com/servo/libfontconfig#1fc43065f581d70133d819070177094434cc3144"
|
||||
dependencies = [
|
||||
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357c58df3a1)",
|
||||
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b96d07de55521)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "freetype"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e"
|
||||
|
||||
[[package]]
|
||||
name = "freetype-sys"
|
||||
version = "2.4.11"
|
||||
source = "git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b96d07de55521"
|
||||
|
||||
[[package]]
|
||||
name = "geom"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489"
|
||||
|
||||
[[package]]
|
||||
name = "gfx"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig#6e02b6df7815dc4bf1f8ef20b926e717891f8544)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz#f07c6ae3111a94945f0f04b5f0d7c4e7c20958e9)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679)",
|
||||
"macros 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c)",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glfw"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14"
|
||||
dependencies = [
|
||||
"link_glfw 0.1.0 (git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14)",
|
||||
"semver 0.0.1 (git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glut"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/rust-glut#d351eed425464c58671c6ec33445ee896fd42ff1"
|
||||
dependencies = [
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "harfbuzz"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-harfbuzz#f07c6ae3111a94945f0f04b5f0d7c4e7c20958e9"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.1.0-pre"
|
||||
source = "git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372"
|
||||
dependencies = [
|
||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git#cd40d25cb5721064c5c2002c41a616d2dba7399a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hubbub"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-hubbub#c7f868e688de6e9cbdc26aa09292ed072bc2648b"
|
||||
dependencies = [
|
||||
"hubbub-sys 0.1.2 (git+https://github.com/servo/libhubbub#6d09893991dedc616b264058442a304c03842213)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hubbub-sys"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/servo/libhubbub#6d09893991dedc616b264058442a304c03842213"
|
||||
dependencies = [
|
||||
"parserutils-sys 0.1.1 (git+http://github.com/servo/libparserutils#651b636ba1214bceeb0907adb1eab60efe0d4598)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io_surface"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-mozjs#c9bd679428e8e83e585702a949d593bda8ac04d6"
|
||||
dependencies = [
|
||||
"mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7c2c88)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"gfx 0.0.1",
|
||||
"layout_traits 0.0.1",
|
||||
"macros 0.0.1",
|
||||
"net 0.0.1",
|
||||
"script 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"gfx 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "link_glfw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/glfw-rs?ref=servo#a646f0badaccaebd61d0f8aaec5646da0a7c2a14"
|
||||
|
||||
[[package]]
|
||||
name = "macros"
|
||||
version = "0.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "mozjs-sys"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7c2c88"
|
||||
|
||||
[[package]]
|
||||
name = "msg"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#b8a3eaf37cc3569e49fbc35ae891d816aaad7679)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opengles"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-openssl.git#cd40d25cb5721064c5c2002c41a616d2dba7399a"
|
||||
|
||||
[[package]]
|
||||
name = "parserutils-sys"
|
||||
version = "0.1.1"
|
||||
source = "git+http://github.com/servo/libparserutils#651b636ba1214bceeb0907adb1eab60efe0d4598"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b"
|
||||
|
||||
[[package]]
|
||||
name = "phf_mac"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16"
|
||||
dependencies = [
|
||||
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png-sys"
|
||||
version = "1.6.3"
|
||||
source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98"
|
||||
|
||||
[[package]]
|
||||
name = "script"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"canvas 0.0.1",
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"gfx 0.0.1",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372)",
|
||||
"hubbub 0.1.0 (git+https://github.com/servo/rust-hubbub#c7f868e688de6e9cbdc26aa09292ed072bc2648b)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#c9bd679428e8e83e585702a949d593bda8ac04d6)",
|
||||
"macros 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "script_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe"
|
||||
|
||||
[[package]]
|
||||
name = "servo"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"compositing 0.0.1",
|
||||
"gfx 0.0.1",
|
||||
"layout 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"script 0.0.1",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sharegl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/sharegl#3706681b9f8ba3581220c875630118a0961e5ca2"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "skia-sys"
|
||||
version = "0.0.20130412"
|
||||
source = "git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92"
|
||||
dependencies = [
|
||||
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357c58df3a1)",
|
||||
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b96d07de55521)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stb_image"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/string-cache#aa4365ac8da8504a82c709f97b6bcace9b0af4a1"
|
||||
dependencies = [
|
||||
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b)",
|
||||
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b)",
|
||||
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#aa4365ac8da8504a82c709f97b6bcace9b0af4a1)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "string_cache_macros"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/string-cache#aa4365ac8da8504a82c709f97b6bcace9b0af4a1"
|
||||
|
||||
[[package]]
|
||||
name = "style"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"macros 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "task_info"
|
||||
version = "0.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a"
|
||||
dependencies = [
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "util"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#aa4365ac8da8504a82c709f97b6bcace9b0af4a1)",
|
||||
"task_info 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xlib"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8"
|
||||
|
70
ports/cef/Cargo.toml
Normal file
70
ports/cef/Cargo.toml
Normal file
|
@ -0,0 +1,70 @@
|
|||
[package]
|
||||
name = "embedding"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "embedding"
|
||||
path = "lib.rs"
|
||||
crate-type = ["dylib"]
|
||||
|
||||
[dependencies.servo]
|
||||
path = "../.."
|
||||
|
||||
[dependencies.macros]
|
||||
path = "../../components/macros"
|
||||
|
||||
[dependencies.gfx]
|
||||
path = "../../components/gfx"
|
||||
|
||||
[dependencies.script]
|
||||
path = "../../components/script"
|
||||
|
||||
[dependencies.net]
|
||||
path = "../../components/net"
|
||||
|
||||
[dependencies.msg]
|
||||
path = "../../components/msg"
|
||||
|
||||
[dependencies.util]
|
||||
path = "../../components/util"
|
||||
|
||||
[dependencies.style]
|
||||
path = "../../components/style"
|
||||
|
||||
[dependencies.azure]
|
||||
git = "https://github.com/servo/rust-azure"
|
||||
|
||||
[dependencies.geom]
|
||||
git = "https://github.com/servo/rust-geom"
|
||||
|
||||
[dependencies.glfw]
|
||||
git = "https://github.com/servo/glfw-rs"
|
||||
branch = "servo"
|
||||
|
||||
[dependencies.glut]
|
||||
git = "https://github.com/servo/rust-glut"
|
||||
|
||||
[dependencies.js]
|
||||
git = "https://github.com/servo/rust-mozjs"
|
||||
|
||||
[dependencies.layers]
|
||||
git = "https://github.com/servo/rust-layers"
|
||||
|
||||
[dependencies.opengles]
|
||||
git = "https://github.com/servo/rust-opengles"
|
||||
|
||||
[dependencies.png]
|
||||
git = "https://github.com/servo/rust-png"
|
||||
|
||||
[dependencies.sharegl]
|
||||
git = "https://github.com/servo/sharegl"
|
||||
|
||||
[dependencies.stb_image]
|
||||
git = "https://github.com/servo/rust-stb-image"
|
||||
|
||||
[dependencies.core_graphics]
|
||||
git = "https://github.com/servo/rust-core-graphics"
|
||||
|
||||
[dependencies.core_text]
|
||||
git = "https://github.com/servo/rust-core-text"
|
12
ports/cef/README.md
Normal file
12
ports/cef/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
How to test:
|
||||
|
||||
1. Go to http://cefbuilds.com/ and download a binary for your OS/arch
|
||||
2. Unpack the (huge) archive
|
||||
3. Create both Debug and Release build types for CEF (```./build.sh [Debug|Release]```)
|
||||
4. Build servo
|
||||
5. Run a CEF-based executable with the embedding crate preloaded:
|
||||
* Linux: ```LD_LIBRARY_PATH=/path/to/cef-bin-unpack-dir/out/$build_type LD_PRELOAD=/path/to/servo/build/libembedding-*.so [CEF EXE]```
|
||||
6. Enjoy CEF-powered crashes
|
||||
|
||||
Notes:
|
||||
* Running with the Debug build in GDB is EXTREMELY slow on startup. Only use this if you are actively debugging an unimplemented CEF interaction.
|
31
ports/cef/browser.rs
Normal file
31
ports/cef/browser.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use libc::{calloc, size_t,c_int};
|
||||
use std::mem;
|
||||
use types::{cef_browser_settings_t, cef_browser_t, cef_client_t, cef_request_context_t, cef_string_t, cef_window_info_t};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_browser_host_create_browser(_windowInfo: *const cef_window_info_t,
|
||||
_client: *mut cef_client_t,
|
||||
_url: *const cef_string_t,
|
||||
_settings: *const cef_browser_settings_t,
|
||||
_request_context: *mut cef_request_context_t)
|
||||
-> c_int {
|
||||
0
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_browser_host_create_browser_sync(_windowInfo: *const cef_window_info_t,
|
||||
_client: *mut cef_client_t,
|
||||
_url: *const cef_string_t,
|
||||
_settings: *const cef_browser_settings_t,
|
||||
_request_context: *mut cef_request_context_t)
|
||||
-> *mut cef_browser_t {
|
||||
unsafe {
|
||||
let browser = calloc(1, mem::size_of::<cef_browser_t>() as size_t) as *mut cef_browser_t;
|
||||
browser
|
||||
}
|
||||
}
|
92
ports/cef/command_line.rs
Normal file
92
ports/cef/command_line.rs
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use libc::{calloc, c_int, size_t};
|
||||
use std::mem;
|
||||
use std::string;
|
||||
use std::c_vec::CVec;
|
||||
use string::{cef_string_userfree_utf16_alloc, cef_string_utf16_set};
|
||||
use types::{cef_command_line_t, cef_string_t, cef_string_userfree_t, cef_string_utf16_t};
|
||||
|
||||
type command_line_t = command_line;
|
||||
struct command_line {
|
||||
pub cl: cef_command_line_t,
|
||||
pub argc: c_int,
|
||||
pub argv: Vec<String>,
|
||||
}
|
||||
|
||||
static mut GLOBAL_CMDLINE: Option<*mut command_line_t> = None;
|
||||
|
||||
fn command_line_new() -> *mut command_line_t {
|
||||
unsafe {
|
||||
let cl = calloc(1, mem::size_of::<command_line>() as size_t) as *mut command_line_t;
|
||||
(*cl).cl.base.size = mem::size_of::<cef_command_line_t>() as size_t;
|
||||
cl
|
||||
}
|
||||
}
|
||||
|
||||
pub fn command_line_init(argc: c_int, argv: *const *const u8) {
|
||||
unsafe {
|
||||
let mut a: Vec<String> = vec!();
|
||||
for i in range(0u, argc as uint) {
|
||||
a.push(string::raw::from_buf(*argv.offset(i as int) as *const u8));
|
||||
}
|
||||
let cl = command_line_new();
|
||||
(*cl).argc = argc;
|
||||
(*cl).argv = a;
|
||||
(*cl).cl.get_switch_value = command_line_get_switch_value;
|
||||
GLOBAL_CMDLINE = Some(cl);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, name: *const cef_string_t) -> *mut cef_string_userfree_t {
|
||||
if cmd.is_null() || name.is_null() {
|
||||
return 0 as *mut cef_string_userfree_t;
|
||||
}
|
||||
unsafe {
|
||||
//technically cef_string_t can be any type of character size
|
||||
//but the default cef callback uses utf16, so I'm jumping on board the SS Copy
|
||||
let cl: *mut command_line_t = mem::transmute(cmd);
|
||||
let cs: *const cef_string_utf16_t = mem::transmute(name);
|
||||
let opt = String::from_utf16(CVec::new((*cs).str, (*cs).length as uint).as_slice()).unwrap();
|
||||
//debug!("opt: {}", opt);
|
||||
for s in (*cl).argv.iter() {
|
||||
let o = s.as_slice().trim_left_chars('-');
|
||||
//debug!("arg: {}", o);
|
||||
if o.as_slice().starts_with(opt.as_slice()) {
|
||||
let string = cef_string_userfree_utf16_alloc() as *mut cef_string_utf16_t;
|
||||
let arg = o.slice_from(opt.len() + 1).as_bytes();
|
||||
arg.with_c_str(|c_str| {
|
||||
cef_string_utf16_set(mem::transmute(c_str), arg.len() as size_t, string, 1);
|
||||
});
|
||||
return string as *mut cef_string_userfree_t
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0 as *mut cef_string_userfree_t;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_command_line_create() -> *mut cef_command_line_t {
|
||||
unsafe {
|
||||
let cl = command_line_new();
|
||||
(*cl).cl.get_switch_value = command_line_get_switch_value;
|
||||
mem::transmute(cl)
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_command_line_get_global() -> *mut cef_command_line_t {
|
||||
unsafe {
|
||||
match GLOBAL_CMDLINE {
|
||||
Some(scl) => {
|
||||
mem::transmute(scl)
|
||||
},
|
||||
None => {
|
||||
0 as *mut cef_command_line_t
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
86
ports/cef/core.rs
Normal file
86
ports/cef/core.rs
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use azure;
|
||||
use command_line::command_line_init;
|
||||
use eutil::fptr_is_null;
|
||||
use libc::{c_int, c_void};
|
||||
use native;
|
||||
use servo;
|
||||
use servo_util::opts;
|
||||
use std::mem;
|
||||
use types::{cef_app_t, cef_main_args_t, cef_settings_t};
|
||||
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
|
||||
_settings: *mut cef_settings_t,
|
||||
application: *mut cef_app_t,
|
||||
_windows_sandbox_info: *const c_void)
|
||||
-> c_int {
|
||||
if args.is_null() {
|
||||
return 0;
|
||||
}
|
||||
unsafe {
|
||||
command_line_init((*args).argc, (*args).argv);
|
||||
let cb = (*application).get_browser_process_handler;
|
||||
if !fptr_is_null(mem::transmute(cb)) {
|
||||
let handler = cb(application);
|
||||
if handler.is_not_null() {
|
||||
let hcb = (*handler).on_context_initialized;
|
||||
if !fptr_is_null(mem::transmute(hcb)) {
|
||||
hcb(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_shutdown() {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_run_message_loop() {
|
||||
let mut urls = Vec::new();
|
||||
urls.push("http://s27.postimg.org/vqbtrolyr/servo.jpg".to_string());
|
||||
let opts = opts::Opts {
|
||||
urls: urls,
|
||||
render_backend: azure::azure_hl::SkiaBackend,
|
||||
n_render_threads: 1,
|
||||
cpu_painting: false,
|
||||
tile_size: 512,
|
||||
device_pixels_per_px: None,
|
||||
time_profiler_period: None,
|
||||
memory_profiler_period: None,
|
||||
enable_experimental: false,
|
||||
layout_threads: 1,
|
||||
//layout_threads: cmp::max(rt::default_sched_threads() * 3 / 4, 1),
|
||||
exit_after_load: false,
|
||||
output_file: None,
|
||||
headless: false,
|
||||
hard_fail: false,
|
||||
bubble_inline_sizes_separately: false,
|
||||
show_debug_borders: false,
|
||||
enable_text_antialiasing: true,
|
||||
trace_layout: false,
|
||||
};
|
||||
native::start(0, 0 as *const *const u8, proc() {
|
||||
servo::run(opts);
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_quit_message_loop() {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_execute_process(_args: *const cef_main_args_t,
|
||||
_app: *mut cef_app_t,
|
||||
_windows_sandbox_info: *mut c_void)
|
||||
-> c_int {
|
||||
-1
|
||||
}
|
7
ports/cef/eutil.rs
Normal file
7
ports/cef/eutil.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub fn fptr_is_null(fptr: *const u8) -> bool {
|
||||
fptr.is_null()
|
||||
}
|
59
ports/cef/lib.rs
Normal file
59
ports/cef/lib.rs
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(globs, macro_rules, phase, thread_local, link_args)]
|
||||
|
||||
#![allow(experimental, non_camel_case_types)]
|
||||
|
||||
#![feature(phase)]
|
||||
#[phase(plugin, link)]
|
||||
extern crate log;
|
||||
|
||||
extern crate rustuv;
|
||||
|
||||
extern crate servo_macros = "macros";
|
||||
extern crate servo;
|
||||
|
||||
extern crate azure;
|
||||
extern crate geom;
|
||||
extern crate gfx;
|
||||
#[cfg(not(target_os="android"))]
|
||||
extern crate glfw;
|
||||
#[cfg(target_os="android")]
|
||||
extern crate glut;
|
||||
extern crate js;
|
||||
extern crate layers;
|
||||
extern crate opengles;
|
||||
extern crate png;
|
||||
extern crate script;
|
||||
|
||||
extern crate servo_net = "net";
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate servo_util = "util";
|
||||
extern crate style;
|
||||
extern crate sharegl;
|
||||
extern crate stb_image;
|
||||
|
||||
extern crate green;
|
||||
extern crate native;
|
||||
extern crate libc;
|
||||
extern crate std_url = "url";
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
extern crate core_graphics;
|
||||
#[cfg(target_os="macos")]
|
||||
extern crate core_text;
|
||||
|
||||
pub mod browser;
|
||||
pub mod command_line;
|
||||
pub mod core;
|
||||
pub mod eutil;
|
||||
#[cfg(target_os="linux")] #[cfg(target_os="macos")]
|
||||
pub mod mem;
|
||||
pub mod request;
|
||||
pub mod string;
|
||||
pub mod task;
|
||||
pub mod types;
|
||||
pub mod urlrequest;
|
||||
|
57
ports/cef/mem.rs
Normal file
57
ports/cef/mem.rs
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use libc::{c_void, size_t};
|
||||
use std::mem;
|
||||
use std::ptr::set_memory;
|
||||
|
||||
#[link_args="-Wl,-U,_tc_new -Wl,-U,_tc_newarray -Wl,-U,_tc_delete -Wl,-U,_tc_deletearray"]
|
||||
extern "C" {
|
||||
fn tc_new(size: size_t) -> *mut c_void;
|
||||
fn tc_delete(mem: *mut c_void);
|
||||
fn tc_newarray(size: size_t) -> *mut c_void;
|
||||
fn tc_deletearray(mem: *mut c_void);
|
||||
}
|
||||
|
||||
#[allow(experimental)]
|
||||
pub fn newarray0<T>(nmem: size_t) -> *mut T {
|
||||
let mem = newarray::<T>(nmem) as *mut T;
|
||||
unsafe {
|
||||
set_memory(mem, 0 as u8, nmem as uint);
|
||||
}
|
||||
mem
|
||||
}
|
||||
|
||||
pub fn newarray<T>(nmem: size_t) -> *mut T {
|
||||
unsafe {
|
||||
tc_newarray(nmem * mem::size_of::<T>() as size_t) as *mut T
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(experimental)]
|
||||
pub fn new0<T>(nmem: size_t) -> *mut T {
|
||||
let mem = new(nmem * mem::size_of::<T>() as size_t) as *mut T;
|
||||
unsafe {
|
||||
set_memory(mem, 0 as u8, nmem as uint);
|
||||
}
|
||||
mem
|
||||
}
|
||||
|
||||
pub fn new(size: size_t) -> *mut c_void {
|
||||
unsafe {
|
||||
tc_new(size)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn delete(mem: *mut c_void) {
|
||||
unsafe {
|
||||
tc_delete(mem)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn deletearray(mem: *mut c_void) {
|
||||
unsafe {
|
||||
tc_deletearray(mem)
|
||||
}
|
||||
}
|
21
ports/cef/request.rs
Normal file
21
ports/cef/request.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use types::{cef_post_data_element_t, cef_post_data_t, cef_request_t};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_request_create() -> *mut cef_request_t {
|
||||
0 as *mut cef_request_t
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_post_data_create() -> *mut cef_post_data_t {
|
||||
0 as *mut cef_post_data_t
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_post_data_element_create() -> *mut cef_post_data_element_t {
|
||||
0 as *mut cef_post_data_element_t
|
||||
}
|
177
ports/cef/string.rs
Normal file
177
ports/cef/string.rs
Normal file
|
@ -0,0 +1,177 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use eutil::fptr_is_null;
|
||||
use libc::{size_t, c_int, c_ushort,c_void};
|
||||
use libc::types::os::arch::c95::wchar_t;
|
||||
use mem::{new0,newarray0,delete,deletearray};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use types::{cef_string_utf16_t, cef_string_utf8_t, cef_string_wide_t};
|
||||
use types::{cef_string_userfree_utf16_t, cef_string_userfree_utf8_t, cef_string_userfree_wide_t};
|
||||
|
||||
//cef_string
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn string_wide_dtor(str: *mut wchar_t) {
|
||||
deletearray(str as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn string_utf8_dtor(str: *mut u8) {
|
||||
deletearray(str as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn string_utf16_dtor(str: *mut c_ushort) {
|
||||
deletearray(str as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_wide_free(cs: *mut cef_string_userfree_wide_t) {
|
||||
cef_string_wide_clear(cs);
|
||||
delete(cs as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_utf8_free(cs: *mut cef_string_userfree_utf8_t) {
|
||||
cef_string_utf8_clear(cs);
|
||||
delete(cs as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_utf16_free(cs: *mut cef_string_userfree_utf16_t) {
|
||||
cef_string_utf16_clear(cs);
|
||||
delete(cs as *mut c_void)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_utf8_clear(cs: *mut cef_string_utf8_t) {
|
||||
unsafe {
|
||||
if !fptr_is_null(mem::transmute((*cs).dtor)) {
|
||||
let dtor = (*cs).dtor;
|
||||
dtor((*cs).str);
|
||||
}
|
||||
(*cs).length = 0;
|
||||
(*cs).str = 0 as *mut u8;
|
||||
(*cs).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_utf8_alloc() -> *mut cef_string_utf8_t {
|
||||
#![inline(never)]
|
||||
new0::<cef_string_utf8_t>(1)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_utf8_set(src: *const u8, src_len: size_t, output: *mut cef_string_utf8_t, copy: c_int) -> c_int {
|
||||
cef_string_utf8_clear(output);
|
||||
unsafe {
|
||||
if copy != 0 {
|
||||
if !src.is_null() && src_len > 0 {
|
||||
(*output).str = newarray0::<u8>(src_len + 1);
|
||||
if (*output).str.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr::copy_memory((*output).str, src, src_len as uint);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = string_utf8_dtor;
|
||||
}
|
||||
} else {
|
||||
(*output).str = mem::transmute(src);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_utf16_clear(cs: *mut cef_string_utf16_t) {
|
||||
unsafe {
|
||||
if !fptr_is_null(mem::transmute((*cs).dtor)) {
|
||||
let dtor = (*cs).dtor;
|
||||
dtor((*cs).str);
|
||||
}
|
||||
(*cs).length = 0;
|
||||
(*cs).str = 0 as *mut c_ushort;
|
||||
(*cs).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_utf16_alloc() -> *mut cef_string_utf16_t {
|
||||
#![inline(never)]
|
||||
new0::<cef_string_utf16_t>(1)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, output: *mut cef_string_utf16_t, copy: c_int) -> c_int {
|
||||
cef_string_utf16_clear(output);
|
||||
unsafe {
|
||||
if copy != 0 {
|
||||
if !src.is_null() && src_len > 0 {
|
||||
(*output).str = newarray0::<c_ushort>(src_len + 1);
|
||||
if (*output).str.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr::copy_memory((*output).str, src, src_len as uint);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = string_utf16_dtor;
|
||||
}
|
||||
} else {
|
||||
(*output).str = mem::transmute(src);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_wide_clear(cs: *mut cef_string_wide_t) {
|
||||
unsafe {
|
||||
if !fptr_is_null(mem::transmute((*cs).dtor)) {
|
||||
let dtor = (*cs).dtor;
|
||||
dtor((*cs).str);
|
||||
}
|
||||
(*cs).length = 0;
|
||||
(*cs).str = 0 as *mut wchar_t;
|
||||
(*cs).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_userfree_wide_alloc() -> *mut cef_string_wide_t {
|
||||
#![inline(never)]
|
||||
new0::<cef_string_wide_t>(1)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_string_wide_set(src: *const wchar_t, src_len: size_t, output: *mut cef_string_wide_t, copy: c_int) -> c_int {
|
||||
cef_string_wide_clear(output);
|
||||
unsafe {
|
||||
if copy != 0 {
|
||||
if !src.is_null() && src_len > 0 {
|
||||
(*output).str = newarray0::<wchar_t>(src_len + 1);
|
||||
if (*output).str.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr::copy_memory((*output).str, src, src_len as uint);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = string_wide_dtor;
|
||||
}
|
||||
} else {
|
||||
(*output).str = mem::transmute(src);
|
||||
(*output).length = src_len;
|
||||
(*output).dtor = mem::transmute(0 as *const u8);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
12
ports/cef/task.rs
Normal file
12
ports/cef/task.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use libc::c_int;
|
||||
use types::cef_thread_id_t;
|
||||
|
||||
//FIXME: this should check the current servo task I guess?
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_currently_on(_tid: cef_thread_id_t) -> c_int {
|
||||
1
|
||||
}
|
1899
ports/cef/types.rs
Normal file
1899
ports/cef/types.rs
Normal file
File diff suppressed because it is too large
Load diff
14
ports/cef/urlrequest.rs
Normal file
14
ports/cef/urlrequest.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use types::{cef_request_t, cef_urlrequest_client_t, cef_urlrequest_t};
|
||||
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_urlrequest_create(_request: *mut cef_request_t,
|
||||
_client: *mut cef_urlrequest_client_t)
|
||||
-> *mut cef_urlrequest_t {
|
||||
0 as *mut cef_urlrequest_t
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue