AccelerometerDelegateWrapper.h   AccelerometerDelegateWrapper.h 
skipping to change at line 41 skipping to change at line 41
cocos2d::CCAccelerometerDelegate *delegate_; cocos2d::CCAccelerometerDelegate *delegate_;
cocos2d::CCAcceleration *acceleration_; cocos2d::CCAcceleration *acceleration_;
} }
@property(readwrite) cocos2d::CCAccelerometerDelegate *delegate_; @property(readwrite) cocos2d::CCAccelerometerDelegate *delegate_;
@property(readwrite) cocos2d::CCAcceleration *acceleration_; @property(readwrite) cocos2d::CCAcceleration *acceleration_;
+ (id) sharedAccelerometerDispather; + (id) sharedAccelerometerDispather;
- (id) init; - (id) init;
- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate; - (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate;
- (void) setAccelerometerInterval:(float)interval;
@end @end
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 AppController.h   AppController.h 
skipping to change at line 25 skipping to change at line 25
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH E FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH E
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FR OM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FR OM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
************************************************************************** **/ ************************************************************************** **/
@class RootViewController; #pragma once
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDe #import "cocos2d.h"
legate, UITextFieldDelegate,UIApplicationDelegate> { #import "EAGLView.h"
UIWindow *window;
RootViewController *viewController; @interface AppController : NSObject <NSApplicationDelegate>
} {
NSWindow *window;
EAGLView *glView;
}
@property (nonatomic, assign) IBOutlet NSWindow* window;
@property (nonatomic, assign) IBOutlet EAGLView* glView;
-(IBAction) toggleFullScreen:(id)sender;
-(IBAction) exitFullScreen:(id)sender;
@end @end
 End of changes. 2 change blocks. 
6 lines changed or deleted 15 lines changed or added


 AppDelegate.h   AppDelegate.h 
#ifndef _APP_DELEGATE_H_ #ifndef __APP_DELEGATE_H__
#define _APP_DELEGATE_H_ #define __APP_DELEGATE_H__
#include "cocos2d.h" #include "cocos2d.h"
/** /**
@brief The cocos2d Application. @brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface c all by CCDirector. The reason for implement as private inheritance is to hide some interface c all by CCDirector.
*/ */
class AppDelegate : private cocos2d::CCApplication class AppDelegate : private cocos2d::CCApplication
{ {
skipping to change at line 37 skipping to change at line 37
*/ */
virtual void applicationDidEnterBackground(); virtual void applicationDidEnterBackground();
/** /**
@brief The function be called when the application enter foreground @brief The function be called when the application enter foreground
@param the pointer of the application @param the pointer of the application
*/ */
virtual void applicationWillEnterForeground(); virtual void applicationWillEnterForeground();
}; };
#endif // _APP_DELEGATE_H_ #endif // __APP_DELEGATE_H__
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 Assertions.h   Assertions.h 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Walden <jwalden+code@mit.edu>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Implementations of runtime and static assertion macros for C and C++. */ /* Implementations of runtime and static assertion macros for C and C++. */
#ifndef mozilla_Assertions_h_ #ifndef mozilla_Assertions_h_
#define mozilla_Assertions_h_ #define mozilla_Assertions_h_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Types.h"
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef WIN32 #ifdef WIN32
/*
* TerminateProcess and GetCurrentProcess are defined in <winbase.h>, wh
ich
* further depends on <windef.h>. We hardcode these few definitions man
ually
* because those headers clutter the global namespace with a significant
* number of undesired macros and symbols.
*/
# ifdef __cplusplus
extern "C" {
# endif
__declspec(dllimport) int __stdcall
TerminateProcess(void* hProcess, unsigned int uExitCode);
__declspec(dllimport) void* __stdcall GetCurrentProcess(void);
# ifdef __cplusplus
}
# endif
#else
# include <signal.h> # include <signal.h>
#endif #endif
#ifdef ANDROID #ifdef ANDROID
# include <android/log.h> # include <android/log.h>
#endif #endif
/* /*
* MOZ_STATIC_ASSERT may be used to assert a condition *at compile time*. This * MOZ_STATIC_ASSERT may be used to assert a condition *at compile time*. This
* can be useful when you make certain assumptions about what must hold for * can be useful when you make certain assumptions about what must hold for
* optimal, or even correct, behavior. For example, you might assert that the * optimal, or even correct, behavior. For example, you might assert that the
skipping to change at line 143 skipping to change at line 124
extern void MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)(int arg[(cond) ? 1 : -1]) extern void MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)(int arg[(cond) ? 1 : -1])
# endif # endif
#endif #endif
#define MOZ_STATIC_ASSERT_IF(cond, expr, reason) MOZ_STATIC_ASSERT(!(cond) || (expr), reason) #define MOZ_STATIC_ASSERT_IF(cond, expr, reason) MOZ_STATIC_ASSERT(!(cond) || (expr), reason)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if defined(WIN32) /*
/* * MOZ_CRASH crashes the program, plain and simple, in a Breakpad-compatibl
* We used to call DebugBreak() on Windows, but amazingly, it causes e
* the MSVS 2010 debugger not to be able to recover a call stack. * way, in both debug and release builds.
*/ *
# define MOZ_CRASH() \ * MOZ_CRASH is a good solution for "handling" failure cases when you're
do { \ * unwilling or unable to handle them more cleanly -- for OOM, for likely m
*((volatile int *) NULL) = 123; \ emory
exit(3); \ * corruption, and so on. It's also a good solution if you need safe behav
} while (0) ior
#elif defined(ANDROID) * in release builds as well as debug builds. But if the failure is one th
at
* should be debugged and fixed, MOZ_ASSERT is generally preferable.
*/
#if defined(_MSC_VER)
/* /*
* On Android, raise(SIGABRT) is handled asynchronously. Seg fault now * On MSVC use the __debugbreak compiler intrinsic, which produces an in
* so we crash immediately and capture the current call stack. We need line
* to specifically use the global namespace in the C++ case. * (not nested in a system function) breakpoint. This distinctively inv
okes
* Breakpad without requiring system library symbols on all stack-proces
sing
* machines, as a nested breakpoint would require. We use TerminateProc
ess
* with the exit code aborting would generate because we don't want to i
nvoke
* atexit handlers, destructors, library unload handlers, and so on when
our
* process might be in a compromised state. We don't use abort() becaus
e
* it'd cause Windows to annoyingly pop up the process error dialog mult
iple
* times. See bug 345118 and bug 426163.
*
* (Technically these are Windows requirements, not MSVC requirements.
But
* practically you need MSVC for debugging, and we only ship builds crea
ted
* by MSVC, so doing it this way reduces complexity.)
*/ */
# ifdef __cplusplus # ifdef __cplusplus
# define MOZ_CRASH() \ # define MOZ_CRASH() \
do { \ do { \
*((volatile int *) NULL) = 123; \ __debugbreak(); \
*((volatile int*) NULL) = 123; \
::TerminateProcess(::GetCurrentProcess(), 3); \
} while (0)
# else
# define MOZ_CRASH() \
do { \
__debugbreak(); \
*((volatile int*) NULL) = 123; \
TerminateProcess(GetCurrentProcess(), 3); \
} while (0)
# endif
#else
# ifdef __cplusplus
# define MOZ_CRASH() \
do { \
*((volatile int*) NULL) = 123; \
::abort(); \ ::abort(); \
} while (0) } while (0)
# else # else
# define MOZ_CRASH() \ # define MOZ_CRASH() \
do { \ do { \
*((volatile int *) NULL) = 123; \ *((volatile int*) NULL) = 123; \
abort(); \ abort(); \
} while (0) } while (0)
# endif # endif
#elif defined(__APPLE__)
/*
* On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
* trapped.
*/
# define MOZ_CRASH() \
do { \
*((volatile int *) NULL) = 123; \
raise(SIGABRT); /* In case above statement gets nixed by the optimi
zer. */ \
} while (0)
#else
# define MOZ_CRASH() \
do { \
raise(SIGABRT); /* To continue from here in GDB: "signal 0". */ \
} while (0)
#endif #endif
extern MFBT_API(void) /*
MOZ_Assert(const char* s, const char* file, int ln); * Prints |s| as an assertion failure (using file and ln as the location of
the
* assertion) to the standard debug-output channel.
*
* Usually you should use MOZ_ASSERT instead of this method. This method i
s
* primarily for internal use in this header, and only secondarily for use
in
* implementing release-build assertions.
*/
static MOZ_ALWAYS_INLINE void static MOZ_ALWAYS_INLINE void
MOZ_OutputAssertMessage(const char* s, const char *file, int ln) MOZ_ReportAssertionFailure(const char* s, const char* file, int ln)
{ {
#ifdef ANDROID #ifdef ANDROID
__android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert", __android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert",
"Assertion failure: %s, at %s:%d\n", s, file, ln); "Assertion failure: %s, at %s:%d\n", s, file, ln);
#else #else
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln); fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr); fflush(stderr);
#endif #endif
} }
skipping to change at line 245 skipping to change at line 242
* "we already set [[PrimitiveThis]] for this String object"); * "we already set [[PrimitiveThis]] for this String object");
* *
* MOZ_ASSERT has no effect in non-debug builds. It is designed to catch b ugs * MOZ_ASSERT has no effect in non-debug builds. It is designed to catch b ugs
* *only* during debugging, not "in the field". * *only* during debugging, not "in the field".
*/ */
#ifdef DEBUG #ifdef DEBUG
/* First the single-argument form. */ /* First the single-argument form. */
# define MOZ_ASSERT_HELPER1(expr) \ # define MOZ_ASSERT_HELPER1(expr) \
do { \ do { \
if (!(expr)) { \ if (!(expr)) { \
MOZ_OutputAssertMessage(#expr, __FILE__, __LINE__); \ MOZ_ReportAssertionFailure(#expr, __FILE__, __LINE__); \
MOZ_CRASH(); \ MOZ_CRASH(); \
} \ } \
} while (0) } while (0)
/* Now the two-argument form. */ /* Now the two-argument form. */
# define MOZ_ASSERT_HELPER2(expr, explain) \ # define MOZ_ASSERT_HELPER2(expr, explain) \
do { \ do { \
if (!(expr)) { \ if (!(expr)) { \
MOZ_OutputAssertMessage(#expr " (" explain ")", __FILE__, __LINE__ ); \ MOZ_ReportAssertionFailure(#expr " (" explain ")", __FILE__, __LIN E__); \
MOZ_CRASH(); \ MOZ_CRASH(); \
} \ } \
} while (0) } while (0)
/* And now, helper macrology up the wazoo. */ /* And now, helper macrology up the wazoo. */
/* /*
* Count the number of arguments passed to MOZ_ASSERT, very carefully * Count the number of arguments passed to MOZ_ASSERT, very carefully
* tiptoeing around an MSVC bug where it improperly expands __VA_ARGS__ as a * tiptoeing around an MSVC bug where it improperly expands __VA_ARGS__ as a
* single token in argument lists. See these URLs for details: * single token in argument lists. See these URLs for details:
* *
* http://connect.microsoft.com/VisualStudio/feedback/details/380090/v ariadic-macro-replacement * http://connect.microsoft.com/VisualStudio/feedback/details/380090/v ariadic-macro-replacement
skipping to change at line 304 skipping to change at line 301
#ifdef DEBUG #ifdef DEBUG
# define MOZ_ASSERT_IF(cond, expr) \ # define MOZ_ASSERT_IF(cond, expr) \
do { \ do { \
if (cond) \ if (cond) \
MOZ_ASSERT(expr); \ MOZ_ASSERT(expr); \
} while (0) } while (0)
#else #else
# define MOZ_ASSERT_IF(cond, expr) do { } while (0) # define MOZ_ASSERT_IF(cond, expr) do { } while (0)
#endif #endif
/* MOZ_NOT_REACHED_MARKER() expands (in compilers which support it) to an /*
* expression which states that it is undefined behavior for the compiler t * MOZ_NOT_REACHED_MARKER() expands to an expression which states that it i
o s
* reach this point. Most code should probably use the higher level * undefined behavior for execution to reach this point. No guarantees are
* MOZ_NOT_REACHED (which expands to this when appropriate). made
* about what will happen if this is reached at runtime. Most code should
* probably use the higher level MOZ_NOT_REACHED, which uses this when
* appropriate.
*/ */
#if defined(__clang__) #if defined(__clang__)
# define MOZ_NOT_REACHED_MARKER() __builtin_unreachable() # define MOZ_NOT_REACHED_MARKER() __builtin_unreachable()
#elif defined(__GNUC__) #elif defined(__GNUC__)
/*
* __builtin_unreachable() was implemented in gcc 4.5. If we don't have
* that, call a noreturn function; abort() will do nicely. Qualify the
call
* in C++ in case there's another abort() visible in local scope.
*/
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# define MOZ_NOT_REACHED_MARKER() __builtin_unreachable() # define MOZ_NOT_REACHED_MARKER() __builtin_unreachable()
# else
# ifdef __cplusplus
# define MOZ_NOT_REACHED_MARKER() ::abort()
# else
# define MOZ_NOT_REACHED_MARKER() abort()
# endif
# endif # endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define MOZ_NOT_REACHED_MARKER() __assume(0) # define MOZ_NOT_REACHED_MARKER() __assume(0)
#else
# ifdef __cplusplus
# define MOZ_NOT_REACHED_MARKER() ::abort()
# else
# define MOZ_NOT_REACHED_MARKER() abort()
# endif
#endif #endif
/* /*
* MOZ_NOT_REACHED(reason) indicates that the given point can't be reached * MOZ_NOT_REACHED(reason) indicates that the given point can't be reached
* during execution: simply reaching that point in execution is a bug. It takes * during execution: simply reaching that point in execution is a bug. It takes
* as an argument an error message indicating the reason why that point sho uld * as an argument an error message indicating the reason why that point sho uld
* not have been reachable. * not have been reachable.
* *
* // ...in a language parser... * // ...in a language parser...
* void handle(BooleanLiteralNode node) * void handle(BooleanLiteralNode node)
* { * {
* if (node.isTrue()) * if (node.isTrue())
* handleTrueLiteral(); * handleTrueLiteral();
* else if (node.isFalse()) * else if (node.isFalse())
* handleFalseLiteral(); * handleFalseLiteral();
* else * else
* MOZ_NOT_REACHED("boolean literal that's not true or false?"); * MOZ_NOT_REACHED("boolean literal that's not true or false?");
* } * }
*/ */
#if defined(MOZ_NOT_REACHED_MARKER) #if defined(DEBUG)
# if defined(DEBUG) # define MOZ_NOT_REACHED(reason) \
# define MOZ_NOT_REACHED(reason) do { \ do { \
MOZ_Assert(reason, __FILE__, __LINE_ MOZ_ASSERT(false, reason); \
_); \ MOZ_NOT_REACHED_MARKER(); \
MOZ_NOT_REACHED_MARKER(); \ } while (0)
} while (0)
# else
# define MOZ_NOT_REACHED(reason) MOZ_NOT_REACHED_MARKER()
# endif
#else #else
# if defined(__GNUC__) # define MOZ_NOT_REACHED(reason) MOZ_NOT_REACHED_MARKER()
/*
* On older versions of gcc we need to call a noreturn function to mar
k the
* code as unreachable. Since what we want is an unreachable version o
f
* MOZ_Assert, we use an asm label
* (http://gcc.gnu.org/onlinedocs/gcc-4.6.2/gcc/Asm-Labels.html) to cr
eate
* a new declaration to the same symbol. MOZ_ASSERT_NR should only be
* used via this macro, as it is a very specific hack to older version
s of
* gcc.
*/
# define MOZ_GETASMPREFIX2(X) #X
# define MOZ_GETASMPREFIX(X) MOZ_GETASMPREFIX2(X)
# define MOZ_ASMPREFIX MOZ_GETASMPREFIX(__USER_LABEL_PREFIX__)
extern MOZ_NORETURN MFBT_API(void)
MOZ_ASSERT_NR(const char* s, const char* file, int ln) \
asm (MOZ_ASMPREFIX "MOZ_Assert");
# define MOZ_NOT_REACHED(reason) MOZ_ASSERT_NR(reason, __FILE__, __LI
NE__)
# elif defined(DEBUG)
# define MOZ_NOT_REACHED(reason) MOZ_Assert(reason, __FILE__, __LINE_
_)
# else
# define MOZ_NOT_REACHED(reason) ((void)0)
# endif
#endif #endif
/* /*
* MOZ_ALWAYS_TRUE(expr) and MOZ_ALWAYS_FALSE(expr) always evaluate the pro vided * MOZ_ALWAYS_TRUE(expr) and MOZ_ALWAYS_FALSE(expr) always evaluate the pro vided
* expression, in debug builds and in release builds both. Then, in debug * expression, in debug builds and in release builds both. Then, in debug
* builds only, the value of the expression is asserted either true or fals e * builds only, the value of the expression is asserted either true or fals e
* using MOZ_ASSERT. * using MOZ_ASSERT.
*/ */
#ifdef DEBUG #ifdef DEBUG
# define MOZ_ALWAYS_TRUE(expr) MOZ_ASSERT((expr)) # define MOZ_ALWAYS_TRUE(expr) MOZ_ASSERT((expr))
 End of changes. 19 change blocks. 
133 lines changed or deleted 129 lines changed or added


 Attributes.h   Attributes.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Walden <jwalden+code@mit.edu> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Implementations of various class and method modifier attributes. */ /* Implementations of various class and method modifier attributes. */
#ifndef mozilla_Attributes_h_ #ifndef mozilla_Attributes_h_
#define mozilla_Attributes_h_ #define mozilla_Attributes_h_
/* /*
* This header does not include any other headers so that it can be include d by * This header does not include any other headers so that it can be include d by
* code that is (only currently) mfbt-incompatible. * code that is (only currently) mfbt-incompatible.
*/ */
skipping to change at line 108 skipping to change at line 73
# ifndef __has_extension # ifndef __has_extension
# define __has_extension __has_feature /* compatibility, for older versi ons of clang */ # define __has_extension __has_feature /* compatibility, for older versi ons of clang */
# endif # endif
# if __has_extension(cxx_deleted_functions) # if __has_extension(cxx_deleted_functions)
# define MOZ_HAVE_CXX11_DELETE # define MOZ_HAVE_CXX11_DELETE
# endif # endif
# if __has_extension(cxx_override_control) # if __has_extension(cxx_override_control)
# define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_OVERRIDE
# define MOZ_HAVE_CXX11_FINAL final # define MOZ_HAVE_CXX11_FINAL final
# endif # endif
# if __has_extension(cxx_strong_enums)
# define MOZ_HAVE_CXX11_ENUM_TYPE
# define MOZ_HAVE_CXX11_STRONG_ENUMS
# endif
# if __has_attribute(noinline) # if __has_attribute(noinline)
# define MOZ_HAVE_NEVER_INLINE __attribute__((noinline)) # define MOZ_HAVE_NEVER_INLINE __attribute__((noinline))
# endif # endif
# if __has_attribute(noreturn) # if __has_attribute(noreturn)
# define MOZ_HAVE_NORETURN __attribute__((noreturn)) # define MOZ_HAVE_NORETURN __attribute__((noreturn))
# endif # endif
#elif defined(__GNUC__) #elif defined(__GNUC__)
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# if __GNUC__ > 4 # if __GNUC__ > 4
# define MOZ_HAVE_CXX11_DELETE # define MOZ_HAVE_CXX11_DELETE
# define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_OVERRIDE
# define MOZ_HAVE_CXX11_FINAL final # define MOZ_HAVE_CXX11_FINAL final
# elif __GNUC__ == 4 # elif __GNUC__ == 4
# if __GNUC_MINOR__ >= 7 # if __GNUC_MINOR__ >= 7
# define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_OVERRIDE
# define MOZ_HAVE_CXX11_FINAL final # define MOZ_HAVE_CXX11_FINAL final
# endif # endif
# if __GNUC_MINOR__ >= 4 # if __GNUC_MINOR__ >= 4
# define MOZ_HAVE_CXX11_DELETE # define MOZ_HAVE_CXX11_DELETE
# define MOZ_HAVE_CXX11_ENUM_TYPE
# define MOZ_HAVE_CXX11_STRONG_ENUMS
# endif # endif
# endif # endif
# else # else
/* __final is a non-C++11 GCC synonym for 'final', per GCC r176655. */ /* __final is a non-C++11 GCC synonym for 'final', per GCC r176655. */
# if __GNUC__ > 4 # if __GNUC__ > 4
# define MOZ_HAVE_CXX11_FINAL __final # define MOZ_HAVE_CXX11_FINAL __final
# elif __GNUC__ == 4 # elif __GNUC__ == 4
# if __GNUC_MINOR__ >= 7 # if __GNUC_MINOR__ >= 7
# define MOZ_HAVE_CXX11_FINAL __final # define MOZ_HAVE_CXX11_FINAL __final
# endif # endif
# endif # endif
# endif # endif
# define MOZ_HAVE_NEVER_INLINE __attribute__((noinline)) # define MOZ_HAVE_NEVER_INLINE __attribute__((noinline))
# define MOZ_HAVE_NORETURN __attribute__((noreturn)) # define MOZ_HAVE_NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# if _MSC_VER >= 1400 # if _MSC_VER >= 1400
# define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_OVERRIDE
/* MSVC currently spells "final" as "sealed". */ /* MSVC currently spells "final" as "sealed". */
# define MOZ_HAVE_CXX11_FINAL sealed # define MOZ_HAVE_CXX11_FINAL sealed
# define MOZ_HAVE_CXX11_ENUM_TYPE
# endif
# if _MSC_VER >= 1700
# define MOZ_HAVE_CXX11_STRONG_ENUMS
# endif # endif
# define MOZ_HAVE_NEVER_INLINE __declspec(noinline) # define MOZ_HAVE_NEVER_INLINE __declspec(noinline)
# define MOZ_HAVE_NORETURN __declspec(noreturn) # define MOZ_HAVE_NORETURN __declspec(noreturn)
#endif #endif
/* /*
* MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the * MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the
* method decorated with it must never be inlined, even if the compiler wou ld * method decorated with it must never be inlined, even if the compiler wou ld
* otherwise choose to inline the method. Compilers aren't absolutely * otherwise choose to inline the method. Compilers aren't absolutely
* guaranteed to support this, but most do. * guaranteed to support this, but most do.
skipping to change at line 183 skipping to change at line 158
* operations performed after the function returns. * operations performed after the function returns.
* *
* This modifier does not affect the corresponding function's linking behav ior. * This modifier does not affect the corresponding function's linking behav ior.
*/ */
#if defined(MOZ_HAVE_NORETURN) #if defined(MOZ_HAVE_NORETURN)
# define MOZ_NORETURN MOZ_HAVE_NORETURN # define MOZ_NORETURN MOZ_HAVE_NORETURN
#else #else
# define MOZ_NORETURN /* no support */ # define MOZ_NORETURN /* no support */
#endif #endif
/*
* MOZ_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time
* instrumentation shipped with Clang) to not instrument the annotated func
tion.
* Furthermore, it will prevent the compiler from inlining the function bec
ause
* inlining currently breaks the blacklisting mechanism of AddressSanitizer
.
*/
#if defined(MOZ_ASAN)
# define MOZ_ASAN_BLACKLIST MOZ_NEVER_INLINE __attribute__((no_address_saf
ety_analysis))
# else
# define MOZ_ASAN_BLACKLIST
#endif
#ifdef __cplusplus #ifdef __cplusplus
/* /*
* MOZ_DELETE, specified immediately prior to the ';' terminating an undefi ned- * MOZ_DELETE, specified immediately prior to the ';' terminating an undefi ned-
* method declaration, attempts to delete that method from the correspondin g * method declaration, attempts to delete that method from the correspondin g
* class. An attempt to use the method will always produce an error *at co mpile * class. An attempt to use the method will always produce an error *at co mpile
* time* (instead of sometimes as late as link time) when this macro can be * time* (instead of sometimes as late as link time) when this macro can be
* implemented. For example, you can use MOZ_DELETE to produce classes wit h no * implemented. For example, you can use MOZ_DELETE to produce classes wit h no
* implicit copy constructor or assignment operator: * implicit copy constructor or assignment operator:
* *
skipping to change at line 324 skipping to change at line 311
* to override a method annotated with MOZ_FINAL. In other compilers it se rves * to override a method annotated with MOZ_FINAL. In other compilers it se rves
* only as documentation. * only as documentation.
*/ */
#if defined(MOZ_HAVE_CXX11_FINAL) #if defined(MOZ_HAVE_CXX11_FINAL)
# define MOZ_FINAL MOZ_HAVE_CXX11_FINAL # define MOZ_FINAL MOZ_HAVE_CXX11_FINAL
#else #else
# define MOZ_FINAL /* no support */ # define MOZ_FINAL /* no support */
#endif #endif
/** /**
* MOZ_ENUM_TYPE specifies the underlying numeric type for an enum. It's
* specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name
in
* its declaration, and before the opening curly brace, like
*
* enum MyEnum MOZ_ENUM_TYPE(uint16_t)
* {
* A,
* B = 7,
* C
* };
*
* In supporting compilers, the macro will expand to ": uint16_t". The
* compiler will allocate exactly two bytes for MyEnum, and will require al
l
* enumerators to have values between 0 and 65535. (Thus specifying "B =
* 100000" instead of "B = 7" would fail to compile.) In old compilers, th
e
* macro expands to the empty string, and the underlying type is generally
* undefined.
*/
#ifdef MOZ_HAVE_CXX11_ENUM_TYPE
# define MOZ_ENUM_TYPE(type) : type
#else
# define MOZ_ENUM_TYPE(type) /* no support */
#endif
/**
* MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the
* strongly-typed enumeration feature of C++11 ("enum class"). If supporte
d
* by the compiler, an enum defined using these macros will not be implicit
ly
* converted to any other type, and its enumerators will be scoped using th
e
* enumeration name. Place MOZ_BEGIN_ENUM_CLASS(EnumName, type) in place o
f
* "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the clos
ing
* "};". For example,
*
* MOZ_BEGIN_ENUM_CLASS(Enum, int32_t)
* A, B = 6
* MOZ_END_ENUM_CLASS(Enum)
*
* This will make "Enum::A" and "Enum::B" appear in the global scope, but "
A"
* and "B" will not. In compilers that support C++11 strongly-typed
* enumerations, implicit conversions of Enum values to numeric types will
* fail. In other compilers, Enum itself will actually be defined as a cla
ss,
* and some implicit conversions will fail while others will succeed.
*
* The type argument specifies the underlying type for the enum where
* supported, as with MOZ_ENUM_TYPE(). For simplicity, it is currently
* mandatory. As with MOZ_ENUM_TYPE(), it will do nothing on compilers tha
t do
* not support it.
*/
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
/* All compilers that support strong enums also support an explicit
* underlying type, so no extra check is needed */
# define MOZ_BEGIN_ENUM_CLASS(Name, type) enum class Name : type {
# define MOZ_END_ENUM_CLASS(Name) };
#else
/**
* We need Name to both name a type, and scope the provided enumerator
* names. Namespaces and classes both provide scoping, but namespaces
* aren't types, so we need to use a class that wraps the enum values.
We
* have an implicit conversion from the inner enum type to the class, so
* statements like
*
* Enum x = Enum::A;
*
* will still work. We need to define an implicit conversion from the c
lass
* to the inner enum as well, so that (for instance) switch statements w
ill
* work. This means that the class can be implicitly converted to a num
eric
* value as well via the enum type, since C++ allows an implicit
* user-defined conversion followed by a standard conversion to still be
* implicit.
*
* We have an explicit constructor from int defined, so that casts like
* (Enum)7 will still work. We also have a zero-argument constructor wi
th
* no arguments, so declaration without initialization (like "Enum foo;"
)
* will work.
*
* Additionally, we'll delete as many operators as possible for the inne
r
* enum type, so statements like this will still fail:
*
* f(5 + Enum::B); // deleted operator+
*
* But we can't prevent things like this, because C++ doesn't allow
* overriding conversions or assignment operators for enums:
*
* int x = Enum::A;
* int f()
* {
* return Enum::A;
* }
*/
# define MOZ_BEGIN_ENUM_CLASS(Name, type) \
class Name \
{ \
public: \
enum Enum MOZ_ENUM_TYPE(type) \
{
# define MOZ_END_ENUM_CLASS(Name) \
}; \
Name() {} \
Name(Enum aEnum) : mEnum(aEnum) {} \
explicit Name(int num) : mEnum((Enum)num) {} \
operator Enum() const { return mEnum; } \
private: \
Enum mEnum; \
}; \
inline int operator+(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator+(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator-(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator-(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator*(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator*(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator/(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator/(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator%(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator%(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator+(const Name::Enum&) MOZ_DELETE; \
inline int operator-(const Name::Enum&) MOZ_DELETE; \
inline int& operator++(Name::Enum&) MOZ_DELETE; \
inline int operator++(Name::Enum&, int) MOZ_DELETE; \
inline int& operator--(Name::Enum&) MOZ_DELETE; \
inline int operator--(Name::Enum&, int) MOZ_DELETE; \
inline bool operator==(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator==(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator!=(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator!=(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator>(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator>(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator<(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator<(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator>=(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator>=(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator<=(const int&, const Name::Enum&) MOZ_DELETE; \
inline bool operator<=(const Name::Enum&, const int&) MOZ_DELETE; \
inline bool operator!(const Name::Enum&) MOZ_DELETE; \
inline bool operator&&(const bool&, const Name::Enum&) MOZ_DELETE; \
inline bool operator&&(const Name::Enum&, const bool&) MOZ_DELETE; \
inline bool operator||(const bool&, const Name::Enum&) MOZ_DELETE; \
inline bool operator||(const Name::Enum&, const bool&) MOZ_DELETE; \
inline int operator~(const Name::Enum&) MOZ_DELETE; \
inline int operator&(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator&(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator|(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator|(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator^(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator^(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator<<(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator<<(const Name::Enum&, const int&) MOZ_DELETE; \
inline int operator>>(const int&, const Name::Enum&) MOZ_DELETE; \
inline int operator>>(const Name::Enum&, const int&) MOZ_DELETE; \
inline int& operator+=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator-=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator*=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator/=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator%=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator&=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator|=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator^=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator<<=(int&, const Name::Enum&) MOZ_DELETE; \
inline int& operator>>=(int&, const Name::Enum&) MOZ_DELETE;
#endif
/**
* MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a functio n's * MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a functio n's
* return value is not used by the caller. * return value is not used by the caller.
* *
* Place this attribute at the very beginning of a function definition. For * Place this attribute at the very beginning of a function definition. For
* example, write * example, write
* *
* MOZ_WARN_UNUSED_RESULT int foo(); * MOZ_WARN_UNUSED_RESULT int foo();
* *
* or * or
* *
 End of changes. 6 change blocks. 
48 lines changed or deleted 210 lines changed or added


 Barrier.h   Barrier.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=78: * vim: set ts=8 sw=4 et tw=78:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey global object code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsgc_barrier_h___ #ifndef jsgc_barrier_h___
#define jsgc_barrier_h___ #define jsgc_barrier_h___
#include "jsapi.h" #include "jsapi.h"
#include "jscell.h"
#include "gc/Heap.h"
#include "js/HashTable.h" #include "js/HashTable.h"
/* /*
* A write barrier is a mechanism used by incremental or generation GCs to * A write barrier is a mechanism used by incremental or generation GCs to
* ensure that every value that needs to be marked is marked. In general, t he * ensure that every value that needs to be marked is marked. In general, t he
* write barrier should be invoked whenever a write can cause the set of th ings * write barrier should be invoked whenever a write can cause the set of th ings
* traced through by the GC to change. This includes: * traced through by the GC to change. This includes:
* - writes to object properties * - writes to object properties
* - writes to array slots * - writes to array slots
* - writes to fields like JSObject::shape_ that we trace through * - writes to fields like JSObject::shape_ that we trace through
skipping to change at line 143 skipping to change at line 111
* call, this file contains a bunch of C++ classes and templates that use * call, this file contains a bunch of C++ classes and templates that use
* operator overloading to take care of barriers automatically. In many cas es, * operator overloading to take care of barriers automatically. In many cas es,
* all that's necessary to make some field be barriered is to replace * all that's necessary to make some field be barriered is to replace
* Type *field; * Type *field;
* with * with
* HeapPtr<Type> field; * HeapPtr<Type> field;
* There are also special classes HeapValue and HeapId, which barrier js::V alue * There are also special classes HeapValue and HeapId, which barrier js::V alue
* and jsid, respectively. * and jsid, respectively.
* *
* One additional note: not all object writes need to be barriered. Writes to * One additional note: not all object writes need to be barriered. Writes to
* newly allocated objects do not need a barrier as long as the GC is not * newly allocated objects do not need a pre-barrier. In these cases, we u
* allowed to run in between the allocation and the write. In these cases, se
we * the "obj->field.init(value)" method instead of "obj->field = value". We
* use the "obj->field.init(value)" method instead of "obj->field = value". use
* We use the init naming idiom in many places to signify that a field is b * the init naming idiom in many places to signify that a field is being
eing * assigned for the first time.
* assigned for the first time, and that no GCs have taken place between th
e
* object allocation and the assignment.
*/ */
struct JSXML; struct JSXML;
namespace js { namespace js {
template<class T, typename Unioned = uintptr_t> template<class T, typename Unioned = uintptr_t>
class HeapPtr class EncapsulatedPtr
{ {
protected:
union { union {
T *value; T *value;
Unioned other; Unioned other;
}; };
public: public:
HeapPtr() : value(NULL) {} EncapsulatedPtr() : value(NULL) {}
explicit HeapPtr(T *v) : value(v) { post(); } EncapsulatedPtr(T *v) : value(v) {}
explicit HeapPtr(const HeapPtr<T> &v) : value(v.value) { post(); } explicit EncapsulatedPtr(const EncapsulatedPtr<T> &v) : value(v.value)
{}
~HeapPtr() { pre(); } ~EncapsulatedPtr() { pre(); }
/* Use this to install a ptr into a newly allocated object. */ /* Use to set the pointer to NULL. */
void init(T *v) { void clear() {
pre();
value = NULL;
}
EncapsulatedPtr<T, Unioned> &operator=(T *v) {
pre();
JS_ASSERT(!IsPoisonedPtr<T>(v)); JS_ASSERT(!IsPoisonedPtr<T>(v));
value = v; value = v;
post(); return *this;
} }
/* Use to set the pointer to NULL. */ EncapsulatedPtr<T, Unioned> &operator=(const EncapsulatedPtr<T> &v) {
void clear() { pre();
pre(); JS_ASSERT(!IsPoisonedPtr<T>(v.value));
value = NULL; value = v.value;
return *this;
} }
/* Use this if the automatic coercion to T* isn't working. */ /* Use this if the automatic coercion to T* isn't working. */
T *get() const { return value; } T *get() const { return value; }
/* /*
* Use these if you want to change the value without invoking the barri er. * Use these if you want to change the value without invoking the barri er.
* Obviously this is dangerous unless you know the barrier is not neede d. * Obviously this is dangerous unless you know the barrier is not neede d.
*/ */
T **unsafeGet() { return &value; } T **unsafeGet() { return &value; }
void unsafeSet(T *v) { value = v; } void unsafeSet(T *v) { value = v; }
Unioned *unsafeGetUnioned() { return &other; } Unioned *unsafeGetUnioned() { return &other; }
T &operator*() const { return *value; }
T *operator->() const { return value; }
operator T*() const { return value; }
protected:
void pre() { T::writeBarrierPre(value); }
};
template <class T, class Unioned = uintptr_t>
class HeapPtr : public EncapsulatedPtr<T, Unioned>
{
public:
HeapPtr() : EncapsulatedPtr<T>(NULL) {}
explicit HeapPtr(T *v) : EncapsulatedPtr<T>(v) { post(); }
explicit HeapPtr(const HeapPtr<T> &v)
: EncapsulatedPtr<T>(v) { post(); }
void init(T *v) {
JS_ASSERT(!IsPoisonedPtr<T>(v));
this->value = v;
post();
}
HeapPtr<T, Unioned> &operator=(T *v) { HeapPtr<T, Unioned> &operator=(T *v) {
pre(); this->pre();
JS_ASSERT(!IsPoisonedPtr<T>(v)); JS_ASSERT(!IsPoisonedPtr<T>(v));
value = v; this->value = v;
post(); post();
return *this; return *this;
} }
HeapPtr<T, Unioned> &operator=(const HeapPtr<T> &v) { HeapPtr<T, Unioned> &operator=(const HeapPtr<T> &v) {
pre(); this->pre();
JS_ASSERT(!IsPoisonedPtr<T>(v.value)); JS_ASSERT(!IsPoisonedPtr<T>(v.value));
value = v.value; this->value = v.value;
post(); post();
return *this; return *this;
} }
T &operator*() const { return *value; } protected:
T *operator->() const { return value; } void post() { T::writeBarrierPost(this->value, (void *)&this->value); }
operator T*() const { return value; }
private:
void pre() { T::writeBarrierPre(value); }
void post() { T::writeBarrierPost(value, (void *)&value); }
/* Make this friend so it can access pre() and post(). */ /* Make this friend so it can access pre() and post(). */
template<class T1, class T2> template<class T1, class T2>
friend inline void friend inline void
BarrieredSetPair(JSCompartment *comp, BarrieredSetPair(JSCompartment *comp,
HeapPtr<T1> &v1, T1 *val1, HeapPtr<T1> &v1, T1 *val1,
HeapPtr<T2> &v2, T2 *val2); HeapPtr<T2> &v2, T2 *val2);
}; };
template <class T>
class RelocatablePtr : public EncapsulatedPtr<T>
{
public:
RelocatablePtr() : EncapsulatedPtr<T>(NULL) {}
explicit RelocatablePtr(T *v) : EncapsulatedPtr<T>(v) {
if (v)
post();
}
explicit RelocatablePtr(const RelocatablePtr<T> &v) : EncapsulatedPtr<T
>(v) {
if (this->value)
post();
}
~RelocatablePtr() {
if (this->value)
relocate(this->value->compartment());
}
RelocatablePtr<T> &operator=(T *v) {
this->pre();
JS_ASSERT(!IsPoisonedPtr<T>(v));
if (v) {
this->value = v;
post();
} else if (this->value) {
JSCompartment *comp = this->value->compartment();
this->value = v;
relocate(comp);
}
return *this;
}
RelocatablePtr<T> &operator=(const RelocatablePtr<T> &v) {
this->pre();
JS_ASSERT(!IsPoisonedPtr<T>(v.value));
if (v.value) {
this->value = v.value;
post();
} else if (this->value) {
JSCompartment *comp = this->value->compartment();
this->value = v;
relocate(comp);
}
return *this;
}
protected:
inline void post();
inline void relocate(JSCompartment *comp);
};
/* /*
* This is a hack for RegExpStatics::updateFromMatch. It allows us to do tw o * This is a hack for RegExpStatics::updateFromMatch. It allows us to do tw o
* barriers with only one branch to check if we're in an incremental GC. * barriers with only one branch to check if we're in an incremental GC.
*/ */
template<class T1, class T2> template<class T1, class T2>
static inline void static inline void
BarrieredSetPair(JSCompartment *comp, BarrieredSetPair(JSCompartment *comp,
HeapPtr<T1> &v1, T1 *val1, HeapPtr<T1> &v1, T1 *val1,
HeapPtr<T2> &v2, T2 *val2) HeapPtr<T2> &v2, T2 *val2)
{ {
skipping to change at line 252 skipping to change at line 296
v1.unsafeSet(val1); v1.unsafeSet(val1);
v2.unsafeSet(val2); v2.unsafeSet(val2);
v1.post(); v1.post();
v2.post(); v2.post();
} }
struct Shape; struct Shape;
class BaseShape; class BaseShape;
namespace types { struct TypeObject; } namespace types { struct TypeObject; }
typedef HeapPtr<JSAtom> HeapPtrAtom; typedef EncapsulatedPtr<JSObject> EncapsulatedPtrObject;
typedef EncapsulatedPtr<JSScript> EncapsulatedPtrScript;
typedef RelocatablePtr<JSObject> RelocatablePtrObject;
typedef RelocatablePtr<JSScript> RelocatablePtrScript;
typedef HeapPtr<JSObject> HeapPtrObject; typedef HeapPtr<JSObject> HeapPtrObject;
typedef HeapPtr<JSFunction> HeapPtrFunction; typedef HeapPtr<JSFunction> HeapPtrFunction;
typedef HeapPtr<JSString> HeapPtrString; typedef HeapPtr<JSString> HeapPtrString;
typedef HeapPtr<JSScript> HeapPtrScript; typedef HeapPtr<JSScript> HeapPtrScript;
typedef HeapPtr<Shape> HeapPtrShape; typedef HeapPtr<Shape> HeapPtrShape;
typedef HeapPtr<BaseShape> HeapPtrBaseShape; typedef HeapPtr<BaseShape> HeapPtrBaseShape;
typedef HeapPtr<types::TypeObject> HeapPtrTypeObject; typedef HeapPtr<types::TypeObject> HeapPtrTypeObject;
typedef HeapPtr<JSXML> HeapPtrXML; typedef HeapPtr<JSXML> HeapPtrXML;
/* Useful for hashtables with a HeapPtr as key. */ /* Useful for hashtables with a HeapPtr as key. */
skipping to change at line 275 skipping to change at line 324
{ {
typedef HeapPtr<T> Key; typedef HeapPtr<T> Key;
typedef T *Lookup; typedef T *Lookup;
static HashNumber hash(Lookup obj) { return DefaultHasher<T *>::hash(ob j); } static HashNumber hash(Lookup obj) { return DefaultHasher<T *>::hash(ob j); }
static bool match(const Key &k, Lookup l) { return k.get() == l; } static bool match(const Key &k, Lookup l) { return k.get() == l; }
}; };
/* Specialized hashing policy for HeapPtrs. */ /* Specialized hashing policy for HeapPtrs. */
template <class T> template <class T>
struct DefaultHasher< HeapPtr<T> >: HeapPtrHasher<T> { }; struct DefaultHasher< HeapPtr<T> > : HeapPtrHasher<T> { };
class EncapsulatedValue template<class T>
struct EncapsulatedPtrHasher
{
typedef EncapsulatedPtr<T> Key;
typedef T *Lookup;
static HashNumber hash(Lookup obj) { return DefaultHasher<T *>::hash(ob
j); }
static bool match(const Key &k, Lookup l) { return k.get() == l; }
};
template <class T>
struct DefaultHasher< EncapsulatedPtr<T> > : EncapsulatedPtrHasher<T> { };
class EncapsulatedValue : public ValueOperations<EncapsulatedValue>
{ {
protected: protected:
Value value; Value value;
/* /*
* Ensure that EncapsulatedValue is not constructable, except by our * Ensure that EncapsulatedValue is not constructable, except by our
* implementations. * implementations.
*/ */
EncapsulatedValue() MOZ_DELETE; EncapsulatedValue() MOZ_DELETE;
EncapsulatedValue(const EncapsulatedValue &v) MOZ_DELETE; EncapsulatedValue(const EncapsulatedValue &v) MOZ_DELETE;
EncapsulatedValue &operator=(const Value &v) MOZ_DELETE; EncapsulatedValue &operator=(const Value &v) MOZ_DELETE;
EncapsulatedValue &operator=(const EncapsulatedValue &v) MOZ_DELETE; EncapsulatedValue &operator=(const EncapsulatedValue &v) MOZ_DELETE;
EncapsulatedValue(const Value &v) : value(v) {} EncapsulatedValue(const Value &v) : value(v) {}
~EncapsulatedValue() {} ~EncapsulatedValue() {}
public: public:
bool operator==(const EncapsulatedValue &v) const { return value == v.v
alue; }
bool operator!=(const EncapsulatedValue &v) const { return value != v.v
alue; }
const Value &get() const { return value; } const Value &get() const { return value; }
Value *unsafeGet() { return &value; } Value *unsafeGet() { return &value; }
operator const Value &() const { return value; } operator const Value &() const { return value; }
bool isUndefined() const { return value.isUndefined(); }
bool isNull() const { return value.isNull(); }
bool isBoolean() const { return value.isBoolean(); }
bool isTrue() const { return value.isTrue(); }
bool isFalse() const { return value.isFalse(); }
bool isNumber() const { return value.isNumber(); }
bool isInt32() const { return value.isInt32(); }
bool isDouble() const { return value.isDouble(); }
bool isString() const { return value.isString(); }
bool isObject() const { return value.isObject(); }
bool isMagic(JSWhyMagic why) const { return value.isMagic(why); }
bool isGCThing() const { return value.isGCThing(); }
bool isMarkable() const { return value.isMarkable(); }
bool toBoolean() const { return value.toBoolean(); }
double toNumber() const { return value.toNumber(); }
int32_t toInt32() const { return value.toInt32(); }
double toDouble() const { return value.toDouble(); }
JSString *toString() const { return value.toString(); }
JSObject &toObject() const { return value.toObject(); }
JSObject *toObjectOrNull() const { return value.toObjectOrNull(); }
void *toGCThing() const { return value.toGCThing(); }
JSGCTraceKind gcKind() const { return value.gcKind(); } JSGCTraceKind gcKind() const { return value.gcKind(); }
uint64_t asRawBits() const { return value.asRawBits(); } uint64_t asRawBits() const { return value.asRawBits(); }
#ifdef DEBUG
JSWhyMagic whyMagic() const { return value.whyMagic(); }
#endif
static inline void writeBarrierPre(const Value &v); static inline void writeBarrierPre(const Value &v);
static inline void writeBarrierPre(JSCompartment *comp, const Value &v) ; static inline void writeBarrierPre(JSCompartment *comp, const Value &v) ;
protected: protected:
inline void pre(); inline void pre();
inline void pre(JSCompartment *comp); inline void pre(JSCompartment *comp);
private:
friend class ValueOperations<EncapsulatedValue>;
const Value * extract() const { return &value; }
}; };
class HeapValue : public EncapsulatedValue class HeapValue : public EncapsulatedValue
{ {
public: public:
explicit inline HeapValue(); explicit inline HeapValue();
explicit inline HeapValue(const Value &v); explicit inline HeapValue(const Value &v);
explicit inline HeapValue(const HeapValue &v); explicit inline HeapValue(const HeapValue &v);
inline ~HeapValue(); inline ~HeapValue();
skipping to change at line 360 skipping to change at line 402
inline HeapValue &operator=(const HeapValue &v); inline HeapValue &operator=(const HeapValue &v);
/* /*
* This is a faster version of operator=. Normally, operator= has to * This is a faster version of operator=. Normally, operator= has to
* determine the compartment of the value before it can decide whether to do * determine the compartment of the value before it can decide whether to do
* the barrier. If you already know the compartment, it's faster to pas s it * the barrier. If you already know the compartment, it's faster to pas s it
* in. * in.
*/ */
inline void set(JSCompartment *comp, const Value &v); inline void set(JSCompartment *comp, const Value &v);
static inline void writeBarrierPost(const Value &v, void *addr); static inline void writeBarrierPost(const Value &v, Value *addr);
static inline void writeBarrierPost(JSCompartment *comp, const Value &v static inline void writeBarrierPost(JSCompartment *comp, const Value &v
, void *addr); , Value *addr);
private:
inline void post();
inline void post(JSCompartment *comp);
};
class RelocatableValue : public EncapsulatedValue
{
public:
explicit inline RelocatableValue();
explicit inline RelocatableValue(const Value &v);
inline RelocatableValue(const RelocatableValue &v);
inline ~RelocatableValue();
inline RelocatableValue &operator=(const Value &v);
inline RelocatableValue &operator=(const RelocatableValue &v);
private: private:
inline void post(); inline void post();
inline void post(JSCompartment *comp); inline void post(JSCompartment *comp);
inline void relocate();
}; };
class HeapSlot : public EncapsulatedValue class HeapSlot : public EncapsulatedValue
{ {
/* /*
* Operator= is not valid for HeapSlot because is must take the object and * Operator= is not valid for HeapSlot because is must take the object and
* slot offset to provide to the post/generational barrier. * slot offset to provide to the post/generational barrier.
*/ */
inline HeapSlot &operator=(const Value &v) MOZ_DELETE; inline HeapSlot &operator=(const Value &v) MOZ_DELETE;
inline HeapSlot &operator=(const HeapValue &v) MOZ_DELETE; inline HeapSlot &operator=(const HeapValue &v) MOZ_DELETE;
skipping to change at line 391 skipping to change at line 450
explicit inline HeapSlot(JSObject *obj, uint32_t slot, const HeapSlot & v); explicit inline HeapSlot(JSObject *obj, uint32_t slot, const HeapSlot & v);
inline ~HeapSlot(); inline ~HeapSlot();
inline void init(JSObject *owner, uint32_t slot, const Value &v); inline void init(JSObject *owner, uint32_t slot, const Value &v);
inline void init(JSCompartment *comp, JSObject *owner, uint32_t slot, c onst Value &v); inline void init(JSCompartment *comp, JSObject *owner, uint32_t slot, c onst Value &v);
inline void set(JSObject *owner, uint32_t slot, const Value &v); inline void set(JSObject *owner, uint32_t slot, const Value &v);
inline void set(JSCompartment *comp, JSObject *owner, uint32_t slot, co nst Value &v); inline void set(JSCompartment *comp, JSObject *owner, uint32_t slot, co nst Value &v);
static inline void writeBarrierPost(JSObject *obj, uint32_t slot); static inline void writeBarrierPost(JSObject *obj, uint32_t slot);
static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slotno); static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slot);
private: private:
inline void post(JSObject *owner, uint32_t slot); inline void post(JSObject *owner, uint32_t slot);
inline void post(JSCompartment *comp, JSObject *owner, uint32_t slot); inline void post(JSCompartment *comp, JSObject *owner, uint32_t slot);
}; };
/* /*
* NOTE: This is a placeholder for bug 619558. * NOTE: This is a placeholder for bug 619558.
* *
* Run a post write barrier that encompasses multiple contiguous slots in a * Run a post write barrier that encompasses multiple contiguous slots in a
* single step. * single step.
*/ */
static inline void inline void
SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t star SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t star
t, uint32_t count) t, uint32_t count);
{
/*
* This is a post barrier for HashTables whose key can be moved during a GC
.
*/
template <class Map, class Key>
inline void
HashTableWriteBarrierPost(JSCompartment *comp, const Map *map, const Key &k
ey)
{
#ifdef JS_GCGENERATIONAL
if (key && comp->gcNursery.isInside(key))
comp->gcStoreBuffer.putGeneric(HashKeyRef(map, key));
#endif
} }
static inline const Value * static inline const Value *
Valueify(const EncapsulatedValue *array) Valueify(const EncapsulatedValue *array)
{ {
JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value)); JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value));
JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value)); JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value));
return (const Value *)array; return (const Value *)array;
} }
static inline HeapValue *
HeapValueify(Value *v)
{
JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value));
JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value));
return (HeapValue *)v;
}
class HeapSlotArray class HeapSlotArray
{ {
HeapSlot *array; HeapSlot *array;
public: public:
HeapSlotArray(HeapSlot *array) : array(array) {} HeapSlotArray(HeapSlot *array) : array(array) {}
operator const Value *() const { return Valueify(array); } operator const Value *() const { return Valueify(array); }
operator HeapSlot *() const { return array; } operator HeapSlot *() const { return array; }
HeapSlotArray operator +(int offset) const { return HeapSlotArray(array + offset); } HeapSlotArray operator +(int offset) const { return HeapSlotArray(array + offset); }
HeapSlotArray operator +(uint32_t offset) const { return HeapSlotArray( array + offset); } HeapSlotArray operator +(uint32_t offset) const { return HeapSlotArray( array + offset); }
}; };
class HeapId class EncapsulatedId
{ {
protected:
jsid value; jsid value;
public: private:
explicit HeapId() : value(JSID_VOID) {} EncapsulatedId(const EncapsulatedId &v) MOZ_DELETE;
explicit inline HeapId(jsid id);
inline ~HeapId();
inline void init(jsid id); public:
explicit EncapsulatedId() : value(JSID_VOID) {}
explicit EncapsulatedId(jsid id) : value(id) {}
~EncapsulatedId();
inline HeapId &operator=(jsid id); inline EncapsulatedId &operator=(const EncapsulatedId &v);
inline HeapId &operator=(const HeapId &v);
bool operator==(jsid id) const { return value == id; } bool operator==(jsid id) const { return value == id; }
bool operator!=(jsid id) const { return value != id; } bool operator!=(jsid id) const { return value != id; }
jsid get() const { return value; } jsid get() const { return value; }
jsid *unsafeGet() { return &value; } jsid *unsafeGet() { return &value; }
operator jsid() const { return value; } operator jsid() const { return value; }
private: protected:
inline void pre(); inline void pre();
};
class RelocatableId : public EncapsulatedId
{
public:
explicit RelocatableId() : EncapsulatedId() {}
explicit inline RelocatableId(jsid id) : EncapsulatedId(id) {}
inline ~RelocatableId();
inline RelocatableId &operator=(jsid id);
inline RelocatableId &operator=(const RelocatableId &v);
};
class HeapId : public EncapsulatedId
{
public:
explicit HeapId() : EncapsulatedId() {}
explicit inline HeapId(jsid id);
inline ~HeapId();
inline void init(jsid id);
inline HeapId &operator=(jsid id);
inline HeapId &operator=(const HeapId &v);
private:
inline void post(); inline void post();
HeapId(const HeapId &v); HeapId(const HeapId &v) MOZ_DELETE;
}; };
/* /*
* Incremental GC requires that weak pointers have read barriers. This is m ostly * Incremental GC requires that weak pointers have read barriers. This is m ostly
* an issue for empty shapes stored in JSCompartment. The problem happens w hen, * an issue for empty shapes stored in JSCompartment. The problem happens w hen,
* during an incremental GC, some JS code stores one of the compartment's e mpty * during an incremental GC, some JS code stores one of the compartment's e mpty
* shapes into an object already marked black. Normally, this would not be a * shapes into an object already marked black. Normally, this would not be a
* problem, because the empty shape would have been part of the initial sna pshot * problem, because the empty shape would have been part of the initial sna pshot
* when the GC started. However, since this is a weak pointer, it isn't. So we * when the GC started. However, since this is a weak pointer, it isn't. So we
* may collect the empty shape even though a live object points to it. To f ix * may collect the empty shape even though a live object points to it. To f ix
skipping to change at line 491 skipping to change at line 595
return NULL; return NULL;
T::readBarrier(value); T::readBarrier(value);
return value; return value;
} }
operator T*() const { return get(); } operator T*() const { return get(); }
T &operator*() const { return *get(); } T &operator*() const { return *get(); }
T *operator->() const { return get(); } T *operator->() const { return get(); }
T *unsafeGet() { return value; } T **unsafeGet() { return &value; }
void set(T *v) { value = v; } void set(T *v) { value = v; }
operator bool() { return !!value; } operator bool() { return !!value; }
}; };
class ReadBarrieredValue class ReadBarrieredValue
{ {
Value value; Value value;
public: public:
ReadBarrieredValue() : value(UndefinedValue()) {} ReadBarrieredValue() : value(UndefinedValue()) {}
ReadBarrieredValue(const Value &value) : value(value) {} ReadBarrieredValue(const Value &value) : value(value) {}
inline const Value &get() const; inline const Value &get() const;
Value *unsafeGet() { return &value; }
inline operator const Value &() const; inline operator const Value &() const;
inline JSObject &toObject() const; inline JSObject &toObject() const;
}; };
namespace tl { namespace tl {
template <class T> struct IsPostBarrieredType<HeapPtr<T> > { template <class T> struct IsRelocatableHeapType<HeapPtr<T> >
static const bool resul { static const bool res
t = true; }; ult = false; };
template <> struct IsPostBarrieredType<HeapSlot> { static const bool resul template <> struct IsRelocatableHeapType<HeapSlot> { static const bool res
t = true; }; ult = false; };
template <> struct IsPostBarrieredType<HeapValue> { static const bool resul template <> struct IsRelocatableHeapType<HeapValue> { static const bool res
t = true; }; ult = false; };
template <> struct IsPostBarrieredType<HeapId> { static const bool resul template <> struct IsRelocatableHeapType<HeapId> { static const bool res
t = true; }; ult = false; };
} /* namespace tl */ } /* namespace tl */
} /* namespace js */ } /* namespace js */
#endif /* jsgc_barrier_h___ */ #endif /* jsgc_barrier_h___ */
 End of changes. 41 change blocks. 
137 lines changed or deleted 239 lines changed or added


 BitArray.h   BitArray.h 
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=4 sw=4 et tw=99 ft=cpp: * vim: set ts=4 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey JavaScript engine.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Terrence Cole <terrence@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef BitArray_h__ #ifndef BitArray_h__
#define BitArray_h__ #define BitArray_h__
#include "jstypes.h" #include "jstypes.h"
#include "js/TemplateLib.h" #include "js/TemplateLib.h"
namespace js { namespace js {
 End of changes. 1 change blocks. 
44 lines changed or deleted 3 lines changed or added


 BloomFilter.h   BloomFilter.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 , * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* /*
* A counting Bloom filter implementation. This allows consumers to * A counting Bloom filter implementation. This allows consumers to
* do fast probabilistic "is item X in set Y?" testing which will * do fast probabilistic "is item X in set Y?" testing which will
* never answer "no" when the correct answer is "yes" (but might * never answer "no" when the correct answer is "yes" (but might
* incorrectly answer "yes" when the correct answer is "no"). * incorrectly answer "yes" when the correct answer is "no").
*/ */
skipping to change at line 55 skipping to change at line 55
* the number N of objects in set Y. As long as N is small compared * the number N of objects in set Y. As long as N is small compared
* to M, the rate of such answers is expected to be approximately * to M, the rate of such answers is expected to be approximately
* 4*(N/M)**2 for this filter. In practice, if Y has a few hundred * 4*(N/M)**2 for this filter. In practice, if Y has a few hundred
* elements then using a KeySize of 12 gives a reasonably low * elements then using a KeySize of 12 gives a reasonably low
* incorrect answer rate. A KeySize of 12 has the additional benefit * incorrect answer rate. A KeySize of 12 has the additional benefit
* of using exactly one page for the filter in typical hardware * of using exactly one page for the filter in typical hardware
* configurations. * configurations.
*/ */
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
class BloomFilter { class BloomFilter
{
/* /*
* A counting Bloom filter with 8-bit counters. For now we assume * A counting Bloom filter with 8-bit counters. For now we assume
* that having two hash functions is enough, but we may revisit that * that having two hash functions is enough, but we may revisit that
* decision later. * decision later.
* *
* The filter uses an array with 2**KeySize entries. * The filter uses an array with 2**KeySize entries.
* *
* Assuming a well-distributed hash function, a Bloom filter with * Assuming a well-distributed hash function, a Bloom filter with
* array size M containing N elements and * array size M containing N elements and
* using k hash function has expected false positive rate exactly * using k hash function has expected false positive rate exactly
skipping to change at line 104 skipping to change at line 105
* factor of 4, and a false positive rate of 1% corresponds to * factor of 4, and a false positive rate of 1% corresponds to
* about M/N == 20. * about M/N == 20.
* *
* What this means in practice is that for a few hundred keys using a * What this means in practice is that for a few hundred keys using a
* KeySize of 12 gives false positive rates on the order of 0.25-4%. * KeySize of 12 gives false positive rates on the order of 0.25-4%.
* *
* Similarly, using a KeySize of 10 would lead to a 4% false * Similarly, using a KeySize of 10 would lead to a 4% false
* positive rate for N == 100 and to quite bad false positive * positive rate for N == 100 and to quite bad false positive
* rates for larger N. * rates for larger N.
*/ */
public: public:
BloomFilter() { BloomFilter() {
MOZ_STATIC_ASSERT(KeySize <= keyShift, "KeySize too big"); MOZ_STATIC_ASSERT(KeySize <= keyShift, "KeySize too big");
// Should we have a custom operator new using calloc instead and // Should we have a custom operator new using calloc instead and
// require that we're allocated via the operator? // require that we're allocated via the operator?
clear(); clear();
} }
/* /*
* Clear the filter. This should be done before reusing it, because * Clear the filter. This should be done before reusing it, because
skipping to change at line 145 skipping to change at line 146
*/ */
bool mightContain(const T* t) const; bool mightContain(const T* t) const;
/* /*
* Methods for add/remove/contain when we already have a hash computed * Methods for add/remove/contain when we already have a hash computed
*/ */
void add(uint32_t hash); void add(uint32_t hash);
void remove(uint32_t hash); void remove(uint32_t hash);
bool mightContain(uint32_t hash) const; bool mightContain(uint32_t hash) const;
private: private:
static const size_t arraySize = (1 << KeySize); static const size_t arraySize = (1 << KeySize);
static const uint32_t keyMask = (1 << KeySize) - 1; static const uint32_t keyMask = (1 << KeySize) - 1;
static const uint32_t keyShift = 16; static const uint32_t keyShift = 16;
static uint32_t hash1(uint32_t hash) { return hash & keyMask; } static uint32_t hash1(uint32_t hash) { return hash & keyMask; }
static uint32_t hash2(uint32_t hash) { return (hash >> keyShift) & keyM ask; } static uint32_t hash2(uint32_t hash) { return (hash >> keyShift) & keyM ask; }
uint8_t& firstSlot(uint32_t hash) { return counters[hash1(hash)]; } uint8_t& firstSlot(uint32_t hash) { return counters[hash1(hash)]; }
uint8_t& secondSlot(uint32_t hash) { return counters[hash2(hash)]; } uint8_t& secondSlot(uint32_t hash) { return counters[hash2(hash)]; }
const uint8_t& firstSlot(uint32_t hash) const { return counters[hash1(h ash)]; } const uint8_t& firstSlot(uint32_t hash) const { return counters[hash1(h ash)]; }
skipping to change at line 167 skipping to change at line 168
static bool full(const uint8_t& slot) { return slot == UINT8_MAX; } static bool full(const uint8_t& slot) { return slot == UINT8_MAX; }
uint8_t counters[arraySize]; uint8_t counters[arraySize];
}; };
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
inline void inline void
BloomFilter<KeySize, T>::clear() BloomFilter<KeySize, T>::clear()
{ {
memset(counters, 0, arraySize); memset(counters, 0, arraySize);
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
inline void inline void
BloomFilter<KeySize, T>::add(uint32_t hash) BloomFilter<KeySize, T>::add(uint32_t hash)
{ {
uint8_t& slot1 = firstSlot(hash); uint8_t& slot1 = firstSlot(hash);
if (MOZ_LIKELY(!full(slot1))) if (MOZ_LIKELY(!full(slot1)))
++slot1; ++slot1;
uint8_t& slot2 = secondSlot(hash); uint8_t& slot2 = secondSlot(hash);
if (MOZ_LIKELY(!full(slot2))) if (MOZ_LIKELY(!full(slot2)))
++slot2; ++slot2;
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
MOZ_ALWAYS_INLINE void MOZ_ALWAYS_INLINE void
BloomFilter<KeySize, T>::add(const T* t) BloomFilter<KeySize, T>::add(const T* t)
{ {
uint32_t hash = t->hash(); uint32_t hash = t->hash();
return add(hash); return add(hash);
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
inline void inline void
BloomFilter<KeySize, T>::remove(uint32_t hash) BloomFilter<KeySize, T>::remove(uint32_t hash)
{ {
// If the slots are full, we don't know whether we bumped them to be // If the slots are full, we don't know whether we bumped them to be
// there when we added or not, so just leave them full. // there when we added or not, so just leave them full.
uint8_t& slot1 = firstSlot(hash); uint8_t& slot1 = firstSlot(hash);
if (MOZ_LIKELY(!full(slot1))) if (MOZ_LIKELY(!full(slot1)))
--slot1; --slot1;
uint8_t& slot2 = secondSlot(hash); uint8_t& slot2 = secondSlot(hash);
if (MOZ_LIKELY(!full(slot2))) if (MOZ_LIKELY(!full(slot2)))
--slot2; --slot2;
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
MOZ_ALWAYS_INLINE void MOZ_ALWAYS_INLINE void
BloomFilter<KeySize, T>::remove(const T* t) BloomFilter<KeySize, T>::remove(const T* t)
{ {
uint32_t hash = t->hash(); uint32_t hash = t->hash();
remove(hash); remove(hash);
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
MOZ_ALWAYS_INLINE bool MOZ_ALWAYS_INLINE bool
BloomFilter<KeySize, T>::mightContain(uint32_t hash) const BloomFilter<KeySize, T>::mightContain(uint32_t hash) const
{ {
// Check that all the slots for this hash contain something // Check that all the slots for this hash contain something
return firstSlot(hash) && secondSlot(hash); return firstSlot(hash) && secondSlot(hash);
} }
template<unsigned KeySize, class T> template<unsigned KeySize, class T>
MOZ_ALWAYS_INLINE bool MOZ_ALWAYS_INLINE bool
BloomFilter<KeySize, T>::mightContain(const T* t) const BloomFilter<KeySize, T>::mightContain(const T* t) const
{ {
uint32_t hash = t->hash(); uint32_t hash = t->hash();
return mightContain(hash); return mightContain(hash);
} }
} // namespace mozilla } // namespace mozilla
#endif /* mozilla_BloomFilter_h_ */ #endif /* mozilla_BloomFilter_h_ */
 End of changes. 11 change blocks. 
29 lines changed or deleted 30 lines changed or added


 CCAccelerometer.h   CCAccelerometer.h 
skipping to change at line 25 skipping to change at line 25
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO M, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO M,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*************************************************************************** */ *************************************************************************** */
#ifndef __PLATFORM_MAC_CCACCELEROMETER_H__ #ifndef __PLATFORM_IPHONE_CCACCELEROMETER_H__
#define __PLATFORM_MAC_CCACCELEROMETER_H__ #define __PLATFORM_IPHONE_CCACCELEROMETER_H__
#include "platform/CCAccelerometerDelegate.h" #include "platform/CCAccelerometerDelegate.h"
NS_CC_BEGIN NS_CC_BEGIN
class CC_DLL CCAccelerometer class CC_DLL CCAccelerometer
{ {
public: public:
CCAccelerometer() {} CCAccelerometer();
~CCAccelerometer() {} ~CCAccelerometer();
void setDelegate(CCAccelerometerDelegate* pDelegate) { CC_UNUSED_PARAM( void setDelegate(CCAccelerometerDelegate* pDelegate);
pDelegate); } void setAccelerometerInterval(float interval);
}; };
NS_CC_END NS_CC_END
#endif #endif
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added


 CCActionEase.h   CCActionEase.h 
skipping to change at line 314 skipping to change at line 314
virtual CCActionInterval* reverse(void); virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
public: public:
/** Creates the action with the inner action and the period in radians (default is 0.3) /** Creates the action with the inner action and the period in radians (default is 0.3)
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCEaseElastic* actionWithAction(CCAction Interval *pAction, float fPeriod = 0.3f); CC_DEPRECATED_ATTRIBUTE static CCEaseElastic* actionWithAction(CCAction Interval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */ /** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod); static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod);
static CCEaseElastic* create(CCActionInterval *pAction) { static CCEaseElastic* create(CCActionInterval *pAction);
return CCEaseElastic::create(pAction, 0.3f);
}
protected: protected:
float m_fPeriod; float m_fPeriod;
}; };
/** /**
@brief Ease Elastic In action. @brief Ease Elastic In action.
@warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action. @warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action.
@since v0.8.2 @since v0.8.2
@ingroup Actions @ingroup Actions
*/ */
skipping to change at line 341 skipping to change at line 339
virtual CCActionInterval* reverse(void); virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
public: public:
/** Creates the action with the inner action and the period in radians (default is 0.3) /** Creates the action with the inner action and the period in radians (default is 0.3)
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCEaseElasticIn* actionWithAction(CCActi onInterval *pAction, float fPeriod = 0.3f); CC_DEPRECATED_ATTRIBUTE static CCEaseElasticIn* actionWithAction(CCActi onInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */ /** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod ); static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod );
static CCEaseElasticIn* create(CCActionInterval *pAction) { static CCEaseElasticIn* create(CCActionInterval *pAction);
return CCEaseElasticIn::create(pAction, 0.3f);
}
}; };
/** /**
@brief Ease Elastic Out action. @brief Ease Elastic Out action.
@warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action. @warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action.
@since v0.8.2 @since v0.8.2
@ingroup Actions @ingroup Actions
*/ */
class CC_DLL CCEaseElasticOut : public CCEaseElastic class CC_DLL CCEaseElasticOut : public CCEaseElastic
{ {
skipping to change at line 367 skipping to change at line 363
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
public: public:
/** Creates the action with the inner action and the period in radians (default is 0.3) /** Creates the action with the inner action and the period in radians (default is 0.3)
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCEaseElasticOut* actionWithAction(CCAct ionInterval *pAction, float fPeriod = 0.3f); CC_DEPRECATED_ATTRIBUTE static CCEaseElasticOut* actionWithAction(CCAct ionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */ /** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticOut* create(CCActionInterval *pAction, float fPerio d); static CCEaseElasticOut* create(CCActionInterval *pAction, float fPerio d);
static CCEaseElasticOut* create(CCActionInterval *pAction) { static CCEaseElasticOut* create(CCActionInterval *pAction);
return CCEaseElasticOut::create(pAction, 0.3f);
}
}; };
/** /**
@brief Ease Elastic InOut action. @brief Ease Elastic InOut action.
@warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action. @warning This action doesn't use a bijective function. Actions like Sequen ce might have an unexpected result when used with this action.
@since v0.8.2 @since v0.8.2
@ingroup Actions @ingroup Actions
*/ */
class CC_DLL CCEaseElasticInOut : public CCEaseElastic class CC_DLL CCEaseElasticInOut : public CCEaseElastic
{ {
skipping to change at line 393 skipping to change at line 387
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
public: public:
/** Creates the action with the inner action and the period in radians (default is 0.3) /** Creates the action with the inner action and the period in radians (default is 0.3)
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCEaseElasticInOut* actionWithAction(CCA ctionInterval *pAction, float fPeriod = 0.3f); CC_DEPRECATED_ATTRIBUTE static CCEaseElasticInOut* actionWithAction(CCA ctionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */ /** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPer iod); static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPer iod);
static CCEaseElasticInOut* create(CCActionInterval *pAction) { static CCEaseElasticInOut* create(CCActionInterval *pAction);
return CCEaseElasticInOut::create(pAction, 0.3f);
}
}; };
/** /**
@brief CCEaseBounce abstract class. @brief CCEaseBounce abstract class.
@since v0.8.2 @since v0.8.2
@ingroup Actions @ingroup Actions
*/ */
class CC_DLL CCEaseBounce : public CCActionEase class CC_DLL CCEaseBounce : public CCActionEase
{ {
public: public:
 End of changes. 4 change blocks. 
12 lines changed or deleted 4 lines changed or added


 CCCommon.h   CCCommon.h 
skipping to change at line 66 skipping to change at line 66
@brief Enum the language type supported now @brief Enum the language type supported now
*/ */
typedef enum LanguageType typedef enum LanguageType
{ {
kLanguageEnglish = 0, kLanguageEnglish = 0,
kLanguageChinese, kLanguageChinese,
kLanguageFrench, kLanguageFrench,
kLanguageItalian, kLanguageItalian,
kLanguageGerman, kLanguageGerman,
kLanguageSpanish, kLanguageSpanish,
kLanguageRussian kLanguageRussian,
kLanguageKorean
} ccLanguageType; } ccLanguageType;
// end of platform group // end of platform group
/// @} /// @}
NS_CC_END NS_CC_END
#endif // __CC_COMMON_H__ #endif // __CC_COMMON_H__
 End of changes. 1 change blocks. 
1 lines changed or deleted 2 lines changed or added


 CCDirector.h   CCDirector.h 
skipping to change at line 161 skipping to change at line 161
inline bool isSendCleanupToScene(void) { return m_bSendCleanupToScene; } inline bool isSendCleanupToScene(void) { return m_bSendCleanupToScene; }
/** This object will be visited after the main scene is visited. /** This object will be visited after the main scene is visited.
This object MUST implement the "visit" selector. This object MUST implement the "visit" selector.
Useful to hook a notification object, like CCNotifications (http://git hub.com/manucorporat/CCNotifications) Useful to hook a notification object, like CCNotifications (http://git hub.com/manucorporat/CCNotifications)
@since v0.99.5 @since v0.99.5
*/ */
CCNode* getNotificationNode(); CCNode* getNotificationNode();
void setNotificationNode(CCNode *node); void setNotificationNode(CCNode *node);
bool enableRetinaDisplay(bool bEnabelRetina);
// window size // window size
/** returns the size of the OpenGL view in points. /** returns the size of the OpenGL view in points.
*/ */
CCSize getWinSize(void); CCSize getWinSize(void);
/** returns the size of the OpenGL view in pixels. /** returns the size of the OpenGL view in pixels.
*/ */
CCSize getWinSizeInPixels(void); CCSize getWinSizeInPixels(void);
/** returns visible size of the OpenGL view in points. /** returns visible size of the OpenGL view in points.
* the value is equal to getWinSize if don't invoke * the value is equal to getWinSize if don't invoke
* CCEGLView::setDesignResolutionSize() * CCEGLView::setDesignResolutionSize()
*/ */
CCSize getVisibleSize(); CCSize getVisibleSize();
/** returns visible origin of the OpenGL view in points. /** returns visible origin of the OpenGL view in points.
*/ */
CCPoint getVisibleOrigin(); CCPoint getVisibleOrigin();
/** changes the projection size */
void reshapeProjection(const CCSize& newWindowSize);
/** converts a UIKit coordinate to an OpenGL coordinate /** converts a UIKit coordinate to an OpenGL coordinate
Useful to convert (multi) touches coordinates to the current layout (p ortrait or landscape) Useful to convert (multi) touches coordinates to the current layout (p ortrait or landscape)
*/ */
CCPoint convertToGL(const CCPoint& obPoint); CCPoint convertToGL(const CCPoint& obPoint);
/** converts an OpenGL coordinate to a UIKit coordinate /** converts an OpenGL coordinate to a UIKit coordinate
Useful to convert node points to window points for calls such as glSci ssor Useful to convert node points to window points for calls such as glSci ssor
*/ */
CCPoint convertToUI(const CCPoint& obPoint); CCPoint convertToUI(const CCPoint& obPoint);
skipping to change at line 331 skipping to change at line 326
CC_PROPERTY(CCAccelerometer*, m_pAccelerometer, Accelerometer); CC_PROPERTY(CCAccelerometer*, m_pAccelerometer, Accelerometer);
/** returns a shared instance of the director */ /** returns a shared instance of the director */
static CCDirector* sharedDirector(void); static CCDirector* sharedDirector(void);
protected: protected:
void purgeDirector(); void purgeDirector();
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in e nd() bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in e nd()
void updateContentScaleFactor(void);
void setNextScene(void); void setNextScene(void);
void showStats(); void showStats();
void createStatsLabel(); void createStatsLabel();
void calculateMPF(); void calculateMPF();
/** calculates delta time since last time it was called */ /** calculates delta time since last time it was called */
void calculateDeltaTime(); void calculateDeltaTime();
protected: protected:
/* The CCEGLView, where everything is rendered */ /* The CCEGLView, where everything is rendered */
skipping to change at line 395 skipping to change at line 388
/* whether or not the next delta time will be zero */ /* whether or not the next delta time will be zero */
bool m_bNextDeltaTimeZero; bool m_bNextDeltaTimeZero;
/* projection used */ /* projection used */
ccDirectorProjection m_eProjection; ccDirectorProjection m_eProjection;
/* window size in points */ /* window size in points */
CCSize m_obWinSizeInPoints; CCSize m_obWinSizeInPoints;
/* window size in pixels */
CCSize m_obWinSizeInPixels;
/* content scale factor */ /* content scale factor */
float m_fContentScaleFactor; float m_fContentScaleFactor;
/* store the fps string */ /* store the fps string */
char *m_pszFPS; char *m_pszFPS;
/* This object will be visited after the scene. Useful to hook a notifi cation node */ /* This object will be visited after the scene. Useful to hook a notifi cation node */
CCNode *m_pNotificationNode; CCNode *m_pNotificationNode;
/* Projection protocol delegate */ /* Projection protocol delegate */
CCDirectorDelegate *m_pProjectionDelegate; CCDirectorDelegate *m_pProjectionDelegate;
/* contentScaleFactor could be simulated */
bool m_bIsContentScaleSupported;
// CCEGLViewProtocol will recreate stats labels to fit visible rect // CCEGLViewProtocol will recreate stats labels to fit visible rect
friend class CCEGLViewProtocol; friend class CCEGLViewProtocol;
}; };
/** /**
@brief DisplayLinkDirector is a Director that synchronizes timers with the refresh rate of the display. @brief DisplayLinkDirector is a Director that synchronizes timers with the refresh rate of the display.
Features and Limitations: Features and Limitations:
- Scheduled timers & drawing are synchronizes with the refresh rate of th e display - Scheduled timers & drawing are synchronizes with the refresh rate of th e display
- Only supports animation intervals of 1/60 1/30 & 1/15 - Only supports animation intervals of 1/60 1/30 & 1/15
 End of changes. 5 change blocks. 
13 lines changed or deleted 0 lines changed or added


 CCEGLView.h   CCEGLView.h 
/************************************************************************** ** /************************************************************************** **
Copyright (c) 2010 cocos2d-x.org Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a cop Permission is hereby granted, free of charge, to any person obtaining a co
y py
of this software and associated documentation files (the "Software"), to de of this software and associated documentation files (the "Software"), to d
al eal
in the Software without restriction, including without limitation the right in the Software without restriction, including without limitation the righ
s ts
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER E
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
M, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FR
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OM,
THE SOFTWARE. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*************************************************************************** THE SOFTWARE.
*/ **************************************************************************
**/
#ifndef __CC_EGLVIEW_IPHONE_H__ #ifndef __CC_EGLVIEW_MAC_H__
#define __CC_EGLVIEW_IPHONE_H__ #define __CC_EGLVIEW_MAC_H__
#include "platform/CCCommon.h" #include "platform/CCCommon.h"
#include "platform/CCEGLViewProtocol.h" #include "platform/CCEGLViewProtocol.h"
NS_CC_BEGIN NS_CC_BEGIN
class CCSet;
class CCTouch;
class CCSize;
class CC_DLL CCEGLView : public CCEGLViewProtocol class CC_DLL CCEGLView : public CCEGLViewProtocol
{ {
public: public:
CCEGLView(); static CCEGLView* sharedOpenGLView(void);
~CCEGLView();
virtual ~CCEGLView(void);
virtual bool isOpenGLReady(); virtual bool isOpenGLReady(void);
virtual bool setContentScaleFactor(float contentScaleFactor); virtual bool setContentScaleFactor(float contentScaleFactor);
virtual bool enableRetina(); virtual void end();
virtual void swapBuffers(void);
// keep compatible /**
virtual void end(); * Set opengl view port rectangle with points.
virtual void swapBuffers(); */
virtual void setViewPortInPoints(float x , float y , float w , float h)
;
virtual void setScissorInPoints(float x , float y , float w , float h);
virtual void setIMEKeyboardState(bool bOpen); virtual void setIMEKeyboardState(bool bOpen);
virtual void setMultiTouchMask(bool mask);
static CCEGLView* sharedOpenGLView(); private:
static CCEGLView* s_sharedView;
CCEGLView(void);
}; };
NS_CC_END NS_CC_END // end of namespace cocos2d
#endif // end of __CC_EGLVIEW_IPHONE_H__ #endif // end of __CC_EGLVIEW_MAC_H__
 End of changes. 12 change blocks. 
38 lines changed or deleted 50 lines changed or added


 CCEGLViewProtocol.h   CCEGLViewProtocol.h 
skipping to change at line 52 skipping to change at line 52
/** Get whether opengl render system is ready, subclass must implement this method. */ /** Get whether opengl render system is ready, subclass must implement this method. */
virtual bool isOpenGLReady() = 0; virtual bool isOpenGLReady() = 0;
/** Exchanges the front and back buffers, subclass must implement this method. */ /** Exchanges the front and back buffers, subclass must implement this method. */
virtual void swapBuffers() = 0; virtual void swapBuffers() = 0;
/** Open or close IME keyboard , subclass must implement this method. * / /** Open or close IME keyboard , subclass must implement this method. * /
virtual void setIMEKeyboardState(bool bOpen) = 0; virtual void setIMEKeyboardState(bool bOpen) = 0;
/** /**
* Get design resolution size.
* If setDesignResolutionSize wasn't invoked, the result of this functi
on return is the same as 'getFrameSize'
*/
virtual const CCSize& getSize() const;
/**
* Get the frame size of EGL view. * Get the frame size of EGL view.
* In general, it returns the screen size since the EGL view is a fulls creen view. * In general, it returns the screen size since the EGL view is a fulls creen view.
*/ */
virtual const CCSize& getFrameSize() const; virtual const CCSize& getFrameSize() const;
/** /**
* Set the frame size of EGL view. * Set the frame size of EGL view.
*/ */
virtual void setFrameSize(float width, float height); virtual void setFrameSize(float width, float height);
skipping to change at line 81 skipping to change at line 74
*/ */
virtual CCSize getVisibleSize() const; virtual CCSize getVisibleSize() const;
/** /**
* Get the visible origin point of opengl viewport. * Get the visible origin point of opengl viewport.
*/ */
virtual CCPoint getVisibleOrigin() const; virtual CCPoint getVisibleOrigin() const;
/** /**
* Set the design resolution size. * Set the design resolution size.
* Behavior undefined when enableRetina == true.
* @param width Design resolution width. * @param width Design resolution width.
* @param height Design resolution height. * @param height Design resolution height.
* @param resolutionPolicy The resolution policy desired, you may choos e: * @param resolutionPolicy The resolution policy desired, you may choos e:
* [1] kCCResolutionExactFit Fill screen by str * [1] kResolutionExactFit Fill screen by stret
etch-to-fit: if the design resolution ratio of width to height is different ch-to-fit: if the design resolution ratio of width to height is different f
from the screen resolution ratio, your game view will be stretched. rom the screen resolution ratio, your game view will be stretched.
* [2] kCCResolutionNoBorder Full screen withou * [2] kResolutionNoBorder Full screen without
t black border: if the design resolution ratio of width to height is differ black border: if the design resolution ratio of width to height is differen
ent from the screen resolution ratio, two areas of your game view will be c t from the screen resolution ratio, two areas of your game view will be cut
ut. .
* [3] kCCResolutionShowAll Full screen with b * [3] kResolutionShowAll Full screen with bla
lack border: if the design resolution ratio of width to height is different ck border: if the design resolution ratio of width to height is different f
from the screen resolution ratio, two black borders will be shown. rom the screen resolution ratio, two black borders will be shown.
*/ */
virtual void setDesignResolutionSize(float width, float height, Resolut ionPolicy resolutionPolicy); virtual void setDesignResolutionSize(float width, float height, Resolut ionPolicy resolutionPolicy);
/** Get design resolution size.
* Default resolution size is the same as 'getFrameSize'.
*/
virtual const CCSize& getDesignResolutionSize() const;
/** Set touch delegate */ /** Set touch delegate */
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate); virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
/** /**
* Set content scale factor.
* @return If the return value is true, the platform supports retina di
splay mode.
*/
virtual bool setContentScaleFactor(float contentScaleFactor);
/**
* Set opengl view port rectangle with points. * Set opengl view port rectangle with points.
*/ */
virtual void setViewPortInPoints(float x , float y , float w , float h) ; virtual void setViewPortInPoints(float x , float y , float w , float h) ;
/** /**
* Set Scissor rectangle with points. * Set Scissor rectangle with points.
*/ */
virtual void setScissorInPoints(float x , float y , float w , float h); virtual void setScissorInPoints(float x , float y , float w , float h);
/** virtual void setViewName(const char* pszViewName);
* Enable retina mode.
* You can't use it with setDesignResolutionSize const char* getViewName();
*/
virtual bool enableRetina();
/** Touch events are handled by default; if you want to customize your handlers, please override these functions: */ /** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
virtual void handleTouchesBegin(int num, int ids[], float xs[], float y s[]); virtual void handleTouchesBegin(int num, int ids[], float xs[], float y s[]);
virtual void handleTouchesMove(int num, int ids[], float xs[], float ys []); virtual void handleTouchesMove(int num, int ids[], float xs[], float ys []);
virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[ ]); virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[ ]);
virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]); virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]);
/** /**
* Get the opengl view port rectangle. * Get the opengl view port rectangle.
*/ */
skipping to change at line 136 skipping to change at line 125
/** /**
* Get scale factor of the horizontal direction. * Get scale factor of the horizontal direction.
*/ */
float getScaleX() const; float getScaleX() const;
/** /**
* Get scale factor of the vertical direction. * Get scale factor of the vertical direction.
*/ */
float getScaleY() const; float getScaleY() const;
/**
* Get retina mode status (on if true).
*/
bool isRetinaEnabled() const;
private: private:
void getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float x s[], float ys[]); void getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float x s[], float ys[]);
protected: protected:
EGLTouchDelegate* m_pDelegate; EGLTouchDelegate* m_pDelegate;
// real screen size // real screen size
CCSize m_obScreenSize; CCSize m_obScreenSize;
// resolution size, it is the size appropriate for the app resources. // resolution size, it is the size appropriate for the app resources.
CCSize m_obDesignResolutionSize; CCSize m_obDesignResolutionSize;
// the view port size // the view port size
CCRect m_obViewPortRect; CCRect m_obViewPortRect;
// the view name // the view name
char m_szViewName[50]; char m_szViewName[50];
float m_fScaleX; float m_fScaleX;
float m_fScaleY; float m_fScaleY;
ResolutionPolicy m_eResolutionPolicy; ResolutionPolicy m_eResolutionPolicy;
bool m_bIsRetinaEnabled;
}; };
// end of platform group // end of platform group
/// @} /// @}
NS_CC_END NS_CC_END
#endif /* __CCEGLVIEWPROTOCOL_H__ */ #endif /* __CCEGLVIEWPROTOCOL_H__ */
 End of changes. 8 change blocks. 
37 lines changed or deleted 18 lines changed or added


 CCEditBoxImplIOS.h   CCEditBoxImplIOS.h 
skipping to change at line 67 skipping to change at line 67
virtual void setContentSize(const CCSize& size); virtual void setContentSize(const CCSize& size);
virtual void visit(void); virtual void visit(void);
virtual void doAnimationWhenKeyboardMove(float duration, float distance ); virtual void doAnimationWhenKeyboardMove(float duration, float distance );
virtual void openKeyboard(); virtual void openKeyboard();
virtual void closeKeyboard(); virtual void closeKeyboard();
private: private:
CCSize m_tContentSize; CCSize m_tContentSize;
void* m_pSysEdit; void* m_pSysEdit;
int m_nMaxTextLength; int m_nMaxTextLength;
bool m_bInRetinaMode;
}; };
NS_CC_EXT_END NS_CC_EXT_END
#endif /* __CCEditBoxIMPLIOS_H__ */ #endif /* __CCEditBoxIMPLIOS_H__ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 CCLabelBMFont.h   CCLabelBMFont.h 
skipping to change at line 211 skipping to change at line 211
@since v0.99.3 @since v0.99.3
*/ */
static void purgeCachedData(); static void purgeCachedData();
/** creates a bitmap font atlas with an initial string and the FNT file /** creates a bitmap font atlas with an initial string and the FNT file
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLabelBMFont * labelWithString(const ch ar *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextA lignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZer o); CC_DEPRECATED_ATTRIBUTE static CCLabelBMFont * labelWithString(const ch ar *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextA lignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZer o);
/** creates a bitmap font atlas with an initial string and the FNT file */ /** creates a bitmap font atlas with an initial string and the FNT file */
static CCLabelBMFont * create(const char *str, const char *fntFile, flo at width, CCTextAlignment alignment, CCPoint imageOffset); static CCLabelBMFont * create(const char *str, const char *fntFile, flo at width, CCTextAlignment alignment, CCPoint imageOffset);
static CCLabelBMFont * create(const char *str, const char *fntFile, static CCLabelBMFont * create(const char *str, const char *fntFile,
float width, CCTextAlignment alignment) { float width, CCTextAlignment alignment);
return CCLabelBMFont::create(str, fntFile, width, alignment,
CCPointZero); static CCLabelBMFont * create(const char *str, const char *fntFile,
} float width);
static CCLabelBMFont * create(const char *str, const char *fntFile, static CCLabelBMFont * create(const char *str, const char *fntFile);
float width) {
return CCLabelBMFont::create(str, fntFile, width, kCCTextAli
gnmentLeft, CCPointZero);
}
static CCLabelBMFont * create(const char *str, const char *fntFile)
{
return CCLabelBMFont::create(str, fntFile, kCCLabelAutomaticWidth,
kCCTextAlignmentLeft, CCPointZero);
}
/** Creates an label. /** Creates an label.
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLabelBMFont * node(); CC_DEPRECATED_ATTRIBUTE static CCLabelBMFont * node();
/** Creates an label. /** Creates an label.
*/ */
static CCLabelBMFont * create(); static CCLabelBMFont * create();
 End of changes. 1 change blocks. 
17 lines changed or deleted 7 lines changed or added


 CCLayer.h   CCLayer.h 
skipping to change at line 39 skipping to change at line 39
#include "base_nodes/CCNode.h" #include "base_nodes/CCNode.h"
#include "CCProtocols.h" #include "CCProtocols.h"
#include "touch_dispatcher/CCTouchDelegateProtocol.h" #include "touch_dispatcher/CCTouchDelegateProtocol.h"
#include "platform/CCAccelerometerDelegate.h" #include "platform/CCAccelerometerDelegate.h"
#include "keypad_dispatcher/CCKeypadDelegate.h" #include "keypad_dispatcher/CCKeypadDelegate.h"
#include "cocoa/CCArray.h" #include "cocoa/CCArray.h"
NS_CC_BEGIN NS_CC_BEGIN
typedef enum {
kCCTouchesAllAtOnce,
kCCTouchesOneByOne,
} ccTouchesMode;
/** /**
* @addtogroup layer * @addtogroup layer
* @{ * @{
*/ */
class CCTouchScriptHandlerEntry; class CCTouchScriptHandlerEntry;
// //
// CCLayer // CCLayer
// //
skipping to change at line 83 skipping to change at line 88
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent); virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent); virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent); virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
// default implements are used to call script callback if exist // default implements are used to call script callback if exist
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent); virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent); virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent); virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent); virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUS ED_PARAM(pAccelerationValue);} virtual void didAccelerate(CCAcceleration* pAccelerationValue);
/** If isTouchEnabled, this method is called onEnter. Override it to ch ange the /** If isTouchEnabled, this method is called onEnter. Override it to ch ange the
way CCLayer receives touch events. way CCLayer receives touch events.
( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(t his,0); ) ( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(t his,0); )
Example: Example:
void CCLayer::registerWithTouchDispatcher() void CCLayer::registerWithTouchDispatcher()
{ {
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN +1,true); CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN +1,true);
} }
@since v0.8.0 @since v0.8.0
skipping to change at line 109 skipping to change at line 114
/** Unregister script touch events handler */ /** Unregister script touch events handler */
void unregisterScriptTouchHandler(void); void unregisterScriptTouchHandler(void);
/** whether or not it will receive Touch events. /** whether or not it will receive Touch events.
You can enable / disable touch events with this property. You can enable / disable touch events with this property.
Only the touches of this node will be affected. This "method" is not pr opagated to it's children. Only the touches of this node will be affected. This "method" is not pr opagated to it's children.
@since v0.8.1 @since v0.8.1
*/ */
bool isTouchEnabled(); bool isTouchEnabled();
void setTouchEnabled(bool value); void setTouchEnabled(bool value);
void setTouchMode(ccTouchesMode mode);
void setTouchPriority(int priority);
int getTouchPriority();
int getTouchMode();
/** whether or not it will receive Accelerometer events /** whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property. You can enable / disable accelerometer events with this property.
@since v0.8.1 @since v0.8.1
*/ */
bool isAccelerometerEnabled(); bool isAccelerometerEnabled();
void setAccelerometerEnabled(bool value); void setAccelerometerEnabled(bool value);
void setAccelerometerInterval(double interval);
/** whether or not it will receive keypad events /** whether or not it will receive keypad events
You can enable / disable accelerometer events with this property. You can enable / disable accelerometer events with this property.
it's new in cocos2d-x it's new in cocos2d-x
*/ */
bool isKeypadEnabled(); bool isKeypadEnabled();
void setKeypadEnabled(bool value); void setKeypadEnabled(bool value);
inline CCTouchScriptHandlerEntry* getScriptHandlerEntry() { return m_pS criptHandlerEntry; }; inline CCTouchScriptHandlerEntry* getScriptHandlerEntry() { return m_pS criptHandlerEntry; };
protected: protected:
bool m_bIsTouchEnabled; bool m_bIsTouchEnabled;
bool m_bIsAccelerometerEnabled; bool m_bIsAccelerometerEnabled;
bool m_bIsKeypadEnabled; bool m_bIsKeypadEnabled;
private: private:
// Script touch events handler // Script touch events handler
CCTouchScriptHandlerEntry* m_pScriptHandlerEntry; CCTouchScriptHandlerEntry* m_pScriptHandlerEntry;
int m_bTouchPriority;
ccTouchesMode m_bTouchMode;
int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch); int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch);
int excuteScriptTouchHandler(int nEventType, CCSet *pTouches); int excuteScriptTouchHandler(int nEventType, CCSet *pTouches);
}; };
// //
// CCLayerColor // CCLayerColor
// //
/** @brief CCLayerColor is a subclass of CCLayer that implements the CCRGBA Protocol protocol. /** @brief CCLayerColor is a subclass of CCLayer that implements the CCRGBA Protocol protocol.
All features from CCLayer are valid, plus the following new features: All features from CCLayer are valid, plus the following new features:
skipping to change at line 166 skipping to change at line 183
/** creates a CCLayer with color, width and height in Points /** creates a CCLayer with color, width and height in Points
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccCo lor4B& color, GLfloat width, GLfloat height); CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccCo lor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. /** creates a CCLayer with color. Width and height are the window size.
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccCo lor4B& color); CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccCo lor4B& color);
//@deprecated: This interface will be deprecated sooner or later.
static CCLayerColor* node();
static CCLayerColor* create();
/** creates a CCLayer with color, width and height in Points */ /** creates a CCLayer with color, width and height in Points */
static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLf loat height); static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLf loat height);
/** creates a CCLayer with color. Width and height are the window size. */ /** creates a CCLayer with color. Width and height are the window size. */
static CCLayerColor * create(const ccColor4B& color); static CCLayerColor * create(const ccColor4B& color);
virtual bool init(); virtual bool init();
/** initializes a CCLayer with color, width and height in Points */ /** initializes a CCLayer with color, width and height in Points */
virtual bool initWithColor(const ccColor4B& color, GLfloat width, GLflo at height); virtual bool initWithColor(const ccColor4B& color, GLfloat width, GLflo at height);
/** initializes a CCLayer with color. Width and height are the window s ize. */ /** initializes a CCLayer with color. Width and height are the window s ize. */
virtual bool initWithColor(const ccColor4B& color); virtual bool initWithColor(const ccColor4B& color);
skipping to change at line 195 skipping to change at line 217
/** Opacity: conforms to CCRGBAProtocol protocol */ /** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity) CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** Color: conforms to CCRGBAProtocol protocol */ /** Color: conforms to CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** BlendFunction. Conforms to CCBlendProtocol protocol */ /** BlendFunction. Conforms to CCBlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc) CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue); } virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue); }
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) { return false;}
//@deprecated: This interface will be deprecated sooner or later.
CREATE_FUNC(CCLayerColor)
NODE_FUNC(CCLayerColor)
protected: protected:
virtual void updateColor(); virtual void updateColor();
}; };
// //
// CCLayerGradient // CCLayerGradient
// //
/** CCLayerGradient is a subclass of CCLayerColor that draws gradients acro ss /** CCLayerGradient is a subclass of CCLayerColor that draws gradients acro ss
the background. the background.
skipping to change at line 245 skipping to change at line 265
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLayerGradient* layerWithColor(const cc Color4B& start, const ccColor4B& end, const CCPoint& v); CC_DEPRECATED_ATTRIBUTE static CCLayerGradient* layerWithColor(const cc Color4B& start, const ccColor4B& end, const CCPoint& v);
/** Creates a full-screen CCLayer with a gradient between start and end . */ /** Creates a full-screen CCLayer with a gradient between start and end . */
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end); static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */ /** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v); static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
virtual bool init();
/** Initializes the CCLayer with a gradient between start and end. */ /** Initializes the CCLayer with a gradient between start and end. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end ); virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end );
/** Initializes the CCLayer with a gradient between start and end in th e direction of v. */ /** Initializes the CCLayer with a gradient between start and end in th e direction of v. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end , const CCPoint& v); virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end , const CCPoint& v);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_startColor, StartColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_startColor, StartColor)
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_endColor, EndColor) CC_PROPERTY_PASS_BY_REF(ccColor3B, m_endColor, EndColor)
CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity) CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity)
CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity) CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity)
skipping to change at line 266 skipping to change at line 287
/** Whether or not the interpolation will be compressed in order to dis play all the colors of the gradient both in canonical and non canonical vec tors /** Whether or not the interpolation will be compressed in order to dis play all the colors of the gradient both in canonical and non canonical vec tors
Default: YES Default: YES
*/ */
protected: protected:
bool m_bCompressedInterpolation; bool m_bCompressedInterpolation;
public: public:
virtual void setCompressedInterpolation(bool bCompressedInterpolation); virtual void setCompressedInterpolation(bool bCompressedInterpolation);
virtual bool isCompressedInterpolation(); virtual bool isCompressedInterpolation();
// @deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
NODE_FUNC(CCLayerGradient) static CCLayerGradient* node();
CREATE_FUNC(CCLayerGradient)
static CCLayerGradient* create();
protected: protected:
virtual void updateColor(); virtual void updateColor();
}; };
/** @brief CCMultipleLayer is a CCLayer with the ability to multiplex it's children. /** @brief CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
Features: Features:
- It supports one or more children - It supports one or more children
- Only one children will be active a time - Only one children will be active a time
*/ */
class CC_DLL CCLayerMultiplex : public CCLayer class CC_DLL CCLayerMultiplex : public CCLayer
skipping to change at line 322 skipping to change at line 345
/** switches to a certain layer indexed by n. /** switches to a certain layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup: YES'. The current (old) layer will be removed from it's parent with 'cleanup: YES'.
*/ */
void switchTo(unsigned int n); void switchTo(unsigned int n);
/** release the current layer and switches to another layer indexed by n. /** release the current layer and switches to another layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup: YES'. The current (old) layer will be removed from it's parent with 'cleanup: YES'.
*/ */
void switchToAndReleaseMe(unsigned int n); void switchToAndReleaseMe(unsigned int n);
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
NODE_FUNC(CCLayerMultiplex) static CCLayerMultiplex* node();
CREATE_FUNC(CCLayerMultiplex) static CCLayerMultiplex* create();
}; };
// end of layer group // end of layer group
/// @} /// @}
NS_CC_END NS_CC_END
#endif // __CCLAYER_H__ #endif // __CCLAYER_H__
 End of changes. 11 change blocks. 
9 lines changed or deleted 32 lines changed or added


 CCNode.h   CCNode.h 
skipping to change at line 65 skipping to change at line 65
*/ */
enum { enum {
kCCNodeTagInvalid = -1, kCCNodeTagInvalid = -1,
}; };
enum { enum {
kCCNodeOnEnter, kCCNodeOnEnter,
kCCNodeOnExit, kCCNodeOnExit,
kCCNodeOnEnterTransitionDidFinish, kCCNodeOnEnterTransitionDidFinish,
kCCNodeOnExitTransitionDidStart kCCNodeOnExitTransitionDidStart,
kCCNodeOnCleanup
}; };
/** @brief CCNode is the main element. Anything that gets drawn or contains things that get drawn is a CCNode. /** @brief CCNode is the main element. Anything that gets drawn or contains things that get drawn is a CCNode.
The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu. The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.
The main features of a CCNode are: The main features of a CCNode are:
- They can contain other CCNode nodes (addChild, getChildByTag, removeChil d, etc) - They can contain other CCNode nodes (addChild, getChildByTag, removeChil d, etc)
- They can schedule periodic callback (schedule, unschedule, etc) - They can schedule periodic callback (schedule, unschedule, etc)
- They can execute actions (runAction, stopAction, etc) - They can execute actions (runAction, stopAction, etc)
skipping to change at line 441 skipping to change at line 442
AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE
But if you enable any other GL state, you should disable it after draw ing your node. But if you enable any other GL state, you should disable it after draw ing your node.
*/ */
virtual void draw(void); virtual void draw(void);
/** recursive method that visit its children and draw them */ /** recursive method that visit its children and draw them */
virtual void visit(void); virtual void visit(void);
// transformations // transformations
// MARMALADE ADDED THIS... SO IT IS NO LONGER SPECIFIC TO CCSprite
/** updates the quad according the the rotation, position, scale values
. */
virtual void updateTransform(void);
/** performs OpenGL view-matrix transformation based on position, scale , rotation and other attributes. */ /** performs OpenGL view-matrix transformation based on position, scale , rotation and other attributes. */
void transform(void); void transform(void);
/** performs OpenGL view-matrix transformation of it's ancestors. /** performs OpenGL view-matrix transformation of it's ancestors.
Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO) Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO)
it's necessary to transform the ancestors again. it's necessary to transform the ancestors again.
@since v0.7.2 @since v0.7.2
*/ */
void transformAncestors(void); void transformAncestors(void);
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 CCNotificationCenter.h   CCNotificationCenter.h 
skipping to change at line 31 skipping to change at line 31
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*************************************************************************** */ *************************************************************************** */
#ifndef __CCNOTIFICATIONCENTER_H__ #ifndef __CCNOTIFICATIONCENTER_H__
#define __CCNOTIFICATIONCENTER_H__ #define __CCNOTIFICATIONCENTER_H__
#include "cocoa/CCObject.h" #include "cocoa/CCObject.h"
#include "cocoa/CCArray.h" #include "cocoa/CCArray.h"
NS_CC_BEGIN; NS_CC_BEGIN
class CC_DLL CCNotificationCenter : public CCObject class CC_DLL CCNotificationCenter : public CCObject
{ {
public: public:
/** CCNotificationCenter constructor */
CCNotificationCenter(); CCNotificationCenter();
/** CCNotificationCenter destructor */
~CCNotificationCenter(); ~CCNotificationCenter();
/** Gets the single instance of CCNotificationCenter. */
static CCNotificationCenter *sharedNotificationCenter(void); static CCNotificationCenter *sharedNotificationCenter(void);
/** Destroys the single instance of CCNotificationCenter. */
static void purgeNotificationCenter(void); static void purgeNotificationCenter(void);
/** @brief Adds an observer for the specified target.
* @param target The target which wants to observe notification events
.
* @param selector The callback function which will be invoked when th
e specified notification event was posted.
* @param name The name of this notification.
* @param obj The extra parameter which will be passed to the callback
function.
*/
void addObserver(CCObject *target, void addObserver(CCObject *target,
SEL_CallFuncO selector, SEL_CallFuncO selector,
const char *name, const char *name,
CCObject *obj); CCObject *obj);
/** @brief Removes the observer by the specified target and name.
* @param target The target of this notification.
* @param name The name of this notification.
*/
void removeObserver(CCObject *target,const char *name); void removeObserver(CCObject *target,const char *name);
/** @brief Registers one hander for script binding.
* @note Only supports Lua Binding now.
* @param handler The lua handler.
*/
void registerScriptObserver(int handler); void registerScriptObserver(int handler);
/** Unregisters script observer */
void unregisterScriptObserver(void); void unregisterScriptObserver(void);
/** @brief Posts one notification event by name.
* @param name The name of this notification.
*/
void postNotification(const char *name); void postNotification(const char *name);
/** @brief Posts one notification event by name.
* @param name The name of this notification.
* @param object The extra parameter.
*/
void postNotification(const char *name, CCObject *object); void postNotification(const char *name, CCObject *object);
/** @brief Gets script handler.
* @note Only supports Lua Binding now.
* @return The script handle.
*/
inline int getScriptHandler() { return m_scriptHandler; }; inline int getScriptHandler() { return m_scriptHandler; };
private: private:
//
// internal functions // internal functions
//
// Check whether the observer exists by the specified target and name.
bool observerExisted(CCObject *target,const char *name); bool observerExisted(CCObject *target,const char *name);
//
// variables // variables
// //
CCArray *m_observers; CCArray *m_observers;
int m_scriptHandler; int m_scriptHandler;
}; };
class CC_DLL CCNotificationObserver : public CCObject class CC_DLL CCNotificationObserver : public CCObject
{ {
public: public:
/** @brief CCNotificationObserver constructor
* @param target The target which wants to observer notification event
s.
* @param selector The callback function which will be invoked when th
e specified notification event was posted.
* @param name The name of this notification.
* @param obj The extra parameter which will be passed to the callback
function.
*/
CCNotificationObserver(CCObject *target, CCNotificationObserver(CCObject *target,
SEL_CallFuncO selector, SEL_CallFuncO selector,
const char *name, const char *name,
CCObject *obj); CCObject *obj);
/** CCNotificationObserver destructor function */
~CCNotificationObserver(); ~CCNotificationObserver();
/** Invokes the callback function of this observer */
void performSelector(CCObject *obj); void performSelector(CCObject *obj);
private: private:
CC_PROPERTY_READONLY(CCObject *, m_target, Target); CC_PROPERTY_READONLY(CCObject *, m_target, Target);
CC_PROPERTY_READONLY(SEL_CallFuncO, m_selector, Selector); CC_PROPERTY_READONLY(SEL_CallFuncO, m_selector, Selector);
CC_PROPERTY_READONLY(char *, m_name, Name); CC_PROPERTY_READONLY(char *, m_name, Name);
CC_PROPERTY_READONLY(CCObject *, m_object, Object); CC_PROPERTY_READONLY(CCObject *, m_object, Object);
}; };
NS_CC_END; NS_CC_END
#endif//__CCNOTIFICATIONCENTER_H__ #endif//__CCNOTIFICATIONCENTER_H__
 End of changes. 19 change blocks. 
5 lines changed or deleted 53 lines changed or added


 CCObject.h   CCObject.h 
skipping to change at line 58 skipping to change at line 58
class CC_DLL CCObject : public CCCopying class CC_DLL CCObject : public CCCopying
{ {
public: public:
// object id, CCScriptSupport need public m_uID // object id, CCScriptSupport need public m_uID
unsigned int m_uID; unsigned int m_uID;
// Lua reference id // Lua reference id
int m_nLuaID; int m_nLuaID;
protected: protected:
// count of references // count of references
unsigned int m_uReference; unsigned int m_uReference;
// is the object autoreleased // count of autorelease
bool m_bManaged; unsigned int m_uAutoReleaseCount;
public: public:
CCObject(void); CCObject(void);
virtual ~CCObject(void); virtual ~CCObject(void);
void release(void); void release(void);
void retain(void); void retain(void);
CCObject* autorelease(void); CCObject* autorelease(void);
CCObject* copy(void); CCObject* copy(void);
bool isSingleReference(void); bool isSingleReference(void);
unsigned int retainCount(void); unsigned int retainCount(void);
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 CCParticleExamples.h   CCParticleExamples.h 
skipping to change at line 46 skipping to change at line 46
*/ */
//! @brief A fire particle system //! @brief A fire particle system
class CC_DLL CCParticleFire : public CCParticleSystemQuad class CC_DLL CCParticleFire : public CCParticleSystemQuad
{ {
public: public:
CCParticleFire(){} CCParticleFire(){}
virtual ~CCParticleFire(){} virtual ~CCParticleFire(){}
bool init(){ return initWithTotalParticles(250); } bool init(){ return initWithTotalParticles(250); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFire * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleFire* node();
return create();
} static CCParticleFire* create();
static CCParticleFire * create()
{
CCParticleFire *pRet = new CCParticleFire();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A fireworks particle system //! @brief A fireworks particle system
class CC_DLL CCParticleFireworks : public CCParticleSystemQuad class CC_DLL CCParticleFireworks : public CCParticleSystemQuad
{ {
public: public:
CCParticleFireworks(){} CCParticleFireworks(){}
virtual ~CCParticleFireworks(){} virtual ~CCParticleFireworks(){}
bool init(){ return initWithTotalParticles(1500); } bool init(){ return initWithTotalParticles(1500); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFireworks * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleFireworks* node();
return create();
} static CCParticleFireworks* create();
static CCParticleFireworks * create()
{
CCParticleFireworks *pRet = new CCParticleFireworks();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A sun particle system //! @brief A sun particle system
class CC_DLL CCParticleSun : public CCParticleSystemQuad class CC_DLL CCParticleSun : public CCParticleSystemQuad
{ {
public: public:
CCParticleSun(){} CCParticleSun(){}
virtual ~CCParticleSun(){} virtual ~CCParticleSun(){}
bool init(){ return initWithTotalParticles(350); } bool init(){ return initWithTotalParticles(350); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSun * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleSun* node();
return create();
} static CCParticleSun* create();
static CCParticleSun * create()
{
CCParticleSun *pRet = new CCParticleSun();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A galaxy particle system //! @brief A galaxy particle system
class CC_DLL CCParticleGalaxy : public CCParticleSystemQuad class CC_DLL CCParticleGalaxy : public CCParticleSystemQuad
{ {
public: public:
CCParticleGalaxy(){} CCParticleGalaxy(){}
virtual ~CCParticleGalaxy(){} virtual ~CCParticleGalaxy(){}
bool init(){ return initWithTotalParticles(200); } bool init(){ return initWithTotalParticles(200); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleGalaxy * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleGalaxy* node();
return create();
} static CCParticleGalaxy* create();
static CCParticleGalaxy * create()
{
CCParticleGalaxy *pRet = new CCParticleGalaxy();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A flower particle system //! @brief A flower particle system
class CC_DLL CCParticleFlower : public CCParticleSystemQuad class CC_DLL CCParticleFlower : public CCParticleSystemQuad
{ {
public: public:
CCParticleFlower(){} CCParticleFlower(){}
virtual ~CCParticleFlower(){} virtual ~CCParticleFlower(){}
bool init(){ return initWithTotalParticles(250); } bool init(){ return initWithTotalParticles(250); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFlower * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleFlower* node();
return create();
} static CCParticleFlower* create();
static CCParticleFlower * create()
{
CCParticleFlower *pRet = new CCParticleFlower();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A meteor particle system //! @brief A meteor particle system
class CC_DLL CCParticleMeteor : public CCParticleSystemQuad class CC_DLL CCParticleMeteor : public CCParticleSystemQuad
{ {
public: public:
CCParticleMeteor(){} CCParticleMeteor(){}
virtual ~CCParticleMeteor(){} virtual ~CCParticleMeteor(){}
bool init(){ return initWithTotalParticles(150); } bool init(){ return initWithTotalParticles(150); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleMeteor * node() CC_DEPRECATED_ATTRIBUTE static CCParticleMeteor * node();
{ static CCParticleMeteor * create();
return create();
}
static CCParticleMeteor * create()
{
CCParticleMeteor *pRet = new CCParticleMeteor();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief An spiral particle system //! @brief An spiral particle system
class CC_DLL CCParticleSpiral : public CCParticleSystemQuad class CC_DLL CCParticleSpiral : public CCParticleSystemQuad
{ {
public: public:
CCParticleSpiral(){} CCParticleSpiral(){}
virtual ~CCParticleSpiral(){} virtual ~CCParticleSpiral(){}
bool init(){ return initWithTotalParticles(500); } bool init(){ return initWithTotalParticles(500); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSpiral * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleSpiral* node();
return create();
} static CCParticleSpiral* create();
static CCParticleSpiral * create()
{
CCParticleSpiral *pRet = new CCParticleSpiral();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief An explosion particle system //! @brief An explosion particle system
class CC_DLL CCParticleExplosion : public CCParticleSystemQuad class CC_DLL CCParticleExplosion : public CCParticleSystemQuad
{ {
public: public:
CCParticleExplosion(){} CCParticleExplosion(){}
virtual ~CCParticleExplosion(){} virtual ~CCParticleExplosion(){}
bool init(){ return initWithTotalParticles(700); } bool init(){ return initWithTotalParticles(700); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleExplosion * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleExplosion* node();
return create();
} static CCParticleExplosion* create();
static CCParticleExplosion * create()
{
CCParticleExplosion *pRet = new CCParticleExplosion();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief An smoke particle system //! @brief An smoke particle system
class CC_DLL CCParticleSmoke : public CCParticleSystemQuad class CC_DLL CCParticleSmoke : public CCParticleSystemQuad
{ {
public: public:
CCParticleSmoke(){} CCParticleSmoke(){}
virtual ~CCParticleSmoke(){} virtual ~CCParticleSmoke(){}
bool init(){ return initWithTotalParticles(200); } bool init(){ return initWithTotalParticles(200); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSmoke * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleSmoke* node();
return create();
} static CCParticleSmoke* create();
static CCParticleSmoke * create()
{
CCParticleSmoke *pRet = new CCParticleSmoke();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief An snow particle system //! @brief An snow particle system
class CC_DLL CCParticleSnow : public CCParticleSystemQuad class CC_DLL CCParticleSnow : public CCParticleSystemQuad
{ {
public: public:
CCParticleSnow(){} CCParticleSnow(){}
virtual ~CCParticleSnow(){} virtual ~CCParticleSnow(){}
bool init(){ return initWithTotalParticles(700); } bool init(){ return initWithTotalParticles(700); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSnow * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleSnow* node();
return create();
} static CCParticleSnow* create();
static CCParticleSnow * create()
{
CCParticleSnow *pRet = new CCParticleSnow();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
//! @brief A rain particle system //! @brief A rain particle system
class CC_DLL CCParticleRain : public CCParticleSystemQuad class CC_DLL CCParticleRain : public CCParticleSystemQuad
{ {
public: public:
CCParticleRain(){} CCParticleRain(){}
virtual ~CCParticleRain(){} virtual ~CCParticleRain(){}
bool init(){ return initWithTotalParticles(1000); } bool init(){ return initWithTotalParticles(1000); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles); virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleRain * node() //@deprecated: This interface will be deprecated sooner or later.
{ CC_DEPRECATED_ATTRIBUTE static CCParticleRain* node();
return create();
} static CCParticleRain* create();
static CCParticleRain * create()
{
CCParticleRain *pRet = new CCParticleRain();
if (pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}; };
// end of particle_nodes group // end of particle_nodes group
/// @} /// @}
NS_CC_END NS_CC_END
#endif //__CCPARTICLE_EXAMPLE_H__ #endif //__CCPARTICLE_EXAMPLE_H__
 End of changes. 11 change blocks. 
170 lines changed or deleted 42 lines changed or added


 CCPlatformDefine.h   CCPlatformDefine.h 
#ifndef __CCPLATFORMDEFINE_H__ #ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__ #define __CCPLATFORMDEFINE_H__
#include <assert.h> #include <assert.h>
#define CC_DLL #define CC_DLL
#if CC_DISABLE_ASSERT > 0
#define CC_ASSERT(cond)
#else
#define CC_ASSERT(cond) assert(cond) #define CC_ASSERT(cond) assert(cond)
#endif
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam #define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */ /* Define NULL pointer value */
#ifndef NULL #ifndef NULL
#ifdef __cplusplus #ifdef __cplusplus
#define NULL 0 #define NULL 0
#else #else
#define NULL ((void *)0) #define NULL ((void *)0)
#endif #endif
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 CCRenderTexture.h   CCRenderTexture.h 
skipping to change at line 150 skipping to change at line 150
/** Listen "come to background" message, and save render texture. /** Listen "come to background" message, and save render texture.
It only has effect on Android. It only has effect on Android.
*/ */
void listenToBackground(CCObject *obj); void listenToBackground(CCObject *obj);
protected: protected:
GLuint m_uFBO; GLuint m_uFBO;
GLuint m_uDepthRenderBufffer; GLuint m_uDepthRenderBufffer;
GLint m_nOldFBO; GLint m_nOldFBO;
CCTexture2D* m_pTexture; CCTexture2D* m_pTexture;
CCTexture2D* m_pTextureCopy; // a copy of m_pTexture
CCImage* m_pUITextureImage; CCImage* m_pUITextureImage;
GLenum m_ePixelFormat; GLenum m_ePixelFormat;
}; };
// end of textures group // end of textures group
/// @} /// @}
NS_CC_END NS_CC_END
#endif //__CCRENDER_TEXTURE_H__ #endif //__CCRENDER_TEXTURE_H__
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 CCTouch.h   CCTouch.h 
skipping to change at line 49 skipping to change at line 49
{ {
public: public:
CCTouch() CCTouch()
: m_nId(0) : m_nId(0)
{} {}
/** returns the current touch location in OpenGL coordinates */ /** returns the current touch location in OpenGL coordinates */
CCPoint getLocation() const; CCPoint getLocation() const;
/** returns the previous touch location in OpenGL coordinates */ /** returns the previous touch location in OpenGL coordinates */
CCPoint getPreviousLocation() const; CCPoint getPreviousLocation() const;
/** returns the current touch location in screen coordinates */ /** returns the delta of 2 current touches locations in screen coordina tes */
CCPoint getDelta() const; CCPoint getDelta() const;
/** returns the current touch location in screen coordinates */ /** returns the current touch location in screen coordinates */
CCPoint getLocationInView() const; CCPoint getLocationInView() const;
/** returns the previous touch location in screen coordinates */ /** returns the previous touch location in screen coordinates */
CCPoint getPreviousLocationInView() const; CCPoint getPreviousLocationInView() const;
/** returns the current touch location in screen coordinates /** returns the current touch location in screen coordinates
@deprecated: use CCTouch::getLocationInView() instead. @deprecated: use CCTouch::getLocationInView() instead.
CCTouch::getLocation() is recommended, it will return OpenGL coordinat e. CCTouch::getLocation() is recommended, it will return OpenGL coordinat e.
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 CCTransition.h   CCTransition.h 
skipping to change at line 44 skipping to change at line 44
/** /**
* @addtogroup transition * @addtogroup transition
* @{ * @{
*/ */
//static creation function macro //static creation function macro
//c/c++ don't support object creation of using class name //c/c++ don't support object creation of using class name
//so, all classes need creation method. //so, all classes need creation method.
#define OLD_TRANSITION_CREATE_FUNC(_Type) \
CC_DEPRECATED_ATTRIBUTE static _Type* transitionWithDuration(float t, C
CScene* scene) \
{ \
_Type* pScene = new _Type(); \
if(pScene && pScene->initWithDuration(t, scene)) \
{ \
pScene->autorelease(); \
return pScene; \
} \
CC_SAFE_DELETE(pScene); \
return NULL; \
}
#define TRANSITION_CREATE_FUNC(_Type) \
static _Type* create(float t, CCScene* scene) \
{ \
_Type* pScene = new _Type(); \
if(pScene && pScene->initWithDuration(t, scene)) \
{ \
pScene->autorelease(); \
return pScene; \
} \
CC_SAFE_DELETE(pScene); \
return NULL; \
}
class CCActionInterval; class CCActionInterval;
class CCNode; class CCNode;
/** @brief CCTransitionEaseScene can ease the actions of the scene protocol . /** @brief CCTransitionEaseScene can ease the actions of the scene protocol .
@since v0.8.2 @since v0.8.2
*/ */
class CC_DLL CCTransitionEaseScene// : public CCObject class CC_DLL CCTransitionEaseScene// : public CCObject
{ {
public: public:
/** returns the Ease action that will be performed on a linear action. /** returns the Ease action that will be performed on a linear action.
skipping to change at line 177 skipping to change at line 151
/** @brief CCTransitionRotoZoom: /** @brief CCTransitionRotoZoom:
Rotate and zoom out the outgoing scene, and then rotate and zoom in the inc oming Rotate and zoom out the outgoing scene, and then rotate and zoom in the inc oming
*/ */
class CC_DLL CCTransitionRotoZoom : public CCTransitionScene class CC_DLL CCTransitionRotoZoom : public CCTransitionScene
{ {
public: public:
CCTransitionRotoZoom(); CCTransitionRotoZoom();
virtual ~CCTransitionRotoZoom(); virtual ~CCTransitionRotoZoom();
virtual void onEnter(); virtual void onEnter();
TRANSITION_CREATE_FUNC(CCTransitionRotoZoom); CC_DEPRECATED_ATTRIBUTE static CCTransitionRotoZoom* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionRotoZoom); tion(float t, CCScene* scene);
static CCTransitionRotoZoom* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionJumpZoom: /** @brief CCTransitionJumpZoom:
Zoom out and jump the outgoing scene, and then jump and zoom in the incomin g Zoom out and jump the outgoing scene, and then jump and zoom in the incomin g
*/ */
class CC_DLL CCTransitionJumpZoom : public CCTransitionScene class CC_DLL CCTransitionJumpZoom : public CCTransitionScene
{ {
public: public:
CCTransitionJumpZoom(); CCTransitionJumpZoom();
virtual ~CCTransitionJumpZoom(); virtual ~CCTransitionJumpZoom();
virtual void onEnter(); virtual void onEnter();
TRANSITION_CREATE_FUNC(CCTransitionJumpZoom); CC_DEPRECATED_ATTRIBUTE static CCTransitionJumpZoom* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionJumpZoom); tion(float t, CCScene* scene);
static CCTransitionJumpZoom* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionMoveInL: /** @brief CCTransitionMoveInL:
Move in from to the left the incoming scene. Move in from to the left the incoming scene.
*/ */
class CC_DLL CCTransitionMoveInL : public CCTransitionScene, public CCTrans itionEaseScene class CC_DLL CCTransitionMoveInL : public CCTransitionScene, public CCTrans itionEaseScene
{ {
public: public:
CCTransitionMoveInL(); CCTransitionMoveInL();
virtual ~CCTransitionMoveInL(); virtual ~CCTransitionMoveInL();
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
/** returns the action that will be performed */ /** returns the action that will be performed */
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n); virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n);
virtual void onEnter(); virtual void onEnter();
TRANSITION_CREATE_FUNC(CCTransitionMoveInL); CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInL* transitionWithDurat
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInL); ion(float t, CCScene* scene);
static CCTransitionMoveInL* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionMoveInR: /** @brief CCTransitionMoveInR:
Move in from to the right the incoming scene. Move in from to the right the incoming scene.
*/ */
class CC_DLL CCTransitionMoveInR : public CCTransitionMoveInL class CC_DLL CCTransitionMoveInR : public CCTransitionMoveInL
{ {
public: public:
CCTransitionMoveInR(); CCTransitionMoveInR();
virtual ~CCTransitionMoveInR(); virtual ~CCTransitionMoveInR();
virtual void initScenes(); virtual void initScenes();
TRANSITION_CREATE_FUNC(CCTransitionMoveInR); CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInR* transitionWithDurat
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInR); ion(float t, CCScene* scene);
static CCTransitionMoveInR* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionMoveInT: /** @brief CCTransitionMoveInT:
Move in from to the top the incoming scene. Move in from to the top the incoming scene.
*/ */
class CC_DLL CCTransitionMoveInT : public CCTransitionMoveInL class CC_DLL CCTransitionMoveInT : public CCTransitionMoveInL
{ {
public: public:
CCTransitionMoveInT(); CCTransitionMoveInT();
virtual ~CCTransitionMoveInT(); virtual ~CCTransitionMoveInT();
virtual void initScenes(); virtual void initScenes();
TRANSITION_CREATE_FUNC(CCTransitionMoveInT); CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInT* transitionWithDurat
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInT); ion(float t, CCScene* scene);
static CCTransitionMoveInT* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionMoveInB: /** @brief CCTransitionMoveInB:
Move in from to the bottom the incoming scene. Move in from to the bottom the incoming scene.
*/ */
class CC_DLL CCTransitionMoveInB : public CCTransitionMoveInL class CC_DLL CCTransitionMoveInB : public CCTransitionMoveInL
{ {
public: public:
CCTransitionMoveInB(); CCTransitionMoveInB();
virtual ~CCTransitionMoveInB(); virtual ~CCTransitionMoveInB();
virtual void initScenes(); virtual void initScenes();
TRANSITION_CREATE_FUNC(CCTransitionMoveInB); CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInB* transitionWithDurat
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInB); ion(float t, CCScene* scene);
static CCTransitionMoveInB* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionSlideInL: /** @brief CCTransitionSlideInL:
Slide in the incoming scene from the left border. Slide in the incoming scene from the left border.
*/ */
class CC_DLL CCTransitionSlideInL : public CCTransitionScene, public CCTran sitionEaseScene class CC_DLL CCTransitionSlideInL : public CCTransitionScene, public CCTran sitionEaseScene
{ {
public: public:
CCTransitionSlideInL(); CCTransitionSlideInL();
virtual ~CCTransitionSlideInL(); virtual ~CCTransitionSlideInL();
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
/** returns the action that will be performed by the incoming and outgo ing scene */ /** returns the action that will be performed by the incoming and outgo ing scene */
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n); virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n);
TRANSITION_CREATE_FUNC(CCTransitionSlideInL); CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInL* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInL); tion(float t, CCScene* scene);
static CCTransitionSlideInL* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** @brief CCTransitionSlideInR: /** @brief CCTransitionSlideInR:
Slide in the incoming scene from the right border. Slide in the incoming scene from the right border.
*/ */
class CC_DLL CCTransitionSlideInR : public CCTransitionSlideInL class CC_DLL CCTransitionSlideInR : public CCTransitionSlideInL
{ {
public: public:
CCTransitionSlideInR(); CCTransitionSlideInR();
virtual ~CCTransitionSlideInR(); virtual ~CCTransitionSlideInR();
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
/** returns the action that will be performed by the incoming and outgo ing scene */ /** returns the action that will be performed by the incoming and outgo ing scene */
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInR); CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInR* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInR); tion(float t, CCScene* scene);
static CCTransitionSlideInR* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** @brief CCTransitionSlideInB: /** @brief CCTransitionSlideInB:
Slide in the incoming scene from the bottom border. Slide in the incoming scene from the bottom border.
*/ */
class CC_DLL CCTransitionSlideInB : public CCTransitionSlideInL class CC_DLL CCTransitionSlideInB : public CCTransitionSlideInL
{ {
public: public:
CCTransitionSlideInB(); CCTransitionSlideInB();
virtual ~CCTransitionSlideInB(); virtual ~CCTransitionSlideInB();
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
/** returns the action that will be performed by the incoming and outgo ing scene */ /** returns the action that will be performed by the incoming and outgo ing scene */
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInB); CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInB* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInB); tion(float t, CCScene* scene);
static CCTransitionSlideInB* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** @brief CCTransitionSlideInT: /** @brief CCTransitionSlideInT:
Slide in the incoming scene from the top border. Slide in the incoming scene from the top border.
*/ */
class CC_DLL CCTransitionSlideInT : public CCTransitionSlideInL class CC_DLL CCTransitionSlideInT : public CCTransitionSlideInL
{ {
public: public:
CCTransitionSlideInT(); CCTransitionSlideInT();
virtual ~CCTransitionSlideInT(); virtual ~CCTransitionSlideInT();
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
/** returns the action that will be performed by the incoming and outgo ing scene */ /** returns the action that will be performed by the incoming and outgo ing scene */
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInT); CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInT* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInT); tion(float t, CCScene* scene);
static CCTransitionSlideInT* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** /**
@brief Shrink the outgoing scene while grow the incoming scene @brief Shrink the outgoing scene while grow the incoming scene
*/ */
class CC_DLL CCTransitionShrinkGrow : public CCTransitionScene , public CCT ransitionEaseScene class CC_DLL CCTransitionShrinkGrow : public CCTransitionScene , public CCT ransitionEaseScene
{ {
public: public:
CCTransitionShrinkGrow(); CCTransitionShrinkGrow();
virtual ~CCTransitionShrinkGrow(); virtual ~CCTransitionShrinkGrow();
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n); virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n);
TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow); CC_DEPRECATED_ATTRIBUTE static CCTransitionShrinkGrow* transitionWithDu
OLD_TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow); ration(float t, CCScene* scene);
static CCTransitionShrinkGrow* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionFlipX: /** @brief CCTransitionFlipX:
Flips the screen horizontally. Flips the screen horizontally.
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionFlipX : public CCTransitionSceneOriented class CC_DLL CCTransitionFlipX : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionFlipX(); CCTransitionFlipX();
virtual ~CCTransitionFlipX(); virtual ~CCTransitionFlipX();
virtual void onEnter(); virtual void onEnter();
// @deprecated: This interface will be deprecated sooner or later. // @deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipX* transitionWithDuratio n(float t, CCScene* s, tOrientation o = kOrientationRightOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipX* transitionWithDuratio n(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipX* create(float t, CCScene* s, tOrientation o); static CCTransitionFlipX* create(float t, CCScene* s, tOrientation o);
static CCTransitionFlipX* create(float t, CCScene* s) { static CCTransitionFlipX* create(float t, CCScene* s);
return CCTransitionFlipX::create(t, s, kOrientationRightOver);
}
}; };
/** @brief CCTransitionFlipY: /** @brief CCTransitionFlipY:
Flips the screen vertically. Flips the screen vertically.
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionFlipY : public CCTransitionSceneOriented class CC_DLL CCTransitionFlipY : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionFlipY(); CCTransitionFlipY();
virtual ~CCTransitionFlipY(); virtual ~CCTransitionFlipY();
virtual void onEnter(); virtual void onEnter();
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipY* transitionWithDuratio n(float t, CCScene* s, tOrientation o = kOrientationUpOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipY* transitionWithDuratio n(float t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionFlipY* create(float t, CCScene* s, tOrientation o); static CCTransitionFlipY* create(float t, CCScene* s, tOrientation o);
static CCTransitionFlipY* create(float t, CCScene* s) { static CCTransitionFlipY* create(float t, CCScene* s);
return CCTransitionFlipY::create(t, s, kOrientationUpOver);
}
}; };
/** @brief CCTransitionFlipAngular: /** @brief CCTransitionFlipAngular:
Flips the screen half horizontally and half vertically. Flips the screen half horizontally and half vertically.
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionFlipAngular : public CCTransitionSceneOriented class CC_DLL CCTransitionFlipAngular : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionFlipAngular(); CCTransitionFlipAngular();
virtual ~CCTransitionFlipAngular(); virtual ~CCTransitionFlipAngular();
virtual void onEnter(); virtual void onEnter();
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipAngular* transitionWithD uration(float t, CCScene* s, tOrientation o = kOrientationRightOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipAngular* transitionWithD uration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientatio n o); static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientatio n o);
static CCTransitionFlipAngular* create(float t, CCScene* s) { static CCTransitionFlipAngular* create(float t, CCScene* s);
return CCTransitionFlipAngular::create(t, s, kOrientationRightOver);
}
}; };
/** @brief CCTransitionZoomFlipX: /** @brief CCTransitionZoomFlipX:
Flips the screen horizontally doing a zoom out/in Flips the screen horizontally doing a zoom out/in
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionZoomFlipX : public CCTransitionSceneOriented class CC_DLL CCTransitionZoomFlipX : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionZoomFlipX(); CCTransitionZoomFlipX();
virtual ~CCTransitionZoomFlipX(); virtual ~CCTransitionZoomFlipX();
virtual void onEnter(); virtual void onEnter();
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipX* transitionWithDur ation(float t, CCScene* s, tOrientation o = kOrientationRightOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipX* transitionWithDur ation(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation o); static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation o);
static CCTransitionZoomFlipX* create(float t, CCScene* s) { static CCTransitionZoomFlipX* create(float t, CCScene* s);
return CCTransitionZoomFlipX::create(t, s, kOrientationRightOver);
}
}; };
/** @brief CCTransitionZoomFlipY: /** @brief CCTransitionZoomFlipY:
Flips the screen vertically doing a little zooming out/in Flips the screen vertically doing a little zooming out/in
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionZoomFlipY : public CCTransitionSceneOriented class CC_DLL CCTransitionZoomFlipY : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionZoomFlipY(); CCTransitionZoomFlipY();
virtual ~CCTransitionZoomFlipY(); virtual ~CCTransitionZoomFlipY();
virtual void onEnter(); virtual void onEnter();
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipY* transitionWithDur ation(float t, CCScene* s, tOrientation o = kOrientationUpOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipY* transitionWithDur ation(float t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation o); static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation o);
static CCTransitionZoomFlipY* create(float t, CCScene* s) { static CCTransitionZoomFlipY* create(float t, CCScene* s);
return CCTransitionZoomFlipY::create(t, s, kOrientationUpOver);
}
}; };
/** @brief CCTransitionZoomFlipAngular: /** @brief CCTransitionZoomFlipAngular:
Flips the screen half horizontally and half vertically doing a little zoomi ng out/in. Flips the screen half horizontally and half vertically doing a little zoomi ng out/in.
The front face is the outgoing scene and the back face is the incoming scen e. The front face is the outgoing scene and the back face is the incoming scen e.
*/ */
class CC_DLL CCTransitionZoomFlipAngular : public CCTransitionSceneOriented class CC_DLL CCTransitionZoomFlipAngular : public CCTransitionSceneOriented
{ {
public: public:
CCTransitionZoomFlipAngular(); CCTransitionZoomFlipAngular();
virtual ~CCTransitionZoomFlipAngular(); virtual ~CCTransitionZoomFlipAngular();
virtual void onEnter(); virtual void onEnter();
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipAngular* transitionW ithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver); CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipAngular* transitionW ithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrient ation o); static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrient ation o);
static CCTransitionZoomFlipAngular* create(float t, CCScene* s) { static CCTransitionZoomFlipAngular* create(float t, CCScene* s);
return CCTransitionZoomFlipAngular::create(t, s, kOrientationRightOv
er);
}
}; };
/** @brief CCTransitionFade: /** @brief CCTransitionFade:
Fade out the outgoing scene and then fade in the incoming scene.''' Fade out the outgoing scene and then fade in the incoming scene.'''
*/ */
class CC_DLL CCTransitionFade : public CCTransitionScene class CC_DLL CCTransitionFade : public CCTransitionScene
{ {
protected: protected:
ccColor4B m_tColor; ccColor4B m_tColor;
skipping to change at line 501 skipping to change at line 463
/** creates the transition with a duration and with an RGB color /** creates the transition with a duration and with an RGB color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0, 0); // red color * Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0, 0); // red color
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCTransitionFade* transitionWithDuration (float duration,CCScene* scene, const ccColor3B& color = ccBLACK); CC_DEPRECATED_ATTRIBUTE static CCTransitionFade* transitionWithDuration (float duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** creates the transition with a duration and with an RGB color /** creates the transition with a duration and with an RGB color
* Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color * Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color
*/ */
static CCTransitionFade* create(float duration,CCScene* scene, const cc Color3B& color); static CCTransitionFade* create(float duration,CCScene* scene, const cc Color3B& color);
static CCTransitionFade* create(float duration,CCScene* scene) { static CCTransitionFade* create(float duration,CCScene* scene);
return CCTransitionFade::create(duration, scene, ccBLACK);
}
/** initializes the transition with a duration and with an RGB color */ /** initializes the transition with a duration and with an RGB color */
virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color); virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color);
virtual bool initWithDuration(float t,CCScene* scene); virtual bool initWithDuration(float t,CCScene* scene);
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
}; };
class CCRenderTexture; class CCRenderTexture;
skipping to change at line 529 skipping to change at line 489
{ {
public : public :
CCTransitionCrossFade(); CCTransitionCrossFade();
virtual ~CCTransitionCrossFade(); virtual ~CCTransitionCrossFade();
virtual void draw(); virtual void draw();
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
public: public:
TRANSITION_CREATE_FUNC(CCTransitionCrossFade); CC_DEPRECATED_ATTRIBUTE static CCTransitionCrossFade* transitionWithDur
OLD_TRANSITION_CREATE_FUNC(CCTransitionCrossFade); ation(float t, CCScene* scene);
static CCTransitionCrossFade* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionTurnOffTiles: /** @brief CCTransitionTurnOffTiles:
Turn off the tiles of the outgoing scene in random order Turn off the tiles of the outgoing scene in random order
*/ */
class CC_DLL CCTransitionTurnOffTiles : public CCTransitionScene ,public CC TransitionEaseScene class CC_DLL CCTransitionTurnOffTiles : public CCTransitionScene ,public CC TransitionEaseScene
{ {
public : public :
CCTransitionTurnOffTiles(); CCTransitionTurnOffTiles();
virtual ~CCTransitionTurnOffTiles(); virtual ~CCTransitionTurnOffTiles();
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval * easeActionWithAction(CCActionInterval * acti on); virtual CCActionInterval * easeActionWithAction(CCActionInterval * acti on);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles); CC_DEPRECATED_ATTRIBUTE static CCTransitionTurnOffTiles* transitionWith
OLD_TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles); Duration(float t, CCScene* scene);
static CCTransitionTurnOffTiles* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** @brief CCTransitionSplitCols: /** @brief CCTransitionSplitCols:
The odd columns goes upwards while the even columns goes downwards. The odd columns goes upwards while the even columns goes downwards.
*/ */
class CC_DLL CCTransitionSplitCols : public CCTransitionScene , public CCTr ansitionEaseScene class CC_DLL CCTransitionSplitCols : public CCTransitionScene , public CCTr ansitionEaseScene
{ {
public: public:
CCTransitionSplitCols(); CCTransitionSplitCols();
virtual ~CCTransitionSplitCols(); virtual ~CCTransitionSplitCols();
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval * easeActionWithAction(CCActionInterval * acti on); virtual CCActionInterval * easeActionWithAction(CCActionInterval * acti on);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionSplitCols); CC_DEPRECATED_ATTRIBUTE static CCTransitionSplitCols* transitionWithDur
OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitCols); ation(float t, CCScene* scene);
static CCTransitionSplitCols* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionSplitRows: /** @brief CCTransitionSplitRows:
The odd rows goes to the left while the even rows goes to the right. The odd rows goes to the left while the even rows goes to the right.
*/ */
class CC_DLL CCTransitionSplitRows : public CCTransitionSplitCols class CC_DLL CCTransitionSplitRows : public CCTransitionSplitCols
{ {
public: public:
CCTransitionSplitRows(); CCTransitionSplitRows();
virtual ~CCTransitionSplitRows(); virtual ~CCTransitionSplitRows();
virtual CCActionInterval* action(void); virtual CCActionInterval* action(void);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionSplitRows) CC_DEPRECATED_ATTRIBUTE static CCTransitionSplitRows* transitionWithDur
OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitRows) ation(float t, CCScene* scene);
static CCTransitionSplitRows* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionFadeTR: /** @brief CCTransitionFadeTR:
Fade the tiles of the outgoing scene from the left-bottom corner the to top -right corner. Fade the tiles of the outgoing scene from the left-bottom corner the to top -right corner.
*/ */
class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTrans itionEaseScene class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTrans itionEaseScene
{ {
public: public:
CCTransitionFadeTR(); CCTransitionFadeTR();
virtual ~CCTransitionFadeTR(); virtual ~CCTransitionFadeTR();
virtual CCActionInterval* actionWithSize(const ccGridSize& size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual void onEnter(); virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n); virtual CCActionInterval* easeActionWithAction(CCActionInterval * actio n);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionFadeTR) CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeTR* transitionWithDurati
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeTR) on(float t, CCScene* scene);
static CCTransitionFadeTR* create(float t, CCScene* scene);
protected: protected:
virtual void sceneOrder(); virtual void sceneOrder();
}; };
/** @brief CCTransitionFadeBL: /** @brief CCTransitionFadeBL:
Fade the tiles of the outgoing scene from the top-right corner to the botto m-left corner. Fade the tiles of the outgoing scene from the top-right corner to the botto m-left corner.
*/ */
class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR
{ {
public: public:
CCTransitionFadeBL(); CCTransitionFadeBL();
virtual ~CCTransitionFadeBL(); virtual ~CCTransitionFadeBL();
virtual CCActionInterval* actionWithSize(const ccGridSize& size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionFadeBL) CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeBL* transitionWithDurati
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeBL) on(float t, CCScene* scene);
static CCTransitionFadeBL* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionFadeUp: /** @brief CCTransitionFadeUp:
* Fade the tiles of the outgoing scene from the bottom to the top. * Fade the tiles of the outgoing scene from the bottom to the top.
*/ */
class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR
{ {
public: public:
CCTransitionFadeUp(); CCTransitionFadeUp();
virtual ~CCTransitionFadeUp(); virtual ~CCTransitionFadeUp();
virtual CCActionInterval* actionWithSize(const ccGridSize& size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionFadeUp) CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeUp* transitionWithDurati
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeUp) on(float t, CCScene* scene);
static CCTransitionFadeUp* create(float t, CCScene* scene);
}; };
/** @brief CCTransitionFadeDown: /** @brief CCTransitionFadeDown:
* Fade the tiles of the outgoing scene from the top to the bottom. * Fade the tiles of the outgoing scene from the top to the bottom.
*/ */
class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR
{ {
public: public:
CCTransitionFadeDown(); CCTransitionFadeDown();
virtual ~CCTransitionFadeDown(); virtual ~CCTransitionFadeDown();
virtual CCActionInterval* actionWithSize(const ccGridSize& size); virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public: public:
TRANSITION_CREATE_FUNC(CCTransitionFadeDown) CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeDown* transitionWithDura
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeDown) tion(float t, CCScene* scene);
static CCTransitionFadeDown* create(float t, CCScene* scene);
}; };
// end of transition group // end of transition group
/// @} /// @}
NS_CC_END NS_CC_END
#endif // __CCTRANSITION_H__ #endif // __CCTRANSITION_H__
 End of changes. 28 change blocks. 
88 lines changed or deleted 64 lines changed or added


 CCTransitionProgress.h   CCTransitionProgress.h 
skipping to change at line 45 skipping to change at line 45
class CCRenderTexture; class CCRenderTexture;
/** /**
* @addtogroup transition * @addtogroup transition
* @{ * @{
*/ */
class CC_DLL CCTransitionProgress : public CCTransitionScene class CC_DLL CCTransitionProgress : public CCTransitionScene
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgress) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgress* transitionWithDura
TRANSITION_CREATE_FUNC(CCTransitionProgress) tion(float t, CCScene* scene);
static CCTransitionProgress* create(float t, CCScene* scene);
CCTransitionProgress(); CCTransitionProgress();
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
virtual void setupTransition(); virtual void setupTransition();
virtual void sceneOrder(); virtual void sceneOrder();
float m_fTo; float m_fTo;
float m_fFrom; float m_fFrom;
CCScene* m_pSceneToBeModified; CCScene* m_pSceneToBeModified;
}; };
/** CCTransitionRadialCCW transition. /** CCTransitionRadialCCW transition.
A counter clock-wise radial transition to the next scene A counter clock-wise radial transition to the next scene
*/ */
class CC_DLL CCTransitionProgressRadialCCW : public CCTransitionProgress class CC_DLL CCTransitionProgressRadialCCW : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressRadialCCW* transitio
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) nWithDuration(float t, CCScene* scene);
static CCTransitionProgressRadialCCW* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
}; };
/** CCTransitionRadialCW transition. /** CCTransitionRadialCW transition.
A counter clock-wise radial transition to the next scene A counter clock-wise radial transition to the next scene
*/ */
class CC_DLL CCTransitionProgressRadialCW : public CCTransitionProgress class CC_DLL CCTransitionProgressRadialCW : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressRadialCW* transition
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) WithDuration(float t, CCScene* scene);
static CCTransitionProgressRadialCW* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
}; };
/** CCTransitionProgressHorizontal transition. /** CCTransitionProgressHorizontal transition.
A clock-wise radial transition to the next scene A clock-wise radial transition to the next scene
*/ */
class CC_DLL CCTransitionProgressHorizontal : public CCTransitionProgress class CC_DLL CCTransitionProgressHorizontal : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressHorizontal* transiti
TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) onWithDuration(float t, CCScene* scene);
static CCTransitionProgressHorizontal* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
}; };
class CC_DLL CCTransitionProgressVertical : public CCTransitionProgress class CC_DLL CCTransitionProgressVertical : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressVertical) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressVertical* transition
TRANSITION_CREATE_FUNC(CCTransitionProgressVertical) WithDuration(float t, CCScene* scene);
static CCTransitionProgressVertical* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
}; };
class CC_DLL CCTransitionProgressInOut : public CCTransitionProgress class CC_DLL CCTransitionProgressInOut : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressInOut) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressInOut* transitionWit
TRANSITION_CREATE_FUNC(CCTransitionProgressInOut) hDuration(float t, CCScene* scene);
static CCTransitionProgressInOut* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
virtual void sceneOrder(); virtual void sceneOrder();
virtual void setupTransition(); virtual void setupTransition();
}; };
class CC_DLL CCTransitionProgressOutIn : public CCTransitionProgress class CC_DLL CCTransitionProgressOutIn : public CCTransitionProgress
{ {
public: public:
OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressOutIn) CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressOutIn* transitionWit
TRANSITION_CREATE_FUNC(CCTransitionProgressOutIn) hDuration(float t, CCScene* scene);
static CCTransitionProgressOutIn* create(float t, CCScene* scene);
protected: protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture);
}; };
// end of transition group // end of transition group
/// @} /// @}
NS_CC_END NS_CC_END
 End of changes. 7 change blocks. 
14 lines changed or deleted 21 lines changed or added


 DOCBparser.h   DOCBparser.h 
skipping to change at line 45 skipping to change at line 45
typedef xmlSAXHandler docbSAXHandler; typedef xmlSAXHandler docbSAXHandler;
typedef xmlSAXHandlerPtr docbSAXHandlerPtr; typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
typedef xmlParserInput docbParserInput; typedef xmlParserInput docbParserInput;
typedef xmlParserInputPtr docbParserInputPtr; typedef xmlParserInputPtr docbParserInputPtr;
typedef xmlDocPtr docbDocPtr; typedef xmlDocPtr docbDocPtr;
/* /*
* There is only few public functions. * There is only few public functions.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
docbEncodeEntities(unsigned char *out, docbEncodeEntities(unsigned char *out,
int *outlen, int *outlen,
const unsigned char *in, const unsigned char *in,
int *inlen, int quoteChar); int *inlen, int quoteChar);
XMLPUBFUN docbDocPtr XMLCALL XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseDoc (xmlChar *cur, docbSAXParseDoc (xmlChar *cur,
const char *encoding, const char *encoding,
docbSAXHandlerPtr sax, docbSAXHandlerPtr sax,
void *userData); void *userData);
XMLPUBFUN docbDocPtr XMLCALL XMLPUBFUN docbDocPtr XMLCALL
docbParseDoc (xmlChar *cur, docbParseDoc (xmlChar *cur,
const char *encoding); const char *encoding);
XMLPUBFUN docbDocPtr XMLCALL XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseFile (const char *filename, docbSAXParseFile (const char *filename,
const char *encoding, const char *encoding,
docbSAXHandlerPtr sax, docbSAXHandlerPtr sax,
void *userData); void *userData);
XMLPUBFUN docbDocPtr XMLCALL XMLPUBFUN docbDocPtr XMLCALL
docbParseFile (const char *filename, docbParseFile (const char *filename,
const char *encoding); const char *encoding);
/** /**
* Interfaces for the Push mode. * Interfaces for the Push mode.
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
docbFreeParserCtxt (docbParserCtxtPtr ctxt); docbFreeParserCtxt (docbParserCtxtPtr ctxt);
XMLPUBFUN docbParserCtxtPtr XMLCALL XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreatePushParserCtxt(docbSAXHandlerPtr sax, docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
void *user_data, void *user_data,
const char *chunk, const char *chunk,
int size, int size,
const char *filename, const char *filename,
xmlCharEncoding enc); xmlCharEncoding enc);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
docbParseChunk (docbParserCtxtPtr ctxt, docbParseChunk (docbParserCtxtPtr ctxt,
const char *chunk, const char *chunk,
int size, int size,
int terminate); int terminate);
XMLPUBFUN docbParserCtxtPtr XMLCALL XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreateFileParserCtxt(const char *filename, docbCreateFileParserCtxt(const char *filename,
const char *encoding); const char *encoding);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
docbParseDocument (docbParserCtxtPtr ctxt); docbParseDocument (docbParserCtxtPtr ctxt);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_DOCB_ENABLED */ #endif /* LIBXML_DOCB_ENABLED */
#endif /* __DOCB_PARSER_H__ */ #endif /* __DOCB_PARSER_H__ */
 End of changes. 10 change blocks. 
10 lines changed or deleted 10 lines changed or added


 FloatingPoint.h   FloatingPoint.h 
skipping to change at line 229 skipping to change at line 229
/** Computes the smallest non-zero positive double value. */ /** Computes the smallest non-zero positive double value. */
static MOZ_ALWAYS_INLINE double static MOZ_ALWAYS_INLINE double
MOZ_DOUBLE_MIN_VALUE() MOZ_DOUBLE_MIN_VALUE()
{ {
union MozDoublePun pun; union MozDoublePun pun;
pun.u = 1; pun.u = 1;
return pun.d; return pun.d;
} }
/** Computes a 32-bit hash of the given double. */
static MOZ_ALWAYS_INLINE uint32_t
MOZ_HASH_DOUBLE(double d)
{
union MozDoublePun pun;
pun.d = d;
return ((uint32_t)(pun.u >> 32)) ^ ((uint32_t)(pun.u));
}
static MOZ_ALWAYS_INLINE int static MOZ_ALWAYS_INLINE int
MOZ_DOUBLE_IS_INT32(double d, int32_t* i) MOZ_DOUBLE_IS_INT32(double d, int32_t* i)
{ {
/* /*
* XXX Casting a double that doesn't truncate to int32_t, to int32_t, ind uces * XXX Casting a double that doesn't truncate to int32_t, to int32_t, ind uces
* undefined behavior. We should definitely fix this (bug 744965), b ut as * undefined behavior. We should definitely fix this (bug 744965), b ut as
* apparently it "works" in practice, it's not a pressing concern now . * apparently it "works" in practice, it's not a pressing concern now .
*/ */
return !MOZ_DOUBLE_IS_NEGATIVE_ZERO(d) && d == (*i = (int32_t)d); return !MOZ_DOUBLE_IS_NEGATIVE_ZERO(d) && d == (*i = (int32_t)d);
} }
 End of changes. 1 change blocks. 
10 lines changed or deleted 0 lines changed or added


 GuardObjects.h   GuardObjects.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- */ - */
/* vim: set ts=8 sw=4 et tw=99 ft=cpp: */ /* This Source Code Form is subject to the terms of the Mozilla Public
/* ***** BEGIN LICENSE BLOCK ***** * License, v. 2.0. If a copy of the MPL was not distributed with this
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation (original auth
or)
* Ms2ger <ms2ger@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Implementation of macros to ensure correct use of RAII Auto* objects. */ /* Implementation of macros to ensure correct use of RAII Auto* objects. */
#ifndef mozilla_GuardObjects_h #ifndef mozilla_GuardObjects_h
#define mozilla_GuardObjects_h #define mozilla_GuardObjects_h
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Types.h" #include "mozilla/Types.h"
#ifdef __cplusplus #ifdef __cplusplus
#ifdef DEBUG #ifdef DEBUG
namespace mozilla { namespace mozilla {
namespace detail { namespace detail {
/* /*
* The following classes are designed to cause assertions to detect * The following classes are designed to cause assertions to detect
* inadvertent use of guard objects as temporaries. In other words, * inadvertent use of guard objects as temporaries. In other words,
* when we have a guard object whose only purpose is its constructor and * when we have a guard object whose only purpose is its constructor and
* destructor (and is never otherwise referenced), the intended use * destructor (and is never otherwise referenced), the intended use
* might be: * might be:
* *
* AutoRestore savePainting(mIsPainting); * AutoRestore savePainting(mIsPainting);
* *
* but is is easy to accidentally write: * but is is easy to accidentally write:
* *
* AutoRestore(mIsPainting); * AutoRestore(mIsPainting);
* *
* which compiles just fine, but runs the destructor well before the * which compiles just fine, but runs the destructor well before the
* intended time. * intended time.
* *
* They work by adding (#ifdef DEBUG) an additional parameter to the * They work by adding (#ifdef DEBUG) an additional parameter to the
* guard object's constructor, with a default value, so that users of * guard object's constructor, with a default value, so that users of
* the guard object's API do not need to do anything. The default value * the guard object's API do not need to do anything. The default value
* of this parameter is a temporary object. C++ (ISO/IEC 14882:1998), * of this parameter is a temporary object. C++ (ISO/IEC 14882:1998),
* section 12.2 [class.temporary], clauses 4 and 5 seem to assume a * section 12.2 [class.temporary], clauses 4 and 5 seem to assume a
* guarantee that temporaries are destroyed in the reverse of their * guarantee that temporaries are destroyed in the reverse of their
skipping to change at line 109 skipping to change at line 75
* *
* For more details, and examples of using these macros, see * For more details, and examples of using these macros, see
* https://developer.mozilla.org/en/Using_RAII_classes_in_Mozilla * https://developer.mozilla.org/en/Using_RAII_classes_in_Mozilla
*/ */
class MOZ_EXPORT_API(GuardObjectNotifier) class MOZ_EXPORT_API(GuardObjectNotifier)
{ {
private: private:
bool* statementDone; bool* statementDone;
public: public:
GuardObjectNotifier() : statementDone(NULL) {} GuardObjectNotifier() : statementDone(NULL) { }
~GuardObjectNotifier() { ~GuardObjectNotifier() {
*statementDone = true; *statementDone = true;
} }
void setStatementDone(bool* statementIsDone) { void setStatementDone(bool* statementIsDone) {
statementDone = statementIsDone; statementDone = statementIsDone;
} }
}; };
class MOZ_EXPORT_API(GuardObjectNotificationReceiver) class MOZ_EXPORT_API(GuardObjectNotificationReceiver)
{ {
private: private:
bool statementDone; bool statementDone;
public: public:
GuardObjectNotificationReceiver() : statementDone(false) {} GuardObjectNotificationReceiver() : statementDone(false) { }
~GuardObjectNotificationReceiver() { ~GuardObjectNotificationReceiver() {
/* /*
* Assert that the guard object was not used as a temporary. * Assert that the guard object was not used as a temporary. (Note t
* (Note that this assert might also fire if init is not called hat
* because the guard object's implementation is not using the * this assert might also fire if init is not called because the guar
* above macros correctly.) d
*/ * object's implementation is not using the above macros correctly.)
MOZ_ASSERT(statementDone); */
MOZ_ASSERT(statementDone);
} }
void init(const GuardObjectNotifier& constNotifier) { void init(const GuardObjectNotifier& constNotifier) {
/* /*
* constNotifier is passed as a const reference so that we can pass * constNotifier is passed as a const reference so that we can pass a
a * temporary, but we really intend it as non-const.
* temporary, but we really intend it as non-const. */
*/ GuardObjectNotifier& notifier = const_cast<GuardObjectNotifier&>(cons
GuardObjectNotifier& notifier = const_cast<GuardObjectNotifier&>(co tNotifier);
nstNotifier); notifier.setStatementDone(&statementDone);
notifier.setStatementDone(&statementDone);
} }
}; };
} /* namespace detail */ } /* namespace detail */
} /* namespace mozilla */ } /* namespace mozilla */
#endif /* DEBUG */ #endif /* DEBUG */
#ifdef DEBUG #ifdef DEBUG
# define MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER \ # define MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER \
 End of changes. 10 change blocks. 
70 lines changed or deleted 27 lines changed or added


 HashFunctions.h   HashFunctions.h 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* This Source Code Form is subject to the terms of the Mozilla Public
*
* 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 , * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Utilities for hashing */ /* Utilities for hashing. */
/* /*
* This file exports functions for hashing data down to a 32-bit value, * This file exports functions for hashing data down to a 32-bit value,
* including: * including:
* *
* - HashString Hash a char* or uint16_t/wchar_t* of known or unknown * - HashString Hash a char* or uint16_t/wchar_t* of known or unknown
* length. * length.
* *
* - HashBytes Hash a byte array of known length. * - HashBytes Hash a byte array of known length.
* *
* - HashGeneric Hash one or more values. Currently, we support uint32_ t, * - HashGeneric Hash one or more values. Currently, we support uint32_ t,
* types which can be implicitly cast to uint32_t, data * types which can be implicitly cast to uint32_t, data
* pointers, and function pointers. * pointers, and function pointers.
* *
* - AddToHash Add one or more values to the given hash. This support s the * - AddToHash Add one or more values to the given hash. This support s the
* same list of types as HashGeneric. * same list of types as HashGeneric.
* *
* *
* You can chain these functions together to hash complex objects. For exa mple: * You can chain these functions together to hash complex objects. For exa mple:
* *
* class ComplexObject { * class ComplexObject
* char* str; * {
* uint32_t uint1, uint2; * char* str;
* void (*callbackFn)(); * uint32_t uint1, uint2;
* * void (*callbackFn)();
* uint32_t Hash() { *
* uint32_t hash = HashString(str); * public:
* hash = AddToHash(hash, uint1, uint2); * uint32_t hash() {
* return AddToHash(hash, callbackFn); * uint32_t hash = HashString(str);
* } * hash = AddToHash(hash, uint1, uint2);
* return AddToHash(hash, callbackFn);
* }
* }; * };
* *
* If you want to hash an nsAString or nsACString, use the HashString funct ions * If you want to hash an nsAString or nsACString, use the HashString funct ions
* in nsHashKey.h. * in nsHashKey.h.
*/ */
#ifndef mozilla_HashFunctions_h_ #ifndef mozilla_HashFunctions_h_
#define mozilla_HashFunctions_h_ #define mozilla_HashFunctions_h_
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/StandardInteger.h" #include "mozilla/StandardInteger.h"
#include "mozilla/Types.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace mozilla { namespace mozilla {
/** /**
* The golden ratio as a 32-bit fixed-point value. * The golden ratio as a 32-bit fixed-point value.
*/ */
static const uint32_t GoldenRatioU32 = 0x9E3779B9U; static const uint32_t GoldenRatioU32 = 0x9E3779B9U;
inline uint32_t inline uint32_t
skipping to change at line 181 skipping to change at line 182
* You might think this function should just take a void*. But then we'd only * You might think this function should just take a void*. But then we'd only
* catch data pointers and couldn't handle function pointers. * catch data pointers and couldn't handle function pointers.
*/ */
MOZ_STATIC_ASSERT(sizeof(a) == sizeof(uintptr_t), MOZ_STATIC_ASSERT(sizeof(a) == sizeof(uintptr_t),
"Strange pointer!"); "Strange pointer!");
return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, uintptr_t(a)); return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, uintptr_t(a));
} }
template<>
MOZ_WARN_UNUSED_RESULT
inline uint32_t
AddToHash(uint32_t hash, uintptr_t a)
{
return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, a);
}
template<typename A, typename B> template<typename A, typename B>
MOZ_WARN_UNUSED_RESULT MOZ_WARN_UNUSED_RESULT
uint32_t uint32_t
AddToHash(uint32_t hash, A a, B b) AddToHash(uint32_t hash, A a, B b)
{ {
return AddToHash(AddToHash(hash, a), b); return AddToHash(AddToHash(hash, a), b);
} }
template<typename A, typename B, typename C> template<typename A, typename B, typename C>
MOZ_WARN_UNUSED_RESULT MOZ_WARN_UNUSED_RESULT
 End of changes. 5 change blocks. 
16 lines changed or deleted 25 lines changed or added


 HashTable.h   HashTable.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* November 13, 2009.
*
* The Initial Developer of the Original Code is
* the Mozilla Corporation.
*
* Contributor(s):
* Brendan Eich <brendan@mozilla.org> (Original Author)
* Chris Waterson <waterson@netscape.com>
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
* Luke Wagner <lw@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jshashtable_h_ #ifndef jshashtable_h_
#define jshashtable_h_ #define jshashtable_h_
#include "TemplateLib.h" #include "TemplateLib.h"
#include "Utility.h" #include "Utility.h"
namespace js { namespace js {
class TempAllocPolicy; class TempAllocPolicy;
/* Integral types for all hash functions. */
typedef uint32_t HashNumber;
/************************************************************************** ***/ /************************************************************************** ***/
namespace detail { namespace detail {
template <class T, class HashPolicy, class AllocPolicy> template <class T, class HashPolicy, class AllocPolicy>
class HashTable; class HashTable;
template <class T> template <class T>
class HashTableEntry { class HashTableEntry {
HashNumber keyHash; HashNumber keyHash;
skipping to change at line 100 skipping to change at line 62
bool isRemoved() const { return keyHash == sRemovedKey; } bool isRemoved() const { return keyHash == sRemovedKey; }
void setRemoved() { keyHash = sRemovedKey; t = T(); } void setRemoved() { keyHash = sRemovedKey; t = T(); }
bool isLive() const { return isLiveHash(keyHash); } bool isLive() const { return isLiveHash(keyHash); }
void setLive(HashNumber hn) { JS_ASSERT(isLiveHash(hn)); keyHash = hn ; } void setLive(HashNumber hn) { JS_ASSERT(isLiveHash(hn)); keyHash = hn ; }
void setCollision() { JS_ASSERT(isLive()); keyHash |= sCollis ionBit; } void setCollision() { JS_ASSERT(isLive()); keyHash |= sCollis ionBit; }
void setCollision(HashNumber collisionBit) { void setCollision(HashNumber collisionBit) {
JS_ASSERT(isLive()); keyHash |= collisionBit; JS_ASSERT(isLive()); keyHash |= collisionBit;
} }
void unsetCollision() { keyHash &= ~sCollisionBit; } void unsetCollision() { keyHash &= ~sCollisionBit; }
bool hasCollision() const { JS_ASSERT(isLive()); return keyHash & s CollisionBit; } bool hasCollision() const { return keyHash & sCollisionBit; }
bool matchHash(HashNumber hn) { return (keyHash & ~sCollisionBit) == hn ; } bool matchHash(HashNumber hn) { return (keyHash & ~sCollisionBit) == hn ; }
HashNumber getKeyHash() const { JS_ASSERT(!hasCollision()); return keyH ash; } HashNumber getKeyHash() const { JS_ASSERT(!hasCollision()); return keyH ash; }
}; };
/* /*
* js::detail::HashTable is an implementation detail of the js::HashMap and * js::detail::HashTable is an implementation detail of the js::HashMap and
* js::HashSet templates. For js::Hash{Map,Set} API documentation and examp les, * js::HashSet templates. For js::Hash{Map,Set} API documentation and examp les,
* skip to the end of the detail namespace. * skip to the end of the detail namespace.
*/ */
skipping to change at line 180 skipping to change at line 142
* A collection of hash table entries. The collection is enumerated by * A collection of hash table entries. The collection is enumerated by
* calling |front()| followed by |popFront()| as long as |!empty()|. As * calling |front()| followed by |popFront()| as long as |!empty()|. As
* with Ptr/AddPtr, Range objects must not be used after any mutating h ash * with Ptr/AddPtr, Range objects must not be used after any mutating h ash
* table operation unless the |generation()| is tested. * table operation unless the |generation()| is tested.
*/ */
class Range class Range
{ {
protected: protected:
friend class HashTable; friend class HashTable;
Range(Entry *c, Entry *e) : cur(c), end(e) { Range(Entry *c, Entry *e) : cur(c), end(e), validEntry(true) {
while (cur < end && !cur->isLive()) while (cur < end && !cur->isLive())
++cur; ++cur;
} }
Entry *cur, *end; Entry *cur, *end;
DebugOnly<bool> validEntry;
public: public:
Range() : cur(NULL), end(NULL) {} Range() : cur(NULL), end(NULL), validEntry(false) {}
bool empty() const { bool empty() const {
return cur == end; return cur == end;
} }
T &front() const { T &front() const {
JS_ASSERT(validEntry);
JS_ASSERT(!empty()); JS_ASSERT(!empty());
return cur->t; return cur->t;
} }
void popFront() { void popFront() {
JS_ASSERT(!empty()); JS_ASSERT(!empty());
while (++cur < end && !cur->isLive()) while (++cur < end && !cur->isLive())
continue; continue;
validEntry = true;
} }
}; };
/* /*
* A Range whose lifetime delimits a mutating enumeration of a hash tab le. * A Range whose lifetime delimits a mutating enumeration of a hash tab le.
* Since rehashing when elements were removed during enumeration would be * Since rehashing when elements were removed during enumeration would be
* bad, it is postponed until |endEnumeration()| is called. If * bad, it is postponed until |endEnumeration()| is called. If
* |endEnumeration()| is not called before an Enum's constructor, it wi ll * |endEnumeration()| is not called before an Enum's constructor, it wi ll
* be called automatically. Since |endEnumeration()| touches the hash * be called automatically. Since |endEnumeration()| touches the hash
* table, the user must ensure that the hash table is still alive when this * table, the user must ensure that the hash table is still alive when this
* happens. * happens.
*/ */
class Enum : public Range class Enum : public Range
{ {
friend class HashTable; friend class HashTable;
HashTable &table; HashTable &table;
bool added; bool rekeyed;
bool removed; bool removed;
/* Not copyable. */ /* Not copyable. */
Enum(const Enum &); Enum(const Enum &);
void operator=(const Enum &); void operator=(const Enum &);
public: public:
template<class Map> explicit template<class Map> explicit
Enum(Map &map) : Range(map.all()), table(map.impl), added(false), r emoved(false) {} Enum(Map &map) : Range(map.all()), table(map.impl), rekeyed(false), removed(false) {}
/* /*
* Removes the |front()| element from the table, leaving |front()| * Removes the |front()| element from the table, leaving |front()|
* invalid until the next call to |popFront()|. For example: * invalid until the next call to |popFront()|. For example:
* *
* HashSet<int> s; * HashSet<int> s;
* for (HashSet<int>::Enum e(s); !e.empty(); e.popFront()) * for (HashSet<int>::Enum e(s); !e.empty(); e.popFront())
* if (e.front() == 42) * if (e.front() == 42)
* e.removeFront(); * e.removeFront();
*/ */
void removeFront() { void removeFront() {
table.remove(*this->cur); table.remove(*this->cur);
removed = true; removed = true;
this->validEntry = false;
} }
/* /*
* Removes the |front()| element and re-inserts it into the table w ith * Removes the |front()| element and re-inserts it into the table w ith
* a new key at the new Lookup position. |front()| is invalid afte r * a new key at the new Lookup position. |front()| is invalid afte r
* this operation until the next call to |popFront()|. * this operation until the next call to |popFront()|.
*/ */
void rekeyFront(Key &k) { void rekeyFront(const Lookup &l, const Key &k) {
JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); typename HashTableEntry<T>::NonConstT t = this->cur->t;
JS_ASSERT(!table.match(*this->cur, k)); HashPolicy::setKey(t, const_cast<Key &>(k));
Entry e = *this->cur;
HashPolicy::setKey(e.t, k);
table.remove(*this->cur); table.remove(*this->cur);
table.add(k, e); table.putNewInfallible(l, t);
added = true; rekeyed = true;
this->validEntry = false;
}
void rekeyFront(const Key &k) {
rekeyFront(k, k);
} }
/* Potentially rehashes the table. */ /* Potentially rehashes the table. */
~Enum() { ~Enum() {
if (added) if (rekeyed)
table.checkOverloaded(); table.checkOverRemoved();
if (removed) if (removed)
table.checkUnderloaded(); table.checkUnderloaded();
} }
/* Can be used to end the enumeration before the destructor. */
void endEnumeration() {
if (added) {
table.checkOverloaded();
added = false;
}
if (removed) {
table.checkUnderloaded();
removed = false;
}
}
}; };
private: private:
uint32_t hashShift; /* multiplicative hash shift */ uint32_t hashShift; /* multiplicative hash shift */
uint32_t entryCount; /* number of entries in table */ uint32_t entryCount; /* number of entries in table */
uint32_t gen; /* entry storage generation number */ uint32_t gen; /* entry storage generation number */
uint32_t removedCount; /* removed entry sentinels in table */ uint32_t removedCount; /* removed entry sentinels in table */
Entry *table; /* entry storage */ Entry *table; /* entry storage */
void setTableSizeLog2(unsigned sizeLog2) { void setTableSizeLog2(unsigned sizeLog2) {
skipping to change at line 304 skipping to change at line 261
uint32_t searches; /* total number of table searches * / uint32_t searches; /* total number of table searches * /
uint32_t steps; /* hash chain links traversed */ uint32_t steps; /* hash chain links traversed */
uint32_t hits; /* searches that found key */ uint32_t hits; /* searches that found key */
uint32_t misses; /* searches that didn't find key */ uint32_t misses; /* searches that didn't find key */
uint32_t addOverRemoved; /* adds that recycled a removed ent ry */ uint32_t addOverRemoved; /* adds that recycled a removed ent ry */
uint32_t removes; /* calls to remove */ uint32_t removes; /* calls to remove */
uint32_t removeFrees; /* calls to remove that freed the e ntry */ uint32_t removeFrees; /* calls to remove that freed the e ntry */
uint32_t grows; /* table expansions */ uint32_t grows; /* table expansions */
uint32_t shrinks; /* table contractions */ uint32_t shrinks; /* table contractions */
uint32_t compresses; /* table compressions */ uint32_t compresses; /* table compressions */
uint32_t rehashes; /* tombstone decontaminations */
} stats; } stats;
# define METER(x) x # define METER(x) x
#else #else
# define METER(x) # define METER(x)
#endif #endif
friend class js::ReentrancyGuard; friend class js::ReentrancyGuard;
mutable DebugOnly<bool> entered; mutable DebugOnly<bool> entered;
DebugOnly<uint64_t> mutationCount; DebugOnly<uint64_t> mutationCount;
skipping to change at line 327 skipping to change at line 285
static const unsigned sDefaultInitSizeLog2 = 4; static const unsigned sDefaultInitSizeLog2 = 4;
public: public:
static const unsigned sDefaultInitSize = 1 << sDefaultInitSizeLog2; static const unsigned sDefaultInitSize = 1 << sDefaultInitSizeLog2;
private: private:
static const unsigned sMaxInit = JS_BIT(23); static const unsigned sMaxInit = JS_BIT(23);
static const unsigned sMaxCapacity = JS_BIT(24); static const unsigned sMaxCapacity = JS_BIT(24);
static const unsigned sHashBits = tl::BitSize<HashNumber>::result; static const unsigned sHashBits = tl::BitSize<HashNumber>::result;
static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */ static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */
static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */ static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */
static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */ static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */
static const HashNumber sGoldenRatio = 0x9E3779B9U; /* taken fro m jsdhash.h */
static const HashNumber sFreeKey = Entry::sFreeKey; static const HashNumber sFreeKey = Entry::sFreeKey;
static const HashNumber sRemovedKey = Entry::sRemovedKey; static const HashNumber sRemovedKey = Entry::sRemovedKey;
static const HashNumber sCollisionBit = Entry::sCollisionBit; static const HashNumber sCollisionBit = Entry::sCollisionBit;
static void staticAsserts() static void staticAsserts()
{ {
/* Rely on compiler "constant overflow warnings". */ /* Rely on compiler "constant overflow warnings". */
JS_STATIC_ASSERT(((sMaxInit * sInvMaxAlpha) >> 7) < sMaxCapacity); JS_STATIC_ASSERT(((sMaxInit * sInvMaxAlpha) >> 7) < sMaxCapacity);
JS_STATIC_ASSERT((sMaxCapacity * sInvMaxAlpha) <= UINT32_MAX); JS_STATIC_ASSERT((sMaxCapacity * sInvMaxAlpha) <= UINT32_MAX);
JS_STATIC_ASSERT((sMaxCapacity * sizeof(Entry)) <= UINT32_MAX); JS_STATIC_ASSERT((sMaxCapacity * sizeof(Entry)) <= UINT32_MAX);
} }
static bool isLiveHash(HashNumber hash) static bool isLiveHash(HashNumber hash)
{ {
return Entry::isLiveHash(hash); return Entry::isLiveHash(hash);
} }
static HashNumber prepareHash(const Lookup& l) static HashNumber prepareHash(const Lookup& l)
{ {
HashNumber keyHash = HashPolicy::hash(l); HashNumber keyHash = ScrambleHashCode(HashPolicy::hash(l));
/* Improve keyHash distribution. */
keyHash *= sGoldenRatio;
/* Avoid reserved hash codes. */ /* Avoid reserved hash codes. */
if (!isLiveHash(keyHash)) if (!isLiveHash(keyHash))
keyHash -= (sRemovedKey + 1); keyHash -= (sRemovedKey + 1);
return keyHash & ~sCollisionBit; return keyHash & ~sCollisionBit;
} }
static Entry *createTable(AllocPolicy &alloc, uint32_t capacity) static Entry *createTable(AllocPolicy &alloc, uint32_t capacity)
{ {
Entry *newTable = (Entry *)alloc.malloc_(capacity * sizeof(Entry)); Entry *newTable = (Entry *)alloc.malloc_(capacity * sizeof(Entry));
skipping to change at line 387 skipping to change at line 341
: AllocPolicy(ap), : AllocPolicy(ap),
hashShift(sHashBits), hashShift(sHashBits),
entryCount(0), entryCount(0),
gen(0), gen(0),
removedCount(0), removedCount(0),
table(NULL), table(NULL),
entered(false), entered(false),
mutationCount(0) mutationCount(0)
{} {}
bool init(uint32_t length) MOZ_WARN_UNUSED_RESULT bool init(uint32_t length)
{ {
/* Make sure that init isn't called twice. */ /* Make sure that init isn't called twice. */
JS_ASSERT(table == NULL); JS_ASSERT(table == NULL);
/* /*
* Correct for sMaxAlphaFrac such that the table will not resize * Correct for sMaxAlphaFrac such that the table will not resize
* when adding 'length' entries. * when adding 'length' entries.
*/ */
if (length > sMaxInit) { if (length > sMaxInit) {
this->reportAllocOverflow(); this->reportAllocOverflow();
skipping to change at line 536 skipping to change at line 490
/* /*
* This is a copy of lookup hardcoded to the assumptions: * This is a copy of lookup hardcoded to the assumptions:
* 1. the lookup is a lookupForAdd * 1. the lookup is a lookupForAdd
* 2. the key, whose |keyHash| has been passed is not in the table, * 2. the key, whose |keyHash| has been passed is not in the table,
* 3. no entries have been removed from the table. * 3. no entries have been removed from the table.
* This specialized search avoids the need for recovering lookup values * This specialized search avoids the need for recovering lookup values
* from entries, which allows more flexible Lookup/Key types. * from entries, which allows more flexible Lookup/Key types.
*/ */
Entry &findFreeEntry(HashNumber keyHash) Entry &findFreeEntry(HashNumber keyHash)
{ {
METER(stats.searches++);
JS_ASSERT(!(keyHash & sCollisionBit)); JS_ASSERT(!(keyHash & sCollisionBit));
JS_ASSERT(table);
METER(stats.searches++);
/* N.B. the |keyHash| has already been distributed. */ /* N.B. the |keyHash| has already been distributed. */
/* Compute the primary hash address. */ /* Compute the primary hash address. */
HashNumber h1 = hash1(keyHash, hashShift); HashNumber h1 = hash1(keyHash, hashShift);
Entry *entry = &table[h1]; Entry *entry = &table[h1];
/* Miss: return space for a new entry. */ /* Miss: return space for a new entry. */
if (entry->isFree()) { if (!entry->isLive()) {
METER(stats.misses++); METER(stats.misses++);
return *entry; return *entry;
} }
/* Collision: double hash. */ /* Collision: double hash. */
DoubleHash dh = hash2(keyHash, hashShift); DoubleHash dh = hash2(keyHash, hashShift);
while(true) { while(true) {
JS_ASSERT(!entry->isRemoved()); JS_ASSERT(!entry->isRemoved());
entry->setCollision(); entry->setCollision();
METER(stats.steps++); METER(stats.steps++);
h1 = applyDoubleHash(h1, dh); h1 = applyDoubleHash(h1, dh);
entry = &table[h1]; entry = &table[h1];
if (entry->isFree()) { if (!entry->isLive()) {
METER(stats.misses++); METER(stats.misses++);
return *entry; return *entry;
} }
} }
} }
bool changeTableSize(int deltaLog2) enum RebuildStatus { NotOverloaded, Rehashed, RehashFailed };
RebuildStatus changeTableSize(int deltaLog2)
{ {
/* Look, but don't touch, until we succeed in getting new entry sto re. */ /* Look, but don't touch, until we succeed in getting new entry sto re. */
Entry *oldTable = table; Entry *oldTable = table;
uint32_t oldCap = capacity(); uint32_t oldCap = capacity();
uint32_t newLog2 = sHashBits - hashShift + deltaLog2; uint32_t newLog2 = sHashBits - hashShift + deltaLog2;
uint32_t newCapacity = JS_BIT(newLog2); uint32_t newCapacity = JS_BIT(newLog2);
if (newCapacity > sMaxCapacity) { if (newCapacity > sMaxCapacity) {
this->reportAllocOverflow(); this->reportAllocOverflow();
return false; return RehashFailed;
} }
Entry *newTable = createTable(*this, newCapacity); Entry *newTable = createTable(*this, newCapacity);
if (!newTable) if (!newTable)
return false; return RehashFailed;
/* We can't fail from here on, so update table parameters. */ /* We can't fail from here on, so update table parameters. */
setTableSizeLog2(newLog2); setTableSizeLog2(newLog2);
removedCount = 0; removedCount = 0;
gen++; gen++;
table = newTable; table = newTable;
/* Copy only live entries, leaving removed ones behind. */ /* Copy only live entries, leaving removed ones behind. */
for (Entry *src = oldTable, *end = src + oldCap; src < end; ++src) { for (Entry *src = oldTable, *end = src + oldCap; src < end; ++src) {
if (src->isLive()) { if (src->isLive()) {
src->unsetCollision(); src->unsetCollision();
findFreeEntry(src->getKeyHash()) = Move(*src); findFreeEntry(src->getKeyHash()) = Move(*src);
} }
} }
destroyTable(*this, oldTable, oldCap); destroyTable(*this, oldTable, oldCap);
return true; return Rehashed;
} }
void add(const Lookup &l, const Entry &e) RebuildStatus checkOverloaded()
{
HashNumber keyHash = prepareHash(l);
Entry &entry = lookup(l, keyHash, sCollisionBit);
if (entry.isRemoved()) {
METER(stats.addOverRemoved++);
removedCount--;
keyHash |= sCollisionBit;
}
entry.t = e.t;
entry.setLive(keyHash);
entryCount++;
mutationCount++;
}
bool checkOverloaded()
{ {
if (!overloaded()) if (!overloaded())
return false; return NotOverloaded;
/* Compress if a quarter or more of all entries are removed. */ /* Compress if a quarter or more of all entries are removed. */
int deltaLog2; int deltaLog2;
if (removedCount >= (capacity() >> 2)) { if (removedCount >= (capacity() >> 2)) {
METER(stats.compresses++); METER(stats.compresses++);
deltaLog2 = 0; deltaLog2 = 0;
} else { } else {
METER(stats.grows++); METER(stats.grows++);
deltaLog2 = 1; deltaLog2 = 1;
} }
return changeTableSize(deltaLog2); return changeTableSize(deltaLog2);
} }
/* Infallibly rehash the table if we are overloaded with removals. */
void checkOverRemoved()
{
if (overloaded()) {
METER(stats.rehashes++);
rehashTable();
JS_ASSERT(!overloaded());
}
}
void remove(Entry &e) void remove(Entry &e)
{ {
JS_ASSERT(table);
METER(stats.removes++); METER(stats.removes++);
if (e.hasCollision()) { if (e.hasCollision()) {
e.setRemoved(); e.setRemoved();
removedCount++; removedCount++;
} else { } else {
METER(stats.removeFrees++); METER(stats.removeFrees++);
e.setFree(); e.setFree();
} }
entryCount--; entryCount--;
mutationCount++; mutationCount++;
} }
void checkUnderloaded() void checkUnderloaded()
{ {
if (underloaded()) { if (underloaded()) {
METER(stats.shrinks++); METER(stats.shrinks++);
(void) changeTableSize(-1); (void) changeTableSize(-1);
} }
} }
/*
* This is identical to changeTableSize(currentSize), but without requi
ring
* a second table. We do this by recycling the collision bits to tell
us if
* the element is already inserted or still waiting to be inserted. Si
nce
* already-inserted elements win any conflicts, we get the same table a
s we
* would have gotten through random insertion order.
*/
void rehashTable()
{
removedCount = 0;
for (size_t i = 0; i < capacity(); ++i)
table[i].unsetCollision();
for (size_t i = 0; i < capacity();) {
Entry *src = &table[i];
if (!src->isLive() || src->hasCollision()) {
++i;
continue;
}
HashNumber keyHash = src->getKeyHash();
HashNumber h1 = hash1(keyHash, hashShift);
DoubleHash dh = hash2(keyHash, hashShift);
Entry *tgt = &table[h1];
while (true) {
if (!tgt->hasCollision()) {
Swap(*src, *tgt);
tgt->setCollision();
break;
}
h1 = applyDoubleHash(h1, dh);
tgt = &table[h1];
}
}
/*
* TODO: this algorithm leaves collision bits on *all* elements, ev
en if
* they are on no collision path. We have the option of setting the
* collision bits correctly on a subsequent pass or skipping the re
hash
* unless we are totally filled with tombstones: benchmark to find
out
* which approach is best.
*/
}
public: public:
void clear() void clear()
{ {
if (tl::IsPodType<Entry>::result) { if (tl::IsPodType<Entry>::result) {
memset(table, 0, sizeof(*table) * capacity()); memset(table, 0, sizeof(*table) * capacity());
} else { } else {
uint32_t tableCapacity = capacity(); uint32_t tableCapacity = capacity();
for (Entry *e = table, *end = table + tableCapacity; e < end; + +e) for (Entry *e = table, *end = table + tableCapacity; e < end; + +e)
*e = Move(Entry()); *e = Move(Entry());
} }
skipping to change at line 691 skipping to change at line 689
destroyTable(*this, table, capacity()); destroyTable(*this, table, capacity());
table = NULL; table = NULL;
gen++; gen++;
entryCount = 0; entryCount = 0;
removedCount = 0; removedCount = 0;
mutationCount++; mutationCount++;
} }
Range all() const { Range all() const {
JS_ASSERT(table);
return Range(table, table + capacity()); return Range(table, table + capacity());
} }
bool empty() const { bool empty() const {
JS_ASSERT(table);
return !entryCount; return !entryCount;
} }
uint32_t count() const { uint32_t count() const {
JS_ASSERT(table);
return entryCount; return entryCount;
} }
uint32_t capacity() const { uint32_t capacity() const {
JS_ASSERT(table);
return JS_BIT(sHashBits - hashShift); return JS_BIT(sHashBits - hashShift);
} }
uint32_t generation() const { uint32_t generation() const {
JS_ASSERT(table);
return gen; return gen;
} }
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
return mallocSizeOf(table); return mallocSizeOf(table);
} }
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
} }
skipping to change at line 750 skipping to change at line 753
/* /*
* Changing an entry from removed to live does not affect whether w e * Changing an entry from removed to live does not affect whether w e
* are overloaded and can be handled separately. * are overloaded and can be handled separately.
*/ */
if (p.entry->isRemoved()) { if (p.entry->isRemoved()) {
METER(stats.addOverRemoved++); METER(stats.addOverRemoved++);
removedCount--; removedCount--;
p.keyHash |= sCollisionBit; p.keyHash |= sCollisionBit;
} else { } else {
if (checkOverloaded()) /* Preserve the validity of |p.entry|. */
/* Preserve the validity of |p.entry|. */ RebuildStatus status = checkOverloaded();
if (status == RehashFailed)
return false;
if (status == Rehashed)
p.entry = &findFreeEntry(p.keyHash); p.entry = &findFreeEntry(p.keyHash);
} }
p.entry->setLive(p.keyHash); p.entry->setLive(p.keyHash);
entryCount++; entryCount++;
mutationCount++; mutationCount++;
return true; return true;
} }
/* /*
skipping to change at line 782 skipping to change at line 788
} }
bool add(AddPtr &p, const T &t) bool add(AddPtr &p, const T &t)
{ {
if (!add(p)) if (!add(p))
return false; return false;
p.entry->t = t; p.entry->t = t;
return true; return true;
} }
void putNewInfallible(const Lookup &l, const T &t)
{
JS_ASSERT(table);
HashNumber keyHash = prepareHash(l);
Entry *entry = &findFreeEntry(keyHash);
if (entry->isRemoved()) {
METER(stats.addOverRemoved++);
removedCount--;
keyHash |= sCollisionBit;
}
entry->t = t;
entry->setLive(keyHash);
entryCount++;
mutationCount++;
}
bool putNew(const Lookup &l, const T &t)
{
if (checkOverloaded() == RehashFailed)
return false;
putNewInfallible(l, t);
return true;
}
bool relookupOrAdd(AddPtr& p, const Lookup &l, const T& t) bool relookupOrAdd(AddPtr& p, const Lookup &l, const T& t)
{ {
p.mutationCount = mutationCount; p.mutationCount = mutationCount;
{ {
ReentrancyGuard g(*this); ReentrancyGuard g(*this);
p.entry = &lookup(l, p.keyHash, sCollisionBit); p.entry = &lookup(l, p.keyHash, sCollisionBit);
} }
return p.found() || add(p, t); return p.found() || add(p, t);
} }
void remove(Ptr p) void remove(Ptr p)
{ {
JS_ASSERT(table);
ReentrancyGuard g(*this); ReentrancyGuard g(*this);
JS_ASSERT(p.found()); JS_ASSERT(p.found());
remove(*p.entry); remove(*p.entry);
checkUnderloaded(); checkUnderloaded();
} }
#undef METER #undef METER
}; };
} /* namespace detail */ } /* namespace detail */
skipping to change at line 961 skipping to change at line 996
* N.B: HashMap is not reentrant: Key/Value/HashPolicy/AllocPolicy members * N.B: HashMap is not reentrant: Key/Value/HashPolicy/AllocPolicy members
* called by HashMap must not call back into the same HashMap object. * called by HashMap must not call back into the same HashMap object.
* N.B: Due to the lack of exception handling, the user must call |init()|. * N.B: Due to the lack of exception handling, the user must call |init()|.
*/ */
template <class Key, template <class Key,
class Value, class Value,
class HashPolicy = DefaultHasher<Key>, class HashPolicy = DefaultHasher<Key>,
class AllocPolicy = TempAllocPolicy> class AllocPolicy = TempAllocPolicy>
class HashMap class HashMap
{ {
typedef typename tl::StaticAssert<tl::IsRelocatableHeapType<Key>::resul
t>::result keyAssert;
typedef typename tl::StaticAssert<tl::IsRelocatableHeapType<Value>::res
ult>::result valAssert;
public: public:
typedef typename HashPolicy::Lookup Lookup; typedef typename HashPolicy::Lookup Lookup;
typedef HashMapEntry<Key, Value> Entry; typedef HashMapEntry<Key, Value> Entry;
private: private:
/* Implement HashMap using HashTable. Lift |Key| operations to |Entry|. */ /* Implement HashMap using HashTable. Lift |Key| operations to |Entry|. */
struct MapHashPolicy : HashPolicy struct MapHashPolicy : HashPolicy
{ {
typedef Key KeyType; typedef Key KeyType;
skipping to change at line 1166 skipping to change at line 1204
AddPtr p = lookupForAdd(k); AddPtr p = lookupForAdd(k);
if (p) { if (p) {
p->value = v; p->value = v;
return true; return true;
} }
return add(p, k, v); return add(p, k, v);
} }
/* Like put, but assert that the given key is not already present. */ /* Like put, but assert that the given key is not already present. */
bool putNew(const Key &k, const Value &v) { bool putNew(const Key &k, const Value &v) {
AddPtr p = lookupForAdd(k); return impl.putNew(k, Entry(k, v));
JS_ASSERT(!p);
return add(p, k, v);
} }
/* Add (k,defaultValue) if k no found. Return false-y Ptr on oom. */ /* Add (k,defaultValue) if k no found. Return false-y Ptr on oom. */
Ptr lookupWithDefault(const Key &k, const Value &defaultValue) { Ptr lookupWithDefault(const Key &k, const Value &defaultValue) {
AddPtr p = lookupForAdd(k); AddPtr p = lookupForAdd(k);
if (p) if (p)
return p; return p;
(void)add(p, k, defaultValue); /* p is left false-y on oom. */ (void)add(p, k, defaultValue); /* p is left false-y on oom. */
return p; return p;
} }
skipping to change at line 1374 skipping to change at line 1410
} }
/* Overwrite existing value with v. Return false on oom. */ /* Overwrite existing value with v. Return false on oom. */
bool put(const T &t) { bool put(const T &t) {
AddPtr p = lookupForAdd(t); AddPtr p = lookupForAdd(t);
return p ? true : add(p, t); return p ? true : add(p, t);
} }
/* Like put, but assert that the given key is not already present. */ /* Like put, but assert that the given key is not already present. */
bool putNew(const T &t) { bool putNew(const T &t) {
AddPtr p = lookupForAdd(t); return impl.putNew(t, t);
JS_ASSERT(!p);
return add(p, t);
} }
bool putNew(const Lookup &l, const T &t) { bool putNew(const Lookup &l, const T &t) {
AddPtr p = lookupForAdd(l); return impl.putNew(l, t);
JS_ASSERT(!p);
return add(p, t);
} }
void remove(const Lookup &l) { void remove(const Lookup &l) {
if (Ptr p = lookup(l)) if (Ptr p = lookup(l))
remove(p); remove(p);
} }
}; };
} /* namespace js */ } /* namespace js */
 End of changes. 45 change blocks. 
119 lines changed or deleted 151 lines changed or added


 HttpRequest.h   HttpRequest.h 
skipping to change at line 179 skipping to change at line 179
inline CCObject* getTarget() inline CCObject* getTarget()
{ {
return _pTarget; return _pTarget;
} }
/** Get the selector function pointer, mainly used by CCHttpClient */ /** Get the selector function pointer, mainly used by CCHttpClient */
inline SEL_CallFuncND getSelector() inline SEL_CallFuncND getSelector()
{ {
return _pSelector; return _pSelector;
} }
/** Set any custom headers **/
inline void setHeaders(std::vector<std::string> pHeaders)
{
_headers=pHeaders;
}
/** Get custom headers **/
inline std::vector<std::string> getHeaders()
{
return _headers;
}
protected: protected:
// properties // properties
HttpRequestType _requestType; /// kHttpRequestGet, kHttp RequestPost or other enums HttpRequestType _requestType; /// kHttpRequestGet, kHttp RequestPost or other enums
std::string _url; /// target url that this r equest is sent to std::string _url; /// target url that this r equest is sent to
std::vector<char> _requestData; /// used for POST std::vector<char> _requestData; /// used for POST
std::string _tag; /// user defined tag, to i dentify different requests in response callback std::string _tag; /// user defined tag, to i dentify different requests in response callback
CCObject* _pTarget; /// callback target of pSelector fu nction CCObject* _pTarget; /// callback target of pSelector fu nction
SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer ::onHttpResponse(CCObject *sender, void *data) SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer ::onHttpResponse(CCObject *sender, void *data)
void* _pUserData; /// You can add your custo med data here void* _pUserData; /// You can add your custo med data here
std::vector<std::string> _headers; /// custom htt p headers
}; };
NS_CC_EXT_END NS_CC_EXT_END
#endif //__HTTP_REQUEST_H__ #endif //__HTTP_REQUEST_H__
 End of changes. 2 change blocks. 
0 lines changed or deleted 13 lines changed or added


 Java_org_cocos2dx_lib_Cocos2dxHelper.h   Java_org_cocos2dx_lib_Cocos2dxHelper.h 
skipping to change at line 40 skipping to change at line 40
extern "C" { extern "C" {
extern const char * getApkPath(); extern const char * getApkPath();
extern void showDialogJNI(const char * pszMsg, const char * pszTitle); extern void showDialogJNI(const char * pszMsg, const char * pszTitle);
extern void showEditTextDialogJNI(const char* pszTitle, const char* psz Content, int nInputMode, int nInputFlag, int nReturnType, int nMaxLength, E ditTextCallback pfEditTextCallback, void* ctx); extern void showEditTextDialogJNI(const char* pszTitle, const char* psz Content, int nInputMode, int nInputFlag, int nReturnType, int nMaxLength, E ditTextCallback pfEditTextCallback, void* ctx);
extern void terminateProcessJNI(); extern void terminateProcessJNI();
extern const char * getCurrentLanguageJNI(); extern const char * getCurrentLanguageJNI();
extern const char * getPackageNameJNI(); extern const char * getPackageNameJNI();
extern void enableAccelerometerJNI(); extern void enableAccelerometerJNI();
extern void disableAccelerometerJNI(); extern void disableAccelerometerJNI();
extern void setAccelerometerIntervalJNI(float interval);
} }
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 LegacyIntTypes.h   LegacyIntTypes.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
* This section typedefs the old 'native' types to the new <stdint.h> types . * This section typedefs the old 'native' types to the new <stdint.h> types .
* These redefinitions are provided solely to allow JSAPI users to more eas ily * These redefinitions are provided solely to allow JSAPI users to more eas ily
* transition to <stdint.h> types. They are not to be used in the JSAPI, a nd * transition to <stdint.h> types. They are not to be used in the JSAPI, a nd
* new JSAPI user code should not use them. This mapping file may eventual ly * new JSAPI user code should not use them. This mapping file may eventual ly
* be removed from SpiderMonkey, so don't depend on it in the long run. * be removed from SpiderMonkey, so don't depend on it in the long run.
*/ */
/* /*
 End of changes. 1 change blocks. 
45 lines changed or deleted 3 lines changed or added


 Likely.h   Likely.h 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 , * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* /*
* MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
* boolean predicate should be branch-predicted. * boolean predicate should be branch-predicted.
*/ */
#ifndef Likely_h_ #ifndef mozilla_Likely_h_
#define Likely_h_ #define mozilla_Likely_h_
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2)) #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
# define MOZ_LIKELY(x) (__builtin_expect((x), 1)) # define MOZ_LIKELY(x) (__builtin_expect((x), 1))
# define MOZ_UNLIKELY(x) (__builtin_expect((x), 0)) # define MOZ_UNLIKELY(x) (__builtin_expect((x), 0))
#else #else
# define MOZ_LIKELY(x) (x) # define MOZ_LIKELY(x) (x)
# define MOZ_UNLIKELY(x) (x) # define MOZ_UNLIKELY(x) (x)
#endif #endif
#endif /* Likely_h_ */ #endif /* mozilla_Likely_h_ */
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 LinkedList.h   LinkedList.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=4 sw=4 tw=80 et cin: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Justin Lebar <justin.lebar@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* A type-safe doubly-linked list class. */ /* A type-safe doubly-linked list class. */
/* /*
* The classes LinkedList<T> and LinkedListElement<T> together form a * The classes LinkedList<T> and LinkedListElement<T> together form a
* convenient, type-safe doubly-linked list implementation. * convenient, type-safe doubly-linked list implementation.
* *
* The class T which will be inserted into the linked list must inherit fro m * The class T which will be inserted into the linked list must inherit fro m
* LinkedListElement<T>. A given object may be in only one linked list at a * LinkedListElement<T>. A given object may be in only one linked list at a
* time. * time.
* *
* For example, you might use LinkedList in a simple observer list class as * For example, you might use LinkedList in a simple observer list class as
* follows. * follows.
* *
* class Observer : public LinkedListElement<Observer> * class Observer : public LinkedListElement<Observer>
* { * {
* void observe(char* topic) { ... } * public:
* void observe(char* topic) { ... }
* }; * };
* *
* class ObserverContainer * class ObserverContainer
* { * {
* private: * private:
* LinkedList<ElemType> list; * LinkedList<Observer> list;
*
* public:
* *
* void addObserver(Observer* observer) * public:
* { * void addObserver(Observer* observer) {
* // Will assert if |observer| is part of another list. * // Will assert if |observer| is part of another list.
* list.insertBack(observer); * list.insertBack(observer);
* } * }
* *
* void removeObserver(Observer* observer) * void removeObserver(Observer* observer) {
* { * // Will assert if |observer| is not part of some list.
* // Will assert if |observer| is not part of some list. * observer.remove();
* observer.remove(); * }
* }
* *
* void notifyObservers(char* topic) * void notifyObservers(char* topic) {
* { * for (Observer* o = list.getFirst(); o != NULL; o = o->getNext())
* for (Observer* o = list.getFirst(); * o->Observe(topic);
* o != NULL;
* o = o->getNext()) {
* o->Observe(topic);
* } * }
* }
* }; * };
* *
*/ */
#ifndef mozilla_LinkedList_h_ #ifndef mozilla_LinkedList_h_
#define mozilla_LinkedList_h_ #define mozilla_LinkedList_h_
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
skipping to change at line 140 skipping to change at line 99
* than one list. But the upside is that you can call next() / prev() / * than one list. But the upside is that you can call next() / prev() /
* remove() directly on the object. With stl::list, you'd need to stor e a * remove() directly on the object. With stl::list, you'd need to stor e a
* pointer to its iterator in the object in order to accomplish this. Not * pointer to its iterator in the object in order to accomplish this. Not
* only would this waste space, but you'd have to remember to update th at * only would this waste space, but you'd have to remember to update th at
* pointer every time you added or removed the object from a list. * pointer every time you added or removed the object from a list.
* *
* In-place, constant-time removal is a killer feature of doubly-linked * In-place, constant-time removal is a killer feature of doubly-linked
* lists, and supporting this painlessly was a key design criterion. * lists, and supporting this painlessly was a key design criterion.
*/ */
private: private:
LinkedListElement* next; LinkedListElement* next;
LinkedListElement* prev; LinkedListElement* prev;
const bool isSentinel; const bool isSentinel;
public: public:
LinkedListElement() LinkedListElement() : next(this), prev(this), isSentinel(false) { }
: next(this)
, prev(this)
, isSentinel(false)
{
}
/* /*
* Get the next element in the list, or NULL if this is the last elemen t in * Get the next element in the list, or NULL if this is the last elemen t in
* the list. * the list.
*/ */
T* getNext() T* getNext() {
{ return next->asT();
return next->asT(); }
const T* getNext() const {
return next->asT();
} }
/* /*
* Get the previous element in the list, or NULL if this is the first e lement * Get the previous element in the list, or NULL if this is the first e lement
* in the list. * in the list.
*/ */
T* getPrevious() T* getPrevious() {
{ return prev->asT();
return prev->asT(); }
const T* getPrevious() const {
return prev->asT();
} }
/* /*
* Insert elem after this element in the list. |this| must be part of a * Insert elem after this element in the list. |this| must be part of a
* linked list when you call setNext(); otherwise, this method will ass ert. * linked list when you call setNext(); otherwise, this method will ass ert.
*/ */
void setNext(T* elem) void setNext(T* elem) {
{
MOZ_ASSERT(isInList()); MOZ_ASSERT(isInList());
setNextUnsafe(elem); setNextUnsafe(elem);
} }
/* /*
* Insert elem before this element in the list. |this| must be part of a * Insert elem before this element in the list. |this| must be part of a
* linked list when you call setPrevious(); otherwise, this method will * linked list when you call setPrevious(); otherwise, this method will
* assert. * assert.
*/ */
void setPrevious(T* elem) void setPrevious(T* elem) {
{ MOZ_ASSERT(isInList());
MOZ_ASSERT(isInList()); setPreviousUnsafe(elem);
setPreviousUnsafe(elem);
} }
/* /*
* Remove this element from the list which contains it. If this elemen t is * Remove this element from the list which contains it. If this elemen t is
* not currently part of a linked list, this method asserts. * not currently part of a linked list, this method asserts.
*/ */
void remove() void remove() {
{ MOZ_ASSERT(isInList());
MOZ_ASSERT(isInList());
prev->next = next; prev->next = next;
next->prev = prev; next->prev = prev;
next = this; next = this;
prev = this; prev = this;
} }
/* /*
* Return true if |this| part is of a linked list, and false otherwise. * Return true if |this| part is of a linked list, and false otherwise.
*/ */
bool isInList() bool isInList() const {
{ MOZ_ASSERT((next == this) == (prev == this));
MOZ_ASSERT((next == this) == (prev == this)); return next != this;
return next != this;
} }
private: private:
LinkedListElement& operator=(const LinkedList<T>& other) MOZ_DELETE;
LinkedListElement(const LinkedList<T>& other) MOZ_DELETE;
friend class LinkedList<T>; friend class LinkedList<T>;
enum NodeKind { enum NodeKind {
NODE_KIND_NORMAL, NODE_KIND_NORMAL,
NODE_KIND_SENTINEL NODE_KIND_SENTINEL
}; };
LinkedListElement(NodeKind nodeKind) LinkedListElement(NodeKind nodeKind)
: next(this) : next(this),
, prev(this) prev(this),
, isSentinel(nodeKind == NODE_KIND_SENTINEL) isSentinel(nodeKind == NODE_KIND_SENTINEL)
{ {
} }
/* /*
* Return |this| cast to T* if we're a normal node, or return NULL if w e're * Return |this| cast to T* if we're a normal node, or return NULL if w e're
* a sentinel node. * a sentinel node.
*/ */
T* asT() T* asT() {
{ if (isSentinel)
if (isSentinel) return NULL;
return NULL;
return static_cast<T*>(this);
}
const T* asT() const {
if (isSentinel)
return NULL;
return static_cast<T*>(this); return static_cast<const T*>(this);
} }
/* /*
* Insert elem after this element, but don't check that this element is in * Insert elem after this element, but don't check that this element is in
* the list. This is called by LinkedList::insertFront(). * the list. This is called by LinkedList::insertFront().
*/ */
void setNextUnsafe(T* elem) void setNextUnsafe(T* elem) {
{ LinkedListElement *listElem = static_cast<LinkedListElement*>(elem);
LinkedListElement *listElem = static_cast<LinkedListElement*>(elem) MOZ_ASSERT(!listElem->isInList());
;
MOZ_ASSERT(!listElem->isInList()); listElem->next = this->next;
listElem->prev = this;
listElem->next = this->next; this->next->prev = listElem;
listElem->prev = this; this->next = listElem;
this->next->prev = listElem;
this->next = listElem;
} }
/* /*
* Insert elem before this element, but don't check that this element i s in * Insert elem before this element, but don't check that this element i s in
* the list. This is called by LinkedList::insertBack(). * the list. This is called by LinkedList::insertBack().
*/ */
void setPreviousUnsafe(T* elem) void setPreviousUnsafe(T* elem) {
{ LinkedListElement<T>* listElem = static_cast<LinkedListElement<T>*>(e
LinkedListElement<T>* listElem = static_cast<LinkedListElement<T>*> lem);
(elem); MOZ_ASSERT(!listElem->isInList());
MOZ_ASSERT(!listElem->isInList());
listElem->next = this; listElem->next = this;
listElem->prev = this->prev; listElem->prev = this->prev;
this->prev->next = listElem; this->prev->next = listElem;
this->prev = listElem; this->prev = listElem;
} }
private:
LinkedListElement& operator=(const LinkedList<T>& other) MOZ_DELETE;
LinkedListElement(const LinkedList<T>& other) MOZ_DELETE;
}; };
template<typename T> template<typename T>
class LinkedList class LinkedList
{ {
private: private:
LinkedListElement<T> sentinel; LinkedListElement<T> sentinel;
public: public:
LinkedList& operator=(const LinkedList<T>& other) MOZ_DELETE; LinkedList() : sentinel(LinkedListElement<T>::NODE_KIND_SENTINEL) { }
LinkedList(const LinkedList<T>& other) MOZ_DELETE;
LinkedList()
: sentinel(LinkedListElement<T>::NODE_KIND_SENTINEL)
{
}
/* /*
* Add elem to the front of the list. * Add elem to the front of the list.
*/ */
void insertFront(T* elem) void insertFront(T* elem) {
{ /* Bypass setNext()'s this->isInList() assertion. */
/* Bypass setNext()'s this->isInList() assertion. */ sentinel.setNextUnsafe(elem);
sentinel.setNextUnsafe(elem);
} }
/* /*
* Add elem to the back of the list. * Add elem to the back of the list.
*/ */
void insertBack(T* elem) void insertBack(T* elem) {
{ sentinel.setPreviousUnsafe(elem);
sentinel.setPreviousUnsafe(elem);
} }
/* /*
* Get the first element of the list, or NULL if the list is empty. * Get the first element of the list, or NULL if the list is empty.
*/ */
T* getFirst() T* getFirst() {
{ return sentinel.getNext();
return sentinel.getNext(); }
const T* getFirst() const {
return sentinel.getNext();
} }
/* /*
* Get the last element of the list, or NULL if the list is empty. * Get the last element of the list, or NULL if the list is empty.
*/ */
T* getLast() T* getLast() {
{ return sentinel.getPrevious();
return sentinel.getPrevious(); }
const T* getLast() const {
return sentinel.getPrevious();
} }
/* /*
* Get and remove the first element of the list. If the list is empty, * Get and remove the first element of the list. If the list is empty,
* return NULL. * return NULL.
*/ */
T* popFirst() T* popFirst() {
{ T* ret = sentinel.getNext();
T* ret = sentinel.getNext(); if (ret)
if (ret) static_cast<LinkedListElement<T>*>(ret)->remove();
static_cast<LinkedListElement<T>*>(ret)->remove(); return ret;
return ret;
} }
/* /*
* Get and remove the last element of the list. If the list is empty, * Get and remove the last element of the list. If the list is empty,
* return NULL. * return NULL.
*/ */
T* popLast() T* popLast() {
{ T* ret = sentinel.getPrevious();
T* ret = sentinel.getPrevious(); if (ret)
if (ret) static_cast<LinkedListElement<T>*>(ret)->remove();
static_cast<LinkedListElement<T>*>(ret)->remove(); return ret;
return ret;
} }
/* /*
* Return true if the list is empty, or false otherwise. * Return true if the list is empty, or false otherwise.
*/ */
bool isEmpty() bool isEmpty() const {
{ return !sentinel.isInList();
return !sentinel.isInList();
} }
/* /*
* Remove all the elements from the list. * Remove all the elements from the list.
* *
* This runs in time linear to the list's length, because we have to ma rk * This runs in time linear to the list's length, because we have to ma rk
* each element as not in the list. * each element as not in the list.
*/ */
void clear() void clear() {
{ while (popFirst())
while (popFirst()) continue;
continue;
} }
/* /*
* In a debug build, make sure that the list is sane (no cycles, consis tent * In a debug build, make sure that the list is sane (no cycles, consis tent
* next/prev pointers, only one sentinel). Has no effect in release bu ilds. * next/prev pointers, only one sentinel). Has no effect in release bu ilds.
*/ */
void debugAssertIsSane() void debugAssertIsSane() const {
{
#ifdef DEBUG #ifdef DEBUG
/* const LinkedListElement<T>* slow;
* Check for cycles in the forward singly-linked list using the const LinkedListElement<T>* fast1;
* tortoise/hare algorithm. const LinkedListElement<T>* fast2;
*/
for (LinkedListElement<T>* slow = sentinel.next, /*
* fast1 = sentinel.next->next, * Check for cycles in the forward singly-linked list using the
* fast2 = sentinel.next->next->next; * tortoise/hare algorithm.
slow != sentinel && fast1 != sentinel && fast2 != sentinel; */
slow = slow->next, for (slow = sentinel.next,
fast1 = fast2->next, fast1 = sentinel.next->next,
fast2 = fast1->next) { fast2 = sentinel.next->next->next;
slow != sentinel && fast1 != sentinel && fast2 != sentinel;
MOZ_ASSERT(slow != fast1); slow = slow->next, fast1 = fast2->next, fast2 = fast1->next)
MOZ_ASSERT(slow != fast2); {
} MOZ_ASSERT(slow != fast1);
MOZ_ASSERT(slow != fast2);
/* Check for cycles in the backward singly-linked list. */ }
for (LinkedListElement<T>* slow = sentinel.prev,
* fast1 = sentinel.prev->prev, /* Check for cycles in the backward singly-linked list. */
* fast2 = sentinel.prev->prev->prev; for (slow = sentinel.prev,
slow != sentinel && fast1 != sentinel && fast2 != sentinel; fast1 = sentinel.prev->prev,
slow = slow->prev, fast2 = sentinel.prev->prev->prev;
fast1 = fast2->prev, slow != sentinel && fast1 != sentinel && fast2 != sentinel;
fast2 = fast1->prev) { slow = slow->prev, fast1 = fast2->prev, fast2 = fast1->prev)
{
MOZ_ASSERT(slow != fast1); MOZ_ASSERT(slow != fast1);
MOZ_ASSERT(slow != fast2); MOZ_ASSERT(slow != fast2);
} }
/* /*
* Check that |sentinel| is the only node in the list with * Check that |sentinel| is the only node in the list with
* isSentinel == true. * isSentinel == true.
*/ */
for (LinkedListElement<T>* elem = sentinel.next; for (const LinkedListElement<T>* elem = sentinel.next;
elem != sentinel; elem != sentinel;
elem = elem->next) { elem = elem->next)
{
MOZ_ASSERT(!elem->isSentinel); MOZ_ASSERT(!elem->isSentinel);
} }
/* Check that the next/prev pointers match up. */ /* Check that the next/prev pointers match up. */
LinkedListElement<T>* prev = sentinel; const LinkedListElement<T>* prev = sentinel;
LinkedListElement<T>* cur = sentinel.next; const LinkedListElement<T>* cur = sentinel.next;
do { do {
MOZ_ASSERT(cur->prev == prev); MOZ_ASSERT(cur->prev == prev);
MOZ_ASSERT(prev->next == cur); MOZ_ASSERT(prev->next == cur);
prev = cur; prev = cur;
cur = cur->next; cur = cur->next;
} while (cur != sentinel); } while (cur != sentinel);
#endif /* ifdef DEBUG */ #endif /* ifdef DEBUG */
} }
private:
LinkedList& operator=(const LinkedList<T>& other) MOZ_DELETE;
LinkedList(const LinkedList<T>& other) MOZ_DELETE;
}; };
} /* namespace mozilla */ } /* namespace mozilla */
#endif /* ifdef __cplusplus */ #endif /* ifdef __cplusplus */
#endif /* ifdef mozilla_LinkedList_h_ */ #endif /* ifdef mozilla_LinkedList_h_ */
 End of changes. 38 change blocks. 
229 lines changed or deleted 171 lines changed or added


 MemoryMetrics.h   MemoryMetrics.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is about:memory glue.
*
* The Initial Developer of the Original Code is
* Ms2ger <ms2ger@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef js_MemoryMetrics_h #ifndef js_MemoryMetrics_h
#define js_MemoryMetrics_h #define js_MemoryMetrics_h
/* /*
* These declarations are not within jsapi.h because they are highly likely * These declarations are not within jsapi.h because they are highly likely
* to change in the future. Depend on them at your own risk. * to change in the future. Depend on them at your own risk.
*/ */
#include <string.h> #include <string.h>
skipping to change at line 65 skipping to change at line 33
namespace JS { namespace JS {
/* Data for tracking analysis/inference memory usage. */ /* Data for tracking analysis/inference memory usage. */
struct TypeInferenceSizes struct TypeInferenceSizes
{ {
size_t scripts; size_t scripts;
size_t objects; size_t objects;
size_t tables; size_t tables;
size_t temporary; size_t temporary;
void add(TypeInferenceSizes &sizes) {
this->scripts += sizes.scripts;
this->objects += sizes.objects;
this->tables += sizes.tables;
this->temporary += sizes.temporary;
}
};
// These measurements relate directly to the JSRuntime, and not to
// compartments within it.
struct RuntimeSizes
{
RuntimeSizes()
: object(0)
, atomsTable(0)
, contexts(0)
, dtoa(0)
, temporary(0)
, mjitCode(0)
, regexpCode(0)
, unusedCodeMemory(0)
, stackCommitted(0)
, gcMarker(0)
, mathCache(0)
, scriptFilenames(0)
, scriptSources(0)
, compartmentObjects(0)
{}
size_t object;
size_t atomsTable;
size_t contexts;
size_t dtoa;
size_t temporary;
size_t mjitCode;
size_t regexpCode;
size_t unusedCodeMemory;
size_t stackCommitted;
size_t gcMarker;
size_t mathCache;
size_t scriptFilenames;
size_t scriptSources;
// This is the exception to the "RuntimeSizes doesn't measure things wi
thin
// compartments" rule. We combine the sizes of all the JSCompartment
// objects into a single measurement because each one is fairly small,
and
// they're all the same size.
size_t compartmentObjects;
}; };
struct CompartmentStats struct CompartmentStats
{ {
CompartmentStats() { CompartmentStats() {
memset(this, 0, sizeof(*this)); memset(this, 0, sizeof(*this));
} }
void *extra; // These fields can be used by embedders.
size_t gcHeapArenaHeaders; void *extra1;
size_t gcHeapArenaPadding; void *extra2;
size_t gcHeapArenaUnused;
// If you add a new number, remember to update add() and maybe
// gcHeapThingsSize()!
size_t gcHeapArenaAdmin;
size_t gcHeapUnusedGcThings;
size_t gcHeapObjectsNonFunction; size_t gcHeapObjectsNonFunction;
size_t gcHeapObjectsFunction; size_t gcHeapObjectsFunction;
size_t gcHeapStrings; size_t gcHeapStrings;
size_t gcHeapShapesTree; size_t gcHeapShapesTree;
size_t gcHeapShapesDict; size_t gcHeapShapesDict;
size_t gcHeapShapesBase; size_t gcHeapShapesBase;
size_t gcHeapScripts; size_t gcHeapScripts;
size_t gcHeapTypeObjects; size_t gcHeapTypeObjects;
#if JS_HAS_XML_SUPPORT
size_t gcHeapXML; size_t gcHeapXML;
#endif
size_t objectSlots; size_t objectSlots;
size_t objectElements; size_t objectElements;
size_t objectMisc; size_t objectMisc;
size_t objectPrivate;
size_t stringChars; size_t stringChars;
size_t shapesExtraTreeTables; size_t shapesExtraTreeTables;
size_t shapesExtraDictTables; size_t shapesExtraDictTables;
size_t shapesExtraTreeShapeKids; size_t shapesExtraTreeShapeKids;
size_t shapesCompartmentTables; size_t shapesCompartmentTables;
size_t scriptData; size_t scriptData;
#ifdef JS_METHODJIT
size_t mjitCode;
size_t mjitData; size_t mjitData;
#endif size_t crossCompartmentWrappers;
TypeInferenceSizes typeInferenceSizes; TypeInferenceSizes typeInferenceSizes;
// Add cStats's numbers to this object's numbers.
void add(CompartmentStats &cStats) {
#define ADD(x) this->x += cStats.x
ADD(gcHeapArenaAdmin);
ADD(gcHeapUnusedGcThings);
ADD(gcHeapObjectsNonFunction);
ADD(gcHeapObjectsFunction);
ADD(gcHeapStrings);
ADD(gcHeapShapesTree);
ADD(gcHeapShapesDict);
ADD(gcHeapShapesBase);
ADD(gcHeapScripts);
ADD(gcHeapTypeObjects);
#if JS_HAS_XML_SUPPORT
ADD(gcHeapXML);
#endif
ADD(objectSlots);
ADD(objectElements);
ADD(objectMisc);
ADD(objectPrivate);
ADD(stringChars);
ADD(shapesExtraTreeTables);
ADD(shapesExtraDictTables);
ADD(shapesExtraTreeShapeKids);
ADD(shapesCompartmentTables);
ADD(scriptData);
ADD(mjitData);
ADD(crossCompartmentWrappers);
#undef ADD
typeInferenceSizes.add(cStats.typeInferenceSizes);
}
// The size of all the live things in the GC heap.
size_t gcHeapThingsSize();
}; };
struct RuntimeStats struct RuntimeStats
{ {
RuntimeStats(JSMallocSizeOfFun mallocSizeOf) RuntimeStats(JSMallocSizeOfFun mallocSizeOf)
: runtimeObject(0) : runtime()
, runtimeAtomsTable(0)
, runtimeContexts(0)
, runtimeNormal(0)
, runtimeTemporary(0)
, runtimeRegexpCode(0)
, runtimeStackCommitted(0)
, runtimeGCMarker(0)
, gcHeapChunkTotal(0) , gcHeapChunkTotal(0)
, gcHeapChunkCleanUnused(0) , gcHeapDecommittedArenas(0)
, gcHeapChunkDirtyUnused(0) , gcHeapUnusedChunks(0)
, gcHeapChunkCleanDecommitted(0) , gcHeapUnusedArenas(0)
, gcHeapChunkDirtyDecommitted(0) , gcHeapUnusedGcThings(0)
, gcHeapArenaUnused(0)
, gcHeapChunkAdmin(0) , gcHeapChunkAdmin(0)
, gcHeapUnusedPercentage(0) , gcHeapGcThings(0)
, totalObjects(0) , totals()
, totalShapes(0)
, totalScripts(0)
, totalStrings(0)
#ifdef JS_METHODJIT
, totalMjit(0)
#endif
, totalTypeInference(0)
, totalAnalysisTemp(0)
, compartmentStatsVector() , compartmentStatsVector()
, currCompartmentStats(NULL) , currCompartmentStats(NULL)
, mallocSizeOf(mallocSizeOf) , mallocSizeOf(mallocSizeOf)
{} {}
size_t runtimeObject; RuntimeSizes runtime;
size_t runtimeAtomsTable;
size_t runtimeContexts; // If you add a new number, remember to update the constructor!
size_t runtimeNormal;
size_t runtimeTemporary; // Here's a useful breakdown of the GC heap.
size_t runtimeRegexpCode; //
size_t runtimeStackCommitted; // - rtStats.gcHeapChunkTotal
size_t runtimeGCMarker; // - decommitted bytes
// - rtStats.gcHeapDecommittedArenas (decommitted arenas in non-emp
ty chunks)
// - unused bytes
// - rtStats.gcHeapUnusedChunks (empty chunks)
// - rtStats.gcHeapUnusedArenas (empty arenas within non-empty chun
ks)
// - rtStats.total.gcHeapUnusedGcThings (empty GC thing slots withi
n non-empty arenas)
// - used bytes
// - rtStats.gcHeapChunkAdmin
// - rtStats.total.gcHeapArenaAdmin
// - rtStats.gcHeapGcThings (in-use GC things)
//
// It's possible that some arenas in empty chunks may be decommitted, b
ut
// we don't count those under rtStats.gcHeapDecommittedArenas because (
a)
// it's rare, and (b) this means that rtStats.gcHeapUnusedChunks is a
// multiple of the chunk size, which is good.
size_t gcHeapChunkTotal; size_t gcHeapChunkTotal;
size_t gcHeapChunkCleanUnused; size_t gcHeapDecommittedArenas;
size_t gcHeapChunkDirtyUnused; size_t gcHeapUnusedChunks;
size_t gcHeapChunkCleanDecommitted; size_t gcHeapUnusedArenas;
size_t gcHeapChunkDirtyDecommitted; size_t gcHeapUnusedGcThings;
size_t gcHeapArenaUnused;
size_t gcHeapChunkAdmin; size_t gcHeapChunkAdmin;
size_t gcHeapUnusedPercentage; size_t gcHeapGcThings;
size_t totalObjects;
size_t totalShapes; // The sum of all compartment's measurements.
size_t totalScripts; CompartmentStats totals;
size_t totalStrings;
#ifdef JS_METHODJIT
size_t totalMjit;
#endif
size_t totalTypeInference;
size_t totalAnalysisTemp;
js::Vector<CompartmentStats, 0, js::SystemAllocPolicy> compartmentStats Vector; js::Vector<CompartmentStats, 0, js::SystemAllocPolicy> compartmentStats Vector;
CompartmentStats *currCompartmentStats; CompartmentStats *currCompartmentStats;
JSMallocSizeOfFun mallocSizeOf; JSMallocSizeOfFun mallocSizeOf;
virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentSta ts *cstats) = 0; virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentSta ts *cstats) = 0;
}; };
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
class ObjectPrivateVisitor
{
public:
// Within CollectRuntimeStats, this method is called for each JS object
// that has a private slot containing an nsISupports pointer.
virtual size_t sizeOfIncludingThis(void *aSupports) = 0;
};
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats); CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisi tor *opv);
extern JS_PUBLIC_API(int64_t) extern JS_PUBLIC_API(int64_t)
GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf) ; GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf) ;
#endif /* JS_THREADSAFE */ #endif /* JS_THREADSAFE */
extern JS_PUBLIC_API(size_t) extern JS_PUBLIC_API(size_t)
SystemCompartmentCount(const JSRuntime *rt); SystemCompartmentCount(const JSRuntime *rt);
extern JS_PUBLIC_API(size_t) extern JS_PUBLIC_API(size_t)
 End of changes. 17 change blocks. 
98 lines changed or deleted 159 lines changed or added


 RangedPtr.h   RangedPtr.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Walden <jwalden+code@mit.edu> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
* Implements a smart pointer asserted to remain within a range specified a t * Implements a smart pointer asserted to remain within a range specified a t
* construction. * construction.
*/ */
#ifndef mozilla_RangedPtr_h_ #ifndef mozilla_RangedPtr_h_
#define mozilla_RangedPtr_h_ #define mozilla_RangedPtr_h_
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
skipping to change at line 74 skipping to change at line 39
* In theory passing a smart pointer instance as an argument can be slightl y * In theory passing a smart pointer instance as an argument can be slightl y
* slower than passing a T* (due to ABI requirements for passing structs ve rsus * slower than passing a T* (due to ABI requirements for passing structs ve rsus
* passing pointers), if the method being called isn't inlined. If you are in * passing pointers), if the method being called isn't inlined. If you are in
* extremely performance-critical code, you may want to be careful using th is * extremely performance-critical code, you may want to be careful using th is
* smart pointer as an argument type. * smart pointer as an argument type.
* *
* RangedPtr<T> intentionally does not implicitly convert to T*. Use get() to * RangedPtr<T> intentionally does not implicitly convert to T*. Use get() to
* explicitly convert to T*. Keep in mind that the raw pointer of course w on't * explicitly convert to T*. Keep in mind that the raw pointer of course w on't
* implement bounds checking in debug builds. * implement bounds checking in debug builds.
*/ */
template <typename T> template<typename T>
class RangedPtr class RangedPtr
{ {
T* ptr; T* ptr;
#ifdef DEBUG #ifdef DEBUG
T* const rangeStart; T* const rangeStart;
T* const rangeEnd; T* const rangeEnd;
#endif #endif
void checkSanity() { void checkSanity() {
MOZ_ASSERT(rangeStart <= ptr); MOZ_ASSERT(rangeStart <= ptr);
MOZ_ASSERT(ptr <= rangeEnd); MOZ_ASSERT(ptr <= rangeEnd);
} }
/* Creates a new pointer for |ptr|, restricted to this pointer's range. */ /* Creates a new pointer for |ptr|, restricted to this pointer's range. */
RangedPtr<T> create(T *ptr) const { RangedPtr<T> create(T *ptr) const {
#ifdef DEBUG #ifdef DEBUG
return RangedPtr<T>(ptr, rangeStart, rangeEnd); return RangedPtr<T>(ptr, rangeStart, rangeEnd);
#else #else
return RangedPtr<T>(ptr, NULL, size_t(0)); return RangedPtr<T>(ptr, NULL, size_t(0));
#endif #endif
} }
public: public:
RangedPtr(T* p, T* start, T* end) RangedPtr(T* p, T* start, T* end)
: ptr(p) : ptr(p)
#ifdef DEBUG #ifdef DEBUG
, rangeStart(start), rangeEnd(end) , rangeStart(start), rangeEnd(end)
#endif #endif
{ {
MOZ_ASSERT(rangeStart <= rangeEnd); MOZ_ASSERT(rangeStart <= rangeEnd);
checkSanity(); checkSanity();
} }
RangedPtr(T* p, T* start, size_t length) RangedPtr(T* p, T* start, size_t length)
: ptr(p) : ptr(p)
#ifdef DEBUG #ifdef DEBUG
, rangeStart(start), rangeEnd(start + length) , rangeStart(start), rangeEnd(start + length)
#endif #endif
{ {
MOZ_ASSERT(length <= size_t(-1) / sizeof(T)); MOZ_ASSERT(length <= size_t(-1) / sizeof(T));
MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t( MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t(ra
rangeStart)); ngeStart));
checkSanity(); checkSanity();
} }
/* Equivalent to RangedPtr(p, p, length). */ /* Equivalent to RangedPtr(p, p, length). */
RangedPtr(T* p, size_t length) RangedPtr(T* p, size_t length)
: ptr(p) : ptr(p)
#ifdef DEBUG #ifdef DEBUG
, rangeStart(p), rangeEnd(p + length) , rangeStart(p), rangeEnd(p + length)
#endif #endif
{ {
MOZ_ASSERT(length <= size_t(-1) / sizeof(T)); MOZ_ASSERT(length <= size_t(-1) / sizeof(T));
MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t( MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t(ra
rangeStart)); ngeStart));
checkSanity(); checkSanity();
} }
/* Equivalent to RangedPtr(arr, arr, N). */ /* Equivalent to RangedPtr(arr, arr, N). */
template<size_t N> template<size_t N>
RangedPtr(T arr[N]) RangedPtr(T arr[N])
: ptr(arr) : ptr(arr)
#ifdef DEBUG #ifdef DEBUG
, rangeStart(arr), rangeEnd(arr + N) , rangeStart(arr), rangeEnd(arr + N)
#endif #endif
{ {
checkSanity(); checkSanity();
} }
T* get() const { T* get() const {
return ptr; return ptr;
} }
/* /*
* You can only assign one RangedPtr into another if the two pointers h ave * You can only assign one RangedPtr into another if the two pointers h ave
* the same valid range: * the same valid range:
* *
* char arr1[] = "hi"; * char arr1[] = "hi";
* char arr2[] = "bye"; * char arr2[] = "bye";
* RangedPtr<char> p1(arr1, 2); * RangedPtr<char> p1(arr1, 2);
* p1 = RangedPtr<char>(arr1 + 1, arr1, arr1 + 2); // works * p1 = RangedPtr<char>(arr1 + 1, arr1, arr1 + 2); // works
* p1 = RangedPtr<char>(arr2, 3); // asserts * p1 = RangedPtr<char>(arr2, 3); // asserts
*/ */
RangedPtr<T>& operator=(const RangedPtr<T>& other) { RangedPtr<T>& operator=(const RangedPtr<T>& other) {
MOZ_ASSERT(rangeStart == other.rangeStart); MOZ_ASSERT(rangeStart == other.rangeStart);
MOZ_ASSERT(rangeEnd == other.rangeEnd); MOZ_ASSERT(rangeEnd == other.rangeEnd);
ptr = other.ptr; ptr = other.ptr;
checkSanity(); checkSanity();
return *this; return *this;
} }
RangedPtr<T> operator+(size_t inc) { RangedPtr<T> operator+(size_t inc) {
MOZ_ASSERT(inc <= size_t(-1) / sizeof(T)); MOZ_ASSERT(inc <= size_t(-1) / sizeof(T));
MOZ_ASSERT(ptr + inc > ptr); MOZ_ASSERT(ptr + inc > ptr);
return create(ptr + inc); return create(ptr + inc);
} }
RangedPtr<T> operator-(size_t dec) { RangedPtr<T> operator-(size_t dec) {
MOZ_ASSERT(dec <= size_t(-1) / sizeof(T)); MOZ_ASSERT(dec <= size_t(-1) / sizeof(T));
MOZ_ASSERT(ptr - dec < ptr); MOZ_ASSERT(ptr - dec < ptr);
return create(ptr - dec); return create(ptr - dec);
} }
/* /*
* You can assign a raw pointer into a RangedPtr if the raw pointer is * You can assign a raw pointer into a RangedPtr if the raw pointer is
* within the range specified at creation. * within the range specified at creation.
*/ */
template <typename U> template <typename U>
RangedPtr<T>& operator=(U* p) { RangedPtr<T>& operator=(U* p) {
*this = create(p); *this = create(p);
return *this; return *this;
} }
template <typename U> template <typename U>
RangedPtr<T>& operator=(const RangedPtr<U>& p) { RangedPtr<T>& operator=(const RangedPtr<U>& p) {
MOZ_ASSERT(rangeStart <= p.ptr); MOZ_ASSERT(rangeStart <= p.ptr);
MOZ_ASSERT(p.ptr <= rangeEnd); MOZ_ASSERT(p.ptr <= rangeEnd);
ptr = p.ptr; ptr = p.ptr;
checkSanity(); checkSanity();
return *this; return *this;
} }
RangedPtr<T>& operator++() { RangedPtr<T>& operator++() {
return (*this += 1); return (*this += 1);
} }
RangedPtr<T> operator++(int) { RangedPtr<T> operator++(int) {
RangedPtr<T> rcp = *this; RangedPtr<T> rcp = *this;
++*this; ++*this;
return rcp; return rcp;
} }
RangedPtr<T>& operator--() { RangedPtr<T>& operator--() {
return (*this -= 1); return (*this -= 1);
} }
RangedPtr<T> operator--(int) { RangedPtr<T> operator--(int) {
RangedPtr<T> rcp = *this; RangedPtr<T> rcp = *this;
--*this; --*this;
return rcp; return rcp;
} }
RangedPtr<T>& operator+=(size_t inc) { RangedPtr<T>& operator+=(size_t inc) {
this->operator=<T>(*this + inc); *this = *this + inc;
return *this; return *this;
} }
RangedPtr<T>& operator-=(size_t dec) { RangedPtr<T>& operator-=(size_t dec) {
this->operator=<T>(*this - dec); *this = *this - dec;
return *this; return *this;
} }
T& operator[](int index) const { T& operator[](int index) const {
MOZ_ASSERT(size_t(index > 0 ? index : -index) <= size_t(-1) / sizeo MOZ_ASSERT(size_t(index > 0 ? index : -index) <= size_t(-1) / sizeof(
f(T)); T));
return *create(ptr + index); return *create(ptr + index);
} }
T& operator*() const { T& operator*() const {
return *ptr; return *ptr;
} }
template <typename U> template <typename U>
bool operator==(const RangedPtr<U>& other) const { bool operator==(const RangedPtr<U>& other) const {
return ptr == other.ptr; return ptr == other.ptr;
} }
template <typename U> template <typename U>
bool operator!=(const RangedPtr<U>& other) const { bool operator!=(const RangedPtr<U>& other) const {
return !(*this == other); return !(*this == other);
} }
template<typename U> template<typename U>
bool operator==(const U* u) const { bool operator==(const U* u) const {
return ptr == u; return ptr == u;
} }
template<typename U> template<typename U>
bool operator!=(const U* u) const { bool operator!=(const U* u) const {
return !(*this == u); return !(*this == u);
} }
template <typename U> template <typename U>
bool operator<(const RangedPtr<U>& other) const { bool operator<(const RangedPtr<U>& other) const {
return ptr < other.ptr; return ptr < other.ptr;
} }
template <typename U> template <typename U>
bool operator<=(const RangedPtr<U>& other) const { bool operator<=(const RangedPtr<U>& other) const {
return ptr <= other.ptr; return ptr <= other.ptr;
} }
template <typename U> template <typename U>
bool operator>(const RangedPtr<U>& other) const { bool operator>(const RangedPtr<U>& other) const {
return ptr > other.ptr; return ptr > other.ptr;
} }
template <typename U> template <typename U>
bool operator>=(const RangedPtr<U>& other) const { bool operator>=(const RangedPtr<U>& other) const {
return ptr >= other.ptr; return ptr >= other.ptr;
} }
size_t operator-(const RangedPtr<T>& other) const { size_t operator-(const RangedPtr<T>& other) const {
MOZ_ASSERT(ptr >= other.ptr); MOZ_ASSERT(ptr >= other.ptr);
return PointerRangeSize(other.ptr, ptr); return PointerRangeSize(other.ptr, ptr);
} }
private: private:
RangedPtr() MOZ_DELETE; RangedPtr() MOZ_DELETE;
T* operator&() MOZ_DELETE; T* operator&() MOZ_DELETE;
operator T*() const MOZ_DELETE; operator T*() const MOZ_DELETE;
}; };
} /* namespace mozilla */ } /* namespace mozilla */
 End of changes. 31 change blocks. 
108 lines changed or deleted 65 lines changed or added


 RefPtr.h   RefPtr.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Helpers for defining and using refcounted objects. */ /* Helpers for defining and using refcounted objects. */
#ifndef mozilla_RefPtr_h_ #ifndef mozilla_RefPtr_h_
#define mozilla_RefPtr_h_ #define mozilla_RefPtr_h_
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
namespace mozilla { namespace mozilla {
skipping to change at line 83 skipping to change at line 48
* to 0, the RefCounted<T> "dies" and is destroyed. The "destroyed" * to 0, the RefCounted<T> "dies" and is destroyed. The "destroyed"
* state is represented in DEBUG builds by refcount==-0xdead. This * state is represented in DEBUG builds by refcount==-0xdead. This
* state distinguishes use-before-ref (refcount==0) from * state distinguishes use-before-ref (refcount==0) from
* use-after-destroy (refcount==-0xdead). * use-after-destroy (refcount==-0xdead).
*/ */
template<typename T> template<typename T>
class RefCounted class RefCounted
{ {
friend class RefPtr<T>; friend class RefPtr<T>;
public: public:
RefCounted() : refCnt(0) { } RefCounted() : refCnt(0) { }
~RefCounted() { MOZ_ASSERT(refCnt == -0xdead); } ~RefCounted() { MOZ_ASSERT(refCnt == -0xdead); }
// Compatibility with nsRefPtr. // Compatibility with nsRefPtr.
void AddRef() { void AddRef() {
MOZ_ASSERT(refCnt >= 0); MOZ_ASSERT(refCnt >= 0);
++refCnt; ++refCnt;
} }
void Release() { void Release() {
MOZ_ASSERT(refCnt > 0); MOZ_ASSERT(refCnt > 0);
if (0 == --refCnt) { if (0 == --refCnt) {
#ifdef DEBUG #ifdef DEBUG
refCnt = -0xdead; refCnt = -0xdead;
#endif #endif
delete static_cast<T*>(this); delete static_cast<T*>(this);
} }
} }
// Compatibility with wtf::RefPtr. // Compatibility with wtf::RefPtr.
void ref() { AddRef(); } void ref() { AddRef(); }
void deref() { Release(); } void deref() { Release(); }
int refCount() const { return refCnt; } int refCount() const { return refCnt; }
bool hasOneRef() const { bool hasOneRef() const {
MOZ_ASSERT(refCnt > 0); MOZ_ASSERT(refCnt > 0);
return refCnt == 1; return refCnt == 1;
} }
private: private:
int refCnt; int refCnt;
}; };
/** /**
* RefPtr points to a refcounted thing that has AddRef and Release * RefPtr points to a refcounted thing that has AddRef and Release
* methods to increase/decrease the refcount, respectively. After a * methods to increase/decrease the refcount, respectively. After a
* RefPtr<T> is assigned a T*, the T* can be used through the RefPtr * RefPtr<T> is assigned a T*, the T* can be used through the RefPtr
* as if it were a T*. * as if it were a T*.
* *
* A RefPtr can forget its underlying T*, which results in the T* * A RefPtr can forget its underlying T*, which results in the T*
* being wrapped in a temporary object until the T* is either * being wrapped in a temporary object until the T* is either
* re-adopted from or released by the temporary. * re-adopted from or released by the temporary.
*/ */
template<typename T> template<typename T>
class RefPtr class RefPtr
{ {
// To allow them to use unref() // To allow them to use unref()
friend class TemporaryRef<T>; friend class TemporaryRef<T>;
friend class OutParamRef<T>; friend class OutParamRef<T>;
struct dontRef {}; struct DontRef {};
public: public:
RefPtr() : ptr(0) { } RefPtr() : ptr(0) { }
RefPtr(const RefPtr& o) : ptr(ref(o.ptr)) {} RefPtr(const RefPtr& o) : ptr(ref(o.ptr)) {}
RefPtr(const TemporaryRef<T>& o) : ptr(o.drop()) {} RefPtr(const TemporaryRef<T>& o) : ptr(o.drop()) {}
RefPtr(T* t) : ptr(ref(t)) {} RefPtr(T* t) : ptr(ref(t)) {}
template<typename U> template<typename U>
RefPtr(const RefPtr<U>& o) : ptr(ref(o.get())) {} RefPtr(const RefPtr<U>& o) : ptr(ref(o.get())) {}
~RefPtr() { unref(ptr); } ~RefPtr() { unref(ptr); }
RefPtr& operator=(const RefPtr& o) { RefPtr& operator=(const RefPtr& o) {
assign(ref(o.ptr)); assign(ref(o.ptr));
return *this; return *this;
} }
RefPtr& operator=(const TemporaryRef<T>& o) { RefPtr& operator=(const TemporaryRef<T>& o) {
assign(o.drop()); assign(o.drop());
return *this; return *this;
} }
RefPtr& operator=(T* t) { RefPtr& operator=(T* t) {
assign(ref(t)); assign(ref(t));
return *this; return *this;
} }
template<typename U> template<typename U>
RefPtr& operator=(const RefPtr<U>& o) { RefPtr& operator=(const RefPtr<U>& o) {
assign(ref(o.get())); assign(ref(o.get()));
return *this; return *this;
} }
TemporaryRef<T> forget() { TemporaryRef<T> forget() {
T* tmp = ptr; T* tmp = ptr;
ptr = 0; ptr = 0;
return TemporaryRef<T>(tmp, dontRef()); return TemporaryRef<T>(tmp, DontRef());
} }
T* get() const { return ptr; } T* get() const { return ptr; }
operator T*() const { return ptr; } operator T*() const { return ptr; }
T* operator->() const { return ptr; } T* operator->() const { return ptr; }
T& operator*() const { return *ptr; } T& operator*() const { return *ptr; }
template<typename U> template<typename U>
operator TemporaryRef<U>() { return TemporaryRef<U>(ptr); } operator TemporaryRef<U>() { return TemporaryRef<U>(ptr); }
private: private:
void assign(T* t) { void assign(T* t) {
unref(ptr); unref(ptr);
ptr = t; ptr = t;
} }
T* ptr; T* ptr;
static MOZ_ALWAYS_INLINE T* ref(T* t) { static MOZ_ALWAYS_INLINE T* ref(T* t) {
if (t) { if (t)
t->AddRef(); t->AddRef();
} return t;
return t;
} }
static MOZ_ALWAYS_INLINE void unref(T* t) { static MOZ_ALWAYS_INLINE void unref(T* t) {
if (t) { if (t)
t->Release(); t->Release();
}
} }
}; };
/** /**
* TemporaryRef<T> represents an object that holds a temporary * TemporaryRef<T> represents an object that holds a temporary
* reference to a T. TemporaryRef objects can't be manually ref'd or * reference to a T. TemporaryRef objects can't be manually ref'd or
* unref'd (being temporaries, not lvalues), so can only relinquish * unref'd (being temporaries, not lvalues), so can only relinquish
* references to other objects, or unref on destruction. * references to other objects, or unref on destruction.
*/ */
template<typename T> template<typename T>
class TemporaryRef class TemporaryRef
{ {
// To allow it to construct TemporaryRef from a bare T* // To allow it to construct TemporaryRef from a bare T*
friend class RefPtr<T>; friend class RefPtr<T>;
typedef typename RefPtr<T>::dontRef dontRef; typedef typename RefPtr<T>::DontRef DontRef;
public: public:
TemporaryRef(T* t) : ptr(RefPtr<T>::ref(t)) {} TemporaryRef(T* t) : ptr(RefPtr<T>::ref(t)) {}
TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {} TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {}
template<typename U> template<typename U>
TemporaryRef(const TemporaryRef<U>& o) : ptr(o.drop()) {} TemporaryRef(const TemporaryRef<U>& o) : ptr(o.drop()) {}
~TemporaryRef() { RefPtr<T>::unref(ptr); } ~TemporaryRef() { RefPtr<T>::unref(ptr); }
T* drop() const { T* drop() const {
T* tmp = ptr; T* tmp = ptr;
ptr = 0; ptr = 0;
return tmp; return tmp;
} }
private: private:
TemporaryRef(T* t, const dontRef&) : ptr(t) {} TemporaryRef(T* t, const DontRef&) : ptr(t) {}
mutable T* ptr; mutable T* ptr;
TemporaryRef(); TemporaryRef() MOZ_DELETE;
TemporaryRef& operator=(const TemporaryRef&); void operator=(const TemporaryRef&) MOZ_DELETE;
}; };
/** /**
* OutParamRef is a wrapper that tracks a refcounted pointer passed as * OutParamRef is a wrapper that tracks a refcounted pointer passed as
* an outparam argument to a function. OutParamRef implements COM T** * an outparam argument to a function. OutParamRef implements COM T**
* outparam semantics: this requires the callee to AddRef() the T* * outparam semantics: this requires the callee to AddRef() the T*
* returned through the T** outparam on behalf of the caller. This * returned through the T** outparam on behalf of the caller. This
* means the caller (through OutParamRef) must Release() the old * means the caller (through OutParamRef) must Release() the old
* object contained in the tracked RefPtr. It's OK if the callee * object contained in the tracked RefPtr. It's OK if the callee
* returns the same T* passed to it through the T** outparam, as long * returns the same T* passed to it through the T** outparam, as long
skipping to change at line 257 skipping to change at line 220
* *
* Prefer returning TemporaryRef<T> from functions over creating T** * Prefer returning TemporaryRef<T> from functions over creating T**
* outparams and passing OutParamRef<T> to T**. Prefer RefPtr<T>* * outparams and passing OutParamRef<T> to T**. Prefer RefPtr<T>*
* outparams over T** outparams. * outparams over T** outparams.
*/ */
template<typename T> template<typename T>
class OutParamRef class OutParamRef
{ {
friend OutParamRef byRef<T>(RefPtr<T>&); friend OutParamRef byRef<T>(RefPtr<T>&);
public: public:
~OutParamRef() { ~OutParamRef() {
RefPtr<T>::unref(refPtr.ptr); RefPtr<T>::unref(refPtr.ptr);
refPtr.ptr = tmp; refPtr.ptr = tmp;
} }
operator T**() { return &tmp; } operator T**() { return &tmp; }
private: private:
OutParamRef(RefPtr<T>& p) : refPtr(p), tmp(p.get()) {} OutParamRef(RefPtr<T>& p) : refPtr(p), tmp(p.get()) {}
RefPtr<T>& refPtr; RefPtr<T>& refPtr;
T* tmp; T* tmp;
OutParamRef() MOZ_DELETE; OutParamRef() MOZ_DELETE;
OutParamRef& operator=(const OutParamRef&) MOZ_DELETE; OutParamRef& operator=(const OutParamRef&) MOZ_DELETE;
}; };
/** /**
* byRef cooperates with OutParamRef to implement COM outparam semantics. * byRef cooperates with OutParamRef to implement COM outparam semantics.
*/ */
template<typename T> template<typename T>
OutParamRef<T> OutParamRef<T>
byRef(RefPtr<T>& ptr) byRef(RefPtr<T>& ptr)
{ {
return OutParamRef<T>(ptr); return OutParamRef<T>(ptr);
} }
} // namespace mozilla } // namespace mozilla
#endif // mozilla_RefPtr_h_ #endif // mozilla_RefPtr_h_
#if 0 #if 0
// Command line that builds these tests // Command line that builds these tests
// //
// cp RefPtr.h test.cc && g++ -g -Wall -pedantic -DDEBUG -o test test.cc && ./test // cp RefPtr.h test.cc && g++ -g -Wall -pedantic -DDEBUG -o test test.cc && ./test
using namespace mozilla; using namespace mozilla;
struct Foo : public RefCounted<Foo> struct Foo : public RefCounted<Foo>
{ {
Foo() : dead(false) { } Foo() : dead(false) { }
~Foo() { ~Foo() {
MOZ_ASSERT(!dead); MOZ_ASSERT(!dead);
dead = true; dead = true;
numDestroyed++; numDestroyed++;
} }
bool dead; bool dead;
static int numDestroyed; static int numDestroyed;
}; };
int Foo::numDestroyed; int Foo::numDestroyed;
struct Bar : public Foo { }; struct Bar : public Foo { };
TemporaryRef<Foo> TemporaryRef<Foo>
NewFoo() NewFoo()
{ {
return RefPtr<Foo>(new Foo()); return RefPtr<Foo>(new Foo());
} }
TemporaryRef<Foo> TemporaryRef<Foo>
NewBar() NewBar()
{ {
return new Bar(); return new Bar();
} }
void void
GetNewFoo(Foo** f) GetNewFoo(Foo** f)
{ {
*f = new Bar(); *f = new Bar();
// Kids, don't try this at home // Kids, don't try this at home
(*f)->AddRef(); (*f)->AddRef();
} }
void void
GetPassedFoo(Foo** f) GetPassedFoo(Foo** f)
{ {
// Kids, don't try this at home // Kids, don't try this at home
(*f)->AddRef(); (*f)->AddRef();
} }
void void
GetNewFoo(RefPtr<Foo>* f) GetNewFoo(RefPtr<Foo>* f)
{ {
*f = new Bar(); *f = new Bar();
} }
void void
GetPassedFoo(RefPtr<Foo>* f) GetPassedFoo(RefPtr<Foo>* f)
{} {}
TemporaryRef<Foo> TemporaryRef<Foo>
GetNullFoo() GetNullFoo()
{ {
return 0; return 0;
} }
int int
main(int argc, char** argv) main(int argc, char** argv)
{ {
// This should blow up // This should blow up
// Foo* f = new Foo(); delete f; // Foo* f = new Foo(); delete f;
MOZ_ASSERT(0 == Foo::numDestroyed); MOZ_ASSERT(0 == Foo::numDestroyed);
{ {
RefPtr<Foo> f = new Foo(); RefPtr<Foo> f = new Foo();
MOZ_ASSERT(f->refCount() == 1); MOZ_ASSERT(f->refCount() == 1);
} }
MOZ_ASSERT(1 == Foo::numDestroyed);
{
RefPtr<Foo> f1 = NewFoo();
RefPtr<Foo> f2(NewFoo());
MOZ_ASSERT(1 == Foo::numDestroyed); MOZ_ASSERT(1 == Foo::numDestroyed);
}
MOZ_ASSERT(3 == Foo::numDestroyed);
{ {
RefPtr<Foo> f1 = NewFoo(); RefPtr<Foo> b = NewBar();
RefPtr<Foo> f2(NewFoo());
MOZ_ASSERT(1 == Foo::numDestroyed);
}
MOZ_ASSERT(3 == Foo::numDestroyed); MOZ_ASSERT(3 == Foo::numDestroyed);
}
MOZ_ASSERT(4 == Foo::numDestroyed);
{
RefPtr<Foo> f1;
{ {
RefPtr<Foo> b = NewBar(); f1 = new Foo();
MOZ_ASSERT(3 == Foo::numDestroyed); RefPtr<Foo> f2(f1);
RefPtr<Foo> f3 = f2;
MOZ_ASSERT(4 == Foo::numDestroyed);
} }
MOZ_ASSERT(4 == Foo::numDestroyed); MOZ_ASSERT(4 == Foo::numDestroyed);
}
MOZ_ASSERT(5 == Foo::numDestroyed);
{ {
RefPtr<Foo> f1; RefPtr<Foo> f = new Foo();
{ f.forget();
f1 = new Foo(); MOZ_ASSERT(6 == Foo::numDestroyed);
RefPtr<Foo> f2(f1); }
RefPtr<Foo> f3 = f2;
MOZ_ASSERT(4 == Foo::numDestroyed); {
} RefPtr<Foo> f = new Foo();
MOZ_ASSERT(4 == Foo::numDestroyed); GetNewFoo(byRef(f));
} MOZ_ASSERT(7 == Foo::numDestroyed);
MOZ_ASSERT(5 == Foo::numDestroyed); }
MOZ_ASSERT(8 == Foo::numDestroyed);
{
RefPtr<Foo> f = new Foo(); {
f.forget(); RefPtr<Foo> f = new Foo();
MOZ_ASSERT(6 == Foo::numDestroyed); GetPassedFoo(byRef(f));
}
{
RefPtr<Foo> f = new Foo();
GetNewFoo(byRef(f));
MOZ_ASSERT(7 == Foo::numDestroyed);
}
MOZ_ASSERT(8 == Foo::numDestroyed); MOZ_ASSERT(8 == Foo::numDestroyed);
}
MOZ_ASSERT(9 == Foo::numDestroyed);
{ {
RefPtr<Foo> f = new Foo(); RefPtr<Foo> f = new Foo();
GetPassedFoo(byRef(f)); GetNewFoo(&f);
MOZ_ASSERT(8 == Foo::numDestroyed); MOZ_ASSERT(10 == Foo::numDestroyed);
} }
MOZ_ASSERT(9 == Foo::numDestroyed); MOZ_ASSERT(11 == Foo::numDestroyed);
{ {
RefPtr<Foo> f = new Foo(); RefPtr<Foo> f = new Foo();
GetNewFoo(&f); GetPassedFoo(&f);
MOZ_ASSERT(10 == Foo::numDestroyed);
}
MOZ_ASSERT(11 == Foo::numDestroyed); MOZ_ASSERT(11 == Foo::numDestroyed);
}
MOZ_ASSERT(12 == Foo::numDestroyed);
{ {
RefPtr<Foo> f = new Foo(); RefPtr<Foo> f1 = new Bar();
GetPassedFoo(&f); }
MOZ_ASSERT(11 == Foo::numDestroyed); MOZ_ASSERT(13 == Foo::numDestroyed);
}
MOZ_ASSERT(12 == Foo::numDestroyed);
{
RefPtr<Foo> f1 = new Bar();
}
MOZ_ASSERT(13 == Foo::numDestroyed);
{ {
RefPtr<Foo> f = GetNullFoo(); RefPtr<Foo> f = GetNullFoo();
MOZ_ASSERT(13 == Foo::numDestroyed);
}
MOZ_ASSERT(13 == Foo::numDestroyed); MOZ_ASSERT(13 == Foo::numDestroyed);
}
MOZ_ASSERT(13 == Foo::numDestroyed);
return 0; return 0;
} }
#endif #endif
 End of changes. 52 change blocks. 
177 lines changed or deleted 132 lines changed or added


 Root.h   Root.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=78: * vim: set ts=8 sw=4 et tw=78:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey global object code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsgc_root_h__ #ifndef jsgc_root_h__
#define jsgc_root_h__ #define jsgc_root_h__
#include "jspubtd.h" #ifdef __cplusplus
#include "js/Utility.h" #include "mozilla/TypeTraits.h"
#ifdef __cplusplus #include "jsapi.h"
#include "js/TemplateLib.h"
#include "js/Utility.h"
namespace JS { namespace JS {
/* /*
* Moving GC Stack Rooting * Moving GC Stack Rooting
* *
* A moving GC may change the physical location of GC allocated things, eve n * A moving GC may change the physical location of GC allocated things, eve n
* when they are rooted, updating all pointers to the thing to refer to its new * when they are rooted, updating all pointers to the thing to refer to its new
* location. The GC must therefore know about all live pointers to a thing, * location. The GC must therefore know about all live pointers to a thing,
* not just one of them, in order to behave correctly. * not just one of them, in order to behave correctly.
skipping to change at line 79 skipping to change at line 50
* whether there are other roots which ensure that the object itself will n ot * whether there are other roots which ensure that the object itself will n ot
* be collected. * be collected.
* *
* If Foo() cannot trigger a GC, and the same holds for all other calls mad e * If Foo() cannot trigger a GC, and the same holds for all other calls mad e
* between obj's definitions and its last uses, then no rooting is required . * between obj's definitions and its last uses, then no rooting is required .
* *
* Several classes are available for rooting stack locations. All are templ ated * Several classes are available for rooting stack locations. All are templ ated
* on the type T of the value being rooted, for which RootMethods<T> must * on the type T of the value being rooted, for which RootMethods<T> must
* have an instantiation. * have an instantiation.
* *
* - Root<T> roots an existing stack allocated variable or other location o * - Rooted<T> declares a variable of type T, whose value is always rooted.
f * Rooted<T> may be automatically coerced to a Handle<T>, below. Rooted<T
* type T. This is typically used either when a variable only needs to be >
* rooted on certain rare paths, or when a function takes a bare GC thing * should be used whenever a local variable's value may be held live acro
* pointer as an argument and needs to root it. In the latter case a ss a
* Handle<T> is generally preferred, see below. * call which can allocate GC things or otherwise trigger a GC.
* *
* - RootedVar<T> declares a variable of type T, whose value is always root * - Handle<T> is a const reference to a Rooted<T>. Functions which take GC
ed. * things or values as arguments and need to root those arguments should
* * generally use handles for those arguments and avoid any explicit rooti
* - Handle<T> is a const reference to a Root<T> or RootedVar<T>. Handles a ng.
re * This has two benefits. First, when several such functions call each ot
* coerced automatically from such a Root<T> or RootedVar<T>. Functions w her
hich * then redundant rooting of multiple copies of the GC thing can be avoid
* take GC things or values as arguments and need to root those arguments ed.
* should generally replace those arguments with handles and avoid any * Second, if the caller does not pass a rooted value a compile error wil
* explicit rooting. This has two benefits. First, when several such l be
* functions call each other then redundant rooting of multiple copies of * generated, which is quicker and easier to fix than when relying on a
the * separate rooting analysis.
* GC thing can be avoided. Second, if the caller does not pass a rooted
* value a compile error will be generated, which is quicker and easier t
o
* fix than when relying on a separate rooting analysis.
*/ */
template <typename T> class Root; template <typename T> class MutableHandle;
template <typename T> class RootedVar; template <typename T> class Rooted;
template <typename T> template <typename T>
struct RootMethods { }; struct RootMethods { };
/* /*
* Reference to a stack location rooted for GC. See the "Moving GC Stack * Handle provides an implicit constructor for NullPtr so that, given:
* Rooting" comment above. * foo(Handle<JSObject*> h);
* callers can simply write:
* foo(NullPtr());
* which avoids creating a Rooted<JSObject*> just to pass NULL.
*/ */
struct NullPtr
{
static void * const constNullValue;
};
template <typename T> template <typename T>
class Handle class MutableHandle;
template <typename T>
class HandleBase {};
/*
* Reference to a T that has been rooted elsewhere. This is most useful
* as a parameter type, which guarantees that the T lvalue is properly
* rooted. See "Move GC Stack Rooting" above.
*
* If you want to add additional methods to Handle for a specific
* specialization, define a HandleBase<T> specialization containing them.
*/
template <typename T>
class Handle : public HandleBase<T>
{ {
public: public:
/* Copy handles of different types, with implicit coercion. */ /* Creates a handle from a handle of a type convertible to T. */
template <typename S> Handle(Handle<S> handle) { template <typename S>
testAssign<S>(); Handle(Handle<S> handle,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value,
int>::Type dummy = 0)
{
ptr = reinterpret_cast<const T *>(handle.address()); ptr = reinterpret_cast<const T *>(handle.address());
} }
/* Get a handle from a rooted stack location, with implicit coercion. * /* Create a handle for a NULL pointer. */
/ Handle(NullPtr) {
template <typename S> inline Handle(const Root<S> &root); typedef typename js::tl::StaticAssert<js::tl::IsPointerType<T>::res
template <typename S> inline Handle(const RootedVar<S> &root); ult>::result _;
ptr = reinterpret_cast<const T *>(&NullPtr::constNullValue);
}
friend class MutableHandle<T>;
Handle(MutableHandle<T> handle) {
ptr = handle.address();
}
const T *address() { return ptr; } /*
* This may be called only if the location of the T is guaranteed
* to be marked (for some reason other than being a Rooted),
* e.g., if it is guaranteed to be reachable from an implicit root.
*
* Create a Handle from a raw location of a T.
*/
static Handle fromMarkedLocation(const T *p) {
Handle h;
h.ptr = p;
return h;
}
operator T () { return value(); } /*
T operator ->() { return value(); } * Construct a handle from an explicitly rooted location. This is the
* normal way to create a handle, and normally happens implicitly.
*/
template <typename S>
inline
Handle(Rooted<S> &root,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value,
int>::Type dummy = 0);
/* Construct a read only handle from a mutable handle. */
template <typename S>
inline
Handle(MutableHandle<S> &root,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value,
int>::Type dummy = 0);
const T *address() const { return ptr; }
T get() const { return *ptr; }
operator T () const { return get(); }
T operator ->() const { return get(); }
private: private:
Handle() {}
const T *ptr; const T *ptr;
T value() { return *ptr; }
template <typename S> template <typename S>
void testAssign() { void operator =(S v) MOZ_DELETE;
#ifdef DEBUG
T a = RootMethods<T>::initial();
S b = RootMethods<S>::initial();
a = b;
(void)a;
#endif
}
}; };
typedef Handle<JSObject*> HandleObject; typedef Handle<JSObject*> HandleObject;
typedef Handle<JSFunction*> HandleFunction; typedef Handle<JSFunction*> HandleFunction;
typedef Handle<JSScript*> HandleScript;
typedef Handle<JSString*> HandleString; typedef Handle<JSString*> HandleString;
typedef Handle<jsid> HandleId; typedef Handle<jsid> HandleId;
typedef Handle<Value> HandleValue; typedef Handle<Value> HandleValue;
template <typename T> template <typename T>
class MutableHandleBase {};
/*
* Similar to a handle, but the underlying storage can be changed. This is
* useful for outparams.
*
* If you want to add additional methods to MutableHandle for a specific
* specialization, define a MutableHandleBase<T> specialization containing
* them.
*/
template <typename T>
class MutableHandle : public MutableHandleBase<T>
{
public:
template <typename S>
MutableHandle(MutableHandle<S> handle,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::
value, int>::Type dummy = 0)
{
this->ptr = reinterpret_cast<const T *>(handle.address());
}
template <typename S>
inline
MutableHandle(Rooted<S> *root,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::
value, int>::Type dummy = 0);
void set(T v)
{
JS_ASSERT(!RootMethods<T>::poisoned(v));
*ptr = v;
}
/*
* This may be called only if the location of the T is guaranteed
* to be marked (for some reason other than being a Rooted),
* e.g., if it is guaranteed to be reachable from an implicit root.
*
* Create a MutableHandle from a raw location of a T.
*/
static MutableHandle fromMarkedLocation(T *p) {
MutableHandle h;
h.ptr = p;
return h;
}
T *address() const { return ptr; }
T get() const { return *ptr; }
operator T () const { return get(); }
T operator ->() const { return get(); }
private:
MutableHandle() {}
T *ptr;
template <typename S>
void operator =(S v) MOZ_DELETE;
};
typedef MutableHandle<JSObject*> MutableHandleObject;
typedef MutableHandle<Value> MutableHandleValue;
/*
* Raw pointer used as documentation that a parameter does not need to be
* rooted.
*/
typedef JSObject * RawObject;
/*
* By default, pointers should use the inheritance hierarchy to find their
* ThingRootKind. Some pointer types are explicitly set in jspubtd.h so tha
t
* Rooted<T> may be used without the class definition being available.
*/
template <typename T>
struct RootKind<T *> { static ThingRootKind rootKind() { return T::rootKind
(); }; };
template <typename T>
struct RootMethods<T *> struct RootMethods<T *>
{ {
static T *initial() { return NULL; } static T *initial() { return NULL; }
static ThingRootKind kind() { return T::rootKind(); } static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
static bool poisoned(T *v) { return IsPoisonedPtr(v); } static bool poisoned(T *v) { return IsPoisonedPtr(v); }
}; };
template <typename T>
class RootedBase {};
/* /*
* Root a stack location holding a GC thing. This takes a stack pointer * Local variable of type T whose value is always rooted. This is typically
* and ensures that throughout its lifetime the referenced variable * used for local variables, or for non-rooted values being passed to a
* will remain pinned against a moving GC. * function that requires a handle, e.g. Foo(Root<T>(cx, x)).
* *
* It is important to ensure that the location referenced by a Root is * If you want to add additional methods to Rooted for a specific
* initialized, as otherwise the GC may try to use the the uninitialized va * specialization, define a RootedBase<T> specialization containing them.
lue.
* It is generally preferable to use either RootedVar for local variables,
or
* Handle for arguments.
*/ */
template <typename T> template <typename T>
class Root class Rooted : public RootedBase<T>
{ {
public: void init(JSContext *cx_)
Root(JSContext *cx_, const T *ptr
JS_GUARD_OBJECT_NOTIFIER_PARAM)
{ {
#ifdef JSGC_ROOT_ANALYSIS #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
ContextFriendFields *cx = ContextFriendFields::get(cx_); ContextFriendFields *cx = ContextFriendFields::get(cx_);
ThingRootKind kind = RootMethods<T>::kind(); ThingRootKind kind = RootMethods<T>::kind();
this->stack = reinterpret_cast<Root<T>**>(&cx->thingGCRooters[kind] ); this->stack = reinterpret_cast<Rooted<T>**>(&cx->thingGCRooters[kin d]);
this->prev = *stack; this->prev = *stack;
*stack = this; *stack = this;
#endif
JS_ASSERT(!RootMethods<T>::poisoned(*ptr)); JS_ASSERT(!RootMethods<T>::poisoned(ptr));
#endif
this->ptr = ptr;
JS_GUARD_OBJECT_NOTIFIER_INIT;
} }
~Root() public:
Rooted(JSContext *cx) : ptr(RootMethods<T>::initial()) { init(cx); }
Rooted(JSContext *cx, T initial) : ptr(initial) { init(cx); }
~Rooted()
{ {
#ifdef JSGC_ROOT_ANALYSIS #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
JS_ASSERT(*stack == this); JS_ASSERT(*stack == this);
*stack = prev; *stack = prev;
#endif #endif
} }
#ifdef JSGC_ROOT_ANALYSIS #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
Root<T> *previous() { return prev; } Rooted<T> *previous() { return prev; }
#endif #endif
const T *address() const { return ptr; } operator T () const { return ptr; }
T operator ->() const { return ptr; }
T * address() { return &ptr; }
const T * address() const { return &ptr; }
T & get() { return ptr; }
const T & get() const { return ptr; }
T & operator =(T value)
{
JS_ASSERT(!RootMethods<T>::poisoned(value));
ptr = value;
return ptr;
}
T & operator =(const Rooted &value)
{
ptr = value;
return ptr;
}
private: private:
#ifdef JSGC_ROOT_ANALYSIS #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
Root<T> **stack, *prev; Rooted<T> **stack, *prev;
#endif #endif
const T *ptr; T ptr;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER Rooted() MOZ_DELETE;
Rooted(const Rooted &) MOZ_DELETE;
}; };
template<typename T> template <typename S> template<typename T> template <typename S>
inline inline
Handle<T>::Handle(const Root<S> &root) Handle<T>::Handle(Rooted<S> &root,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::
value, int>::Type dummy)
{ {
testAssign<S>();
ptr = reinterpret_cast<const T *>(root.address()); ptr = reinterpret_cast<const T *>(root.address());
} }
typedef Root<JSObject*> RootObject; template<typename T> template <typename S>
typedef Root<JSFunction*> RootFunction; inline
typedef Root<JSString*> RootString; Handle<T>::Handle(MutableHandle<S> &root,
typedef Root<jsid> RootId; typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::
typedef Root<Value> RootValue; value, int>::Type dummy)
{
ptr = reinterpret_cast<const T *>(root.address());
}
template<typename T> template <typename S>
inline
MutableHandle<T>::MutableHandle(Rooted<S> *root,
typename mozilla::EnableIf<mozilla::IsConve
rtible<S, T>::value, int>::Type dummy)
{
ptr = root->address();
}
typedef Rooted<JSObject*> RootedObject;
typedef Rooted<JSFunction*> RootedFunction;
typedef Rooted<JSScript*> RootedScript;
typedef Rooted<JSString*> RootedString;
typedef Rooted<jsid> RootedId;
typedef Rooted<Value> RootedValue;
/* /*
* Mark a stack location as a root for the rooting analysis, without actual ly * Mark a stack location as a root for the rooting analysis, without actual ly
* rooting it in release builds. This should only be used for stack locatio ns * rooting it in release builds. This should only be used for stack locatio ns
* of GC things that cannot be relocated by a garbage collection, and that * of GC things that cannot be relocated by a garbage collection, and that
* are definitely reachable via another path. * are definitely reachable via another path.
*/ */
class SkipRoot class SkipRoot
{ {
#if defined(DEBUG) && defined(JSGC_ROOT_ANALYSIS) #if defined(DEBUG) && defined(JSGC_ROOT_ANALYSIS)
SkipRoot **stack, *prev; SkipRoot **stack, *prev;
const uint8_t *start; const uint8_t *start;
const uint8_t *end; const uint8_t *end;
public:
template <typename T> template <typename T>
SkipRoot(JSContext *cx_, const T *ptr void init(ContextFriendFields *cx, const T *ptr, size_t count)
JS_GUARD_OBJECT_NOTIFIER_PARAM)
{ {
ContextFriendFields *cx = ContextFriendFields::get(cx_);
this->stack = &cx->skipGCRooters; this->stack = &cx->skipGCRooters;
this->prev = *stack; this->prev = *stack;
*stack = this; *stack = this;
this->start = (const uint8_t *) ptr; this->start = (const uint8_t *) ptr;
this->end = this->start + sizeof(T); this->end = this->start + (sizeof(T) * count);
}
public:
template <typename T>
SkipRoot(JSContext *cx, const T *ptr, size_t count = 1
JS_GUARD_OBJECT_NOTIFIER_PARAM)
{
init(ContextFriendFields::get(cx), ptr, count);
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
} }
~SkipRoot() ~SkipRoot()
{ {
JS_ASSERT(*stack == this); JS_ASSERT(*stack == this);
*stack = prev; *stack = prev;
} }
SkipRoot *previous() { return prev; } SkipRoot *previous() { return prev; }
bool contains(const uint8_t *v, size_t len) { bool contains(const uint8_t *v, size_t len) {
return v >= start && v + len <= end; return v >= start && v + len <= end;
} }
#else /* DEBUG && JSGC_ROOT_ANALYSIS */ #else /* DEBUG && JSGC_ROOT_ANALYSIS */
public: public:
template <typename T> template <typename T>
SkipRoot(JSContext *cx, const T *ptr SkipRoot(JSContext *cx, const T *ptr, size_t count = 1
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
{ {
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
} }
#endif /* DEBUG && JSGC_ROOT_ANALYSIS */ #endif /* DEBUG && JSGC_ROOT_ANALYSIS */
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
/* Make a local variable which stays rooted throughout its lifetime. */ /*
template <typename T> * This typedef is to annotate parameters that we have manually verified do
class RootedVar not
{ * need rooting, as opposed to parameters that have not yet been considered
public: .
RootedVar(JSContext *cx) */
: ptr(RootMethods<T>::initial()), root(cx, &ptr) typedef JSObject *RawObject;
{}
RootedVar(JSContext *cx, T initial)
: ptr(initial), root(cx, &ptr)
{}
operator T () const { return ptr; }
T operator ->() const { return ptr; }
T * address() { return &ptr; }
const T * address() const { return &ptr; }
T & reference() { return ptr; }
T raw() { return ptr; }
/* #ifdef DEBUG
* This method is only necessary due to an obscure C++98 requirement (t JS_FRIEND_API(bool) IsRootingUnnecessaryForContext(JSContext *cx);
hat JS_FRIEND_API(void) SetRootingUnnecessaryForContext(JSContext *cx, bool val
* there be an accessible, usable copy constructor when passing a tempo ue);
rary JS_FRIEND_API(bool) RelaxRootChecksForContext(JSContext *cx);
* to an implicitly-called constructor for use with a const-ref paramet #endif
er).
* (Head spinning yet?) We can remove this when we build the JS engine
* with -std=c++11.
*/
operator Handle<T> () const { return Handle<T>(*this); }
T & operator =(T value) class AssertRootingUnnecessary {
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
#ifdef DEBUG
JSContext *cx;
bool prev;
#endif
public:
AssertRootingUnnecessary(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM)
{ {
JS_ASSERT(!RootMethods<T>::poisoned(value)); JS_GUARD_OBJECT_NOTIFIER_INIT;
ptr = value; #ifdef DEBUG
return ptr; this->cx = cx;
prev = IsRootingUnnecessaryForContext(cx);
SetRootingUnnecessaryForContext(cx, true);
#endif
} }
T & operator =(const RootedVar &value) ~AssertRootingUnnecessary() {
{ #ifdef DEBUG
ptr = value; SetRootingUnnecessaryForContext(cx, prev);
return ptr; #endif
} }
private:
T ptr;
Root<T> root;
RootedVar() MOZ_DELETE;
RootedVar(const RootedVar &) MOZ_DELETE;
}; };
template <typename T> template <typename S> #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) &&
inline !defined(JS_THREADSAFE)
Handle<T>::Handle(const RootedVar<S> &root) extern void
CheckStackRoots(JSContext *cx);
#endif
/*
* Hook for dynamic root analysis. Checks the native stack and poisons
* references to GC things which have not been rooted.
*/
inline void MaybeCheckStackRoots(JSContext *cx, bool relax = true)
{ {
testAssign<S>(); #ifdef DEBUG
ptr = reinterpret_cast<const T *>(root.address()); JS_ASSERT(!IsRootingUnnecessaryForContext(cx));
# if defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THRE
ADSAFE)
if (relax && RelaxRootChecksForContext(cx))
return;
CheckStackRoots(cx);
# endif
#endif
} }
typedef RootedVar<JSObject*> RootedVarObject;
typedef RootedVar<JSFunction*> RootedVarFunction;
typedef RootedVar<JSString*> RootedVarString;
typedef RootedVar<jsid> RootedVarId;
typedef RootedVar<Value> RootedVarValue;
} /* namespace JS */ } /* namespace JS */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* jsgc_root_h___ */ #endif /* jsgc_root_h___ */
 End of changes. 51 change blocks. 
196 lines changed or deleted 329 lines changed or added


 SAX.h   SAX.h 
skipping to change at line 26 skipping to change at line 26
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xlink.h> #include <libxml/xlink.h>
#ifdef LIBXML_LEGACY_ENABLED #ifdef LIBXML_LEGACY_ENABLED
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
getPublicId (void *ctx); getPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
getSystemId (void *ctx); getSystemId (void *ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
setDocumentLocator (void *ctx, setDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc); xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
getLineNumber (void *ctx); getLineNumber (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
getColumnNumber (void *ctx); getColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
isStandalone (void *ctx); isStandalone (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
hasInternalSubset (void *ctx); hasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
hasExternalSubset (void *ctx); hasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
internalSubset (void *ctx, internalSubset (void *ctx,
const xmlChar *name, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *ExternalID,
const xmlChar *SystemID); const xmlChar *SystemID);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
externalSubset (void *ctx, externalSubset (void *ctx,
const xmlChar *name, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *ExternalID,
const xmlChar *SystemID); const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL XMLPUBFUN xmlEntityPtr XMLCALL
getEntity (void *ctx, getEntity (void *ctx,
const xmlChar *name); const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL XMLPUBFUN xmlEntityPtr XMLCALL
getParameterEntity (void *ctx, getParameterEntity (void *ctx,
const xmlChar *name); const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL
resolveEntity (void *ctx, resolveEntity (void *ctx,
const xmlChar *publicId, const xmlChar *publicId,
const xmlChar *systemId); const xmlChar *systemId);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
entityDecl (void *ctx, entityDecl (void *ctx,
const xmlChar *name, const xmlChar *name,
int type, int type,
const xmlChar *publicId, const xmlChar *publicId,
const xmlChar *systemId, const xmlChar *systemId,
xmlChar *content); xmlChar *content);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
attributeDecl (void *ctx, attributeDecl (void *ctx,
const xmlChar *elem, const xmlChar *elem,
const xmlChar *fullname, const xmlChar *fullname,
int type, int type,
int def, int def,
const xmlChar *defaultValue const xmlChar *defaultValue,
, xmlEnumerationPtr tree);
xmlEnumerationPtr tree); XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL elementDecl (void *ctx,
elementDecl (void *ctx, const xmlChar *name,
const xmlChar *name, int type,
int type, xmlElementContentPtr content);
xmlElementContentPtr conten XMLPUBFUN void XMLCALL
t); notationDecl (void *ctx,
XMLPUBFUN void XMLCALL const xmlChar *name,
notationDecl (void *ctx, const xmlChar *publicId,
const xmlChar *name, const xmlChar *systemId);
const xmlChar *publicId, XMLPUBFUN void XMLCALL
const xmlChar *systemId); unparsedEntityDecl (void *ctx,
XMLPUBFUN void XMLCALL const xmlChar *name,
unparsedEntityDecl (void *ctx, const xmlChar *publicId,
const xmlChar *name, const xmlChar *systemId,
const xmlChar *publicId, const xmlChar *notationName);
const xmlChar *systemId,
const xmlChar *notationName XMLPUBFUN void XMLCALL
); startDocument (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL endDocument (void *ctx);
startDocument (void *ctx); XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL attribute (void *ctx,
endDocument (void *ctx); const xmlChar *fullname,
XMLPUBFUN void XMLCALL const xmlChar *value);
attribute (void *ctx, XMLPUBFUN void XMLCALL
const xmlChar *fullname, startElement (void *ctx,
const xmlChar *value); const xmlChar *fullname,
XMLPUBFUN void XMLCALL const xmlChar **atts);
startElement (void *ctx, XMLPUBFUN void XMLCALL
const xmlChar *fullname, endElement (void *ctx,
const xmlChar **atts); const xmlChar *name);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
endElement (void *ctx, reference (void *ctx,
const xmlChar *name); const xmlChar *name);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
reference (void *ctx, characters (void *ctx,
const xmlChar *name); const xmlChar *ch,
XMLPUBFUN void XMLCALL int len);
characters (void *ctx, XMLPUBFUN void XMLCALL
const xmlChar *ch, ignorableWhitespace (void *ctx,
int len); const xmlChar *ch,
XMLPUBFUN void XMLCALL int len);
ignorableWhitespace (void *ctx, XMLPUBFUN void XMLCALL
const xmlChar *ch, processingInstruction (void *ctx,
int len); const xmlChar *target,
XMLPUBFUN void XMLCALL const xmlChar *data);
processingInstruction (void *ctx, XMLPUBFUN void XMLCALL
const xmlChar *target, globalNamespace (void *ctx,
const xmlChar *data); const xmlChar *href,
XMLPUBFUN void XMLCALL const xmlChar *prefix);
globalNamespace (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
setNamespace (void *ctx, setNamespace (void *ctx,
const xmlChar *name); const xmlChar *name);
XMLPUBFUN xmlNsPtr XMLCALL XMLPUBFUN xmlNsPtr XMLCALL
getNamespace (void *ctx); getNamespace (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
checkNamespace (void *ctx, checkNamespace (void *ctx,
xmlChar *nameSpace); xmlChar *nameSpace);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
namespaceDecl (void *ctx, namespaceDecl (void *ctx,
const xmlChar *href, const xmlChar *href,
const xmlChar *prefix); const xmlChar *prefix);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
comment (void *ctx, comment (void *ctx,
const xmlChar *value); const xmlChar *value);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
cdataBlock (void *ctx, cdataBlock (void *ctx,
const xmlChar *value, const xmlChar *value,
int len); int len);
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
int warning); int warning);
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif #endif
#ifdef LIBXML_DOCB_ENABLED #ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif #endif
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_LEGACY_ENABLED */ #endif /* LIBXML_LEGACY_ENABLED */
#endif /* __XML_SAX_H__ */ #endif /* __XML_SAX_H__ */
 End of changes. 22 change blocks. 
111 lines changed or deleted 108 lines changed or added


 Scoped.h   Scoped.h 
skipping to change at line 38 skipping to change at line 38
* *
* ScopedClass foo(create_value()); * ScopedClass foo(create_value());
* // ... In this scope, |foo| is defined. Use |foo.get()| or |foo.rwget()| * // ... In this scope, |foo| is defined. Use |foo.get()| or |foo.rwget()|
* to access the value. * to access the value.
* // ... In case of |return| or |throw|, |foo| is deallocated automaticall y. * // ... In case of |return| or |throw|, |foo| is deallocated automaticall y.
* // ... If |foo| needs to be returned or stored, use |foo.forget()| * // ... If |foo| needs to be returned or stored, use |foo.forget()|
* *
* Note that the RAII classes defined in this header do _not_ perform any f orm * Note that the RAII classes defined in this header do _not_ perform any f orm
* of reference-counting or garbage-collection. These classes have exactly two * of reference-counting or garbage-collection. These classes have exactly two
* behaviors: * behaviors:
*
* - if |forget()| has not been called, the resource is always deallocated at * - if |forget()| has not been called, the resource is always deallocated at
* the end of the scope; * the end of the scope;
* - if |forget()| has been called, any control on the resource is unbound * - if |forget()| has been called, any control on the resource is unbound
* and the resource is not deallocated by the class. * and the resource is not deallocated by the class.
* *
*
* Extension: * Extension:
* *
* In addition, this header provides class |Scoped| and macro |SCOPED_TEMPL ATE| * In addition, this header provides class |Scoped| and macro |SCOPED_TEMPL ATE|
* to simplify the definition of RAII classes for other scenarios. These ma cros * to simplify the definition of RAII classes for other scenarios. These ma cros
* have been used to automatically close file descriptors/file handles when * have been used to automatically close file descriptors/file handles when
* reaching the end of the scope, graphics contexts, etc. * reaching the end of the scope, graphics contexts, etc.
*/ */
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h" #include "mozilla/GuardObjects.h"
namespace mozilla {
/* /*
* Scoped is a helper to create RAII wrappers * Scoped is a helper to create RAII wrappers
* Type argument |Traits| is expected to have the following structure: * Type argument |Traits| is expected to have the following structure:
* *
* struct Traits { * struct Traits {
* // Define the type of the value stored in the wrapper * // Define the type of the value stored in the wrapper
* typedef value_type type; * typedef value_type type;
* // Returns the value corresponding to the uninitialized or freed sta te * // Returns the value corresponding to the uninitialized or freed sta te
* const static type empty(); * const static type empty();
* // Release resources corresponding to the wrapped value * // Release resources corresponding to the wrapped value
* // This function is responsible for not releasing an |empty| value * // This function is responsible for not releasing an |empty| value
* const static void release(type); * const static void release(type);
* } * }
*/ */
template <typename Traits> template<typename Traits>
class Scoped class Scoped
{ {
public: public:
typedef typename Traits::type Resource; typedef typename Traits::type Resource;
explicit Scoped(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) explicit Scoped(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: value(Traits::empty()) : value(Traits::empty())
{ {
MOZ_GUARD_OBJECT_NOTIFIER_INIT; MOZ_GUARD_OBJECT_NOTIFIER_INIT;
} }
explicit Scoped(const Resource& value explicit Scoped(const Resource& value
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: value(value) : value(value)
{ {
MOZ_GUARD_OBJECT_NOTIFIER_INIT; MOZ_GUARD_OBJECT_NOTIFIER_INIT;
} }
~Scoped() { ~Scoped() {
Traits::release(value); Traits::release(value);
} }
// Constant getter // Constant getter
operator const Resource&() const { return value; } operator const Resource&() const { return value; }
const Resource& operator->() const { return value; } const Resource& operator->() const { return value; }
const Resource& get() const { return value; } const Resource& get() const { return value; }
// Non-constant getter. // Non-constant getter.
Resource& rwget() { return value; } Resource& rwget() { return value; }
/* /*
* Forget the resource. * Forget the resource.
* *
* Once |forget| has been called, the |Scoped| is neutralized, i.e. it wi * Once |forget| has been called, the |Scoped| is neutralized, i.e. it
ll will
* have no effect at destruction (unless it is reset to another resource * have no effect at destruction (unless it is reset to another resourc
by e by
* |operator=|). * |operator=|).
* *
* @return The original resource. * @return The original resource.
*/ */
Resource forget() { Resource forget() {
Resource tmp = value; Resource tmp = value;
value = Traits::empty(); value = Traits::empty();
return tmp; return tmp;
} }
/* /*
* Perform immediate clean-up of this |Scoped|. * Perform immediate clean-up of this |Scoped|.
* *
* If this |Scoped| is currently empty, this method has no effect. * If this |Scoped| is currently empty, this method has no effect.
*/ */
void dispose() { void dispose() {
Traits::release(value); Traits::release(value);
value = Traits::empty(); value = Traits::empty();
} }
bool operator==(const Resource& other) const { bool operator==(const Resource& other) const {
return value == other; return value == other;
} }
/* /*
* Replace the resource with another resource. * Replace the resource with another resource.
* *
* Calling |operator=| has the side-effect of triggering clean-up. If you * Calling |operator=| has the side-effect of triggering clean-up. If y
do ou do
* not want to trigger clean-up, you should first invoke |forget|. * not want to trigger clean-up, you should first invoke |forget|.
* *
* @return this * @return this
*/ */
Scoped<Traits>& operator=(const Resource& other) { Scoped<Traits>& operator=(const Resource& other) {
return reset(other); return reset(other);
} }
Scoped<Traits>& reset(const Resource& other) { Scoped<Traits>& reset(const Resource& other) {
Traits::release(value); Traits::release(value);
value = other; value = other;
return *this; return *this;
} }
private: private:
explicit Scoped(const Scoped<Traits>& value) MOZ_DELETE; explicit Scoped(const Scoped<Traits>& value) MOZ_DELETE;
Scoped<Traits>& operator=(const Scoped<Traits>& value) MOZ_DELETE; Scoped<Traits>& operator=(const Scoped<Traits>& value) MOZ_DELETE;
private: private:
Resource value; Resource value;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
/* /*
* SCOPED_TEMPLATE defines a templated class derived from Scoped * SCOPED_TEMPLATE defines a templated class derived from Scoped
* This allows to implement templates such as ScopedFreePtr. * This allows to implement templates such as ScopedFreePtr.
* *
* @param name The name of the class to define. * @param name The name of the class to define.
* @param Traits A struct implementing clean-up. See the implementations * @param Traits A struct implementing clean-up. See the implementations
* for more details. * for more details.
*/ */
#define SCOPED_TEMPLATE(name, Traits) \ #define SCOPED_TEMPLATE(name, Traits) \
template <typename Type> \ template<typename Type> \
struct name : public Scoped<Traits<Type> > \ struct name : public mozilla::Scoped<Traits<Type> > \
{ \ { \
typedef Scoped<Traits<Type> > Super; \ typedef mozilla::Scoped<Traits<Type> > Super; \
typedef typename Super::Resource Resource; \ typedef typename Super::Resource Resource; \
name& operator=(Resource ptr) { \ name& operator=(Resource ptr) { \
Super::operator=(ptr); \ Super::operator=(ptr); \
return *this; \ return *this; \
} \ } \
explicit name(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) \ explicit name(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) \
: Super(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) \ : Super(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) \
{} \ {} \
explicit name(Resource ptr \ explicit name(Resource ptr \
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) \ MOZ_GUARD_OBJECT_NOTIFIER_PARAM) \
: Super(ptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) \ : Super(ptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) \
{} \ {} \
private: \ private: \
explicit name(name& source) MOZ_DELETE; \ explicit name(name& source) MOZ_DELETE; \
name& operator=(name& source) MOZ_DELETE; \ name& operator=(name& source) MOZ_DELETE; \
}; };
/* /*
* ScopedFreePtr is a RAII wrapper for pointers that need to be free()d. * ScopedFreePtr is a RAII wrapper for pointers that need to be free()d.
* *
* struct S { ... }; * struct S { ... };
* ScopedFreePtr<S> foo = malloc(sizeof(S)); * ScopedFreePtr<S> foo = malloc(sizeof(S));
* ScopedFreePtr<char> bar = strdup(str); * ScopedFreePtr<char> bar = strdup(str);
*/ */
template <typename T> template<typename T>
struct ScopedFreePtrTraits struct ScopedFreePtrTraits
{ {
typedef T* type; typedef T* type;
static T* empty() { return NULL; } static T* empty() { return NULL; }
static void release(T* ptr) { free(ptr); } static void release(T* ptr) { free(ptr); }
}; };
SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits)
/* /*
* ScopedDeletePtr is a RAII wrapper for pointers that need to be deleted. * ScopedDeletePtr is a RAII wrapper for pointers that need to be deleted.
* *
* struct S { ... }; * struct S { ... };
* ScopedDeletePtr<S> foo = new S(); * ScopedDeletePtr<S> foo = new S();
*/ */
template <typename T> template<typename T>
struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T> { struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T>
static void release(T* ptr) { delete ptr; } {
static void release(T* ptr) { delete ptr; }
}; };
SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits) SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits)
/* /*
* ScopedDeleteArray is a RAII wrapper for pointers that need to be delete[ ]ed. * ScopedDeleteArray is a RAII wrapper for pointers that need to be delete[ ]ed.
* *
* struct S { ... }; * struct S { ... };
* ScopedDeleteArray<S> foo = new S[42]; * ScopedDeleteArray<S> foo = new S[42];
*/ */
template <typename T> template<typename T>
struct ScopedDeleteArrayTraits : public ScopedFreePtrTraits<T> struct ScopedDeleteArrayTraits : public ScopedFreePtrTraits<T>
{ {
static void release(T* ptr) { delete [] ptr; } static void release(T* ptr) { delete [] ptr; }
}; };
SCOPED_TEMPLATE(ScopedDeleteArray, ScopedDeleteArrayTraits) SCOPED_TEMPLATE(ScopedDeleteArray, ScopedDeleteArrayTraits)
} /* namespace mozilla */
#endif // mozilla_Scoped_h_ #endif // mozilla_Scoped_h_
 End of changes. 14 change blocks. 
109 lines changed or deleted 114 lines changed or added


 ScriptingCore.h   ScriptingCore.h 
skipping to change at line 29 skipping to change at line 29
void js_log(const char *format, ...); void js_log(const char *format, ...);
using namespace cocos2d; using namespace cocos2d;
typedef void (*sc_register_sth)(JSContext* cx, JSObject* global); typedef void (*sc_register_sth)(JSContext* cx, JSObject* global);
void registerDefaultClasses(JSContext* cx, JSObject* global); void registerDefaultClasses(JSContext* cx, JSObject* global);
class ScriptingCore : public CCScriptEngineProtocol class ScriptingCore : public CCScriptEngineProtocol
{ {
JSRuntime *rt; JSRuntime *rt_;
JSContext *cx; JSContext *cx_;
JSObject *global; JSObject *global_;
ScriptingCore(); ScriptingCore();
public: public:
~ScriptingCore(); ~ScriptingCore();
static ScriptingCore *getInstance() { static ScriptingCore *getInstance() {
static ScriptingCore* pInstance = NULL; static ScriptingCore* pInstance = NULL;
if (pInstance == NULL) { if (pInstance == NULL) {
pInstance = new ScriptingCore(); pInstance = new ScriptingCore();
} }
skipping to change at line 60 skipping to change at line 60
*/ */
virtual void removeScriptObjectByCCObject(CCObject* pObj); virtual void removeScriptObjectByCCObject(CCObject* pObj);
/** /**
@brief Execute script code contained in the given string. @brief Execute script code contained in the given string.
@param codes holding the valid script code that should be executed. @param codes holding the valid script code that should be executed.
@return 0 if the string is excuted correctly. @return 0 if the string is excuted correctly.
@return other if the string is excuted wrongly. @return other if the string is excuted wrongly.
*/ */
virtual int executeString(const char* codes) { return 0; } virtual int executeString(const char* codes) { return 0; }
void pauseSchedulesAndActions(CCNode *node);
void resumeSchedulesAndActions(CCNode *node);
void cleanupSchedulesAndActions(CCNode *node);
/** /**
@brief Execute a script file. @brief Execute a script file.
@param filename String object holding the filename of the script file that is to be executed @param filename String object holding the filename of the script file that is to be executed
*/ */
virtual int executeScriptFile(const char* filename) { return 0; } virtual int executeScriptFile(const char* filename) { return 0; }
/** /**
@brief Execute a scripted global function. @brief Execute a scripted global function.
@brief The function should not take any parameters and should return a n integer. @brief The function should not take any parameters and should return a n integer.
skipping to change at line 86 skipping to change at line 89
virtual int executeMenuItemEvent(CCMenuItem* pMenuItem); virtual int executeMenuItemEvent(CCMenuItem* pMenuItem);
virtual int executeNotificationEvent(CCNotificationCenter* pNotificatio nCenter, const char* pszName); virtual int executeNotificationEvent(CCNotificationCenter* pNotificatio nCenter, const char* pszName);
virtual int executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* p Target = NULL); virtual int executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* p Target = NULL);
virtual int executeSchedule(CCTimer* pTimer, float dt, CCNode* pNode = NULL); virtual int executeSchedule(CCTimer* pTimer, float dt, CCNode* pNode = NULL);
virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CC Set *pTouches); virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CC Set *pTouches);
virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTo uch *pTouch); virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTo uch *pTouch);
int executeFunctionWithObjectData(CCNode *self, const char *name, JSObj ect *obj); int executeFunctionWithObjectData(CCNode *self, const char *name, JSObj ect *obj);
int executeFunctionWithOwner(jsval owner, const char *name, jsval data) ; int executeFunctionWithOwner(jsval owner, const char *name, jsval data) ;
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, jsval data); void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, jsval *data);
/** /**
* will eval the specified string * will eval the specified string
* @param string The string with the javascript code to be evaluated * @param string The string with the javascript code to be evaluated
* @param outVal The jsval that will hold the return value of the ev aluation. * @param outVal The jsval that will hold the return value of the ev aluation.
* Can be NULL. * Can be NULL.
*/ */
JSBool evalString(const char *string, jsval *outVal, const char *fil ename = NULL); JSBool evalString(const char *string, jsval *outVal, const char *fil ename = NULL, JSContext* cx = NULL, JSObject* global = NULL);
/** /**
* will run the specified string * will run the specified string
* @param string The path of the script to be run * @param string The path of the script to be run
*/ */
JSBool runScript(const char *path); JSBool runScript(const char *path, JSObject* global = NULL, JSContex t* cx = NULL);
/** /**
* initialize everything * initialize everything
*/ */
void start(); void start();
/** /**
* will add the register_sth callback to the list of functions that need to be called * will add the register_sth callback to the list of functions that need to be called
* after the creation of the context * after the creation of the context
*/ */
skipping to change at line 131 skipping to change at line 134
int executeCustomTouchEvent(int eventType, int executeCustomTouchEvent(int eventType,
CCTouch *pTouch, JSObject *obj, jsval &retv al); CCTouch *pTouch, JSObject *obj, jsval &retv al);
int executeCustomTouchEvent(int eventType, int executeCustomTouchEvent(int eventType,
CCTouch *pTouch, JSObject *obj); CCTouch *pTouch, JSObject *obj);
int executeCustomTouchesEvent(int eventType, int executeCustomTouchesEvent(int eventType,
CCSet *pTouches, JSObject *obj); CCSet *pTouches, JSObject *obj);
/** /**
* @return the global context * @return the global context
*/ */
JSContext* getGlobalContext() { JSContext* getGlobalContext() {
return cx; return cx_;
}; };
/** /**
* @param cx * @param cx
* @param message * @param message
* @param report * @param report
*/ */
static void reportError(JSContext *cx, const char *message, JSErrorR eport *report); static void reportError(JSContext *cx, const char *message, JSErrorR eport *report);
/** /**
skipping to change at line 184 skipping to change at line 187
std::string jsval_to_std_string(JSContext *cx, jsval v); std::string jsval_to_std_string(JSContext *cx, jsval v);
// you should free this pointer after you're done with it // you should free this pointer after you're done with it
const char* jsval_to_c_string(JSContext *cx, jsval v); const char* jsval_to_c_string(JSContext *cx, jsval v);
CCPoint jsval_to_ccpoint(JSContext *cx, jsval v); CCPoint jsval_to_ccpoint(JSContext *cx, jsval v);
CCRect jsval_to_ccrect(JSContext *cx, jsval v); CCRect jsval_to_ccrect(JSContext *cx, jsval v);
CCSize jsval_to_ccsize(JSContext *cx, jsval v); CCSize jsval_to_ccsize(JSContext *cx, jsval v);
ccGridSize jsval_to_ccgridsize(JSContext *cx, jsval v); ccGridSize jsval_to_ccgridsize(JSContext *cx, jsval v);
ccColor4B jsval_to_cccolor4b(JSContext *cx, jsval v); ccColor4B jsval_to_cccolor4b(JSContext *cx, jsval v);
ccColor4F jsval_to_cccolor4f(JSContext *cx, jsval v); ccColor4F jsval_to_cccolor4f(JSContext *cx, jsval v);
ccColor3B jsval_to_cccolor3b(JSContext *cx, jsval v); ccColor3B jsval_to_cccolor3b(JSContext *cx, jsval v);
JSBool jsval_to_ccarray_of_CCPoint(JSContext* cx, jsval v, CCPoint **points , int *numPoints);
CCArray* jsval_to_ccarray(JSContext* cx, jsval v); CCArray* jsval_to_ccarray(JSContext* cx, jsval v);
jsval ccarray_to_jsval(JSContext* cx, CCArray *arr); jsval ccarray_to_jsval(JSContext* cx, CCArray *arr);
// from native // from native
jsval long_long_to_jsval(JSContext* cx, long long v); jsval long_long_to_jsval(JSContext* cx, long long v);
jsval std_string_to_jsval(JSContext* cx, std::string& v); jsval std_string_to_jsval(JSContext* cx, std::string& v);
jsval c_string_to_jsval(JSContext* cx, const char* v); jsval c_string_to_jsval(JSContext* cx, const char* v);
jsval ccpoint_to_jsval(JSContext* cx, CCPoint& v); jsval ccpoint_to_jsval(JSContext* cx, CCPoint& v);
jsval ccrect_to_jsval(JSContext* cx, CCRect& v); jsval ccrect_to_jsval(JSContext* cx, CCRect& v);
jsval ccsize_to_jsval(JSContext* cx, CCSize& v); jsval ccsize_to_jsval(JSContext* cx, CCSize& v);
jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v); jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v);
jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v); jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v);
jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v); jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v);
jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v); jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v);
JSObject* NewGlobalObject(JSContext* cx);
JSBool jsNewGlobal(JSContext* cx, unsigned argc, jsval* vp);
JSBool jsSocketOpen(JSContext* cx, unsigned argc, jsval* vp);
JSBool jsSocketRead(JSContext* cx, unsigned argc, jsval* vp);
JSBool jsSocketWrite(JSContext* cx, unsigned argc, jsval* vp);
JSBool jsSocketClose(JSContext* cx, unsigned argc, jsval* vp);
#endif #endif
 End of changes. 8 change blocks. 
8 lines changed or deleted 20 lines changed or added


 ShaderTest.h   ShaderTest.h 
skipping to change at line 117 skipping to change at line 117
void update(float dt); void update(float dt);
protected: protected:
CCLabelBMFont* m_pLabel; CCLabelBMFont* m_pLabel;
float m_fAccum; float m_fAccum;
}; };
class ShaderNode : public CCNode class ShaderNode : public CCNode
{ {
public: public:
ShaderNode(); ShaderNode();
~ShaderNode();
bool initWithVertex(const char *vert, const char *frag); bool initWithVertex(const char *vert, const char *frag);
void loadShaderVertex(const char *vert, const char *frag); void loadShaderVertex(const char *vert, const char *frag);
void listenBackToForeground(CCObject *obj);
virtual void update(float dt); virtual void update(float dt);
virtual void setPosition(const CCPoint &newPosition); virtual void setPosition(const CCPoint &newPosition);
virtual void draw(); virtual void draw();
static ShaderNode* shaderNodeWithVertex(const char *vert, const char *f rag); static ShaderNode* shaderNodeWithVertex(const char *vert, const char *f rag);
private: private:
ccVertex2F m_center; ccVertex2F m_center;
ccVertex2F m_resolution; ccVertex2F m_resolution;
float m_time; float m_time;
GLuint m_uniformCenter, m_uniformResolution, m_uniformTime; GLuint m_uniformCenter, m_uniformResolution, m_uniformTime;
std::string m_vertFileName;
std::string m_fragFileName;
}; };
class ShaderTestScene : public TestScene class ShaderTestScene : public TestScene
{ {
public: public:
virtual void runThisTest(); virtual void runThisTest();
}; };
//CCLayer* nextAction(); //CCLayer* nextAction();
 End of changes. 3 change blocks. 
0 lines changed or deleted 4 lines changed or added


 StandardInteger.h   StandardInteger.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Walden <jwalden+code@mit.edu> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Implements the C99 <stdint.h> interface for C and C++ code. */ /* Implements the C99 <stdint.h> interface for C and C++ code. */
#ifndef mozilla_StandardInteger_h_ #ifndef mozilla_StandardInteger_h_
#define mozilla_StandardInteger_h_ #define mozilla_StandardInteger_h_
/* /*
* The C99 standard header <stdint.h> exposes typedefs for common fixed-wid th * The C99 standard header <stdint.h> exposes typedefs for common fixed-wid th
* integer types. It would be feasible to simply #include <stdint.h>, but * integer types. It would be feasible to simply #include <stdint.h>, but
* MSVC++ versions prior to 2010 don't provide <stdint.h>. We could solve this * MSVC++ versions prior to 2010 don't provide <stdint.h>. We could solve this
 End of changes. 1 change blocks. 
48 lines changed or deleted 5 lines changed or added


 Statistics.h   Statistics.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=78: * vim: set ts=8 sw=4 et tw=78:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey JavaScript engine.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsgc_statistics_h___ #ifndef jsgc_statistics_h___
#define jsgc_statistics_h___ #define jsgc_statistics_h___
#include <string.h> #include <string.h>
#include "jsfriendapi.h" #include "jsfriendapi.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jsutil.h" #include "jsutil.h"
struct JSCompartment; struct JSCompartment;
namespace js { namespace js {
namespace gcstats { namespace gcstats {
enum Phase { enum Phase {
PHASE_GC_BEGIN, PHASE_GC_BEGIN,
PHASE_WAIT_BACKGROUND_THREAD, PHASE_WAIT_BACKGROUND_THREAD,
PHASE_PURGE, PHASE_PURGE,
PHASE_MARK, PHASE_MARK,
PHASE_MARK_DISCARD_CODE,
PHASE_MARK_ROOTS, PHASE_MARK_ROOTS,
PHASE_MARK_TYPES,
PHASE_MARK_DELAYED, PHASE_MARK_DELAYED,
PHASE_MARK_OTHER, PHASE_MARK_WEAK,
PHASE_MARK_GRAY,
PHASE_MARK_GRAY_WEAK,
PHASE_FINALIZE_START, PHASE_FINALIZE_START,
PHASE_SWEEP, PHASE_SWEEP,
PHASE_SWEEP_ATOMS,
PHASE_SWEEP_COMPARTMENTS, PHASE_SWEEP_COMPARTMENTS,
PHASE_SWEEP_TABLES,
PHASE_SWEEP_OBJECT, PHASE_SWEEP_OBJECT,
PHASE_SWEEP_STRING, PHASE_SWEEP_STRING,
PHASE_SWEEP_SCRIPT, PHASE_SWEEP_SCRIPT,
PHASE_SWEEP_SHAPE, PHASE_SWEEP_SHAPE,
PHASE_DISCARD_CODE, PHASE_SWEEP_DISCARD_CODE,
PHASE_DISCARD_ANALYSIS, PHASE_DISCARD_ANALYSIS,
PHASE_DISCARD_TI, PHASE_DISCARD_TI,
PHASE_FREE_TI_ARENA,
PHASE_SWEEP_TYPES, PHASE_SWEEP_TYPES,
PHASE_CLEAR_SCRIPT_ANALYSIS, PHASE_CLEAR_SCRIPT_ANALYSIS,
PHASE_FINALIZE_END, PHASE_FINALIZE_END,
PHASE_DESTROY, PHASE_DESTROY,
PHASE_GC_END, PHASE_GC_END,
PHASE_LIMIT PHASE_LIMIT
}; };
enum Stat { enum Stat {
skipping to change at line 108 skipping to change at line 83
void endSlice(); void endSlice();
void reset(const char *reason) { slices.back().resetReason = reason; } void reset(const char *reason) { slices.back().resetReason = reason; }
void nonincremental(const char *reason) { nonincrementalReason = reason ; } void nonincremental(const char *reason) { nonincrementalReason = reason ; }
void count(Stat s) { void count(Stat s) {
JS_ASSERT(s < STAT_LIMIT); JS_ASSERT(s < STAT_LIMIT);
counts[s]++; counts[s]++;
} }
int64_t beginSCC();
void endSCC(unsigned scc, int64_t start);
jschar *formatMessage(); jschar *formatMessage();
jschar *formatJSON(uint64_t timestamp); jschar *formatJSON(uint64_t timestamp);
private: private:
JSRuntime *runtime; JSRuntime *runtime;
int64_t startupTime; int64_t startupTime;
FILE *fp; FILE *fp;
bool fullFormat; bool fullFormat;
/*
* GCs can't really nest, but a second GC can be triggered from within
the
* JSGC_END callback.
*/
int gcDepth;
int collectedCount; int collectedCount;
int compartmentCount; int compartmentCount;
const char *nonincrementalReason; const char *nonincrementalReason;
struct SliceData { struct SliceData {
SliceData(gcreason::Reason reason, int64_t start) SliceData(gcreason::Reason reason, int64_t start, size_t startFault
: reason(reason), resetReason(NULL), start(start) s)
: reason(reason), resetReason(NULL), start(start), startFaults(st
artFaults)
{ {
PodArrayZero(phaseTimes); PodArrayZero(phaseTimes);
} }
gcreason::Reason reason; gcreason::Reason reason;
const char *resetReason; const char *resetReason;
int64_t start, end; int64_t start, end;
size_t startFaults, endFaults;
int64_t phaseTimes[PHASE_LIMIT]; int64_t phaseTimes[PHASE_LIMIT];
int64_t duration() const { return end - start; } int64_t duration() const { return end - start; }
}; };
Vector<SliceData, 8, SystemAllocPolicy> slices; Vector<SliceData, 8, SystemAllocPolicy> slices;
/* Most recent time when the given phase started. */ /* Most recent time when the given phase started. */
int64_t phaseStarts[PHASE_LIMIT]; int64_t phaseStartTimes[PHASE_LIMIT];
/* Total time in a given phase for this GC. */ /* Total time in a given phase for this GC. */
int64_t phaseTimes[PHASE_LIMIT]; int64_t phaseTimes[PHASE_LIMIT];
/* Total time in a given phase over all GCs. */ /* Total time in a given phase over all GCs. */
int64_t phaseTotals[PHASE_LIMIT]; int64_t phaseTotals[PHASE_LIMIT];
/* Number of events of this type for this GC. */ /* Number of events of this type for this GC. */
unsigned int counts[STAT_LIMIT]; unsigned int counts[STAT_LIMIT];
/* Allocated space before the GC started. */ /* Allocated space before the GC started. */
size_t preBytes; size_t preBytes;
/* Sweep times for SCCs of compartments. */
Vector<int64_t, 0, SystemAllocPolicy> sccTimes;
void beginGC(); void beginGC();
void endGC(); void endGC();
int64_t gcDuration(); void gcDuration(int64_t *total, int64_t *maxPause);
void sccDurations(int64_t *total, int64_t *maxPause);
void printStats(); void printStats();
bool formatData(StatisticsSerializer &ss, uint64_t timestamp); bool formatData(StatisticsSerializer &ss, uint64_t timestamp);
double computeMMU(int64_t resolution); double computeMMU(int64_t resolution);
}; };
struct AutoGCSlice { struct AutoGCSlice {
AutoGCSlice(Statistics &stats, int collectedCount, int compartmentCount , gcreason::Reason reason AutoGCSlice(Statistics &stats, int collectedCount, int compartmentCount , gcreason::Reason reason
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
: stats(stats) : stats(stats)
skipping to change at line 189 skipping to change at line 178
struct AutoPhase { struct AutoPhase {
AutoPhase(Statistics &stats, Phase phase JS_GUARD_OBJECT_NOTIFIER_PARAM ) AutoPhase(Statistics &stats, Phase phase JS_GUARD_OBJECT_NOTIFIER_PARAM )
: stats(stats), phase(phase) { JS_GUARD_OBJECT_NOTIFIER_INIT; stats.b eginPhase(phase); } : stats(stats), phase(phase) { JS_GUARD_OBJECT_NOTIFIER_INIT; stats.b eginPhase(phase); }
~AutoPhase() { stats.endPhase(phase); } ~AutoPhase() { stats.endPhase(phase); }
Statistics &stats; Statistics &stats;
Phase phase; Phase phase;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
struct AutoSCC {
AutoSCC(Statistics &stats, unsigned scc JS_GUARD_OBJECT_NOTIFIER_PARAM)
: stats(stats), scc(scc) { JS_GUARD_OBJECT_NOTIFIER_INIT; start = sta
ts.beginSCC(); }
~AutoSCC() { stats.endSCC(scc, start); }
Statistics &stats;
unsigned scc;
int64_t start;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} /* namespace gcstats */ } /* namespace gcstats */
} /* namespace js */ } /* namespace js */
#endif /* jsgc_statistics_h___ */ #endif /* jsgc_statistics_h___ */
 End of changes. 16 change blocks. 
50 lines changed or deleted 45 lines changed or added


 TemplateLib.h   TemplateLib.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Luke Wagner <luke@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef js_template_lib_h__ #ifndef js_template_lib_h__
#define js_template_lib_h__ #define js_template_lib_h__
#include "jstypes.h" #include "jstypes.h"
/* /*
* Library of reusable template meta-functions (that is, functions on types and * Library of reusable template meta-functions (that is, functions on types and
* compile-time values). Meta-functions are placed inside the 'tl' namespac e to * compile-time values). Meta-functions are placed inside the 'tl' namespac e to
* avoid conflict with non-meta functions that logically have the same name * avoid conflict with non-meta functions that logically have the same name
skipping to change at line 177 skipping to change at line 144
template <> struct IsPodType<unsigned long long> { static const bool res ult = true; }; template <> struct IsPodType<unsigned long long> { static const bool res ult = true; };
template <> struct IsPodType<bool> { static const bool res ult = true; }; template <> struct IsPodType<bool> { static const bool res ult = true; };
template <> struct IsPodType<float> { static const bool res ult = true; }; template <> struct IsPodType<float> { static const bool res ult = true; };
template <> struct IsPodType<double> { static const bool res ult = true; }; template <> struct IsPodType<double> { static const bool res ult = true; };
template <> struct IsPodType<wchar_t> { static const bool res ult = true; }; template <> struct IsPodType<wchar_t> { static const bool res ult = true; };
template <typename T> struct IsPodType<T *> { static const bool res ult = true; }; template <typename T> struct IsPodType<T *> { static const bool res ult = true; };
template <bool cond, typename T, T v1, T v2> struct If { static cons t T result = v1; }; template <bool cond, typename T, T v1, T v2> struct If { static cons t T result = v1; };
template <typename T, T v1, T v2> struct If<false, T, v1, v2> { static cons t T result = v2; }; template <typename T, T v1, T v2> struct If<false, T, v1, v2> { static cons t T result = v2; };
template <class T> struct IsPointerType { static const bool res
ult = false; };
template <class T> struct IsPointerType<T *> { static const bool res
ult = true; };
/* /*
* Traits class for identifying types that are implicitly barriered. * Traits class for identifying types that are implicitly barriered.
*/ */
template <class T> struct IsPostBarrieredType { static const bool result = false; }; template <class T> struct IsRelocatableHeapType { static const bool result = true; };
} /* namespace tl */ } /* namespace tl */
} /* namespace js */ } /* namespace js */
#endif /* js_template_lib_h__ */ #endif /* js_template_lib_h__ */
 End of changes. 3 change blocks. 
45 lines changed or deleted 9 lines changed or added


 TouchesTest.h   TouchesTest.h 
skipping to change at line 23 skipping to change at line 23
virtual void runThisTest(); virtual void runThisTest();
virtual void MainMenuCallback(CCObject* pSender); virtual void MainMenuCallback(CCObject* pSender);
}; };
class Ball; class Ball;
class PongLayer : public CCLayer class PongLayer : public CCLayer
{ {
private: private:
CCSize m_tWinSize;
Ball* m_ball; Ball* m_ball;
CCArray* m_paddles; CCArray* m_paddles;
CCPoint m_ballStartingVelocity; CCPoint m_ballStartingVelocity;
public: public:
PongLayer(); PongLayer();
~PongLayer(); ~PongLayer();
void resetAndScoreBallForPlayer(int player); void resetAndScoreBallForPlayer(int player);
void doStep(float delta); void doStep(float delta);
}; };
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 Types.h   Types.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* mfbt foundational types and macros. */ /* mfbt foundational types and macros. */
#ifndef mozilla_Types_h_ #ifndef mozilla_Types_h_
#define mozilla_Types_h_ #define mozilla_Types_h_
/* /*
* This header must be valid C and C++, includable by code embedding either * This header must be valid C and C++, includable by code embedding either
* SpiderMonkey or Gecko. * SpiderMonkey or Gecko.
*/ */
 End of changes. 1 change blocks. 
47 lines changed or deleted 5 lines changed or added


 Util.h   Util.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*
- - */
* vim: set ts=8 sw=4 et tw=99 ft=cpp: /* 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
* ***** BEGIN LICENSE BLOCK ***** * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
* Miscellaneous uncategorized functionality. Please add new functionality to * Miscellaneous uncategorized functionality. Please add new functionality to
* new headers, or to other appropriate existing headers, not here. * new headers, or to other appropriate existing headers, not here.
*/ */
#ifndef mozilla_Util_h_ #ifndef mozilla_Util_h_
#define mozilla_Util_h_ #define mozilla_Util_h_
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Types.h" #include "mozilla/Types.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace mozilla { namespace mozilla {
/** /**
* DebugOnly contains a value of type T, but only in debug builds. In * DebugOnly contains a value of type T, but only in debug builds. In rele
* release builds, it does not contain a value. This helper is ase
* intended to be used along with ASSERT()-style macros, allowing one * builds, it does not contain a value. This helper is intended to be used
* to write with
* * MOZ_ASSERT()-style macros, allowing one to write:
* DebugOnly<bool> check = Func(); *
* ASSERT(check); * DebugOnly<bool> check = func();
* * MOZ_ASSERT(check);
* more concisely than declaring |check| conditional on #ifdef DEBUG, *
* but also without allocating storage space for |check| in release * more concisely than declaring |check| conditional on #ifdef DEBUG, but a
* builds. lso
* * without allocating storage space for |check| in release builds.
* DebugOnly instances can only be coerced to T in debug builds; in *
* release builds, they don't have a value so type coercion is not * DebugOnly instances can only be coerced to T in debug builds. In releas
* well defined. e
* builds they don't have a value, so type coercion is not well defined.
*/ */
template <typename T> template<typename T>
struct DebugOnly struct DebugOnly
{ {
#ifdef DEBUG #ifdef DEBUG
T value; T value;
DebugOnly() {} DebugOnly() { }
DebugOnly(const T& other) : value(other) {} DebugOnly(const T& other) : value(other) { }
DebugOnly(const DebugOnly& other) : value(other.value) {} DebugOnly(const DebugOnly& other) : value(other.value) { }
DebugOnly& operator=(const T& rhs) { DebugOnly& operator=(const T& rhs) {
value = rhs; value = rhs;
return *this; return *this;
} }
void operator++(int) { void operator++(int) {
value++; value++;
} }
void operator--(int) { void operator--(int) {
value--; value--;
} }
T *operator&() { return &value; }
operator T&() { return value; } operator T&() { return value; }
operator const T&() const { return value; } operator const T&() const { return value; }
T& operator->() { return value; } T& operator->() { return value; }
#else #else
DebugOnly() {} DebugOnly() { }
DebugOnly(const T&) {} DebugOnly(const T&) { }
DebugOnly(const DebugOnly&) {} DebugOnly(const DebugOnly&) { }
DebugOnly& operator=(const T&) { return *this; } DebugOnly& operator=(const T&) { return *this; }
void operator++(int) {} void operator++(int) { }
void operator--(int) {} void operator--(int) { }
#endif #endif
/* /*
* DebugOnly must always have a destructor or else it will * DebugOnly must always have a destructor or else it will
* generate "unused variable" warnings, exactly what it's intended * generate "unused variable" warnings, exactly what it's intended
* to avoid! * to avoid!
*/ */
~DebugOnly() {} ~DebugOnly() {}
}; };
/* /*
* This class, and the corresponding macro MOZ_ALIGNOF, figure out how many * This class, and the corresponding macro MOZ_ALIGNOF, figure out how many
* bytes of alignment a given type needs. * bytes of alignment a given type needs.
*/ */
template<class T> template<class T>
struct AlignmentFinder class AlignmentFinder
{ {
private: struct Aligner
struct Aligner {
{ char c;
char c; T t;
T t; };
};
public: public:
static const int alignment = sizeof(Aligner) - sizeof(T); static const size_t alignment = sizeof(Aligner) - sizeof(T);
}; };
#define MOZ_ALIGNOF(T) mozilla::AlignmentFinder<T>::alignment #define MOZ_ALIGNOF(T) mozilla::AlignmentFinder<T>::alignment
/* /*
* Declare the MOZ_ALIGNED_DECL macro for declaring aligned types. * Declare the MOZ_ALIGNED_DECL macro for declaring aligned types.
* *
* For instance, * For instance,
* *
* MOZ_ALIGNED_DECL(char arr[2], 8); * MOZ_ALIGNED_DECL(char arr[2], 8);
skipping to change at line 157 skipping to change at line 121
_type __attribute__((aligned(_align))) _type __attribute__((aligned(_align)))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define MOZ_ALIGNED_DECL(_type, _align) \ # define MOZ_ALIGNED_DECL(_type, _align) \
__declspec(align(_align)) _type __declspec(align(_align)) _type
#else #else
# warning "We don't know how to align variables on this compiler." # warning "We don't know how to align variables on this compiler."
# define MOZ_ALIGNED_DECL(_type, _align) _type # define MOZ_ALIGNED_DECL(_type, _align) _type
#endif #endif
/* /*
* AlignedElem<N> is a structure whose alignment is guaranteed to be at lea * AlignedElem<N> is a structure whose alignment is guaranteed to be at lea
st N bytes. st N
* bytes.
* *
* We support 1, 2, 4, 8, and 16-bit alignment. * We support 1, 2, 4, 8, and 16-bit alignment.
*/ */
template<size_t align> template<size_t align>
struct AlignedElem; struct AlignedElem;
/* /*
* We have to specialize this template because GCC doesn't like __attribute __((aligned(foo))) where * We have to specialize this template because GCC doesn't like __attribute __((aligned(foo))) where
* foo is a template parameter. * foo is a template parameter.
*/ */
template<> template<>
struct AlignedElem<1> struct AlignedElem<1>
{ {
MOZ_ALIGNED_DECL(uint8_t elem, 1); MOZ_ALIGNED_DECL(uint8_t elem, 1);
}; };
template<> template<>
struct AlignedElem<2> struct AlignedElem<2>
{ {
MOZ_ALIGNED_DECL(uint8_t elem, 2); MOZ_ALIGNED_DECL(uint8_t elem, 2);
}; };
template<> template<>
struct AlignedElem<4> struct AlignedElem<4>
{ {
MOZ_ALIGNED_DECL(uint8_t elem, 4); MOZ_ALIGNED_DECL(uint8_t elem, 4);
}; };
template<> template<>
struct AlignedElem<8> struct AlignedElem<8>
{ {
MOZ_ALIGNED_DECL(uint8_t elem, 8); MOZ_ALIGNED_DECL(uint8_t elem, 8);
}; };
template<> template<>
struct AlignedElem<16> struct AlignedElem<16>
{ {
MOZ_ALIGNED_DECL(uint8_t elem, 16); MOZ_ALIGNED_DECL(uint8_t elem, 16);
}; };
/* /*
* This utility pales in comparison to Boost's aligned_storage. The utility * This utility pales in comparison to Boost's aligned_storage. The utility
* simply assumes that uint64_t is enough alignment for anyone. This may ne ed * simply assumes that uint64_t is enough alignment for anyone. This may ne ed
* to be extended one day... * to be extended one day...
* *
* As an important side effect, pulling the storage into this template is * As an important side effect, pulling the storage into this template is
* enough obfuscation to confuse gcc's strict-aliasing analysis into not gi ving * enough obfuscation to confuse gcc's strict-aliasing analysis into not gi ving
* false negatives when we cast from the char buffer to whatever type we've * false negatives when we cast from the char buffer to whatever type we've
* constructed using the bytes. * constructed using the bytes.
*/ */
template <size_t nbytes> template<size_t nbytes>
struct AlignedStorage struct AlignedStorage
{ {
union U { union U {
char bytes[nbytes]; char bytes[nbytes];
uint64_t _; uint64_t _;
} u; } u;
const void *addr() const { return u.bytes; } const void* addr() const { return u.bytes; }
void *addr() { return u.bytes; } void* addr() { return u.bytes; }
}; };
template <class T> template<class T>
struct AlignedStorage2 struct AlignedStorage2
{ {
union U { union U {
char bytes[sizeof(T)]; char bytes[sizeof(T)];
uint64_t _; uint64_t _;
} u; } u;
const T *addr() const { return (const T *)u.bytes; } const T* addr() const { return reinterpret_cast<const T*>(u.bytes); }
T *addr() { return (T *)(void *)u.bytes; } T* addr() { return static_cast<T*>(static_cast<void*>(u.bytes)); }
}; };
/* /*
* Small utility for lazily constructing objects without using dynamic stor age. * Small utility for lazily constructing objects without using dynamic stor age.
* When a Maybe<T> is constructed, it is |empty()|, i.e., no value of T has * When a Maybe<T> is constructed, it is |empty()|, i.e., no value of T has
* been constructed and no T destructor will be called when the Maybe<T> is * been constructed and no T destructor will be called when the Maybe<T> is
* destroyed. Upon calling |construct|, a T object will be constructed with the * destroyed. Upon calling |construct|, a T object will be constructed with the
* given arguments and that object will be destroyed when the owning Maybe< T> * given arguments and that object will be destroyed when the owning Maybe< T>
* is destroyed. * is destroyed.
* *
* N.B. GCC seems to miss some optimizations with Maybe and may generate ex tra * N.B. GCC seems to miss some optimizations with Maybe and may generate ex tra
* branches/loads/stores. Use with caution on hot paths. * branches/loads/stores. Use with caution on hot paths.
*/ */
template <class T> template<class T>
class Maybe class Maybe
{ {
AlignedStorage2<T> storage; AlignedStorage2<T> storage;
bool constructed; bool constructed;
T &asT() { return *storage.addr(); } T& asT() { return *storage.addr(); }
explicit Maybe(const Maybe &other);
const Maybe &operator=(const Maybe &other);
public: public:
Maybe() { constructed = false; } Maybe() { constructed = false; }
~Maybe() { if (constructed) asT().~T(); } ~Maybe() { if (constructed) asT().~T(); }
bool empty() const { return !constructed; } bool empty() const { return !constructed; }
void construct() { void construct() {
MOZ_ASSERT(!constructed); MOZ_ASSERT(!constructed);
new(storage.addr()) T(); new (storage.addr()) T();
constructed = true; constructed = true;
} }
template <class T1> template<class T1>
void construct(const T1 &t1) { void construct(const T1& t1) {
MOZ_ASSERT(!constructed); MOZ_ASSERT(!constructed);
new(storage.addr()) T(t1); new (storage.addr()) T(t1);
constructed = true; constructed = true;
} }
template <class T1, class T2> template<class T1, class T2>
void construct(const T1 &t1, const T2 &t2) { void construct(const T1& t1, const T2& t2) {
MOZ_ASSERT(!constructed); MOZ_ASSERT(!constructed);
new(storage.addr()) T(t1, t2); new (storage.addr()) T(t1, t2);
constructed = true; constructed = true;
} }
template <class T1, class T2, class T3> template<class T1, class T2, class T3>
void construct(const T1 &t1, const T2 &t2, const T3 &t3) { void construct(const T1& t1, const T2& t2, const T3& t3) {
MOZ_ASSERT(!constructed); MOZ_ASSERT(!constructed);
new(storage.addr()) T(t1, t2, t3); new (storage.addr()) T(t1, t2, t3);
constructed = true; constructed = true;
} }
template <class T1, class T2, class T3, class T4> template<class T1, class T2, class T3, class T4>
void construct(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4) void construct(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{ {
MOZ_ASSERT(!constructed); MOZ_ASSERT(!constructed);
new(storage.addr()) T(t1, t2, t3, t4); new (storage.addr()) T(t1, t2, t3, t4);
constructed = true; constructed = true;
} }
T *addr() { T* addr() {
MOZ_ASSERT(constructed); MOZ_ASSERT(constructed);
return &asT(); return &asT();
} }
T &ref() { T& ref() {
MOZ_ASSERT(constructed); MOZ_ASSERT(constructed);
return asT(); return asT();
} }
const T &ref() const { const T& ref() const {
MOZ_ASSERT(constructed); MOZ_ASSERT(constructed);
return const_cast<Maybe *>(this)->asT(); return const_cast<Maybe*>(this)->asT();
} }
void destroy() { void destroy() {
ref().~T(); ref().~T();
constructed = false; constructed = false;
} }
void destroyIfConstructed() { void destroyIfConstructed() {
if (!empty()) if (!empty())
destroy(); destroy();
} }
private:
Maybe(const Maybe& other) MOZ_DELETE;
const Maybe& operator=(const Maybe& other) MOZ_DELETE;
}; };
/* /*
* Safely subtract two pointers when it is known that end >= begin. This a voids * Safely subtract two pointers when it is known that end >= begin. This a voids
* the common compiler bug that if (size_t(end) - size_t(begin)) has the MS B * the common compiler bug that if (size_t(end) - size_t(begin)) has the MS B
* set, the unsigned subtraction followed by right shift will produce -1, o r * set, the unsigned subtraction followed by right shift will produce -1, o r
* size_t(-1), instead of the real difference. * size_t(-1), instead of the real difference.
*/ */
template <class T> template<class T>
MOZ_ALWAYS_INLINE size_t MOZ_ALWAYS_INLINE size_t
PointerRangeSize(T* begin, T* end) PointerRangeSize(T* begin, T* end)
{ {
MOZ_ASSERT(end >= begin); MOZ_ASSERT(end >= begin);
return (size_t(end) - size_t(begin)) / sizeof(T); return (size_t(end) - size_t(begin)) / sizeof(T);
} }
/* /*
* Compute the length of an array with constant length. (Use of this metho d * Compute the length of an array with constant length. (Use of this metho d
* with a non-array pointer will not compile.) * with a non-array pointer will not compile.)
* *
* Beware of the implicit trailing '\0' when using this with string constan ts. * Beware of the implicit trailing '\0' when using this with string constan ts.
*/ */
template<typename T, size_t N> template<typename T, size_t N>
size_t size_t
ArrayLength(T (&arr)[N]) ArrayLength(T (&arr)[N])
{ {
return N; return N;
} }
/* /*
* Compute the address one past the last element of a constant-length array . * Compute the address one past the last element of a constant-length array .
* *
* Beware of the implicit trailing '\0' when using this with string constan ts. * Beware of the implicit trailing '\0' when using this with string constan ts.
*/ */
template<typename T, size_t N> template<typename T, size_t N>
T* T*
ArrayEnd(T (&arr)[N]) ArrayEnd(T (&arr)[N])
{ {
return arr + ArrayLength(arr); return arr + ArrayLength(arr);
} }
} /* namespace mozilla */ } /* namespace mozilla */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* mozilla_Util_h_ */ #endif /* mozilla_Util_h_ */
 End of changes. 42 change blocks. 
148 lines changed or deleted 110 lines changed or added


 Utility.h   Utility.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef js_utility_h__ #ifndef js_utility_h__
#define js_utility_h__ #define js_utility_h__
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef JS_OOM_DO_BACKTRACES #ifdef JS_OOM_DO_BACKTRACES
#include <stdio.h> #include <stdio.h>
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#include "jstypes.h" #include "jstypes.h"
#ifdef __cplusplus #ifdef __cplusplus
# include "mozilla/Scoped.h"
/* The public JS engine namespace. */ /* The public JS engine namespace. */
namespace JS {} namespace JS {}
/* The mozilla-shared reusable template/utility namespace. */ /* The mozilla-shared reusable template/utility namespace. */
namespace mozilla {} namespace mozilla {}
/* The private JS engine namespace. */ /* The private JS engine namespace. */
namespace js { namespace js {
skipping to change at line 100 skipping to change at line 70
# else # else
# define JS_THREADSAFE_ASSERT(expr) ((void) 0) # define JS_THREADSAFE_ASSERT(expr) ((void) 0)
# endif # endif
#else #else
# define JS_THREADSAFE_ASSERT(expr) ((void) 0) # define JS_THREADSAFE_ASSERT(expr) ((void) 0)
#endif #endif
#define JS_STATIC_ASSERT(cond) MOZ_STATIC_ASSERT(cond, "JS_STATIC _ASSERT") #define JS_STATIC_ASSERT(cond) MOZ_STATIC_ASSERT(cond, "JS_STATIC _ASSERT")
#define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, " JS_STATIC_ASSERT_IF") #define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, " JS_STATIC_ASSERT_IF")
extern MOZ_NORETURN JS_PUBLIC_API(void)
JS_Assert(const char *s, const char *file, int ln);
/* /*
* Abort the process in a non-graceful manner. This will cause a core file, * Abort the process in a non-graceful manner. This will cause a core file,
* call to the debugger or other moral equivalent as well as causing the * call to the debugger or other moral equivalent as well as causing the
* entire process to stop. * entire process to stop.
*/ */
extern JS_PUBLIC_API(void) JS_Abort(void); extern JS_PUBLIC_API(void) JS_Abort(void);
/* /*
* Custom allocator support for SpiderMonkey * Custom allocator support for SpiderMonkey
*/ */
skipping to change at line 385 skipping to change at line 358
* This is a version of JS_FloorLog2 that operates on unsigned integers wit h * This is a version of JS_FloorLog2 that operates on unsigned integers wit h
* CPU-dependant size and requires that n != 0. * CPU-dependant size and requires that n != 0.
*/ */
static MOZ_ALWAYS_INLINE size_t static MOZ_ALWAYS_INLINE size_t
JS_FLOOR_LOG2W(size_t n) JS_FLOOR_LOG2W(size_t n)
{ {
JS_ASSERT(n != 0); JS_ASSERT(n != 0);
return js_FloorLog2wImpl(n); return js_FloorLog2wImpl(n);
} }
/*
* JS_ROTATE_LEFT32
*
* There is no rotate operation in the C Language so the construct (a << 4)
|
* (a >> 28) is used instead. Most compilers convert this to a rotate
* instruction but some versions of MSVC don't without a little help. To g
et
* MSVC to generate a rotate instruction, we have to use the _rotl intrinsi
c
* and use a pragma to make _rotl inline.
*
* MSVC in VS2005 will do an inline rotate instruction on the above constru
ct.
*/
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \
defined(_M_X64))
#include <stdlib.h>
#pragma intrinsic(_rotl)
#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits)
#else
#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))
)
#endif
JS_END_EXTERN_C JS_END_EXTERN_C
#ifdef __cplusplus #ifdef __cplusplus
#include <new> #include <new>
/* /*
* User guide to memory management within SpiderMonkey: * User guide to memory management within SpiderMonkey:
* *
* Quick tips: * Quick tips:
* *
skipping to change at line 627 skipping to change at line 620
static JS_ALWAYS_INLINE void free_(void* p) { static JS_ALWAYS_INLINE void free_(void* p) {
::js_free(p); ::js_free(p);
} }
JS_DECLARE_DELETE_METHODS(::js_free, JS_ALWAYS_INLINE static) JS_DECLARE_DELETE_METHODS(::js_free, JS_ALWAYS_INLINE static)
}; };
class UnwantedForeground : public Foreground { class UnwantedForeground : public Foreground {
}; };
template<typename T>
struct ScopedFreePtrTraits
{
typedef T* type;
static T* empty() { return NULL; }
static void release(T* ptr) { Foreground::free_(ptr); }
};
SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits)
template <typename T>
struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T>
{
static void release(T *ptr) { Foreground::delete_(ptr); }
};
SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits)
} /* namespace js */ } /* namespace js */
/* /*
* Note lack of ; in JSRuntime below. This is intentional so "calling" this * Note lack of ; in JSRuntime below. This is intentional so "calling" this
* looks "normal". * looks "normal".
*/ */
#define JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR \ #define JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR \
friend class js::OffTheBooks;\ friend class js::OffTheBooks;\
friend class js::Foreground;\ friend class js::Foreground;\
friend class js::UnwantedForeground;\ friend class js::UnwantedForeground;\
skipping to change at line 848 skipping to change at line 857
* especially since GNU C++ fails to notice that this does indeed initializ e x * especially since GNU C++ fails to notice that this does indeed initializ e x
* and y, which may matter if they're const. * and y, which may matter if they're const.
*/ */
template<typename T> template<typename T>
class MoveRef { class MoveRef {
public: public:
typedef T Referent; typedef T Referent;
explicit MoveRef(T &t) : pointer(&t) { } explicit MoveRef(T &t) : pointer(&t) { }
T &operator*() const { return *pointer; } T &operator*() const { return *pointer; }
T *operator->() const { return pointer; } T *operator->() const { return pointer; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/*
* If MoveRef is used in a rvalue position (which is expected), we can
* end up in a situation where, without this ifdef, we would try to pas
s
* a T& to a move constructor, which fails. It is not clear if the comp
iler
* should instead use the copy constructor, but for now this lets us bu
ild
* with clang. See bug 689066 and llvm.org/pr11003 for the details.
* Note: We can probably remove MoveRef completely once we are comforta
ble
* using c++11.
*/
operator T&& () const { return static_cast<T&&>(*pointer); }
#else
operator T& () const { return *pointer; } operator T& () const { return *pointer; }
#endif
private: private:
T *pointer; T *pointer;
}; };
template<typename T> template<typename T>
MoveRef<T> Move(T &t) { return MoveRef<T>(t); } MoveRef<T> Move(T &t) { return MoveRef<T>(t); }
template<typename T> template<typename T>
MoveRef<T> Move(const T &t) { return MoveRef<T>(const_cast<T &>(t)); } MoveRef<T> Move(const T &t) { return MoveRef<T>(const_cast<T &>(t)); }
skipping to change at line 914 skipping to change at line 910
/* /*
* Round x up to the nearest power of 2. This function assumes that the mo st * Round x up to the nearest power of 2. This function assumes that the mo st
* significant bit of x is not set, which would lead to overflow. * significant bit of x is not set, which would lead to overflow.
*/ */
JS_ALWAYS_INLINE size_t JS_ALWAYS_INLINE size_t
RoundUpPow2(size_t x) RoundUpPow2(size_t x)
{ {
return size_t(1) << JS_CEILING_LOG2W(x); return size_t(1) << JS_CEILING_LOG2W(x);
} }
/* Integral types for all hash functions. */
typedef uint32_t HashNumber;
const unsigned HashNumberSizeBits = 32;
namespace detail {
/*
* Given a raw hash code, h, return a number that can be used to select a h
ash
* bucket.
*
* This function aims to produce as uniform an output distribution as possi
ble,
* especially in the most significant (leftmost) bits, even though the inpu
t
* distribution may be highly nonrandom, given the constraints that this mu
st
* be deterministic and quick to compute.
*
* Since the leftmost bits of the result are best, the hash bucket index is
* computed by doing ScrambleHashCode(h) / (2^32/N) or the equivalent
* right-shift, not ScrambleHashCode(h) % N or the equivalent bit-mask.
*
* FIXME: OrderedHashTable uses a bit-mask; see bug 775896.
*/
inline HashNumber
ScrambleHashCode(HashNumber h)
{
/*
* Simply returning h would not cause any hash tables to produce wrong
* answers. But it can produce pathologically bad performance: The call
er
* right-shifts the result, keeping only the highest bits. The high bit
s of
* hash codes are very often completely entropy-free. (So are the lowes
t
* bits.)
*
* So we use Fibonacci hashing, as described in Knuth, The Art of Compu
ter
* Programming, 6.4. This mixes all the bits of the input hash code h.
*
* The value of goldenRatio is taken from the hex
* expansion of the golden ratio, which starts 1.9E3779B9....
* This value is especially good if values with consecutive hash codes
* are stored in a hash table; see Knuth for details.
*/
static const HashNumber goldenRatio = 0x9E3779B9U;
return h * goldenRatio;
}
} /* namespace detail */
} /* namespace js */ } /* namespace js */
namespace JS { namespace JS {
/* /*
* Methods for poisoning GC heap pointer words and checking for poisoned wo rds. * Methods for poisoning GC heap pointer words and checking for poisoned wo rds.
* These are in this file for use in Value methods and so forth. * These are in this file for use in Value methods and so forth.
* *
* If the moving GC hazard analysis is in use and detects a non-rooted stac k * If the moving GC hazard analysis is in use and detects a non-rooted stac k
* pointer to a GC thing, one byte of that pointer is poisoned to refer to an * pointer to a GC thing, one byte of that pointer is poisoned to refer to an
* invalid location. For both 32 bit and 64 bit systems, the fourth byte of the * invalid location. For both 32 bit and 64 bit systems, the fourth byte of the
* pointer is overwritten, to reduce the likelihood of accidentally changin g * pointer is overwritten, to reduce the likelihood of accidentally changin g
* a live integer value. * a live integer value.
*/ */
inline void PoisonPtr(uintptr_t *v) inline void PoisonPtr(void *v)
{ {
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG)
uint8_t *ptr = (uint8_t *) v + 3; uint8_t *ptr = (uint8_t *) v + 3;
*ptr = JS_FREE_PATTERN; *ptr = JS_FREE_PATTERN;
#endif #endif
} }
template <typename T> template <typename T>
inline bool IsPoisonedPtr(T *v) inline bool IsPoisonedPtr(T *v)
{ {
 End of changes. 10 change blocks. 
61 lines changed or deleted 103 lines changed or added


 Vector.h   Vector.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* June 12, 2009.
*
* The Initial Developer of the Original Code is
* the Mozilla Corporation.
*
* Contributor(s):
* Luke Wagner <lw@mozilla.com>
* Nicholas Nethercote <nnethercote@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsvector_h_ #ifndef jsvector_h_
#define jsvector_h_ #define jsvector_h_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "TemplateLib.h" #include "TemplateLib.h"
#include "Utility.h" #include "Utility.h"
/* Silence dire "bugs in previous versions of MSVC have been fixed" warning s */ /* Silence dire "bugs in previous versions of MSVC have been fixed" warning s */
skipping to change at line 216 skipping to change at line 183
* - any value, however, N is clamped to min/max values * - any value, however, N is clamped to min/max values
* AllocPolicy: * AllocPolicy:
* - see "Allocation policies" in jsalloc.h (default js::TempAllocPolicy) * - see "Allocation policies" in jsalloc.h (default js::TempAllocPolicy)
* *
* N.B: Vector is not reentrant: T member functions called during Vector me mber * N.B: Vector is not reentrant: T member functions called during Vector me mber
* functions must not call back into the same object. * functions must not call back into the same object.
*/ */
template <class T, size_t N, class AllocPolicy> template <class T, size_t N, class AllocPolicy>
class Vector : private AllocPolicy class Vector : private AllocPolicy
{ {
typedef typename tl::StaticAssert<!tl::IsPostBarrieredType<T>::result>: :result _; typedef typename tl::StaticAssert<tl::IsRelocatableHeapType<T>::result> ::result _;
/* utilities */ /* utilities */
static const bool sElemIsPod = tl::IsPodType<T>::result; static const bool sElemIsPod = tl::IsPodType<T>::result;
typedef VectorImpl<T, N, AllocPolicy, sElemIsPod> Impl; typedef VectorImpl<T, N, AllocPolicy, sElemIsPod> Impl;
friend struct VectorImpl<T, N, AllocPolicy, sElemIsPod>; friend struct VectorImpl<T, N, AllocPolicy, sElemIsPod>;
bool calculateNewCapacity(size_t curLength, size_t lengthInc, size_t &n ewCap); bool calculateNewCapacity(size_t curLength, size_t lengthInc, size_t &n ewCap);
bool growStorageBy(size_t lengthInc); bool growStorageBy(size_t lengthInc);
bool growHeapStorageBy(size_t lengthInc); bool growHeapStorageBy(size_t lengthInc);
skipping to change at line 599 skipping to change at line 566
if (!usingInlineStorage()) if (!usingInlineStorage())
this->free_(beginNoCheck()); this->free_(beginNoCheck());
} }
/* /*
* Calculate a new capacity that is at least lengthInc greater than * Calculate a new capacity that is at least lengthInc greater than
* curLength and check for overflow. * curLength and check for overflow.
*/ */
template <class T, size_t N, class AP> template <class T, size_t N, class AP>
STATIC_POSTCONDITION(!return || newCap >= curLength + lengthInc) STATIC_POSTCONDITION(!return || newCap >= curLength + lengthInc)
#ifdef DEBUG
/* gcc (ARM, x86) compiler bug workaround - See bug 694694 */
JS_NEVER_INLINE bool
#else
inline bool inline bool
#endif
Vector<T,N,AP>::calculateNewCapacity(size_t curLength, size_t lengthInc, Vector<T,N,AP>::calculateNewCapacity(size_t curLength, size_t lengthInc,
size_t &newCap) size_t &newCap)
{ {
size_t newMinCap = curLength + lengthInc; size_t newMinCap = curLength + lengthInc;
/* /*
* Check for overflow in the above addition, below CEILING_LOG2, and la ter * Check for overflow in the above addition, below CEILING_LOG2, and la ter
* multiplication by sizeof(T). * multiplication by sizeof(T).
*/ */
if (newMinCap < curLength || if (newMinCap < curLength ||
 End of changes. 4 change blocks. 
46 lines changed or deleted 9 lines changed or added


 c14n.h   c14n.h 
skipping to change at line 68 skipping to change at line 68
* Predefined values for C14N modes * Predefined values for C14N modes
* *
*/ */
typedef enum { typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */ XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode; } xmlC14NMode;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlC14NDocSaveTo (xmlDocPtr doc, xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes, xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */ int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes, xmlChar **inclusive_ns_prefixes,
int with_comments, int with_comments,
xmlOutputBufferPtr buf); xmlOutputBufferPtr buf);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlC14NDocDumpMemory (xmlDocPtr doc, xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes, xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */ int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes, xmlChar **inclusive_ns_prefixes,
int with_comments, int with_comments,
xmlChar **doc_txt_ptr); xmlChar **doc_txt_ptr);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlC14NDocSave (xmlDocPtr doc, xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes, xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */ int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes, xmlChar **inclusive_ns_prefixes,
int with_comments, int with_comments,
const char* filename, const char* filename,
int compression); int compression);
/** /**
* This is the core C14N function * This is the core C14N function
*/ */
/** /**
* xmlC14NIsVisibleCallback: * xmlC14NIsVisibleCallback:
* @user_data: user data * @user_data: user data
* @node: the curent node * @node: the curent node
* @parent: the parent node * @parent: the parent node
* *
* Signature for a C14N callback on visible nodes * Signature for a C14N callback on visible nodes
* *
* Returns 1 if the node should be included * Returns 1 if the node should be included
*/ */
typedef int (*xmlC14NIsVisibleCallback) (void* user_data, typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
xmlNodePtr node, xmlNodePtr node,
xmlNodePtr parent); xmlNodePtr parent);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlC14NExecute (xmlDocPtr doc, xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible xmlC14NIsVisibleCallback is_visible_callback,
_callback, void* user_data,
void* user_data, int mode, /* a xmlC14NMode */
int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes,
xmlChar **inclusive_ns_prefixes, int with_comments,
int with_comments, xmlOutputBufferPtr buf);
xmlOutputBufferPtr buf);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_C14N_ENABLED */ #endif /* LIBXML_C14N_ENABLED */
#endif /* __XML_C14N_H__ */ #endif /* __XML_C14N_H__ */
 End of changes. 5 change blocks. 
30 lines changed or deleted 29 lines changed or added


 catalog.h   catalog.h 
skipping to change at line 37 skipping to change at line 37
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* XML_CATALOGS_NAMESPACE: * XML_CATALOGS_NAMESPACE:
* *
* The namespace for the XML Catalogs elements. * The namespace for the XML Catalogs elements.
*/ */
#define XML_CATALOGS_NAMESPACE \ #define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/** /**
* XML_CATALOG_PI: * XML_CATALOG_PI:
* *
* The specific XML Catalog Processing Instuction name. * The specific XML Catalog Processing Instuction name.
*/ */
#define XML_CATALOG_PI \ #define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog" (const xmlChar *) "oasis-xml-catalog"
/* /*
* The API is voluntarily limited to general cataloging. * The API is voluntarily limited to general cataloging.
*/ */
typedef enum { typedef enum {
XML_CATA_PREFER_NONE = 0, XML_CATA_PREFER_NONE = 0,
XML_CATA_PREFER_PUBLIC = 1, XML_CATA_PREFER_PUBLIC = 1,
XML_CATA_PREFER_SYSTEM XML_CATA_PREFER_SYSTEM
} xmlCatalogPrefer; } xmlCatalogPrefer;
skipping to change at line 70 skipping to change at line 70
XML_CATA_ALLOW_ALL = 3 XML_CATA_ALLOW_ALL = 3
} xmlCatalogAllow; } xmlCatalogAllow;
typedef struct _xmlCatalog xmlCatalog; typedef struct _xmlCatalog xmlCatalog;
typedef xmlCatalog *xmlCatalogPtr; typedef xmlCatalog *xmlCatalogPtr;
/* /*
* Operations on a given catalog. * Operations on a given catalog.
*/ */
XMLPUBFUN xmlCatalogPtr XMLCALL XMLPUBFUN xmlCatalogPtr XMLCALL
xmlNewCatalog (int sgml); xmlNewCatalog (int sgml);
XMLPUBFUN xmlCatalogPtr XMLCALL XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadACatalog (const char *filename); xmlLoadACatalog (const char *filename);
XMLPUBFUN xmlCatalogPtr XMLCALL XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadSGMLSuperCatalog (const char *filename); xmlLoadSGMLSuperCatalog (const char *filename);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlConvertSGMLCatalog (xmlCatalogPtr catal); xmlConvertSGMLCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlACatalogAdd (xmlCatalogPtr catal, xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar *type, const xmlChar *type,
const xmlChar *orig, const xmlChar *orig,
const xmlChar *replace); const xmlChar *replace);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlACatalogRemove (xmlCatalogPtr catal, xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar *value); const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolve (xmlCatalogPtr catal, xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar *pubID, const xmlChar *pubID,
const xmlChar *sysID); const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveSystem(xmlCatalogPtr catal, xmlACatalogResolveSystem(xmlCatalogPtr catal,
const xmlChar *sysID); const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolvePublic(xmlCatalogPtr catal, xmlACatalogResolvePublic(xmlCatalogPtr catal,
const xmlChar *pubID); const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveURI (xmlCatalogPtr catal, xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI); const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlACatalogDump (xmlCatalogPtr catal, xmlACatalogDump (xmlCatalogPtr catal,
FILE *out); FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeCatalog (xmlCatalogPtr catal); xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCatalogIsEmpty (xmlCatalogPtr catal); xmlCatalogIsEmpty (xmlCatalogPtr catal);
/* /*
* Global operations. * Global operations.
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlInitializeCatalog (void); xmlInitializeCatalog (void);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlLoadCatalog (const char *filename); xmlLoadCatalog (const char *filename);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlLoadCatalogs (const char *paths); xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlCatalogCleanup (void); xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlCatalogDump (FILE *out); xmlCatalogDump (FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolve (const xmlChar *pubID, xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID); const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveSystem (const xmlChar *sysID); xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolvePublic (const xmlChar *pubID); xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveURI (const xmlChar *URI); xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCatalogAdd (const xmlChar *type, xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig, const xmlChar *orig,
const xmlChar *replace); const xmlChar *replace);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCatalogRemove (const xmlChar *value); xmlCatalogRemove (const xmlChar *value);
XMLPUBFUN xmlDocPtr XMLCALL XMLPUBFUN xmlDocPtr XMLCALL
xmlParseCatalogFile (const char *filename); xmlParseCatalogFile (const char *filename);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCatalogConvert (void); xmlCatalogConvert (void);
/* /*
* Strictly minimal interfaces for per-document catalogs used * Strictly minimal interfaces for per-document catalogs used
* by the parser. * by the parser.
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlCatalogFreeLocal (void *catalogs); xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlCatalogAddLocal (void *catalogs, xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL); const xmlChar *URL);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolve (void *catalogs, xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID, const xmlChar *pubID,
const xmlChar *sysID); const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolveURI(void *catalogs, xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI); const xmlChar *URI);
/* /*
* Preference settings. * Preference settings.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCatalogSetDebug (int level); xmlCatalogSetDebug (int level);
XMLPUBFUN xmlCatalogPrefer XMLCALL XMLPUBFUN xmlCatalogPrefer XMLCALL
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlCatalogSetDefaults (xmlCatalogAllow allow); xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow XMLCALL XMLPUBFUN xmlCatalogAllow XMLCALL
xmlCatalogGetDefaults (void); xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */ /* DEPRECATED interfaces */
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetSystem (const xmlChar *sysID); xmlCatalogGetSystem (const xmlChar *sysID);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetPublic (const xmlChar *pubID); xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_CATALOG_ENABLED */ #endif /* LIBXML_CATALOG_ENABLED */
#endif /* __XML_CATALOG_H__ */ #endif /* __XML_CATALOG_H__ */
 End of changes. 38 change blocks. 
55 lines changed or deleted 55 lines changed or added


 chvalid.h   chvalid.h 
skipping to change at line 31 skipping to change at line 31
extern "C" { extern "C" {
#endif #endif
/* /*
* Define our typedefs and structures * Define our typedefs and structures
* *
*/ */
typedef struct _xmlChSRange xmlChSRange; typedef struct _xmlChSRange xmlChSRange;
typedef xmlChSRange *xmlChSRangePtr; typedef xmlChSRange *xmlChSRangePtr;
struct _xmlChSRange { struct _xmlChSRange {
unsigned short low; unsigned short low;
unsigned short high; unsigned short high;
}; };
typedef struct _xmlChLRange xmlChLRange; typedef struct _xmlChLRange xmlChLRange;
typedef xmlChLRange *xmlChLRangePtr; typedef xmlChLRange *xmlChLRangePtr;
struct _xmlChLRange { struct _xmlChLRange {
unsigned int low; unsigned int low;
unsigned int high; unsigned int high;
}; };
typedef struct _xmlChRangeGroup xmlChRangeGroup; typedef struct _xmlChRangeGroup xmlChRangeGroup;
typedef xmlChRangeGroup *xmlChRangeGroupPtr; typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup { struct _xmlChRangeGroup {
int nbShortRange; int nbShortRange;
int nbLongRange; int nbLongRange;
const xmlChSRange *shortRange; /* points to an array of ranges */ const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange; const xmlChLRange *longRange;
}; };
/** /**
* Range checking routine * Range checking routine
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroup *grou p); xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/** /**
* xmlIsBaseChar_ch: * xmlIsBaseChar_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a)) || \
((0xc0 <= (c)) && ((c) <= 0xd6)) || \ ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
((0xd8 <= (c)) && ((c) <= 0xf6)) || \ ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
(0xf8 <= (c))) (0xf8 <= (c)))
/** /**
* xmlIsBaseCharQ: * xmlIsBaseCharQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
xmlIsBaseChar_ch((c)) : \ xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup)) xmlCharInRange((c), &xmlIsBaseCharGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
/** /**
* xmlIsBlank_ch: * xmlIsBlank_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsBlank_ch(c) (((c) == 0x20) || \ #define xmlIsBlank_ch(c) (((c) == 0x20) || \
((0x9 <= (c)) && ((c) <= 0xa)) || \ ((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd)) ((c) == 0xd))
/** /**
* xmlIsBlankQ: * xmlIsBlankQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsBlankQ(c) (((c) < 0x100) ? \ #define xmlIsBlankQ(c) (((c) < 0x100) ? \
xmlIsBlank_ch((c)) : 0) xmlIsBlank_ch((c)) : 0)
/** /**
* xmlIsChar_ch: * xmlIsChar_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd) || \ ((c) == 0xd) || \
(0x20 <= (c))) (0x20 <= (c)))
/** /**
* xmlIsCharQ: * xmlIsCharQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsCharQ(c) (((c) < 0x100) ? \ #define xmlIsCharQ(c) (((c) < 0x100) ? \
xmlIsChar_ch((c)) :\ xmlIsChar_ch((c)) :\
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff)))) ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
/** /**
* xmlIsCombiningQ: * xmlIsCombiningQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ #define xmlIsCombiningQ(c) (((c) < 0x100) ? \
0 : \ 0 : \
xmlCharInRange((c), &xmlIsCombiningGroup)) xmlCharInRange((c), &xmlIsCombiningGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
/** /**
* xmlIsDigit_ch: * xmlIsDigit_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
/** /**
* xmlIsDigitQ: * xmlIsDigitQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsDigitQ(c) (((c) < 0x100) ? \ #define xmlIsDigitQ(c) (((c) < 0x100) ? \
xmlIsDigit_ch((c)) : \ xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup)) xmlCharInRange((c), &xmlIsDigitGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
/** /**
* xmlIsExtender_ch: * xmlIsExtender_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsExtender_ch(c) (((c) == 0xb7)) #define xmlIsExtender_ch(c) (((c) == 0xb7))
/** /**
* xmlIsExtenderQ: * xmlIsExtenderQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ #define xmlIsExtenderQ(c) (((c) < 0x100) ? \
xmlIsExtender_ch((c)) : \ xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup)) xmlCharInRange((c), &xmlIsExtenderGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
/** /**
* xmlIsIdeographicQ: * xmlIsIdeographicQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
0 :\ 0 :\
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
((c) == 0x3007) || \ ((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029)))) ((0x3021 <= (c)) && ((c) <= 0x3029))))
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/** /**
* xmlIsPubidChar_ch: * xmlIsPubidChar_ch:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
/** /**
* xmlIsPubidCharQ: * xmlIsPubidCharQ:
* @c: char to validate * @c: char to validate
* *
* Automatically generated by genChRanges.py * Automatically generated by genChRanges.py
*/ */
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0) xmlIsPubidChar_ch((c)) : 0)
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsBaseChar(unsigned int ch); xmlIsBaseChar(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsBlank(unsigned int ch); xmlIsBlank(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsChar(unsigned int ch); xmlIsChar(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsCombining(unsigned int ch); xmlIsCombining(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsDigit(unsigned int ch); xmlIsDigit(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsExtender(unsigned int ch); xmlIsExtender(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsIdeographic(unsigned int ch); xmlIsIdeographic(unsigned int ch);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsPubidChar(unsigned int ch); xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __XML_CHVALID_H__ */ #endif /* __XML_CHVALID_H__ */
 End of changes. 26 change blocks. 
57 lines changed or deleted 57 lines changed or added


 cocos2d.h   cocos2d.h 
skipping to change at line 235 skipping to change at line 235
// root // root
#include "CCCamera.h" #include "CCCamera.h"
#include "CCConfiguration.h" #include "CCConfiguration.h"
#include "CCDirector.h" #include "CCDirector.h"
#include "CCDrawingPrimitives.h" #include "CCDrawingPrimitives.h"
#include "CCScheduler.h" #include "CCScheduler.h"
NS_CC_BEGIN NS_CC_BEGIN
const char* cocos2dVersion(); CC_DLL const char* cocos2dVersion();
NS_CC_END NS_CC_END
#endif // __COCOS2D_H__ #endif // __COCOS2D_H__
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 hash.h   hash.h 
/* /*
* Summary: Chained hash tables * Summary: Chained hash tables
* Description: This module implements the hash table support used in * Description: This module implements the hash table support used in
* various places in the library. * various places in the library.
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.
* *
* Author: Bjorn Reese <bjorn.reese@systematic.dk> * Author: Bjorn Reese <bjorn.reese@systematic.dk>
*/ */
#ifndef __XML_HASH_H__ #ifndef __XML_HASH_H__
#define __XML_HASH_H__ #define __XML_HASH_H__
#ifdef __cplusplus #ifdef __cplusplus
skipping to change at line 99 skipping to change at line 99
* xmlHashScannerFull: * xmlHashScannerFull:
* @payload: the data in the hash * @payload: the data in the hash
* @data: extra scannner data * @data: extra scannner data
* @name: the name associated * @name: the name associated
* @name2: the second name associated * @name2: the second name associated
* @name3: the third name associated * @name3: the third name associated
* *
* Callback when scanning data in a hash with the full scanner. * Callback when scanning data in a hash with the full scanner.
*/ */
typedef void (*xmlHashScannerFull)(void *payload, void *data, typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2, const xmlChar *name, const xmlChar *name2
const xmlChar *name3); ,
const xmlChar *name3);
/* /*
* Constructor and destructor. * Constructor and destructor.
*/ */
XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreate (int size); xmlHashCreate (int size);
XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreateDict(int size, xmlHashCreateDict(int size,
xmlDictPtr dict); xmlDictPtr dict);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table, xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f); xmlHashDeallocator f);
/* /*
* Add a new entry to the hash table. * Add a new entry to the hash table.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashAddEntry (xmlHashTablePtr table, xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
void *userdata); void *userdata);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashUpdateEntry(xmlHashTablePtr table, xmlHashUpdateEntry(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
void *userdata, void *userdata,
xmlHashDeallocator f); xmlHashDeallocator f);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashAddEntry2(xmlHashTablePtr table, xmlHashAddEntry2(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
void *userdata); void *userdata);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashUpdateEntry2(xmlHashTablePtr table, xmlHashUpdateEntry2(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
void *userdata, void *userdata,
xmlHashDeallocator f); xmlHashDeallocator f);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashAddEntry3(xmlHashTablePtr table, xmlHashAddEntry3(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *name3, const xmlChar *name3,
void *userdata); void *userdata);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashUpdateEntry3(xmlHashTablePtr table, xmlHashUpdateEntry3(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *name3, const xmlChar *name3,
void *userdata, void *userdata,
xmlHashDeallocator f); xmlHashDeallocator f);
/* /*
* Remove an entry from the hash table. * Remove an entry from the hash table.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashRemoveEntry(xmlHashTablePtr table, const xmlC har *name,
xmlHashDeallocator f); xmlHashDeallocator f);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, xmlHashRemoveEntry2(xmlHashTablePtr table, const xml Char *name,
const xmlChar *name2, xmlHashDeallocator f); const xmlChar *name2, xmlHashDeallocator f);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, xmlHashRemoveEntry3(xmlHashTablePtr table, const xml Char *name,
const xmlChar *name2, const xmlChar *name3, const xmlChar *name2, const xmlChar *name3,
xmlHashDeallocator f); xmlHashDeallocator f);
/* /*
* Retrieve the userdata. * Retrieve the userdata.
*/ */
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashLookup (xmlHashTablePtr table, xmlHashLookup (xmlHashTablePtr table,
const xmlChar *name); const xmlChar *name);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashLookup2 (xmlHashTablePtr table, xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2); const xmlChar *name2);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashLookup3 (xmlHashTablePtr table, xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *name3); const xmlChar *name3);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashQLookup (xmlHashTablePtr table, xmlHashQLookup (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *prefix); const xmlChar *prefix);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashQLookup2 (xmlHashTablePtr table, xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *prefix, const xmlChar *prefix,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *prefix2); const xmlChar *prefix2);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlHashQLookup3 (xmlHashTablePtr table, xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *prefix, const xmlChar *prefix,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *prefix2, const xmlChar *prefix2,
const xmlChar *name3, const xmlChar *name3,
const xmlChar *prefix3); const xmlChar *prefix3);
/* /*
* Helpers. * Helpers.
*/ */
XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCopy (xmlHashTablePtr table, xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f); xmlHashCopier f);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlHashSize (xmlHashTablePtr table); xmlHashSize (xmlHashTablePtr table);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashScan (xmlHashTablePtr table, xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f, xmlHashScanner f,
void *data); void *data);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashScan3 (xmlHashTablePtr table, xmlHashScan3 (xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *name3, const xmlChar *name3,
xmlHashScanner f, xmlHashScanner f,
void *data); void *data);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashScanFull (xmlHashTablePtr table, xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f, xmlHashScannerFull f,
void *data); void *data);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHashScanFull3(xmlHashTablePtr table, xmlHashScanFull3(xmlHashTablePtr table,
const xmlChar *name, const xmlChar *name,
const xmlChar *name2, const xmlChar *name2,
const xmlChar *name3, const xmlChar *name3,
xmlHashScannerFull f, xmlHashScannerFull f,
void *data); void *data);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* ! __XML_HASH_H__ */ #endif /* ! __XML_HASH_H__ */
 End of changes. 17 change blocks. 
92 lines changed or deleted 93 lines changed or added


 jerror.h   jerror.h 
skipping to change at line 36 skipping to change at line 36
#else #else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined * / /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined * /
#define JMESSAGE(code,string) #define JMESSAGE(code,string)
#endif /* JERROR_H */ #endif /* JERROR_H */
#endif /* JMESSAGE */ #endif /* JMESSAGE */
#ifdef JMAKE_ENUM_LIST #ifdef JMAKE_ENUM_LIST
typedef enum { typedef enum {
#define JMESSAGE(code,string) code , #define JMESSAGE(code,string) code ,
#endif /* JMAKE_ENUM_LIST */ #endif /* JMAKE_ENUM_LIST */
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! * / JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! * /
/* For maintenance convenience, list is alphabetical by message code name * / /* For maintenance convenience, list is alphabetical by message code name * /
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported") JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
JMESSAGE(JERR_BAD_DROP_SAMPLING, JMESSAGE(JERR_BAD_DROP_SAMPLING,
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
JMESSAGE(JERR_BAD_LIB_VERSION, JMESSAGE(JERR_BAD_LIB_VERSION,
"Wrong JPEG library version: library is %d, caller expects %d") "Wrong JPEG library version: library is %d, caller expects %d")
JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved sca n") JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved sca n")
JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
JMESSAGE(JERR_BAD_PROGRESSION, JMESSAGE(JERR_BAD_PROGRESSION,
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
JMESSAGE(JERR_BAD_PROG_SCRIPT, JMESSAGE(JERR_BAD_PROG_SCRIPT,
"Invalid progressive parameters at scan script entry %d") "Invalid progressive parameters at scan script entry %d")
JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
JMESSAGE(JERR_BAD_STRUCT_SIZE, JMESSAGE(JERR_BAD_STRUCT_SIZE,
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") "JPEG parameter struct mismatch: library thinks size is %u, caller exp ects %u")
JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
skipping to change at line 93 skipping to change at line 93
JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
JMESSAGE(JERR_FILE_READ, "Input file read error") JMESSAGE(JERR_FILE_READ, "Input file read error")
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented ye t") JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented ye t")
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixel s") JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixel s")
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
"Cannot transcode due to multiple use of quantization table %d") "Cannot transcode due to multiple use of quantization table %d")
JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
JMESSAGE(JERR_NOTIMPL, "Not implemented yet") JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time" ) JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time" )
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
JMESSAGE(JERR_QUANT_COMPONENTS, JMESSAGE(JERR_QUANT_COMPONENTS,
"Cannot quantize more than %d color components") "Cannot quantize more than %d color components")
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers" ) JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers" )
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker" ) JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker" )
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers" ) JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers" )
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
JMESSAGE(JERR_TFILE_WRITE, JMESSAGE(JERR_TFILE_WRITE,
"Write failed on temporary file --- out of disk space?") "Write failed on temporary file --- out of disk space?")
JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
JMESSAGE(JERR_XMS_READ, "Read from XMS failed") JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
JMESSAGE(JMSG_VERSION, JVERSION) JMESSAGE(JMSG_VERSION, JVERSION)
JMESSAGE(JTRC_16BIT_TABLES, JMESSAGE(JTRC_16BIT_TABLES,
"Caution: quantization tables are too coarse for baseline JPEG") "Caution: quantization tables are too coarse for baseline JPEG")
JMESSAGE(JTRC_ADOBE, JMESSAGE(JTRC_ADOBE,
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d" ) "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
JMESSAGE(JTRC_DRI, "Define Restart Interval %u") JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
JMESSAGE(JTRC_EOI, "End Of Image") JMESSAGE(JTRC_EOI, "End Of Image")
JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u") "Warning: thumbnail image size does not match data length %u")
JMESSAGE(JTRC_JFIF_EXTENSION, JMESSAGE(JTRC_JFIF_EXTENSION,
"JFIF extension marker: type 0x%02x, length %u") "JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
JMESSAGE(JTRC_RST, "RST%d") JMESSAGE(JTRC_RST, "RST%d")
JMESSAGE(JTRC_SMOOTH_NOTIMPL, JMESSAGE(JTRC_SMOOTH_NOTIMPL,
"Smoothing not supported with nonstandard sampling ratios") "Smoothing not supported with nonstandard sampling ratios")
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components= %d") JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components= %d")
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
JMESSAGE(JTRC_SOI, "Start of Image") JMESSAGE(JTRC_SOI, "Start of Image")
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
JMESSAGE(JTRC_THUMB_JPEG, JMESSAGE(JTRC_THUMB_JPEG,
"JFIF extension marker: JPEG-compressed thumbnail image, length %u" ) "JFIF extension marker: JPEG-compressed thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_PALETTE, JMESSAGE(JTRC_THUMB_PALETTE,
"JFIF extension marker: palette thumbnail image, length %u") "JFIF extension marker: palette thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_RGB, JMESSAGE(JTRC_THUMB_RGB,
"JFIF extension marker: RGB thumbnail image, length %u") "JFIF extension marker: RGB thumbnail image, length %u")
JMESSAGE(JTRC_UNKNOWN_IDS, JMESSAGE(JTRC_UNKNOWN_IDS,
"Unrecognized component IDs %d %d %d, assuming YCbCr") "Unrecognized component IDs %d %d %d, assuming YCbCr")
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
JMESSAGE(JWRN_BOGUS_PROGRESSION, JMESSAGE(JWRN_BOGUS_PROGRESSION,
"Inconsistent progression sequence for component %d coefficient %d" ) "Inconsistent progression sequence for component %d coefficient %d")
JMESSAGE(JWRN_EXTRANEOUS_DATA, JMESSAGE(JWRN_EXTRANEOUS_DATA,
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment ") JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment ")
JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
JMESSAGE(JWRN_MUST_RESYNC, JMESSAGE(JWRN_MUST_RESYNC,
"Corrupt JPEG data: found marker 0x%02x instead of RST%d") "Corrupt JPEG data: found marker 0x%02x instead of RST%d")
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
#ifdef JMAKE_ENUM_LIST #ifdef JMAKE_ENUM_LIST
JMSG_LASTMSGCODE JMSG_LASTMSGCODE
} J_MESSAGE_CODE; } J_MESSAGE_CODE;
#undef JMAKE_ENUM_LIST #undef JMAKE_ENUM_LIST
#endif /* JMAKE_ENUM_LIST */ #endif /* JMAKE_ENUM_LIST */
skipping to change at line 247 skipping to change at line 247
(cinfo)->err->msg_parm.i[2] = (p3), \ (cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \ (cinfo)->err->msg_parm.i[3] = (p4), \
(cinfo)->err->msg_parm.i[4] = (p5), \ (cinfo)->err->msg_parm.i[4] = (p5), \
(cinfo)->err->msg_parm.i[5] = (p6), \ (cinfo)->err->msg_parm.i[5] = (p6), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXITS(cinfo,code,str) \ #define ERREXITS(cinfo,code,str) \
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define MAKESTMT(stuff) do { stuff } while (0) #define MAKESTMT(stuff) do { stuff } while (0)
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ /* Nonfatal errors (we can keep going, but the data is probably corrupt) */
#define WARNMS(cinfo,code) \ #define WARNMS(cinfo,code) \
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS1(cinfo,code,p1) \ #define WARNMS1(cinfo,code,p1) \
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS2(cinfo,code,p1,p2) \ #define WARNMS2(cinfo,code,p1,p2) \
skipping to change at line 278 skipping to change at line 278
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS2(cinfo,lvl,code,p1,p2) \ #define TRACEMS2(cinfo,lvl,code,p1,p2) \
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ #define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
(cinfo)->err->msg_code = (code); \ (cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
(cinfo)->err->msg_code = (code); \ (cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ #define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); \ _mp[4] = (p5); \
(cinfo)->err->msg_code = (code); \ (cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
(cinfo)->err->msg_code = (code); \ (cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMSS(cinfo,lvl,code,str) \ #define TRACEMSS(cinfo,lvl,code,str) \
((cinfo)->err->msg_code = (code), \ ((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#endif /* JERROR_H */ #endif /* JERROR_H */
 End of changes. 26 change blocks. 
36 lines changed or deleted 36 lines changed or added


 jmorecfg.h   jmorecfg.h 
skipping to change at line 23 skipping to change at line 23
/* /*
* Define BITS_IN_JSAMPLE as either * Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting) * 8 for 8-bit sample values (the usual setting)
* 12 for 12-bit sample values * 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the * Only 8 and 12 are legal data precisions for lossy JPEG according to the
* JPEG standard, and the IJG code does not support anything else! * JPEG standard, and the IJG code does not support anything else!
* We do not support run-time selection of data precision, sorry. * We do not support run-time selection of data precision, sorry.
*/ */
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ #define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
/* /*
* Maximum number of components (color channels) allowed in JPEG image. * Maximum number of components (color channels) allowed in JPEG image.
* To meet the letter of the JPEG spec, set this to 255. However, darn * To meet the letter of the JPEG spec, set this to 255. However, darn
* few applications need more than 4 channels (maybe 5 for CMYK + alpha * few applications need more than 4 channels (maybe 5 for CMYK + alpha
* mask). We recommend 10 as a reasonable compromise; use 4 if you are * mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so * really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.) * bytes of storage, whether actually used in an image or not.)
*/ */
#define MAX_COMPONENTS 10 /* maximum number of image components */ #define MAX_COMPONENTS 10 /* maximum number of image components */
/* /*
* Basic data types. * Basic data types.
* You may need to change these if you have a machine with unusual data * You may need to change these if you have a machine with unusual data
* type sizes; for example, "char" not 8 bits, "short" not 16 bits, * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
* but it had better be at least 16. * but it had better be at least 16.
*/ */
/* Representation of a single sample (pixel element value). /* Representation of a single sample (pixel element value).
skipping to change at line 71 skipping to change at line 71
typedef char JSAMPLE; typedef char JSAMPLE;
#ifdef CHAR_IS_UNSIGNED #ifdef CHAR_IS_UNSIGNED
#define GETJSAMPLE(value) ((int) (value)) #define GETJSAMPLE(value) ((int) (value))
#else #else
#define GETJSAMPLE(value) ((int) (value) & 0xFF) #define GETJSAMPLE(value) ((int) (value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */ #endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */ #endif /* HAVE_UNSIGNED_CHAR */
#define MAXJSAMPLE 255 #define MAXJSAMPLE 255
#define CENTERJSAMPLE 128 #define CENTERJSAMPLE 128
#endif /* BITS_IN_JSAMPLE == 8 */ #endif /* BITS_IN_JSAMPLE == 8 */
#if BITS_IN_JSAMPLE == 12 #if BITS_IN_JSAMPLE == 12
/* JSAMPLE should be the smallest type that will hold the values 0..4095. /* JSAMPLE should be the smallest type that will hold the values 0..4095.
* On nearly all machines "short" will do nicely. * On nearly all machines "short" will do nicely.
*/ */
typedef short JSAMPLE; typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value)) #define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 4095 #define MAXJSAMPLE 4095
#define CENTERJSAMPLE 2048 #define CENTERJSAMPLE 2048
#endif /* BITS_IN_JSAMPLE == 12 */ #endif /* BITS_IN_JSAMPLE == 12 */
/* Representation of a DCT frequency coefficient. /* Representation of a DCT frequency coefficient.
* This should be a signed value of at least 16 bits; "short" is usually OK . * This should be a signed value of at least 16 bits; "short" is usually OK .
* Again, we allocate large arrays of these, but you can change to int * Again, we allocate large arrays of these, but you can change to int
* if you have memory to burn and "short" is really slow. * if you have memory to burn and "short" is really slow.
*/ */
typedef short JCOEF; typedef short JCOEF;
skipping to change at line 148 skipping to change at line 148
/* UINT16 must hold at least the values 0..65535. */ /* UINT16 must hold at least the values 0..65535. */
#ifdef HAVE_UNSIGNED_SHORT #ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16; typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */ #else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16; typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */ #endif /* HAVE_UNSIGNED_SHORT */
/* INT16 must hold at least the values -32768..32767. */ /* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16; typedef short INT16;
#endif #endif
/* INT32 must hold at least signed 32-bit values. */ /* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ #ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
#ifndef _BASETSD_H /* MinGW is slightly different */ #ifndef _BASETSD_H /* MinGW is slightly different */
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ #ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
typedef long INT32; typedef long INT32;
#endif #endif
#endif #endif
#endif #endif
#endif #endif
/* Datatype used for image dimensions. The JPEG standard only supports /* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
* "unsigned int" is sufficient on all machines. However, if you need to * "unsigned int" is sufficient on all machines. However, if you need to
* handle larger images and you don't mind deviating from the spec, you * handle larger images and you don't mind deviating from the spec, you
skipping to change at line 183 skipping to change at line 183
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
/* These macros are used in all function definitions and extern declaration s. /* These macros are used in all function definitions and extern declaration s.
* You could modify them if you need to change function linkage conventions ; * You could modify them if you need to change function linkage conventions ;
* in particular, you'll need to do that to make the library a Windows DLL. * in particular, you'll need to do that to make the library a Windows DLL.
* Another application is to make all functions global for use with debugge rs * Another application is to make all functions global for use with debugge rs
* or code profilers that require it. * or code profilers that require it.
*/ */
/* a function called through method pointers: */ /* a function called through method pointers: */
#define METHODDEF(type) static type #define METHODDEF(type) static type
/* a function used only in its module: */ /* a function used only in its module: */
#define LOCAL(type) static type #define LOCAL(type) static type
/* a function referenced thru EXTERNs: */ /* a function referenced thru EXTERNs: */
#define GLOBAL(type) type #define GLOBAL(type) type
/* a reference to a GLOBAL function: */ /* a reference to a GLOBAL function: */
#define EXTERN(type) extern type #define EXTERN(type) extern type
/* This macro is used to declare a "method", that is, a function pointer. /* This macro is used to declare a "method", that is, a function pointer.
* We want to supply prototype parameters if the compiler can cope. * We want to supply prototype parameters if the compiler can cope.
* Note that the arglist parameter must be parenthesized! * Note that the arglist parameter must be parenthesized!
* Again, you can customize this if you need special linkage keywords. * Again, you can customize this if you need special linkage keywords.
*/ */
#ifdef HAVE_PROTOTYPES #ifdef HAVE_PROTOTYPES
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist #define JMETHOD(type,methodname,arglist) type (*methodname) arglist
#else #else
skipping to change at line 227 skipping to change at line 227
/* /*
* On a few systems, type boolean and/or its values FALSE, TRUE may appear * On a few systems, type boolean and/or its values FALSE, TRUE may appear
* in standard header files. Or you may have conflicts with application- * in standard header files. Or you may have conflicts with application-
* specific header files that you want to include together with these files . * specific header files that you want to include together with these files .
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work. * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/ */
#ifndef HAVE_BOOLEAN #ifndef HAVE_BOOLEAN
typedef int boolean; typedef int boolean;
#endif #endif
#ifndef FALSE /* in case these macros already exist */ #ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */ #define FALSE 0 /* values of boolean */
#endif #endif
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif #endif
/* /*
* The remaining options affect code selection within the JPEG library, * The remaining options affect code selection within the JPEG library,
* but they don't need to be visible to most applications using the library . * but they don't need to be visible to most applications using the library .
* To minimize application namespace pollution, the symbols won't be * To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
*/ */
#ifdef JPEG_INTERNALS #ifdef JPEG_INTERNALS
skipping to change at line 257 skipping to change at line 257
/* /*
* These defines indicate whether to include various optional functions. * These defines indicate whether to include various optional functions.
* Undefining some of these symbols will produce a smaller but less capable * Undefining some of these symbols will produce a smaller but less capable
* library. Note that you can leave certain source files out of the * library. Note that you can leave certain source files out of the
* compilation/linking process if you've #undef'd the corresponding symbols . * compilation/linking process if you've #undef'd the corresponding symbols .
* (You may HAVE to do that if your compiler doesn't like null source files .) * (You may HAVE to do that if your compiler doesn't like null source files .)
*/ */
/* Capability options common to encoder and decoder: */ /* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ #define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ #define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW #define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW
*/ */
/* Encoder capability options: */ /* Encoder capability options: */
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires M #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTI
ULTISCAN)*/ SCAN)*/
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DC #define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires
T_ISLOW)*/ DCT_ISLOW)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parm
*/ s? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off /* Note: if you selected 12-bit data precision, it is dangerous to turn off
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8- bit * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8- bit
* precision, so jchuff.c normally uses entropy optimization to compute * precision, so jchuff.c normally uses entropy optimization to compute
* usable tables for higher precision. If you don't want to do optimizatio n, * usable tables for higher precision. If you don't want to do optimizatio n,
* you'll have to supply different default Huffman tables. * you'll have to supply different default Huffman tables.
* The exact same statements apply for progressive JPEG: the default tables * The exact same statements apply for progressive JPEG: the default tables
* don't work for progressive mode. (This may get fixed, however.) * don't work for progressive mode. (This may get fixed, however.)
*/ */
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ #define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
/* Decoder capability options: */ /* Decoder capability options: */
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires M #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTI
ULTISCAN)*/ SCAN)*/
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
/* more capability options later, no doubt */ /* more capability options later, no doubt */
/* /*
* Ordering of RGB data in scanlines passed to or from the application. * Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just * If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X * change these macros. You can also deal with formats such as R,G,B,X
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changin g * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changin g
* the offsets will also change the order in which colormap data is organiz ed. * the offsets will also change the order in which colormap data is organiz ed.
* RESTRICTIONS: * RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB forma ts. * 1. The sample applications cjpeg,djpeg do NOT support modified RGB forma ts.
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are no t * 2. These macros only affect RGB<=>YCbCr color conversion, so they are no t
* useful if you are using JPEG color spaces other than YCbCr or graysca le. * useful if you are using JPEG color spaces other than YCbCr or graysca le.
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZ E * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZ E
* is not 3 (they don't understand about dummy color components!). So y ou * is not 3 (they don't understand about dummy color components!). So y ou
* can't use color quantization if you change that value. * can't use color quantization if you change that value.
*/ */
#define RGB_RED 0 /* Offset of Red in an RGB scanline #define RGB_RED 0 /* Offset of Red in an RGB scanline element */
element */ #define RGB_GREEN 1 /* Offset of Green */
#define RGB_GREEN 1 /* Offset of Green */ #define RGB_BLUE 2 /* Offset of Blue */
#define RGB_BLUE 2 /* Offset of Blue */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
/* Definitions for speed-related optimizations. */ /* Definitions for speed-related optimizations. */
/* If your compiler supports inline functions, define INLINE /* If your compiler supports inline functions, define INLINE
* as the inline keyword; otherwise define it as empty. * as the inline keyword; otherwise define it as empty.
*/ */
#ifndef INLINE #ifndef INLINE
#ifdef __GNUC__ /* for instance, GNU C knows about i nline */ #ifdef __GNUC__ /* for instance, GNU C knows about inline */
#define INLINE __inline__ #define INLINE __inline__
#endif #endif
#ifndef INLINE #ifndef INLINE
#define INLINE /* default is to define it as empty */ #define INLINE /* default is to define it as empty */
#endif #endif
#endif #endif
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplyin g /* On some machines (notably 68000 series) "int" is 32 bits, but multiplyin g
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIE R * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIE R
* as short on such a machine. MULTIPLIER must be at least 16 bits wide. * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
*/ */
#ifndef MULTIPLIER #ifndef MULTIPLIER
#define MULTIPLIER int /* type for fastest integer multiply */ #define MULTIPLIER int /* type for fastest integer multiply */
#endif #endif
/* FAST_FLOAT should be either float or double, whichever is done faster /* FAST_FLOAT should be either float or double, whichever is done faster
* by your compiler. (Note that this type is only used in the floating poi nt * by your compiler. (Note that this type is only used in the floating poi nt
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
* Typically, float is faster in ANSI C compilers, while double is faster i n * Typically, float is faster in ANSI C compilers, while double is faster i n
* pre-ANSI compilers (because they insist on converting to double anyway). * pre-ANSI compilers (because they insist on converting to double anyway).
* The code below therefore chooses float if we have ANSI-style prototypes. * The code below therefore chooses float if we have ANSI-style prototypes.
*/ */
 End of changes. 20 change blocks. 
42 lines changed or deleted 41 lines changed or added


 jpeglib.h   jpeglib.h 
/* /*
* jpeglib.h * jpeglib.h
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2010 by Guido Vollbeding. * Modified 2002-2009 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file . * For conditions of distribution and use, see the accompanying README file .
* *
* This file defines the application interface for the JPEG library. * This file defines the application interface for the JPEG library.
* Most applications using the library need only include this file, * Most applications using the library need only include this file,
* and perhaps jerror.h if they want to know the exact error codes. * and perhaps jerror.h if they want to know the exact error codes.
*/ */
#ifndef JPEGLIB_H #ifndef JPEGLIB_H
#define JPEGLIB_H #define JPEGLIB_H
/* /*
* First we include the configuration files that record how this * First we include the configuration files that record how this
* installation of the JPEG library is set up. jconfig.h can be * installation of the JPEG library is set up. jconfig.h can be
* generated automatically for many systems. jmorecfg.h contains * generated automatically for many systems. jmorecfg.h contains
* manual configuration options that most people need not worry about. * manual configuration options that most people need not worry about.
*/ */
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
#include "jconfig.h" /* widely used configuration options */ #include "jconfig.h" /* widely used configuration options */
#endif #endif
#include "jmorecfg.h" /* seldom changed options */ #include "jmorecfg.h" /* seldom changed options */
#ifdef __cplusplus #ifdef __cplusplus
#ifndef DONT_USE_EXTERN_C #ifndef DONT_USE_EXTERN_C
extern "C" { extern "C" {
#endif #endif
#endif #endif
/* Version IDs for the JPEG library. /* Version ID for the JPEG library.
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 80". * Might be useful for tests like "#if JPEG_LIB_VERSION >= 80".
*/ */
#define JPEG_LIB_VERSION 80 /* Compatibility version 8.0 */ #define JPEG_LIB_VERSION 80 /* Version 8.0 */
#define JPEG_LIB_VERSION_MAJOR 8
#define JPEG_LIB_VERSION_MINOR 3
/* Various constants determining the sizes of things. /* Various constants determining the sizes of things.
* All of these are specified by the JPEG standard, so don't change them * All of these are specified by the JPEG standard, so don't change them
* if you want to be compatible. * if you want to be compatible.
*/ */
#define DCTSIZE 8 /* The basic DCT block is 8x8 sample #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
s */ #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block
#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
*/ #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 *
#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ /
#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ #define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ #define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15
#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
*/ #define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one sc
#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ an */
#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
/* Unfortunately, some bozo at Adobe saw no reason to be bound by the stand ard; /* Unfortunately, some bozo at Adobe saw no reason to be bound by the stand ard;
* the PostScript DCT filter can emit files with many more than 10 blocks/M CU. * the PostScript DCT filter can emit files with many more than 10 blocks/M CU.
* If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
* to handle it. We even let you do this from the jconfig.h file. However , * to handle it. We even let you do this from the jconfig.h file. However ,
* we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
* sometimes emits noncompliant files doesn't mean you should too. * sometimes emits noncompliant files doesn't mean you should too.
*/ */
#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ #define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
#ifndef D_MAX_BLOCKS_IN_MCU #ifndef D_MAX_BLOCKS_IN_MCU
#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ #define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
#endif #endif
/* Data structures for images (arrays of samples and of DCT coefficients). /* Data structures for images (arrays of samples and of DCT coefficients).
* On 80x86 machines, the image arrays are too big for near pointers, * On 80x86 machines, the image arrays are too big for near pointers,
* but the pointer arrays can fit in near memory. * but the pointer arrays can fit in near memory.
*/ */
typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples.
typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ */
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) *
color */ /
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is colo
typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ r */
typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks
*/ typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficien typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient bloc
t blocks */ ks */
typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks
*/ */
typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks *
/
typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */
/* Types for JPEG compression parameters and working tables. */ /* Types for JPEG compression parameters and working tables. */
/* DCT coefficient quantization tables. */ /* DCT coefficient quantization tables. */
typedef struct { typedef struct {
/* This array gives the coefficient quantizers in natural array order /* This array gives the coefficient quantizers in natural array order
* (not the zigzag order in which they are stored in a JPEG DQT marker). * (not the zigzag order in which they are stored in a JPEG DQT marker).
* CAUTION: IJG versions prior to v6a kept this array in zigzag order. * CAUTION: IJG versions prior to v6a kept this array in zigzag order.
*/ */
UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient * /
/* This field is used only during compression. It's initialized FALSE wh en /* This field is used only during compression. It's initialized FALSE wh en
* the table is created, and set TRUE when it's been output to the file. * the table is created, and set TRUE when it's been output to the file.
* You could suppress output of a table by setting this to TRUE. * You could suppress output of a table by setting this to TRUE.
* (See jpeg_suppress_tables for an example.) * (See jpeg_suppress_tables for an example.)
*/ */
boolean sent_table; /* TRUE when table has been output */ boolean sent_table; /* TRUE when table has been output */
} JQUANT_TBL; } JQUANT_TBL;
/* Huffman coding tables. */ /* Huffman coding tables. */
typedef struct { typedef struct {
/* These two fields directly represent the contents of a JPEG DHT marker */ /* These two fields directly represent the contents of a JPEG DHT marker */
UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
/* length k bits; bits[0] is unused */ /* length k bits; bits[0] is unused */
UINT8 huffval[256]; /* The symbols, in order of incr code length UINT8 huffval[256]; /* The symbols, in order of incr code length *
*/ /
/* This field is used only during compression. It's initialized FALSE wh en /* This field is used only during compression. It's initialized FALSE wh en
* the table is created, and set TRUE when it's been output to the file. * the table is created, and set TRUE when it's been output to the file.
* You could suppress output of a table by setting this to TRUE. * You could suppress output of a table by setting this to TRUE.
* (See jpeg_suppress_tables for an example.) * (See jpeg_suppress_tables for an example.)
*/ */
boolean sent_table; /* TRUE when table has been output */ boolean sent_table; /* TRUE when table has been output */
} JHUFF_TBL; } JHUFF_TBL;
/* Basic info about one component (color channel). */ /* Basic info about one component (color channel). */
typedef struct { typedef struct {
/* These values are fixed over the whole image. */ /* These values are fixed over the whole image. */
/* For compression, they must be supplied by parameter setup; */ /* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOF marker. */ /* for decompression, they are read from the SOF marker. */
int component_id; /* identifier for this component (0..255) */ int component_id; /* identifier for this component (0..255) */
int component_index; /* its index in SOF or cinfo->comp_info[] */ int component_index; /* its index in SOF or cinfo->comp_info[] */
int h_samp_factor; /* horizontal sampling factor (1..4) */ int h_samp_factor; /* horizontal sampling factor (1..4) */
int v_samp_factor; /* vertical sampling factor (1..4) */ int v_samp_factor; /* vertical sampling factor (1..4) */
int quant_tbl_no; /* quantization table selector (0..3) */ int quant_tbl_no; /* quantization table selector (0..3) */
/* These values may vary between scans. */ /* These values may vary between scans. */
/* For compression, they must be supplied by parameter setup; */ /* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOS marker. */ /* for decompression, they are read from the SOS marker. */
/* The decompressor output side may not use these variables. */ /* The decompressor output side may not use these variables. */
int dc_tbl_no; /* DC entropy table selector (0..3) */ int dc_tbl_no; /* DC entropy table selector (0..3) */
int ac_tbl_no; /* AC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */
/* Remaining fields should be treated as private by applications. */ /* Remaining fields should be treated as private by applications. */
/* These values are computed during compression or decompression startup: */ /* These values are computed during compression or decompression startup: */
/* Component's size in DCT blocks. /* Component's size in DCT blocks.
* Any dummy blocks added to complete an MCU are not counted; therefore * Any dummy blocks added to complete an MCU are not counted; therefore
* these values do not depend on whether a scan is interleaved or not. * these values do not depend on whether a scan is interleaved or not.
*/ */
JDIMENSION width_in_blocks; JDIMENSION width_in_blocks;
JDIMENSION height_in_blocks; JDIMENSION height_in_blocks;
skipping to change at line 156 skipping to change at line 154
* Note that different components may receive different DCT scalings. * Note that different components may receive different DCT scalings.
*/ */
int DCT_h_scaled_size; int DCT_h_scaled_size;
int DCT_v_scaled_size; int DCT_v_scaled_size;
/* The downsampled dimensions are the component's actual, unpadded number /* The downsampled dimensions are the component's actual, unpadded number
* of samples at the main buffer (preprocessing/compression interface); * of samples at the main buffer (preprocessing/compression interface);
* DCT scaling is included, so * DCT scaling is included, so
* downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCT SIZE) * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCT SIZE)
* and similarly for height. * and similarly for height.
*/ */
JDIMENSION downsampled_width; /* actual width in samples */ JDIMENSION downsampled_width; /* actual width in samples */
JDIMENSION downsampled_height; /* actual height in samples */ JDIMENSION downsampled_height; /* actual height in samples */
/* This flag is used only for decompression. In cases where some of the /* This flag is used only for decompression. In cases where some of the
* components will be ignored (eg grayscale output from YCbCr image), * components will be ignored (eg grayscale output from YCbCr image),
* we can skip most computations for the unused components. * we can skip most computations for the unused components.
*/ */
boolean component_needed; /* do we need the value of this component? * / boolean component_needed; /* do we need the value of this component? * /
/* These values are computed before starting a scan of the component. */ /* These values are computed before starting a scan of the component. */
/* The decompressor output side may not use these variables. */ /* The decompressor output side may not use these variables. */
int MCU_width; /* number of blocks per MCU, horizontally */ int MCU_width; /* number of blocks per MCU, horizontally */
int MCU_height; /* number of blocks per MCU, vertically */ int MCU_height; /* number of blocks per MCU, vertically */
int MCU_blocks; /* MCU_width * MCU_height */ int MCU_blocks; /* MCU_width * MCU_height */
int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_s int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scale
caled_size */ d_size */
int last_col_width; /* # of non-dummy blocks across in last MCU int last_col_width; /* # of non-dummy blocks across in last MCU */
*/ int last_row_height; /* # of non-dummy blocks down in last MCU */
int last_row_height; /* # of non-dummy blocks down in last MCU */
/* Saved quantization table for component; NULL if none yet saved. /* Saved quantization table for component; NULL if none yet saved.
* See jdinput.c comments about the need for this information. * See jdinput.c comments about the need for this information.
* This field is currently used only for decompression. * This field is currently used only for decompression.
*/ */
JQUANT_TBL * quant_table; JQUANT_TBL * quant_table;
/* Private per-component storage for DCT or IDCT subsystem. */ /* Private per-component storage for DCT or IDCT subsystem. */
void * dct_table; void * dct_table;
} jpeg_component_info; } jpeg_component_info;
/* The script for encoding a multiple-scan file is an array of these: */ /* The script for encoding a multiple-scan file is an array of these: */
typedef struct { typedef struct {
int comps_in_scan; /* number of components encoded in this scan */ int comps_in_scan; /* number of components encoded in this scan */
int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
int Ss, Se; /* progressive JPEG spectral selection parms int Ss, Se; /* progressive JPEG spectral selection parms */
*/ int Ah, Al; /* progressive JPEG successive approx. parms */
int Ah, Al; /* progressive JPEG successive approx. parms
*/
} jpeg_scan_info; } jpeg_scan_info;
/* The decompressor can save APPn and COM markers in a list of these: */ /* The decompressor can save APPn and COM markers in a list of these: */
typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;
struct jpeg_marker_struct { struct jpeg_marker_struct {
jpeg_saved_marker_ptr next; /* next in list, or NULL */ jpeg_saved_marker_ptr next; /* next in list, or NULL */
UINT8 marker; /* marker code: JPEG_COM, or JPEG_AP UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
P0+n */ unsigned int original_length; /* # bytes of data in the file */
unsigned int original_length; /* # bytes of data in the file */ unsigned int data_length; /* # bytes of data saved at data[] */
unsigned int data_length; /* # bytes of data saved at data[] */ JOCTET FAR * data; /* the data contained in the marker */
JOCTET FAR * data; /* the data contained in the marker */
/* the marker length word is not counted in data_length or original_lengt h */ /* the marker length word is not counted in data_length or original_lengt h */
}; };
/* Known color spaces. */ /* Known color spaces. */
typedef enum { typedef enum {
JCS_UNKNOWN, /* error/unspecified */ JCS_UNKNOWN, /* error/unspecified */
JCS_GRAYSCALE, /* monochrome */ JCS_GRAYSCALE, /* monochrome */
JCS_RGB, /* red/green/blue */ JCS_RGB, /* red/green/blue */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
JCS_CMYK, /* C/M/Y/K */ JCS_CMYK, /* C/M/Y/K */
JCS_YCCK /* Y/Cb/Cr/K */ JCS_YCCK /* Y/Cb/Cr/K */
} J_COLOR_SPACE; } J_COLOR_SPACE;
/* DCT/IDCT algorithm options. */ /* DCT/IDCT algorithm options. */
typedef enum { typedef enum {
JDCT_ISLOW, /* slow but accurate integer algorithm */ JDCT_ISLOW, /* slow but accurate integer algorithm */
JDCT_IFAST, /* faster, less accurate integer method */ JDCT_IFAST, /* faster, less accurate integer method */
JDCT_FLOAT /* floating-point: accurate, fast on fast HW JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
*/
} J_DCT_METHOD; } J_DCT_METHOD;
#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ #ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
#define JDCT_DEFAULT JDCT_ISLOW #define JDCT_DEFAULT JDCT_ISLOW
#endif #endif
#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ #ifndef JDCT_FASTEST /* may be overridden in jconfig.h */
#define JDCT_FASTEST JDCT_IFAST #define JDCT_FASTEST JDCT_IFAST
#endif #endif
/* Dithering options for decompression. */ /* Dithering options for decompression. */
typedef enum { typedef enum {
JDITHER_NONE, /* no dithering */ JDITHER_NONE, /* no dithering */
JDITHER_ORDERED, /* simple ordered dither */ JDITHER_ORDERED, /* simple ordered dither */
JDITHER_FS /* Floyd-Steinberg error diffusion dither */ JDITHER_FS /* Floyd-Steinberg error diffusion dither */
} J_DITHER_MODE; } J_DITHER_MODE;
/* Common fields between JPEG compression and decompression master structs. */ /* Common fields between JPEG compression and decompression master structs. */
#define jpeg_common_fields \ #define jpeg_common_fields \
struct jpeg_error_mgr * err; /* Error handler module */\ struct jpeg_error_mgr * err; /* Error handler module */\
struct jpeg_memory_mgr * mem; /* Memory manager module */\ struct jpeg_memory_mgr * mem; /* Memory manager module */\
struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
void * client_data; /* Available for use by application */\ void * client_data; /* Available for use by application */\
boolean is_decompressor; /* So common code can tell which is which */ boolean is_decompressor; /* So common code can tell which is which */\
\ int global_state /* For checking call sequence validity */
int global_state /* For checking call sequence validity */
/* Routines that are to be used by both halves of the library are declared /* Routines that are to be used by both halves of the library are declared
* to receive a pointer to this structure. There are no actual instances o f * to receive a pointer to this structure. There are no actual instances o f
* jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_str uct. * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_str uct.
*/ */
struct jpeg_common_struct { struct jpeg_common_struct {
jpeg_common_fields; /* Fields common to both master struct types */ jpeg_common_fields; /* Fields common to both master struct types * /
/* Additional fields follow in an actual jpeg_compress_struct or /* Additional fields follow in an actual jpeg_compress_struct or
* jpeg_decompress_struct. All three structs must agree on these * jpeg_decompress_struct. All three structs must agree on these
* initial fields! (This would be a lot cleaner in C++.) * initial fields! (This would be a lot cleaner in C++.)
*/ */
}; };
typedef struct jpeg_common_struct * j_common_ptr; typedef struct jpeg_common_struct * j_common_ptr;
typedef struct jpeg_compress_struct * j_compress_ptr; typedef struct jpeg_compress_struct * j_compress_ptr;
typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef struct jpeg_decompress_struct * j_decompress_ptr;
/* Master record for a compression instance */ /* Master record for a compression instance */
struct jpeg_compress_struct { struct jpeg_compress_struct {
jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ jpeg_common_fields; /* Fields shared with jpeg_decompress_struct * /
/* Destination for compressed data */ /* Destination for compressed data */
struct jpeg_destination_mgr * dest; struct jpeg_destination_mgr * dest;
/* Description of source image --- these fields must be filled in by /* Description of source image --- these fields must be filled in by
* outer application before starting compression. in_color_space must * outer application before starting compression. in_color_space must
* be correct before you can even call jpeg_set_defaults(). * be correct before you can even call jpeg_set_defaults().
*/ */
JDIMENSION image_width; /* input image width */ JDIMENSION image_width; /* input image width */
JDIMENSION image_height; /* input image height */ JDIMENSION image_height; /* input image height */
int input_components; /* # of color components in input im int input_components; /* # of color components in input image */
age */ J_COLOR_SPACE in_color_space; /* colorspace of input image */
J_COLOR_SPACE in_color_space; /* colorspace of input image */
double input_gamma; /* image gamma of input image */ double input_gamma; /* image gamma of input image */
/* Compression parameters --- these fields must be set before calling /* Compression parameters --- these fields must be set before calling
* jpeg_start_compress(). We recommend calling jpeg_set_defaults() to * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
* initialize everything to reasonable defaults, then changing anything * initialize everything to reasonable defaults, then changing anything
* the application specifically wants to change. That way you won't get * the application specifically wants to change. That way you won't get
* burnt when new parameters are added. Also note that there are several * burnt when new parameters are added. Also note that there are several
* helper routines to simplify changing parameters. * helper routines to simplify changing parameters.
*/ */
unsigned int scale_num, scale_denom; /* fraction by which to scale image */ unsigned int scale_num, scale_denom; /* fraction by which to scale image */
JDIMENSION jpeg_width; /* scaled JPEG image width */ JDIMENSION jpeg_width; /* scaled JPEG image width */
JDIMENSION jpeg_height; /* scaled JPEG image height */ JDIMENSION jpeg_height; /* scaled JPEG image height */
/* Dimensions of actual JPEG image that will be written to file, /* Dimensions of actual JPEG image that will be written to file,
* derived from input dimensions by scaling factors above. * derived from input dimensions by scaling factors above.
* These fields are computed by jpeg_start_compress(). * These fields are computed by jpeg_start_compress().
* You can also use jpeg_calc_jpeg_dimensions() to determine these values * You can also use jpeg_calc_jpeg_dimensions() to determine these values
* in advance of calling jpeg_start_compress(). * in advance of calling jpeg_start_compress().
*/ */
int data_precision; /* bits of precision in image data */ int data_precision; /* bits of precision in image data */
int num_components; /* # of color components in JPEG image */ int num_components; /* # of color components in JPEG image */
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
jpeg_component_info * comp_info; jpeg_component_info * comp_info;
/* comp_info[i] describes component that appears i'th in SOF */ /* comp_info[i] describes component that appears i'th in SOF */
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
int q_scale_factor[NUM_QUANT_TBLS]; int q_scale_factor[NUM_QUANT_TBLS];
/* ptrs to coefficient quantization tables, or NULL if not defined, /* ptrs to coefficient quantization tables, or NULL if not defined,
* and corresponding scale factors (percentage, initialized 100). * and corresponding scale factors (percentage, initialized 100).
*/ */
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */ /* ptrs to Huffman coding tables, or NULL if not defined */
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
int num_scans; /* # of entries in scan_info array */ int num_scans; /* # of entries in scan_info array */
const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
/* The default value of scan_info is NULL, which causes a single-scan /* The default value of scan_info is NULL, which causes a single-scan
* sequential JPEG file to be emitted. To create a multi-scan file, * sequential JPEG file to be emitted. To create a multi-scan file,
* set num_scans and scan_info to point to an array of scan definitions. * set num_scans and scan_info to point to an array of scan definitions.
*/ */
boolean raw_data_in; /* TRUE=caller supplies downsampled data */ boolean raw_data_in; /* TRUE=caller supplies downsampled data */
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
int smoothing_factor; /* 1..100, or 0 for no input smoothi int smoothing_factor; /* 1..100, or 0 for no input smoothing */
ng */ J_DCT_METHOD dct_method; /* DCT algorithm selector */
J_DCT_METHOD dct_method; /* DCT algorithm selector */
/* The restart interval can be specified in absolute MCUs by setting /* The restart interval can be specified in absolute MCUs by setting
* restart_interval, or in MCU rows by setting restart_in_rows * restart_interval, or in MCU rows by setting restart_in_rows
* (in which case the correct restart_interval will be figured * (in which case the correct restart_interval will be figured
* for each scan). * for each scan).
*/ */
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart * / unsigned int restart_interval; /* MCUs per restart, or 0 for no restart * /
int restart_in_rows; /* if > 0, MCU rows per restart interval */ int restart_in_rows; /* if > 0, MCU rows per restart interval */
/* Parameters controlling emission of special markers. */ /* Parameters controlling emission of special markers. */
boolean write_JFIF_header; /* should a JFIF marker be written? */ boolean write_JFIF_header; /* should a JFIF marker be written? */
UINT8 JFIF_major_version; /* What to write for the JFIF version number UINT8 JFIF_major_version; /* What to write for the JFIF version number
*/ */
UINT8 JFIF_minor_version; UINT8 JFIF_minor_version;
/* These three values are not used by the JPEG code, merely copied */ /* These three values are not used by the JPEG code, merely copied */
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
/* ratio is defined by X_density/Y_density even when density_unit=0. */ /* ratio is defined by X_density/Y_density even when density_unit=0. */
UINT8 density_unit; /* JFIF code for pixel size units */ UINT8 density_unit; /* JFIF code for pixel size units */
UINT16 X_density; /* Horizontal pixel density */ UINT16 X_density; /* Horizontal pixel density */
UINT16 Y_density; /* Vertical pixel density */ UINT16 Y_density; /* Vertical pixel density */
boolean write_Adobe_marker; /* should an Adobe marker be written? */ boolean write_Adobe_marker; /* should an Adobe marker be written? */
/* State variable: index of next scanline to be written to /* State variable: index of next scanline to be written to
* jpeg_write_scanlines(). Application may use this to control its * jpeg_write_scanlines(). Application may use this to control its
* processing loop, e.g., "while (next_scanline < image_height)". * processing loop, e.g., "while (next_scanline < image_height)".
*/ */
JDIMENSION next_scanline; /* 0 .. image_height-1 */ JDIMENSION next_scanline; /* 0 .. image_height-1 */
/* Remaining fields are known throughout compressor, but generally /* Remaining fields are known throughout compressor, but generally
* should not be touched by a surrounding application. * should not be touched by a surrounding application.
*/ */
/* /*
* These fields are computed during compression startup * These fields are computed during compression startup
*/ */
boolean progressive_mode; /* TRUE if scan script uses progressive mode boolean progressive_mode; /* TRUE if scan script uses progressive mode
*/ */
int max_h_samp_factor; /* largest h_samp_factor */ int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any compone int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any compon
nt */ ent */
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any compone int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any compon
nt */ ent */
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr * / JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
/* The coefficient controller receives data in units of MCU rows as defin ed /* The coefficient controller receives data in units of MCU rows as defin ed
* for fully interleaved scans (whether the JPEG file is interleaved or n ot). * for fully interleaved scans (whether the JPEG file is interleaved or n ot).
* There are v_samp_factor * DCTSIZE sample rows of each component in an * There are v_samp_factor * DCTSIZE sample rows of each component in an
* "iMCU" (interleaved MCU) row. * "iMCU" (interleaved MCU) row.
*/ */
/* /*
* These fields are valid during any one scan. * These fields are valid during any one scan.
* They describe the components and MCUs actually appearing in the scan. * They describe the components and MCUs actually appearing in the scan.
*/ */
int comps_in_scan; /* # of JPEG components in this scan */ int comps_in_scan; /* # of JPEG components in this scan */
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
/* *cur_comp_info[i] describes component that appears i'th in SOS */ /* *cur_comp_info[i] describes component that appears i'th in SOS */
JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */ int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[C_MAX_BLOCKS_IN_MCU]; int MCU_membership[C_MAX_BLOCKS_IN_MCU];
/* MCU_membership[i] is index in cur_comp_info of component owning */ /* MCU_membership[i] is index in cur_comp_info of component owning */
/* i'th block in an MCU */ /* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
int block_size; /* the basic DCT block size: 1..16 */ int block_size; /* the basic DCT block size: 1..16 */
const int * natural_order; /* natural-order position array */ const int * natural_order; /* natural-order position array */
int lim_Se; /* min( Se, DCTSIZE2-1 ) */ int lim_Se; /* min( Se, DCTSIZE2-1 ) */
/* /*
* Links to compression subobjects (methods and private variables of modu les) * Links to compression subobjects (methods and private variables of modu les)
*/ */
struct jpeg_comp_master * master; struct jpeg_comp_master * master;
struct jpeg_c_main_controller * main; struct jpeg_c_main_controller * main;
struct jpeg_c_prep_controller * prep; struct jpeg_c_prep_controller * prep;
struct jpeg_c_coef_controller * coef; struct jpeg_c_coef_controller * coef;
struct jpeg_marker_writer * marker; struct jpeg_marker_writer * marker;
struct jpeg_color_converter * cconvert; struct jpeg_color_converter * cconvert;
struct jpeg_downsampler * downsample; struct jpeg_downsampler * downsample;
struct jpeg_forward_dct * fdct; struct jpeg_forward_dct * fdct;
struct jpeg_entropy_encoder * entropy; struct jpeg_entropy_encoder * entropy;
jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression * / jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression * /
int script_space_size; int script_space_size;
}; };
/* Master record for a decompression instance */ /* Master record for a decompression instance */
struct jpeg_decompress_struct { struct jpeg_decompress_struct {
jpeg_common_fields; /* Fields shared with jpeg_compress_struct * / jpeg_common_fields; /* Fields shared with jpeg_compress_struct */
/* Source of compressed data */ /* Source of compressed data */
struct jpeg_source_mgr * src; struct jpeg_source_mgr * src;
/* Basic description of image --- filled in by jpeg_read_header(). */ /* Basic description of image --- filled in by jpeg_read_header(). */
/* Application may inspect these values to decide how to process image. * / /* Application may inspect these values to decide how to process image. * /
JDIMENSION image_width; /* nominal image width (from SOF marker) */ JDIMENSION image_width; /* nominal image width (from SOF marker) */
JDIMENSION image_height; /* nominal image height */ JDIMENSION image_height; /* nominal image height */
int num_components; /* # of color components in JPEG image */ int num_components; /* # of color components in JPEG image */
J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
/* Decompression processing parameters --- these fields must be set befor e /* Decompression processing parameters --- these fields must be set befor e
* calling jpeg_start_decompress(). Note that jpeg_read_header() initial izes * calling jpeg_start_decompress(). Note that jpeg_read_header() initial izes
* them to default values. * them to default values.
*/ */
J_COLOR_SPACE out_color_space; /* colorspace for output */ J_COLOR_SPACE out_color_space; /* colorspace for output */
unsigned int scale_num, scale_denom; /* fraction by which to scale image */ unsigned int scale_num, scale_denom; /* fraction by which to scale image */
double output_gamma; /* image gamma wanted in output */ double output_gamma; /* image gamma wanted in output */
boolean buffered_image; /* TRUE=multiple output passes */ boolean buffered_image; /* TRUE=multiple output passes */
boolean raw_data_out; /* TRUE=downsampled data wanted */ boolean raw_data_out; /* TRUE=downsampled data wanted */
J_DCT_METHOD dct_method; /* IDCT algorithm selector */ J_DCT_METHOD dct_method; /* IDCT algorithm selector */
boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ boolean do_block_smoothing; /* TRUE=apply interblock smoothing */
boolean quantize_colors; /* TRUE=colormapped output wanted */ boolean quantize_colors; /* TRUE=colormapped output wanted */
/* the following are ignored if not quantize_colors: */ /* the following are ignored if not quantize_colors: */
J_DITHER_MODE dither_mode; /* type of color dithering to use */ J_DITHER_MODE dither_mode; /* type of color dithering to use */
boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ boolean two_pass_quantize; /* TRUE=use two-pass color quantization */
int desired_number_of_colors; /* max # colors to use in created co int desired_number_of_colors; /* max # colors to use in created colorm
lormap */ ap */
/* these are significant only in buffered-image mode: */ /* these are significant only in buffered-image mode: */
boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ boolean enable_1pass_quant; /* enable future use of 1-pass quantizer * /
boolean enable_external_quant;/* enable future use of external colormap * / boolean enable_external_quant;/* enable future use of external colormap * /
boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ boolean enable_2pass_quant; /* enable future use of 2-pass quantizer * /
/* Description of actual output image that will be returned to applicatio n. /* Description of actual output image that will be returned to applicatio n.
* These fields are computed by jpeg_start_decompress(). * These fields are computed by jpeg_start_decompress().
* You can also use jpeg_calc_output_dimensions() to determine these valu es * You can also use jpeg_calc_output_dimensions() to determine these valu es
* in advance of calling jpeg_start_decompress(). * in advance of calling jpeg_start_decompress().
*/ */
JDIMENSION output_width; /* scaled image width */ JDIMENSION output_width; /* scaled image width */
JDIMENSION output_height; /* scaled image height */ JDIMENSION output_height; /* scaled image height */
int out_color_components; /* # of color components in out_color_space int out_color_components; /* # of color components in out_color_space
*/ */
int output_components; /* # of color components returned */ int output_components; /* # of color components returned */
/* output_components is 1 (a colormap index) when quantizing colors; /* output_components is 1 (a colormap index) when quantizing colors;
* otherwise it equals out_color_components. * otherwise it equals out_color_components.
*/ */
int rec_outbuf_height; /* min recommended height of scanline buffer */ int rec_outbuf_height; /* min recommended height of scanline buffer */
/* If the buffer passed to jpeg_read_scanlines() is less than this many r ows /* If the buffer passed to jpeg_read_scanlines() is less than this many r ows
* high, space and time will be wasted due to unnecessary data copying. * high, space and time will be wasted due to unnecessary data copying.
* Usually rec_outbuf_height will be 1 or 2, at most 4. * Usually rec_outbuf_height will be 1 or 2, at most 4.
*/ */
/* When quantizing colors, the output colormap is described by these fiel ds. /* When quantizing colors, the output colormap is described by these fiel ds.
* The application can supply a colormap by setting colormap non-NULL bef ore * The application can supply a colormap by setting colormap non-NULL bef ore
* calling jpeg_start_decompress; otherwise a colormap is created during * calling jpeg_start_decompress; otherwise a colormap is created during
* jpeg_start_decompress or jpeg_start_output. * jpeg_start_decompress or jpeg_start_output.
* The map has out_color_components rows and actual_number_of_colors colu mns. * The map has out_color_components rows and actual_number_of_colors colu mns.
*/ */
int actual_number_of_colors; /* number of entries in use */ int actual_number_of_colors; /* number of entries in use */
JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ JSAMPARRAY colormap; /* The color map as a 2-D pixel array */
/* State variables: these variables indicate the progress of decompressio n. /* State variables: these variables indicate the progress of decompressio n.
* The application may examine these but must not modify them. * The application may examine these but must not modify them.
*/ */
/* Row index of next scanline to be read from jpeg_read_scanlines(). /* Row index of next scanline to be read from jpeg_read_scanlines().
* Application may use this to control its processing loop, e.g., * Application may use this to control its processing loop, e.g.,
* "while (output_scanline < output_height)". * "while (output_scanline < output_height)".
*/ */
JDIMENSION output_scanline; /* 0 .. output_height-1 */ JDIMENSION output_scanline; /* 0 .. output_height-1 */
/* Current input scan number and number of iMCU rows completed in scan. /* Current input scan number and number of iMCU rows completed in scan.
* These indicate the progress of the decompressor input side. * These indicate the progress of the decompressor input side.
*/ */
int input_scan_number; /* Number of SOS markers seen so far */ int input_scan_number; /* Number of SOS markers seen so far */
JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */
/* The "output scan number" is the notional scan being displayed by the /* The "output scan number" is the notional scan being displayed by the
* output side. The decompressor will not allow output scan/row number * output side. The decompressor will not allow output scan/row number
* to get ahead of input scan/row, but it can fall arbitrarily far behind . * to get ahead of input scan/row, but it can fall arbitrarily far behind .
*/ */
int output_scan_number; /* Nominal scan number being displayed */ int output_scan_number; /* Nominal scan number being displayed */
JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
/* Current progression status. coef_bits[c][i] indicates the precision /* Current progression status. coef_bits[c][i] indicates the precision
* with which component c's DCT coefficient i (in zigzag order) is known. * with which component c's DCT coefficient i (in zigzag order) is known.
* It is -1 when no data has yet been received, otherwise it is the point * It is -1 when no data has yet been received, otherwise it is the point
* transform (shift) value for the most recent scan of the coefficient * transform (shift) value for the most recent scan of the coefficient
* (thus, 0 at completion of the progression). * (thus, 0 at completion of the progression).
* This pointer is NULL when reading a non-progressive file. * This pointer is NULL when reading a non-progressive file.
*/ */
int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */
/* Internal JPEG parameters --- the application usually need not look at /* Internal JPEG parameters --- the application usually need not look at
* these fields. Note that the decompressor output side may not use * these fields. Note that the decompressor output side may not use
* any parameters that can change between scans. * any parameters that can change between scans.
*/ */
/* Quantization and Huffman tables are carried forward across input /* Quantization and Huffman tables are carried forward across input
* datastreams when processing abbreviated JPEG datastreams. * datastreams when processing abbreviated JPEG datastreams.
*/ */
skipping to change at line 553 skipping to change at line 551
/* ptrs to coefficient quantization tables, or NULL if not defined */ /* ptrs to coefficient quantization tables, or NULL if not defined */
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */ /* ptrs to Huffman coding tables, or NULL if not defined */
/* These parameters are never carried across datastreams, since they /* These parameters are never carried across datastreams, since they
* are given in SOF/SOS markers or defined to be reset by SOI. * are given in SOF/SOS markers or defined to be reset by SOI.
*/ */
int data_precision; /* bits of precision in image data */ int data_precision; /* bits of precision in image data */
jpeg_component_info * comp_info; jpeg_component_info * comp_info;
/* comp_info[i] describes component that appears i'th in SOF */ /* comp_info[i] describes component that appears i'th in SOF */
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode * boolean progressive_mode; /* TRUE if SOFn specifies progressive mode *
/ /
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
/* These fields record data obtained from optional markers recognized by /* These fields record data obtained from optional markers recognized by
* the JPEG library. * the JPEG library.
*/ */
boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: * / /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: * /
UINT8 JFIF_major_version; /* JFIF version number */ UINT8 JFIF_major_version; /* JFIF version number */
UINT8 JFIF_minor_version; UINT8 JFIF_minor_version;
UINT8 density_unit; /* JFIF code for pixel size units */ UINT8 density_unit; /* JFIF code for pixel size units */
UINT16 X_density; /* Horizontal pixel density */ UINT16 X_density; /* Horizontal pixel density */
UINT16 Y_density; /* Vertical pixel density */ UINT16 Y_density; /* Vertical pixel density */
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found
*/ */
UINT8 Adobe_transform; /* Color transform code from Adobe marker */ UINT8 Adobe_transform; /* Color transform code from Adobe marker */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
/* Aside from the specific data retained from APPn markers known to the /* Aside from the specific data retained from APPn markers known to the
* library, the uninterpreted contents of any or all APPn and COM markers * library, the uninterpreted contents of any or all APPn and COM markers
* can be saved in a list for examination by the application. * can be saved in a list for examination by the application.
*/ */
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
/* Remaining fields are known throughout decompressor, but generally /* Remaining fields are known throughout decompressor, but generally
* should not be touched by a surrounding application. * should not be touched by a surrounding application.
*/ */
/* /*
* These fields are computed during decompression startup * These fields are computed during decompression startup
*/ */
int max_h_samp_factor; /* largest h_samp_factor */ int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */ int max_v_samp_factor; /* largest v_samp_factor */
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any compone int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any compon
nt */ ent */
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any compone int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any compon
nt */ ent */
JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
/* The coefficient controller's input and output progress is measured in /* The coefficient controller's input and output progress is measured in
* units of "iMCU" (interleaved MCU) rows. These are the same as MCU row s * units of "iMCU" (interleaved MCU) rows. These are the same as MCU row s
* in fully interleaved JPEG scans, but are used whether the scan is * in fully interleaved JPEG scans, but are used whether the scan is
* interleaved or not. We define an iMCU row as v_samp_factor DCT block * interleaved or not. We define an iMCU row as v_samp_factor DCT block
* rows of each component. Therefore, the IDCT output contains * rows of each component. Therefore, the IDCT output contains
* v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU ro w. * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU ro w.
*/ */
JSAMPLE * sample_range_limit; /* table for fast range-limiting */ JSAMPLE * sample_range_limit; /* table for fast range-limiting */
/* /*
* These fields are valid during any one scan. * These fields are valid during any one scan.
* They describe the components and MCUs actually appearing in the scan. * They describe the components and MCUs actually appearing in the scan.
* Note that the decompressor output side must not use these fields. * Note that the decompressor output side must not use these fields.
*/ */
int comps_in_scan; /* # of JPEG components in this scan */ int comps_in_scan; /* # of JPEG components in this scan */
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
/* *cur_comp_info[i] describes component that appears i'th in SOS */ /* *cur_comp_info[i] describes component that appears i'th in SOS */
JDIMENSION MCUs_per_row; /* # of MCUs across the image */ JDIMENSION MCUs_per_row; /* # of MCUs across the image */
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */ int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[D_MAX_BLOCKS_IN_MCU]; int MCU_membership[D_MAX_BLOCKS_IN_MCU];
/* MCU_membership[i] is index in cur_comp_info of component owning */ /* MCU_membership[i] is index in cur_comp_info of component owning */
/* i'th block in an MCU */ /* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
/* These fields are derived from Se of first SOS marker. /* These fields are derived from Se of first SOS marker.
*/ */
int block_size; /* the basic DCT block size: 1..16 */ int block_size; /* the basic DCT block size: 1..16 */
const int * natural_order; /* natural-order position array for entropy de code */ const int * natural_order; /* natural-order position array for entropy de code */
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
/* This field is shared between entropy decoder and marker parser. /* This field is shared between entropy decoder and marker parser.
* It is either zero or the code of a JPEG marker that has been * It is either zero or the code of a JPEG marker that has been
* read from the data source, but has not yet been processed. * read from the data source, but has not yet been processed.
*/ */
int unread_marker; int unread_marker;
/* /*
* Links to decompression subobjects (methods, private variables of modul es) * Links to decompression subobjects (methods, private variables of modul es)
*/ */
skipping to change at line 678 skipping to change at line 676
struct jpeg_error_mgr { struct jpeg_error_mgr {
/* Error exit handler: does not return to caller */ /* Error exit handler: does not return to caller */
JMETHOD(void, error_exit, (j_common_ptr cinfo)); JMETHOD(void, error_exit, (j_common_ptr cinfo));
/* Conditionally emit a trace or warning message */ /* Conditionally emit a trace or warning message */
JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
/* Routine that actually outputs a trace or error message */ /* Routine that actually outputs a trace or error message */
JMETHOD(void, output_message, (j_common_ptr cinfo)); JMETHOD(void, output_message, (j_common_ptr cinfo));
/* Format a message string for the most recent JPEG error or message */ /* Format a message string for the most recent JPEG error or message */
JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffe r */
/* Reset error state variables at start of a new image */ /* Reset error state variables at start of a new image */
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
/* The message ID code and any parameters are saved here. /* The message ID code and any parameters are saved here.
* A message can have one string parameter or up to 8 int parameters. * A message can have one string parameter or up to 8 int parameters.
*/ */
int msg_code; int msg_code;
#define JMSG_STR_PARM_MAX 80 #define JMSG_STR_PARM_MAX 80
union { union {
int i[8]; int i[8];
char s[JMSG_STR_PARM_MAX]; char s[JMSG_STR_PARM_MAX];
} msg_parm; } msg_parm;
/* Standard state variables for error facility */ /* Standard state variables for error facility */
int trace_level; /* max msg_level that will be displayed */ int trace_level; /* max msg_level that will be displayed */
/* For recoverable corrupt-data errors, we emit a warning message, /* For recoverable corrupt-data errors, we emit a warning message,
* but keep going unless emit_message chooses to abort. emit_message * but keep going unless emit_message chooses to abort. emit_message
* should count warnings in num_warnings. The surrounding application * should count warnings in num_warnings. The surrounding application
* can check for bad data by seeing if num_warnings is nonzero at the * can check for bad data by seeing if num_warnings is nonzero at the
* end of processing. * end of processing.
*/ */
long num_warnings; /* number of corrupt-data warnings */ long num_warnings; /* number of corrupt-data warnings */
/* These fields point to the table(s) of error message strings. /* These fields point to the table(s) of error message strings.
* An application can change the table pointer to switch to a different * An application can change the table pointer to switch to a different
* message list (typically, to change the language in which errors are * message list (typically, to change the language in which errors are
* reported). Some applications may wish to add additional error codes * reported). Some applications may wish to add additional error codes
* that will be handled by the JPEG library error mechanism; the second * that will be handled by the JPEG library error mechanism; the second
* table pointer is used for this purpose. * table pointer is used for this purpose.
* *
* First table includes all errors generated by JPEG library itself. * First table includes all errors generated by JPEG library itself.
* Error code 0 is reserved for a "no such error string" message. * Error code 0 is reserved for a "no such error string" message.
*/ */
const char * const * jpeg_message_table; /* Library errors */ const char * const * jpeg_message_table; /* Library errors */
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
/* Second table can be added by application (see cjpeg/djpeg for example) . /* Second table can be added by application (see cjpeg/djpeg for example) .
* It contains strings numbered first_addon_message..last_addon_message. * It contains strings numbered first_addon_message..last_addon_message.
*/ */
const char * const * addon_message_table; /* Non-library errors */ const char * const * addon_message_table; /* Non-library errors */
int first_addon_message; /* code for first string in addon table */ int first_addon_message; /* code for first string in addon table */
int last_addon_message; /* code for last string in addon table */ int last_addon_message; /* code for last string in addon table */
}; };
/* Progress monitor object */ /* Progress monitor object */
struct jpeg_progress_mgr { struct jpeg_progress_mgr {
JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
long pass_counter; /* work units completed in this pass */ long pass_counter; /* work units completed in this pass */
long pass_limit; /* total number of work units in this pass * long pass_limit; /* total number of work units in this pass */
/ int completed_passes; /* passes completed so far */
int completed_passes; /* passes completed so far */ int total_passes; /* total number of passes expected */
int total_passes; /* total number of passes expected */
}; };
/* Data destination object for compression */ /* Data destination object for compression */
struct jpeg_destination_mgr { struct jpeg_destination_mgr {
JOCTET * next_output_byte; /* => next byte to write in buffer */ JOCTET * next_output_byte; /* => next byte to write in buffer */
size_t free_in_buffer; /* # of byte spaces remaining in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */
JMETHOD(void, init_destination, (j_compress_ptr cinfo)); JMETHOD(void, init_destination, (j_compress_ptr cinfo));
JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
JMETHOD(void, term_destination, (j_compress_ptr cinfo)); JMETHOD(void, term_destination, (j_compress_ptr cinfo));
}; };
/* Data source object for decompression */ /* Data source object for decompression */
struct jpeg_source_mgr { struct jpeg_source_mgr {
const JOCTET * next_input_byte; /* => next byte to read from buffer */ const JOCTET * next_input_byte; /* => next byte to read from buffer */
size_t bytes_in_buffer; /* # of bytes remaining in buffer */ size_t bytes_in_buffer; /* # of bytes remaining in buffer */
JMETHOD(void, init_source, (j_decompress_ptr cinfo)); JMETHOD(void, init_source, (j_decompress_ptr cinfo));
JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired) ); JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired) );
JMETHOD(void, term_source, (j_decompress_ptr cinfo)); JMETHOD(void, term_source, (j_decompress_ptr cinfo));
}; };
/* Memory manager object. /* Memory manager object.
* Allocates "small" objects (a few K total), "large" objects (tens of K), * Allocates "small" objects (a few K total), "large" objects (tens of K),
* and "really big" objects (virtual arrays with backing store if needed). * and "really big" objects (virtual arrays with backing store if needed).
* The memory manager does not allow individual objects to be freed; rather , * The memory manager does not allow individual objects to be freed; rather ,
* each created object is assigned to a pool, and whole pools can be freed * each created object is assigned to a pool, and whole pools can be freed
* at once. This is faster and more convenient than remembering exactly wh at * at once. This is faster and more convenient than remembering exactly wh at
* to free, especially where malloc()/free() are not too speedy. * to free, especially where malloc()/free() are not too speedy.
* NB: alloc routines never return NULL. They exit to error_exit if not * NB: alloc routines never return NULL. They exit to error_exit if not
* successful. * successful.
*/ */
#define JPOOL_PERMANENT 0 /* lasts until master record is dest #define JPOOL_PERMANENT 0 /* lasts until master record is destroyed *
royed */ /
#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ #define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
#define JPOOL_NUMPOOLS 2 #define JPOOL_NUMPOOLS 2
typedef struct jvirt_sarray_control * jvirt_sarray_ptr; typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
typedef struct jvirt_barray_control * jvirt_barray_ptr; typedef struct jvirt_barray_control * jvirt_barray_ptr;
struct jpeg_memory_mgr { struct jpeg_memory_mgr {
/* Method pointers */ /* Method pointers */
JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
size_t sizeofobject)); size_t sizeofobject));
JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
size_t sizeofobject)); size_t sizeofobject));
JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
JDIMENSION samplesperrow, JDIMENSION samplesperrow,
JDIMENSION numrows)); JDIMENSION numrows));
JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
JDIMENSION blocksperrow, JDIMENSION blocksperrow,
JDIMENSION numrows)); JDIMENSION numrows));
JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
int pool_id, int pool_id,
boolean pre_zero, boolean pre_zero,
JDIMENSION samplesperrow, JDIMENSION samplesperrow,
JDIMENSION numrows, JDIMENSION numrows,
JDIMENSION maxaccess)); JDIMENSION maxaccess));
JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
int pool_id, int pool_id,
boolean pre_zero, boolean pre_zero,
JDIMENSION blocksperrow, JDIMENSION blocksperrow,
JDIMENSION numrows, JDIMENSION numrows,
JDIMENSION maxaccess)); JDIMENSION maxaccess));
JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
jvirt_sarray_ptr ptr, jvirt_sarray_ptr ptr,
JDIMENSION start_row, JDIMENSION start_row,
JDIMENSION num_rows, JDIMENSION num_rows,
boolean writable)); boolean writable));
JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
jvirt_barray_ptr ptr, jvirt_barray_ptr ptr,
JDIMENSION start_row, JDIMENSION start_row,
JDIMENSION num_rows, JDIMENSION num_rows,
boolean writable)); boolean writable));
JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
JMETHOD(void, self_destruct, (j_common_ptr cinfo)); JMETHOD(void, self_destruct, (j_common_ptr cinfo));
/* Limit on memory allocation for this JPEG object. (Note that this is /* Limit on memory allocation for this JPEG object. (Note that this is
* merely advisory, not a guaranteed maximum; it only affects the space * merely advisory, not a guaranteed maximum; it only affects the space
* used for virtual-array buffers.) May be changed by outer application * used for virtual-array buffers.) May be changed by outer application
* after creating the JPEG object. * after creating the JPEG object.
*/ */
long max_memory_to_use; long max_memory_to_use;
skipping to change at line 837 skipping to change at line 835
* Need not pass marker code since it is stored in cinfo->unread_marker. * Need not pass marker code since it is stored in cinfo->unread_marker.
*/ */
typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo )); typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo ));
/* Declarations for routines called by application. /* Declarations for routines called by application.
* The JPP macro hides prototype parameters from compilers that can't cope. * The JPP macro hides prototype parameters from compilers that can't cope.
* Note JPP requires double parentheses. * Note JPP requires double parentheses.
*/ */
#ifdef HAVE_PROTOTYPES #ifdef HAVE_PROTOTYPES
#define JPP(arglist) arglist #define JPP(arglist) arglist
#else #else
#define JPP(arglist) () #define JPP(arglist) ()
#endif #endif
/* Short forms of external names for systems with brain-damaged linkers. /* Short forms of external names for systems with brain-damaged linkers.
* We shorten external names to be unique in the first six letters, which * We shorten external names to be unique in the first six letters, which
* is good enough for all known systems. * is good enough for all known systems.
* (If your compiler itself needs names to be unique in less than 15 * (If your compiler itself needs names to be unique in less than 15
* characters, you are out of luck. Get a better compiler.) * characters, you are out of luck. Get a better compiler.)
*/ */
#ifdef NEED_SHORT_EXTERNAL_NAMES #ifdef NEED_SHORT_EXTERNAL_NAMES
#define jpeg_std_error jStdError #define jpeg_std_error jStdError
#define jpeg_CreateCompress jCreaCompress #define jpeg_CreateCompress jCreaCompress
#define jpeg_CreateDecompress jCreaDecompress #define jpeg_CreateDecompress jCreaDecompress
#define jpeg_destroy_compress jDestCompress #define jpeg_destroy_compress jDestCompress
#define jpeg_destroy_decompress jDestDecompress #define jpeg_destroy_decompress jDestDecompress
#define jpeg_stdio_dest jStdDest #define jpeg_stdio_dest jStdDest
#define jpeg_stdio_src jStdSrc #define jpeg_stdio_src jStdSrc
#define jpeg_mem_dest jMemDest #define jpeg_mem_dest jMemDest
#define jpeg_mem_src jMemSrc #define jpeg_mem_src jMemSrc
#define jpeg_set_defaults jSetDefaults #define jpeg_set_defaults jSetDefaults
#define jpeg_set_colorspace jSetColorspace #define jpeg_set_colorspace jSetColorspace
#define jpeg_default_colorspace jDefColorspace #define jpeg_default_colorspace jDefColorspace
#define jpeg_set_quality jSetQuality #define jpeg_set_quality jSetQuality
#define jpeg_set_linear_quality jSetLQuality #define jpeg_set_linear_quality jSetLQuality
#define jpeg_default_qtables jDefQTables #define jpeg_default_qtables jDefQTables
#define jpeg_add_quant_table jAddQuantTable #define jpeg_add_quant_table jAddQuantTable
#define jpeg_quality_scaling jQualityScaling #define jpeg_quality_scaling jQualityScaling
#define jpeg_simple_progression jSimProgress #define jpeg_simple_progression jSimProgress
#define jpeg_suppress_tables jSuppressTables #define jpeg_suppress_tables jSuppressTables
#define jpeg_alloc_quant_table jAlcQTable #define jpeg_alloc_quant_table jAlcQTable
#define jpeg_alloc_huff_table jAlcHTable #define jpeg_alloc_huff_table jAlcHTable
#define jpeg_start_compress jStrtCompress #define jpeg_start_compress jStrtCompress
#define jpeg_write_scanlines jWrtScanlines #define jpeg_write_scanlines jWrtScanlines
#define jpeg_finish_compress jFinCompress #define jpeg_finish_compress jFinCompress
#define jpeg_calc_jpeg_dimensions jCjpegDimensions #define jpeg_calc_jpeg_dimensions jCjpegDimensions
#define jpeg_write_raw_data jWrtRawData #define jpeg_write_raw_data jWrtRawData
#define jpeg_write_marker jWrtMarker #define jpeg_write_marker jWrtMarker
#define jpeg_write_m_header jWrtMHeader #define jpeg_write_m_header jWrtMHeader
#define jpeg_write_m_byte jWrtMByte #define jpeg_write_m_byte jWrtMByte
#define jpeg_write_tables jWrtTables #define jpeg_write_tables jWrtTables
#define jpeg_read_header jReadHeader #define jpeg_read_header jReadHeader
#define jpeg_start_decompress jStrtDecompress #define jpeg_start_decompress jStrtDecompress
#define jpeg_read_scanlines jReadScanlines #define jpeg_read_scanlines jReadScanlines
#define jpeg_finish_decompress jFinDecompress #define jpeg_finish_decompress jFinDecompress
#define jpeg_read_raw_data jReadRawData #define jpeg_read_raw_data jReadRawData
#define jpeg_has_multiple_scans jHasMultScn #define jpeg_has_multiple_scans jHasMultScn
#define jpeg_start_output jStrtOutput #define jpeg_start_output jStrtOutput
#define jpeg_finish_output jFinOutput #define jpeg_finish_output jFinOutput
#define jpeg_input_complete jInComplete #define jpeg_input_complete jInComplete
#define jpeg_new_colormap jNewCMap #define jpeg_new_colormap jNewCMap
#define jpeg_consume_input jConsumeInput #define jpeg_consume_input jConsumeInput
#define jpeg_core_output_dimensions jCoreDimensions #define jpeg_core_output_dimensions jCoreDimensions
#define jpeg_calc_output_dimensions jCalcDimensions #define jpeg_calc_output_dimensions jCalcDimensions
#define jpeg_save_markers jSaveMarkers #define jpeg_save_markers jSaveMarkers
#define jpeg_set_marker_processor jSetMarker #define jpeg_set_marker_processor jSetMarker
#define jpeg_read_coefficients jReadCoefs #define jpeg_read_coefficients jReadCoefs
#define jpeg_write_coefficients jWrtCoefs #define jpeg_write_coefficients jWrtCoefs
#define jpeg_copy_critical_parameters jCopyCrit #define jpeg_copy_critical_parameters jCopyCrit
#define jpeg_abort_compress jAbrtCompress #define jpeg_abort_compress jAbrtCompress
#define jpeg_abort_decompress jAbrtDecompress #define jpeg_abort_decompress jAbrtDecompress
#define jpeg_abort jAbort #define jpeg_abort jAbort
#define jpeg_destroy jDestroy #define jpeg_destroy jDestroy
#define jpeg_resync_to_restart jResyncRestart #define jpeg_resync_to_restart jResyncRestart
#endif /* NEED_SHORT_EXTERNAL_NAMES */ #endif /* NEED_SHORT_EXTERNAL_NAMES */
/* Default error-management setup */ /* Default error-management setup */
EXTERN(struct jpeg_error_mgr *) jpeg_std_error EXTERN(struct jpeg_error_mgr *) jpeg_std_error
JPP((struct jpeg_error_mgr * err)); JPP((struct jpeg_error_mgr * err));
/* Initialization of JPEG compression objects. /* Initialization of JPEG compression objects.
* jpeg_create_compress() and jpeg_create_decompress() are the exported * jpeg_create_compress() and jpeg_create_decompress() are the exported
* names that applications should call. These expand to calls on * names that applications should call. These expand to calls on
* jpeg_CreateCompress and jpeg_CreateDecompress with additional informatio n * jpeg_CreateCompress and jpeg_CreateDecompress with additional informatio n
* passed for version mismatch checking. * passed for version mismatch checking.
* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
*/ */
#define jpeg_create_compress(cinfo) \ #define jpeg_create_compress(cinfo) \
jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
(size_t) sizeof(struct jpeg_compress_struct)) (size_t) sizeof(struct jpeg_compress_struct))
#define jpeg_create_decompress(cinfo) \ #define jpeg_create_decompress(cinfo) \
jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
(size_t) sizeof(struct jpeg_decompress_struct)) (size_t) sizeof(struct jpeg_decompress_struct))
EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
int version, size_t structsize)); int version, size_t structsize));
EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
int version, size_t structsize)); int version, size_t structsize));
/* Destruction of JPEG compression objects */ /* Destruction of JPEG compression objects */
EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));
EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
/* Standard data source and destination managers: stdio streams. */ /* Standard data source and destination managers: stdio streams. */
/* Caller is responsible for opening the file before and closing after. */ /* Caller is responsible for opening the file before and closing after. */
EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
/* Data source and destination managers: memory buffers. */ /* Data source and destination managers: memory buffers. */
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
unsigned char ** outbuffer, unsigned char ** outbuffer,
unsigned long * outsize)); unsigned long * outsize));
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
unsigned char * inbuffer, unsigned char * inbuffer,
unsigned long insize)); unsigned long insize));
/* Default parameter setup for compression */ /* Default parameter setup for compression */
EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
/* Compression parameter setup aids */ /* Compression parameter setup aids */
EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,
J_COLOR_SPACE colorspace)); J_COLOR_SPACE colorspace));
EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));
EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
boolean force_baseline)); boolean force_baseline));
EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
int scale_factor, int scale_factor,
boolean force_baseline)); boolean force_baseline));
EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo,
boolean force_baseline)); boolean force_baseline));
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table, const unsigned int *basic_table,
int scale_factor, int scale_factor,
boolean force_baseline)); boolean force_baseline));
EXTERN(int) jpeg_quality_scaling JPP((int quality)); EXTERN(int) jpeg_quality_scaling JPP((int quality));
EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
boolean suppress)); boolean suppress));
EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
/* Main entry points for compression */ /* Main entry points for compression */
EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
boolean write_all_tables)); boolean write_all_tables));
EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
JSAMPARRAY scanlines, JSAMPARRAY scanlines,
JDIMENSION num_lines)); JDIMENSION num_lines));
EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
/* Precalculate JPEG dimensions for current compression parameters. */ /* Precalculate JPEG dimensions for current compression parameters. */
EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo));
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ /* Replaces jpeg_write_scanlines when writing raw downsampled data. */
EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
JSAMPIMAGE data, JSAMPIMAGE data,
JDIMENSION num_lines)); JDIMENSION num_lines));
/* Write a special marker. See libjpeg.txt concerning safe usage. */ /* Write a special marker. See libjpeg.txt concerning safe usage. */
EXTERN(void) jpeg_write_marker EXTERN(void) jpeg_write_marker
JPP((j_compress_ptr cinfo, int marker, JPP((j_compress_ptr cinfo, int marker,
const JOCTET * dataptr, unsigned int datalen)); const JOCTET * dataptr, unsigned int datalen));
/* Same, but piecemeal. */ /* Same, but piecemeal. */
EXTERN(void) jpeg_write_m_header EXTERN(void) jpeg_write_m_header
JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); JPP((j_compress_ptr cinfo, int marker, unsigned int datalen));
EXTERN(void) jpeg_write_m_byte EXTERN(void) jpeg_write_m_byte
JPP((j_compress_ptr cinfo, int val)); JPP((j_compress_ptr cinfo, int val));
/* Alternate compression function: just write an abbreviated table file */ /* Alternate compression function: just write an abbreviated table file */
EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));
/* Decompression startup: read start of JPEG datastream to see what's there */ /* Decompression startup: read start of JPEG datastream to see what's there */
EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
boolean require_image)); boolean require_image));
/* Return value is one of: */ /* Return value is one of: */
#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
#define JPEG_HEADER_OK 1 /* Found valid image datastream */ #define JPEG_HEADER_OK 1 /* Found valid image datastream */
#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only da #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datast
tastream */ ream */
/* If you pass require_image = TRUE (normal case), you need not check for /* If you pass require_image = TRUE (normal case), you need not check for
* a TABLES_ONLY return code; an abbreviated file will cause an error exit. * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
* JPEG_SUSPENDED is only possible if you use a data source module that can * JPEG_SUSPENDED is only possible if you use a data source module that can
* give a suspension return (the stdio source module doesn't). * give a suspension return (the stdio source module doesn't).
*/ */
/* Main entry points for decompression */ /* Main entry points for decompression */
EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));
EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
JSAMPARRAY scanlines, JSAMPARRAY scanlines,
JDIMENSION max_lines)); JDIMENSION max_lines));
EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ /* Replaces jpeg_read_scanlines when reading raw downsampled data. */
EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
JSAMPIMAGE data, JSAMPIMAGE data,
JDIMENSION max_lines)); JDIMENSION max_lines));
/* Additional entry points for buffered-image mode. */ /* Additional entry points for buffered-image mode. */
EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,
int scan_number)); int scan_number));
EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));
EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));
EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));
EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
/* Return value is one of: */ /* Return value is one of: */
/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ #define JPEG_REACHED_SOS 1 /* Reached start of new scan */
#define JPEG_REACHED_EOI 2 /* Reached end of image */ #define JPEG_REACHED_EOI 2 /* Reached end of image */
#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ #define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
/* Precalculate output dimensions for current decompression parameters. */ /* Precalculate output dimensions for current decompression parameters. */
EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));
EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
/* Control saving of COM and APPn markers into marker_list. */ /* Control saving of COM and APPn markers into marker_list. */
EXTERN(void) jpeg_save_markers EXTERN(void) jpeg_save_markers
JPP((j_decompress_ptr cinfo, int marker_code, JPP((j_decompress_ptr cinfo, int marker_code,
unsigned int length_limit)); unsigned int length_limit));
/* Install a special processing method for COM or APPn markers. */ /* Install a special processing method for COM or APPn markers. */
EXTERN(void) jpeg_set_marker_processor EXTERN(void) jpeg_set_marker_processor
JPP((j_decompress_ptr cinfo, int marker_code, JPP((j_decompress_ptr cinfo, int marker_code,
jpeg_marker_parser_method routine)); jpeg_marker_parser_method routine));
/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ /* Read or write raw DCT coefficients --- useful for lossless transcoding. */
EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cin fo)); EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cin fo));
EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
jvirt_barray_ptr * coef_arrays)); jvirt_barray_ptr * coef_arrays));
EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
j_compress_ptr dstinfo)); j_compress_ptr dstinfo));
/* If you choose to abort compression or decompression before completing /* If you choose to abort compression or decompression before completing
* jpeg_finish_(de)compress, then you need to clean up to release memory, * jpeg_finish_(de)compress, then you need to clean up to release memory,
* temporary files, etc. You can just call jpeg_destroy_(de)compress * temporary files, etc. You can just call jpeg_destroy_(de)compress
* if you're done with the JPEG object, but if you want to clean it up and * if you're done with the JPEG object, but if you want to clean it up and
* reuse it, call this: * reuse it, call this:
*/ */
EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));
EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
/* Generic versions of jpeg_abort and jpeg_destroy that work on either /* Generic versions of jpeg_abort and jpeg_destroy that work on either
* flavor of JPEG object. These may be more convenient in some places. * flavor of JPEG object. These may be more convenient in some places.
*/ */
EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));
EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));
/* Default restart-marker-resync procedure for use by data source modules * / /* Default restart-marker-resync procedure for use by data source modules * /
EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
int desired)); int desired));
/* These marker codes are exported since applications and data source modul es /* These marker codes are exported since applications and data source modul es
* are likely to want to use them. * are likely to want to use them.
*/ */
#define JPEG_RST0 0xD0 /* RST0 marker code */ #define JPEG_RST0 0xD0 /* RST0 marker code */
#define JPEG_EOI 0xD9 /* EOI marker code */ #define JPEG_EOI 0xD9 /* EOI marker code */
#define JPEG_APP0 0xE0 /* APP0 marker code */ #define JPEG_APP0 0xE0 /* APP0 marker code */
#define JPEG_COM 0xFE /* COM marker code */ #define JPEG_COM 0xFE /* COM marker code */
/* If we have a brain-damaged compiler that emits warnings (or worse, error s) /* If we have a brain-damaged compiler that emits warnings (or worse, error s)
* for structure definitions that are never filled in, keep it quiet by * for structure definitions that are never filled in, keep it quiet by
* supplying dummy definitions for the various substructures. * supplying dummy definitions for the various substructures.
*/ */
#ifdef INCOMPLETE_TYPES_BROKEN #ifdef INCOMPLETE_TYPES_BROKEN
#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ #ifndef JPEG_INTERNALS /* will be defined in jpegint.h */
struct jvirt_sarray_control { long dummy; }; struct jvirt_sarray_control { long dummy; };
struct jvirt_barray_control { long dummy; }; struct jvirt_barray_control { long dummy; };
struct jpeg_comp_master { long dummy; }; struct jpeg_comp_master { long dummy; };
struct jpeg_c_main_controller { long dummy; }; struct jpeg_c_main_controller { long dummy; };
struct jpeg_c_prep_controller { long dummy; }; struct jpeg_c_prep_controller { long dummy; };
struct jpeg_c_coef_controller { long dummy; }; struct jpeg_c_coef_controller { long dummy; };
struct jpeg_marker_writer { long dummy; }; struct jpeg_marker_writer { long dummy; };
struct jpeg_color_converter { long dummy; }; struct jpeg_color_converter { long dummy; };
struct jpeg_downsampler { long dummy; }; struct jpeg_downsampler { long dummy; };
struct jpeg_forward_dct { long dummy; }; struct jpeg_forward_dct { long dummy; };
skipping to change at line 1125 skipping to change at line 1123
#endif /* INCOMPLETE_TYPES_BROKEN */ #endif /* INCOMPLETE_TYPES_BROKEN */
/* /*
* The JPEG library modules define JPEG_INTERNALS before including this fil e. * The JPEG library modules define JPEG_INTERNALS before including this fil e.
* The internal structure declarations are read only when that is true. * The internal structure declarations are read only when that is true.
* Applications using the library should not include jpegint.h, but may wis h * Applications using the library should not include jpegint.h, but may wis h
* to include jerror.h. * to include jerror.h.
*/ */
#ifdef JPEG_INTERNALS #ifdef JPEG_INTERNALS
#include "jpegint.h" /* fetch private declarations */ #include "jpegint.h" /* fetch private declarations */
#include "jerror.h" /* fetch error codes too */ #include "jerror.h" /* fetch error codes too */
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
#ifndef DONT_USE_EXTERN_C #ifndef DONT_USE_EXTERN_C
} }
#endif #endif
#endif #endif
#endif /* JPEGLIB_H */ #endif /* JPEGLIB_H */
 End of changes. 132 change blocks. 
344 lines changed or deleted 336 lines changed or added


 js-config.h   js-config.h 
/* js-config.h. Generated automatically by configure. */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=78: * vim: set ts=8 sw=4 et tw=78:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef js_config_h___ #ifndef js_config_h___
#define js_config_h___ #define js_config_h___
/* Definitions set at build time that affect SpiderMonkey's public API. /* Definitions set at build time that affect SpiderMonkey's public API.
This header file is generated by the SpiderMonkey configure script, This header file is generated by the SpiderMonkey configure script,
and installed along with jsapi.h. */ and installed along with jsapi.h. */
/* Define to 1 if SpiderMonkey should support multi-threaded clients. */ /* Define to 1 if SpiderMonkey should support multi-threaded clients. */
/* #undef JS_THREADSAFE */ /* #undef JS_THREADSAFE */
/* Define to 1 if SpiderMonkey should include ctypes support. */ /* Define to 1 if SpiderMonkey should include ctypes support. */
/* #undef JS_HAS_CTYPES */ /* #undef JS_HAS_CTYPES */
/* Define to 1 if SpiderMonkey should support the ability to perform /* Define to 1 if SpiderMonkey should support the ability to perform
entirely too much GC. */ entirely too much GC. */
/* #undef JS_GC_ZEAL */ #define JS_GC_ZEAL 1
/* Define to 1 if the <endian.h> header is present and /* Define to 1 if the <endian.h> header is present and
useable. See jscpucfg.h. */ useable. See jscpucfg.h. */
#define JS_HAVE_ENDIAN_H 1 #define JS_HAVE_ENDIAN_H 1
/* Define to 1 if the <machine/endian.h> header is present and /* Define to 1 if the <machine/endian.h> header is present and
useable. See jscpucfg.h. */ useable. See jscpucfg.h. */
#define JS_HAVE_MACHINE_ENDIAN_H 1 #define JS_HAVE_MACHINE_ENDIAN_H 1
/* Define to 1 if the <sys/isa_defs.h> header is present and /* Define to 1 if the <sys/isa_defs.h> header is present and
skipping to change at line 97 skipping to change at line 63
JS_HAVE_STDINT_H. */ JS_HAVE_STDINT_H. */
/* #undef JS_INT8_TYPE */ /* #undef JS_INT8_TYPE */
/* #undef JS_INT16_TYPE */ /* #undef JS_INT16_TYPE */
/* #undef JS_INT32_TYPE */ /* #undef JS_INT32_TYPE */
/* #undef JS_INT64_TYPE */ /* #undef JS_INT64_TYPE */
/* #undef JS_INTPTR_TYPE */ /* #undef JS_INTPTR_TYPE */
#define JS_BYTES_PER_WORD 4 #define JS_BYTES_PER_WORD 4
/* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being /* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being
correct. */ correct. */
/* #undef JS_METHODJIT */ #define JS_METHODJIT 1
/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */
#define JS_HAS_XML_SUPPORT 1
#endif /* js_config_h___ */ #endif /* js_config_h___ */
 End of changes. 4 change blocks. 
48 lines changed or deleted 8 lines changed or added


 jsalloc.h   jsalloc.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99 ft=cpp: * vim: set ts=8 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* July 16, 2009.
*
* The Initial Developer of the Original Code is
* the Mozilla Corporation.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsalloc_h_ #ifndef jsalloc_h_
#define jsalloc_h_ #define jsalloc_h_
#include "jspubtd.h" #include "jspubtd.h"
#include "jsutil.h" #include "jsutil.h"
namespace js { namespace js {
/* /*
 End of changes. 1 change blocks. 
43 lines changed or deleted 3 lines changed or added


 jsapi.h   jsapi.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=78: * vim: set ts=8 sw=4 et tw=78:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsapi_h___ #ifndef jsapi_h___
#define jsapi_h___ #define jsapi_h___
/* /*
* JavaScript API. * JavaScript API.
*/ */
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/FloatingPoint.h" #include "mozilla/FloatingPoint.h"
#include "mozilla/StandardInteger.h" #include "mozilla/StandardInteger.h"
skipping to change at line 62 skipping to change at line 29
#include <stdio.h> #include <stdio.h>
#include "js-config.h" #include "js-config.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jsutil.h" #include "jsutil.h"
#include "jsval.h" #include "jsval.h"
#include "js/Utility.h" #include "js/Utility.h"
#include "gc/Root.h" #include "gc/Root.h"
#ifdef __cplusplus #ifdef __cplusplus
#include <limits> /* for std::numeric_limits */
#include "jsalloc.h" #include "jsalloc.h"
#include "js/Vector.h" #include "js/Vector.h"
#endif #endif
/************************************************************************/ /************************************************************************/
/* JS::Value can store a full int32_t. */ /* JS::Value can store a full int32_t. */
#define JSVAL_INT_BITS 32 #define JSVAL_INT_BITS 32
#define JSVAL_INT_MIN ((int32_t)0x80000000) #define JSVAL_INT_MIN ((int32_t)0x80000000)
#define JSVAL_INT_MAX ((int32_t)0x7fffffff) #define JSVAL_INT_MAX ((int32_t)0x7fffffff)
/************************************************************************/ /************************************************************************/
#define JS_Assert MOZ_Assert
#ifdef __cplusplus #ifdef __cplusplus
namespace JS { namespace JS {
/* /*
* Protecting non-jsval, non-JSObject *, non-JSString * values from collect ion * Protecting non-jsval, non-JSObject *, non-JSString * values from collect ion
* *
* Most of the time, the garbage collector's conservative stack scanner wor ks * Most of the time, the garbage collector's conservative stack scanner wor ks
* behind the scenes, finding all live values and protecting them from bein g * behind the scenes, finding all live values and protecting them from bein g
* collected. However, when JSAPI client code obtains a pointer to data the * collected. However, when JSAPI client code obtains a pointer to data the
* scanner does not know about, owned by an object the scanner does know ab out, * scanner does not know about, owned by an object the scanner does know ab out,
skipping to change at line 606 skipping to change at line 573
} }
const size_t *payloadWord() const { const size_t *payloadWord() const {
#if JS_BITS_PER_WORD == 32 #if JS_BITS_PER_WORD == 32
return &data.s.payload.word; return &data.s.payload.word;
#elif JS_BITS_PER_WORD == 64 #elif JS_BITS_PER_WORD == 64
return &data.asWord; return &data.asWord;
#endif #endif
} }
const uintptr_t *payloadUIntPtr() const {
#if JS_BITS_PER_WORD == 32
return &data.s.payload.uintptr;
#elif JS_BITS_PER_WORD == 64
return &data.asUIntPtr;
#endif
}
#if !defined(_MSC_VER) && !defined(__sparc) #if !defined(_MSC_VER) && !defined(__sparc)
/* To make jsval binary compatible when linking across C and C++ with MSV C, /* To make jsval binary compatible when linking across C and C++ with MSV C,
* JS::Value needs to be POD. Otherwise, jsval will be passed in memory * JS::Value needs to be POD. Otherwise, jsval will be passed in memory
* in C++ but by value in C (bug 645111). * in C++ but by value in C (bug 645111).
* Same issue for SPARC ABI. (bug 737344). * Same issue for SPARC ABI. (bug 737344).
*/ */
private: private:
#endif #endif
jsval_layout data; jsval_layout data;
skipping to change at line 699 skipping to change at line 674
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
ObjectValue(JSObject &obj) ObjectValue(JSObject &obj)
{ {
Value v; Value v;
v.setObject(obj); v.setObject(obj);
return v; return v;
} }
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
ObjectValueCrashOnTouch()
{
Value v;
v.setObject(*reinterpret_cast<JSObject *>(0x42));
return v;
}
static JS_ALWAYS_INLINE Value
MagicValue(JSWhyMagic why) MagicValue(JSWhyMagic why)
{ {
Value v; Value v;
v.setMagic(why); v.setMagic(why);
return v; return v;
} }
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
NumberValue(float f)
{
Value v;
v.setNumber(f);
return v;
}
static JS_ALWAYS_INLINE Value
NumberValue(double dbl) NumberValue(double dbl)
{ {
Value v; Value v;
v.setNumber(dbl); v.setNumber(dbl);
return v; return v;
} }
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
NumberValue(int8_t i)
{
return Int32Value(i);
}
static JS_ALWAYS_INLINE Value
NumberValue(uint8_t i)
{
return Int32Value(i);
}
static JS_ALWAYS_INLINE Value
NumberValue(int16_t i)
{
return Int32Value(i);
}
static JS_ALWAYS_INLINE Value
NumberValue(uint16_t i)
{
return Int32Value(i);
}
static JS_ALWAYS_INLINE Value
NumberValue(int32_t i)
{
return Int32Value(i);
}
static JS_ALWAYS_INLINE Value
NumberValue(uint32_t i)
{
Value v;
v.setNumber(i);
return v;
}
namespace detail {
template <bool Signed>
class MakeNumberValue
{
public:
template<typename T>
static inline Value create(const T t)
{
Value v;
if (JSVAL_INT_MIN <= t && t <= JSVAL_INT_MAX)
v.setInt32(int32_t(t));
else
v.setDouble(double(t));
return v;
}
};
template <>
class MakeNumberValue<false>
{
public:
template<typename T>
static inline Value create(const T t)
{
Value v;
if (t <= JSVAL_INT_MAX)
v.setInt32(int32_t(t));
else
v.setDouble(double(t));
return v;
}
};
} /* namespace detail */
template <typename T>
static JS_ALWAYS_INLINE Value
NumberValue(const T t)
{
MOZ_ASSERT(T(double(t)) == t, "value creation would be lossy");
return detail::MakeNumberValue<std::numeric_limits<T>::is_signed>::crea
te(t);
}
static JS_ALWAYS_INLINE Value
ObjectOrNullValue(JSObject *obj) ObjectOrNullValue(JSObject *obj)
{ {
Value v; Value v;
v.setObjectOrNull(obj); v.setObjectOrNull(obj);
return v; return v;
} }
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
PrivateValue(void *ptr) PrivateValue(void *ptr)
{ {
skipping to change at line 744 skipping to change at line 817
v.setPrivateUint32(ui); v.setPrivateUint32(ui);
return v; return v;
} }
JS_ALWAYS_INLINE bool JS_ALWAYS_INLINE bool
SameType(const Value &lhs, const Value &rhs) SameType(const Value &lhs, const Value &rhs)
{ {
return JSVAL_SAME_TYPE_IMPL(lhs.data, rhs.data); return JSVAL_SAME_TYPE_IMPL(lhs.data, rhs.data);
} }
/************************************************************************/
template <> struct RootMethods<const Value> template <> struct RootMethods<const Value>
{ {
static Value initial() { return UndefinedValue(); } static Value initial() { return UndefinedValue(); }
static ThingRootKind kind() { return THING_ROOT_VALUE; } static ThingRootKind kind() { return THING_ROOT_VALUE; }
static bool poisoned(const Value &v) { return IsPoisonedValue(v); } static bool poisoned(const Value &v) { return IsPoisonedValue(v); }
}; };
template <> struct RootMethods<Value> template <> struct RootMethods<Value>
{ {
static Value initial() { return UndefinedValue(); } static Value initial() { return UndefinedValue(); }
static ThingRootKind kind() { return THING_ROOT_VALUE; } static ThingRootKind kind() { return THING_ROOT_VALUE; }
static bool poisoned(const Value &v) { return IsPoisonedValue(v); } static bool poisoned(const Value &v) { return IsPoisonedValue(v); }
}; };
template <class Outer> class MutableValueOperations;
/*
* A class designed for CRTP use in implementing the non-mutating parts of
the
* Value interface in Value-like classes. Outer must be a class inheriting
* ValueOperations<Outer> with a visible extract() method returning the
* const Value* abstracted by Outer.
*/
template <class Outer>
class ValueOperations
{
friend class MutableValueOperations<Outer>;
const Value * value() const { return static_cast<const Outer*>(this)->e
xtract(); }
public:
bool isUndefined() const { return value()->isUndefined(); }
bool isNull() const { return value()->isNull(); }
bool isBoolean() const { return value()->isBoolean(); }
bool isTrue() const { return value()->isTrue(); }
bool isFalse() const { return value()->isFalse(); }
bool isNumber() const { return value()->isNumber(); }
bool isInt32() const { return value()->isInt32(); }
bool isDouble() const { return value()->isDouble(); }
bool isString() const { return value()->isString(); }
bool isObject() const { return value()->isObject(); }
bool isMagic() const { return value()->isMagic(); }
bool isMagic(JSWhyMagic why) const { return value()->isMagic(why); }
bool isMarkable() const { return value()->isMarkable(); }
bool isPrimitive() const { return value()->isPrimitive(); }
bool isGCThing() const { return value()->isGCThing(); }
bool isNullOrUndefined() const { return value()->isNullOrUndefined(); }
bool isObjectOrNull() const { return value()->isObjectOrNull(); }
bool toBoolean() const { return value()->toBoolean(); }
double toNumber() const { return value()->toNumber(); }
int32_t toInt32() const { return value()->toInt32(); }
double toDouble() const { return value()->toDouble(); }
JSString *toString() const { return value()->toString(); }
JSObject &toObject() const { return value()->toObject(); }
JSObject *toObjectOrNull() const { return value()->toObjectOrNull(); }
void *toGCThing() const { return value()->toGCThing(); }
#ifdef DEBUG
JSWhyMagic whyMagic() const { return value()->whyMagic(); }
#endif
};
/*
* A class designed for CRTP use in implementing the mutating parts of the
* Value interface in Value-like classes. Outer must be a class inheriting
* MutableValueOperations<Outer> with visible extractMutable() and extract(
)
* methods returning the const Value* and Value* abstracted by Outer.
*/
template <class Outer>
class MutableValueOperations : public ValueOperations<Outer>
{
Value * value() { return static_cast<Outer*>(this)->extractMutable(); }
public:
void setNull() { value()->setNull(); }
void setUndefined() { value()->setUndefined(); }
void setInt32(int32_t i) { value()->setInt32(i); }
void setDouble(double d) { value()->setDouble(d); }
void setString(JSString *str) { value()->setString(str); }
void setString(const JS::Anchor<JSString *> &str) { value()->setString(
str); }
void setObject(JSObject &obj) { value()->setObject(obj); }
void setBoolean(bool b) { value()->setBoolean(b); }
void setMagic(JSWhyMagic why) { value()->setMagic(why); }
bool setNumber(uint32_t ui) { return value()->setNumber(ui); }
bool setNumber(double d) { return value()->setNumber(d); }
void setObjectOrNull(JSObject *arg) { value()->setObjectOrNull(arg); }
};
/*
* Augment the generic Handle<T> interface when T = Value with type-queryin
g
* and value-extracting operations.
*/
template <>
class HandleBase<Value> : public ValueOperations<Handle<Value> >
{
friend class ValueOperations<Handle<Value> >;
const Value * extract() const {
return static_cast<const Handle<Value>*>(this)->address();
}
};
/*
* Augment the generic MutableHandle<T> interface when T = Value with
* type-querying, value-extracting, and mutating operations.
*/
template <>
class MutableHandleBase<Value> : public MutableValueOperations<MutableHandl
e<Value> >
{
friend class ValueOperations<MutableHandle<Value> >;
const Value * extract() const {
return static_cast<const MutableHandle<Value>*>(this)->address();
}
friend class MutableValueOperations<MutableHandle<Value> >;
Value * extractMutable() {
return static_cast<MutableHandle<Value>*>(this)->address();
}
};
/*
* Augment the generic Rooted<T> interface when T = Value with type-queryin
g,
* value-extracting, and mutating operations.
*/
template <>
class RootedBase<Value> : public MutableValueOperations<Rooted<Value> >
{
friend class ValueOperations<Rooted<Value> >;
const Value * extract() const {
return static_cast<const Rooted<Value>*>(this)->address();
}
friend class MutableValueOperations<Rooted<Value> >;
Value * extractMutable() {
return static_cast<Rooted<Value>*>(this)->address();
}
};
/************************************************************************/ /************************************************************************/
#ifndef __GNUC__ #ifndef __GNUC__
/* /*
* The default assignment operator for |struct C| has the signature: * The default assignment operator for |struct C| has the signature:
* *
* C& C::operator=(const C&) * C& C::operator=(const C&)
* *
* And in particular requires implicit conversion of |this| to type |C| for the * And in particular requires implicit conversion of |this| to type |C| for the
skipping to change at line 803 skipping to change at line 1001
JS::AutoCheckRequestDepth _autoCheckRequestDepth(cx) JS::AutoCheckRequestDepth _autoCheckRequestDepth(cx)
#else #else
# define CHECK_REQUEST(cx) \ # define CHECK_REQUEST(cx) \
((void) 0) ((void) 0)
#endif /* JS_THREADSAFE && DEBUG */ #endif /* JS_THREADSAFE && DEBUG */
#ifdef DEBUG #ifdef DEBUG
/* Assert that we're not doing GC on cx, that we're in a request as /*
needed, and that the compartments for cx and v are correct. */ * Assert that we're not doing GC on cx, that we're in a request as
* needed, and that the compartments for cx and v are correct.
* Also check that GC would be safe at this point.
*/
JS_PUBLIC_API(void) JS_PUBLIC_API(void)
AssertArgumentsAreSane(JSContext *cx, const Value &v); AssertArgumentsAreSane(JSContext *cx, const Value &v);
#else #else
inline void AssertArgumentsAreSane(JSContext *cx, const Value &v) { inline void AssertArgumentsAreSane(JSContext *cx, const Value &v) {
/* Do nothing */ /* Do nothing */
} }
#endif /* DEBUG */ #endif /* DEBUG */
class JS_PUBLIC_API(AutoGCRooter) { class JS_PUBLIC_API(AutoGCRooter) {
public: public:
skipping to change at line 841 skipping to change at line 1042
* subclass roots an array of values of the length stored in this field . * subclass roots an array of values of the length stored in this field .
* If negative, meaning is indicated by the corresponding value in the enum * If negative, meaning is indicated by the corresponding value in the enum
* below. Any other negative value indicates some deeper problem such as * below. Any other negative value indicates some deeper problem such as
* memory corruption. * memory corruption.
*/ */
ptrdiff_t tag; ptrdiff_t tag;
enum { enum {
JSVAL = -1, /* js::AutoValueRooter */ JSVAL = -1, /* js::AutoValueRooter */
VALARRAY = -2, /* js::AutoValueArrayRooter */ VALARRAY = -2, /* js::AutoValueArrayRooter */
PARSER = -3, /* js::Parser */ PARSER = -3, /* js::frontend::Parser */
SHAPEVECTOR = -4, /* js::AutoShapeVector */ SHAPEVECTOR = -4, /* js::AutoShapeVector */
ENUMERATOR = -5, /* js::AutoEnumStateRooter */ ENUMERATOR = -5, /* js::AutoEnumStateRooter */
IDARRAY = -6, /* js::AutoIdArray */ IDARRAY = -6, /* js::AutoIdArray */
DESCRIPTORS = -7, /* js::AutoPropDescArrayRooter */ DESCRIPTORS = -7, /* js::AutoPropDescArrayRooter */
NAMESPACES = -8, /* js::AutoNamespaceArray */ NAMESPACES = -8, /* js::AutoNamespaceArray */
XML = -9, /* js::AutoXMLRooter */ XML = -9, /* js::AutoXMLRooter */
OBJECT = -10, /* js::AutoObjectRooter */ OBJECT = -10, /* js::AutoObjectRooter */
ID = -11, /* js::AutoIdRooter */ ID = -11, /* js::AutoIdRooter */
VALVECTOR = -12, /* js::AutoValueVector */ VALVECTOR = -12, /* js::AutoValueVector */
DESCRIPTOR = -13, /* js::AutoPropertyDescriptorRooter */ DESCRIPTOR = -13, /* js::AutoPropertyDescriptorRooter */
STRING = -14, /* js::AutoStringRooter */ STRING = -14, /* js::AutoStringRooter */
IDVECTOR = -15, /* js::AutoIdVector */ IDVECTOR = -15, /* js::AutoIdVector */
OBJVECTOR = -16, /* js::AutoObjectVector */ OBJVECTOR = -16, /* js::AutoObjectVector */
SCRIPTVECTOR =-17 /* js::AutoScriptVector */ STRINGVECTOR =-17, /* js::AutoStringVector */
SCRIPTVECTOR =-18, /* js::AutoScriptVector */
PROPDESC = -19, /* js::PropDesc::AutoRooter */
SHAPERANGE = -20, /* js::Shape::Range::AutoRooter */
STACKSHAPE = -21, /* js::StackShape::AutoRooter */
STACKBASESHAPE=-22,/* js::StackBaseShape::AutoRooter */
BINDINGS = -23, /* js::Bindings::AutoRooter */
GETTERSETTER =-24, /* js::AutoRooterGetterSetter */
REGEXPSTATICS=-25, /* js::RegExpStatics::AutoRooter */
NAMEVECTOR = -26, /* js::AutoNameVector */
HASHABLEVALUE=-27
}; };
private: private:
AutoGCRooter ** const stackTop; AutoGCRooter ** const stackTop;
/* No copy or assignment semantics. */ /* No copy or assignment semantics. */
AutoGCRooter(AutoGCRooter &ida) MOZ_DELETE; AutoGCRooter(AutoGCRooter &ida) MOZ_DELETE;
void operator=(AutoGCRooter &ida) MOZ_DELETE; void operator=(AutoGCRooter &ida) MOZ_DELETE;
}; };
skipping to change at line 981 skipping to change at line 1192
private: private:
JSString *str; JSString *str;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
class AutoArrayRooter : private AutoGCRooter { class AutoArrayRooter : private AutoGCRooter {
public: public:
AutoArrayRooter(JSContext *cx, size_t len, Value *vec AutoArrayRooter(JSContext *cx, size_t len, Value *vec
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, len), array(vec) : AutoGCRooter(cx, len), array(vec), skip(cx, array, len)
{ {
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_ASSERT(tag >= 0); JS_ASSERT(tag >= 0);
} }
void changeLength(size_t newLength) { void changeLength(size_t newLength) {
tag = ptrdiff_t(newLength); tag = ptrdiff_t(newLength);
JS_ASSERT(tag >= 0); JS_ASSERT(tag >= 0);
} }
skipping to change at line 1003 skipping to change at line 1214
changeLength(newLength); changeLength(newLength);
array = newArray; array = newArray;
} }
Value *array; Value *array;
friend void AutoGCRooter::trace(JSTracer *trc); friend void AutoGCRooter::trace(JSTracer *trc);
private: private:
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
SkipRoot skip;
}; };
/* The auto-root for enumeration object and its state. */ /* The auto-root for enumeration object and its state. */
class AutoEnumStateRooter : private AutoGCRooter class AutoEnumStateRooter : private AutoGCRooter
{ {
public: public:
AutoEnumStateRooter(JSContext *cx, JSObject *obj AutoEnumStateRooter(JSContext *cx, JSObject *obj
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, ENUMERATOR), obj(obj), stateValue(), context(cx) : AutoGCRooter(cx, ENUMERATOR), obj(cx, obj), stateValue(), context(c x)
{ {
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
JS_ASSERT(obj); JS_ASSERT(obj);
} }
~AutoEnumStateRooter(); ~AutoEnumStateRooter();
friend void AutoGCRooter::trace(JSTracer *trc); friend void AutoGCRooter::trace(JSTracer *trc);
const Value &state() const { return stateValue; } const Value &state() const { return stateValue; }
Value *addr() { return &stateValue; } Value *addr() { return &stateValue; }
protected: protected:
void trace(JSTracer *trc); void trace(JSTracer *trc);
JSObject *obj; RootedObject obj;
private: private:
Value stateValue; Value stateValue;
JSContext *context; JSContext *context;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
template<class T> template<class T>
class AutoVectorRooter : protected AutoGCRooter class AutoVectorRooter : protected AutoGCRooter
{ {
public: public:
explicit AutoVectorRooter(JSContext *cx, ptrdiff_t tag explicit AutoVectorRooter(JSContext *cx, ptrdiff_t tag
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, tag), vector(cx), vectorRoot(cx, &vector) : AutoGCRooter(cx, tag), vector(cx), vectorRoot(cx, &vector)
{ {
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
} }
typedef T ElementType;
size_t length() const { return vector.length(); } size_t length() const { return vector.length(); }
bool empty() const { return vector.empty(); }
bool append(const T &v) { return vector.append(v); } bool append(const T &v) { return vector.append(v); }
bool append(const AutoVectorRooter<T> &other) {
return vector.append(other.vector);
}
/* For use when space has already been reserved. */ /* For use when space has already been reserved. */
void infallibleAppend(const T &v) { vector.infallibleAppend(v); } void infallibleAppend(const T &v) { vector.infallibleAppend(v); }
void popBack() { vector.popBack(); } void popBack() { vector.popBack(); }
T popCopy() { return vector.popCopy(); } T popCopy() { return vector.popCopy(); }
bool growBy(size_t inc) { bool growBy(size_t inc) {
size_t oldLength = vector.length(); size_t oldLength = vector.length();
if (!vector.growByUninitialized(inc)) if (!vector.growByUninitialized(inc))
skipping to change at line 1085 skipping to change at line 1304
void clear() { vector.clear(); } void clear() { vector.clear(); }
bool reserve(size_t newLength) { bool reserve(size_t newLength) {
return vector.reserve(newLength); return vector.reserve(newLength);
} }
T &operator[](size_t i) { return vector[i]; } T &operator[](size_t i) { return vector[i]; }
const T &operator[](size_t i) const { return vector[i]; } const T &operator[](size_t i) const { return vector[i]; }
JS::MutableHandle<T> handleAt(size_t i) { return JS::MutableHandle<T>::
fromMarkedLocation(&vector[i]); }
JS::Handle<T> handleAt(size_t i) const { return JS::Handle<T>::fromMark
edLocation(&vector[i]); }
const T *begin() const { return vector.begin(); } const T *begin() const { return vector.begin(); }
T *begin() { return vector.begin(); } T *begin() { return vector.begin(); }
const T *end() const { return vector.end(); } const T *end() const { return vector.end(); }
T *end() { return vector.end(); } T *end() { return vector.end(); }
const T &back() const { return vector.back(); } const T &back() const { return vector.back(); }
friend void AutoGCRooter::trace(JSTracer *trc); friend void AutoGCRooter::trace(JSTracer *trc);
skipping to change at line 1150 skipping to change at line 1372
explicit AutoScriptVector(JSContext *cx explicit AutoScriptVector(JSContext *cx
JS_GUARD_OBJECT_NOTIFIER_PARAM) JS_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoVectorRooter<JSScript *>(cx, SCRIPTVECTOR) : AutoVectorRooter<JSScript *>(cx, SCRIPTVECTOR)
{ {
JS_GUARD_OBJECT_NOTIFIER_INIT; JS_GUARD_OBJECT_NOTIFIER_INIT;
} }
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
class CallReceiver
{
protected:
#ifdef DEBUG
mutable bool usedRval_;
void setUsedRval() const { usedRval_ = true; }
void clearUsedRval() const { usedRval_ = false; }
#else
void setUsedRval() const {}
void clearUsedRval() const {}
#endif
Value *argv_;
public:
friend CallReceiver CallReceiverFromVp(Value *);
friend CallReceiver CallReceiverFromArgv(Value *);
Value *base() const { return argv_ - 2; }
JSObject &callee() const { JS_ASSERT(!usedRval_); return argv_[-2].toOb
ject(); }
JS::HandleValue calleev() const {
JS_ASSERT(!usedRval_);
return JS::HandleValue::fromMarkedLocation(&argv_[-2]);
}
JS::HandleValue thisv() const {
return JS::HandleValue::fromMarkedLocation(&argv_[-1]);
}
JS::MutableHandleValue rval() const {
setUsedRval();
return JS::MutableHandleValue::fromMarkedLocation(&argv_[-2]);
}
Value *spAfterCall() const {
setUsedRval();
return argv_ - 1;
}
void setCallee(Value calleev) const {
clearUsedRval();
argv_[-2] = calleev;
}
void setThis(Value thisv) const {
argv_[-1] = thisv;
}
};
JS_ALWAYS_INLINE CallReceiver
CallReceiverFromArgv(Value *argv)
{
CallReceiver receiver;
receiver.clearUsedRval();
receiver.argv_ = argv;
return receiver;
}
JS_ALWAYS_INLINE CallReceiver
CallReceiverFromVp(Value *vp)
{
return CallReceiverFromArgv(vp + 2);
}
/**************************************************************************
***/
class CallArgs : public CallReceiver
{
protected:
unsigned argc_;
public:
friend CallArgs CallArgsFromVp(unsigned, Value *);
friend CallArgs CallArgsFromArgv(unsigned, Value *);
friend CallArgs CallArgsFromSp(unsigned, Value *);
Value &operator[](unsigned i) const { JS_ASSERT(i < argc_); return argv
_[i]; }
Value *array() const { return argv_; }
unsigned length() const { return argc_; }
Value *end() const { return argv_ + argc_; }
bool hasDefined(unsigned i) const { return i < argc_ && !argv_[i].isUnd
efined(); }
};
JS_ALWAYS_INLINE CallArgs
CallArgsFromArgv(unsigned argc, Value *argv)
{
CallArgs args;
args.clearUsedRval();
args.argv_ = argv;
args.argc_ = argc;
return args;
}
JS_ALWAYS_INLINE CallArgs
CallArgsFromVp(unsigned argc, Value *vp)
{
return CallArgsFromArgv(argc, vp + 2);
}
JS_ALWAYS_INLINE CallArgs
CallArgsFromSp(unsigned argc, Value *sp)
{
return CallArgsFromArgv(argc, sp - argc);
}
/* Returns true if |v| is considered an acceptable this-value. */
typedef bool (*IsAcceptableThis)(const Value &v);
/*
* Implements the guts of a method; guaranteed to be provided an acceptable
* this-value, as determined by a corresponding IsAcceptableThis method.
*/
typedef bool (*NativeImpl)(JSContext *cx, CallArgs args);
namespace detail {
/* DON'T CALL THIS DIRECTLY. It's for use only by CallNonGenericMethod! */
extern JS_PUBLIC_API(bool)
CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args);
} /* namespace detail */
/*
* Methods usually act upon |this| objects only from a single global object
and
* compartment. Sometimes, however, a method must act upon |this| values f
rom
* multiple global objects or compartments. In such cases the |this| value
a
* method might see will be wrapped, such that various access to the object
--
* to its class, its private data, its reserved slots, and so on -- will no
t
* work properly without entering that object's compartment. This method
* implements a solution to this problem.
*
* To implement a method that accepts |this| values from multiple compartme
nts,
* define two functions. The first function matches the IsAcceptableThis t
ype
* and indicates whether the provided value is an acceptable |this| for the
* method; it must be a pure function only of its argument.
*
* static JSClass AnswerClass = { ... };
*
* static bool
* IsAnswerObject(const Value &v)
* {
* if (!v.isObject())
* return false;
* return JS_GetClass(&v.toObject()) == &AnswerClass;
* }
*
* The second function implements the NativeImpl signature and defines the
* behavior of the method when it is provided an acceptable |this| value.
* Aside from some typing niceties -- see the CallArgs interface for detail
s --
* its interface is the same as that of JSNative.
*
* static bool
* answer_getAnswer_impl(JSContext *cx, JS::CallArgs args)
* {
* args.rval().setInt32(42);
* return true;
* }
*
* The implementation function is guaranteed to be called *only* with a |th
is|
* value which is considered acceptable.
*
* Now to implement the actual method, write a JSNative that calls the meth
od
* declared below, passing the appropriate template and runtime arguments.
*
* static JSBool
* answer_getAnswer(JSContext *cx, unsigned argc, JS::Value *vp)
* {
* JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
* return JS::CallNonGenericMethod<IsAnswerObject, answer_getAnswer_i
mpl>(cx, args);
* }
*
* Note that, because they are used as template arguments, the predicate
* and implementation functions must have external linkage. (This is
* unfortunate, but GCC wasn't inlining things as one would hope when we
* passed them as function arguments.)
*
* JS::CallNonGenericMethod will test whether |args.thisv()| is acceptable.
If
* it is, it will call the provided implementation function, which will ret
urn
* a value and indicate success. If it is not, it will attempt to unwrap
* |this| and call the implementation function on the unwrapped |this|. If
* that succeeds, all well and good. If it doesn't succeed, a TypeError wi
ll
* be thrown.
*
* Note: JS::CallNonGenericMethod will only work correctly if it's called i
n
* tail position in a JSNative. Do not call it from any other place.
*/
template<IsAcceptableThis Test, NativeImpl Impl>
JS_ALWAYS_INLINE bool
CallNonGenericMethod(JSContext *cx, CallArgs args)
{
const Value &thisv = args.thisv();
if (Test(thisv))
return Impl(cx, args);
return detail::CallMethodIfWrapped(cx, Test, Impl, args);
}
JS_ALWAYS_INLINE bool
CallNonGenericMethod(JSContext *cx, IsAcceptableThis Test, NativeImpl Impl,
CallArgs args)
{
const Value &thisv = args.thisv();
if (Test(thisv))
return Impl(cx, args);
return detail::CallMethodIfWrapped(cx, Test, Impl, args);
}
} /* namespace JS */ } /* namespace JS */
/************************************************************************/ /************************************************************************/
/* /*
* JS::Value and jsval are the same type; jsval is the old name, kept aroun d * JS::Value and jsval are the same type; jsval is the old name, kept aroun d
* for backwards compatibility along with all the JSVAL_* operations below. * for backwards compatibility along with all the JSVAL_* operations below.
* jsval_layout is an implementation detail and should not be used external ly. * jsval_layout is an implementation detail and should not be used external ly.
*/ */
typedef JS::Value jsval; typedef JS::Value jsval;
skipping to change at line 1213 skipping to change at line 1638
#ifdef DEBUG #ifdef DEBUG
typedef struct { char c; jsval_layout l; } JSLayoutAlignmentTester; typedef struct { char c; jsval_layout l; } JSLayoutAlignmentTester;
JS_STATIC_ASSERT(sizeof(JSLayoutAlignmentTester) == 16); JS_STATIC_ASSERT(sizeof(JSLayoutAlignmentTester) == 16);
#endif /* DEBUG */ #endif /* DEBUG */
JS_STATIC_ASSERT(sizeof(jsval_layout) == sizeof(jsval)); JS_STATIC_ASSERT(sizeof(jsval_layout) == sizeof(jsval));
/************************************************************************/ /************************************************************************/
#ifdef __cplusplus
typedef JS::Handle<JSObject*> JSHandleObject;
typedef JS::Handle<JSString*> JSHandleString;
typedef JS::Handle<jsid> JSHandleId;
typedef JS::Handle<JS::Value> JSHandleValue;
typedef JS::MutableHandle<JSObject*> JSMutableHandleObject;
typedef JS::MutableHandle<JS::Value> JSMutableHandleValue;
typedef JS::RawObject JSRawObject;
#else
/*
* Handle support for C API users. Handles must be destroyed in the reverse
* order that they were created (as in a stack).
*/
typedef struct { JSObject **_; } JSHandleObject;
typedef struct { jsval _; } JSHandleValue;
typedef struct { JSString **_; } JSHandleString;
typedef struct { JSObject **_; } JSMutableHandleObject;
typedef struct { jsid *_; } JSHandleId;
typedef struct { jsval *_; } JSMutableHandleValue;
typedef JSObject *JSRawObject;
JSBool JS_CreateHandleObject(JSContext *cx, JSObject *obj, JSHandleObject *
phandle);
void JS_DestroyHandleObject(JSContext *cx, JSHandleObject handle);
JSBool JS_CreateMutableHandleObject(JSContext *cx, JSObject *obj, JSMutable
HandleObject *phandle);
void JS_DestroyMutableHandleObject(JSContext *cx, JSMutableHandleObject han
dle);
JSBool JS_CreateHandleId(JSContext *cx, jsid id, JSHandleId *phandle);
void JS_DestroyHandleId(JSContext *cx, JSHandleId handle);
#endif
/* JSClass operation signatures. */ /* JSClass operation signatures. */
/* /*
* Add, delete, or get a property named by id in obj. Note the jsid id * Add, delete, or get a property named by id in obj. Note the jsid id
* type -- id may be a string (Unicode property identifier) or an int (elem ent * type -- id may be a string (Unicode property identifier) or an int (elem ent
* index). The *vp out parameter, on success, is the new property value af ter * index). The *vp out parameter, on success, is the new property value af ter
* an add or get. After a successful delete, *vp is JSVAL_FALSE iff * an add or get. After a successful delete, *vp is JSVAL_FALSE iff
* obj[id] can't be deleted (because it's permanent). * obj[id] can't be deleted (because it's permanent).
*/ */
typedef JSBool typedef JSBool
(* JSPropertyOp)(JSContext *cx, JSObject *obj, jsid id, jsval *vp); (* JSPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutabl eHandleValue vp);
/* /*
* Set a property named by id in obj, treating the assignment as strict * Set a property named by id in obj, treating the assignment as strict
* mode code if strict is true. Note the jsid id type -- id may be a string * mode code if strict is true. Note the jsid id type -- id may be a string
* (Unicode property identifier) or an int (element index). The *vp out * (Unicode property identifier) or an int (element index). The *vp out
* parameter, on success, is the new property value after the * parameter, on success, is the new property value after the
* set. * set.
*/ */
typedef JSBool typedef JSBool
(* JSStrictPropertyOp)(JSContext *cx, JSObject *obj, jsid id, JSBool strict , jsval *vp); (* JSStrictPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JS Bool strict, JSMutableHandleValue vp);
/* /*
* This function type is used for callbacks that enumerate the properties o f * This function type is used for callbacks that enumerate the properties o f
* a JSObject. The behavior depends on the value of enum_op: * a JSObject. The behavior depends on the value of enum_op:
* *
* JSENUMERATE_INIT * JSENUMERATE_INIT
* A new, opaque iterator state should be allocated and stored in *state p. * A new, opaque iterator state should be allocated and stored in *state p.
* (You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored). * (You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored).
* *
* The number of properties that will be enumerated should be returned a s * The number of properties that will be enumerated should be returned a s
skipping to change at line 1268 skipping to change at line 1729
* *
* JSENUMERATE_DESTROY * JSENUMERATE_DESTROY
* Destroy the opaque iterator state previously allocated in *statep by a * Destroy the opaque iterator state previously allocated in *statep by a
* call to this function when enum_op was JSENUMERATE_INIT or * call to this function when enum_op was JSENUMERATE_INIT or
* JSENUMERATE_INIT_ALL. * JSENUMERATE_INIT_ALL.
* *
* The return value is used to indicate success, with a value of JS_FALSE * The return value is used to indicate success, with a value of JS_FALSE
* indicating failure. * indicating failure.
*/ */
typedef JSBool typedef JSBool
(* JSNewEnumerateOp)(JSContext *cx, JSObject *obj, JSIterateOp enum_op, (* JSNewEnumerateOp)(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op ,
jsval *statep, jsid *idp); jsval *statep, jsid *idp);
/* /*
* The old-style JSClass.enumerate op should define all lazy properties not * The old-style JSClass.enumerate op should define all lazy properties not
* yet reflected in obj. * yet reflected in obj.
*/ */
typedef JSBool typedef JSBool
(* JSEnumerateOp)(JSContext *cx, JSObject *obj); (* JSEnumerateOp)(JSContext *cx, JSHandleObject obj);
/* /*
* Resolve a lazy property named by id in obj by defining it directly in ob j. * Resolve a lazy property named by id in obj by defining it directly in ob j.
* Lazy properties are those reflected from some peer native property space * Lazy properties are those reflected from some peer native property space
* (e.g., the DOM attributes for a given node reflected as obj) on demand. * (e.g., the DOM attributes for a given node reflected as obj) on demand.
* *
* JS looks for a property in an object, and if not found, tries to resolve * JS looks for a property in an object, and if not found, tries to resolve
* the given id. If resolve succeeds, the engine looks again in case resol ve * the given id. If resolve succeeds, the engine looks again in case resol ve
* defined obj[id]. If no such property exists directly in obj, the proces s * defined obj[id]. If no such property exists directly in obj, the proces s
* is repeated with obj's prototype, etc. * is repeated with obj's prototype, etc.
* *
* NB: JSNewResolveOp provides a cheaper way to resolve lazy properties. * NB: JSNewResolveOp provides a cheaper way to resolve lazy properties.
*/ */
typedef JSBool typedef JSBool
(* JSResolveOp)(JSContext *cx, JSObject *obj, jsid id); (* JSResolveOp)(JSContext *cx, JSHandleObject obj, JSHandleId id);
/* /*
* Like JSResolveOp, but flags provide contextual information as follows: * Like JSResolveOp, but flags provide contextual information as follows:
* *
* JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not i d * JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not i d
* JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment
* JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequenc e * JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequenc e
* JSRESOLVE_DECLARING var, const, or function prolog declaration opcode
* JSRESOLVE_CLASSNAME class name used when constructing
* *
* The *objp out parameter, on success, should be null to indicate that id * The *objp out parameter, on success, should be null to indicate that id
* was not resolved; and non-null, referring to obj or one of its prototype s, * was not resolved; and non-null, referring to obj or one of its prototype s,
* if id was resolved. * if id was resolved. The hook may assume *objp is null on entry.
* *
* This hook instead of JSResolveOp is called via the JSClass.resolve membe r * This hook instead of JSResolveOp is called via the JSClass.resolve membe r
* if JSCLASS_NEW_RESOLVE is set in JSClass.flags. * if JSCLASS_NEW_RESOLVE is set in JSClass.flags.
*
* Setting JSCLASS_NEW_RESOLVE and JSCLASS_NEW_RESOLVE_GETS_START further
* extends this hook by passing in the starting object on the prototype cha
in
* via *objp. Thus a resolve hook implementation may define the property i
d
* being resolved in the object in which the id was first sought, rather th
an
* in a prototype object whose class led to the resolve hook being called.
*
* When using JSCLASS_NEW_RESOLVE_GETS_START, the resolve hook must therefo
re
* null *objp to signify "not resolved". With only JSCLASS_NEW_RESOLVE and
no
* JSCLASS_NEW_RESOLVE_GETS_START, the hook can assume *objp is null on ent
ry.
* This is not good practice, but enough existing hook implementations coun
t
* on it that we can't break compatibility by passing the starting object i
n
* *objp without a new JSClass flag.
*/ */
typedef JSBool typedef JSBool
(* JSNewResolveOp)(JSContext *cx, JSObject *obj, jsid id, unsigned flags, (* JSNewResolveOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, unsign
JSObject **objp); ed flags,
JSMutableHandleObject objp);
/* /*
* Convert obj to the given type, returning true with the resulting value i n * Convert obj to the given type, returning true with the resulting value i n
* *vp on success, and returning false on error or exception. * *vp on success, and returning false on error or exception.
*/ */
typedef JSBool typedef JSBool
(* JSConvertOp)(JSContext *cx, JSObject *obj, JSType type, jsval *vp); (* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHa ndleValue vp);
/* /*
* Delegate typeof to an object so it can cloak a primitive or another obje ct. * Delegate typeof to an object so it can cloak a primitive or another obje ct.
*/ */
typedef JSType typedef JSType
(* JSTypeOfOp)(JSContext *cx, JSObject *obj); (* JSTypeOfOp)(JSContext *cx, JSHandleObject obj);
typedef struct JSFreeOp JSFreeOp; typedef struct JSFreeOp JSFreeOp;
struct JSFreeOp { struct JSFreeOp {
#ifndef __cplusplus #ifndef __cplusplus
JSRuntime *runtime; JSRuntime *runtime;
#else #else
private: private:
JSRuntime *runtime_; JSRuntime *runtime_;
skipping to change at line 1383 skipping to change at line 1829
void (*finalize)(const JSStringFinalizer *fin, jschar *chars); void (*finalize)(const JSStringFinalizer *fin, jschar *chars);
}; };
/* /*
* JSClass.checkAccess type: check whether obj[id] may be accessed per mode , * JSClass.checkAccess type: check whether obj[id] may be accessed per mode ,
* returning false on error/exception, true on success with obj[id]'s last- got * returning false on error/exception, true on success with obj[id]'s last- got
* value in *vp, and its attributes in *attrsp. As for JSPropertyOp above, id * value in *vp, and its attributes in *attrsp. As for JSPropertyOp above, id
* is either a string or an int jsval. * is either a string or an int jsval.
*/ */
typedef JSBool typedef JSBool
(* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mod e, (* JSCheckAccessOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSAcc essMode mode,
jsval *vp); jsval *vp);
/* /*
* Check whether v is an instance of obj. Return false on error or excepti on, * Check whether v is an instance of obj. Return false on error or excepti on,
* true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in * true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in
* *bp otherwise. * *bp otherwise.
*/ */
typedef JSBool typedef JSBool
(* JSHasInstanceOp)(JSContext *cx, JSObject *obj, const jsval *v, JSBool *b p); (* JSHasInstanceOp)(JSContext *cx, JSHandleObject obj, const jsval *v, JSBo ol *bp);
/* /*
* Function type for trace operation of the class called to enumerate all * Function type for trace operation of the class called to enumerate all
* traceable things reachable from obj's private data structure. For each s uch * traceable things reachable from obj's private data structure. For each s uch
* thing, a trace implementation must call * thing, a trace implementation must call
* *
* JS_CallTracer(trc, thing, kind); * JS_CallTracer(trc, thing, kind);
* *
* or one of its convenience macros as described in jsapi.h. * or one of its convenience macros as described in jsapi.h.
* *
skipping to change at line 1422 skipping to change at line 1868
(* JSTraceOp)(JSTracer *trc, JSObject *obj); (* JSTraceOp)(JSTracer *trc, JSObject *obj);
/* /*
* DEBUG only callback that JSTraceOp implementation can provide to return * DEBUG only callback that JSTraceOp implementation can provide to return
* a string describing the reference traced with JS_CallTracer. * a string describing the reference traced with JS_CallTracer.
*/ */
typedef void typedef void
(* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize); (* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize);
typedef JSBool typedef JSBool
(* JSEqualityOp)(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp); (* JSEqualityOp)(JSContext *cx, JSHandleObject obj, const jsval *v, JSBool
*bp);
typedef JSRawObject
(* JSWeakmapKeyDelegateOp)(JSRawObject obj);
/* /*
* Typedef for native functions called by the JS VM. * Typedef for native functions called by the JS VM.
* *
* See jsapi.h, the JS_CALLEE, JS_THIS, etc. macros. * See jsapi.h, the JS_CALLEE, JS_THIS, etc. macros.
*/ */
typedef JSBool typedef JSBool
(* JSNative)(JSContext *cx, unsigned argc, jsval *vp); (* JSNative)(JSContext *cx, unsigned argc, jsval *vp);
skipping to change at line 1554 skipping to change at line 2003
typedef JSBool typedef JSBool
(* JSLocaleToUnicode)(JSContext *cx, const char *src, jsval *rval); (* JSLocaleToUnicode)(JSContext *cx, const char *src, jsval *rval);
/* /*
* Security protocol types. * Security protocol types.
*/ */
typedef void typedef void
(* JSDestroyPrincipalsOp)(JSPrincipals *principals); (* JSDestroyPrincipalsOp)(JSPrincipals *principals);
typedef JSBool
(* JSSubsumePrincipalsOp)(JSPrincipals *principals1, JSPrincipals *principa
ls2);
/*
* Return a weak reference to the principals associated with obj, possibly
via
* the immutable parent chain leading from obj to a top-level container (e.
g.,
* a window object in the DOM level 0). If there are no principals associa
ted
* with obj, return null. Therefore null does not mean an error was report
ed;
* in no event should an error be reported or an exception be thrown by thi
s
* callback's implementation.
*/
typedef JSPrincipals *
(* JSObjectPrincipalsFinder)(JSObject *obj);
/* /*
* Used to check if a CSP instance wants to disable eval() and friends. * Used to check if a CSP instance wants to disable eval() and friends.
* See js_CheckCSPPermitsJSAction() in jsobj. * See js_CheckCSPPermitsJSAction() in jsobj.
*/ */
typedef JSBool typedef JSBool
(* JSCSPEvalChecker)(JSContext *cx); (* JSCSPEvalChecker)(JSContext *cx);
/* /*
* Security callbacks for pushing and popping context principals. These are
only
* temporarily necessary and will hopefully be gone again in a matter of we
eks.
*/
typedef JSBool
(* JSPushContextPrincipalOp)(JSContext *cx, JSPrincipals *principals);
typedef JSBool
(* JSPopContextPrincipalOp)(JSContext *cx);
/*
* Callback used to ask the embedding for the cross compartment wrapper han dler * Callback used to ask the embedding for the cross compartment wrapper han dler
* that implements the desired prolicy for this kind of object in the * that implements the desired prolicy for this kind of object in the
* destination compartment. * destination compartment.
*/ */
typedef JSObject * typedef JSObject *
(* JSWrapObjectCallback)(JSContext *cx, JSObject *obj, JSObject *proto, JSO bject *parent, (* JSWrapObjectCallback)(JSContext *cx, JSObject *obj, JSObject *proto, JSO bject *parent,
unsigned flags); unsigned flags);
/* /*
* Callback used by the wrap hook to ask the embedding to prepare an object * Callback used by the wrap hook to ask the embedding to prepare an object
skipping to change at line 1618 skipping to change at line 2043
* be a security or cross-compartment wrapper. This is an unfortunate contr act, * be a security or cross-compartment wrapper. This is an unfortunate contr act,
* but is important for to avoid unnecessarily recomputing every cross- * but is important for to avoid unnecessarily recomputing every cross-
* compartment wrapper that gets passed to wrap. * compartment wrapper that gets passed to wrap.
*/ */
typedef JSObject * typedef JSObject *
(* JSSameCompartmentWrapObjectCallback)(JSContext *cx, JSObject *obj); (* JSSameCompartmentWrapObjectCallback)(JSContext *cx, JSObject *obj);
typedef void typedef void
(* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment) ; (* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment) ;
typedef void
(* JSCompartmentNameCallback)(JSRuntime *rt, JSCompartment *compartment,
char *buf, size_t bufsize);
/* /*
* Read structured data from the reader r. This hook is used to read a valu e * Read structured data from the reader r. This hook is used to read a valu e
* previously serialized by a call to the WriteStructuredCloneOp hook. * previously serialized by a call to the WriteStructuredCloneOp hook.
* *
* tag and data are the pair of uint32_t values from the header. The callba ck * tag and data are the pair of uint32_t values from the header. The callba ck
* may use the JS_Read* APIs to read any other relevant parts of the object * may use the JS_Read* APIs to read any other relevant parts of the object
* from the reader r. closure is any value passed to the JS_ReadStructuredC lone * from the reader r. closure is any value passed to the JS_ReadStructuredC lone
* function. Return the new object on success, NULL on error/exception. * function. Return the new object on success, NULL on error/exception.
*/ */
typedef JSObject *(*ReadStructuredCloneOp)(JSContext *cx, JSStructuredClone Reader *r, typedef JSObject *(*ReadStructuredCloneOp)(JSContext *cx, JSStructuredClone Reader *r,
skipping to change at line 1774 skipping to change at line 2203
JS_ASSERT(JSVAL_IS_STRING(v)); JS_ASSERT(JSVAL_IS_STRING(v));
return JSVAL_TO_STRING_IMPL(JSVAL_TO_IMPL(v)); return JSVAL_TO_STRING_IMPL(JSVAL_TO_IMPL(v));
} }
static JS_ALWAYS_INLINE jsval static JS_ALWAYS_INLINE jsval
STRING_TO_JSVAL(JSString *str) STRING_TO_JSVAL(JSString *str)
{ {
return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str)); return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
} }
static JS_ALWAYS_INLINE JSBool
JSVAL_IS_OBJECT(jsval v)
{
return JSVAL_IS_OBJECT_OR_NULL_IMPL(JSVAL_TO_IMPL(v));
}
static JS_ALWAYS_INLINE JSObject * static JS_ALWAYS_INLINE JSObject *
JSVAL_TO_OBJECT(jsval v) JSVAL_TO_OBJECT(jsval v)
{ {
JS_ASSERT(JSVAL_IS_OBJECT(v)); JS_ASSERT(JSVAL_IS_OBJECT_OR_NULL_IMPL(JSVAL_TO_IMPL(v)));
return JSVAL_TO_OBJECT_IMPL(JSVAL_TO_IMPL(v)); return JSVAL_TO_OBJECT_IMPL(JSVAL_TO_IMPL(v));
} }
static JS_ALWAYS_INLINE jsval static JS_ALWAYS_INLINE jsval
OBJECT_TO_JSVAL(JSObject *obj) OBJECT_TO_JSVAL(JSObject *obj)
{ {
if (obj) if (obj)
return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj)); return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj));
return JSVAL_NULL; return JSVAL_NULL;
} }
skipping to change at line 1848 skipping to change at line 2271
return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr)); return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr));
} }
static JS_ALWAYS_INLINE void * static JS_ALWAYS_INLINE void *
JSVAL_TO_PRIVATE(jsval v) JSVAL_TO_PRIVATE(jsval v)
{ {
JS_ASSERT(JSVAL_IS_DOUBLE(v)); JS_ASSERT(JSVAL_IS_DOUBLE(v));
return JSVAL_TO_PRIVATE_PTR_IMPL(JSVAL_TO_IMPL(v)); return JSVAL_TO_PRIVATE_PTR_IMPL(JSVAL_TO_IMPL(v));
} }
static JS_ALWAYS_INLINE jsval
JS_NumberValue(double d)
{
int32_t i;
d = JS_CANONICALIZE_NAN(d);
if (MOZ_DOUBLE_IS_INT32(d, &i))
return INT_TO_JSVAL(i);
return DOUBLE_TO_JSVAL(d);
}
/************************************************************************/ /************************************************************************/
/* /*
* A jsid is an identifier for a property or method of an object which is * A jsid is an identifier for a property or method of an object which is
* either a 31-bit signed integer, interned string or object. If XML is * either a 31-bit signed integer, interned string or object. If XML is
* enabled, there is an additional singleton jsid value; see * enabled, there is an additional singleton jsid value; see
* JS_DEFAULT_XML_NAMESPACE_ID below. Finally, there is an additional jsid * JS_DEFAULT_XML_NAMESPACE_ID below. Finally, there is an additional jsid
* value, JSID_VOID, which does not occur in JS scripts but may be used to * value, JSID_VOID, which does not occur in JS scripts but may be used to
* indicate the absence of a valid jsid. * indicate the absence of a valid jsid.
* *
skipping to change at line 1904 skipping to change at line 2337
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
JS_StringHasBeenInterned(JSContext *cx, JSString *str); JS_StringHasBeenInterned(JSContext *cx, JSString *str);
/* /*
* Only JSStrings that have been interned via the JSAPI can be turned into * Only JSStrings that have been interned via the JSAPI can be turned into
* jsids by API clients. * jsids by API clients.
* *
* N.B. if a jsid is backed by a string which has not been interned, that * N.B. if a jsid is backed by a string which has not been interned, that
* string must be appropriately rooted to avoid being collected by the GC. * string must be appropriately rooted to avoid being collected by the GC.
*/ */
static JS_ALWAYS_INLINE jsid JS_PUBLIC_API(jsid)
INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str) INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str);
{
jsid id;
JS_ASSERT(str);
JS_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0);
#ifdef DEBUG
JS_ASSERT(JS_StringHasBeenInterned(cx, str));
#else
(void)cx;
#endif
JSID_BITS(id) = (size_t)str;
return id;
}
static JS_ALWAYS_INLINE JSBool static JS_ALWAYS_INLINE JSBool
JSID_IS_INT(jsid id) JSID_IS_INT(jsid id)
{ {
return !!(JSID_BITS(id) & JSID_TYPE_INT); return !!(JSID_BITS(id) & JSID_TYPE_INT);
} }
static JS_ALWAYS_INLINE int32_t static JS_ALWAYS_INLINE int32_t
JSID_TO_INT(jsid id) JSID_TO_INT(jsid id)
{ {
JS_ASSERT(JSID_IS_INT(id)); JS_ASSERT(JSID_IS_INT(id));
return ((int32_t)JSID_BITS(id)) >> 1; return ((uint32_t)JSID_BITS(id)) >> 1;
} }
/* #define JSID_INT_MIN 0
* Note: when changing these values, verify that their use in #define JSID_INT_MAX INT32_MAX
* js_CheckForStringIndex is still valid.
*/
#define JSID_INT_MIN (-(1 << 30))
#define JSID_INT_MAX ((1 << 30) - 1)
static JS_ALWAYS_INLINE JSBool static JS_ALWAYS_INLINE JSBool
INT_FITS_IN_JSID(int32_t i) INT_FITS_IN_JSID(int32_t i)
{ {
return ((uint32_t)(i) - (uint32_t)JSID_INT_MIN <= return i >= 0;
(uint32_t)(JSID_INT_MAX - JSID_INT_MIN));
} }
static JS_ALWAYS_INLINE jsid static JS_ALWAYS_INLINE jsid
INT_TO_JSID(int32_t i) INT_TO_JSID(int32_t i)
{ {
jsid id; jsid id;
JS_ASSERT(INT_FITS_IN_JSID(i)); JS_ASSERT(INT_FITS_IN_JSID(i));
JSID_BITS(id) = ((i << 1) | JSID_TYPE_INT); JSID_BITS(id) = ((i << 1) | JSID_TYPE_INT);
return id; return id;
} }
skipping to change at line 1970 skipping to change at line 2386
} }
static JS_ALWAYS_INLINE JSObject * static JS_ALWAYS_INLINE JSObject *
JSID_TO_OBJECT(jsid id) JSID_TO_OBJECT(jsid id)
{ {
JS_ASSERT(JSID_IS_OBJECT(id)); JS_ASSERT(JSID_IS_OBJECT(id));
return (JSObject *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); return (JSObject *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK);
} }
static JS_ALWAYS_INLINE jsid static JS_ALWAYS_INLINE jsid
OBJECT_TO_JSID(JSObject *obj) OBJECT_TO_JSID(JSRawObject obj)
{ {
jsid id; jsid id;
JS_ASSERT(obj != NULL); JS_ASSERT(obj != NULL);
JS_ASSERT(((size_t)obj & JSID_TYPE_MASK) == 0); JS_ASSERT(((size_t)obj & JSID_TYPE_MASK) == 0);
JSID_BITS(id) = ((size_t)obj | JSID_TYPE_OBJECT); JSID_BITS(id) = ((size_t)obj | JSID_TYPE_OBJECT);
return id; return id;
} }
static JS_ALWAYS_INLINE JSBool static JS_ALWAYS_INLINE JSBool
JSID_IS_GCTHING(jsid id) JSID_IS_GCTHING(jsid id)
skipping to change at line 2116 skipping to change at line 2532
object that delegates to a proto type object that delegates to a proto type
containing this property */ containing this property */
#define JSPROP_INDEX 0x80 /* name is actually (int) index */ #define JSPROP_INDEX 0x80 /* name is actually (int) index */
#define JSPROP_SHORTID 0x100 /* set in JS_DefineProperty attrs #define JSPROP_SHORTID 0x100 /* set in JS_DefineProperty attrs
if getters/setters use a shortid */ if getters/setters use a shortid */
#define JSPROP_NATIVE_ACCESSORS 0x08 /* set in JSPropertyDescriptor.flag s #define JSPROP_NATIVE_ACCESSORS 0x08 /* set in JSPropertyDescriptor.flag s
if getters/setters are JSNatives */ if getters/setters are JSNatives */
/* Function flags, internal use only, returned by JS_GetFunctionFlags. */ /* Function flags, internal use only, returned by JS_GetFunctionFlags. */
#define JSFUN_LAMBDA 0x08 /* expressed, not declared, functio n */ #define JSFUN_LAMBDA 0x08 /* expressed, not declared, functio n */
#define JSFUN_SELF_HOSTED 0x40 /* function is self-hosted native a
nd
must not be decompilable nor
constructible. */
#define JSFUN_HEAVYWEIGHT 0x80 /* activation requires a Call objec t */ #define JSFUN_HEAVYWEIGHT 0x80 /* activation requires a Call objec t */
#define JSFUN_HEAVYWEIGHT_TEST(f) ((f) & JSFUN_HEAVYWEIGHT) #define JSFUN_HEAVYWEIGHT_TEST(f) ((f) & JSFUN_HEAVYWEIGHT)
/* 0x0100 is unused */ #define JSFUN_HAS_REST 0x0100 /* function has a rest (...) parame
#define JSFUN_CONSTRUCTOR 0x0200 /* native that can be called as a c ter */
tor #define JSFUN_CONSTRUCTOR 0x0200 /* native that can be called as a c
tor
without creating a this object * / without creating a this object * /
#define JSFUN_HAS_DEFAULTS 0x0400 /* function has at least one defaul
t
parameter */
#define JSFUN_FLAGS_MASK 0x07f8 /* overlay JSFUN_* attributes -- #define JSFUN_FLAGS_MASK 0x07f8 /* overlay JSFUN_* attributes --
bits 12-15 are used internally t o bits 12-15 are used internally t o
flag interpreted functions */ flag interpreted functions */
#define JSFUN_STUB_GSOPS 0x1000 /* use JS_PropertyStub getter/sette r #define JSFUN_STUB_GSOPS 0x1000 /* use JS_PropertyStub getter/sette r
instead of defaulting to class g sops instead of defaulting to class g sops
for property holding function */ for property holding function */
/* /*
skipping to change at line 2296 skipping to change at line 2719
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ValueToNumber(JSContext *cx, jsval v, double *dp); JS_ValueToNumber(JSContext *cx, jsval v, double *dp);
#ifdef __cplusplus #ifdef __cplusplus
namespace js { namespace js {
/* /*
* DO NOT CALL THIS. Use JS::ToNumber * DO NOT CALL THIS. Use JS::ToNumber
*/ */
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
ToNumberSlow(JSContext *cx, JS::Value v, double *dp); ToNumberSlow(JSContext *cx, JS::Value v, double *dp);
/*
* DO NOT CALL THIS. Use JS::ToBoolean
*/
extern JS_PUBLIC_API(bool)
ToBooleanSlow(const JS::Value &v);
} /* namespace js */ } /* namespace js */
namespace JS { namespace JS {
/* ES5 9.3 ToNumber. */ /* ES5 9.3 ToNumber. */
JS_ALWAYS_INLINE bool JS_ALWAYS_INLINE bool
ToNumber(JSContext *cx, const Value &v, double *out) ToNumber(JSContext *cx, const Value &v, double *out)
{ {
AssertArgumentsAreSane(cx, v); AssertArgumentsAreSane(cx, v);
{
JS::SkipRoot root(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isNumber()) { if (v.isNumber()) {
*out = v.toNumber(); *out = v.toNumber();
return true; return true;
} }
return js::ToNumberSlow(cx, v, out); return js::ToNumberSlow(cx, v, out);
} }
JS_ALWAYS_INLINE bool
ToBoolean(const Value &v)
{
if (v.isBoolean())
return v.toBoolean();
if (v.isInt32())
return v.toInt32() != 0;
if (v.isObject())
return true;
if (v.isNullOrUndefined())
return false;
if (v.isDouble()) {
double d = v.toDouble();
return !MOZ_DOUBLE_IS_NaN(d) && d != 0;
}
/* Slow path. Handle Strings. */
return js::ToBooleanSlow(v);
}
} /* namespace JS */ } /* namespace JS */
#endif /* __cplusplus */ #endif /* __cplusplus */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DoubleIsInt32(double d, int32_t *ip); JS_DoubleIsInt32(double d, int32_t *ip);
extern JS_PUBLIC_API(int32_t) extern JS_PUBLIC_API(int32_t)
JS_DoubleToInt32(double d); JS_DoubleToInt32(double d);
extern JS_PUBLIC_API(uint32_t) extern JS_PUBLIC_API(uint32_t)
JS_DoubleToUint32(double d); JS_DoubleToUint32(double d);
/* /*
* Convert a value to a number, then to an int32_t, according to the ECMA r ules * Convert a value to a number, then to an int32_t, according to the ECMA r ules
* for ToInt32. * for ToInt32.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ValueToECMAInt32(JSContext *cx, jsval v, int32_t *ip); JS_ValueToECMAInt32(JSContext *cx, jsval v, int32_t *ip);
#ifdef __cplusplus
namespace js {
/* /*
* DO NOT CALL THIS. Use JS::ToInt32 * Convert a value to a number, then to an int64_t, according to the WebIDL
* rules for ToInt64: http://dev.w3.org/2006/webapi/WebIDL/#es-long-long
*/
extern JS_PUBLIC_API(JSBool)
JS_ValueToInt64(JSContext *cx, jsval v, int64_t *ip);
/*
* Convert a value to a number, then to an uint64_t, according to the WebID
L
* rules for ToUint64: http://dev.w3.org/2006/webapi/WebIDL/#es-unsigned-lo
ng-long
*/ */
extern JS_PUBLIC_API(JSBool)
JS_ValueToUint64(JSContext *cx, jsval v, uint64_t *ip);
#ifdef __cplusplus
namespace js {
/* DO NOT CALL THIS. Use JS::ToInt16. */
extern JS_PUBLIC_API(bool)
ToUint16Slow(JSContext *cx, const JS::Value &v, uint16_t *out);
/* DO NOT CALL THIS. Use JS::ToInt32. */
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
ToInt32Slow(JSContext *cx, const JS::Value &v, int32_t *out); ToInt32Slow(JSContext *cx, const JS::Value &v, int32_t *out);
/* DO NOT CALL THIS. Use JS::ToUint32. */
extern JS_PUBLIC_API(bool)
ToUint32Slow(JSContext *cx, const JS::Value &v, uint32_t *out);
/* DO NOT CALL THIS. Use JS::ToInt64. */
extern JS_PUBLIC_API(bool)
ToInt64Slow(JSContext *cx, const JS::Value &v, int64_t *out);
/* DO NOT CALL THIS. Use JS::ToUint64. */
extern JS_PUBLIC_API(bool)
ToUint64Slow(JSContext *cx, const JS::Value &v, uint64_t *out);
} /* namespace js */ } /* namespace js */
namespace JS { namespace JS {
JS_ALWAYS_INLINE bool JS_ALWAYS_INLINE bool
ToUint16(JSContext *cx, const js::Value &v, uint16_t *out)
{
AssertArgumentsAreSane(cx, v);
{
SkipRoot skip(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isInt32()) {
*out = uint16_t(v.toInt32());
return true;
}
return js::ToUint16Slow(cx, v, out);
}
JS_ALWAYS_INLINE bool
ToInt32(JSContext *cx, const js::Value &v, int32_t *out) ToInt32(JSContext *cx, const js::Value &v, int32_t *out)
{ {
AssertArgumentsAreSane(cx, v); AssertArgumentsAreSane(cx, v);
{
JS::SkipRoot root(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isInt32()) { if (v.isInt32()) {
*out = v.toInt32(); *out = v.toInt32();
return true; return true;
} }
return js::ToInt32Slow(cx, v, out); return js::ToInt32Slow(cx, v, out);
} }
JS_ALWAYS_INLINE bool
ToUint32(JSContext *cx, const js::Value &v, uint32_t *out)
{
AssertArgumentsAreSane(cx, v);
{
JS::SkipRoot root(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isInt32()) {
*out = uint32_t(v.toInt32());
return true;
}
return js::ToUint32Slow(cx, v, out);
}
JS_ALWAYS_INLINE bool
ToInt64(JSContext *cx, const js::Value &v, int64_t *out)
{
AssertArgumentsAreSane(cx, v);
{
JS::SkipRoot skip(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isInt32()) {
*out = int64_t(v.toInt32());
return true;
}
return js::ToInt64Slow(cx, v, out);
}
JS_ALWAYS_INLINE bool
ToUint64(JSContext *cx, const js::Value &v, uint64_t *out)
{
AssertArgumentsAreSane(cx, v);
{
SkipRoot skip(cx, &v);
MaybeCheckStackRoots(cx);
}
if (v.isInt32()) {
/* Account for sign extension of negatives into the longer 64bit sp
ace. */
*out = uint64_t(int64_t(v.toInt32()));
return true;
}
return js::ToUint64Slow(cx, v, out);
}
} /* namespace JS */ } /* namespace JS */
#endif /* __cplusplus */ #endif /* __cplusplus */
/* /*
* Convert a value to a number, then to a uint32_t, according to the ECMA r ules * Convert a value to a number, then to a uint32_t, according to the ECMA r ules
* for ToUint32. * for ToUint32.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ValueToECMAUint32(JSContext *cx, jsval v, uint32_t *ip); JS_ValueToECMAUint32(JSContext *cx, jsval v, uint32_t *ip);
skipping to change at line 2646 skipping to change at line 3200
to an nsISupports subcla ss */ to an nsISupports subcla ss */
#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Scr ipt #define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Scr ipt
promises to execute comp iled promises to execute comp iled
script once only; enable s script once only; enable s
compile-time scope chain compile-time scope chain
resolution of consts. */ resolution of consts. */
#define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filenam e"] #define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filenam e"]
option supported for the option supported for the
XUL preprocessor and kin dred XUL preprocessor and kin dred
beasts. */ beasts. */
#define JSOPTION_XML JS_BIT(6) /* EMCAScript for XML suppo #define JSOPTION_ALLOW_XML JS_BIT(6) /* enable E4X syntax (depre
rt: cated)
and define the E4X-relat
ed
globals: XML, XMLList,
Namespace, etc. */
#define JSOPTION_MOAR_XML JS_BIT(7) /* enable E4X even in versi
ons
that don't normally get
it;
parse <!-- --> as a toke n, parse <!-- --> as a toke n,
not backward compatible with not backward compatible with
the comment-hiding hack used the comment-hiding hack used
in HTML script tags. */ in HTML script tags. */
#define JSOPTION_DONT_REPORT_UNCAUGHT \ #define JSOPTION_DONT_REPORT_UNCAUGHT \
JS_BIT(8) /* When returning from the JS_BIT(8) /* When returning from the
outermost API call, prev ent outermost API call, prev ent
uncaught exceptions from uncaught exceptions from
being converted to error being converted to error
reports */ reports */
#define JSOPTION_RELIMIT JS_BIT(9) /* Throw exception on any #define JSOPTION_RELIMIT JS_BIT(9) /* Throw exception on any
regular expression which regular expression which
backtracks more than n^3 backtracks more than n^3
times, where n is length times, where n is length
skipping to change at line 2687 skipping to change at line 3246
#define JSOPTION_METHODJIT JS_BIT(14) /* Whole-method JIT. */ #define JSOPTION_METHODJIT JS_BIT(14) /* Whole-method JIT. */
/* JS_BIT(15) is currently unused. */ /* JS_BIT(15) is currently unused. */
#define JSOPTION_METHODJIT_ALWAYS \ #define JSOPTION_METHODJIT_ALWAYS \
JS_BIT(16) /* Always whole-method JIT, JS_BIT(16) /* Always whole-method JIT,
don't tune at run-time. */ don't tune at run-time. */
#define JSOPTION_PCCOUNT JS_BIT(17) /* Collect per-op execution counts */ #define JSOPTION_PCCOUNT JS_BIT(17) /* Collect per-op execution counts */
#define JSOPTION_TYPE_INFERENCE JS_BIT(18) /* Perform type inference. */ #define JSOPTION_TYPE_INFERENCE JS_BIT(18) /* Perform type inference. */
#define JSOPTION_STRICT_MODE JS_BIT(19) /* Provides a way to force
strict mode for all code
without requiring
"use strict" annotations
. */
/* Options which reflect compile-time properties of scripts. */ /* Options which reflect compile-time properties of scripts. */
#define JSCOMPILEOPTION_MASK (JSOPTION_XML) #define JSCOMPILEOPTION_MASK (JSOPTION_ALLOW_XML | JSOPTION_MOAR_XML)
#define JSRUNOPTION_MASK (JS_BITMASK(19) & ~JSCOMPILEOPTION_MASK) #define JSRUNOPTION_MASK (JS_BITMASK(20) & ~JSCOMPILEOPTION_MASK)
#define JSALLOPTION_MASK (JSCOMPILEOPTION_MASK | JSRUNOPTION_MASK) #define JSALLOPTION_MASK (JSCOMPILEOPTION_MASK | JSRUNOPTION_MASK)
extern JS_PUBLIC_API(uint32_t) extern JS_PUBLIC_API(uint32_t)
JS_GetOptions(JSContext *cx); JS_GetOptions(JSContext *cx);
extern JS_PUBLIC_API(uint32_t) extern JS_PUBLIC_API(uint32_t)
JS_SetOptions(JSContext *cx, uint32_t options); JS_SetOptions(JSContext *cx, uint32_t options);
extern JS_PUBLIC_API(uint32_t) extern JS_PUBLIC_API(uint32_t)
JS_ToggleOptions(JSContext *cx, uint32_t options); JS_ToggleOptions(JSContext *cx, uint32_t options);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetJitHardening(JSRuntime *rt, JSBool enabled); JS_SetJitHardening(JSRuntime *rt, JSBool enabled);
extern JS_PUBLIC_API(const char *) extern JS_PUBLIC_API(const char *)
JS_GetImplementationVersion(void); JS_GetImplementationVersion(void);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallbac k callback); JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallbac k callback);
extern JS_PUBLIC_API(void)
JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback call
back);
extern JS_PUBLIC_API(JSWrapObjectCallback) extern JS_PUBLIC_API(JSWrapObjectCallback)
JS_SetWrapObjectCallbacks(JSRuntime *rt, JS_SetWrapObjectCallbacks(JSRuntime *rt,
JSWrapObjectCallback callback, JSWrapObjectCallback callback,
JSSameCompartmentWrapObjectCallback sccallback, JSSameCompartmentWrapObjectCallback sccallback,
JSPreWrapCallback precallback); JSPreWrapCallback precallback);
extern JS_PUBLIC_API(JSCrossCompartmentCall *) extern JS_PUBLIC_API(JSCrossCompartmentCall *)
JS_EnterCrossCompartmentCall(JSContext *cx, JSObject *target); JS_EnterCrossCompartmentCall(JSContext *cx, JSRawObject target);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_LeaveCrossCompartmentCall(JSCrossCompartmentCall *call); JS_LeaveCrossCompartmentCall(JSCrossCompartmentCall *call);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetCompartmentPrivate(JSCompartment *compartment, void *data); JS_SetCompartmentPrivate(JSCompartment *compartment, void *data);
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_GetCompartmentPrivate(JSCompartment *compartment); JS_GetCompartmentPrivate(JSCompartment *compartment);
skipping to change at line 2746 skipping to change at line 3312
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_TransplantObject(JSContext *cx, JSObject *origobj, JSObject *target); JS_TransplantObject(JSContext *cx, JSObject *origobj, JSObject *target);
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
js_TransplantObjectWithWrapper(JSContext *cx, js_TransplantObjectWithWrapper(JSContext *cx,
JSObject *origobj, JSObject *origobj,
JSObject *origwrapper, JSObject *origwrapper,
JSObject *targetobj, JSObject *targetobj,
JSObject *targetwrapper); JSObject *targetwrapper);
extern JS_FRIEND_API(JSObject *) extern JS_PUBLIC_API(JSBool)
js_TransplantObjectWithWrapper(JSContext *cx, JS_RefreshCrossCompartmentWrappers(JSContext *cx, JSObject *ob);
JSObject *origobj,
JSObject *origwrapper,
JSObject *targetobj,
JSObject *targetwrapper);
#ifdef __cplusplus #ifdef __cplusplus
JS_END_EXTERN_C JS_END_EXTERN_C
namespace js { namespace js {
class AutoCompartment; class AutoCompartment;
} }
class JS_PUBLIC_API(JSAutoEnterCompartment) class JS_PUBLIC_API(JSAutoCompartment)
{ {
/* JSContext *cx_;
* This is a poor man's Maybe<AutoCompartment>, because we don't have JSCompartment *oldCompartment_;
* access to the AutoCompartment definition here. We statically assert
in
* jsapi.cpp that we have the right size here.
*
* In practice, 32-bit Windows and Android get 16-word |bytes|, while
* other platforms get 13-word |bytes|.
*/
void* bytes[sizeof(void*) == 4 && MOZ_ALIGNOF(uint64_t) == 8 ? 16 : 13]
;
protected:
js::AutoCompartment *getAutoCompartment() {
JS_ASSERT(state == STATE_OTHER_COMPARTMENT);
return reinterpret_cast<js::AutoCompartment*>(bytes);
}
/*
* This object may be in one of three states. If enter() or
* enterAndIgnoreErrors() hasn't been called, it's in STATE_UNENTERED.
* Otherwise, if we were asked to enter into the current compartment, o
ur
* state is STATE_SAME_COMPARTMENT. If we actually created an
* AutoCompartment and entered another compartment, our state is
* STATE_OTHER_COMPARTMENT.
*/
enum State {
STATE_UNENTERED,
STATE_SAME_COMPARTMENT,
STATE_OTHER_COMPARTMENT
} state;
public: public:
JSAutoEnterCompartment() : state(STATE_UNENTERED) {} JSAutoCompartment(JSContext *cx, JSRawObject target);
~JSAutoCompartment();
bool enter(JSContext *cx, JSObject *target);
void enterAndIgnoreErrors(JSContext *cx, JSObject *target);
bool entered() const { return state != STATE_UNENTERED; }
~JSAutoEnterCompartment();
}; };
JS_BEGIN_EXTERN_C JS_BEGIN_EXTERN_C
#endif #endif
typedef void (*JSIterateCompartmentCallback)(JSRuntime *rt, void *data, JSC ompartment *compartment); typedef void (*JSIterateCompartmentCallback)(JSRuntime *rt, void *data, JSC ompartment *compartment);
/* /*
* This function calls |compartmentCallback| on every compartment. Beware that * This function calls |compartmentCallback| on every compartment. Beware that
* there is no guarantee that the compartment will survive after the callba ck * there is no guarantee that the compartment will survive after the callba ck
* returns. * returns.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_IterateCompartments(JSRuntime *rt, void *data, JS_IterateCompartments(JSRuntime *rt, void *data,
JSIterateCompartmentCallback compartmentCallback); JSIterateCompartmentCallback compartmentCallback);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalObject(JSContext *cx); JS_GetGlobalObject(JSContext *cx);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetGlobalObject(JSContext *cx, JSObject *obj); JS_SetGlobalObject(JSContext *cx, JSRawObject obj);
/* /*
* Initialize standard JS class constructors, prototypes, and any top-level * Initialize standard JS class constructors, prototypes, and any top-level
* functions and constants associated with the standard classes (e.g. isNaN * functions and constants associated with the standard classes (e.g. isNaN
* for Number). * for Number).
* *
* NB: This sets cx's global object to obj if it was null. * NB: This sets cx's global object to obj if it was null.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_InitStandardClasses(JSContext *cx, JSObject *obj); JS_InitStandardClasses(JSContext *cx, JSObject *obj);
skipping to change at line 2864 skipping to change at line 3391
/* /*
* Enumerate any already-resolved standard class ids into ida, or into a ne w * Enumerate any already-resolved standard class ids into ida, or into a ne w
* JSIdArray if ida is null. Return the augmented array on success, null o n * JSIdArray if ida is null. Return the augmented array on success, null o n
* failure with ida (if it was non-null on entry) destroyed. * failure with ida (if it was non-null on entry) destroyed.
*/ */
extern JS_PUBLIC_API(JSIdArray *) extern JS_PUBLIC_API(JSIdArray *)
JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj, JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj,
JSIdArray *ida); JSIdArray *ida);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key, JS_GetClassObject(JSContext *cx, JSRawObject obj, JSProtoKey key, JSObject
JSObject **objp); **objp);
extern JS_PUBLIC_API(JSBool)
JS_GetClassPrototype(JSContext *cx, JSProtoKey key, JSObject **objp);
extern JS_PUBLIC_API(JSProtoKey)
JS_IdentifyClassPrototype(JSContext *cx, JSObject *obj);
/* /*
* Returns the original value of |Function.prototype| from the global objec t in * Returns the original value of |Function.prototype| from the global objec t in
* which |forObj| was created. * which |forObj| was created.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj); JS_GetFunctionPrototype(JSContext *cx, JSRawObject forObj);
/* /*
* Returns the original value of |Object.prototype| from the global object in * Returns the original value of |Object.prototype| from the global object in
* which |forObj| was created. * which |forObj| was created.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetObjectPrototype(JSContext *cx, JSObject *forObj); JS_GetObjectPrototype(JSContext *cx, JSRawObject forObj);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj); JS_GetGlobalForObject(JSContext *cx, JSRawObject obj);
/*
* May return NULL, if |c| never had a global (e.g. the atoms compartment),
or
* if |c|'s global has been collected.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForScopeChain(JSContext *cx); JS_GetGlobalForScopeChain(JSContext *cx);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetScriptedGlobal(JSContext *cx); JS_GetScriptedGlobal(JSContext *cx);
/* /*
* Initialize the 'Reflect' object on a global object. * Initialize the 'Reflect' object on a global object.
*/ */
skipping to change at line 2930 skipping to change at line 3469
typedef struct JSCTypesCallbacks JSCTypesCallbacks; typedef struct JSCTypesCallbacks JSCTypesCallbacks;
/* /*
* Set the callbacks on the provided 'ctypesObj' object. 'callbacks' should be a * Set the callbacks on the provided 'ctypesObj' object. 'callbacks' should be a
* pointer to static data that exists for the lifetime of 'ctypesObj', but it * pointer to static data that exists for the lifetime of 'ctypesObj', but it
* may safely be altered after calling this function and without having * may safely be altered after calling this function and without having
* to call this function again. * to call this function again.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetCTypesCallbacks(JSObject *ctypesObj, JSCTypesCallbacks *callbacks); JS_SetCTypesCallbacks(JSRawObject ctypesObj, JSCTypesCallbacks *callbacks);
#endif #endif
typedef JSBool typedef JSBool
(* JSEnumerateDiagnosticMemoryCallback)(void *ptr, size_t length); (* JSEnumerateDiagnosticMemoryCallback)(void *ptr, size_t length);
/* /*
* Enumerate memory regions that contain diagnostic information * Enumerate memory regions that contain diagnostic information
* intended to be included in crash report minidumps. * intended to be included in crash report minidumps.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
skipping to change at line 3039 skipping to change at line 3578
extern JS_PUBLIC_API(JSFreeOp *) extern JS_PUBLIC_API(JSFreeOp *)
JS_GetDefaultFreeOp(JSRuntime *rt); JS_GetDefaultFreeOp(JSRuntime *rt);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_updateMallocCounter(JSContext *cx, size_t nbytes); JS_updateMallocCounter(JSContext *cx, size_t nbytes);
extern JS_PUBLIC_API(char *) extern JS_PUBLIC_API(char *)
JS_strdup(JSContext *cx, const char *s); JS_strdup(JSContext *cx, const char *s);
extern JS_PUBLIC_API(JSBool)
JS_NewNumberValue(JSContext *cx, double d, jsval *rval);
/* /*
* A GC root is a pointer to a jsval, JSObject * or JSString * that itself * A GC root is a pointer to a jsval, JSObject * or JSString * that itself
* points into the GC heap. JS_AddValueRoot takes a pointer to a jsval and * points into the GC heap. JS_AddValueRoot takes a pointer to a jsval and
* JS_AddGCThingRoot takes a pointer to a JSObject * or JString *. * JS_AddGCThingRoot takes a pointer to a JSObject * or JString *.
* *
* Note that, since JS_Add*Root stores the address of a variable (of type * Note that, since JS_Add*Root stores the address of a variable (of type
* jsval, JSString *, or JSObject *), that variable must live until * jsval, JSString *, or JSObject *), that variable must live until
* JS_Remove*Root is called to remove that variable. For example, after: * JS_Remove*Root is called to remove that variable. For example, after:
* *
* void some_function() { * void some_function() {
skipping to change at line 3165 skipping to change at line 3701
#define JS_EnterLocalRootScope(cx) (JS_TRUE) #define JS_EnterLocalRootScope(cx) (JS_TRUE)
#define JS_LeaveLocalRootScope(cx) ((void) 0) #define JS_LeaveLocalRootScope(cx) ((void) 0)
#define JS_LeaveLocalRootScopeWithResult(cx, rval) ((void) 0) #define JS_LeaveLocalRootScopeWithResult(cx, rval) ((void) 0)
#define JS_ForgetLocalRoot(cx, thing) ((void) 0) #define JS_ForgetLocalRoot(cx, thing) ((void) 0)
typedef enum JSGCRootType { typedef enum JSGCRootType {
JS_GC_ROOT_VALUE_PTR, JS_GC_ROOT_VALUE_PTR,
JS_GC_ROOT_GCTHING_PTR JS_GC_ROOT_GCTHING_PTR
} JSGCRootType; } JSGCRootType;
#ifdef DEBUG
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DumpNamedRoots(JSRuntime *rt, JS_DumpNamedRoots(JSRuntime *rt,
void (*dump)(const char *name, void *rp, JSGCRootType typ e, void *data), void (*dump)(const char *name, void *rp, JSGCRootType typ e, void *data),
void *data); void *data);
#endif
/* /*
* Call JS_MapGCRoots to map the GC's roots table using map(rp, name, data) . * Call JS_MapGCRoots to map the GC's roots table using map(rp, name, data) .
* The root is pointed at by rp; if the root is unnamed, name is null; data is * The root is pointed at by rp; if the root is unnamed, name is null; data is
* supplied from the third parameter to JS_MapGCRoots. * supplied from the third parameter to JS_MapGCRoots.
* *
* The map function should return JS_MAP_GCROOT_REMOVE to cause the current ly * The map function should return JS_MAP_GCROOT_REMOVE to cause the current ly
* enumerated root to be removed. To stop enumeration, set JS_MAP_GCROOT_S TOP * enumerated root to be removed. To stop enumeration, set JS_MAP_GCROOT_S TOP
* in the return value. To keep on mapping, return JS_MAP_GCROOT_NEXT. Th ese * in the return value. To keep on mapping, return JS_MAP_GCROOT_NEXT. Th ese
* constants are flags; you can OR them together. * constants are flags; you can OR them together.
skipping to change at line 3260 skipping to change at line 3798
/* /*
* Tracer callback, called for each traceable thing directly referenced by a * Tracer callback, called for each traceable thing directly referenced by a
* particular object or runtime structure. It is the callback responsibilit y * particular object or runtime structure. It is the callback responsibilit y
* to ensure the traversal of the full object graph via calling eventually * to ensure the traversal of the full object graph via calling eventually
* JS_TraceChildren on the passed thing. In this case the callback must be * JS_TraceChildren on the passed thing. In this case the callback must be
* prepared to deal with cycles in the traversal graph. * prepared to deal with cycles in the traversal graph.
* *
* kind argument is one of JSTRACE_OBJECT, JSTRACE_STRING or a tag denoting * kind argument is one of JSTRACE_OBJECT, JSTRACE_STRING or a tag denoting
* internal implementation-specific traversal kind. In the latter case the only * internal implementation-specific traversal kind. In the latter case the only
* operations on thing that the callback can do is to call JS_TraceChildren or * operations on thing that the callback can do is to call JS_TraceChildren or
* DEBUG-only JS_PrintTraceThingInfo. * JS_GetTraceThingInfo.
* *
* If eagerlyTraceWeakMaps is true, when we trace a WeakMap visit all * If eagerlyTraceWeakMaps is true, when we trace a WeakMap visit all
* of its mappings. This should be used in cases where the tracer * of its mappings. This should be used in cases where the tracer
* wants to use the existing liveness of entries. * wants to use the existing liveness of entries.
*/ */
typedef void typedef void
(* JSTraceCallback)(JSTracer *trc, void **thingp, JSGCTraceKind kind); (* JSTraceCallback)(JSTracer *trc, void **thingp, JSGCTraceKind kind);
struct JSTracer { struct JSTracer {
JSRuntime *runtime; JSRuntime *runtime;
JSTraceCallback callback; JSTraceCallback callback;
JSTraceNamePrinter debugPrinter; JSTraceNamePrinter debugPrinter;
const void *debugPrintArg; const void *debugPrintArg;
size_t debugPrintIndex; size_t debugPrintIndex;
JSBool eagerlyTraceWeakMaps; JSBool eagerlyTraceWeakMaps;
#ifdef DEBUG #ifdef JS_GC_ZEAL
void *realLocation; void *realLocation;
#endif #endif
}; };
/* /*
* The method to call on each reference to a traceable thing stored in a * The method to call on each reference to a traceable thing stored in a
* particular JSObject or other runtime structure. With DEBUG defined the * particular JSObject or other runtime structure. With DEBUG defined the
* caller before calling JS_CallTracer must initialize JSTracer fields * caller before calling JS_CallTracer must initialize JSTracer fields
* describing the reference using the macros below. * describing the reference using the macros below.
*/ */
skipping to change at line 3306 skipping to change at line 3844
* alone describes the reference or it must be an index into some array vec tor * alone describes the reference or it must be an index into some array vec tor
* that stores the reference. * that stores the reference.
* *
* When printer callback is not null, the arg and index arguments are * When printer callback is not null, the arg and index arguments are
* available to the callback as debugPrintArg and debugPrintIndex fields * available to the callback as debugPrintArg and debugPrintIndex fields
* of JSTracer. * of JSTracer.
* *
* The storage for name or callback's arguments needs to live only until * The storage for name or callback's arguments needs to live only until
* the following call to JS_CallTracer returns. * the following call to JS_CallTracer returns.
*/ */
#ifdef DEBUG
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \ # define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
(trc)->debugPrinter = (printer); \ (trc)->debugPrinter = (printer); \
(trc)->debugPrintArg = (arg); \ (trc)->debugPrintArg = (arg); \
(trc)->debugPrintIndex = (index); \ (trc)->debugPrintIndex = (index); \
JS_END_MACRO JS_END_MACRO
#else
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index)
\
JS_BEGIN_MACRO
\
JS_END_MACRO
#endif
/* /*
* Sets the real location for a marked reference, when passing the address * Sets the real location for a marked reference, when passing the address
* directly is not feasable. * directly is not feasable.
*
* FIXME: This is currently overcomplicated by our need to nest calls for V
alues
* stored as keys in hash tables, but will get simplified once we can rekey
* in-place.
*/ */
#ifdef DEBUG #ifdef JS_GC_ZEAL
# define JS_SET_TRACING_LOCATION(trc, location) \ # define JS_SET_TRACING_LOCATION(trc, location) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
(trc)->realLocation = (location); if (!(trc)->realLocation || !(location))
\ \
(trc)->realLocation = (location);
\
JS_END_MACRO JS_END_MACRO
#else #else
# define JS_SET_TRACING_LOCATION(trc, location) \ # define JS_SET_TRACING_LOCATION(trc, location) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
JS_END_MACRO JS_END_MACRO
#endif #endif
/* /*
* Convenience macro to describe the argument of JS_CallTracer using C stri ng * Convenience macro to describe the argument of JS_CallTracer using C stri ng
* and index. * and index.
skipping to change at line 3395 skipping to change at line 3932
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback); JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind); JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_TraceRuntime(JSTracer *trc); JS_TraceRuntime(JSTracer *trc);
#ifdef DEBUG
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_PrintTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc,
void *thing, JSGCTraceKind kind, JSBool includeDetai void *thing, JSGCTraceKind kind, JSBool includeDetails
ls); );
extern JS_PUBLIC_API(const char *) extern JS_PUBLIC_API(const char *)
JS_GetTraceEdgeName(JSTracer *trc, char *buffer, int bufferSize); JS_GetTraceEdgeName(JSTracer *trc, char *buffer, int bufferSize);
#ifdef DEBUG
/* /*
* DEBUG-only method to dump the object graph of heap-allocated things. * DEBUG-only method to dump the object graph of heap-allocated things.
* *
* fp: file for the dump output. * fp: file for the dump output.
* start: when non-null, dump only things reachable from start * start: when non-null, dump only things reachable from start
* thing. Otherwise dump all things reachable from the * thing. Otherwise dump all things reachable from the
* runtime roots. * runtime roots.
* startKind: trace kind of start if start is not null. Must be * startKind: trace kind of start if start is not null. Must be
* JSTRACE_OBJECT when start is null. * JSTRACE_OBJECT when start is null.
* thingToFind: dump only paths in the object graph leading to thingToF ind * thingToFind: dump only paths in the object graph leading to thingToF ind
skipping to change at line 3432 skipping to change at line 3969
#endif #endif
/* /*
* Garbage collector API. * Garbage collector API.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_GC(JSRuntime *rt); JS_GC(JSRuntime *rt);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_CompartmentGC(JSRuntime *rt, JSCompartment *comp);
extern JS_PUBLIC_API(void)
JS_MaybeGC(JSContext *cx); JS_MaybeGC(JSContext *cx);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetGCCallback(JSRuntime *rt, JSGCCallback cb); JS_SetGCCallback(JSRuntime *rt, JSGCCallback cb);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetFinalizeCallback(JSRuntime *rt, JSFinalizeCallback cb); JS_SetFinalizeCallback(JSRuntime *rt, JSFinalizeCallback cb);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsGCMarkingTracer(JSTracer *trc); JS_IsGCMarkingTracer(JSTracer *trc);
skipping to change at line 3478 skipping to change at line 4012
/* Number of cached empty GC chunks. */ /* Number of cached empty GC chunks. */
JSGC_UNUSED_CHUNKS = 7, JSGC_UNUSED_CHUNKS = 7,
/* Total number of allocated GC chunks. */ /* Total number of allocated GC chunks. */
JSGC_TOTAL_CHUNKS = 8, JSGC_TOTAL_CHUNKS = 8,
/* Max milliseconds to spend in an incremental GC slice. */ /* Max milliseconds to spend in an incremental GC slice. */
JSGC_SLICE_TIME_BUDGET = 9, JSGC_SLICE_TIME_BUDGET = 9,
/* Maximum size the GC mark stack can grow to. */ /* Maximum size the GC mark stack can grow to. */
JSGC_MARK_STACK_LIMIT = 10 JSGC_MARK_STACK_LIMIT = 10,
/*
* GCs less than this far apart in time will be considered 'high-freque
ncy GCs'.
* See setGCLastBytes in jsgc.cpp.
*/
JSGC_HIGH_FREQUENCY_TIME_LIMIT = 11,
/* Start of dynamic heap growth. */
JSGC_HIGH_FREQUENCY_LOW_LIMIT = 12,
/* End of dynamic heap growth. */
JSGC_HIGH_FREQUENCY_HIGH_LIMIT = 13,
/* Upper bound of heap growth. */
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX = 14,
/* Lower bound of heap growth. */
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN = 15,
/* Heap growth for low frequency GCs. */
JSGC_LOW_FREQUENCY_HEAP_GROWTH = 16,
/*
* If false, the heap growth factor is fixed at 3. If true, it is deter
mined
* based on whether GCs are high- or low- frequency.
*/
JSGC_DYNAMIC_HEAP_GROWTH = 17,
/* If true, high-frequency GCs will use a longer mark slice. */
JSGC_DYNAMIC_MARK_SLICE = 18,
/* Number of megabytes of analysis data to allocate before purging. */
JSGC_ANALYSIS_PURGE_TRIGGER = 19
} JSGCParamKey; } JSGCParamKey;
typedef enum JSGCMode { typedef enum JSGCMode {
/* Perform only global GCs. */ /* Perform only global GCs. */
JSGC_MODE_GLOBAL = 0, JSGC_MODE_GLOBAL = 0,
/* Perform per-compartment GCs until too much garbage has accumulated. */ /* Perform per-compartment GCs until too much garbage has accumulated. */
JSGC_MODE_COMPARTMENT = 1, JSGC_MODE_COMPARTMENT = 1,
/* /*
skipping to change at line 3560 skipping to change at line 4127
JSPropertyOp getProperty; JSPropertyOp getProperty;
JSStrictPropertyOp setProperty; JSStrictPropertyOp setProperty;
JSEnumerateOp enumerate; JSEnumerateOp enumerate;
JSResolveOp resolve; JSResolveOp resolve;
JSConvertOp convert; JSConvertOp convert;
JSFinalizeOp finalize; JSFinalizeOp finalize;
/* Optionally non-null members start here. */ /* Optionally non-null members start here. */
JSCheckAccessOp checkAccess; JSCheckAccessOp checkAccess;
JSNative call; JSNative call;
JSNative construct;
JSHasInstanceOp hasInstance; JSHasInstanceOp hasInstance;
JSNative construct;
JSTraceOp trace; JSTraceOp trace;
void *reserved[40]; void *reserved[40];
}; };
#define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slo t */ #define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slo t */
#define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hoo k */ #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hoo k */
#define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */
#define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) /* private is (nsISupports *) */ #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) /* private is (nsISupports *) */
#define JSCLASS_NEW_RESOLVE_GETS_START (1<<4) /* JSNewResolveOp gets star #define JSCLASS_IS_DOMJSCLASS (1<<4) /* objects are DOM */
ting
object in prototype chai
n
passed in via *objp in/o
ut
parameter */
#define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) /* Correctly implements GC read #define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) /* Correctly implements GC read
and write barriers */ and write barriers */
#define JSCLASS_DOCUMENT_OBSERVER (1<<6) /* DOM document observer */ #define JSCLASS_DOCUMENT_OBSERVER (1<<6) /* DOM document observer */
#define JSCLASS_USERBIT1 (1<<7) /* Reserved for embeddings. */ #define JSCLASS_USERBIT1 (1<<7) /* Reserved for embeddings. */
/* /*
* To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise- or * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise- or
* JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, wh ere * JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, wh ere
* n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1. * n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1.
*/ */
skipping to change at line 3597 skipping to change at line 4161
#define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_W IDTH) #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_W IDTH)
#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK ) \ #define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK ) \
<< JSCLASS_RESERVED_SLOTS_SHIFT) << JSCLASS_RESERVED_SLOTS_SHIFT)
#define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \
>> JSCLASS_RESERVED_SLOTS_SHIFT) \ >> JSCLASS_RESERVED_SLOTS_SHIFT) \
& JSCLASS_RESERVED_SLOTS_MASK) & JSCLASS_RESERVED_SLOTS_MASK)
#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ #define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \
JSCLASS_RESERVED_SLOTS_WIDTH) JSCLASS_RESERVED_SLOTS_WIDTH)
/* #define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0))
* Call the iteratorObject hook only to iterate over contents (for-of), not #define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1))
to #define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2))
* enumerate properties (for-in, for-each, Object.keys, etc.) #define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3))
*/
#define JSCLASS_FOR_OF_ITERATION (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0))
#define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1))
#define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2))
#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3))
#define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
/* Indicate whether the proto or ctor should be frozen. */ /* Indicate whether the proto or ctor should be frozen. */
#define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5)) #define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
#define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6)) #define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5))
#define JSCLASS_XPCONNECT_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7)) #define JSCLASS_XPCONNECT_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6))
/* Reserved for embeddings. */ /* Reserved for embeddings. */
#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8)) #define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7))
#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+9)) #define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8))
/* /*
* Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see * Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see
* below. * below.
*/ */
/* Global flags. */ /* Global flags. */
#define JSGLOBAL_FLAGS_CLEARED 0x1 #define JSGLOBAL_FLAGS_CLEARED 0x1
/* /*
* ECMA-262 requires that most constructors used internally create objects * ECMA-262 requires that most constructors used internally create objects
* with "the original Foo.prototype value" as their [[Prototype]] (__proto_ _) * with "the original Foo.prototype value" as their [[Prototype]] (__proto_ _)
* member initial value. The "original ... value" verbiage is there becaus e * member initial value. The "original ... value" verbiage is there becaus e
* in ECMA-262, global properties naming class objects are read/write and * in ECMA-262, global properties naming class objects are read/write and
* deleteable, for the most part. * deleteable, for the most part.
* *
* Implementing this efficiently requires that global objects have classes * Implementing this efficiently requires that global objects have classes
* with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was * with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was
* prevously allowed, but is now an ES5 violation and thus unsupported. * prevously allowed, but is now an ES5 violation and thus unsupported.
*/ */
#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 8) #define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 24)
#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \ #define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
(JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COU NT + (n))) (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COU NT + (n)))
#define JSCLASS_GLOBAL_FLAGS \ #define JSCLASS_GLOBAL_FLAGS \
JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0) JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0)
#define JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(clasp) \ #define JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(clasp) \
(((clasp)->flags & JSCLASS_IS_GLOBAL) \ (((clasp)->flags & JSCLASS_IS_GLOBAL) \
&& JSCLASS_RESERVED_SLOTS(clasp) >= JSCLASS_GLOBAL_SLOT_COUNT) && JSCLASS_RESERVED_SLOTS(clasp) >= JSCLASS_GLOBAL_SLOT_COUNT)
/* Fast access to the original value of each standard class's prototype. */ /* Fast access to the original value of each standard class's prototype. */
#define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10) #define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10)
#define JSCLASS_CACHED_PROTO_WIDTH 6 #define JSCLASS_CACHED_PROTO_WIDTH 6
#define JSCLASS_CACHED_PROTO_MASK JS_BITMASK(JSCLASS_CACHED_PROTO_WID TH) #define JSCLASS_CACHED_PROTO_MASK JS_BITMASK(JSCLASS_CACHED_PROTO_WID TH)
#define JSCLASS_HAS_CACHED_PROTO(key) ((key) << JSCLASS_CACHED_PROTO_SHIF T) #define JSCLASS_HAS_CACHED_PROTO(key) (uint32_t(key) << JSCLASS_CACHED_PR OTO_SHIFT)
#define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey) \ #define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey) \
(((clasp)->flags \ (((clasp)->flags \
>> JSCLASS_CACHED_PROTO_SHIFT) \ >> JSCLASS_CACHED_PROTO_SHIFT) \
& JSCLASS_CACHED_PROTO_MASK)) & JSCLASS_CACHED_PROTO_MASK))
/* Initializer for unused members of statically initialized JSClass structs . */ /* Initializer for unused members of statically initialized JSClass structs . */
#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0} #define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0}
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBE RS #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBE RS
extern JS_PUBLIC_API(int) extern JS_PUBLIC_API(int)
skipping to change at line 3733 skipping to change at line 4291
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IdToValue(JSContext *cx, jsid id, jsval *vp); JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
/* /*
* JSNewResolveOp flag bits. * JSNewResolveOp flag bits.
*/ */
#define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */ #define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */
#define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignmen t */ #define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignmen t */
#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:... ' */ #define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:... ' */
#define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog o
p */
#define JSRESOLVE_CLASSNAME 0x10 /* class name used when constructin
g */
#define JSRESOLVE_WITH 0x20 /* resolve inside a with statement
*/
/* /*
* Invoke the [[DefaultValue]] hook (see ES5 8.6.2) with the provided hint on * Invoke the [[DefaultValue]] hook (see ES5 8.6.2) with the provided hint on
* the specified object, computing a primitive default value for the object . * the specified object, computing a primitive default value for the object .
* The hint must be JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_VOID (no hint). On * The hint must be JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_VOID (no hint). On
* success the resulting value is stored in *vp. * success the resulting value is stored in *vp.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp); JS_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_PropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp); JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutable HandleValue vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_StrictPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp); JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSB ool strict, JSMutableHandleValue vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_EnumerateStub(JSContext *cx, JSObject *obj); JS_EnumerateStub(JSContext *cx, JSHandleObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ResolveStub(JSContext *cx, JSObject *obj, jsid id); JS_ResolveStub(JSContext *cx, JSHandleObject obj, JSHandleId id);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp); JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHan dleValue vp);
struct JSConstDoubleSpec { struct JSConstDoubleSpec {
double dval; double dval;
const char *name; const char *name;
uint8_t flags; uint8_t flags;
uint8_t spare[3]; uint8_t spare[3];
}; };
typedef struct JSJitInfo JSJitInfo;
/*
* Wrappers to replace {Strict,}PropertyOp for JSPropertySpecs. This will a
llow
* us to pass one JSJitInfo per function with the property spec, without
* additional field overhead.
*/
typedef struct JSStrictPropertyOpWrapper {
JSStrictPropertyOp op;
const JSJitInfo *info;
} JSStrictPropertyOpWrapper;
typedef struct JSPropertyOpWrapper {
JSPropertyOp op;
const JSJitInfo *info;
} JSPropertyOpWrapper;
/*
* Wrapper to do as above, but for JSNatives for JSFunctionSpecs.
*/
typedef struct JSNativeWrapper {
JSNative op;
const JSJitInfo *info;
} JSNativeWrapper;
/*
* Macro static initializers which make it easy to pass no JSJitInfo as par
t of a
* JSPropertySpec or JSFunctionSpec.
*/
#define JSOP_WRAPPER(op) {op, NULL}
#define JSOP_NULLWRAPPER JSOP_WRAPPER(NULL)
/* /*
* To define an array element rather than a named property member, cast the * To define an array element rather than a named property member, cast the
* element's index to (const char *) and initialize name with it, and set t he * element's index to (const char *) and initialize name with it, and set t he
* JSPROP_INDEX bit in flags. * JSPROP_INDEX bit in flags.
*/ */
struct JSPropertySpec { struct JSPropertySpec {
const char *name; const char *name;
int8_t tinyid; int8_t tinyid;
uint8_t flags; uint8_t flags;
JSPropertyOp getter; JSPropertyOpWrapper getter;
JSStrictPropertyOp setter; JSStrictPropertyOpWrapper setter;
}; };
/*
* To define a native function, set call to a JSNativeWrapper. To define a
* self-hosted function, set selfHostedName to the name of a function
* compiled during JSRuntime::initSelfHosting.
*/
struct JSFunctionSpec { struct JSFunctionSpec {
const char *name; const char *name;
JSNative call; JSNativeWrapper call;
uint16_t nargs; uint16_t nargs;
uint16_t flags; uint16_t flags;
const char *selfHostedName;
}; };
/* /*
* Terminating sentinel initializer to put at the end of a JSFunctionSpec a rray * Terminating sentinel initializer to put at the end of a JSFunctionSpec a rray
* that's passed to JS_DefineFunctions or JS_InitClass. * that's passed to JS_DefineFunctions or JS_InitClass.
*/ */
#define JS_FS_END JS_FS(NULL,NULL,0,0) #define JS_FS_END JS_FS(NULL,NULL,0,0)
/* /*
* Initializer macros for a JSFunctionSpec array element. JS_FN (whose name * Initializer macros for a JSFunctionSpec array element. JS_FN (whose name
* pays homage to the old JSNative/JSFastNative split) simply adds the flag * pays homage to the old JSNative/JSFastNative split) simply adds the flag
* JSFUN_STUB_GSOPS. * JSFUN_STUB_GSOPS. JS_FNINFO allows the simple adding of JSJitInfos.
*/ */
#define JS_FS(name,call,nargs,flags) \ #define JS_FS(name,call,nargs,flags) \
{name, call, nargs, flags} {name, JSOP_WRAPPER(call), nargs, flags}
#define JS_FN(name,call,nargs,flags) \ #define JS_FN(name,call,nargs,flags) \
{name, call, nargs, (flags) | JSFUN_STUB_GSOPS} {name, JSOP_WRAPPER(call), nargs, (flags) | JSFUN_STUB_GSOPS}
#define JS_FNINFO(name,call,info,nargs,flags)
\
{name,{call,info},nargs,flags}
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto, JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
JSClass *clasp, JSNative constructor, unsigned nargs, JSClass *clasp, JSNative constructor, unsigned nargs,
JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *ps, JSFunctionSpec *fs,
JSPropertySpec *static_ps, JSFunctionSpec *static_fs); JSPropertySpec *static_ps, JSFunctionSpec *static_fs);
/* /*
* Set up ctor.prototype = proto and proto.constructor = ctor with the * Set up ctor.prototype = proto and proto.constructor = ctor with the
* right property flags. * right property flags.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *pro to); JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *pro to);
extern JS_PUBLIC_API(JSClass *) extern JS_PUBLIC_API(JSClass *)
JS_GetClass(JSObject *obj); JS_GetClass(JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv); JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp); JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_GetPrivate(JSObject *obj); JS_GetPrivate(JSRawObject obj);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetPrivate(JSObject *obj, void *data); JS_SetPrivate(JSRawObject obj, void *data);
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp, JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
jsval *argv); jsval *argv);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetPrototype(JSObject *obj); JS_GetPrototype(JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto); JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetParent(JSObject *obj); JS_GetParent(JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent); JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetConstructor(JSContext *cx, JSObject *proto); JS_GetConstructor(JSContext *cx, JSObject *proto);
/* /*
* Get a unique identifier for obj, good for the lifetime of obj (even if i t * Get a unique identifier for obj, good for the lifetime of obj (even if i t
* is moved by a copying GC). Return false on failure (likely out of memor y), * is moved by a copying GC). Return false on failure (likely out of memor y),
* and true with *idp containing the unique id on success. * and true with *idp containing the unique id on success.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp); JS_GetObjectId(JSContext *cx, JSRawObject obj, jsid *idp);
extern JS_PUBLIC_API(JSObject *)
JS_NewGlobalObject(JSContext *cx, JSClass *clasp);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewCompartmentAndGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipal s *principals); JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals) ;
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *pare nt); JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *pare nt);
/* Queries the [[Extensible]] property of the object. */ /* Queries the [[Extensible]] property of the object. */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsExtensible(JSObject *obj); JS_IsExtensible(JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsNative(JSObject *obj); JS_IsNative(JSRawObject obj);
extern JS_PUBLIC_API(JSRuntime *) extern JS_PUBLIC_API(JSRuntime *)
JS_GetObjectRuntime(JSObject *obj); JS_GetObjectRuntime(JSRawObject obj);
/* /*
* Unlike JS_NewObject, JS_NewObjectWithGivenProto does not compute a defau lt * Unlike JS_NewObject, JS_NewObjectWithGivenProto does not compute a defau lt
* proto if proto's actual parameter value is null. * proto if proto's actual parameter value is null.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto, JS_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
JSObject *parent); JSObject *parent);
/* /*
skipping to change at line 3901 skipping to change at line 4493
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DeepFreezeObject(JSContext *cx, JSObject *obj); JS_DeepFreezeObject(JSContext *cx, JSObject *obj);
/* /*
* Freezes an object; see ES5's Object.freeze(obj) method. * Freezes an object; see ES5's Object.freeze(obj) method.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_FreezeObject(JSContext *cx, JSObject *obj); JS_FreezeObject(JSContext *cx, JSObject *obj);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *parent);
extern JS_PUBLIC_API(JSObject *)
JS_ConstructObjectWithArguments(JSContext *cx, JSClass *clasp, JSObject *pa
rent,
unsigned argc, jsval *argv);
extern JS_PUBLIC_API(JSObject *)
JS_New(JSContext *cx, JSObject *ctor, unsigned argc, jsval *argv); JS_New(JSContext *cx, JSObject *ctor, unsigned argc, jsval *argv);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *cl asp, JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *cl asp,
JSObject *proto, unsigned attrs); JSObject *proto, unsigned attrs);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DefineConstDoubles(JSContext *cx, JSObject *obj, JSConstDoubleSpec *cds) ; JS_DefineConstDoubles(JSContext *cx, JSObject *obj, JSConstDoubleSpec *cds) ;
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
skipping to change at line 4006 skipping to change at line 4591
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name, JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name,
unsigned flags, jsval *vp); unsigned flags, jsval *vp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id, JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id,
unsigned flags, JSObject **objp, jsval *vp); unsigned flags, JSObject **objp, jsval *vp);
struct JSPropertyDescriptor { struct JSPropertyDescriptor {
JSObject *obj; JSObject *obj;
unsigned attrs; unsigned attrs;
unsigned shortid;
JSPropertyOp getter; JSPropertyOp getter;
JSStrictPropertyOp setter; JSStrictPropertyOp setter;
jsval value; jsval value;
unsigned shortid;
}; };
/* /*
* Like JS_GetPropertyAttrsGetterAndSetterById but will return a property o n * Like JS_GetPropertyAttrsGetterAndSetterById but will return a property o n
* an object on the prototype chain (returned in objp). If data->obj is nul l, * an object on the prototype chain (returned in objp). If data->obj is nul l,
* then this property was not found on the prototype chain. * then this property was not found on the prototype chain.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, unsigne d flags, JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, unsigne d flags,
JSPropertyDescriptor *desc); JSPropertyDescriptor *desc);
skipping to change at line 4216 skipping to change at line 4801
/* /*
* Return true on success with *idp containing the id of the next enumerabl e * Return true on success with *idp containing the id of the next enumerabl e
* property to visit using iterobj, or JSID_IS_VOID if there is no such pro perty * property to visit using iterobj, or JSID_IS_VOID if there is no such pro perty
* left to visit. Return false on error. * left to visit. Return false on error.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp); JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp);
/* /*
* Create an object to iterate over the elements of obj in for-of order. Th * A JSNative that creates and returns a new iterator that iterates over th
is e
* can be used to implement the iteratorObject hook for an array-like Class * elements of |this|, up to |this.length|, in index order. This can be use
. d to
* make any array-like object iterable. Just give the object an obj.iterato
r()
* method using this JSNative as the implementation.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSBool)
JS_NewElementIterator(JSContext *cx, JSObject *obj); JS_ArrayIterator(JSContext *cx, unsigned argc, jsval *vp);
/*
* To make your array-like class iterable using the for-of loop, set the
* JSCLASS_FOR_OF_ITERATION bit in the class's flags field and set its
* .ext.iteratorObject hook to this function.
*/
extern JS_PUBLIC_API(JSObject *)
JS_ElementIteratorStub(JSContext *cx, JSObject *obj, JSBool keysonly);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode, JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
jsval *vp, unsigned *attrsp); jsval *vp, unsigned *attrsp);
extern JS_PUBLIC_API(jsval) extern JS_PUBLIC_API(jsval)
JS_GetReservedSlot(JSObject *obj, uint32_t index); JS_GetReservedSlot(JSRawObject obj, uint32_t index);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetReservedSlot(JSObject *obj, uint32_t index, jsval v); JS_SetReservedSlot(JSRawObject obj, uint32_t index, jsval v);
/************************************************************************/ /************************************************************************/
/* /*
* Security protocol. * Security protocol.
*/ */
struct JSPrincipals { struct JSPrincipals {
/* Don't call "destroy"; use reference counting macros below. */ /* Don't call "destroy"; use reference counting macros below. */
int refcount; int refcount;
skipping to change at line 4277 skipping to change at line 4856
}; };
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_HoldPrincipals(JSPrincipals *principals); JS_HoldPrincipals(JSPrincipals *principals);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DropPrincipals(JSRuntime *rt, JSPrincipals *principals); JS_DropPrincipals(JSRuntime *rt, JSPrincipals *principals);
struct JSSecurityCallbacks { struct JSSecurityCallbacks {
JSCheckAccessOp checkObjectAccess; JSCheckAccessOp checkObjectAccess;
JSSubsumePrincipalsOp subsumePrincipals;
JSObjectPrincipalsFinder findObjectPrincipals;
JSCSPEvalChecker contentSecurityPolicyAllows; JSCSPEvalChecker contentSecurityPolicyAllows;
JSPushContextPrincipalOp pushContextPrincipal;
JSPopContextPrincipalOp popContextPrincipal;
}; };
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *callbacks ); JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *callbacks );
extern JS_PUBLIC_API(const JSSecurityCallbacks *) extern JS_PUBLIC_API(const JSSecurityCallbacks *)
JS_GetSecurityCallbacks(JSRuntime *rt); JS_GetSecurityCallbacks(JSRuntime *rt);
/* /*
* Code running with "trusted" principals will be given a deeper stack * Code running with "trusted" principals will be given a deeper stack
skipping to change at line 4343 skipping to change at line 4918
/* /*
* Return the function's identifier as a JSString, or null if fun is unname d. * Return the function's identifier as a JSString, or null if fun is unname d.
* The returned string lives as long as fun, so you don't need to root a sa ved * The returned string lives as long as fun, so you don't need to root a sa ved
* reference to it if fun is well-connected or rooted, and provided you bou nd * reference to it if fun is well-connected or rooted, and provided you bou nd
* the use of the saved reference by fun's lifetime. * the use of the saved reference by fun's lifetime.
*/ */
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_GetFunctionId(JSFunction *fun); JS_GetFunctionId(JSFunction *fun);
/* /*
* Return a function's display name. This is the defined name if one was gi
ven
* where the function was defined, or it could be an inferred name by the J
S
* engine in the case that the function was defined to be anonymous. This c
an
* still return NULL if a useful display name could not be inferred. The sa
me
* restrictions on rooting as those in JS_GetFunctionId apply.
*/
extern JS_PUBLIC_API(JSString *)
JS_GetFunctionDisplayId(JSFunction *fun);
/*
* Return JSFUN_* flags for fun. * Return JSFUN_* flags for fun.
*/ */
extern JS_PUBLIC_API(unsigned) extern JS_PUBLIC_API(unsigned)
JS_GetFunctionFlags(JSFunction *fun); JS_GetFunctionFlags(JSFunction *fun);
/* /*
* Return the arity (length) of fun. * Return the arity (length) of fun.
*/ */
extern JS_PUBLIC_API(uint16_t) extern JS_PUBLIC_API(uint16_t)
JS_GetFunctionArity(JSFunction *fun); JS_GetFunctionArity(JSFunction *fun);
/* /*
* Infallible predicate to test whether obj is a function object (faster th an * Infallible predicate to test whether obj is a function object (faster th an
* comparing obj's class name to "Function", but equivalent unless someone has * comparing obj's class name to "Function", but equivalent unless someone has
* overwritten the "Function" identifier with a different constructor and t hen * overwritten the "Function" identifier with a different constructor and t hen
* created instances using that constructor that might be passed in as obj) . * created instances using that constructor that might be passed in as obj) .
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ObjectIsFunction(JSContext *cx, JSObject *obj); JS_ObjectIsFunction(JSContext *cx, JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ObjectIsCallable(JSContext *cx, JSObject *obj); JS_ObjectIsCallable(JSContext *cx, JSRawObject obj);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsNativeFunction(JSObject *funobj, JSNative call); JS_IsNativeFunction(JSRawObject funobj, JSNative call);
/* /*
* Bind the given callable to use the given object as "this". * Bind the given callable to use the given object as "this".
* *
* If |callable| is not callable, will throw and return NULL. * If |callable| is not callable, will throw and return NULL.
*/ */
extern JS_PUBLIC_API(JSObject*) extern JS_PUBLIC_API(JSObject*)
JS_BindCallable(JSContext *cx, JSObject *callable, JSObject *newThis); JS_BindCallable(JSContext *cx, JSObject *callable, JSRawObject newThis);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs); JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call, JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call,
unsigned nargs, unsigned attrs); unsigned nargs, unsigned attrs);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
JS_DefineUCFunction(JSContext *cx, JSObject *obj, JS_DefineUCFunction(JSContext *cx, JSObject *obj,
const jschar *name, size_t namelen, JSNative call, const jschar *name, size_t namelen, JSNative call,
unsigned nargs, unsigned attrs); unsigned nargs, unsigned attrs);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
JS_DefineFunctionById(JSContext *cx, JSObject *obj, jsid id, JSNative call, JS_DefineFunctionById(JSContext *cx, JSObject *obj, jsid id, JSNative call,
unsigned nargs, unsigned attrs); unsigned nargs, unsigned attrs);
/*
* Clone a top-level function into a new scope. This function will dynamica
lly
* fail if funobj was lexically nested inside some other function.
*/
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSRawObject parent) ;
/* /*
* Given a buffer, return JS_FALSE if the buffer might become a valid * Given a buffer, return JS_FALSE if the buffer might become a valid
* javascript statement with the addition of more lines. Otherwise return * javascript statement with the addition of more lines. Otherwise return
* JS_TRUE. The intent is to support interactive compilation - accumulate * JS_TRUE. The intent is to support interactive compilation - accumulate
* lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to * lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to
* the compiler. * the compiler.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8, JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8,
skipping to change at line 4509 skipping to change at line 5098
const char *filename, unsigned lineno); const char *filename, unsigned lineno);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj, JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj,
JSPrincipals *principals, const ch ar *name, JSPrincipals *principals, const ch ar *name,
unsigned nargs, const char **argna mes, unsigned nargs, const char **argna mes,
const jschar *chars, size_t length , const jschar *chars, size_t length ,
const char *filename, unsigned lin eno, const char *filename, unsigned lin eno,
JSVersion version); JSVersion version);
#ifdef __cplusplus
JS_END_EXTERN_C
namespace JS {
/* Options for JavaScript compilation. */
struct JS_PUBLIC_API(CompileOptions) {
JSPrincipals *principals;
JSPrincipals *originPrincipals;
JSVersion version;
bool versionSet;
bool utf8;
const char *filename;
unsigned lineno;
bool compileAndGo;
bool noScriptRval;
bool selfHostingMode;
enum SourcePolicy {
NO_SOURCE,
LAZY_SOURCE,
SAVE_SOURCE
} sourcePolicy;
explicit CompileOptions(JSContext *cx);
CompileOptions &setPrincipals(JSPrincipals *p) { principals = p; return
*this; }
CompileOptions &setOriginPrincipals(JSPrincipals *p) { originPrincipals
= p; return *this; }
CompileOptions &setVersion(JSVersion v) { version = v; versionSet = tru
e; return *this; }
CompileOptions &setUTF8(bool u) { utf8 = u; return *this; }
CompileOptions &setFileAndLine(const char *f, unsigned l) {
filename = f; lineno = l; return *this;
}
CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return
*this; }
CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return
*this; }
CompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; r
eturn *this; }
CompileOptions &setSourcePolicy(SourcePolicy sp) { sourcePolicy = sp; r
eturn *this; }
};
extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options,
const char *bytes, size_t length);
extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options,
const jschar *chars, size_t length);
extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, FILE *fi
le);
extern JS_PUBLIC_API(JSScript *)
Compile(JSContext *cx, JSHandleObject obj, CompileOptions options, const ch
ar *filename);
extern JS_PUBLIC_API(JSFunction *)
CompileFunction(JSContext *cx, JSHandleObject obj, CompileOptions options,
const char *name, unsigned nargs, const char **argnames,
const char *bytes, size_t length);
extern JS_PUBLIC_API(JSFunction *)
CompileFunction(JSContext *cx, JSHandleObject obj, CompileOptions options,
const char *name, unsigned nargs, const char **argnames,
const jschar *chars, size_t length);
} /* namespace JS */
JS_BEGIN_EXTERN_C
#endif /* __cplusplus */
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsig ned indent); JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsig ned indent);
/* /*
* API extension: OR this into indent to avoid pretty-printing the decompil ed * API extension: OR this into indent to avoid pretty-printing the decompil ed
* source resulting from JS_DecompileFunction{,Body}. * source resulting from JS_DecompileFunction{,Body}.
*/ */
#define JS_DONT_PRETTY_PRINT ((unsigned)0x8000) #define JS_DONT_PRETTY_PRINT ((unsigned)0x8000)
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
skipping to change at line 4628 skipping to change at line 5283
* value of principals is used as origin principals for the script. * value of principals is used as origin principals for the script.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_EvaluateUCScriptForPrincipalsVersionOrigin(JSContext *cx, JSObject *obj, JS_EvaluateUCScriptForPrincipalsVersionOrigin(JSContext *cx, JSObject *obj,
JSPrincipals *principals, JSPrincipals *principals,
JSPrincipals *originPrincipal s, JSPrincipals *originPrincipal s,
const jschar *chars, unsigned length, const jschar *chars, unsigned length,
const char *filename, unsigne d lineno, const char *filename, unsigne d lineno,
jsval *rval, JSVersion versio n); jsval *rval, JSVersion versio n);
#ifdef __cplusplus
JS_END_EXTERN_C
namespace JS {
extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options,
const jschar *chars, size_t length, jsval *rval);
extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options,
const char *bytes, size_t length, jsval *rval);
extern JS_PUBLIC_API(bool)
Evaluate(JSContext *cx, JSHandleObject obj, CompileOptions options,
const char *filename, jsval *rval);
} /* namespace JS */
JS_BEGIN_EXTERN_C
#endif
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_CallFunction(JSContext *cx, JSObject *obj, JSFunction *fun, unsigned arg c, JS_CallFunction(JSContext *cx, JSObject *obj, JSFunction *fun, unsigned arg c,
jsval *argv, jsval *rval); jsval *argv, jsval *rval);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_CallFunctionName(JSContext *cx, JSObject *obj, const char *name, unsigne d argc, JS_CallFunctionName(JSContext *cx, JSObject *obj, const char *name, unsigne d argc,
jsval *argv, jsval *rval); jsval *argv, jsval *rval);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval, unsigned arg c, JS_CallFunctionValue(JSContext *cx, JSObject *obj, jsval fval, unsigned arg c,
skipping to change at line 4753 skipping to change at line 5430
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_NewStringCopyN(JSContext *cx, const char *s, size_t n); JS_NewStringCopyN(JSContext *cx, const char *s, size_t n);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_NewStringCopyZ(JSContext *cx, const char *s); JS_NewStringCopyZ(JSContext *cx, const char *s);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_InternJSString(JSContext *cx, JSString *str); JS_InternJSString(JSContext *cx, JSString *str);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_InternStringN(JSContext *cx, const char *s, size_t length);
extern JS_PUBLIC_API(JSString *)
JS_InternString(JSContext *cx, const char *s); JS_InternString(JSContext *cx, const char *s);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_NewUCString(JSContext *cx, jschar *chars, size_t length); JS_NewUCString(JSContext *cx, jschar *chars, size_t length);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_NewUCStringCopyN(JSContext *cx, const jschar *s, size_t n); JS_NewUCStringCopyN(JSContext *cx, const jschar *s, size_t n);
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_NewUCStringCopyZ(JSContext *cx, const jschar *s); JS_NewUCStringCopyZ(JSContext *cx, const jschar *s);
skipping to change at line 5255 skipping to change at line 5935
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_ReportError(JSContext *cx, const char *format, ...); JS_ReportError(JSContext *cx, const char *format, ...);
/* /*
* Use an errorNumber to retrieve the format string, args are char * * Use an errorNumber to retrieve the format string, args are char *
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback, JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback,
void *userRef, const unsigned errorNumber, ...); void *userRef, const unsigned errorNumber, ...);
#ifdef va_start
extern JS_PUBLIC_API(void)
JS_ReportErrorNumberVA(JSContext *cx, JSErrorCallback errorCallback,
void *userRef, const unsigned errorNumber, va_list a
p);
#endif
/* /*
* Use an errorNumber to retrieve the format string, args are jschar * * Use an errorNumber to retrieve the format string, args are jschar *
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback, JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback,
void *userRef, const unsigned errorNumber, ...); void *userRef, const unsigned errorNumber, ...);
/* /*
* As above, but report a warning instead (JSREPORT_IS_WARNING(report.flags )). * As above, but report a warning instead (JSREPORT_IS_WARNING(report.flags )).
* Return true if there was no error trying to issue the warning, and if th e * Return true if there was no error trying to issue the warning, and if th e
skipping to change at line 5305 skipping to change at line 5991
JSPrincipals *originPrincipals; /* see 'originPrincipals' comment ab ove */ JSPrincipals *originPrincipals; /* see 'originPrincipals' comment ab ove */
unsigned lineno; /* source line number */ unsigned lineno; /* source line number */
const char *linebuf; /* offending source line without final \n */ const char *linebuf; /* offending source line without final \n */
const char *tokenptr; /* pointer to error token in linebuf */ const char *tokenptr; /* pointer to error token in linebuf */
const jschar *uclinebuf; /* unicode (original) line buffer */ const jschar *uclinebuf; /* unicode (original) line buffer */
const jschar *uctokenptr; /* unicode (original) token pointer */ const jschar *uctokenptr; /* unicode (original) token pointer */
unsigned flags; /* error/warning, etc. */ unsigned flags; /* error/warning, etc. */
unsigned errorNumber; /* the error number, e.g. see js.msg */ unsigned errorNumber; /* the error number, e.g. see js.msg */
const jschar *ucmessage; /* the (default) error message */ const jschar *ucmessage; /* the (default) error message */
const jschar **messageArgs; /* arguments for the error message */ const jschar **messageArgs; /* arguments for the error message */
int16_t exnType; /* One of the JSExnType constants */
unsigned column; /* zero-based column index in line *
/
}; };
/* /*
* JSErrorReport flag values. These may be freely composed. * JSErrorReport flag values. These may be freely composed.
*/ */
#define JSREPORT_ERROR 0x0 /* pseudo-flag for default case */ #define JSREPORT_ERROR 0x0 /* pseudo-flag for default case */
#define JSREPORT_WARNING 0x1 /* reported via JS_ReportWarning */ #define JSREPORT_WARNING 0x1 /* reported via JS_ReportWarning */
#define JSREPORT_EXCEPTION 0x2 /* exception was thrown */ #define JSREPORT_EXCEPTION 0x2 /* exception was thrown */
#define JSREPORT_STRICT 0x4 /* error or warning due to strict optio n */ #define JSREPORT_STRICT 0x4 /* error or warning due to strict optio n */
skipping to change at line 5358 skipping to change at line 6046
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec); JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewDateObjectMsec(JSContext *cx, double msec); JS_NewDateObjectMsec(JSContext *cx, double msec);
/* /*
* Infallible predicate to test whether obj is a date object. * Infallible predicate to test whether obj is a date object.
*/ */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_ObjectIsDate(JSContext *cx, JSObject *obj); JS_ObjectIsDate(JSContext *cx, JSRawObject obj);
/*
* Clears the cache of calculated local time from each Date object.
* Call to propagate a system timezone change.
*/
extern JS_PUBLIC_API(void)
JS_ClearDateCaches(JSContext *cx);
/************************************************************************/ /************************************************************************/
/* /*
* Regular Expressions. * Regular Expressions.
*/ */
#define JSREG_FOLD 0x01 /* fold uppercase to lowercase */ #define JSREG_FOLD 0x01 /* fold uppercase to lowercase */
#define JSREG_GLOB 0x02 /* global exec, creates array of matches */ #define JSREG_GLOB 0x02 /* global exec, creates array of matches */
#define JSREG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line * / #define JSREG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line * /
#define JSREG_STICKY 0x08 /* only match starting at lastIndex */ #define JSREG_STICKY 0x08 /* only match starting at lastIndex */
skipping to change at line 5553 skipping to change at line 6248
/* /*
* A constructor can request that the JS engine create a default new 'this' * A constructor can request that the JS engine create a default new 'this'
* object of the given class, using the callee to determine parentage and * object of the given class, using the callee to determine parentage and
* [[Prototype]]. * [[Prototype]].
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp); JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp);
/************************************************************************/ /************************************************************************/
#ifdef DEBUG
#define JS_GC_ZEAL 1
#endif
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
#define JS_DEFAULT_ZEAL_FREQ 100 #define JS_DEFAULT_ZEAL_FREQ 100
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency); JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_ScheduleGC(JSContext *cx, uint32_t count); JS_ScheduleGC(JSContext *cx, uint32_t count);
#endif #endif
skipping to change at line 5594 skipping to change at line 6285
JS_DescribeScriptedCaller(JSContext *cx, JSScript **script, unsigned *linen o); JS_DescribeScriptedCaller(JSContext *cx, JSScript **script, unsigned *linen o);
/* /*
* Encode/Decode interpreted scripts and functions to/from memory. * Encode/Decode interpreted scripts and functions to/from memory.
*/ */
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_EncodeScript(JSContext *cx, JSScript *script, uint32_t *lengthp); JS_EncodeScript(JSContext *cx, JSScript *script, uint32_t *lengthp);
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_EncodeInterpretedFunction(JSContext *cx, JSObject *funobj, uint32_t *len gthp); JS_EncodeInterpretedFunction(JSContext *cx, JSRawObject funobj, uint32_t *l engthp);
extern JS_PUBLIC_API(JSScript *) extern JS_PUBLIC_API(JSScript *)
JS_DecodeScript(JSContext *cx, const void *data, uint32_t length, JS_DecodeScript(JSContext *cx, const void *data, uint32_t length,
JSPrincipals *principals, JSPrincipals *originPrincipals); JSPrincipals *principals, JSPrincipals *originPrincipals);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t leng th, JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t leng th,
JSPrincipals *principals, JSPrincipals *origin Principals); JSPrincipals *principals, JSPrincipals *origin Principals);
JS_END_EXTERN_C JS_END_EXTERN_C
 End of changes. 149 change blocks. 
346 lines changed or deleted 1072 lines changed or added


 jsatom.h   jsatom.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsatom_h___ #ifndef jsatom_h___
#define jsatom_h___ #define jsatom_h___
#include <stddef.h> #include <stddef.h>
#include "jsversion.h" #include "jsversion.h"
#include "jsalloc.h" #include "jsalloc.h"
#include "jsapi.h" #include "jsapi.h"
#include "jsprvtd.h" #include "jsprvtd.h"
#include "jshash.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jslock.h" #include "jslock.h"
#include "gc/Barrier.h" #include "gc/Barrier.h"
#include "js/HashTable.h" #include "js/HashTable.h"
#include "mozilla/HashFunctions.h"
struct JSIdArray { struct JSIdArray {
int length; int length;
js::HeapId vector[1]; /* actually, length jsid words */ js::HeapId vector[1]; /* actually, length jsid words */
}; };
/* Engine-internal extensions of jsid */ /* Engine-internal extensions of jsid */
static JS_ALWAYS_INLINE jsid static JS_ALWAYS_INLINE jsid
JSID_FROM_BITS(size_t bits) JSID_FROM_BITS(size_t bits)
{ {
jsid id; jsid id;
JSID_BITS(id) = bits; JSID_BITS(id) = bits;
return id; return id;
} }
/*
* Must not be used on atoms that are representable as integer jsids.
* Prefer NameToId or AtomToId over this function:
*
* A PropertyName is an atom that does not contain an integer in the range
* [0, UINT32_MAX]. However, jsid can only hold an integer in the range
* [0, JSID_INT_MAX] (where JSID_INT_MAX == 2^31-1). Thus, for the range o
f
* integers (JSID_INT_MAX, UINT32_MAX], to represent as a jsid 'id', it mus
t be
* the case JSID_IS_ATOM(id) and !JSID_TO_ATOM(id)->isPropertyName(). In m
ost
* cases when creating a jsid, code does not have to care about this corner
* case because:
*
* - When given an arbitrary JSAtom*, AtomToId must be used, which checks f
or
* integer atoms representable as integer jsids, and does this conversion
.
*
* - When given a PropertyName*, NameToId can be used which which does not
need
* to do any dynamic checks.
*
* Thus, it is only the rare third case which needs this function, which
* handles any JSAtom* that is known not to be representable with an int js
id.
*/
static JS_ALWAYS_INLINE jsid static JS_ALWAYS_INLINE jsid
ATOM_TO_JSID(JSAtom *atom) NON_INTEGER_ATOM_TO_JSID(JSAtom *atom)
{ {
JS_ASSERT(((size_t)atom & 0x7) == 0); JS_ASSERT(((size_t)atom & 0x7) == 0);
return JSID_FROM_BITS((size_t)atom); jsid id = JSID_FROM_BITS((size_t)atom);
JS_ASSERT(id == INTERNED_STRING_TO_JSID(NULL, (JSString*)atom));
return id;
} }
/* All strings stored in jsids are atomized. */ /* All strings stored in jsids are atomized, but are not necessarily proper ty names. */
static JS_ALWAYS_INLINE JSBool static JS_ALWAYS_INLINE JSBool
JSID_IS_ATOM(jsid id) JSID_IS_ATOM(jsid id)
{ {
return JSID_IS_STRING(id); return JSID_IS_STRING(id);
} }
static JS_ALWAYS_INLINE JSBool static JS_ALWAYS_INLINE JSBool
JSID_IS_ATOM(jsid id, JSAtom *atom) JSID_IS_ATOM(jsid id, JSAtom *atom)
{ {
return JSID_BITS(id) == JSID_BITS(ATOM_TO_JSID(atom)); return id == JSID_FROM_BITS((size_t)atom);
} }
static JS_ALWAYS_INLINE JSAtom * static JS_ALWAYS_INLINE JSAtom *
JSID_TO_ATOM(jsid id) JSID_TO_ATOM(jsid id)
{ {
return (JSAtom *)JSID_TO_STRING(id); return (JSAtom *)JSID_TO_STRING(id);
} }
extern jsid JS_STATIC_ASSERT(sizeof(js::HashNumber) == 4);
js_CheckForStringIndex(jsid id);
JS_STATIC_ASSERT(sizeof(JSHashNumber) == 4);
JS_STATIC_ASSERT(sizeof(jsid) == JS_BYTES_PER_WORD); JS_STATIC_ASSERT(sizeof(jsid) == JS_BYTES_PER_WORD);
namespace js { namespace js {
static JS_ALWAYS_INLINE JSHashNumber static JS_ALWAYS_INLINE js::HashNumber
HashId(jsid id) HashId(jsid id)
{ {
JS_ASSERT(js_CheckForStringIndex(id) == id); return HashGeneric(JSID_BITS(id));
JSHashNumber n =
#if JS_BYTES_PER_WORD == 4
JSHashNumber(JSID_BITS(id));
#elif JS_BYTES_PER_WORD == 8
JSHashNumber(JSID_BITS(id)) ^ JSHashNumber(JSID_BITS(id) >> 32);
#else
# error "Unsupported configuration"
#endif
return n * JS_GOLDEN_RATIO;
} }
static JS_ALWAYS_INLINE Value static JS_ALWAYS_INLINE Value
IdToValue(jsid id) IdToValue(jsid id)
{ {
if (JSID_IS_STRING(id)) if (JSID_IS_STRING(id))
return StringValue(JSID_TO_STRING(id)); return StringValue(JSID_TO_STRING(id));
if (JS_LIKELY(JSID_IS_INT(id))) if (JS_LIKELY(JSID_IS_INT(id)))
return Int32Value(JSID_TO_INT(id)); return Int32Value(JSID_TO_INT(id));
if (JS_LIKELY(JSID_IS_OBJECT(id))) if (JS_LIKELY(JSID_IS_OBJECT(id)))
skipping to change at line 143 skipping to change at line 121
IdToJsval(jsid id) IdToJsval(jsid id)
{ {
return IdToValue(id); return IdToValue(id);
} }
template<> template<>
struct DefaultHasher<jsid> struct DefaultHasher<jsid>
{ {
typedef jsid Lookup; typedef jsid Lookup;
static HashNumber hash(const Lookup &l) { static HashNumber hash(const Lookup &l) {
JS_ASSERT(l == js_CheckForStringIndex(l));
return HashNumber(JSID_BITS(l)); return HashNumber(JSID_BITS(l));
} }
static bool match(const jsid &id, const Lookup &l) { static bool match(const jsid &id, const Lookup &l) {
JS_ASSERT(l == js_CheckForStringIndex(l));
return id == l; return id == l;
} }
}; };
} }
#if JS_BYTES_PER_WORD == 4
# define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2)
#elif JS_BYTES_PER_WORD == 8
# define ATOM_HASH(atom) (((JSHashNumber)(uintptr_t)(atom) >> 3) ^
\
(JSHashNumber)((uintptr_t)(atom) >> 32))
#else
# error "Unsupported configuration"
#endif
/* /*
* Return a printable, lossless char[] representation of a string-type atom . * Return a printable, lossless char[] representation of a string-type atom .
* The lifetime of the result matches the lifetime of bytes. * The lifetime of the result matches the lifetime of bytes.
*/ */
extern const char * extern const char *
js_AtomToPrintableString(JSContext *cx, JSAtom *atom, JSAutoByteString *byt es); js_AtomToPrintableString(JSContext *cx, JSAtom *atom, JSAutoByteString *byt es);
namespace js { namespace js {
/* Compute a hash function from chars/length. */ /* Compute a hash function from chars/length. */
skipping to change at line 294 skipping to change at line 261
/* Various built-in or commonly-used atoms, pinned on first context. */ /* Various built-in or commonly-used atoms, pinned on first context. */
#define DEFINE_ATOM(id, text) js::PropertyName *id##Atom; #define DEFINE_ATOM(id, text) js::PropertyName *id##Atom;
#define DEFINE_PROTOTYPE_ATOM(id) js::PropertyName *id##Atom; #define DEFINE_PROTOTYPE_ATOM(id) js::PropertyName *id##Atom;
#define DEFINE_KEYWORD_ATOM(id) js::PropertyName *id##Atom; #define DEFINE_KEYWORD_ATOM(id) js::PropertyName *id##Atom;
#include "jsatom.tbl" #include "jsatom.tbl"
#undef DEFINE_ATOM #undef DEFINE_ATOM
#undef DEFINE_PROTOTYPE_ATOM #undef DEFINE_PROTOTYPE_ATOM
#undef DEFINE_KEYWORD_ATOM #undef DEFINE_KEYWORD_ATOM
/* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass
. */
struct {
js::PropertyName *XMLListAtom;
js::PropertyName *decodeURIAtom;
js::PropertyName *decodeURIComponentAtom;
js::PropertyName *defineGetterAtom;
js::PropertyName *defineSetterAtom;
js::PropertyName *encodeURIAtom;
js::PropertyName *encodeURIComponentAtom;
js::PropertyName *escapeAtom;
js::PropertyName *hasOwnPropertyAtom;
js::PropertyName *isFiniteAtom;
js::PropertyName *isNaNAtom;
js::PropertyName *isPrototypeOfAtom;
js::PropertyName *isXMLNameAtom;
js::PropertyName *lookupGetterAtom;
js::PropertyName *lookupSetterAtom;
js::PropertyName *parseFloatAtom;
js::PropertyName *parseIntAtom;
js::PropertyName *propertyIsEnumerableAtom;
js::PropertyName *unescapeAtom;
js::PropertyName *unevalAtom;
js::PropertyName *unwatchAtom;
js::PropertyName *watchAtom;
} lazy;
static const size_t commonAtomsOffset; static const size_t commonAtomsOffset;
static const size_t lazyAtomsOffset;
void clearLazyAtoms() {
memset(&lazy, 0, sizeof(lazy));
}
void junkAtoms() { void junkAtoms() {
#ifdef DEBUG #ifdef DEBUG
memset(commonAtomsStart(), JS_FREE_PATTERN, sizeof(*this) - commonA tomsOffset); memset(commonAtomsStart(), JS_FREE_PATTERN, sizeof(*this) - commonA tomsOffset);
#endif #endif
} }
JSAtom **commonAtomsStart() { JSAtom **commonAtomsStart() {
return reinterpret_cast<JSAtom **>(&emptyAtom); return reinterpret_cast<JSAtom **>(&emptyAtom);
} }
void checkStaticInvariants(); void checkStaticInvariants();
}; };
extern bool extern bool
AtomIsInterned(JSContext *cx, JSAtom *atom); AtomIsInterned(JSContext *cx, JSAtom *atom);
#define ATOM(name) cx->runtime->atomState.name##Atom #define ATOM(name) js::HandlePropertyName::fromMarkedLocation(&cx->runtime- >atomState.name##Atom)
#define COMMON_ATOM_INDEX(name) \ #define COMMON_ATOM_INDEX(name) \
((offsetof(JSAtomState, name##Atom) - JSAtomState::commonAtomsOffset) \ ((offsetof(JSAtomState, name##Atom) - JSAtomState::commonAtomsOffset) \
/ sizeof(JSAtom*)) / sizeof(JSAtom*))
#define COMMON_TYPE_ATOM_INDEX(type) \ #define COMMON_TYPE_ATOM_INDEX(type) \
((offsetof(JSAtomState, typeAtoms[type]) - JSAtomState::commonAtomsOffs et)\ ((offsetof(JSAtomState, typeAtoms[type]) - JSAtomState::commonAtomsOffs et)\
/ sizeof(JSAtom*)) / sizeof(JSAtom*))
#define ATOM_OFFSET(name) offsetof(JSAtomState, name##Atom) #define NAME_OFFSET(name) offsetof(JSAtomState, name##Atom)
#define OFFSET_TO_ATOM(rt,off) (*(JSAtom **)((char*)&(rt)->atomState + (of #define OFFSET_TO_NAME(rt,off) (*(js::PropertyName **)((char*)&(rt)->atomS
f))) tate + (off)))
#define CLASS_ATOM_OFFSET(name) offsetof(JSAtomState, classAtoms[JSProto_## #define CLASS_NAME_OFFSET(name) offsetof(JSAtomState, classAtoms[JSProto_##
name]) name])
#define CLASS_ATOM(cx,name) ((cx)->runtime->atomState.classAtoms[JSProt #define CLASS_NAME(cx,name) ((cx)->runtime->atomState.classAtoms[JSProt
o_##name]) o_##name])
extern const char *const js_common_atom_names[]; extern const char *const js_common_atom_names[];
extern const size_t js_common_atom_count; extern const size_t js_common_atom_count;
/* /*
* Macros to access C strings for JSType and boolean literals. * Macros to access C strings for JSType and boolean literals.
*/ */
#define JS_BOOLEAN_STR(type) (js_common_atom_names[1 + (type)]) #define JS_BOOLEAN_STR(type) (js_common_atom_names[1 + (type)])
#define JS_TYPE_STR(type) (js_common_atom_names[1 + 2 + (type)]) #define JS_TYPE_STR(type) (js_common_atom_names[1 + 2 + (type)])
skipping to change at line 392 skipping to change at line 328
#if JS_HAS_GENERATORS #if JS_HAS_GENERATORS
extern const char js_close_str[]; extern const char js_close_str[];
extern const char js_send_str[]; extern const char js_send_str[];
#endif #endif
/* Constant strings that are not atomized. */ /* Constant strings that are not atomized. */
extern const char js_getter_str[]; extern const char js_getter_str[];
extern const char js_setter_str[]; extern const char js_setter_str[];
namespace js {
/* /*
* Initialize atom state. Return true on success, false on failure to alloc ate * Initialize atom state. Return true on success, false on failure to alloc ate
* memory. The caller must zero rt->atomState before calling this function and * memory. The caller must zero rt->atomState before calling this function and
* only call it after js_InitGC successfully returns. * only call it after js_InitGC successfully returns.
*/ */
extern JSBool extern JSBool
js_InitAtomState(JSRuntime *rt); InitAtomState(JSRuntime *rt);
/* /*
* Free and clear atom state including any interned string atoms. This * Free and clear atom state including any interned string atoms. This
* function must be called before js_FinishGC. * function must be called before js_FinishGC.
*/ */
extern void extern void
js_FinishAtomState(JSRuntime *rt); FinishAtomState(JSRuntime *rt);
/* /*
* Atom tracing and garbage collection hooks. * Atom tracing and garbage collection hooks.
*/ */
namespace js {
extern void extern void
MarkAtomState(JSTracer *trc, bool markAll); MarkAtomState(JSTracer *trc);
extern void extern void
SweepAtomState(JSRuntime *rt); SweepAtomState(JSRuntime *rt);
extern bool extern bool
InitCommonAtoms(JSContext *cx); InitCommonAtoms(JSContext *cx);
extern void extern void
FinishCommonAtoms(JSRuntime *rt); FinishCommonAtoms(JSRuntime *rt);
/* N.B. must correspond to boolean tagging behavior. */ /* N.B. must correspond to boolean tagging behavior. */
enum InternBehavior enum InternBehavior
{ {
DoNotInternAtom = false, DoNotInternAtom = false,
InternAtom = true InternAtom = true
}; };
} /* namespace js */
extern JSAtom * extern JSAtom *
js_Atomize(JSContext *cx, const char *bytes, size_t length, Atomize(JSContext *cx, const char *bytes, size_t length,
js::InternBehavior ib = js::DoNotInternAtom, js::InternBehavior ib = js::DoNotInternAtom,
js::FlationCoding fc = js::NormalEncoding); js::FlationCoding fc = js::NormalEncoding);
extern JSAtom * extern JSAtom *
js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, AtomizeChars(JSContext *cx, const jschar *chars, size_t length,
js::InternBehavior ib = js::DoNotInternAtom); js::InternBehavior ib = js::DoNotInternAtom);
extern JSAtom * extern JSAtom *
js_AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js:: AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoN
DoNotInternAtom); otInternAtom);
/*
* Return an existing atom for the given char array or null if the char
* sequence is currently not atomized.
*/
extern JSAtom *
js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length)
;
#ifdef DEBUG
extern JS_FRIEND_API(void)
js_DumpAtoms(JSContext *cx, FILE *fp);
#endif
inline bool inline JSAtom *
js_ValueToAtom(JSContext *cx, const js::Value &v, JSAtom **atomp); ToAtom(JSContext *cx, const js::Value &v);
inline bool bool
js_ValueToStringId(JSContext *cx, const js::Value &v, jsid *idp); InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval,
jsid *idp, MutableHandleValue vp);
inline bool inline bool
js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, jsi
al, d *idp)
jsid *idp); {
inline bool RootedValue dummy(cx);
js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv return InternNonIntElementId(cx, obj, idval, idp, &dummy);
al, }
jsid *idp, js::Value *vp);
namespace js {
/*
* For all unmapped atoms recorded in al, add a mapping from the atom's ind
ex
* to its address. map->length must already be set to the number of atoms i
n
* the list and map->vector must point to pre-allocated memory.
*/
extern void
InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtrAtom *atoms);
template<XDRMode mode> template<XDRMode mode>
bool bool
XDRAtom(XDRState<mode> *xdr, JSAtom **atomp); XDRAtom(XDRState<mode> *xdr, JSAtom **atomp);
} /* namespace js */ } /* namespace js */
#endif /* jsatom_h___ */ #endif /* jsatom_h___ */
 End of changes. 30 change blocks. 
170 lines changed or deleted 72 lines changed or added


 jsclass.h   jsclass.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=4 sw=4 et tw=79 ft=cpp: * vim: set ts=4 sw=4 et tw=79 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey JavaScript engine.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsclass_h__ #ifndef jsclass_h__
#define jsclass_h__ #define jsclass_h__
/* /*
* A JSClass acts as a vtable for JS objects that allows JSAPI clients to * A JSClass acts as a vtable for JS objects that allows JSAPI clients to
* control various aspects of the behavior of an object like property looku p. * control various aspects of the behavior of an object like property looku p.
* js::Class is an engine-private extension that allows more control over * js::Class is an engine-private extension that allows more control over
* object behavior and, e.g., allows custom slow layout. * object behavior and, e.g., allows custom slow layout.
*/ */
#include "jsapi.h" #include "jsapi.h"
#include "jsprvtd.h" #include "jsprvtd.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace js { namespace js {
class PropertyName; class PropertyName;
class SpecialId; class SpecialId;
class PropertyId;
static JS_ALWAYS_INLINE jsid static JS_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid); SPECIALID_TO_JSID(const SpecialId &sid);
/* /*
* We partition the ways to refer to a property into three: by an index * We partition the ways to refer to a property into three: by an index
* (uint32_t); by a string whose characters do not represent an index * (uint32_t); by a string whose characters do not represent an index
* (PropertyName, see vm/String.h); and by various special values. * (PropertyName, see vm/String.h); and by various special values.
* *
* Special values are encoded using SpecialId, which is layout-compatible b ut * Special values are encoded using SpecialId, which is layout-compatible b ut
* non-interconvertible with jsid. A SpecialId may be: an object (used by E4X * non-interconvertible with jsid. A SpecialId may be: an object (used by E4X
* and perhaps eventually by Harmony-proposed private names); JSID_VOID, wh ich * and perhaps eventually by Harmony-proposed private names); JSID_VOID, wh ich
* does not occur in JS scripts but may be used to indicate the absence of a * does not occur in JS scripts but may be used to indicate the absence of a
* valid identifier; or JS_DEFAULT_XML_NAMESPACE_ID, if E4X is enabled. * valid identifier; or JS_DEFAULT_XML_NAMESPACE_ID, if E4X is enabled.
*/ */
class SpecialId
class SpecialId { {
uintptr_t bits; uintptr_t bits;
/* Needs access to raw bits. */ /* Needs access to raw bits. */
friend JS_ALWAYS_INLINE jsid SPECIALID_TO_JSID(const SpecialId &sid); friend JS_ALWAYS_INLINE jsid SPECIALID_TO_JSID(const SpecialId &sid);
friend class PropertyId;
static const uintptr_t TYPE_VOID = JSID_TYPE_VOID; static const uintptr_t TYPE_VOID = JSID_TYPE_VOID;
static const uintptr_t TYPE_OBJECT = JSID_TYPE_OBJECT; static const uintptr_t TYPE_OBJECT = JSID_TYPE_OBJECT;
static const uintptr_t TYPE_DEFAULT_XML_NAMESPACE = JSID_TYPE_DEFAULT_X ML_NAMESPACE; static const uintptr_t TYPE_DEFAULT_XML_NAMESPACE = JSID_TYPE_DEFAULT_X ML_NAMESPACE;
static const uintptr_t TYPE_MASK = JSID_TYPE_MASK; static const uintptr_t TYPE_MASK = JSID_TYPE_MASK;
SpecialId(uintptr_t bits) : bits(bits) { } SpecialId(uintptr_t bits) : bits(bits) { }
public: public:
SpecialId() : bits(TYPE_VOID) { } SpecialId() : bits(TYPE_VOID) { }
skipping to change at line 177 skipping to change at line 147
if (JSID_IS_OBJECT(id)) if (JSID_IS_OBJECT(id))
return SpecialId(*JSID_TO_OBJECT(id)); return SpecialId(*JSID_TO_OBJECT(id));
if (JSID_IS_EMPTY(id)) if (JSID_IS_EMPTY(id))
return SpecialId::empty(); return SpecialId::empty();
if (JSID_IS_VOID(id)) if (JSID_IS_VOID(id))
return SpecialId::voidId(); return SpecialId::voidId();
JS_ASSERT(JSID_IS_DEFAULT_XML_NAMESPACE(id)); JS_ASSERT(JSID_IS_DEFAULT_XML_NAMESPACE(id));
return SpecialId::defaultXMLNamespace(); return SpecialId::defaultXMLNamespace();
} }
typedef JS::Handle<SpecialId> HandleSpecialId;
/* js::Class operation signatures. */ /* js::Class operation signatures. */
typedef JSBool typedef JSBool
(* LookupGenericOp)(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, (* LookupGenericOp)(JSContext *cx, HandleObject obj, HandleId id,
JSProperty **propp); MutableHandleObject objp, MutableHandleShape propp);
typedef JSBool typedef JSBool
(* LookupPropOp)(JSContext *cx, JSObject *obj, PropertyName *name, JSObject (* LookupPropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name,
**objp, MutableHandleObject objp, MutableHandleShape propp);
JSProperty **propp);
typedef JSBool typedef JSBool
(* LookupElementOp)(JSContext *cx, JSObject *obj, uint32_t index, JSObject (* LookupElementOp)(JSContext *cx, HandleObject obj, uint32_t index,
**objp, MutableHandleObject objp, MutableHandleShape propp);
JSProperty **propp);
typedef JSBool typedef JSBool
(* LookupSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, JSObject * (* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid,
*objp, MutableHandleObject objp, MutableHandleShape propp);
JSProperty **propp);
typedef JSBool typedef JSBool
(* DefineGenericOp)(JSContext *cx, JSObject *obj, jsid id, const Value *val ue, (* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, HandleVal ue value,
PropertyOp getter, StrictPropertyOp setter, unsigned at trs); PropertyOp getter, StrictPropertyOp setter, unsigned at trs);
typedef JSBool typedef JSBool
(* DefinePropOp)(JSContext *cx, JSObject *obj, PropertyName *name, const Va lue *value, (* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs ); PropertyOp getter, StrictPropertyOp setter, unsigned attrs );
typedef JSBool typedef JSBool
(* DefineElementOp)(JSContext *cx, JSObject *obj, uint32_t index, const Val ue *value, (* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, Handle Value value,
PropertyOp getter, StrictPropertyOp setter, unsigned at trs); PropertyOp getter, StrictPropertyOp setter, unsigned at trs);
typedef JSBool typedef JSBool
(* DefineSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, const Valu e *value, (* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, H andleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned at trs); PropertyOp getter, StrictPropertyOp setter, unsigned at trs);
typedef JSBool typedef JSBool
(* GenericIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp); (* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, Han dleId id, MutableHandleValue vp);
typedef JSBool typedef JSBool
(* PropertyIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, Property Name *name, Value *vp); (* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, Ha ndlePropertyName name, MutableHandleValue vp);
typedef JSBool typedef JSBool
(* ElementIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp); (* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uin t32_t index, MutableHandleValue vp);
typedef JSBool typedef JSBool
(* ElementIfPresentOp)(JSContext *cx, JSObject *obj, JSObject *receiver, ui nt32_t index, Value *vp, bool* present); (* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiv er, uint32_t index, MutableHandleValue vp, bool* present);
typedef JSBool typedef JSBool
(* SpecialIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp); (* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, Han dleSpecialId sid, MutableHandleValue vp);
typedef JSBool typedef JSBool
(* StrictGenericIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSB ool strict); (* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, Mutable HandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* StrictPropertyIdOp)(JSContext *cx, JSObject *obj, PropertyName *name, Va lue *vp, JSBool strict); (* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* StrictElementIdOp)(JSContext *cx, JSObject *obj, uint32_t index, Value * vp, JSBool strict); (* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, Muta bleHandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* StrictSpecialIdOp)(JSContext *cx, JSObject *obj, SpecialId sid, Value *v p, JSBool strict); (* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* GenericAttributesOp)(JSContext *cx, JSObject *obj, jsid id, unsigned *at trsp); (* GenericAttributesOp)(JSContext *cx, HandleObject obj, HandleId id, unsig ned *attrsp);
typedef JSBool typedef JSBool
(* PropertyAttributesOp)(JSContext *cx, JSObject *obj, PropertyName *name, unsigned *attrsp); (* PropertyAttributesOp)(JSContext *cx, HandleObject obj, HandlePropertyNam e name, unsigned *attrsp);
typedef JSBool typedef JSBool
(* ElementAttributesOp)(JSContext *cx, JSObject *obj, uint32_t index, unsig ned *attrsp); (* ElementAttributesOp)(JSContext *cx, HandleObject obj, uint32_t index, un signed *attrsp);
typedef JSBool typedef JSBool
(* SpecialAttributesOp)(JSContext *cx, JSObject *obj, SpecialId sid, unsign ed *attrsp); (* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId si d, unsigned *attrsp);
typedef JSBool typedef JSBool
(* DeletePropertyOp)(JSContext *cx, JSObject *obj, PropertyName *name, Valu e *vp, JSBool strict); (* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName na me, MutableHandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* DeleteElementOp)(JSContext *cx, JSObject *obj, uint32_t index, Value *vp , JSBool strict); (* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, Mutabl eHandleValue vp, JSBool strict);
typedef JSBool typedef JSBool
(* DeleteSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict); (* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, M utableHandleValue vp, JSBool strict);
typedef JSType typedef JSType
(* TypeOfOp)(JSContext *cx, JSObject *obj); (* TypeOfOp)(JSContext *cx, HandleObject obj);
/*
* Prepare to make |obj| non-extensible; in particular, fully resolve its p
roperties.
* On error, return false.
* If |obj| is now ready to become non-extensible, set |*fixed| to true and
return true.
* If |obj| refuses to become non-extensible, set |*fixed| to false and ret
urn true; the
* caller will throw an appropriate error.
*/
typedef JSBool
(* FixOp)(JSContext *cx, JSObject *obj, bool *fixed, AutoIdVector *props);
typedef JSObject * typedef JSObject *
(* ObjectOp)(JSContext *cx, JSObject *obj); (* ObjectOp)(JSContext *cx, HandleObject obj);
typedef void typedef void
(* FinalizeOp)(FreeOp *fop, JSObject *obj); (* ClearOp)(JSContext *cx, HandleObject obj);
typedef void typedef void
(* ClearOp)(JSContext *cx, JSObject *obj); (* FinalizeOp)(FreeOp *fop, JSObject *obj);
#define JS_CLASS_MEMBERS \ #define JS_CLASS_MEMBERS \
const char *name; \ const char *name; \
uint32_t flags; \ uint32_t flags; \
\ \
/* Mandatory non-null function pointer members. */ \ /* Mandatory non-null function pointer members. */ \
JSPropertyOp addProperty; \ JSPropertyOp addProperty; \
JSPropertyOp delProperty; \ JSPropertyOp delProperty; \
JSPropertyOp getProperty; \ JSPropertyOp getProperty; \
JSStrictPropertyOp setProperty; \ JSStrictPropertyOp setProperty; \
JSEnumerateOp enumerate; \ JSEnumerateOp enumerate; \
JSResolveOp resolve; \ JSResolveOp resolve; \
JSConvertOp convert; \ JSConvertOp convert; \
FinalizeOp finalize; \ FinalizeOp finalize; \
\ \
/* Optionally non-null members start here. */ \ /* Optionally non-null members start here. */ \
JSCheckAccessOp checkAccess; \ JSCheckAccessOp checkAccess; \
JSNative call; \ JSNative call; \
JSNative construct; \
JSHasInstanceOp hasInstance; \ JSHasInstanceOp hasInstance; \
JSNative construct; \
JSTraceOp trace JSTraceOp trace
/* /*
* The helper struct to measure the size of JS_CLASS_MEMBERS to know how mu ch * The helper struct to measure the size of JS_CLASS_MEMBERS to know how mu ch
* we have to padd js::Class to match the size of JSClass; * we have to padd js::Class to match the size of JSClass;
*/ */
struct ClassSizeMeasurement struct ClassSizeMeasurement
{ {
JS_CLASS_MEMBERS; JS_CLASS_MEMBERS;
}; };
skipping to change at line 298 skipping to change at line 260
JSObjectOp outerObject; JSObjectOp outerObject;
JSObjectOp innerObject; JSObjectOp innerObject;
JSIteratorOp iteratorObject; JSIteratorOp iteratorObject;
void *unused; void *unused;
/* /*
* isWrappedNative is true only if the class is an XPCWrappedNative. * isWrappedNative is true only if the class is an XPCWrappedNative.
* WeakMaps use this to override the wrapper disposal optimization. * WeakMaps use this to override the wrapper disposal optimization.
*/ */
bool isWrappedNative; bool isWrappedNative;
/*
* If an object is used as a key in a weakmap, it may be desirable for
the
* garbage collector to keep that object around longer than it otherwis
e
* would. A common case is when the key is a wrapper around an object i
n
* another compartment, and we want to avoid collecting the wrapper (an
d
* removing the weakmap entry) as long as the wrapped object is alive.
In
* that case, the wrapped object is returned by the wrapper's
* weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakm
ap
* key, it will not be collected (and remain in the weakmap) until the
* wrapped object is collected.
*/
JSWeakmapKeyDelegateOp weakmapKeyDelegateOp;
}; };
#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false} #define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false,NULL}
struct ObjectOps struct ObjectOps
{ {
LookupGenericOp lookupGeneric; LookupGenericOp lookupGeneric;
LookupPropOp lookupProperty; LookupPropOp lookupProperty;
LookupElementOp lookupElement; LookupElementOp lookupElement;
LookupSpecialOp lookupSpecial; LookupSpecialOp lookupSpecial;
DefineGenericOp defineGeneric; DefineGenericOp defineGeneric;
DefinePropOp defineProperty; DefinePropOp defineProperty;
DefineElementOp defineElement; DefineElementOp defineElement;
skipping to change at line 335 skipping to change at line 310
GenericAttributesOp setGenericAttributes; GenericAttributesOp setGenericAttributes;
PropertyAttributesOp setPropertyAttributes; PropertyAttributesOp setPropertyAttributes;
ElementAttributesOp setElementAttributes; ElementAttributesOp setElementAttributes;
SpecialAttributesOp setSpecialAttributes; SpecialAttributesOp setSpecialAttributes;
DeletePropertyOp deleteProperty; DeletePropertyOp deleteProperty;
DeleteElementOp deleteElement; DeleteElementOp deleteElement;
DeleteSpecialOp deleteSpecial; DeleteSpecialOp deleteSpecial;
JSNewEnumerateOp enumerate; JSNewEnumerateOp enumerate;
TypeOfOp typeOf; TypeOfOp typeOf;
FixOp fix;
ObjectOp thisObject; ObjectOp thisObject;
ClearOp clear; ClearOp clear;
}; };
#define JS_NULL_OBJECT_OPS \ #define JS_NULL_OBJECT_OPS \
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \
NULL,NULL,NULL,NULL,NULL,NULL} NULL,NULL,NULL,NULL,NULL}
struct Class struct Class
{ {
JS_CLASS_MEMBERS; JS_CLASS_MEMBERS;
ClassExtension ext; ClassExtension ext;
ObjectOps ops; ObjectOps ops;
uint8_t pad[sizeof(JSClass) - sizeof(ClassSizeMeasurement) - uint8_t pad[sizeof(JSClass) - sizeof(ClassSizeMeasurement) -
sizeof(ClassExtension) - sizeof(ObjectOps)]; sizeof(ClassExtension) - sizeof(ObjectOps)];
/* Class is not native and its map is not a scope. */ /* Class is not native and its map is not a scope. */
skipping to change at line 409 skipping to change at line 383
Valueify(const JSClass *c) Valueify(const JSClass *c)
{ {
return (const Class *)c; return (const Class *)c;
} }
/* /*
* Enumeration describing possible values of the [[Class]] internal propert y * Enumeration describing possible values of the [[Class]] internal propert y
* value of objects. * value of objects.
*/ */
enum ESClassValue { enum ESClassValue {
ESClass_Array, ESClass_Number, ESClass_String, ESClass_Boolean, ESClass ESClass_Array, ESClass_Number, ESClass_String, ESClass_Boolean,
_RegExp ESClass_RegExp, ESClass_ArrayBuffer
}; };
/* /*
* Return whether the given object has the given [[Class]] internal propert y * Return whether the given object has the given [[Class]] internal propert y
* value. Beware, this query says nothing about the js::Class of the JSObje ct * value. Beware, this query says nothing about the js::Class of the JSObje ct
* so the caller must not assume anything about obj's representation (e.g., obj * so the caller must not assume anything about obj's representation (e.g., obj
* may be a proxy). * may be a proxy).
*/ */
inline bool inline bool
ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx); ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx);
/* Just a helper that checks v.isObject before calling ObjectClassIs. */ /* Just a helper that checks v.isObject before calling ObjectClassIs. */
inline bool inline bool
IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx); IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx);
} /* namespace js */ } /* namespace js */
namespace JS {
inline bool
IsPoisonedSpecialId(js::SpecialId iden)
{
if (iden.isObject())
return IsPoisonedPtr(iden.toObject());
return false;
}
template <> struct RootMethods<js::SpecialId>
{
static js::SpecialId initial() { return js::SpecialId(); }
static ThingRootKind kind() { return THING_ROOT_ID; }
static bool poisoned(js::SpecialId id) { return IsPoisonedSpecialId(id)
; }
};
} /* namespace JS */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* jsclass_h__ */ #endif /* jsclass_h__ */
 End of changes. 41 change blocks. 
99 lines changed or deleted 85 lines changed or added


 jsclist.h   jsclist.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsclist_h___ #ifndef jsclist_h___
#define jsclist_h___ #define jsclist_h___
#include "jstypes.h" #include "jstypes.h"
/* /*
** Circular linked list ** Circular linked list
*/ */
typedef struct JSCListStr { typedef struct JSCListStr {
 End of changes. 1 change blocks. 
45 lines changed or deleted 3 lines changed or added


 jscpucfg.h   jscpucfg.h 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef js_cpucfg___ #ifndef js_cpucfg___
#define js_cpucfg___ #define js_cpucfg___
#define JS_HAVE_LONG_LONG #define JS_HAVE_LONG_LONG
#if defined(_WIN64) #if defined(_WIN64)
# if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_) # if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)
# define IS_LITTLE_ENDIAN 1 # define IS_LITTLE_ENDIAN 1
 End of changes. 1 change blocks. 
45 lines changed or deleted 3 lines changed or added


 jsdbgapi.h   jsdbgapi.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=8 sw=4 et tw=99: * vim: set ts=8 sw=4 et tw=99:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Nick Fitzgerald <nfitzgerald@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsdbgapi_h___ #ifndef jsdbgapi_h___
#define jsdbgapi_h___ #define jsdbgapi_h___
/* /*
* JS debugger API. * JS debugger API.
*/ */
#include "jsapi.h" #include "jsapi.h"
#include "jsprvtd.h" #include "jsprvtd.h"
JS_BEGIN_EXTERN_C JS_BEGIN_EXTERN_C
skipping to change at line 124 skipping to change at line 90
* features. In general, it is not safe to interact with frames that were l ive * features. In general, it is not safe to interact with frames that were l ive
* before debug mode was enabled. For this reason, it is also not safe to * before debug mode was enabled. For this reason, it is also not safe to
* enable debug mode while frames are live. * enable debug mode while frames are live.
*/ */
/* Get current state of debugging mode. */ /* Get current state of debugging mode. */
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetDebugMode(JSContext *cx); JS_GetDebugMode(JSContext *cx);
/* /*
* Turn on/off debugging mode for all compartments. This returns false if a
ny code
* from any of the runtime's compartments is running or on the stack.
*/
JS_FRIEND_API(JSBool)
JS_SetDebugModeForAllCompartments(JSContext *cx, JSBool debug);
/*
* Turn on/off debugging mode for a single compartment. This should only be * Turn on/off debugging mode for a single compartment. This should only be
* used when no code from this compartment is running or on the stack in an y * used when no code from this compartment is running or on the stack in an y
* thread. * thread.
*/ */
JS_FRIEND_API(JSBool) JS_FRIEND_API(JSBool)
JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, JSBool de bug); JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, JSBool de bug);
/* /*
* Turn on/off debugging mode for a context's compartment. * Turn on/off debugging mode for a context's compartment.
*/ */
skipping to change at line 251 skipping to change at line 224
extern JS_PUBLIC_API(jsbytecode *) extern JS_PUBLIC_API(jsbytecode *)
JS_GetFramePC(JSContext *cx, JSStackFrame *fp); JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(void *) extern JS_PUBLIC_API(void *)
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation); JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
extern JS_PUBLIC_API(JSBool)
JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp); JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp); JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv); JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
skipping to change at line 302 skipping to change at line 272
/** /**
* Return fp's callee function object (fp->callee) if it has one. Note that * Return fp's callee function object (fp->callee) if it has one. Note that
* this API cannot fail. A null return means "no callee": fp is a global or * this API cannot fail. A null return means "no callee": fp is a global or
* eval-from-global frame, not a call frame. * eval-from-global frame, not a call frame.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp); JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp);
/************************************************************************/ /************************************************************************/
/*
* This is almost JS_GetClass(obj)->name except that certain debug-only
* proxies are made transparent. In particular, this function turns the cla
ss
* of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObj
ect)
* from "Proxy" to "Call", "Block", "With" etc.
*/
extern JS_PUBLIC_API(const char *)
JS_GetDebugClassName(JSObject *obj);
/************************************************************************/
extern JS_PUBLIC_API(const char *) extern JS_PUBLIC_API(const char *)
JS_GetScriptFilename(JSContext *cx, JSScript *script); JS_GetScriptFilename(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(const jschar *) extern JS_PUBLIC_API(const jschar *)
JS_GetScriptSourceMap(JSContext *cx, JSScript *script); JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(unsigned) extern JS_PUBLIC_API(unsigned)
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script); JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(unsigned) extern JS_PUBLIC_API(unsigned)
skipping to change at line 355 skipping to change at line 336
const char *filename, unsigned lineno, const char *filename, unsigned lineno,
jsval *rval); jsval *rval);
/************************************************************************/ /************************************************************************/
typedef struct JSPropertyDesc { typedef struct JSPropertyDesc {
jsval id; /* primary id, atomized string, or int */ jsval id; /* primary id, atomized string, or int */
jsval value; /* property value */ jsval value; /* property value */
uint8_t flags; /* flags, see below */ uint8_t flags; /* flags, see below */
uint8_t spare; /* unused */ uint8_t spare; /* unused */
uint16_t slot; /* argument/variable slot */
jsval alias; /* alias id if JSPD_ALIAS flag */ jsval alias; /* alias id if JSPD_ALIAS flag */
} JSPropertyDesc; } JSPropertyDesc;
#define JSPD_ENUMERATE 0x01 /* visible to for/in loop */ #define JSPD_ENUMERATE 0x01 /* visible to for/in loop */
#define JSPD_READONLY 0x02 /* assignment is error */ #define JSPD_READONLY 0x02 /* assignment is error */
#define JSPD_PERMANENT 0x04 /* property cannot be deleted */ #define JSPD_PERMANENT 0x04 /* property cannot be deleted */
#define JSPD_ALIAS 0x08 /* property has an alias id */ #define JSPD_ALIAS 0x08 /* property has an alias id */
#define JSPD_ARGUMENT 0x10 /* argument to function */
#define JSPD_VARIABLE 0x20 /* local variable in function */
#define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property , */ #define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property , */
/* value is exception */ /* value is exception */
#define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */ #define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */
/* throwing an exception */ /* throwing an exception */
typedef struct JSPropertyDescArray { typedef struct JSPropertyDescArray {
uint32_t length; /* number of elements in array */ uint32_t length; /* number of elements in array */
JSPropertyDesc *array; /* alloc'd by Get, freed by Put */ JSPropertyDesc *array; /* alloc'd by Get, freed by Put */
} JSPropertyDescArray; } JSPropertyDescArray;
typedef struct JSScopeProperty JSScopeProperty; typedef struct JSScopeProperty JSScopeProperty;
extern JS_PUBLIC_API(JSScopeProperty *)
JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *shape,
JSPropertyDesc *pd);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray * pda); JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray * pda);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda); JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
/************************************************************************/ /************************************************************************/
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure) ; JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure) ;
skipping to change at line 421 skipping to change at line 392
extern JS_PUBLIC_API(size_t) extern JS_PUBLIC_API(size_t)
JS_GetObjectTotalSize(JSContext *cx, JSObject *obj); JS_GetObjectTotalSize(JSContext *cx, JSObject *obj);
extern JS_PUBLIC_API(size_t) extern JS_PUBLIC_API(size_t)
JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun); JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun);
extern JS_PUBLIC_API(size_t) extern JS_PUBLIC_API(size_t)
JS_GetScriptTotalSize(JSContext *cx, JSScript *script); JS_GetScriptTotalSize(JSContext *cx, JSScript *script);
/*
* Return true if obj is a "system" object, that is, one created by
* JS_NewSystemObject with the system flag set and not JS_NewObject.
*
* What "system" means is up to the API client.
*/
extern JS_PUBLIC_API(JSBool)
JS_IsSystemObject(JSContext *cx, JSObject *obj);
/*
* Mark an object as being a system object. This should be called immediate
ly
* after allocating the object. A system object is an object for which
* JS_IsSystemObject returns true.
*/
extern JS_PUBLIC_API(JSBool)
JS_MakeSystemObject(JSContext *cx, JSObject *obj);
/************************************************************************/ /************************************************************************/
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
js_RevertVersion(JSContext *cx); js_RevertVersion(JSContext *cx);
extern JS_PUBLIC_API(const JSDebugHooks *) extern JS_PUBLIC_API(const JSDebugHooks *)
JS_GetGlobalDebugHooks(JSRuntime *rt); JS_GetGlobalDebugHooks(JSRuntime *rt);
/** /**
* Start any profilers that are available and have been configured on for t his * Start any profilers that are available and have been configured on for t his
skipping to change at line 535 skipping to change at line 489
js_StopVtune(); js_StopVtune();
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
js_PauseVtune(); js_PauseVtune();
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
js_ResumeVtune(); js_ResumeVtune();
#endif /* MOZ_VTUNE */ #endif /* MOZ_VTUNE */
#ifdef __linux__
extern JS_FRIEND_API(JSBool)
js_StartPerf();
extern JS_FRIEND_API(JSBool)
js_StopPerf();
#endif /* __linux__ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DumpBytecode(JSContext *cx, JSScript *script); JS_DumpBytecode(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DumpCompartmentBytecode(JSContext *cx); JS_DumpCompartmentBytecode(JSContext *cx);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DumpPCCounts(JSContext *cx, JSScript *script); JS_DumpPCCounts(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_DumpCompartmentPCCounts(JSContext *cx); JS_DumpCompartmentPCCounts(JSContext *cx);
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_UnwrapObject(JSObject *obj); JS_UnwrapObject(JSObject *obj);
extern JS_PUBLIC_API(JSObject *)
JS_UnwrapObjectAndInnerize(JSObject *obj);
/* Call the context debug handler on the topmost scripted frame. */ /* Call the context debug handler on the topmost scripted frame. */
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
js_CallContextDebugHandler(JSContext *cx); js_CallContextDebugHandler(JSContext *cx);
JS_END_EXTERN_C JS_END_EXTERN_C
#endif /* jsdbgapi_h___ */ #endif /* jsdbgapi_h___ */
 End of changes. 10 change blocks. 
77 lines changed or deleted 37 lines changed or added


 jsdhash.h   jsdhash.h 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla JavaScript code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999-2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brendan Eich <brendan@mozilla.org> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsdhash_h___ #ifndef jsdhash_h___
#define jsdhash_h___ #define jsdhash_h___
/* /*
* Double hashing, a la Knuth 6. * Double hashing, a la Knuth 6.
* *
* Try to keep this file in sync with xpcom/glue/pldhash.h. * Try to keep this file in sync with xpcom/glue/pldhash.h.
*/ */
#include "jstypes.h" #include "jstypes.h"
 End of changes. 1 change blocks. 
45 lines changed or deleted 3 lines changed or added


 jsfriendapi.h   jsfriendapi.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
*
* The Original Code is SpiderMonkey code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsfriendapi_h___ #ifndef jsfriendapi_h___
#define jsfriendapi_h___ #define jsfriendapi_h___
#include "jsclass.h" #include "jsclass.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jsprvtd.h" #include "jsprvtd.h"
#include "mozilla/GuardObjects.h" #include "mozilla/GuardObjects.h"
JS_BEGIN_EXTERN_C JS_BEGIN_EXTERN_C
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data); JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
extern JS_FRIEND_API(JSString *) extern JS_FRIEND_API(JSString *)
JS_GetAnonymousString(JSRuntime *rt); JS_GetAnonymousString(JSRuntime *rt);
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_FindCompilationScope(JSContext *cx, JSObject *obj); JS_FindCompilationScope(JSContext *cx, JSRawObject obj);
extern JS_FRIEND_API(JSFunction *) extern JS_FRIEND_API(JSFunction *)
JS_GetObjectFunction(JSObject *obj); JS_GetObjectFunction(JSRawObject obj);
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_GetGlobalForFrame(JSStackFrame *fp); JS_GetGlobalForFrame(JSStackFrame *fp);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_SplicePrototype(JSContext *cx, JSObject *obj, JSObject *proto); JS_SplicePrototype(JSContext *cx, JSObject *obj, JSObject *proto);
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent); JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
extern JS_FRIEND_API(uint32_t) extern JS_FRIEND_API(uint32_t)
JS_ObjectCountDynamicSlots(JSObject *obj); JS_ObjectCountDynamicSlots(JSHandleObject obj);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
JS_ShrinkGCBuffers(JSRuntime *rt); JS_ShrinkGCBuffers(JSRuntime *rt);
extern JS_FRIEND_API(size_t) extern JS_FRIEND_API(size_t)
JS_GetE4XObjectsCreated(JSContext *cx); JS_GetE4XObjectsCreated(JSContext *cx);
extern JS_FRIEND_API(size_t) extern JS_FRIEND_API(size_t)
JS_SetProtoCalled(JSContext *cx); JS_SetProtoCalled(JSContext *cx);
extern JS_FRIEND_API(size_t) extern JS_FRIEND_API(size_t)
JS_GetCustomIteratorCount(JSContext *cx); JS_GetCustomIteratorCount(JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject ** ret); JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject ** ret);
/* /*
* Determine whether the given object is backed by a DeadObjectProxy.
*
* Such objects hold no other objects (they have no outgoing reference edge
s)
* and will throw if you touch them (e.g. by reading/writing a property).
*/
extern JS_FRIEND_API(JSBool)
JS_IsDeadWrapper(JSObject *obj);
/*
* Used by the cycle collector to trace through the shape and all * Used by the cycle collector to trace through the shape and all
* shapes it reaches, marking all non-shape children found in the * shapes it reaches, marking all non-shape children found in the
* process. Uses bounded stack space. * process. Uses bounded stack space.
*/ */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
JS_TraceShapeCycleCollectorChildren(JSTracer *trc, void *shape); JS_TraceShapeCycleCollectorChildren(JSTracer *trc, void *shape);
enum { enum {
JS_TELEMETRY_GC_REASON, JS_TELEMETRY_GC_REASON,
JS_TELEMETRY_GC_IS_COMPARTMENTAL, JS_TELEMETRY_GC_IS_COMPARTMENTAL,
JS_TELEMETRY_GC_MS, JS_TELEMETRY_GC_MS,
JS_TELEMETRY_GC_MAX_PAUSE_MS,
JS_TELEMETRY_GC_MARK_MS, JS_TELEMETRY_GC_MARK_MS,
JS_TELEMETRY_GC_SWEEP_MS, JS_TELEMETRY_GC_SWEEP_MS,
JS_TELEMETRY_GC_MARK_ROOTS_MS,
JS_TELEMETRY_GC_MARK_GRAY_MS,
JS_TELEMETRY_GC_SLICE_MS, JS_TELEMETRY_GC_SLICE_MS,
JS_TELEMETRY_GC_MMU_50, JS_TELEMETRY_GC_MMU_50,
JS_TELEMETRY_GC_RESET, JS_TELEMETRY_GC_RESET,
JS_TELEMETRY_GC_INCREMENTAL_DISABLED, JS_TELEMETRY_GC_INCREMENTAL_DISABLED,
JS_TELEMETRY_GC_NON_INCREMENTAL JS_TELEMETRY_GC_NON_INCREMENTAL,
JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS,
JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS
}; };
typedef void typedef void
(* JSAccumulateTelemetryDataCallback)(int id, uint32_t sample); (* JSAccumulateTelemetryDataCallback)(int id, uint32_t sample);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
JS_SetAccumulateTelemetryCallback(JSRuntime *rt, JSAccumulateTelemetryDataC allback callback); JS_SetAccumulateTelemetryCallback(JSRuntime *rt, JSAccumulateTelemetryDataC allback callback);
extern JS_FRIEND_API(JSPrincipals *) extern JS_FRIEND_API(JSPrincipals *)
JS_GetCompartmentPrincipals(JSCompartment *compartment); JS_GetCompartmentPrincipals(JSCompartment *compartment);
extern JS_FRIEND_API(void)
JS_SetCompartmentPrincipals(JSCompartment *compartment, JSPrincipals *princ
ipals);
/* Safe to call with input obj == NULL. Returns non-NULL iff obj != NULL. * / /* Safe to call with input obj == NULL. Returns non-NULL iff obj != NULL. * /
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_ObjectToInnerObject(JSContext *cx, JSObject *obj); JS_ObjectToInnerObject(JSContext *cx, JSObject *obj);
/* Requires obj != NULL. */ /* Requires obj != NULL. */
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_ObjectToOuterObject(JSContext *cx, JSObject *obj); JS_ObjectToOuterObject(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *par ent); JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *par ent);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool str ict, jsval *vp); js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
JS_FRIEND_API(void) JS_FRIEND_API(void)
js_ReportOverRecursed(JSContext *maybecx); js_ReportOverRecursed(JSContext *maybecx);
#ifdef DEBUG #ifdef DEBUG
/* /*
* Routines to print out values during debugging. These are FRIEND_API to help * Routines to print out values during debugging. These are FRIEND_API to help
* the debugger find them and to support temporarily hacking js_Dump* calls * the debugger find them and to support temporarily hacking js_Dump* calls
* into other code. * into other code.
skipping to change at line 167 skipping to change at line 151
#ifdef __cplusplus #ifdef __cplusplus
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
JS_CopyPropertiesFrom(JSContext *cx, JSObject *target, JSObject *obj); JS_CopyPropertiesFrom(JSContext *cx, JSObject *target, JSObject *obj);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_WrapPropertyDescriptor(JSContext *cx, js::PropertyDescriptor *desc); JS_WrapPropertyDescriptor(JSContext *cx, js::PropertyDescriptor *desc);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_EnumerateState(JSContext *cx, JSObject *obj, JSIterateOp enum_op, js::Va JS_WrapAutoIdVector(JSContext *cx, JS::AutoIdVector &props);
lue *statep, jsid *idp);
extern JS_FRIEND_API(JSBool)
JS_EnumerateState(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, j
s::Value *statep, jsid *idp);
struct JSFunctionSpecWithHelp { struct JSFunctionSpecWithHelp {
const char *name; const char *name;
JSNative call; JSNative call;
uint16_t nargs; uint16_t nargs;
uint16_t flags; uint16_t flags;
const char *usage; const char *usage;
const char *help; const char *help;
}; };
#define JS_FN_HELP(name,call,nargs,flags,usage,help) \ #define JS_FN_HELP(name,call,nargs,flags,usage,help) \
{name, call, nargs, (flags) | JSPROP_ENUMERATE | JSFUN_STUB_GSOPS, usag e, help} {name, call, nargs, (flags) | JSPROP_ENUMERATE | JSFUN_STUB_GSOPS, usag e, help}
#define JS_FS_HELP_END
\
{NULL, NULL, 0, 0, NULL, NULL}
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSp ecWithHelp *fs); JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSp ecWithHelp *fs);
#endif #endif
JS_END_EXTERN_C JS_END_EXTERN_C
#ifdef __cplusplus #ifdef __cplusplus
typedef bool (* JS_SourceHook)(JSContext *cx, JSScript *script, jschar **sr
c, uint32_t *length);
extern JS_FRIEND_API(void)
JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook);
namespace js { namespace js {
struct RuntimeFriendFields { struct RuntimeFriendFields {
/* /*
* If non-zero, we were been asked to call the operation callback as so on * If non-zero, we were been asked to call the operation callback as so on
* as possible. * as possible.
*/ */
volatile int32_t interrupt; volatile int32_t interrupt;
/* Limit pointer for checking native stack consumption. */ /* Limit pointer for checking native stack consumption. */
skipping to change at line 220 skipping to change at line 214
inline JSRuntime * inline JSRuntime *
GetRuntime(const JSContext *cx) GetRuntime(const JSContext *cx)
{ {
return ContextFriendFields::get(cx)->runtime; return ContextFriendFields::get(cx)->runtime;
} }
typedef bool typedef bool
(* PreserveWrapperCallback)(JSContext *cx, JSObject *obj); (* PreserveWrapperCallback)(JSContext *cx, JSObject *obj);
#ifdef DEBUG
/* /*
* DEBUG-only method to dump the complete object graph of heap-allocated t hings. * Dump the complete object graph of heap-allocated things.
* fp is the file for the dump output. * fp is the file for the dump output.
*/ */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
DumpHeapComplete(JSRuntime *rt, FILE *fp); DumpHeapComplete(JSRuntime *rt, FILE *fp);
#endif
class JS_FRIEND_API(AutoPreserveCompartment) {
private:
JSContext *cx;
JSCompartment *oldCompartment;
public:
AutoPreserveCompartment(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoPreserveCompartment();
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class JS_FRIEND_API(AutoSwitchCompartment) { class JS_FRIEND_API(AutoSwitchCompartment) {
private: private:
JSContext *cx; JSContext *cx;
JSCompartment *oldCompartment; JSCompartment *oldCompartment;
public: public:
AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment
JS_GUARD_OBJECT_NOTIFIER_PARAM); JS_GUARD_OBJECT_NOTIFIER_PARAM);
AutoSwitchCompartment(JSContext *cx, JSObject *target JS_GUARD_OBJECT_N OTIFIER_PARAM); AutoSwitchCompartment(JSContext *cx, JSHandleObject target JS_GUARD_OBJ ECT_NOTIFIER_PARAM);
~AutoSwitchCompartment(); ~AutoSwitchCompartment();
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
}; };
#ifdef OLD_GETTER_SETTER_METHODS #ifdef OLD_GETTER_SETTER_METHODS
JS_FRIEND_API(JSBool) obj_defineGetter(JSContext *cx, unsigned argc, js::Va lue *vp); JS_FRIEND_API(JSBool) obj_defineGetter(JSContext *cx, unsigned argc, js::Va lue *vp);
JS_FRIEND_API(JSBool) obj_defineSetter(JSContext *cx, unsigned argc, js::Va lue *vp); JS_FRIEND_API(JSBool) obj_defineSetter(JSContext *cx, unsigned argc, js::Va lue *vp);
#endif #endif
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
skipping to change at line 299 skipping to change at line 280
WeakMapTracer(JSRuntime *rt, WeakMapTraceCallback cb) WeakMapTracer(JSRuntime *rt, WeakMapTraceCallback cb)
: runtime(rt), callback(cb) {} : runtime(rt), callback(cb) {}
}; };
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
TraceWeakMaps(WeakMapTracer *trc); TraceWeakMaps(WeakMapTracer *trc);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
GCThingIsMarkedGray(void *thing); GCThingIsMarkedGray(void *thing);
extern JS_FRIEND_API(JSCompartment*)
GetGCThingCompartment(void *thing);
typedef void
(GCThingCallback)(void *closure, void *gcthing);
extern JS_FRIEND_API(void)
VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, voi
d *closure);
extern JS_FRIEND_API(JSObject *)
GetWeakmapKeyDelegate(JSObject *key);
/* /*
* Shadow declarations of JS internal structures, for access by inline acce ss * Shadow declarations of JS internal structures, for access by inline acce ss
* functions below. Do not use these structures in any other way. When addi ng * functions below. Do not use these structures in any other way. When addi ng
* new fields for access by inline methods, make sure to add static asserts to * new fields for access by inline methods, make sure to add static asserts to
* the original header file to ensure that offsets are consistent. * the original header file to ensure that offsets are consistent.
*/ */
namespace shadow { namespace shadow {
struct TypeObject { struct TypeObject {
JSObject *proto; JSObject *proto;
skipping to change at line 343 skipping to change at line 336
} }
js::Value &slotRef(size_t slot) const { js::Value &slotRef(size_t slot) const {
size_t nfixed = numFixedSlots(); size_t nfixed = numFixedSlots();
if (slot < nfixed) if (slot < nfixed)
return fixedSlots()[slot]; return fixedSlots()[slot];
return slots[slot - nfixed]; return slots[slot - nfixed];
} }
}; };
struct Function {
Object base;
uint16_t nargs;
uint16_t flags;
/* Used only for natives */
Native native;
const JSJitInfo *jitinfo;
void *_1;
};
struct Atom { struct Atom {
size_t _; size_t _;
const jschar *chars; const jschar *chars;
}; };
} /* namespace shadow */ } /* namespace shadow */
extern JS_FRIEND_DATA(js::Class) AnyNameClass; extern JS_FRIEND_DATA(js::Class) AnyNameClass;
extern JS_FRIEND_DATA(js::Class) AttributeNameClass; extern JS_FRIEND_DATA(js::Class) AttributeNameClass;
extern JS_FRIEND_DATA(js::Class) CallClass; extern JS_FRIEND_DATA(js::Class) CallClass;
skipping to change at line 364 skipping to change at line 367
extern JS_FRIEND_DATA(js::Class) FunctionClass; extern JS_FRIEND_DATA(js::Class) FunctionClass;
extern JS_FRIEND_DATA(js::Class) FunctionProxyClass; extern JS_FRIEND_DATA(js::Class) FunctionProxyClass;
extern JS_FRIEND_DATA(js::Class) NamespaceClass; extern JS_FRIEND_DATA(js::Class) NamespaceClass;
extern JS_FRIEND_DATA(js::Class) OuterWindowProxyClass; extern JS_FRIEND_DATA(js::Class) OuterWindowProxyClass;
extern JS_FRIEND_DATA(js::Class) ObjectProxyClass; extern JS_FRIEND_DATA(js::Class) ObjectProxyClass;
extern JS_FRIEND_DATA(js::Class) QNameClass; extern JS_FRIEND_DATA(js::Class) QNameClass;
extern JS_FRIEND_DATA(js::Class) XMLClass; extern JS_FRIEND_DATA(js::Class) XMLClass;
extern JS_FRIEND_DATA(js::Class) ObjectClass; extern JS_FRIEND_DATA(js::Class) ObjectClass;
inline js::Class * inline js::Class *
GetObjectClass(const JSObject *obj) GetObjectClass(RawObject obj)
{ {
return reinterpret_cast<const shadow::Object*>(obj)->shape->base->clasp ; return reinterpret_cast<const shadow::Object*>(obj)->shape->base->clasp ;
} }
inline JSClass * inline JSClass *
GetObjectJSClass(const JSObject *obj) GetObjectJSClass(RawObject obj)
{ {
return js::Jsvalify(GetObjectClass(obj)); return js::Jsvalify(GetObjectClass(obj));
} }
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
IsScopeObject(JSObject *obj); IsScopeObject(RawObject obj);
inline JSObject * inline JSObject *
GetObjectParent(JSObject *obj) GetObjectParent(RawObject obj)
{ {
JS_ASSERT(!IsScopeObject(obj)); JS_ASSERT(!IsScopeObject(obj));
return reinterpret_cast<shadow::Object*>(obj)->shape->base->parent; return reinterpret_cast<shadow::Object*>(obj)->shape->base->parent;
} }
JS_FRIEND_API(JSObject *) JS_FRIEND_API(JSObject *)
GetObjectParentMaybeScope(JSObject *obj); GetObjectParentMaybeScope(RawObject obj);
JS_FRIEND_API(JSObject *) JS_FRIEND_API(JSObject *)
GetGlobalForObjectCrossCompartment(JSObject *obj); GetGlobalForObjectCrossCompartment(RawObject obj);
JS_FRIEND_API(void)
NotifyAnimationActivity(RawObject obj);
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
IsOriginalScriptFunction(JSFunction *fun); IsOriginalScriptFunction(JSFunction *fun);
JS_FRIEND_API(JSFunction *) JS_FRIEND_API(JSFunction *)
DefineFunctionWithReserved(JSContext *cx, JSObject *obj, const char *name, JSNative call, DefineFunctionWithReserved(JSContext *cx, JSObject *obj, const char *name, JSNative call,
unsigned nargs, unsigned attrs); unsigned nargs, unsigned attrs);
JS_FRIEND_API(JSFunction *) JS_FRIEND_API(JSFunction *)
NewFunctionWithReserved(JSContext *cx, JSNative call, unsigned nargs, unsig ned flags, NewFunctionWithReserved(JSContext *cx, JSNative call, unsigned nargs, unsig ned flags,
skipping to change at line 413 skipping to change at line 419
NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags, NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
JSObject *parent, jsid id); JSObject *parent, jsid id);
JS_FRIEND_API(JSObject *) JS_FRIEND_API(JSObject *)
InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto, InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto,
JSClass *clasp, JSNative constructor, unsigned nargs, JSClass *clasp, JSNative constructor, unsigned nargs,
JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *ps, JSFunctionSpec *fs,
JSPropertySpec *static_ps, JSFunctionSpec *static_fs) ; JSPropertySpec *static_ps, JSFunctionSpec *static_fs) ;
JS_FRIEND_API(const Value &) JS_FRIEND_API(const Value &)
GetFunctionNativeReserved(JSObject *fun, size_t which); GetFunctionNativeReserved(RawObject fun, size_t which);
JS_FRIEND_API(void) JS_FRIEND_API(void)
SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val); SetFunctionNativeReserved(RawObject fun, size_t which, const Value &val);
inline JSObject * inline JSObject *
GetObjectProto(JSObject *obj) GetObjectProto(RawObject obj)
{ {
return reinterpret_cast<const shadow::Object*>(obj)->type->proto; return reinterpret_cast<const shadow::Object*>(obj)->type->proto;
} }
inline void * inline void *
GetObjectPrivate(JSObject *obj) GetObjectPrivate(RawObject obj)
{ {
const shadow::Object *nobj = reinterpret_cast<const shadow::Object*>(ob j); const shadow::Object *nobj = reinterpret_cast<const shadow::Object*>(ob j);
void **addr = reinterpret_cast<void**>(&nobj->fixedSlots()[nobj->numFix edSlots()]); void **addr = reinterpret_cast<void**>(&nobj->fixedSlots()[nobj->numFix edSlots()]);
return *addr; return *addr;
} }
/* /*
* Get a slot that is both reserved for object's clasp *and* is fixed (fits * Get a slot that is both reserved for object's clasp *and* is fixed (fits
* within the maximum capacity for the object's fixed slots). * within the maximum capacity for the object's fixed slots).
*/ */
inline const Value & inline const Value &
GetReservedSlot(const JSObject *obj, size_t slot) GetReservedSlot(RawObject obj, size_t slot)
{ {
JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)));
return reinterpret_cast<const shadow::Object *>(obj)->slotRef(slot); return reinterpret_cast<const shadow::Object *>(obj)->slotRef(slot);
} }
JS_FRIEND_API(void) JS_FRIEND_API(void)
SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const Value &value); SetReservedSlotWithBarrier(RawObject obj, size_t slot, const Value &value);
inline void inline void
SetReservedSlot(JSObject *obj, size_t slot, const Value &value) SetReservedSlot(RawObject obj, size_t slot, const Value &value)
{ {
JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)));
shadow::Object *sobj = reinterpret_cast<shadow::Object *>(obj); shadow::Object *sobj = reinterpret_cast<shadow::Object *>(obj);
if (sobj->slotRef(slot).isMarkable()) if (sobj->slotRef(slot).isMarkable())
SetReservedSlotWithBarrier(obj, slot, value); SetReservedSlotWithBarrier(obj, slot, value);
else else
sobj->slotRef(slot) = value; sobj->slotRef(slot) = value;
} }
JS_FRIEND_API(uint32_t) JS_FRIEND_API(uint32_t)
GetObjectSlotSpan(JSObject *obj); GetObjectSlotSpan(RawObject obj);
inline const Value & inline const Value &
GetObjectSlot(JSObject *obj, size_t slot) GetObjectSlot(RawObject obj, size_t slot)
{ {
JS_ASSERT(slot < GetObjectSlotSpan(obj)); JS_ASSERT(slot < GetObjectSlotSpan(obj));
return reinterpret_cast<const shadow::Object *>(obj)->slotRef(slot); return reinterpret_cast<const shadow::Object *>(obj)->slotRef(slot);
} }
inline Shape *
GetObjectShape(JSObject *obj)
{
shadow::Shape *shape = reinterpret_cast<const shadow::Object*>(obj)->sh
ape;
return reinterpret_cast<Shape *>(shape);
}
inline const jschar * inline const jschar *
GetAtomChars(JSAtom *atom) GetAtomChars(JSAtom *atom)
{ {
return reinterpret_cast<shadow::Atom *>(atom)->chars; return reinterpret_cast<shadow::Atom *>(atom)->chars;
} }
inline JSLinearString * inline JSLinearString *
AtomToLinearString(JSAtom *atom) AtomToLinearString(JSAtom *atom)
{ {
return reinterpret_cast<JSLinearString *>(atom); return reinterpret_cast<JSLinearString *>(atom);
} }
static inline js::PropertyOp static inline js::PropertyOp
CastAsJSPropertyOp(JSObject *object) CastAsJSPropertyOp(RawObject object)
{ {
return JS_DATA_TO_FUNC_PTR(js::PropertyOp, object); return JS_DATA_TO_FUNC_PTR(js::PropertyOp, object);
} }
static inline js::StrictPropertyOp static inline js::StrictPropertyOp
CastAsJSStrictPropertyOp(JSObject *object) CastAsJSStrictPropertyOp(RawObject object)
{ {
return JS_DATA_TO_FUNC_PTR(js::StrictPropertyOp, object); return JS_DATA_TO_FUNC_PTR(js::StrictPropertyOp, object);
} }
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVe GetPropertyNames(JSContext *cx, RawObject obj, unsigned flags, js::AutoIdVe
ctor *props); ctor *props);
JS_FRIEND_API(bool)
GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value
*vp);
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
StringIsArrayIndex(JSLinearString *str, uint32_t *indexp); StringIsArrayIndex(JSLinearString *str, uint32_t *indexp);
JS_FRIEND_API(void) JS_FRIEND_API(void)
SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback) ; SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback) ;
JS_FRIEND_API(bool) JS_FRIEND_API(bool)
IsObjectInContextCompartment(const JSObject *obj, const JSContext *cx); IsObjectInContextCompartment(RawObject obj, const JSContext *cx);
/* /*
* NB: these flag bits are encoded into the bytecode stream in the immediat e * NB: these flag bits are encoded into the bytecode stream in the immediat e
* operand of JSOP_ITER, so don't change them without advancing vm/Xdr.h's * operand of JSOP_ITER, so don't change them without advancing vm/Xdr.h's
* XDR_BYTECODE_VERSION. * XDR_BYTECODE_VERSION.
*/ */
#define JSITER_ENUMERATE 0x1 /* for-in compatible hidden default iterato r */ #define JSITER_ENUMERATE 0x1 /* for-in compatible hidden default iterato r */
#define JSITER_FOREACH 0x2 /* return [key, value] pair rather than key */ #define JSITER_FOREACH 0x2 /* return [key, value] pair rather than key */
#define JSITER_KEYVALUE 0x4 /* destructuring for-in wants [key, value] */ #define JSITER_KEYVALUE 0x4 /* destructuring for-in wants [key, value] */
#define JSITER_OWNONLY 0x8 /* iterate over obj's own properties only * / #define JSITER_OWNONLY 0x8 /* iterate over obj's own properties only * /
skipping to change at line 555 skipping to change at line 557
JS_FRIEND_API(size_t) JS_FRIEND_API(size_t)
GetPCCountScriptCount(JSContext *cx); GetPCCountScriptCount(JSContext *cx);
JS_FRIEND_API(JSString *) JS_FRIEND_API(JSString *)
GetPCCountScriptSummary(JSContext *cx, size_t script); GetPCCountScriptSummary(JSContext *cx, size_t script);
JS_FRIEND_API(JSString *) JS_FRIEND_API(JSString *)
GetPCCountScriptContents(JSContext *cx, size_t script); GetPCCountScriptContents(JSContext *cx, size_t script);
/*
* A call stack can be specified to the JS engine such that all JS entry/ex
its
* to functions push/pop an entry to/from the specified stack.
*
* For more detailed information, see vm/SPSProfiler.h
*/
class ProfileEntry
{
/*
* All fields are marked volatile to prevent the compiler from re-order
ing
* instructions. Namely this sequence:
*
* entry[size] = ...;
* size++;
*
* If the size modification were somehow reordered before the stores, t
hen
* if a sample were taken it would be examining bogus information.
*
* A ProfileEntry represents both a C++ profile entry and a JS one. Bot
h use
* the string as a description, but JS uses the sp as NULL to indicate
that
* it is a JS entry. The script_ is then only ever examined for a JS en
try,
* and the idx is used by both, but with different meanings.
*/
const char * volatile string; // Descriptive string of this entry
void * volatile sp; // Relevant stack pointer for the entry
JSScript * volatile script_; // if js(), non-null script which is runn
ing
int32_t volatile idx; // if js(), idx of pc, otherwise line num
ber
public:
/*
* All of these methods are marked with the 'volatile' keyword because
SPS's
* representation of the stack is stored such that all ProfileEntry
* instances are volatile. These methods would not be available unless
they
* were marked as volatile as well
*/
bool js() volatile {
JS_ASSERT_IF(sp == NULL, script_ != NULL);
return sp == NULL;
}
uint32_t line() volatile { JS_ASSERT(!js()); return idx; }
JSScript *script() volatile { JS_ASSERT(js()); return script_; }
void *stackAddress() volatile { return sp; }
const char *label() volatile { return string; }
void setLine(uint32_t line) volatile { JS_ASSERT(!js()); idx = line; }
void setLabel(const char *string) volatile { this->string = string; }
void setStackAddress(void *sp) volatile { this->sp = sp; }
void setScript(JSScript *script) volatile { script_ = script; }
/* we can't know the layout of JSScript, so look in vm/SPSProfiler.cpp
*/
JS_FRIEND_API(jsbytecode *) pc() volatile;
JS_FRIEND_API(void) setPC(jsbytecode *pc) volatile;
static size_t offsetOfString() { return offsetof(ProfileEntry, string);
}
static size_t offsetOfStackAddress() { return offsetof(ProfileEntry, sp
); }
static size_t offsetOfPCIdx() { return offsetof(ProfileEntry, idx); }
static size_t offsetOfScript() { return offsetof(ProfileEntry, script_)
; }
/*
* The index used in the entry can either be a line number or the offse
t of
* a pc into a script's code. To signify a NULL pc, use a -1 index. Thi
s is
* checked against in pc() and setPC() to set/get the right pc.
*/
static const int32_t NullPCIndex = -1;
};
JS_FRIEND_API(void)
SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size
,
uint32_t max);
JS_FRIEND_API(void)
EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled);
JS_FRIEND_API(jsbytecode*)
ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip);
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
JS_FRIEND_API(void *) JS_FRIEND_API(void *)
GetOwnerThread(const JSContext *cx); GetOwnerThread(const JSContext *cx);
JS_FRIEND_API(unsigned) JS_FRIEND_API(unsigned)
GetContextOutstandingRequests(const JSContext *cx); GetContextOutstandingRequests(const JSContext *cx);
#endif #endif
JS_FRIEND_API(JSCompartment *) JS_FRIEND_API(JSCompartment *)
GetContextCompartment(const JSContext *cx); GetContextCompartment(const JSContext *cx);
skipping to change at line 584 skipping to change at line 664
* last active request ceases - and begins activity - when it was * last active request ceases - and begins activity - when it was
* idle and a request begins. * idle and a request begins.
*/ */
JS_FRIEND_API(void) JS_FRIEND_API(void)
SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg); SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg);
extern JS_FRIEND_API(const JSStructuredCloneCallbacks *) extern JS_FRIEND_API(const JSStructuredCloneCallbacks *)
GetContextStructuredCloneCallbacks(JSContext *cx); GetContextStructuredCloneCallbacks(JSContext *cx);
extern JS_FRIEND_API(JSVersion) extern JS_FRIEND_API(JSVersion)
VersionSetXML(JSVersion version, bool enable); VersionSetMoarXML(JSVersion version, bool enable);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
CanCallContextDebugHandler(JSContext *cx); CanCallContextDebugHandler(JSContext *cx);
extern JS_FRIEND_API(JSTrapStatus) extern JS_FRIEND_API(JSTrapStatus)
CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Va lue *rval); CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Va lue *rval);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
IsContextRunningJS(JSContext *cx); IsContextRunningJS(JSContext *cx);
skipping to change at line 613 skipping to change at line 693
#define GCREASONS(D) \ #define GCREASONS(D) \
/* Reasons internal to the JS engine */ \ /* Reasons internal to the JS engine */ \
D(API) \ D(API) \
D(MAYBEGC) \ D(MAYBEGC) \
D(LAST_CONTEXT) \ D(LAST_CONTEXT) \
D(DESTROY_CONTEXT) \ D(DESTROY_CONTEXT) \
D(LAST_DITCH) \ D(LAST_DITCH) \
D(TOO_MUCH_MALLOC) \ D(TOO_MUCH_MALLOC) \
D(ALLOC_TRIGGER) \ D(ALLOC_TRIGGER) \
D(DEBUG_GC) \ D(DEBUG_GC) \
D(UNUSED2) /* was SHAPE */ \ D(DEBUG_MODE_GC) \
D(UNUSED3) /* was REFILL */ \ D(TRANSPLANT) \
D(RESET) \
\ \
/* Reasons from Firefox */ \ /* Reasons from Firefox */ \
D(DOM_WINDOW_UTILS) \ D(DOM_WINDOW_UTILS) \
D(COMPONENT_UTILS) \ D(COMPONENT_UTILS) \
D(MEM_PRESSURE) \ D(MEM_PRESSURE) \
D(CC_WAITING) \ D(CC_WAITING) \
D(CC_FORCED) \ D(CC_FORCED) \
D(LOAD_END) \ D(LOAD_END) \
D(POST_COMPARTMENT) \ D(POST_COMPARTMENT) \
D(PAGE_HIDE) \ D(PAGE_HIDE) \
D(NSJSCONTEXT_DESTROY) \ D(NSJSCONTEXT_DESTROY) \
D(SET_NEW_DOCUMENT) \ D(SET_NEW_DOCUMENT) \
D(SET_DOC_SHELL) \ D(SET_DOC_SHELL) \
D(DOM_UTILS) \ D(DOM_UTILS) \
D(DOM_IPC) \ D(DOM_IPC) \
D(DOM_WORKER) \ D(DOM_WORKER) \
D(INTER_SLICE_GC) \ D(INTER_SLICE_GC) \
D(REFRESH_FRAME) D(REFRESH_FRAME) \
D(FULL_GC_TIMER) \
D(SHUTDOWN_CC)
namespace gcreason { namespace gcreason {
/* GCReasons will end up looking like JSGC_MAYBEGC */ /* GCReasons will end up looking like JSGC_MAYBEGC */
enum Reason { enum Reason {
#define MAKE_REASON(name) name, #define MAKE_REASON(name) name,
GCREASONS(MAKE_REASON) GCREASONS(MAKE_REASON)
#undef MAKE_REASON #undef MAKE_REASON
NO_REASON, NO_REASON,
NUM_REASONS NUM_REASONS,
/*
* For telemetry, we want to keep a fixed max bucket size over time so
we
* don't have to switch histograms. 100 is conservative; as of this wri
ting
* there are 26. But the cost of extra buckets seems to be low while th
e
* cost of switching histograms is high.
*/
NUM_TELEMETRY_REASONS = 100
}; };
} /* namespace gcreason */ } /* namespace gcreason */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
PrepareCompartmentForGC(JSCompartment *comp); PrepareCompartmentForGC(JSCompartment *comp);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
PrepareForFullGC(JSRuntime *rt); PrepareForFullGC(JSRuntime *rt);
extern JS_FRIEND_API(void)
PrepareForIncrementalGC(JSRuntime *rt);
extern JS_FRIEND_API(bool)
IsGCScheduled(JSRuntime *rt);
extern JS_FRIEND_API(void)
SkipCompartmentForGC(JSCompartment *comp);
/* /*
* When triggering a GC using one of the functions below, it is first neces sary * When triggering a GC using one of the functions below, it is first neces sary
* to select the compartments to be collected. To do this, you can call * to select the compartments to be collected. To do this, you can call
* PrepareCompartmentForGC on each compartment, or you can call PrepareForF ullGC * PrepareCompartmentForGC on each compartment, or you can call PrepareForF ullGC
* to select all compartments. Failing to select any compartment is an erro r. * to select all compartments. Failing to select any compartment is an erro r.
*/ */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
GCForReason(JSRuntime *rt, gcreason::Reason reason); GCForReason(JSRuntime *rt, gcreason::Reason reason);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); ShrinkingGC(JSRuntime *rt, gcreason::Reason reason);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
IncrementalGC(JSRuntime *rt, gcreason::Reason reason); IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
SetGCSliceTimeBudget(JSContext *cx, int64_t millis); FinishIncrementalGC(JSRuntime *rt, gcreason::Reason reason);
enum GCProgress { enum GCProgress {
/* /*
* During non-incremental GC, the GC is bracketed by JSGC_CYCLE_BEGIN/E ND * During non-incremental GC, the GC is bracketed by JSGC_CYCLE_BEGIN/E ND
* callbacks. During an incremental GC, the sequence of callbacks is as * callbacks. During an incremental GC, the sequence of callbacks is as
* follows: * follows:
* JSGC_CYCLE_BEGIN, JSGC_SLICE_END (first slice) * JSGC_CYCLE_BEGIN, JSGC_SLICE_END (first slice)
* JSGC_SLICE_BEGIN, JSGC_SLICE_END (second slice) * JSGC_SLICE_BEGIN, JSGC_SLICE_END (second slice)
* ... * ...
* JSGC_SLICE_BEGIN, JSGC_CYCLE_END (last slice) * JSGC_SLICE_BEGIN, JSGC_CYCLE_END (last slice)
skipping to change at line 705 skipping to change at line 805
jschar *formatMessage(JSRuntime *rt) const; jschar *formatMessage(JSRuntime *rt) const;
jschar *formatJSON(JSRuntime *rt, uint64_t timestamp) const; jschar *formatJSON(JSRuntime *rt, uint64_t timestamp) const;
}; };
typedef void typedef void
(* GCSliceCallback)(JSRuntime *rt, GCProgress progress, const GCDescription &desc); (* GCSliceCallback)(JSRuntime *rt, GCProgress progress, const GCDescription &desc);
extern JS_FRIEND_API(GCSliceCallback) extern JS_FRIEND_API(GCSliceCallback)
SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback);
typedef void
(* AnalysisPurgeCallback)(JSRuntime *rt, JSFlatString *desc);
extern JS_FRIEND_API(AnalysisPurgeCallback)
SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback);
/* Was the most recent GC run incrementally? */
extern JS_FRIEND_API(bool)
WasIncrementalGC(JSRuntime *rt);
typedef JSBool
(* DOMInstanceClassMatchesProto)(JSHandleObject protoObject, uint32_t proto
ID,
uint32_t depth);
struct JSDOMCallbacks {
DOMInstanceClassMatchesProto instanceClassMatchesProto;
};
typedef struct JSDOMCallbacks DOMCallbacks;
extern JS_FRIEND_API(void)
SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks);
extern JS_FRIEND_API(const DOMCallbacks *)
GetDOMCallbacks(JSRuntime *rt);
/* /*
* Signals a good place to do an incremental slice, because the browser is * Signals a good place to do an incremental slice, because the browser is
* drawing a frame. * drawing a frame.
*/ */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
NotifyDidPaint(JSRuntime *rt); NotifyDidPaint(JSRuntime *rt);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
IsIncrementalGCEnabled(JSRuntime *rt); IsIncrementalGCEnabled(JSRuntime *rt);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
DisableIncrementalGC(JSRuntime *rt); DisableIncrementalGC(JSRuntime *rt);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSRuntime *rt); IsIncrementalBarrierNeeded(JSRuntime *rt);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSContext *cx); IsIncrementalBarrierNeeded(JSContext *cx);
extern JS_FRIEND_API(bool) extern JS_FRIEND_API(bool)
IsIncrementalBarrierNeededOnObject(JSObject *obj); IsIncrementalBarrierNeededOnObject(RawObject obj);
extern JS_FRIEND_API(bool)
IsIncrementalBarrierNeededOnScript(JSScript *obj);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
IncrementalReferenceBarrier(void *ptr); IncrementalReferenceBarrier(void *ptr);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
IncrementalValueBarrier(const Value &v); IncrementalValueBarrier(const Value &v);
extern JS_FRIEND_API(void)
PokeGC(JSRuntime *rt);
class ObjectPtr class ObjectPtr
{ {
JSObject *value; JSObject *value;
public: public:
ObjectPtr() : value(NULL) {} ObjectPtr() : value(NULL) {}
ObjectPtr(JSObject *obj) : value(obj) {} ObjectPtr(JSObject *obj) : value(obj) {}
/* Always call finalize before the destructor. */ /* Always call finalize before the destructor. */
skipping to change at line 787 skipping to change at line 917
*/ */
inline JSFreeOp * inline JSFreeOp *
CastToJSFreeOp(FreeOp *fop) CastToJSFreeOp(FreeOp *fop)
{ {
return reinterpret_cast<JSFreeOp *>(fop); return reinterpret_cast<JSFreeOp *>(fop);
} }
/* Implemented in jsexn.cpp. */ /* Implemented in jsexn.cpp. */
/* /*
* Get an error type name from a number. * Get an error type name from a JSExnType constant.
* If no exception is associated, return NULL. * Returns NULL for invalid arguments and JSEXN_INTERNALERR
*/ */
extern JS_FRIEND_API(const jschar*) extern JS_FRIEND_API(const jschar*)
GetErrorTypeNameFromNumber(JSContext* cx, const unsigned errorNumber); GetErrorTypeName(JSContext* cx, int16_t exnType);
/* Implemented in jswrapper.cpp. */
typedef enum NukeReferencesToWindow {
NukeWindowReferences,
DontNukeWindowReferences
} NukeReferencesToWindow;
/*
* These filters are designed to be ephemeral stack classes, and thus don't
* do any rooting or holding of their members.
*/
struct CompartmentFilter {
virtual bool match(JSCompartment *c) const = 0;
};
struct AllCompartments : public CompartmentFilter {
virtual bool match(JSCompartment *c) const { return true; }
};
struct ContentCompartmentsOnly : public CompartmentFilter {
virtual bool match(JSCompartment *c) const {
return !IsSystemCompartment(c);
}
};
struct ChromeCompartmentsOnly : public CompartmentFilter {
virtual bool match(JSCompartment *c) const {
return IsSystemCompartment(c);
}
};
struct SingleCompartment : public CompartmentFilter {
JSCompartment *ours;
SingleCompartment(JSCompartment *c) : ours(c) {}
virtual bool match(JSCompartment *c) const { return c == ours; }
};
struct CompartmentsWithPrincipals : public CompartmentFilter {
JSPrincipals *principals;
CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {}
virtual bool match(JSCompartment *c) const {
return JS_GetCompartmentPrincipals(c) == principals;
}
};
extern JS_FRIEND_API(JSBool)
NukeCrossCompartmentWrappers(JSContext* cx,
const CompartmentFilter& sourceFilter,
const CompartmentFilter& targetFilter,
NukeReferencesToWindow nukeReferencesToWindow)
;
/* Specify information about ListBase proxies in the DOM, for use by ICs. *
/
JS_FRIEND_API(void)
SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpand
oSlot);
void *GetListBaseHandlerFamily();
uint32_t GetListBaseExpandoSlot();
} /* namespace js */ } /* namespace js */
#endif #endif
/* Implemented in jsdate.cpp. */ /* Implemented in jsdate.cpp. */
/* /*
* Detect whether the internal date value is NaN. (Because failure is * Detect whether the internal date value is NaN. (Because failure is
* out-of-band for js_DateGet*) * out-of-band for js_DateGet*)
*/ */
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
js_DateIsValid(JSContext *cx, JSObject* obj); js_DateIsValid(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(double) extern JS_FRIEND_API(double)
js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj); js_DateGetMsecSinceEpoch(JSContext *cx, JSRawObject obj);
/* Implemented in jscntxt.cpp. */ /* Implemented in jscntxt.cpp. */
/* /*
* Report an exception, which is currently realized as a printf-style forma t * Report an exception, which is currently realized as a printf-style forma t
* string and its arguments. * string and its arguments.
*/ */
typedef enum JSErrNum { typedef enum JSErrNum {
#define MSG_DEF(name, number, count, exception, format) \ #define MSG_DEF(name, number, count, exception, format) \
name = number, name = number,
skipping to change at line 967 skipping to change at line 1154
/* /*
* Check whether obj supports JS_GetTypedArray* APIs. Note that this may re turn * Check whether obj supports JS_GetTypedArray* APIs. Note that this may re turn
* false if a security wrapper is encountered that denies the unwrapping. I f * false if a security wrapper is encountered that denies the unwrapping. I f
* this test or one of the JS_Is*Array tests succeeds, then it is safe to c all * this test or one of the JS_Is*Array tests succeeds, then it is safe to c all
* the various accessor JSAPI calls defined below. * the various accessor JSAPI calls defined below.
*/ */
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsTypedArrayObject(JSObject *obj, JSContext *cx); JS_IsTypedArrayObject(JSObject *obj, JSContext *cx);
/* /*
* Check whether obj supports JS_GetArrayBufferView* APIs. Note that this m
ay
* return false if a security wrapper is encountered that denies the
* unwrapping. If this test or one of the more specific tests succeeds, the
n it
* is safe to call the various ArrayBufferView accessor JSAPI calls defined
* below. cx MUST be non-NULL and valid.
*/
extern JS_FRIEND_API(JSBool)
JS_IsArrayBufferViewObject(JSObject *obj, JSContext *cx);
/*
* Test for specific typed array types (ArrayBufferView subtypes) * Test for specific typed array types (ArrayBufferView subtypes)
*/ */
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsInt8Array(JSObject *obj, JSContext *cx); JS_IsInt8Array(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsUint8Array(JSObject *obj, JSContext *cx); JS_IsUint8Array(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsUint8ClampedArray(JSObject *obj, JSContext *cx); JS_IsUint8ClampedArray(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
skipping to change at line 990 skipping to change at line 1187
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsInt32Array(JSObject *obj, JSContext *cx); JS_IsInt32Array(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsUint32Array(JSObject *obj, JSContext *cx); JS_IsUint32Array(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsFloat32Array(JSObject *obj, JSContext *cx); JS_IsFloat32Array(JSObject *obj, JSContext *cx);
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
JS_IsFloat64Array(JSObject *obj, JSContext *cx); JS_IsFloat64Array(JSObject *obj, JSContext *cx);
/* /*
* Unwrap Typed arrays all at once. Return NULL without throwing if the obj
ect
* cannot be viewed as the correct typed array, or the typed array object o
n
* success, filling both outparameters.
*/
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsInt8Array(JSContext *cx, JSObject *obj, uint32_t *length, int
8_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsUint8Array(JSContext *cx, JSObject *obj, uint32_t *length, ui
nt8_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsUint8ClampedArray(JSContext *cx, JSObject *obj, uint32_t *len
gth, uint8_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsInt16Array(JSContext *cx, JSObject *obj, uint32_t *length, in
t16_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsUint16Array(JSContext *cx, JSObject *obj, uint32_t *length, u
int16_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsInt32Array(JSContext *cx, JSObject *obj, uint32_t *length, in
t32_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsUint32Array(JSContext *cx, JSObject *obj, uint32_t *length, u
int32_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsFloat32Array(JSContext *cx, JSObject *obj, uint32_t *length,
float **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsFloat64Array(JSContext *cx, JSObject *obj, uint32_t *length,
double **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsArrayBufferView(JSContext *cx, JSObject *obj, uint32_t *lengt
h, uint8_t **data);
extern JS_FRIEND_API(JSObject *)
JS_GetObjectAsArrayBuffer(JSContext *cx, JSObject *obj, uint32_t *length, u
int8_t **data);
/*
* Get the type of elements in a typed array. * Get the type of elements in a typed array.
* *
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or some how * |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or some how
* be known that it would pass such a test: it is a typed array or a wrappe r of * be known that it would pass such a test: it is a typed array or a wrappe r of
* a typed array, and the unwrapping will succeed. If cx is NULL, then DEBU G * a typed array, and the unwrapping will succeed. If cx is NULL, then DEBU G
* builds may be unable to assert when unwrapping should be disallowed. * builds may be unable to assert when unwrapping should be disallowed.
*/ */
extern JS_FRIEND_API(JSArrayBufferViewType) extern JS_FRIEND_API(JSArrayBufferViewType)
JS_GetTypedArrayType(JSObject *obj, JSContext *cx); JS_GetTypedArrayType(JSObject *obj, JSContext *cx);
skipping to change at line 1067 skipping to change at line 1292
* *
* |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or some how * |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or some how
* be known that it would pass such a test: it is a typed array or a wrappe r of * be known that it would pass such a test: it is a typed array or a wrappe r of
* a typed array, and the unwrapping will succeed. If cx is NULL, then DEBU G * a typed array, and the unwrapping will succeed. If cx is NULL, then DEBU G
* builds may be unable to assert when unwrapping should be disallowed. * builds may be unable to assert when unwrapping should be disallowed.
*/ */
extern JS_FRIEND_API(uint32_t) extern JS_FRIEND_API(uint32_t)
JS_GetTypedArrayByteLength(JSObject *obj, JSContext *cx); JS_GetTypedArrayByteLength(JSObject *obj, JSContext *cx);
/* /*
* Check whether obj supports JS_ArrayBufferView* APIs. Note that this may
* return false if a security wrapper is encountered that denies the
* unwrapping.
*/
extern JS_FRIEND_API(JSBool)
JS_IsArrayBufferViewObject(JSObject *obj, JSContext *cx);
/*
* More generic name for JS_GetTypedArrayByteLength to cover DataViews as w ell * More generic name for JS_GetTypedArrayByteLength to cover DataViews as w ell
*/ */
extern JS_FRIEND_API(uint32_t) extern JS_FRIEND_API(uint32_t)
JS_GetArrayBufferViewByteLength(JSObject *obj, JSContext *cx); JS_GetArrayBufferViewByteLength(JSObject *obj, JSContext *cx);
/* /*
* Return a pointer to the start of the data referenced by a typed array. T he * Return a pointer to the start of the data referenced by a typed array. T he
* data is still owned by the typed array, and should not be modified on * data is still owned by the typed array, and should not be modified on
* another thread. * another thread.
* *
skipping to change at line 1109 skipping to change at line 1342
extern JS_FRIEND_API(double *) extern JS_FRIEND_API(double *)
JS_GetFloat64ArrayData(JSObject *obj, JSContext *cx); JS_GetFloat64ArrayData(JSObject *obj, JSContext *cx);
/* /*
* Same as above, but for any kind of ArrayBufferView. Prefer the type-spec ific * Same as above, but for any kind of ArrayBufferView. Prefer the type-spec ific
* versions when possible. * versions when possible.
*/ */
extern JS_FRIEND_API(void *) extern JS_FRIEND_API(void *)
JS_GetArrayBufferViewData(JSObject *obj, JSContext *cx); JS_GetArrayBufferViewData(JSObject *obj, JSContext *cx);
/*
* Check whether obj supports JS_GetDataView* APIs. Note that this may fail
and
* throw an exception if a security wrapper is encountered that denies the
* operation.
*/
JS_FRIEND_API(JSBool)
JS_IsDataViewObject(JSContext *cx, JSObject *obj, JSBool *isDataView);
/*
* Return the byte offset of a data view into its array buffer. |obj| must
be a
* DataView.
*
* |obj| must have passed a JS_IsDataViewObject test, or somehow be known t
hat
* it would pass such a test: it is a data view or a wrapper of a data view
,
* and the unwrapping will succeed. If cx is NULL, then DEBUG builds may be
* unable to assert when unwrapping should be disallowed.
*/
JS_FRIEND_API(uint32_t)
JS_GetDataViewByteOffset(JSObject *obj, JSContext *cx);
/*
* Return the byte length of a data view.
*
* |obj| must have passed a JS_IsDataViewObject test, or somehow be known t
hat
* it would pass such a test: it is a data view or a wrapper of a data view
,
* and the unwrapping will succeed. If cx is NULL, then DEBUG builds may be
* unable to assert when unwrapping should be disallowed.
*/
JS_FRIEND_API(uint32_t)
JS_GetDataViewByteLength(JSObject *obj, JSContext *cx);
/*
* Return a pointer to the beginning of the data referenced by a DataView.
*
* |obj| must have passed a JS_IsDataViewObject test, or somehow be known t
hat
* it would pass such a test: it is a data view or a wrapper of a data view
,
* and the unwrapping will succeed. If cx is NULL, then DEBUG builds may be
* unable to assert when unwrapping should be disallowed.
*/
JS_FRIEND_API(void *)
JS_GetDataViewData(JSObject *obj, JSContext *cx);
#ifdef __cplusplus
/*
* This struct contains metadata passed from the DOM to the JS Engine for J
IT
* optimizations on DOM property accessors. Eventually, this should be made
* available to general JSAPI users, but we are not currently ready to do s
o.
*/
typedef bool
(* JSJitPropertyOp)(JSContext *cx, JSHandleObject thisObj,
void *specializedThis, JS::Value *vp);
typedef bool
(* JSJitMethodOp)(JSContext *cx, JSHandleObject thisObj,
void *specializedThis, unsigned argc, JS::Value *vp);
struct JSJitInfo {
JSJitPropertyOp op;
uint32_t protoID;
uint32_t depth;
bool isInfallible; /* Is op fallible? Getters only */
bool isConstant; /* Getting a construction-time constant? */
};
static JS_ALWAYS_INLINE const JSJitInfo *
FUNCTION_VALUE_TO_JITINFO(const JS::Value& v)
{
JS_ASSERT(js::GetObjectClass(&v.toObject()) == &js::FunctionClass);
return reinterpret_cast<js::shadow::Function *>(&v.toObject())->jitinfo
;
}
static JS_ALWAYS_INLINE void
SET_JITINFO(JSFunction * func, const JSJitInfo *info)
{
js::shadow::Function *fun = reinterpret_cast<js::shadow::Function *>(fu
nc);
/* JS_ASSERT(func->isNative()). 0x4000 is JSFUN_INTERPRETED */
JS_ASSERT(!(fun->flags & 0x4000));
fun->jitinfo = info;
}
#endif /* __cplusplus */
#endif /* jsfriendapi_h___ */ #endif /* jsfriendapi_h___ */
 End of changes. 57 change blocks. 
107 lines changed or deleted 467 lines changed or added


 jsgc.h   jsgc.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsgc_h___ #ifndef jsgc_h___
#define jsgc_h___ #define jsgc_h___
/* /*
* JS Garbage Collector. * JS Garbage Collector.
*/ */
#include <setjmp.h> #include <setjmp.h>
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "jsalloc.h" #include "jsalloc.h"
#include "jstypes.h" #include "jstypes.h"
#include "jsprvtd.h" #include "jsprvtd.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jslock.h" #include "jslock.h"
#include "jsutil.h" #include "jsutil.h"
#include "jsversion.h" #include "jsversion.h"
#include "jscell.h"
#include "ds/BitArray.h" #include "ds/BitArray.h"
#include "gc/Heap.h"
#include "gc/Statistics.h" #include "gc/Statistics.h"
#include "js/HashTable.h" #include "js/HashTable.h"
#include "js/Vector.h" #include "js/Vector.h"
#include "js/TemplateLib.h" #include "js/TemplateLib.h"
struct JSCompartment; struct JSCompartment;
extern "C" void
js_TraceXML(JSTracer *trc, JSXML* thing);
#if JS_STACK_GROWTH_DIRECTION > 0 #if JS_STACK_GROWTH_DIRECTION > 0
# define JS_CHECK_STACK_SIZE(limit, lval) ((uintptr_t)(lval) < limit) # define JS_CHECK_STACK_SIZE(limit, lval) ((uintptr_t)(lval) < limit)
#else #else
# define JS_CHECK_STACK_SIZE(limit, lval) ((uintptr_t)(lval) > limit) # define JS_CHECK_STACK_SIZE(limit, lval) ((uintptr_t)(lval) > limit)
#endif #endif
namespace js { namespace js {
class GCHelperThread; class GCHelperThread;
struct Shape; struct Shape;
struct SliceBudget;
namespace gc { namespace gc {
enum State { enum State {
NO_INCREMENTAL, NO_INCREMENTAL,
MARK_ROOTS, MARK_ROOTS,
MARK, MARK,
SWEEP,
SWEEP_END,
INVALID INVALID
}; };
struct Arena;
/*
* This must be an upper bound, but we do not need the least upper bound, s
o
* we just exclude non-background objects.
*/
const size_t MAX_BACKGROUND_FINALIZE_KINDS = FINALIZE_LIMIT - FINALIZE_OBJE
CT_LIMIT / 2;
/*
* Page size is 4096 by default, except for SPARC, where it is 8192.
* Note: Do not use JS_CPU_SPARC here, this header is used outside JS.
* Bug 692267: Move page size definition to gc/Memory.h and include it
* directly once jsgc.h is no longer an installed header.
*/
#if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
const size_t PageShift = 13;
#else
const size_t PageShift = 12;
#endif
const size_t PageSize = size_t(1) << PageShift;
const size_t ChunkShift = 20;
const size_t ChunkSize = size_t(1) << ChunkShift;
const size_t ChunkMask = ChunkSize - 1;
const size_t ArenaShift = PageShift;
const size_t ArenaSize = PageSize;
const size_t ArenaMask = ArenaSize - 1;
/*
* This is the maximum number of arenas we allow in the FreeCommitted state
* before we trigger a GC_SHRINK to release free arenas to the OS.
*/
const static uint32_t FreeCommittedArenasThreshold = (32 << 20) / ArenaSize
;
/*
* The mark bitmap has one bit per each GC cell. For multi-cell GC things t
his
* wastes space but allows to avoid expensive devisions by thing's size whe
n
* accessing the bitmap. In addition this allows to use some bits for color
ed
* marking during the cycle GC.
*/
const size_t ArenaCellCount = size_t(1) << (ArenaShift - Cell::CellShift);
const size_t ArenaBitmapBits = ArenaCellCount;
const size_t ArenaBitmapBytes = ArenaBitmapBits / 8;
const size_t ArenaBitmapWords = ArenaBitmapBits / JS_BITS_PER_WORD;
/*
* A FreeSpan represents a contiguous sequence of free cells in an Arena.
* |first| is the address of the first free cell in the span. |last| is the
* address of the last free cell in the span. This last cell holds a FreeSp
an
* data structure for the next span unless this is the last span on the lis
t
* of spans in the arena. For this last span |last| points to the last byte
of
* the last thing in the arena and no linkage is stored there, so
* |last| == arenaStart + ArenaSize - 1. If the space at the arena end is
* fully used this last span is empty and |first| == |last + 1|.
*
* Thus |first| < |last| implies that we have either the last span with at
least
* one element or that the span is not the last and contains at least 2
* elements. In both cases to allocate a thing from this span we need simpl
y
* to increment |first| by the allocation size.
*
* |first| == |last| implies that we have a one element span that records t
he
* next span. So to allocate from it we need to update the span list head
* with a copy of the span stored at |last| address so the following
* allocations will use that span.
*
* |first| > |last| implies that we have an empty last span and the arena i
s
* fully used.
*
* Also only for the last span (|last| & 1)! = 0 as all allocation sizes ar
e
* multiples of Cell::CellSize.
*/
struct FreeSpan {
uintptr_t first;
uintptr_t last;
public:
FreeSpan() {}
FreeSpan(uintptr_t first, uintptr_t last)
: first(first), last(last) {
checkSpan();
}
/*
* To minimize the size of the arena header the first span is encoded
* there as offsets from the arena start.
*/
static size_t encodeOffsets(size_t firstOffset, size_t lastOffset) {
/* Check that we can pack the offsets into uint16. */
JS_STATIC_ASSERT(ArenaShift < 16);
JS_ASSERT(firstOffset <= ArenaSize);
JS_ASSERT(lastOffset < ArenaSize);
JS_ASSERT(firstOffset <= ((lastOffset + 1) & ~size_t(1)));
return firstOffset | (lastOffset << 16);
}
/*
* Encoded offsets for a full arena when its first span is the last one
* and empty.
*/
static const size_t FullArenaOffsets = ArenaSize | ((ArenaSize - 1) <<
16);
static FreeSpan decodeOffsets(uintptr_t arenaAddr, size_t offsets) {
JS_ASSERT(!(arenaAddr & ArenaMask));
size_t firstOffset = offsets & 0xFFFF;
size_t lastOffset = offsets >> 16;
JS_ASSERT(firstOffset <= ArenaSize);
JS_ASSERT(lastOffset < ArenaSize);
/*
* We must not use | when calculating first as firstOffset is
* ArenaMask + 1 for the empty span.
*/
return FreeSpan(arenaAddr + firstOffset, arenaAddr | lastOffset);
}
void initAsEmpty(uintptr_t arenaAddr = 0) {
JS_ASSERT(!(arenaAddr & ArenaMask));
first = arenaAddr + ArenaSize;
last = arenaAddr | (ArenaSize - 1);
JS_ASSERT(isEmpty());
}
bool isEmpty() const {
checkSpan();
return first > last;
}
bool hasNext() const {
checkSpan();
return !(last & uintptr_t(1));
}
const FreeSpan *nextSpan() const {
JS_ASSERT(hasNext());
return reinterpret_cast<FreeSpan *>(last);
}
FreeSpan *nextSpanUnchecked(size_t thingSize) const {
#ifdef DEBUG
uintptr_t lastOffset = last & ArenaMask;
JS_ASSERT(!(lastOffset & 1));
JS_ASSERT((ArenaSize - lastOffset) % thingSize == 0);
#endif
return reinterpret_cast<FreeSpan *>(last);
}
uintptr_t arenaAddressUnchecked() const {
return last & ~ArenaMask;
}
uintptr_t arenaAddress() const {
checkSpan();
return arenaAddressUnchecked();
}
ArenaHeader *arenaHeader() const {
return reinterpret_cast<ArenaHeader *>(arenaAddress());
}
bool isSameNonEmptySpan(const FreeSpan *another) const {
JS_ASSERT(!isEmpty());
JS_ASSERT(!another->isEmpty());
return first == another->first && last == another->last;
}
bool isWithinArena(uintptr_t arenaAddr) const {
JS_ASSERT(!(arenaAddr & ArenaMask));
/* Return true for the last empty span as well. */
return arenaAddress() == arenaAddr;
}
size_t encodeAsOffsets() const {
/*
* We must use first - arenaAddress(), not first & ArenaMask as
* first == ArenaMask + 1 for an empty span.
*/
uintptr_t arenaAddr = arenaAddress();
return encodeOffsets(first - arenaAddr, last & ArenaMask);
}
/* See comments before FreeSpan for details. */
JS_ALWAYS_INLINE void *allocate(size_t thingSize) {
JS_ASSERT(thingSize % Cell::CellSize == 0);
checkSpan();
uintptr_t thing = first;
if (thing < last) {
/* Bump-allocate from the current span. */
first = thing + thingSize;
} else if (JS_LIKELY(thing == last)) {
/*
* Move to the next span. We use JS_LIKELY as without PGO
* compilers mis-predict == here as unlikely to succeed.
*/
*this = *reinterpret_cast<FreeSpan *>(thing);
} else {
return NULL;
}
checkSpan();
return reinterpret_cast<void *>(thing);
}
/* A version of allocate when we know that the span is not empty. */
JS_ALWAYS_INLINE void *infallibleAllocate(size_t thingSize) {
JS_ASSERT(thingSize % Cell::CellSize == 0);
checkSpan();
uintptr_t thing = first;
if (thing < last) {
first = thing + thingSize;
} else {
JS_ASSERT(thing == last);
*this = *reinterpret_cast<FreeSpan *>(thing);
}
checkSpan();
return reinterpret_cast<void *>(thing);
}
/*
* Allocate from a newly allocated arena. We do not move the free list
* from the arena. Rather we set the arena up as fully used during the
* initialization so to allocate we simply return the first thing in th
e
* arena and set the free list to point to the second.
*/
JS_ALWAYS_INLINE void *allocateFromNewArena(uintptr_t arenaAddr, size_t
firstThingOffset,
size_t thingSize) {
JS_ASSERT(!(arenaAddr & ArenaMask));
uintptr_t thing = arenaAddr | firstThingOffset;
first = thing + thingSize;
last = arenaAddr | ArenaMask;
checkSpan();
return reinterpret_cast<void *>(thing);
}
void checkSpan() const {
#ifdef DEBUG
/* We do not allow spans at the end of the address space. */
JS_ASSERT(last != uintptr_t(-1));
JS_ASSERT(first);
JS_ASSERT(last);
JS_ASSERT(first - 1 <= last);
uintptr_t arenaAddr = arenaAddressUnchecked();
if (last & 1) {
/* The span is the last. */
JS_ASSERT((last & ArenaMask) == ArenaMask);
if (first - 1 == last) {
/* The span is last and empty. The above start != 0 check
* implies that we are not at the end of the address space.
*/
return;
}
size_t spanLength = last - first + 1;
JS_ASSERT(spanLength % Cell::CellSize == 0);
/* Start and end must belong to the same arena. */
JS_ASSERT((first & ~ArenaMask) == arenaAddr);
return;
}
/* The span is not the last and we have more spans to follow. */
JS_ASSERT(first <= last);
size_t spanLengthWithoutOneThing = last - first;
JS_ASSERT(spanLengthWithoutOneThing % Cell::CellSize == 0);
JS_ASSERT((first & ~ArenaMask) == arenaAddr);
/*
* If there is not enough space before the arena end to allocate on
e
* more thing, then the span must be marked as the last one to avoi
d
* storing useless empty span reference.
*/
size_t beforeTail = ArenaSize - (last & ArenaMask);
JS_ASSERT(beforeTail >= sizeof(FreeSpan) + Cell::CellSize);
FreeSpan *next = reinterpret_cast<FreeSpan *>(last);
/*
* The GC things on the list of free spans come from one arena
* and the spans are linked in ascending address order with
* at least one non-free thing between spans.
*/
JS_ASSERT(last < next->first);
JS_ASSERT(arenaAddr == next->arenaAddressUnchecked());
if (next->first > next->last) {
/*
* The next span is the empty span that terminates the list for
* arenas that do not have any free things at the end.
*/
JS_ASSERT(next->first - 1 == next->last);
JS_ASSERT(arenaAddr + ArenaSize == next->first);
}
#endif
}
};
/* Every arena has a header. */
struct ArenaHeader {
friend struct FreeLists;
JSCompartment *compartment;
/*
* ArenaHeader::next has two purposes: when unallocated, it points to t
he
* next available Arena's header. When allocated, it points to the next
* arena of the same size class and compartment.
*/
ArenaHeader *next;
private:
/*
* The first span of free things in the arena. We encode it as the star
t
* and end offsets within the arena, not as FreeSpan structure, to
* minimize the header size.
*/
size_t firstFreeSpanOffsets;
/*
* One of AllocKind constants or FINALIZE_LIMIT when the arena does not
* contain any GC things and is on the list of empty arenas in the GC
* chunk. The latter allows to quickly check if the arena is allocated
* during the conservative GC scanning without searching the arena in t
he
* list.
*/
size_t allocKind : 8;
/*
* When recursive marking uses too much stack the marking is delayed an
d
* the corresponding arenas are put into a stack using the following fi
eld
* as a linkage. To distinguish the bottom of the stack from the arenas
* not present in the stack we use an extra flag to tag arenas on the
* stack.
*
* Delayed marking is also used for arenas that we allocate into during
an
* incremental GC. In this case, we intend to mark all the objects in t
he
* arena, and it's faster to do this marking in bulk.
*
* To minimize the ArenaHeader size we record the next delayed marking
* linkage as arenaAddress() >> ArenaShift and pack it with the allocKi
nd
* field and hasDelayedMarking flag. We use 8 bits for the allocKind, n
ot
* ArenaShift - 1, so the compiler can use byte-level memory instructio
ns
* to access it.
*/
public:
size_t hasDelayedMarking : 1;
size_t allocatedDuringIncremental : 1;
size_t markOverflow : 1;
size_t nextDelayedMarking : JS_BITS_PER_WORD - 8 - 1 - 1 - 1;
static void staticAsserts() {
/* We must be able to fit the allockind into uint8_t. */
JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255);
/*
* nextDelayedMarkingpacking assumes that ArenaShift has enough bit
s
* to cover allocKind and hasDelayedMarking.
*/
JS_STATIC_ASSERT(ArenaShift >= 8 + 1 + 1 + 1);
}
inline uintptr_t address() const;
inline Chunk *chunk() const;
bool allocated() const {
JS_ASSERT(allocKind <= size_t(FINALIZE_LIMIT));
return allocKind < size_t(FINALIZE_LIMIT);
}
void init(JSCompartment *comp, AllocKind kind) {
JS_ASSERT(!allocated());
JS_ASSERT(!markOverflow);
JS_ASSERT(!allocatedDuringIncremental);
JS_ASSERT(!hasDelayedMarking);
compartment = comp;
JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255);
allocKind = size_t(kind);
/* See comments in FreeSpan::allocateFromNewArena. */
firstFreeSpanOffsets = FreeSpan::FullArenaOffsets;
}
void setAsNotAllocated() {
allocKind = size_t(FINALIZE_LIMIT);
markOverflow = 0;
allocatedDuringIncremental = 0;
hasDelayedMarking = 0;
nextDelayedMarking = 0;
}
uintptr_t arenaAddress() const {
return address();
}
Arena *getArena() {
return reinterpret_cast<Arena *>(arenaAddress());
}
AllocKind getAllocKind() const {
JS_ASSERT(allocated());
return AllocKind(allocKind);
}
inline size_t getThingSize() const;
bool hasFreeThings() const {
return firstFreeSpanOffsets != FreeSpan::FullArenaOffsets;
}
inline bool isEmpty() const;
void setAsFullyUsed() {
firstFreeSpanOffsets = FreeSpan::FullArenaOffsets;
}
FreeSpan getFirstFreeSpan() const {
#ifdef DEBUG
checkSynchronizedWithFreeList();
#endif
return FreeSpan::decodeOffsets(arenaAddress(), firstFreeSpanOffsets
);
}
void setFirstFreeSpan(const FreeSpan *span) {
JS_ASSERT(span->isWithinArena(arenaAddress()));
firstFreeSpanOffsets = span->encodeAsOffsets();
}
#ifdef DEBUG
void checkSynchronizedWithFreeList() const;
#endif
inline ArenaHeader *getNextDelayedMarking() const;
inline void setNextDelayedMarking(ArenaHeader *aheader);
};
struct Arena {
/*
* Layout of an arena:
* An arena is 4K in size and 4K-aligned. It starts with the ArenaHeade
r
* descriptor followed by some pad bytes. The remainder of the arena is
* filled with the array of T things. The pad bytes ensure that the thi
ng
* array ends exactly at the end of the arena.
*
* +-------------+-----+----+----+-----+----+
* | ArenaHeader | pad | T0 | T1 | ... | Tn |
* +-------------+-----+----+----+-----+----+
*
* <----------------------------------------> = ArenaSize bytes
* <-------------------> = first thing offset
*/
ArenaHeader aheader;
uint8_t data[ArenaSize - sizeof(ArenaHeader)];
private:
static JS_FRIEND_DATA(const uint32_t) ThingSizes[];
static JS_FRIEND_DATA(const uint32_t) FirstThingOffsets[];
public:
static void staticAsserts();
static size_t thingSize(AllocKind kind) {
return ThingSizes[kind];
}
static size_t firstThingOffset(AllocKind kind) {
return FirstThingOffsets[kind];
}
static size_t thingsPerArena(size_t thingSize) {
JS_ASSERT(thingSize % Cell::CellSize == 0);
/* We should be able to fit FreeSpan in any GC thing. */
JS_ASSERT(thingSize >= sizeof(FreeSpan));
return (ArenaSize - sizeof(ArenaHeader)) / thingSize;
}
static size_t thingsSpan(size_t thingSize) {
return thingsPerArena(thingSize) * thingSize;
}
static bool isAligned(uintptr_t thing, size_t thingSize) {
/* Things ends at the arena end. */
uintptr_t tailOffset = (ArenaSize - thing) & ArenaMask;
return tailOffset % thingSize == 0;
}
uintptr_t address() const {
return aheader.address();
}
uintptr_t thingsStart(AllocKind thingKind) {
return address() | firstThingOffset(thingKind);
}
uintptr_t thingsEnd() {
return address() + ArenaSize;
}
template <typename T>
bool finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize);
};
/* The chunk header (located at the end of the chunk to preserve arena alig
nment). */
struct ChunkInfo {
Chunk *next;
Chunk **prevp;
/* Free arenas are linked together with aheader.next. */
ArenaHeader *freeArenasHead;
/*
* Decommitted arenas are tracked by a bitmap in the chunk header. We u
se
* this offset to start our search iteration close to a decommitted are
na
* that we can allocate.
*/
uint32_t lastDecommittedArenaOffset;
/* Number of free arenas, either committed or decommitted. */
uint32_t numArenasFree;
/* Number of free, committed arenas. */
uint32_t numArenasFreeCommitted;
/* Number of GC cycles this chunk has survived. */
uint32_t age;
};
/*
* Calculating ArenasPerChunk:
*
* In order to figure out how many Arenas will fit in a chunk, we need to k
now
* how much extra space is available after we allocate the header data. Thi
s
* is a problem because the header size depends on the number of arenas in
the
* chunk. The two dependent fields are bitmap and decommittedArenas.
*
* For the mark bitmap, we know that each arena will use a fixed number of
full
* bytes: ArenaBitmapBytes. The full size of the header data is this number
* multiplied by the eventual number of arenas we have in the header. We,
* conceptually, distribute this header data among the individual arenas an
d do
* not include it in the header. This way we do not have to worry about its
* variable size: it gets attached to the variable number we are computing.
*
* For the decommitted arena bitmap, we only have 1 bit per arena, so this
* technique will not work. Instead, we observe that we do not have enough
* header info to fill 8 full arenas: it is currently 4 on 64bit, less on
* 32bit. Thus, with current numbers, we need 64 bytes for decommittedArena
s.
* This will not become 63 bytes unless we double the data required in the
* header. Therefore, we just compute the number of bytes required to track
* every possible arena and do not worry about slop bits, since there are t
oo
* few to usefully allocate.
*
* To actually compute the number of arenas we can allocate in a chunk, we
* divide the amount of available space less the header info (not including
* the mark bitmap which is distributed into the arena size) by the size of
* the arena (with the mark bitmap bytes it uses).
*/
const size_t BytesPerArenaWithHeader = ArenaSize + ArenaBitmapBytes;
const size_t ChunkDecommitBitmapBytes = ChunkSize / ArenaSize / JS_BITS_PER
_BYTE;
const size_t ChunkBytesAvailable = ChunkSize - sizeof(ChunkInfo) - ChunkDec
ommitBitmapBytes;
const size_t ArenasPerChunk = ChunkBytesAvailable / BytesPerArenaWithHeader
;
/* A chunk bitmap contains enough mark bits for all the cells in a chunk. *
/
struct ChunkBitmap {
uintptr_t bitmap[ArenaBitmapWords * ArenasPerChunk];
JS_ALWAYS_INLINE void getMarkWordAndMask(const Cell *cell, uint32_t col
or,
uintptr_t **wordp, uintptr_t *
maskp);
JS_ALWAYS_INLINE bool isMarked(const Cell *cell, uint32_t color) {
uintptr_t *word, mask;
getMarkWordAndMask(cell, color, &word, &mask);
return *word & mask;
}
JS_ALWAYS_INLINE bool markIfUnmarked(const Cell *cell, uint32_t color)
{
uintptr_t *word, mask;
getMarkWordAndMask(cell, BLACK, &word, &mask);
if (*word & mask)
return false;
*word |= mask;
if (color != BLACK) {
/*
* We use getMarkWordAndMask to recalculate both mask and word
as
* doing just mask << color may overflow the mask.
*/
getMarkWordAndMask(cell, color, &word, &mask);
if (*word & mask)
return false;
*word |= mask;
}
return true;
}
JS_ALWAYS_INLINE void unmark(const Cell *cell, uint32_t color) {
uintptr_t *word, mask;
getMarkWordAndMask(cell, color, &word, &mask);
*word &= ~mask;
}
void clear() {
PodArrayZero(bitmap);
}
#ifdef DEBUG
bool noBitsSet(ArenaHeader *aheader) {
/*
* We assume that the part of the bitmap corresponding to the arena
* has the exact number of words so we do not need to deal with a w
ord
* that covers bits from two arenas.
*/
JS_STATIC_ASSERT(ArenaBitmapBits == ArenaBitmapWords * JS_BITS_PER_
WORD);
uintptr_t *word, unused;
getMarkWordAndMask(reinterpret_cast<Cell *>(aheader->address()), BL
ACK, &word, &unused);
for (size_t i = 0; i != ArenaBitmapWords; i++) {
if (word[i])
return false;
}
return true;
}
#endif
};
JS_STATIC_ASSERT(ArenaBitmapBytes * ArenasPerChunk == sizeof(ChunkBitmap));
typedef BitArray<ArenasPerChunk> PerArenaBitmap;
const size_t ChunkPadSize = ChunkSize
- (sizeof(Arena) * ArenasPerChunk)
- sizeof(ChunkBitmap)
- sizeof(PerArenaBitmap)
- sizeof(ChunkInfo);
JS_STATIC_ASSERT(ChunkPadSize < BytesPerArenaWithHeader);
/*
* Chunks contain arenas and associated data structures (mark bitmap, delay
ed
* marking state).
*/
struct Chunk {
Arena arenas[ArenasPerChunk];
/* Pad to full size to ensure cache alignment of ChunkInfo. */
uint8_t padding[ChunkPadSize];
ChunkBitmap bitmap;
PerArenaBitmap decommittedArenas;
ChunkInfo info;
static Chunk *fromAddress(uintptr_t addr) {
addr &= ~ChunkMask;
return reinterpret_cast<Chunk *>(addr);
}
static bool withinArenasRange(uintptr_t addr) {
uintptr_t offset = addr & ChunkMask;
return offset < ArenasPerChunk * ArenaSize;
}
static size_t arenaIndex(uintptr_t addr) {
JS_ASSERT(withinArenasRange(addr));
return (addr & ChunkMask) >> ArenaShift;
}
uintptr_t address() const {
uintptr_t addr = reinterpret_cast<uintptr_t>(this);
JS_ASSERT(!(addr & ChunkMask));
return addr;
}
bool unused() const {
return info.numArenasFree == ArenasPerChunk;
}
bool hasAvailableArenas() const {
return info.numArenasFree != 0;
}
inline void addToAvailableList(JSCompartment *compartment);
inline void insertToAvailableList(Chunk **insertPoint);
inline void removeFromAvailableList();
ArenaHeader *allocateArena(JSCompartment *comp, AllocKind kind);
void releaseArena(ArenaHeader *aheader);
static Chunk *allocate(JSRuntime *rt);
/* Must be called with the GC lock taken. */
static inline void release(JSRuntime *rt, Chunk *chunk);
static inline void releaseList(JSRuntime *rt, Chunk *chunkListHead);
/* Must be called with the GC lock taken. */
inline void prepareToBeFreed(JSRuntime *rt);
/*
* Assuming that the info.prevp points to the next field of the previou
s
* chunk in a doubly-linked list, get that chunk.
*/
Chunk *getPrevious() {
JS_ASSERT(info.prevp);
return fromPointerToNext(info.prevp);
}
/* Get the chunk from a pointer to its info.next field. */
static Chunk *fromPointerToNext(Chunk **nextFieldPtr) {
uintptr_t addr = reinterpret_cast<uintptr_t>(nextFieldPtr);
JS_ASSERT((addr & ChunkMask) == offsetof(Chunk, info.next));
return reinterpret_cast<Chunk *>(addr - offsetof(Chunk, info.next))
;
}
private:
inline void init();
/* Search for a decommitted arena to allocate. */
unsigned findDecommittedArenaOffset();
ArenaHeader* fetchNextDecommittedArena();
public:
/* Unlink and return the freeArenasHead. */
inline ArenaHeader* fetchNextFreeArena(JSRuntime *rt);
inline void addArenaToFreeList(JSRuntime *rt, ArenaHeader *aheader);
};
JS_STATIC_ASSERT(sizeof(Chunk) == ChunkSize);
class ChunkPool { class ChunkPool {
Chunk *emptyChunkListHead; Chunk *emptyChunkListHead;
size_t emptyCount; size_t emptyCount;
public: public:
ChunkPool() ChunkPool()
: emptyChunkListHead(NULL), : emptyChunkListHead(NULL),
emptyCount(0) { } emptyCount(0) { }
size_t getEmptyCount() const { size_t getEmptyCount() const {
skipping to change at line 850 skipping to change at line 86
inline void put(Chunk *chunk); inline void put(Chunk *chunk);
/* /*
* Return the list of chunks that can be released outside the GC lock. * Return the list of chunks that can be released outside the GC lock.
* Must be called either during the GC or with the GC lock taken. * Must be called either during the GC or with the GC lock taken.
*/ */
Chunk *expire(JSRuntime *rt, bool releaseAll); Chunk *expire(JSRuntime *rt, bool releaseAll);
/* Must be called with the GC lock taken. */ /* Must be called with the GC lock taken. */
void expireAndFree(JSRuntime *rt, bool releaseAll); void expireAndFree(JSRuntime *rt, bool releaseAll);
/* Must be called either during the GC or with the GC lock taken. */
JS_FRIEND_API(int64_t) countCleanDecommittedArenas(JSRuntime *rt);
}; };
inline uintptr_t
Cell::address() const
{
uintptr_t addr = uintptr_t(this);
JS_ASSERT(addr % Cell::CellSize == 0);
JS_ASSERT(Chunk::withinArenasRange(addr));
return addr;
}
inline ArenaHeader *
Cell::arenaHeader() const
{
uintptr_t addr = address();
addr &= ~ArenaMask;
return reinterpret_cast<ArenaHeader *>(addr);
}
Chunk *
Cell::chunk() const
{
uintptr_t addr = uintptr_t(this);
JS_ASSERT(addr % Cell::CellSize == 0);
addr &= ~(ChunkSize - 1);
return reinterpret_cast<Chunk *>(addr);
}
AllocKind
Cell::getAllocKind() const
{
return arenaHeader()->getAllocKind();
}
#ifdef DEBUG
inline bool
Cell::isAligned() const
{
return Arena::isAligned(address(), arenaHeader()->getThingSize());
}
#endif
inline uintptr_t
ArenaHeader::address() const
{
uintptr_t addr = reinterpret_cast<uintptr_t>(this);
JS_ASSERT(!(addr & ArenaMask));
JS_ASSERT(Chunk::withinArenasRange(addr));
return addr;
}
inline Chunk *
ArenaHeader::chunk() const
{
return Chunk::fromAddress(address());
}
inline bool
ArenaHeader::isEmpty() const
{
/* Arena is empty if its first span covers the whole arena. */
JS_ASSERT(allocated());
size_t firstThingOffset = Arena::firstThingOffset(getAllocKind());
return firstFreeSpanOffsets == FreeSpan::encodeOffsets(firstThingOffset
, ArenaMask);
}
inline size_t
ArenaHeader::getThingSize() const
{
JS_ASSERT(allocated());
return Arena::thingSize(getAllocKind());
}
inline ArenaHeader *
ArenaHeader::getNextDelayedMarking() const
{
return &reinterpret_cast<Arena *>(nextDelayedMarking << ArenaShift)->ah
eader;
}
inline void
ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader)
{
JS_ASSERT(!(uintptr_t(aheader) & ArenaMask));
hasDelayedMarking = 1;
nextDelayedMarking = aheader->arenaAddress() >> ArenaShift;
}
JS_ALWAYS_INLINE void
ChunkBitmap::getMarkWordAndMask(const Cell *cell, uint32_t color,
uintptr_t **wordp, uintptr_t *maskp)
{
size_t bit = (cell->address() & ChunkMask) / Cell::CellSize + color;
JS_ASSERT(bit < ArenaBitmapBits * ArenasPerChunk);
*maskp = uintptr_t(1) << (bit % JS_BITS_PER_WORD);
*wordp = &bitmap[bit / JS_BITS_PER_WORD];
}
static void
AssertValidColor(const void *thing, uint32_t color)
{
#ifdef DEBUG
ArenaHeader *aheader = reinterpret_cast<const js::gc::Cell *>(thing)->a
renaHeader();
JS_ASSERT_IF(color, color < aheader->getThingSize() / Cell::CellSize);
#endif
}
inline bool
Cell::isMarked(uint32_t color) const
{
AssertValidColor(this, color);
return chunk()->bitmap.isMarked(this, color);
}
bool
Cell::markIfUnmarked(uint32_t color) const
{
AssertValidColor(this, color);
return chunk()->bitmap.markIfUnmarked(this, color);
}
void
Cell::unmark(uint32_t color) const
{
JS_ASSERT(color != BLACK);
AssertValidColor(this, color);
chunk()->bitmap.unmark(this, color);
}
JSCompartment *
Cell::compartment() const
{
return arenaHeader()->compartment;
}
static inline JSGCTraceKind static inline JSGCTraceKind
MapAllocToTraceKind(AllocKind thingKind) MapAllocToTraceKind(AllocKind thingKind)
{ {
static const JSGCTraceKind map[FINALIZE_LIMIT] = { static const JSGCTraceKind map[FINALIZE_LIMIT] = {
JSTRACE_OBJECT, /* FINALIZE_OBJECT0 */ JSTRACE_OBJECT, /* FINALIZE_OBJECT0 */
JSTRACE_OBJECT, /* FINALIZE_OBJECT0_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT0_BACKGROUND */
JSTRACE_OBJECT, /* FINALIZE_OBJECT2 */ JSTRACE_OBJECT, /* FINALIZE_OBJECT2 */
JSTRACE_OBJECT, /* FINALIZE_OBJECT2_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT2_BACKGROUND */
JSTRACE_OBJECT, /* FINALIZE_OBJECT4 */ JSTRACE_OBJECT, /* FINALIZE_OBJECT4 */
JSTRACE_OBJECT, /* FINALIZE_OBJECT4_BACKGROUND */ JSTRACE_OBJECT, /* FINALIZE_OBJECT4_BACKGROUND */
skipping to change at line 1017 skipping to change at line 118
#if JS_HAS_XML_SUPPORT /* FINALIZE_XML */ #if JS_HAS_XML_SUPPORT /* FINALIZE_XML */
JSTRACE_XML, JSTRACE_XML,
#endif #endif
JSTRACE_STRING, /* FINALIZE_SHORT_STRING */ JSTRACE_STRING, /* FINALIZE_SHORT_STRING */
JSTRACE_STRING, /* FINALIZE_STRING */ JSTRACE_STRING, /* FINALIZE_STRING */
JSTRACE_STRING, /* FINALIZE_EXTERNAL_STRING */ JSTRACE_STRING, /* FINALIZE_EXTERNAL_STRING */
}; };
return map[thingKind]; return map[thingKind];
} }
static inline bool
IsNurseryAllocable(AllocKind kind)
{
JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT);
static const bool map[FINALIZE_LIMIT] = {
false, /* FINALIZE_OBJECT0 */
true, /* FINALIZE_OBJECT0_BACKGROUND */
false, /* FINALIZE_OBJECT2 */
true, /* FINALIZE_OBJECT2_BACKGROUND */
false, /* FINALIZE_OBJECT4 */
true, /* FINALIZE_OBJECT4_BACKGROUND */
false, /* FINALIZE_OBJECT8 */
true, /* FINALIZE_OBJECT8_BACKGROUND */
false, /* FINALIZE_OBJECT12 */
true, /* FINALIZE_OBJECT12_BACKGROUND */
false, /* FINALIZE_OBJECT16 */
true, /* FINALIZE_OBJECT16_BACKGROUND */
false, /* FINALIZE_SCRIPT */
false, /* FINALIZE_SHAPE */
false, /* FINALIZE_BASE_SHAPE */
false, /* FINALIZE_TYPE_OBJECT */
#if JS_HAS_XML_SUPPORT
false, /* FINALIZE_XML */
#endif
true, /* FINALIZE_SHORT_STRING */
true, /* FINALIZE_STRING */
false /* FINALIZE_EXTERNAL_STRING */
};
return map[kind];
}
static inline bool
IsBackgroundFinalized(AllocKind kind)
{
JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT);
static const bool map[FINALIZE_LIMIT] = {
false, /* FINALIZE_OBJECT0 */
true, /* FINALIZE_OBJECT0_BACKGROUND */
false, /* FINALIZE_OBJECT2 */
true, /* FINALIZE_OBJECT2_BACKGROUND */
false, /* FINALIZE_OBJECT4 */
true, /* FINALIZE_OBJECT4_BACKGROUND */
false, /* FINALIZE_OBJECT8 */
true, /* FINALIZE_OBJECT8_BACKGROUND */
false, /* FINALIZE_OBJECT12 */
true, /* FINALIZE_OBJECT12_BACKGROUND */
false, /* FINALIZE_OBJECT16 */
true, /* FINALIZE_OBJECT16_BACKGROUND */
false, /* FINALIZE_SCRIPT */
false, /* FINALIZE_SHAPE */
false, /* FINALIZE_BASE_SHAPE */
false, /* FINALIZE_TYPE_OBJECT */
#if JS_HAS_XML_SUPPORT
false, /* FINALIZE_XML */
#endif
true, /* FINALIZE_SHORT_STRING */
true, /* FINALIZE_STRING */
false /* FINALIZE_EXTERNAL_STRING */
};
return map[kind];
}
inline JSGCTraceKind inline JSGCTraceKind
GetGCThingTraceKind(const void *thing); GetGCThingTraceKind(const void *thing);
struct ArenaLists { /*
* ArenaList::head points to the start of the list. Normally cursor points
* to the first arena in the list with some free things and all arenas
* before cursor are fully allocated. However, as the arena currently being
* allocated from is considered full while its list of free spans is moved
* into the freeList, during the GC or cell enumeration, when an
* unallocated freeList is moved back to the arena, we can see an arena
* with some free cells before the cursor. The cursor is an indirect
* pointer to allow for efficient list insertion at the cursor point and
* other list manipulations.
*/
struct ArenaList {
ArenaHeader *head;
ArenaHeader **cursor;
/* ArenaList() {
* ArenaList::head points to the start of the list. Normally cursor poi clear();
nts }
* to the first arena in the list with some free things and all arenas
* before cursor are fully allocated. However, as the arena currently b
eing
* allocated from is considered full while its list of free spans is mo
ved
* into the freeList, during the GC or cell enumeration, when an
* unallocated freeList is moved back to the arena, we can see an arena
* with some free cells before the cursor. The cursor is an indirect
* pointer to allow for efficient list insertion at the cursor point an
d
* other list manipulations.
*/
struct ArenaList {
ArenaHeader *head;
ArenaHeader **cursor;
ArenaList() { void clear() {
clear(); head = NULL;
} cursor = &head;
}
void clear() { void insert(ArenaHeader *arena);
head = NULL; };
cursor = &head;
} struct ArenaLists {
};
private: private:
/* /*
* For each arena kind its free list is represented as the first span w ith * For each arena kind its free list is represented as the first span w ith
* free things. Initially all the spans are initialized as empty. After we * free things. Initially all the spans are initialized as empty. After we
* find a new arena with available things we move its first free span i nto * find a new arena with available things we move its first free span i nto
* the list and set the arena as fully allocated. way we do not need to * the list and set the arena as fully allocated. way we do not need to
* update the arena header after the initial allocation. When starting the * update the arena header after the initial allocation. When starting the
* GC we only move the head of the of the list of spans back to the are na * GC we only move the head of the of the list of spans back to the are na
* only for the arena that was not fully allocated. * only for the arena that was not fully allocated.
*/ */
FreeSpan freeLists[FINALIZE_LIMIT]; FreeSpan freeLists[FINALIZE_LIMIT];
ArenaList arenaLists[FINALIZE_LIMIT]; ArenaList arenaLists[FINALIZE_LIMIT];
#ifdef JS_THREADSAFE
/* /*
* The background finalization adds the finalized arenas to the list at * The background finalization adds the finalized arenas to the list at
* the *cursor position. backgroundFinalizeState controls the interacti on * the *cursor position. backgroundFinalizeState controls the interacti on
* between the GC lock and the access to the list from the allocation * between the GC lock and the access to the list from the allocation
* thread. * thread.
* *
* BFS_DONE indicates that the finalizations is not running or cannot * BFS_DONE indicates that the finalizations is not running or cannot
* affect this arena list. The allocation thread can access the list * affect this arena list. The allocation thread can access the list
* outside the GC lock. * outside the GC lock.
* *
skipping to change at line 1085 skipping to change at line 249
* that case the lock effectively serves as a read barrier to ensure th at * that case the lock effectively serves as a read barrier to ensure th at
* the allocation thread see all the writes done during finalization. * the allocation thread see all the writes done during finalization.
*/ */
enum BackgroundFinalizeState { enum BackgroundFinalizeState {
BFS_DONE, BFS_DONE,
BFS_RUN, BFS_RUN,
BFS_JUST_FINISHED BFS_JUST_FINISHED
}; };
volatile uintptr_t backgroundFinalizeState[FINALIZE_LIMIT]; volatile uintptr_t backgroundFinalizeState[FINALIZE_LIMIT];
#endif
public:
/* For each arena kind, a list of arenas remaining to be swept. */
ArenaHeader *arenaListsToSweep[FINALIZE_LIMIT];
public: public:
ArenaLists() { ArenaLists() {
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) for (size_t i = 0; i != FINALIZE_LIMIT; ++i)
freeLists[i].initAsEmpty(); freeLists[i].initAsEmpty();
#ifdef JS_THREADSAFE
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) for (size_t i = 0; i != FINALIZE_LIMIT; ++i)
backgroundFinalizeState[i] = BFS_DONE; backgroundFinalizeState[i] = BFS_DONE;
#endif for (size_t i = 0; i != FINALIZE_LIMIT; ++i)
arenaListsToSweep[i] = NULL;
} }
~ArenaLists() { ~ArenaLists() {
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) {
#ifdef JS_THREADSAFE
/* /*
* We can only call this during the shutdown after the last GC when * We can only call this during the shutdown after the last GC when
* the background finalization is disabled. * the background finalization is disabled.
*/ */
JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE); JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE);
#endif
ArenaHeader **headp = &arenaLists[i].head; ArenaHeader **headp = &arenaLists[i].head;
while (ArenaHeader *aheader = *headp) { while (ArenaHeader *aheader = *headp) {
*headp = aheader->next; *headp = aheader->next;
aheader->chunk()->releaseArena(aheader); aheader->chunk()->releaseArena(aheader);
} }
} }
} }
const FreeSpan *getFreeList(AllocKind thingKind) const { const FreeSpan *getFreeList(AllocKind thingKind) const {
return &freeLists[thingKind]; return &freeLists[thingKind];
} }
ArenaHeader *getFirstArena(AllocKind thingKind) const { ArenaHeader *getFirstArena(AllocKind thingKind) const {
return arenaLists[thingKind].head; return arenaLists[thingKind].head;
} }
ArenaHeader *getFirstArenaToSweep(AllocKind thingKind) const {
return arenaListsToSweep[thingKind];
}
bool arenaListsAreEmpty() const { bool arenaListsAreEmpty() const {
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) {
#ifdef JS_THREADSAFE
/* /*
* The arena cannot be empty if the background finalization is not yet * The arena cannot be empty if the background finalization is not yet
* done. * done.
*/ */
if (backgroundFinalizeState[i] != BFS_DONE) if (backgroundFinalizeState[i] != BFS_DONE)
return false; return false;
#endif
if (arenaLists[i].head) if (arenaLists[i].head)
return false; return false;
} }
return true; return true;
} }
#ifdef DEBUG bool arenasAreFull(AllocKind thingKind) const {
bool checkArenaListAllUnmarked() const { return !*arenaLists[thingKind].cursor;
}
void unmarkAll() {
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) {
# ifdef JS_THREADSAFE
/* The background finalization must have stopped at this point. */ /* The background finalization must have stopped at this point. */
JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE || JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE ||
backgroundFinalizeState[i] == BFS_JUST_FINISHED); backgroundFinalizeState[i] == BFS_JUST_FINISHED);
# endif
for (ArenaHeader *aheader = arenaLists[i].head; aheader; aheade r = aheader->next) { for (ArenaHeader *aheader = arenaLists[i].head; aheader; aheade r = aheader->next) {
if (!aheader->chunk()->bitmap.noBitsSet(aheader)) uintptr_t *word = aheader->chunk()->bitmap.arenaBits(aheade
return false; r);
memset(word, 0, ArenaBitmapWords * sizeof(uintptr_t));
} }
} }
return true;
} }
#endif
#ifdef JS_THREADSAFE
bool doneBackgroundFinalize(AllocKind kind) const { bool doneBackgroundFinalize(AllocKind kind) const {
return backgroundFinalizeState[kind] == BFS_DONE; return backgroundFinalizeState[kind] == BFS_DONE ||
backgroundFinalizeState[kind] == BFS_JUST_FINISHED;
} }
#endif
/* /*
* Return the free list back to the arena so the GC finalization will n ot * Return the free list back to the arena so the GC finalization will n ot
* run the finalizers over unitialized bytes from free things. * run the finalizers over unitialized bytes from free things.
*/ */
void purge() { void purge() {
for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) {
FreeSpan *headSpan = &freeLists[i]; FreeSpan *headSpan = &freeLists[i];
if (!headSpan->isEmpty()) { if (!headSpan->isEmpty()) {
ArenaHeader *aheader = headSpan->arenaHeader(); ArenaHeader *aheader = headSpan->arenaHeader();
skipping to change at line 1252 skipping to change at line 417
#ifdef DEBUG #ifdef DEBUG
for (size_t i = 0; i < mozilla::ArrayLength(freeLists); ++i) for (size_t i = 0; i < mozilla::ArrayLength(freeLists); ++i)
JS_ASSERT(freeLists[i].isEmpty()); JS_ASSERT(freeLists[i].isEmpty());
#endif #endif
} }
void checkEmptyFreeList(AllocKind kind) { void checkEmptyFreeList(AllocKind kind) {
JS_ASSERT(freeLists[kind].isEmpty()); JS_ASSERT(freeLists[kind].isEmpty());
} }
void finalizeObjects(FreeOp *fop); void queueObjectsForSweep(FreeOp *fop);
void finalizeStrings(FreeOp *fop); void queueStringsForSweep(FreeOp *fop);
void finalizeShapes(FreeOp *fop); void queueShapesForSweep(FreeOp *fop);
void finalizeScripts(FreeOp *fop); void queueScriptsForSweep(FreeOp *fop);
#ifdef JS_THREADSAFE bool foregroundFinalize(FreeOp *fop, AllocKind thingKind, SliceBudget &
static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead); sliceBudget);
#endif static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool
onBackgroundThread);
private: private:
inline void finalizeNow(FreeOp *fop, AllocKind thingKind); inline void finalizeNow(FreeOp *fop, AllocKind thingKind);
inline void finalizeLater(FreeOp *fop, AllocKind thingKind); inline void queueForForegroundSweep(FreeOp *fop, AllocKind thingKind);
inline void queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind);
inline void *allocateFromArena(JSCompartment *comp, AllocKind thingKind ); inline void *allocateFromArena(JSCompartment *comp, AllocKind thingKind );
}; };
/* /*
* Initial allocation size for data structures holding chunks is set to hol d * Initial allocation size for data structures holding chunks is set to hol d
* chunks with total capacity of 16MB to avoid buffer resizes during browse r * chunks with total capacity of 16MB to avoid buffer resizes during browse r
* startup. * startup.
*/ */
const size_t INITIAL_CHUNK_CAPACITY = 16 * 1024 * 1024 / ChunkSize; const size_t INITIAL_CHUNK_CAPACITY = 16 * 1024 * 1024 / ChunkSize;
skipping to change at line 1350 skipping to change at line 515
size_t count; size_t count;
void **array; void **array;
} JSPtrTable; } JSPtrTable;
extern JSBool extern JSBool
js_LockGCThingRT(JSRuntime *rt, void *thing); js_LockGCThingRT(JSRuntime *rt, void *thing);
extern void extern void
js_UnlockGCThingRT(JSRuntime *rt, void *thing); js_UnlockGCThingRT(JSRuntime *rt, void *thing);
extern JS_FRIEND_API(bool)
IsAboutToBeFinalized(const js::gc::Cell *thing);
extern bool
IsAboutToBeFinalized(const js::Value &value);
extern bool extern bool
js_IsAddressableGCThing(JSRuntime *rt, uintptr_t w, js::gc::AllocKind *thin gKind, void **thing); js_IsAddressableGCThing(JSRuntime *rt, uintptr_t w, js::gc::AllocKind *thin gKind, void **thing);
namespace js { namespace js {
extern void extern void
MarkCompartmentActive(js::StackFrame *fp); MarkCompartmentActive(js::StackFrame *fp);
extern void extern void
TraceRuntime(JSTracer *trc); TraceRuntime(JSTracer *trc);
skipping to change at line 1385 skipping to change at line 544
extern void extern void
TriggerCompartmentGC(JSCompartment *comp, js::gcreason::Reason reason); TriggerCompartmentGC(JSCompartment *comp, js::gcreason::Reason reason);
extern void extern void
MaybeGC(JSContext *cx); MaybeGC(JSContext *cx);
extern void extern void
ShrinkGCBuffers(JSRuntime *rt); ShrinkGCBuffers(JSRuntime *rt);
extern void extern void
ReleaseAllJITCode(FreeOp *op);
extern JS_FRIEND_API(void)
PrepareForFullGC(JSRuntime *rt); PrepareForFullGC(JSRuntime *rt);
/* /*
* Kinds of js_GC invocation. * Kinds of js_GC invocation.
*/ */
typedef enum JSGCInvocationKind { typedef enum JSGCInvocationKind {
/* Normal invocation. */ /* Normal invocation. */
GC_NORMAL = 0, GC_NORMAL = 0,
/* Minimize GC triggers and release empty GC chunks right away. */ /* Minimize GC triggers and release empty GC chunks right away. */
GC_SHRINK = 1 GC_SHRINK = 1
} JSGCInvocationKind; } JSGCInvocationKind;
extern void extern void
GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason);
extern void extern void
GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reas GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reas
on); on, int64_t millis = 0);
extern void
GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason
reason);
extern void extern void
GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount); GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount);
extern void extern void
PrepareForDebugGC(JSRuntime *rt); PrepareForDebugGC(JSRuntime *rt);
} /* namespace js */ } /* namespace js */
namespace js { namespace js {
void void
InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback); InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
#ifdef JS_THREADSAFE /*
* Helper that implements sweeping and allocation for kinds that can be swe
pt
* and allocated off the main thread.
*
* In non-threadsafe builds, all actual sweeping and allocation is performe
d
* on the main thread, but GCHelperThread encapsulates this from clients as
* much as possible.
*/
class GCHelperThread { class GCHelperThread {
enum State { enum State {
IDLE, IDLE,
SWEEPING, SWEEPING,
ALLOCATING, ALLOCATING,
CANCEL_ALLOCATION, CANCEL_ALLOCATION,
SHUTDOWN SHUTDOWN
}; };
/* /*
skipping to change at line 1454 skipping to change at line 625
PRCondVar *done; PRCondVar *done;
volatile State state; volatile State state;
bool sweepFlag; bool sweepFlag;
bool shrinkFlag; bool shrinkFlag;
Vector<void **, 16, js::SystemAllocPolicy> freeVector; Vector<void **, 16, js::SystemAllocPolicy> freeVector;
void **freeCursor; void **freeCursor;
void **freeCursorEnd; void **freeCursorEnd;
Vector<js::gc::ArenaHeader *, 64, js::SystemAllocPolicy> finalizeVector
;
bool backgroundAllocation; bool backgroundAllocation;
friend struct js::gc::ArenaLists; friend struct js::gc::ArenaLists;
JS_FRIEND_API(void) JS_FRIEND_API(void)
replenishAndFreeLater(void *ptr); replenishAndFreeLater(void *ptr);
static void freeElementsAndArray(void **array, void **end) { static void freeElementsAndArray(void **array, void **end) {
JS_ASSERT(array <= end); JS_ASSERT(array <= end);
for (void **p = array; p != end; ++p) for (void **p = array; p != end; ++p)
skipping to change at line 1499 skipping to change at line 668
bool init(); bool init();
void finish(); void finish();
/* Must be called with the GC lock taken. */ /* Must be called with the GC lock taken. */
void startBackgroundSweep(bool shouldShrink); void startBackgroundSweep(bool shouldShrink);
/* Must be called with the GC lock taken. */ /* Must be called with the GC lock taken. */
void startBackgroundShrink(); void startBackgroundShrink();
/* Must be called with the GC lock taken. */ /* Must be called without the GC lock taken. */
void waitBackgroundSweepEnd(); void waitBackgroundSweepEnd();
/* Must be called with the GC lock taken. */ /* Must be called without the GC lock taken. */
void waitBackgroundSweepOrAllocEnd(); void waitBackgroundSweepOrAllocEnd();
/* Must be called with the GC lock taken. */ /* Must be called with the GC lock taken. */
inline void startBackgroundAllocationIfIdle(); inline void startBackgroundAllocationIfIdle();
bool canBackgroundAllocate() const { bool canBackgroundAllocate() const {
return backgroundAllocation; return backgroundAllocation;
} }
void disableBackgroundAllocation() { void disableBackgroundAllocation() {
skipping to change at line 1540 skipping to change at line 709
return shrinkFlag; return shrinkFlag;
} }
void freeLater(void *ptr) { void freeLater(void *ptr) {
JS_ASSERT(!sweeping()); JS_ASSERT(!sweeping());
if (freeCursor != freeCursorEnd) if (freeCursor != freeCursorEnd)
*freeCursor++ = ptr; *freeCursor++ = ptr;
else else
replenishAndFreeLater(ptr); replenishAndFreeLater(ptr);
} }
/* Must be called with the GC lock taken. */
bool prepareForBackgroundSweep();
}; };
#endif /* JS_THREADSAFE */
struct GCChunkHasher { struct GCChunkHasher {
typedef gc::Chunk *Lookup; typedef gc::Chunk *Lookup;
/* /*
* Strip zeros for better distribution after multiplying by the golden * Strip zeros for better distribution after multiplying by the golden
* ratio. * ratio.
*/ */
static HashNumber hash(gc::Chunk *chunk) { static HashNumber hash(gc::Chunk *chunk) {
JS_ASSERT(!(uintptr_t(chunk) & gc::ChunkMask)); JS_ASSERT(!(uintptr_t(chunk) & gc::ChunkMask));
return HashNumber(uintptr_t(chunk) >> gc::ChunkShift); return HashNumber(uintptr_t(chunk) >> gc::ChunkShift);
skipping to change at line 1759 skipping to change at line 923
/* /*
* We use a common mark stack to mark GC things of different types and use * We use a common mark stack to mark GC things of different types and use
* the explicit tags to distinguish them when it cannot be deduced from * the explicit tags to distinguish them when it cannot be deduced from
* the context of push or pop operation. * the context of push or pop operation.
*/ */
enum StackTag { enum StackTag {
ValueArrayTag, ValueArrayTag,
ObjectTag, ObjectTag,
TypeTag, TypeTag,
XmlTag, XmlTag,
ArenaTag,
SavedValueArrayTag, SavedValueArrayTag,
LastTag = SavedValueArrayTag LastTag = SavedValueArrayTag
}; };
static const uintptr_t StackTagMask = 7; static const uintptr_t StackTagMask = 7;
static void staticAsserts() { static void staticAsserts() {
JS_STATIC_ASSERT(StackTagMask >= uintptr_t(LastTag)); JS_STATIC_ASSERT(StackTagMask >= uintptr_t(LastTag));
JS_STATIC_ASSERT(StackTagMask <= gc::Cell::CellMask); JS_STATIC_ASSERT(StackTagMask <= gc::Cell::CellMask);
} }
skipping to change at line 1785 skipping to change at line 950
size_t sizeLimit() const { return stack.sizeLimit; } size_t sizeLimit() const { return stack.sizeLimit; }
void start(JSRuntime *rt); void start(JSRuntime *rt);
void stop(); void stop();
void reset(); void reset();
void pushObject(JSObject *obj) { void pushObject(JSObject *obj) {
pushTaggedPtr(ObjectTag, obj); pushTaggedPtr(ObjectTag, obj);
} }
void pushArenaList(gc::ArenaHeader *firstArena) {
pushTaggedPtr(ArenaTag, firstArena);
}
void pushType(types::TypeObject *type) { void pushType(types::TypeObject *type) {
pushTaggedPtr(TypeTag, type); pushTaggedPtr(TypeTag, type);
} }
#if JS_HAS_XML_SUPPORT
void pushXML(JSXML *xml) { void pushXML(JSXML *xml) {
pushTaggedPtr(XmlTag, xml); pushTaggedPtr(XmlTag, xml);
} }
#endif
uint32_t getMarkColor() const { uint32_t getMarkColor() const {
return color; return color;
} }
/* /*
* The only valid color transition during a GC is from black to gray. I t is * The only valid color transition during a GC is from black to gray. I t is
* wrong to switch the mark color from gray to black. The reason is tha t the * wrong to switch the mark color from gray to black. The reason is tha t the
* cycle collector depends on the invariant that there are no black to gray * cycle collector depends on the invariant that there are no black to gray
* edges in the GC heap. This invariant lets the CC not trace through b lack * edges in the GC heap. This invariant lets the CC not trace through b lack
skipping to change at line 1882 skipping to change at line 1053
delayMarkingChildren(obj); delayMarkingChildren(obj);
} }
bool isMarkStackEmpty() { bool isMarkStackEmpty() {
return stack.isEmpty(); return stack.isEmpty();
} }
bool restoreValueArray(JSObject *obj, void **vpp, void **endp); bool restoreValueArray(JSObject *obj, void **vpp, void **endp);
void saveValueRanges(); void saveValueRanges();
inline void processMarkStackTop(SliceBudget &budget); inline void processMarkStackTop(SliceBudget &budget);
void processMarkStackOther(uintptr_t tag, uintptr_t addr); void processMarkStackOther(SliceBudget &budget, uintptr_t tag, uintptr_ t addr);
void appendGrayRoot(void *thing, JSGCTraceKind kind); void appendGrayRoot(void *thing, JSGCTraceKind kind);
/* The color is only applied to objects, functions and xml. */ /* The color is only applied to objects, functions and xml. */
uint32_t color; uint32_t color;
DebugOnly<bool> started; DebugOnly<bool> started;
/* Pointer to the top of the stack of arenas we are delaying marking on . */ /* Pointer to the top of the stack of arenas we are delaying marking on . */
js::gc::ArenaHeader *unmarkedArenaStackTop; js::gc::ArenaHeader *unmarkedArenaStackTop;
skipping to change at line 1950 skipping to change at line 1121
IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback ); IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback );
/* /*
* Invoke cellCallback on every in-use object of the specified thing kind f or * Invoke cellCallback on every in-use object of the specified thing kind f or
* the given compartment or for all compartments if it is null. * the given compartment or for all compartments if it is null.
*/ */
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
IterateCells(JSRuntime *rt, JSCompartment *compartment, gc::AllocKind thing Kind, IterateCells(JSRuntime *rt, JSCompartment *compartment, gc::AllocKind thing Kind,
void *data, IterateCellCallback cellCallback); void *data, IterateCellCallback cellCallback);
/*
* Invoke cellCallback on every gray JS_OBJECT in the given compartment.
*/
extern JS_FRIEND_API(void)
IterateGrayObjects(JSCompartment *compartment, GCThingCallback *cellCallbac
k, void *data);
} /* namespace js */ } /* namespace js */
extern void extern void
js_FinalizeStringRT(JSRuntime *rt, JSString *str); js_FinalizeStringRT(JSRuntime *rt, JSString *str);
/* /*
* Macro to test if a traversal is the marking phase of the GC. * Macro to test if a traversal is the marking phase of the GC.
*/ */
#define IS_GC_MARKING_TRACER(trc) \ #define IS_GC_MARKING_TRACER(trc) \
((trc)->callback == NULL || (trc)->callback == GCMarker::GrayCallback) ((trc)->callback == NULL || (trc)->callback == GCMarker::GrayCallback)
skipping to change at line 1974 skipping to change at line 1151
JSCompartment * JSCompartment *
NewCompartment(JSContext *cx, JSPrincipals *principals); NewCompartment(JSContext *cx, JSPrincipals *principals);
/* Tries to run a GC no matter what (used for GC zeal). */ /* Tries to run a GC no matter what (used for GC zeal). */
void void
RunDebugGC(JSContext *cx); RunDebugGC(JSContext *cx);
void void
SetDeterministicGC(JSContext *cx, bool enabled); SetDeterministicGC(JSContext *cx, bool enabled);
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) && !defined(JS_THREADSAFE void
) SetValidateGC(JSContext *cx, bool enabled);
/* Overwrites stack references to GC things which have not been rooted. */
void CheckStackRoots(JSContext *cx);
inline void MaybeCheckStackRoots(JSContext *cx) { CheckStackRoots(cx); }
#else
inline void MaybeCheckStackRoots(JSContext *cx) {}
#endif
const int ZealPokeValue = 1; const int ZealPokeValue = 1;
const int ZealAllocValue = 2; const int ZealAllocValue = 2;
const int ZealFrameGCValue = 3; const int ZealFrameGCValue = 3;
const int ZealVerifierValue = 4; const int ZealVerifierPreValue = 4;
const int ZealFrameVerifierValue = 5; const int ZealFrameVerifierPreValue = 5;
const int ZealStackRootingSafeValue = 6;
const int ZealStackRootingValue = 7;
const int ZealIncrementalRootsThenFinish = 8;
const int ZealIncrementalMarkAllThenFinish = 9;
const int ZealIncrementalMultipleSlices = 10;
const int ZealVerifierPostValue = 11;
const int ZealFrameVerifierPostValue = 12;
const int ZealPurgeAnalysisValue = 13;
enum VerifierType {
PreBarrierVerifier,
PostBarrierVerifier
};
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
/* Check that write barriers have been used correctly. See jsgc.cpp. */ /* Check that write barriers have been used correctly. See jsgc.cpp. */
void void
VerifyBarriers(JSRuntime *rt); VerifyBarriers(JSRuntime *rt, VerifierType type);
void void
MaybeVerifyBarriers(JSContext *cx, bool always = false); MaybeVerifyBarriers(JSContext *cx, bool always = false);
#else #else
static inline void static inline void
VerifyBarriers(JSRuntime *rt) VerifyBarriers(JSRuntime *rt, VerifierType type)
{ {
} }
static inline void static inline void
MaybeVerifyBarriers(JSContext *cx, bool always = false) MaybeVerifyBarriers(JSContext *cx, bool always = false)
{ {
} }
#endif #endif
 End of changes. 54 change blocks. 
1063 lines changed or deleted 179 lines changed or added


 jslock.h   jslock.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jslock_h__ #ifndef jslock_h__
#define jslock_h__ #define jslock_h__
#include "jsapi.h" #include "jsapi.h"
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
# include "pratom.h" # include "pratom.h"
# include "prlock.h" # include "prlock.h"
# include "prcvar.h" # include "prcvar.h"
# include "prthread.h" # include "prthread.h"
# include "prinit.h" # include "prinit.h"
# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((PRInt32 *)(p)) # define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((int32_t *)(p))
# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((PRInt32 *)(p)) # define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((int32_t *)(p))
# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((PRInt32 *)(p), (PRInt32 # define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((int32_t *)(p), (int32_t
)(v)) )(v))
# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((PRInt32 *)(p), (PRInt32 # define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t
)(v)) )(v))
#else /* JS_THREADSAFE */ #else /* JS_THREADSAFE */
typedef struct PRThread PRThread;
typedef struct PRCondVar PRCondVar;
typedef struct PRLock PRLock;
# define JS_ATOMIC_INCREMENT(p) (++*(p)) # define JS_ATOMIC_INCREMENT(p) (++*(p))
# define JS_ATOMIC_DECREMENT(p) (--*(p)) # define JS_ATOMIC_DECREMENT(p) (--*(p))
# define JS_ATOMIC_ADD(p,v) (*(p) += (v)) # define JS_ATOMIC_ADD(p,v) (*(p) += (v))
# define JS_ATOMIC_SET(p,v) (*(p) = (v)) # define JS_ATOMIC_SET(p,v) (*(p) = (v))
#endif /* JS_THREADSAFE */ #endif /* JS_THREADSAFE */
namespace js { namespace js {
class AutoAtomicIncrement class AutoAtomicIncrement
 End of changes. 3 change blocks. 
51 lines changed or deleted 13 lines changed or added


 json.h   json.h 
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is SpiderMonkey JSON.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Sayre <sayrer@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef json_h___ #ifndef json_h___
#define json_h___ #define json_h___
#include "jsprvtd.h" #include "jsprvtd.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jsapi.h"
#include "js/Vector.h" #include "js/Vector.h"
#define JSON_MAX_DEPTH 2048 #define JSON_MAX_DEPTH 2048
#define JSON_PARSER_BUFSIZE 1024 #define JSON_PARSER_BUFSIZE 1024
extern JSObject * extern JSObject *
js_InitJSONClass(JSContext *cx, JSObject *obj); js_InitJSONClass(JSContext *cx, JSObject *obj);
extern JSBool extern JSBool
js_Stringify(JSContext *cx, js::Value *vp, JSObject *replacer, js::Value sp js_Stringify(JSContext *cx, js::MutableHandleValue vp,
ace, JSObject *replacer, js::Value space,
js::StringBuffer &sb); js::StringBuffer &sb);
// Avoid build errors on certain platforms that define these names as const
ants
#undef STRICT
#undef LEGACY
/* /*
* The type of JSON decoding to perform. Strict decoding is to-the-spec; * The type of JSON decoding to perform. Strict decoding is to-the-spec;
* legacy decoding accepts a few non-JSON syntaxes historically accepted by the * legacy decoding accepts a few non-JSON syntaxes historically accepted by the
* implementation. (Full description of these deviations is deliberately * implementation. (Full description of these deviations is deliberately
* omitted.) New users should use strict decoding rather than legacy decod ing, * omitted.) New users should use strict decoding rather than legacy decod ing,
* as legacy decoding might be removed at a future time. * as legacy decoding might be removed at a future time.
*/ */
enum DecodingMode { STRICT, LEGACY }; enum DecodingMode { STRICT, LEGACY };
namespace js { namespace js {
extern JS_FRIEND_API(JSBool) extern JS_FRIEND_API(JSBool)
ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, con ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, Han
st Value &filter, dleValue filter,
Value *vp, DecodingMode decodingMode = STRICT); MutableHandleValue vp, DecodingMode decodingMode = STR
ICT);
} /* namespace js */ } /* namespace js */
#endif /* json_h___ */ #endif /* json_h___ */
 End of changes. 5 change blocks. 
50 lines changed or deleted 15 lines changed or added


 jsperf.h   jsperf.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Zack Weinberg <zweinberg@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsperf_h___ #ifndef jsperf_h___
#define jsperf_h___ #define jsperf_h___
#include "jsapi.h" #include "jsapi.h"
namespace JS { namespace JS {
/* /*
* JS::PerfMeasurement is a generic way to access detailed performance * JS::PerfMeasurement is a generic way to access detailed performance
skipping to change at line 151 skipping to change at line 118
* not using the stub implementation. * not using the stub implementation.
*/ */
static bool canMeasureSomething(); static bool canMeasureSomething();
}; };
/* Inject a Javascript wrapper around the above C++ class into the /* Inject a Javascript wrapper around the above C++ class into the
* Javascript object passed as an argument (this will normally be a * Javascript object passed as an argument (this will normally be a
* global object). The JS-visible API is identical to the C++ API. * global object). The JS-visible API is identical to the C++ API.
*/ */
extern JS_FRIEND_API(JSObject*) extern JS_FRIEND_API(JSObject*)
RegisterPerfMeasurement(JSContext *cx, JSObject *global); RegisterPerfMeasurement(JSContext *cx, JSRawObject global);
/* /*
* Given a jsval which contains an instance of the aforementioned * Given a jsval which contains an instance of the aforementioned
* wrapper class, extract the C++ object. Returns NULL if the * wrapper class, extract the C++ object. Returns NULL if the
* jsval is not an instance of the wrapper. * jsval is not an instance of the wrapper.
*/ */
extern JS_FRIEND_API(PerfMeasurement*) extern JS_FRIEND_API(PerfMeasurement*)
ExtractPerfMeasurement(jsval wrapper); ExtractPerfMeasurement(jsval wrapper);
} // namespace JS } // namespace JS
 End of changes. 2 change blocks. 
45 lines changed or deleted 4 lines changed or added


 jsprf.h   jsprf.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsprf_h___ #ifndef jsprf_h___
#define jsprf_h___ #define jsprf_h___
/* /*
** API for PR printf like routines. Supports the following formats ** API for PR printf like routines. Supports the following formats
** %d - decimal ** %d - decimal
** %u - unsigned decimal ** %u - unsigned decimal
** %x - unsigned hex ** %x - unsigned hex
** %X - unsigned uppercase hex ** %X - unsigned uppercase hex
 End of changes. 1 change blocks. 
45 lines changed or deleted 3 lines changed or added


 jsproxy.h   jsproxy.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=4 sw=4 et tw=99: * vim: set ts=4 sw=4 et tw=99:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* May 28, 2008.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andreas Gal <gal@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsproxy_h___ #ifndef jsproxy_h___
#define jsproxy_h___ #define jsproxy_h___
#include "jsapi.h" #include "jsapi.h"
#include "jsfriendapi.h" #include "jsfriendapi.h"
namespace js { namespace js {
/* Base class for all C++ proxy handlers. */ class JS_FRIEND_API(Wrapper);
class JS_FRIEND_API(ProxyHandler) {
/*
* A proxy is a JSObject that implements generic behavior by providing cust
om
* implementations for each object trap. The implementation for each trap i
s
* provided by a C++ object stored on the proxy, known as its handler.
*
* A major use case for proxies is to forward each trap to another object,
* known as its target. The target can be an arbitrary C++ object. Not ever
y
* proxy has the notion of a target, however.
*
* Proxy traps are grouped into fundamental and derived traps. Every proxy
has
* to at least provide implementations for the fundamental traps, but the
* derived traps can be implemented in terms of the fundamental ones.
*
* To minimize code duplication, a set of abstract proxy handler classes is
* provided, from which other handlers may inherit. These abstract classes
* are organized in the following hierarchy:
*
* BaseProxyHandler
* |
* IndirectProxyHandler
* |
* DirectProxyHandler
*/
/*
* BaseProxyHandler is the most generic kind of proxy handler. It does not
make
* any assumptions about the target. Consequently, it does not provide any
* default implementation for the fundamental traps. It does, however, impl
ement
* the derived traps in terms of the fundamental ones. This allows consumer
s of
* this class to define any custom behavior they want.
*/
class JS_FRIEND_API(BaseProxyHandler) {
void *mFamily; void *mFamily;
bool mHasPrototype;
protected:
// Subclasses may set this in their constructor.
void setHasPrototype(bool hasPrototype) { mHasPrototype = hasPrototype;
};
public: public:
explicit ProxyHandler(void *family); explicit BaseProxyHandler(void *family);
virtual ~ProxyHandler(); virtual ~BaseProxyHandler();
bool hasPrototype() {
return mHasPrototype;
}
inline void *family() {
return mFamily;
}
virtual bool isOuterWindow() {
return false;
}
/*
* The function Wrapper::wrapperHandler takes a pointer to a
* BaseProxyHandler and returns a pointer to a Wrapper if and only if t
he
* BaseProxyHandler is a wrapper handler (otherwise, it returns NULL).
*
* Unfortunately, we can't inherit Wrapper from BaseProxyHandler, since
that
* would create a dreaded diamond, and we can't use dynamic_cast to cas
t
* BaseProxyHandler to Wrapper, since that would require us to compile
with
* run-time type information. Hence the need for this virtual function.
*/
virtual Wrapper *toWrapper() {
return NULL;
}
/* ES5 Harmony fundamental proxy traps. */ /* ES5 Harmony fundamental proxy traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid
id, bool set, id,
PropertyDescriptor *desc) = 0; bool set, PropertyDescriptor *desc)
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, j = 0;
sid id, bool set, virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
jsid id, bool set,
PropertyDescriptor *desc) = 0; PropertyDescriptor *desc) = 0;
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
PropertyDescriptor *desc) = 0; PropertyDescriptor *desc) = 0;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoId virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy,
Vector &props) = 0; AutoIdVector &props) = 0;
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) = 0; virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) = 0;
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &pr virtual bool enumerate(JSContext *cx, JSObject *proxy,
ops) = 0; AutoIdVector &props) = 0;
virtual bool fix(JSContext *cx, JSObject *proxy, Value *vp) = 0;
/* ES5 Harmony derived proxy traps. */ /* ES5 Harmony derived proxy traps. */
virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); virtual bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, js virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver,
id id, Value *vp); jsid id, Value *vp);
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, js virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
id id, bool strict, jsid id, bool strict, Value *vp);
Value *vp);
virtual bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); virtual bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props);
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Va virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
lue *vp); Value *vp);
/* Spidermonkey extensions. */ /* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp);
virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, V alue *argv, Value *rval); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, V alue *argv, Value *rval);
virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, N ative native, CallArgs args); virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp l impl, CallArgs args);
virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *v p, bool *bp); virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *v p, bool *bp);
virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual JSType typeOf(JSContext *cx, JSObject *proxy);
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo ntext *cx); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo ntext *cx);
virtual JSString *obj_toString(JSContext *cx, JSObject *proxy); virtual JSString *obj_toString(JSContext *cx, JSObject *proxy);
virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent); virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent);
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar d *g); virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar d *g);
virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Va lue *vp); virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Va lue *vp);
virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp); virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp);
virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual void finalize(JSFreeOp *fop, JSObject *proxy);
virtual void trace(JSTracer *trc, JSObject *proxy);
virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver, virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver,
uint32_t index, Value *vp, bool *prese nt); uint32_t index, Value *vp, bool *prese nt);
virtual bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject ** proto);
virtual bool isOuterWindow() { /* See comment for weakmapKeyDelegateOp in jsclass.h. */
return false; virtual JSObject *weakmapKeyDelegate(JSObject *proxy);
} };
inline void *family() { /*
return mFamily; * IndirectProxyHandler assumes that a target exists. Moreover, it assumes
} the
* target is a JSObject. Consequently, it provides default implementations
for
* the fundamental traps that forward their behavior to the target. The der
ived
* traps, however, are inherited from BaseProxyHandler, and therefore still
* implemented in terms of the fundamental ones. This allows consumers of t
his
* class to define custom behavior without implementing the entire gamut of
* proxy traps.
*/
class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler {
public:
explicit IndirectProxyHandler(void *family);
/* ES5 Harmony fundamental proxy traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid
id,
bool set,
PropertyDescriptor *desc) MOZ_OVERRI
DE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVE
RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *proxy,
AutoIdVector &props) MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id,
bool *bp) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JSObject *proxy,
AutoIdVector &props) MOZ_OVERRIDE;
/* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc,
Value *vp) MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc,
Value *argv, Value *rval) MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp
l impl,
CallArgs args) MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *v
p,
bool *bp) MOZ_OVERRIDE;
virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE;
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue,
JSContext *cx) MOZ_OVERRIDE;
virtual JSString *obj_toString(JSContext *cx, JSObject *proxy) MOZ_OVER
RIDE;
virtual JSString *fun_toString(JSContext *cx, JSObject *proxy,
unsigned indent) MOZ_OVERRIDE;
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy,
RegExpGuard *g) MOZ_OVERRIDE;
virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint,
Value *vp) MOZ_OVERRIDE;
virtual bool iteratorNext(JSContext *cx, JSObject *proxy,
Value *vp) MOZ_OVERRIDE;
virtual JSObject *weakmapKeyDelegate(JSObject *proxy);
};
/*
* DirectProxyHandler has the same assumptions about the target as its base
,
* IndirectProxyHandler. Its fundamental traps are inherited from this clas
s,
* and therefore forward their behavior to the target. The derived traps,
* however, are overrided so that, they too, forward their behavior to the
* target. This allows consumers of this class to forward to another object
as
* transparently as possible.
*/
class JS_PUBLIC_API(DirectProxyHandler) : public IndirectProxyHandler {
public:
explicit DirectProxyHandler(void *family);
/* ES5 Harmony derived proxy traps. */
virtual bool has(JSContext *cx, JSObject *proxy, jsid id,
bool *bp) MOZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JSObject *proxy, jsid id,
bool *bp) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, Value *vp) MOZ_OVERRIDE;
virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver,
jsid id, bool strict, Value *vp) MOZ_OVERRIDE;
virtual bool keys(JSContext *cx, JSObject *proxy,
AutoIdVector &props) MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags,
Value *vp) MOZ_OVERRIDE;
}; };
/* Dispatch point for handlers that executes the appropriate C++ or scripte d traps. */ /* Dispatch point for handlers that executes the appropriate C++ or scripte d traps. */
class Proxy { class Proxy {
public: public:
/* ES5 Harmony fundamental proxy traps. */ /* ES5 Harmony fundamental proxy traps. */
static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set,
PropertyDescriptor *desc); PropertyDescriptor *desc);
static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, Value *vp); static bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set, Value *vp);
static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, js id id, bool set, static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, js id id, bool set,
PropertyDescriptor *desc); PropertyDescriptor *desc);
static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, js id id, bool set, static bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, js id id, bool set,
Value *vp); Value *vp);
static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, Pro pertyDescriptor *desc); static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, Pro pertyDescriptor *desc);
static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, con st Value &v); static bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, con st Value &v);
static bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoIdV ector &props); static bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, AutoIdV ector &props);
static bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
static bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &pro ps); static bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &pro ps);
static bool fix(JSContext *cx, JSObject *proxy, Value *vp);
/* ES5 Harmony derived proxy traps. */ /* ES5 Harmony derived proxy traps. */
static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
static bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsi static bool get(JSContext *cx, HandleObject proxy, HandleObject receive
d id, Value *vp); r, HandleId id, MutableHandleValue vp);
static bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObjec static bool getElementIfPresent(JSContext *cx, HandleObject proxy, Hand
t *receiver, leObject receiver,
uint32_t index, Value *vp, bool *presen uint32_t index, MutableHandleValue vp,
t); bool *present);
static bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsi static bool set(JSContext *cx, HandleObject proxy, HandleObject receive
d id, bool strict, r, HandleId id, bool strict,
Value *vp); MutableHandleValue vp);
static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props);
static bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Val ue *vp); static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp);
/* Spidermonkey extensions. */ /* Spidermonkey extensions. */
static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value * vp); static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value * vp);
static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Va lue *argv, Value *rval); static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Va lue *argv, Value *rval);
static bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Na tive native, CallArgs args); static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args);
static bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp , bool *bp); static bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp , bool *bp);
static JSType typeOf(JSContext *cx, JSObject *proxy); static JSType typeOf(JSContext *cx, JSObject *proxy);
static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCon text *cx); static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCon text *cx);
static JSString *obj_toString(JSContext *cx, JSObject *proxy); static JSString *obj_toString(JSContext *cx, JSObject *proxy);
static JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent); static JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent);
static bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g); static bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g);
static bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Val ue *vp); static bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Val ue *vp);
static bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp); static bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp);
}; };
inline bool IsObjectProxyClass(const Class *clasp) inline bool IsObjectProxyClass(const Class *clasp)
{ {
return clasp == &js::ObjectProxyClass || clasp == &js::OuterWindowProxy Class; return clasp == &js::ObjectProxyClass || clasp == &js::OuterWindowProxy Class;
} }
inline bool IsFunctionProxyClass(const Class *clasp) inline bool IsFunctionProxyClass(const Class *clasp)
{ {
return clasp == &js::FunctionProxyClass; return clasp == &js::FunctionProxyClass;
} }
inline bool IsObjectProxy(const JSObject *obj) inline bool IsObjectProxy(RawObject obj)
{ {
return IsObjectProxyClass(GetObjectClass(obj)); return IsObjectProxyClass(GetObjectClass(obj));
} }
inline bool IsFunctionProxy(const JSObject *obj) inline bool IsFunctionProxy(RawObject obj)
{ {
return IsFunctionProxyClass(GetObjectClass(obj)); return IsFunctionProxyClass(GetObjectClass(obj));
} }
inline bool IsProxy(const JSObject *obj) inline bool IsProxy(RawObject obj)
{ {
Class *clasp = GetObjectClass(obj); Class *clasp = GetObjectClass(obj);
return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp);
} }
/* Shared between object and function proxies. */ /* Shared between object and function proxies. */
const uint32_t JSSLOT_PROXY_HANDLER = 0; const uint32_t JSSLOT_PROXY_HANDLER = 0;
const uint32_t JSSLOT_PROXY_PRIVATE = 1; const uint32_t JSSLOT_PROXY_PRIVATE = 1;
const uint32_t JSSLOT_PROXY_EXTRA = 2; const uint32_t JSSLOT_PROXY_EXTRA = 2;
/* Function proxies only. */ /* Function proxies only. */
const uint32_t JSSLOT_PROXY_CALL = 4; const uint32_t JSSLOT_PROXY_CALL = 4;
const uint32_t JSSLOT_PROXY_CONSTRUCT = 5; const uint32_t JSSLOT_PROXY_CONSTRUCT = 5;
inline ProxyHandler * inline BaseProxyHandler *
GetProxyHandler(const JSObject *obj) GetProxyHandler(RawObject obj)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
return (ProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER).toPr ivate(); return (BaseProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER). toPrivate();
} }
inline const Value & inline const Value &
GetProxyPrivate(const JSObject *obj) GetProxyPrivate(RawObject obj)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE); return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE);
} }
inline JSObject *
GetProxyTargetObject(RawObject obj)
{
JS_ASSERT(IsProxy(obj));
return GetProxyPrivate(obj).toObjectOrNull();
}
inline const Value & inline const Value &
GetProxyExtra(const JSObject *obj, size_t n) GetProxyCall(RawObject obj)
{
JS_ASSERT(IsFunctionProxy(obj));
return GetReservedSlot(obj, JSSLOT_PROXY_CALL);
}
inline const Value &
GetProxyExtra(RawObject obj, size_t n)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n); return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n);
} }
inline void inline void
SetProxyExtra(JSObject *obj, size_t n, const Value &extra) SetProxyHandler(RawObject obj, BaseProxyHandler *handler)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
JS_ASSERT(n <= 1); SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler));
SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra);
} }
inline void inline void
SetProxyHandler(JSObject *obj, ProxyHandler *handler) SetProxyPrivate(RawObject obj, const Value &value)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value);
} }
inline void inline void
SetProxyPrivate(JSObject *obj, const Value &value) SetProxyExtra(RawObject obj, size_t n, const Value &extra)
{ {
JS_ASSERT(IsProxy(obj)); JS_ASSERT(IsProxy(obj));
SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value); JS_ASSERT(n <= 1);
SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra);
} }
JS_FRIEND_API(JSObject *) JS_FRIEND_API(JSObject *)
NewProxyObject(JSContext *cx, ProxyHandler *handler, const Value &priv, NewProxyObject(JSContext *cx, BaseProxyHandler *handler, const Value &priv,
JSObject *proto, JSObject *parent, JSObject *proto, JSObject *parent,
JSObject *call = NULL, JSObject *construct = NULL); JSObject *call = NULL, JSObject *construct = NULL);
} /* namespace js */ } /* namespace js */
JS_BEGIN_EXTERN_C JS_BEGIN_EXTERN_C
extern JS_FRIEND_API(JSObject *) extern JS_FRIEND_API(JSObject *)
js_InitProxyClass(JSContext *cx, JSObject *obj); js_InitProxyClass(JSContext *cx, JSObject *obj);
 End of changes. 33 change blocks. 
103 lines changed or deleted 235 lines changed or added


 jsprvtd.h   jsprvtd.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsprvtd_h___ #ifndef jsprvtd_h___
#define jsprvtd_h___ #define jsprvtd_h___
/* /*
* JS private typename definitions. * JS private typename definitions.
* *
* This header is included only in other .h files, for convenience and for * This header is included only in other .h files, for convenience and for
* simplicity of type naming. The alternative for structures is to use tag s, * simplicity of type naming. The alternative for structures is to use tag s,
* which are named the same as their typedef names (legal in C/C++, and les s * which are named the same as their typedef names (legal in C/C++, and les s
* noisy than suffixing the typedef name with "Struct" or "Str"). Instead, * noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
skipping to change at line 87 skipping to change at line 54
/* Scalar typedefs. */ /* Scalar typedefs. */
typedef uint8_t jsbytecode; typedef uint8_t jsbytecode;
typedef uint8_t jssrcnote; typedef uint8_t jssrcnote;
typedef uintptr_t jsatomid; typedef uintptr_t jsatomid;
/* Struct typedefs. */ /* Struct typedefs. */
typedef struct JSArgumentFormatMap JSArgumentFormatMap; typedef struct JSArgumentFormatMap JSArgumentFormatMap;
typedef struct JSGCThing JSGCThing; typedef struct JSGCThing JSGCThing;
typedef struct JSGenerator JSGenerator; typedef struct JSGenerator JSGenerator;
typedef struct JSNativeEnumerator JSNativeEnumerator; typedef struct JSNativeEnumerator JSNativeEnumerator;
typedef struct JSProperty JSProperty;
typedef struct JSSharpObjectMap JSSharpObjectMap; typedef struct JSSharpObjectMap JSSharpObjectMap;
typedef struct JSTryNote JSTryNote; typedef struct JSTryNote JSTryNote;
/* Friend "Advanced API" typedefs. */ /* Friend "Advanced API" typedefs. */
typedef struct JSAtomState JSAtomState; typedef struct JSAtomState JSAtomState;
typedef struct JSCodeSpec JSCodeSpec; typedef struct JSCodeSpec JSCodeSpec;
typedef struct JSPrinter JSPrinter; typedef struct JSPrinter JSPrinter;
typedef struct JSStackHeader JSStackHeader; typedef struct JSStackHeader JSStackHeader;
typedef struct JSSubString JSSubString; typedef struct JSSubString JSSubString;
typedef struct JSSpecializedNative JSSpecializedNative; typedef struct JSSpecializedNative JSSpecializedNative;
#if JS_HAS_XML_SUPPORT
typedef struct JSXML JSXML; typedef struct JSXML JSXML;
#endif
/* /*
* Template declarations. * Template declarations.
* *
* jsprvtd.h can be included in both C and C++ translation units. For C++, it * jsprvtd.h can be included in both C and C++ translation units. For C++, it
* may possibly be wrapped in an extern "C" block which does not agree with * may possibly be wrapped in an extern "C" block which does not agree with
* templates. * templates.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C++" { extern "C++" {
class JSDependentString; class JSDependentString;
class JSExtensibleString; class JSExtensibleString;
class JSExternalString; class JSExternalString;
class JSLinearString; class JSLinearString;
class JSFixedString; class JSFixedString;
class JSStaticAtom;
class JSRope; class JSRope;
class JSAtom; class JSAtom;
class JSWrapper; class JSWrapper;
namespace js { namespace js {
struct ArgumentsData; struct ArgumentsData;
struct Class; struct Class;
class RegExpGuard; class RegExpGuard;
skipping to change at line 163 skipping to change at line 131
class ExecuteArgsGuard; class ExecuteArgsGuard;
class InvokeFrameGuard; class InvokeFrameGuard;
class InvokeArgsGuard; class InvokeArgsGuard;
class StringBuffer; class StringBuffer;
class FrameRegs; class FrameRegs;
class StackFrame; class StackFrame;
class StackSegment; class StackSegment;
class StackSpace; class StackSpace;
class ContextStack; class ContextStack;
class FrameRegsIter; class ScriptFrameIter;
class CallReceiver;
class CallArgs;
struct BytecodeEmitter;
struct Definition;
struct FunctionBox;
struct ObjectBox;
struct ParseNode;
struct Parser;
class TokenStream;
struct Token;
struct TokenPos;
struct TokenPtr;
struct TreeContext;
class UpvarCookie;
class Proxy; class Proxy;
class ProxyHandler; class JS_FRIEND_API(BaseProxyHandler);
class Wrapper; class JS_FRIEND_API(DirectWrapper);
class CrossCompartmentWrapper; class JS_FRIEND_API(CrossCompartmentWrapper);
class TempAllocPolicy; class TempAllocPolicy;
class RuntimeAllocPolicy; class RuntimeAllocPolicy;
class GlobalObject; class GlobalObject;
template <typename K, template <typename K,
typename V, typename V,
size_t InlineElems> size_t InlineElems>
class InlineMap; class InlineMap;
skipping to change at line 207 skipping to change at line 160
class BaseShape; class BaseShape;
class UnownedBaseShape; class UnownedBaseShape;
struct Shape; struct Shape;
struct EmptyShape; struct EmptyShape;
class ShapeKindArray; class ShapeKindArray;
class Bindings; class Bindings;
struct StackBaseShape; struct StackBaseShape;
struct StackShape; struct StackShape;
class MultiDeclRange;
class ParseMapPool;
class DefnOrHeader;
typedef InlineMap<JSAtom *, Definition *, 24> AtomDefnMap;
typedef InlineMap<JSAtom *, jsatomid, 24> AtomIndexMap;
typedef InlineMap<JSAtom *, DefnOrHeader, 24> AtomDOHMap;
typedef Vector<UpvarCookie, 8> UpvarCookies;
class Breakpoint; class Breakpoint;
class BreakpointSite; class BreakpointSite;
class Debugger; class Debugger;
class WatchpointMap; class WatchpointMap;
/* /*
* Env is the type of what ES5 calls "lexical environments" (runtime * Env is the type of what ES5 calls "lexical environments" (runtime
* activations of lexical scopes). This is currently just JSObject, and is * activations of lexical scopes). This is currently just JSObject, and is
* implemented by Call, Block, With, and DeclEnv objects, among others--but * implemented by Call, Block, With, and DeclEnv objects, among others--but
* environments and objects are really two different concepts. * environments and objects are really two different concepts.
*/ */
typedef JSObject Env; typedef JSObject Env;
typedef JSNative Native; typedef JSNative Native;
typedef JSPropertyOp PropertyOp; typedef JSPropertyOp PropertyOp;
typedef JSStrictPropertyOp StrictPropertyOp; typedef JSStrictPropertyOp StrictPropertyOp;
typedef JSPropertyDescriptor PropertyDescriptor; typedef JSPropertyDescriptor PropertyDescriptor;
namespace frontend {
struct BytecodeEmitter;
struct Definition;
struct FunctionBox;
struct ObjectBox;
struct Token;
struct TokenPos;
struct TokenPtr;
class TokenStream;
struct Parser;
class ParseMapPool;
struct ParseNode;
} /* namespace frontend */
namespace analyze { namespace analyze {
struct LifetimeVariable; struct LifetimeVariable;
class LoopAnalysis; class LoopAnalysis;
class ScriptAnalysis; class ScriptAnalysis;
class SlotValue; class SlotValue;
class SSAValue; class SSAValue;
class SSAUseChain; class SSAUseChain;
} /* namespace analyze */ } /* namespace analyze */
skipping to change at line 259 skipping to change at line 220
struct TypeCompartment; struct TypeCompartment;
} /* namespace types */ } /* namespace types */
typedef JS::Handle<Shape*> HandleShape; typedef JS::Handle<Shape*> HandleShape;
typedef JS::Handle<BaseShape*> HandleBaseShape; typedef JS::Handle<BaseShape*> HandleBaseShape;
typedef JS::Handle<types::TypeObject*> HandleTypeObject; typedef JS::Handle<types::TypeObject*> HandleTypeObject;
typedef JS::Handle<JSAtom*> HandleAtom; typedef JS::Handle<JSAtom*> HandleAtom;
typedef JS::Handle<PropertyName*> HandlePropertyName; typedef JS::Handle<PropertyName*> HandlePropertyName;
typedef JS::Root<Shape*> RootShape; typedef JS::MutableHandle<Shape*> MutableHandleShape;
typedef JS::Root<BaseShape*> RootBaseShape;
typedef JS::Root<types::TypeObject*> RootTypeObject; typedef JS::Rooted<Shape*> RootedShape;
typedef JS::Root<JSAtom*> RootAtom; typedef JS::Rooted<BaseShape*> RootedBaseShape;
typedef JS::Root<PropertyName*> RootPropertyName; typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
typedef JS::Rooted<JSAtom*> RootedAtom;
typedef JS::RootedVar<Shape*> RootedVarShape; typedef JS::Rooted<PropertyName*> RootedPropertyName;
typedef JS::RootedVar<BaseShape*> RootedVarBaseShape;
typedef JS::RootedVar<types::TypeObject*> RootedVarTypeObject;
typedef JS::RootedVar<JSAtom*> RootedVarAtom;
typedef JS::RootedVar<PropertyName*> RootedVarPropertyName;
enum XDRMode { enum XDRMode {
XDR_ENCODE, XDR_ENCODE,
XDR_DECODE XDR_DECODE
}; };
template <XDRMode mode> template <XDRMode mode>
class XDRState; class XDRState;
class FreeOp; class FreeOp;
skipping to change at line 408 skipping to change at line 365
void *callHookData; void *callHookData;
JSThrowHook throwHook; JSThrowHook throwHook;
void *throwHookData; void *throwHookData;
JSDebugErrorHook debugErrorHook; JSDebugErrorHook debugErrorHook;
void *debugErrorHookData; void *debugErrorHookData;
} JSDebugHooks; } JSDebugHooks;
/* js::ObjectOps function pointer typedefs. */ /* js::ObjectOps function pointer typedefs. */
/* /*
* Look for id in obj and its prototype chain, returning false on error or
* exception, true on success. On success, return null in *propp if id was
* not found. If id was found, return the first object searching from obj
* along its prototype chain in which id names a direct property in *objp,
and
* return a non-null, opaque property pointer in *propp.
*
* If JSLookupPropOp succeeds and returns with *propp non-null, that pointe
r
* may be passed as the prop parameter to a JSAttributesOp, as a short-cut
* that bypasses id re-lookup.
*/
typedef JSBool
(* JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp);
/*
* Get or set attributes of the property obj[id]. Return false on error or
* exception, true with current attributes in *attrsp.
*/
typedef JSBool
(* JSAttributesOp)(JSContext *cx, JSObject *obj, jsid id, unsigned *attrsp)
;
/*
* A generic type for functions mapping an object to another object, or nul l * A generic type for functions mapping an object to another object, or nul l
* if an error or exception was thrown on cx. * if an error or exception was thrown on cx.
*/ */
typedef JSObject * typedef JSObject *
(* JSObjectOp)(JSContext *cx, JSObject *obj); (* JSObjectOp)(JSContext *cx, JSHandleObject obj);
/* Signature for class initialization ops. */
typedef JSObject *
(* JSClassInitializerOp)(JSContext *cx, JSObject *obj);
/* /*
* Hook that creates an iterator object for a given object. Returns the * Hook that creates an iterator object for a given object. Returns the
* iterator object or null if an error or exception was thrown on cx. * iterator object or null if an error or exception was thrown on cx.
*/ */
typedef JSObject * typedef JSObject *
(* JSIteratorOp)(JSContext *cx, JSObject *obj, JSBool keysonly); (* JSIteratorOp)(JSContext *cx, JSHandleObject obj, JSBool keysonly);
/* /*
* The following determines whether JS_EncodeCharacters and JS_DecodeBytes * The following determines whether JS_EncodeCharacters and JS_DecodeBytes
* treat char[] as utf-8 or simply as bytes that need to be inflated/deflat ed. * treat char[] as utf-8 or simply as bytes that need to be inflated/deflat ed.
*/ */
#ifdef JS_C_STRINGS_ARE_UTF8 #ifdef JS_C_STRINGS_ARE_UTF8
# define js_CStringsAreUTF8 JS_TRUE # define js_CStringsAreUTF8 JS_TRUE
#else #else
extern JSBool js_CStringsAreUTF8; extern JSBool js_CStringsAreUTF8;
#endif #endif
 End of changes. 13 change blocks. 
112 lines changed or deleted 39 lines changed or added


 jspubtd.h   jspubtd.h 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jspubtd_h___ #ifndef jspubtd_h___
#define jspubtd_h___ #define jspubtd_h___
/* /*
* JS public API typedefs. * JS public API typedefs.
*/ */
#include "jstypes.h" #include "jstypes.h"
/* /*
skipping to change at line 151 skipping to change at line 118
typedef enum JSProtoKey { typedef enum JSProtoKey {
#define JS_PROTO(name,code,init) JSProto_##name = code, #define JS_PROTO(name,code,init) JSProto_##name = code,
#include "jsproto.tbl" #include "jsproto.tbl"
#undef JS_PROTO #undef JS_PROTO
JSProto_LIMIT JSProto_LIMIT
} JSProtoKey; } JSProtoKey;
/* js_CheckAccess mode enumeration. */ /* js_CheckAccess mode enumeration. */
typedef enum JSAccessMode { typedef enum JSAccessMode {
JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */ JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */
JSACC_PARENT = 1, /* XXXbe redundant w.r.t. id */
/*
* enum value #1 formerly called JSACC_PARE
NT,
* gap preserved for ABI compatibility.
*/
/* /*
* enum value #2 formerly called JSACC_IMPO RT, * enum value #2 formerly called JSACC_IMPO RT,
* gap preserved for ABI compatibility. * gap preserved for ABI compatibility.
*/ */
JSACC_WATCH = 3, /* a watchpoint on object foo for id 'bar' */ JSACC_WATCH = 3, /* a watchpoint on object foo for id 'bar' */
JSACC_READ = 4, /* a "get" of foo.bar */ JSACC_READ = 4, /* a "get" of foo.bar */
JSACC_WRITE = 8, /* a "set" of foo.bar = baz */ JSACC_WRITE = 8, /* a "set" of foo.bar = baz */
JSACC_LIMIT JSACC_LIMIT
skipping to change at line 252 skipping to change at line 223
#endif #endif
typedef JSBool (*JSInitCallback)(void); typedef JSBool (*JSInitCallback)(void);
JS_END_EXTERN_C JS_END_EXTERN_C
#ifdef __cplusplus #ifdef __cplusplus
namespace JS { namespace JS {
template <typename T> template <typename T>
class Root; class Rooted;
class SkipRoot; class SkipRoot;
enum ThingRootKind enum ThingRootKind
{ {
THING_ROOT_OBJECT, THING_ROOT_OBJECT,
THING_ROOT_SHAPE, THING_ROOT_SHAPE,
THING_ROOT_BASE_SHAPE, THING_ROOT_BASE_SHAPE,
THING_ROOT_TYPE_OBJECT, THING_ROOT_TYPE_OBJECT,
THING_ROOT_STRING, THING_ROOT_STRING,
THING_ROOT_SCRIPT, THING_ROOT_SCRIPT,
THING_ROOT_XML,
THING_ROOT_ID, THING_ROOT_ID,
THING_ROOT_PROPERTY_ID,
THING_ROOT_VALUE, THING_ROOT_VALUE,
THING_ROOT_TYPE,
THING_ROOT_LIMIT THING_ROOT_LIMIT
}; };
template <typename T>
struct RootKind;
/*
* Specifically mark the ThingRootKind of externally visible types, so that
* JSAPI users may use JSRooted... types without having the class definitio
n
* available.
*/
template <> struct RootKind<JSObject *> { static ThingRootKind rootKind() {
return THING_ROOT_OBJECT; }; };
template <> struct RootKind<JSFunction *> { static ThingRootKind rootKind()
{ return THING_ROOT_OBJECT; }; };
template <> struct RootKind<JSString *> { static ThingRootKind rootKind() {
return THING_ROOT_STRING; }; };
template <> struct RootKind<JSScript *> { static ThingRootKind rootKind() {
return THING_ROOT_SCRIPT; }; };
template <> struct RootKind<jsid> { static ThingRootKind rootKind() { retur
n THING_ROOT_ID; }; };
template <> struct RootKind<Value> { static ThingRootKind rootKind() { retu
rn THING_ROOT_VALUE; }; };
struct ContextFriendFields { struct ContextFriendFields {
JSRuntime *const runtime; JSRuntime *const runtime;
ContextFriendFields(JSRuntime *rt) ContextFriendFields(JSRuntime *rt)
: runtime(rt) { } : runtime(rt) { }
static const ContextFriendFields *get(const JSContext *cx) { static const ContextFriendFields *get(const JSContext *cx) {
return reinterpret_cast<const ContextFriendFields *>(cx); return reinterpret_cast<const ContextFriendFields *>(cx);
} }
static ContextFriendFields *get(JSContext *cx) { static ContextFriendFields *get(JSContext *cx) {
return reinterpret_cast<ContextFriendFields *>(cx); return reinterpret_cast<ContextFriendFields *>(cx);
} }
#ifdef JSGC_ROOT_ANALYSIS #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
/* /*
* Stack allocated GC roots for stack GC heap pointers, which may be * Stack allocated GC roots for stack GC heap pointers, which may be
* overwritten if moved during a GC. * overwritten if moved during a GC.
*/ */
Root<void*> *thingGCRooters[THING_ROOT_LIMIT]; Rooted<void*> *thingGCRooters[THING_ROOT_LIMIT];
#endif
#ifdef DEBUG #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
/* /*
* Stack allocated list of stack locations which hold non-relocatable * Stack allocated list of stack locations which hold non-relocatable
* GC heap pointers (where the target is rooted somewhere else) or inte ger * GC heap pointers (where the target is rooted somewhere else) or inte ger
* values which may be confused for GC heap pointers. These are used to * values which may be confused for GC heap pointers. These are used to
* suppress false positives which occur when a rooting analysis treats the * suppress false positives which occur when a rooting analysis treats the
* location as holding a relocatable pointer, but have no other effect on * location as holding a relocatable pointer, but have no other effect on
* GC behavior. * GC behavior.
*/ */
SkipRoot *skipGCRooters; SkipRoot *skipGCRooters;
#endif #endif
#endif /* JSGC_ROOT_ANALYSIS */
}; };
} /* namespace JS */ } /* namespace JS */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* jspubtd_h___ */ #endif /* jspubtd_h___ */
 End of changes. 11 change blocks. 
53 lines changed or deleted 39 lines changed or added


 jstypes.h   jstypes.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -* - */
/* ***** BEGIN LICENSE BLOCK ***** /* This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* IBM Corp.
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
** File: jstypes.h ** File: jstypes.h
** Description: Definitions of NSPR's basic types ** Description: Definitions of NSPR's basic types
** **
** Prototypes and macros used to make up for deficiencies in ANSI environme nts ** Prototypes and macros used to make up for deficiencies in ANSI environme nts
** that we have found. ** that we have found.
** **
** Since we do not wrap <stdlib.h> and all the other standard headers, auth ors ** Since we do not wrap <stdlib.h> and all the other standard headers, auth ors
** of portable code will not know in general that they need these definitio ns. ** of portable code will not know in general that they need these definitio ns.
skipping to change at line 184 skipping to change at line 150
/*********************************************************************** /***********************************************************************
** MACROS: JS_HOWMANY ** MACROS: JS_HOWMANY
** JS_ROUNDUP ** JS_ROUNDUP
** JS_MIN ** JS_MIN
** JS_MAX ** JS_MAX
** DESCRIPTION: ** DESCRIPTION:
** Commonly used macros for operations on compatible types. ** Commonly used macros for operations on compatible types.
***********************************************************************/ ***********************************************************************/
#define JS_HOWMANY(x,y) (((x)+(y)-1)/(y)) #define JS_HOWMANY(x,y) (((x)+(y)-1)/(y))
#define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y)) #define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y))
#define JS_MIN(x,y) ((x)<(y)?(x):(y))
#define JS_MAX(x,y) ((x)>(y)?(x):(y))
#include "jscpucfg.h" #include "jscpucfg.h"
/* /*
* Define JS_64BIT iff we are building in an environment with 64-bit * Define JS_64BIT iff we are building in an environment with 64-bit
* addresses. * addresses.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
# if defined(_M_X64) || defined(_M_AMD64) # if defined(_M_X64) || defined(_M_AMD64)
# define JS_64BIT # define JS_64BIT
 End of changes. 2 change blocks. 
48 lines changed or deleted 3 lines changed or added


 jsutil.h   jsutil.h 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
* PR assertion checker. * PR assertion checker.
*/ */
#ifndef jsutil_h___ #ifndef jsutil_h___
#define jsutil_h___ #define jsutil_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "js/Utility.h" #include "js/Utility.h"
#ifdef USE_ZLIB
#include "zlib.h"
#endif
/* Forward declarations. */ /* Forward declarations. */
struct JSContext; struct JSContext;
static JS_ALWAYS_INLINE void * static JS_ALWAYS_INLINE void *
js_memcpy(void *dst_, const void *src_, size_t len) js_memcpy(void *dst_, const void *src_, size_t len)
{ {
char *dst = (char *) dst_; char *dst = (char *) dst_;
const char *src = (const char *) src_; const char *src = (const char *) src_;
JS_ASSERT_IF(dst >= src, (size_t) (dst - src) >= len); JS_ASSERT_IF(dst >= src, (size_t) (dst - src) >= len);
JS_ASSERT_IF(src >= dst, (size_t) (src - dst) >= len); JS_ASSERT_IF(src >= dst, (size_t) (src - dst) >= len);
skipping to change at line 371 skipping to change at line 342
array[BitArrayIndexToWordIndex(length, i)] &= ~BitArrayIndexToWordMask( i); array[BitArrayIndexToWordIndex(length, i)] &= ~BitArrayIndexToWordMask( i);
} }
static inline void static inline void
ClearAllBitArrayElements(size_t *array, size_t length) ClearAllBitArrayElements(size_t *array, size_t length)
{ {
for (unsigned i = 0; i < length; ++i) for (unsigned i = 0; i < length; ++i)
array[i] = 0; array[i] = 0;
} }
} /* namespace js */ #ifdef USE_ZLIB
#endif /* __cplusplus */ class Compressor
{
/* Number of bytes we should hand to zlib each compressMore() call. */
static const size_t CHUNKSIZE = 2048;
z_stream zs;
const unsigned char *inp;
size_t inplen;
public:
Compressor(const unsigned char *inp, size_t inplen, unsigned char *out)
: inp(inp),
inplen(inplen)
{
JS_ASSERT(inplen > 0);
zs.opaque = NULL;
zs.next_in = (Bytef *)inp;
zs.avail_in = 0;
zs.next_out = out;
zs.avail_out = inplen;
}
bool init();
/* Compress some of the input. Return true if it should be called again
. */
bool compressMore();
/* Finalize compression. Return the length of the compressed input. */
size_t finish();
};
/* /*
* JS_ROTATE_LEFT32 * Decompress a string. The caller must know the length of the output and
* * allocate |out| to a string of that length.
* There is no rotate operation in the C Language so the construct (a << 4)
|
* (a >> 28) is used instead. Most compilers convert this to a rotate
* instruction but some versions of MSVC don't without a little help. To g
et
* MSVC to generate a rotate instruction, we have to use the _rotl intrinsi
c
* and use a pragma to make _rotl inline.
*
* MSVC in VS2005 will do an inline rotate instruction on the above constru
ct.
*/ */
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ bool DecompressString(const unsigned char *inp, size_t inplen,
defined(_M_X64)) unsigned char *out, size_t outlen);
#include <stdlib.h>
#pragma intrinsic(_rotl)
#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits)
#else
#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))
)
#endif #endif
/* Static control-flow checks. */ } /* namespace js */
#ifdef NS_STATIC_CHECKING #endif /* __cplusplus */
/* Trigger a control flow check to make sure that code flows through label
*/
inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {
}
/* Avoid unused goto-label warnings. */
# define MUST_FLOW_LABEL(label) goto label; label:
#else
# define MUST_FLOW_THROUGH(label) ((void) 0)
# define MUST_FLOW_LABEL(label)
#endif
/* Crash diagnostics */ /* Crash diagnostics */
#ifdef DEBUG #ifdef DEBUG
# define JS_CRASH_DIAGNOSTICS 1 # define JS_CRASH_DIAGNOSTICS 1
#endif #endif
#ifdef JS_CRASH_DIAGNOSTICS #ifdef JS_CRASH_DIAGNOSTICS
# define JS_POISON(p, val, size) memset((p), (val), (size)) # define JS_POISON(p, val, size) memset((p), (val), (size))
# define JS_OPT_ASSERT(expr)
\
((expr) ? (void)0 : MOZ_Assert(#expr, __FILE__, __LINE__))
# define JS_OPT_ASSERT_IF(cond, expr)
\
((!(cond) || (expr)) ? (void)0 : MOZ_Assert(#expr, __FILE__, __LINE__))
#else #else
# define JS_POISON(p, val, size) ((void) 0) # define JS_POISON(p, val, size) ((void) 0)
# define JS_OPT_ASSERT(expr) ((void) 0)
# define JS_OPT_ASSERT_IF(cond, expr) ((void) 0)
#endif #endif
/* Basic stats */ /* Basic stats */
#ifdef DEBUG #ifdef DEBUG
# define JS_BASIC_STATS 1 # define JS_BASIC_STATS 1
#endif #endif
#ifdef JS_BASIC_STATS #ifdef JS_BASIC_STATS
# include <stdio.h> # include <stdio.h>
typedef struct JSBasicStats { typedef struct JSBasicStats {
uint32_t num; uint32_t num;
 End of changes. 8 change blocks. 
90 lines changed or deleted 40 lines changed or added


 jsval.h   jsval.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=4 sw=4 et tw=99 ft=cpp: * vim: set ts=4 sw=4 et tw=99 ft=cpp:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* June 30, 2010
*
* The Initial Developer of the Original Code is
* the Mozilla Corporation.
*
* Contributor(s):
* Luke Wagner <lw@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jsvalimpl_h__ #ifndef jsvalimpl_h__
#define jsvalimpl_h__ #define jsvalimpl_h__
/* /*
* Implementation details for js::Value in jsapi.h. * Implementation details for js::Value in jsapi.h.
*/ */
#include "mozilla/FloatingPoint.h"
#include "js/Utility.h" #include "js/Utility.h"
JS_BEGIN_EXTERN_C JS_BEGIN_EXTERN_C
/* /*
* Try to get jsvals 64-bit aligned. We could almost assert that all values are * Try to get jsvals 64-bit aligned. We could almost assert that all values are
* aligned, but MSVC and GCC occasionally break alignment. * aligned, but MSVC and GCC occasionally break alignment.
*/ */
#if defined(__GNUC__) || defined(__xlc__) || defined(__xlC__) #if defined(__GNUC__) || defined(__xlc__) || defined(__xlC__)
# define JSVAL_ALIGNMENT __attribute__((aligned (8))) # define JSVAL_ALIGNMENT __attribute__((aligned (8)))
skipping to change at line 250 skipping to change at line 216
JS_NATIVE_ENUMERATE, /* indicates that a custom enumerate hook forwarded JS_NATIVE_ENUMERATE, /* indicates that a custom enumerate hook forwarded
* to JS_EnumerateState, which really mean s the object can be * to JS_EnumerateState, which really mean s the object can be
* enumerated like a native object. */ * enumerated like a native object. */
JS_NO_ITER_VALUE, /* there is not a pending iterator value * / JS_NO_ITER_VALUE, /* there is not a pending iterator value * /
JS_GENERATOR_CLOSING, /* exception value thrown when closing a g enerator */ JS_GENERATOR_CLOSING, /* exception value thrown when closing a g enerator */
JS_NO_CONSTANT, /* compiler sentinel value */ JS_NO_CONSTANT, /* compiler sentinel value */
JS_THIS_POISON, /* used in debug builds to catch tracing e rrors */ JS_THIS_POISON, /* used in debug builds to catch tracing e rrors */
JS_ARG_POISON, /* used in debug builds to catch tracing e rrors */ JS_ARG_POISON, /* used in debug builds to catch tracing e rrors */
JS_SERIALIZE_NO_NODE, /* an empty subnode in the AST serializer */ JS_SERIALIZE_NO_NODE, /* an empty subnode in the AST serializer */
JS_LAZY_ARGUMENTS, /* lazy arguments value on the stack */ JS_LAZY_ARGUMENTS, /* lazy arguments value on the stack */
JS_UNASSIGNED_ARGUMENTS, /* the initial value of callobj.arguments */
JS_OPTIMIZED_ARGUMENTS, /* optimized-away 'arguments' value */ JS_OPTIMIZED_ARGUMENTS, /* optimized-away 'arguments' value */
JS_IS_CONSTRUCTING, /* magic value passed to natives to indica te construction */ JS_IS_CONSTRUCTING, /* magic value passed to natives to indica te construction */
JS_OVERWRITTEN_CALLEE, /* arguments.callee has been overwritten * / JS_OVERWRITTEN_CALLEE, /* arguments.callee has been overwritten * /
JS_FORWARD_TO_CALL_OBJECT, /* args object element stored in call obje
ct */
JS_BLOCK_NEEDS_CLONE, /* value of static block object slot */
JS_HASH_KEY_EMPTY, /* see class js::HashableValue */
JS_GENERIC_MAGIC /* for local use */ JS_GENERIC_MAGIC /* for local use */
} JSWhyMagic; } JSWhyMagic;
#if defined(IS_LITTLE_ENDIAN) #if defined(IS_LITTLE_ENDIAN)
# if JS_BITS_PER_WORD == 32 # if JS_BITS_PER_WORD == 32
typedef union jsval_layout typedef union jsval_layout
{ {
uint64_t asBits; uint64_t asBits;
struct { struct {
union { union {
int32_t i32; int32_t i32;
uint32_t u32; uint32_t u32;
JSBool boo; JSBool boo;
JSString *str; JSString *str;
JSObject *obj; JSObject *obj;
void *ptr; void *ptr;
JSWhyMagic why; JSWhyMagic why;
size_t word; size_t word;
uintptr_t uintptr;
} payload; } payload;
JSValueTag tag; JSValueTag tag;
} s; } s;
double asDouble; double asDouble;
void *asPtr; void *asPtr;
} JSVAL_ALIGNMENT jsval_layout; } JSVAL_ALIGNMENT jsval_layout;
# elif JS_BITS_PER_WORD == 64 # elif JS_BITS_PER_WORD == 64
typedef union jsval_layout typedef union jsval_layout
{ {
uint64_t asBits; uint64_t asBits;
skipping to change at line 299 skipping to change at line 268
struct { struct {
union { union {
int32_t i32; int32_t i32;
uint32_t u32; uint32_t u32;
JSWhyMagic why; JSWhyMagic why;
} payload; } payload;
} s; } s;
double asDouble; double asDouble;
void *asPtr; void *asPtr;
size_t asWord; size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout; } JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */ # endif /* JS_BITS_PER_WORD */
#else /* defined(IS_LITTLE_ENDIAN) */ #else /* defined(IS_LITTLE_ENDIAN) */
# if JS_BITS_PER_WORD == 32 # if JS_BITS_PER_WORD == 32
typedef union jsval_layout typedef union jsval_layout
{ {
uint64_t asBits; uint64_t asBits;
struct { struct {
JSValueTag tag; JSValueTag tag;
union { union {
int32_t i32; int32_t i32;
uint32_t u32; uint32_t u32;
JSBool boo; JSBool boo;
JSString *str; JSString *str;
JSObject *obj; JSObject *obj;
void *ptr; void *ptr;
JSWhyMagic why; JSWhyMagic why;
size_t word; size_t word;
uintptr_t uintptr;
} payload; } payload;
} s; } s;
double asDouble; double asDouble;
void *asPtr; void *asPtr;
} JSVAL_ALIGNMENT jsval_layout; } JSVAL_ALIGNMENT jsval_layout;
# elif JS_BITS_PER_WORD == 64 # elif JS_BITS_PER_WORD == 64
typedef union jsval_layout typedef union jsval_layout
{ {
uint64_t asBits; uint64_t asBits;
struct { struct {
skipping to change at line 341 skipping to change at line 312
uint32_t padding; uint32_t padding;
union { union {
int32_t i32; int32_t i32;
uint32_t u32; uint32_t u32;
JSWhyMagic why; JSWhyMagic why;
} payload; } payload;
} s; } s;
double asDouble; double asDouble;
void *asPtr; void *asPtr;
size_t asWord; size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout; } JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */ # endif /* JS_BITS_PER_WORD */
#endif /* defined(IS_LITTLE_ENDIAN) */ #endif /* defined(IS_LITTLE_ENDIAN) */
JS_STATIC_ASSERT(sizeof(jsval_layout) == 8); JS_STATIC_ASSERT(sizeof(jsval_layout) == 8);
#if JS_BITS_PER_WORD == 32 #if JS_BITS_PER_WORD == 32
/* /*
* N.B. GCC, in some but not all cases, chooses to emit signed comparison o f * N.B. GCC, in some but not all cases, chooses to emit signed comparison o f
 End of changes. 8 change blocks. 
47 lines changed or deleted 11 lines changed or added


 jsversion.h   jsversion.h 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* /*
* JS configuration macros. * JS configuration macros.
*/ */
#ifndef JS_VERSION #ifndef JS_VERSION
#define JS_VERSION 185 #define JS_VERSION 185
#endif #endif
/* /*
* Compile-time JS version configuration. The JS version numbers lie on th e * Compile-time JS version configuration. The JS version numbers lie on th e
skipping to change at line 94 skipping to change at line 61
#else #else
#define JS_HAS_OBJ_PROTO_PROP 0 /* has o.__proto__ etc. */ #define JS_HAS_OBJ_PROTO_PROP 0 /* has o.__proto__ etc. */
#endif #endif
#define JS_HAS_OBJ_WATCHPOINT 0 /* has o.watch and o.unwatch */ #define JS_HAS_OBJ_WATCHPOINT 0 /* has o.watch and o.unwatch */
#define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */ #define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */
#define JS_HAS_CATCH_GUARD 0 /* has exception handling catch gua rd */ #define JS_HAS_CATCH_GUARD 0 /* has exception handling catch gua rd */
#define JS_HAS_UNEVAL 0 /* has uneval() top-level function */ #define JS_HAS_UNEVAL 0 /* has uneval() top-level function */
#define JS_HAS_CONST 0 /* has JS2 const as alternative var */ #define JS_HAS_CONST 0 /* has JS2 const as alternative var */
#define JS_HAS_FUN_EXPR_STMT 0 /* has function expression statemen t */ #define JS_HAS_FUN_EXPR_STMT 0 /* has function expression statemen t */
#define JS_HAS_NO_SUCH_METHOD 0 /* has o.__noSuchMethod__ handler * / #define JS_HAS_NO_SUCH_METHOD 0 /* has o.__noSuchMethod__ handler * /
#define JS_HAS_XML_SUPPORT 0 /* has ECMAScript for XML support * /
#define JS_HAS_GENERATORS 0 /* has yield in generator function */ #define JS_HAS_GENERATORS 0 /* has yield in generator function */
#define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */ #define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */
#define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */ #define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */
#define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */ #define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */
#define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */ #define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */
#elif JS_VERSION < 150 #elif JS_VERSION < 150
#error "unsupported JS_VERSION" #error "unsupported JS_VERSION"
skipping to change at line 116 skipping to change at line 82
#define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * / #define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * /
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */ #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */ #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */ #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */ #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
#define JS_HAS_CONST 1 /* has JS2 const as alternative var */ #define JS_HAS_CONST 1 /* has JS2 const as alternative var */
#define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */ #define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */
#define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * / #define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * /
#define JS_HAS_XML_SUPPORT 0 /* has ECMAScript for XML support * /
#define JS_HAS_GENERATORS 0 /* has yield in generator function */ #define JS_HAS_GENERATORS 0 /* has yield in generator function */
#define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */ #define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */
#define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */ #define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */
#define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */ #define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */
#define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */ #define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */
#elif JS_VERSION == 160 #elif JS_VERSION == 160
#define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * / #define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * /
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */ #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */ #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */ #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */ #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
#define JS_HAS_CONST 1 /* has JS2 const as alternative var */ #define JS_HAS_CONST 1 /* has JS2 const as alternative var */
#define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */ #define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */
#define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * / #define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * /
#define JS_HAS_XML_SUPPORT 1 /* has ECMAScript for XML support * /
#define JS_HAS_GENERATORS 0 /* has yield in generator function */ #define JS_HAS_GENERATORS 0 /* has yield in generator function */
#define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */ #define JS_HAS_BLOCK_SCOPE 0 /* has block scope via let/arraycom p */
#define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */ #define JS_HAS_DESTRUCTURING 0 /* has [a,b] = ... or {p:a,q:b} = . .. */
#define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */ #define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */
#define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */ #define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */
#elif JS_VERSION == 170 #elif JS_VERSION == 170
#define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * / #define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * /
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */ #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */ #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */ #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */ #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
#define JS_HAS_CONST 1 /* has JS2 const as alternative var */ #define JS_HAS_CONST 1 /* has JS2 const as alternative var */
#define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */ #define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */
#define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * / #define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * /
#define JS_HAS_XML_SUPPORT 1 /* has ECMAScript for XML support * /
#define JS_HAS_GENERATORS 1 /* has yield in generator function */ #define JS_HAS_GENERATORS 1 /* has yield in generator function */
#define JS_HAS_BLOCK_SCOPE 1 /* has block scope via let/arraycom p */ #define JS_HAS_BLOCK_SCOPE 1 /* has block scope via let/arraycom p */
#define JS_HAS_DESTRUCTURING 1 /* has [a,b] = ... or {p:a,q:b} = . .. */ #define JS_HAS_DESTRUCTURING 1 /* has [a,b] = ... or {p:a,q:b} = . .. */
#define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */ #define JS_HAS_GENERATOR_EXPRS 0 /* has (expr for (lhs in iterable)) */
#define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */ #define JS_HAS_EXPR_CLOSURES 0 /* has function (formals) listexpr */
#elif 180 <= JS_VERSION && JS_VERSION <= 185 #elif 180 <= JS_VERSION && JS_VERSION <= 185
#define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * / #define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. * /
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */ #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */ #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */ #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch gua rd */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */ #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
#define JS_HAS_CONST 1 /* has JS2 const as alternative var */ #define JS_HAS_CONST 1 /* has JS2 const as alternative var */
#define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */ #define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statemen t */
#define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * / #define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler * /
#define JS_HAS_XML_SUPPORT 1 /* has ECMAScript for XML support * /
#define JS_HAS_GENERATORS 1 /* has yield in generator function */ #define JS_HAS_GENERATORS 1 /* has yield in generator function */
#define JS_HAS_BLOCK_SCOPE 1 /* has block scope via let/arraycom p */ #define JS_HAS_BLOCK_SCOPE 1 /* has block scope via let/arraycom p */
#define JS_HAS_DESTRUCTURING 2 /* has [a,b] = ... or {p:a,q:b} = . .. */ #define JS_HAS_DESTRUCTURING 2 /* has [a,b] = ... or {p:a,q:b} = . .. */
#define JS_HAS_GENERATOR_EXPRS 1 /* has (expr for (lhs in iterable)) */ #define JS_HAS_GENERATOR_EXPRS 1 /* has (expr for (lhs in iterable)) */
#define JS_HAS_EXPR_CLOSURES 1 /* has function (formals) listexpr */ #define JS_HAS_EXPR_CLOSURES 1 /* has function (formals) listexpr */
#else #else
#error "unknown JS_VERSION" #error "unknown JS_VERSION"
 End of changes. 6 change blocks. 
50 lines changed or deleted 3 lines changed or added


 jswrapper.h   jswrapper.h 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* - /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -* -
* vim: set ts=4 sw=4 et tw=99: * vim: set ts=4 sw=4 et tw=99:
* *
* ***** BEGIN LICENSE BLOCK ***** * This Source Code Form is subject to the terms of the Mozilla Public
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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/. */
* The contents of this file are subject to the Mozilla Public License Vers
ion
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basi
s,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
* May 28, 2008.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Andreas Gal <gal@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL
"),
* in which case the provisions of the GPL or the LGPL are applicable inste
ad
* of those above. If you wish to allow use of your version of this file on
ly
* under the terms of either the GPL or the LGPL, and not to allow others t
o
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the noti
ce
* and other provisions required by the GPL or the LGPL. If you do not dele
te
* the provisions above, a recipient may use your version of this file unde
r
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef jswrapper_h___ #ifndef jswrapper_h___
#define jswrapper_h___ #define jswrapper_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "jsapi.h" #include "jsapi.h"
#include "jsproxy.h" #include "jsproxy.h"
namespace js { namespace js {
class DummyFrameGuard; class DummyFrameGuard;
/* Base class that just implements no-op forwarding methods for fundamental /*
* traps. This is meant to be used as a base class for ProxyHandlers that * A wrapper is essentially a proxy that restricts access to certain traps.
* want transparent forwarding behavior but don't want to use the derived The
* traps and other baggage of js::Wrapper. * way in which a wrapper restricts access to its traps depends on the
* particular policy for that wrapper. To allow a wrapper's policy to be
* customized, the Wrapper base class contains two functions, enter/leave,
which
* are called as a policy enforcement check before/after each trap is forwa
rded.
*
* To minimize code duplication, a set of abstract wrapper classes is
* provided, from which other wrappers may inherit. These abstract classes
are
* organized in the following hierarchy:
*
* BaseProxyHandler Wrapper
* | | |
* IndirectProxyHandler | |
* | | | |
* | IndirectWrapper |
* | |
* DirectProxyHandler |
* | |
* DirectWrapper
*/ */
class JS_FRIEND_API(AbstractWrapper) : public ProxyHandler class JS_FRIEND_API(Wrapper)
{ {
unsigned mFlags; unsigned mFlags;
public: public:
unsigned flags() const { return mFlags; } enum Action {
GET,
SET,
CALL,
PUNCTURE
};
explicit AbstractWrapper(unsigned flags); enum Flags {
CROSS_COMPARTMENT = 1 << 0,
LAST_USED_FLAG = CROSS_COMPARTMENT
};
/* ES5 Harmony fundamental wrapper traps. */ typedef enum {
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, js PermitObjectAccess,
id id, bool set, PermitPropertyAccess,
PropertyDescriptor *desc) MOZ_OVERRI DenyAccess
DE; } Permission;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set, static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto,
PropertyDescriptor *desc) MOZ_OVE JSObject *parent, Wrapper *handler);
RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id, static Wrapper *wrapperHandler(RawObject wrapper);
PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, Auto static JSObject *wrappedObject(RawObject wrapper);
IdVector &props) MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *b explicit Wrapper(unsigned flags);
p) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector & unsigned flags() const {
props) MOZ_OVERRIDE; return mFlags;
virtual bool fix(JSContext *cx, JSObject *wrapper, Value *vp) MOZ_OVERR }
IDE;
/*
* The function Wrapper::New takes a pointer to a Wrapper as the handle
r
* object. It then passes it on to the function NewProxyObject, which
* expects a pointer to a BaseProxyHandler as the handler object. We do
n't
* want to change Wrapper::New to take a pointer to a BaseProxyHandler,
* because that would allow the creation of wrappers with non-wrapper
* handlers. Unfortunately, we can't inherit Wrapper from BaseProxyHand
ler,
* since that would create a dreaded diamond, and we can't use dynamic_
cast
* to cast Wrapper to BaseProxyHandler, since that would require us to
* compile with run time type information. Hence the need for this virt
ual
* function.
*/
virtual BaseProxyHandler *toBaseProxyHandler() = 0;
/* Policy enforcement traps. /* Policy enforcement traps.
* *
* enter() allows the policy to specify whether the caller may perform |act| * enter() allows the policy to specify whether the caller may perform |act|
* on the underlying object's |id| property. In the case when |act| is CALL, * on the underlying object's |id| property. In the case when |act| is CALL,
* |id| is generally JSID_VOID. * |id| is generally JSID_VOID.
* *
* leave() allows the policy to undo various scoped state changes taken
in
* enter(). If enter() succeeds, leave() must be called upon completion
of
* the approved action.
*
* The |act| parameter to enter() specifies the action being performed. GET, * The |act| parameter to enter() specifies the action being performed. GET,
* SET, and CALL are self-explanatory, but PUNCTURE requires more expla * SET, and CALL are self-explanatory, but PUNCTURE requires more
nation: * explanation:
* *
* GET and SET allow for a very fine-grained security membrane, through * GET and SET allow for a very fine-grained security membrane, through
* which access can be granted or denied on a per-property, per-object, and * which access can be granted or denied on a per-property, per-object, and
* per-action basis. Sometimes though, we just want to asks if we can a ccess * per-action basis. Sometimes though, we just want to asks if we can a ccess
* _everything_ behind the wrapper barrier. For example, when the struc tured * _everything_ behind the wrapper barrier. For example, when the struc tured
* clone algorithm runs up against a cross-compartment wrapper, it need s to * clone algorithm runs up against a cross-compartment wrapper, it need s to
* know whether it can enter the compartment and keep cloning, or wheth er it * know whether it can enter the compartment and keep cloning, or wheth er it
* should throw. This is the role of PUNCTURE. * should throw. This is the role of PUNCTURE.
* *
* PUNCTURE allows the policy to specify whether the wrapper barrier ma y * PUNCTURE allows the policy to specify whether the wrapper barrier ma y
* be lifted - that is to say, whether the caller is allowed to access * be lifted - that is to say, whether the caller is allowed to access
* anything that the wrapped object could access. This is a very powerf ul * anything that the wrapped object could access. This is a very powerf ul
* permission, and thus should generally be denied for security wrapper s * permission, and thus should generally be denied for security wrapper s
* except under very special circumstances. When |act| is PUNCTURE, |id | * except under very special circumstances. When |act| is PUNCTURE, |id |
* should be JSID_VOID. * should be JSID_VOID.
* */ */
enum Action { GET, SET, CALL, PUNCTURE }; virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action ac
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action ac t,
t, bool *bp); bool *bp);
virtual void leave(JSContext *cx, JSObject *wrapper); };
/*
* IndirectWrapper forwards its traps by forwarding them to
* IndirectProxyHandler. In effect, IndirectWrapper behaves the same as
* IndirectProxyHandler, except that it adds policy enforcement checks to e
ach
* fundamental trap.
*/
class JS_FRIEND_API(IndirectWrapper) : public Wrapper,
public IndirectProxyHandler
{
public:
explicit IndirectWrapper(unsigned flags);
virtual BaseProxyHandler* toBaseProxyHandler() {
return this;
}
virtual Wrapper *toWrapper() {
return this;
}
/* ES5 Harmony fundamental wrapper traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVERRI
DE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVE
RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AutoIdVector &props) MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id,
bool *bp) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JSObject *wrapper,
AutoIdVector &props) MOZ_OVERRIDE;
static JSObject *wrappedObject(const JSObject *wrapper); /* Spidermonkey extensions. */
static AbstractWrapper *wrapperHandler(const JSObject *wrapper); virtual bool defaultValue(JSContext *cx, JSObject *wrapper_, JSType hin
t,
Value *vp) MOZ_OVERRIDE;
}; };
/* No-op wrapper handler base class. */ /*
class JS_FRIEND_API(Wrapper) : public AbstractWrapper * DirectWrapper forwards its traps by forwarding them to DirectProxyHandle
r.
* In effect, DirectWrapper behaves the same as DirectProxyHandler, except
that
* it adds policy enforcement checks to each trap.
*/
class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHand
ler
{ {
public: public:
explicit Wrapper(unsigned flags); explicit DirectWrapper(unsigned flags, bool hasPrototype = false);
virtual ~DirectWrapper();
virtual BaseProxyHandler* toBaseProxyHandler() {
return this;
}
typedef enum { PermitObjectAccess, PermitPropertyAccess, DenyAccess } P virtual Wrapper *toWrapper() {
ermission; return this;
}
virtual ~Wrapper(); /* ES5 Harmony fundamental wrapper traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVERRI
DE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVE
RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
AutoIdVector &props) MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id,
bool *bp) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JSObject *wrapper,
AutoIdVector &props) MOZ_OVERRIDE;
/* ES5 Harmony derived wrapper traps. */ /* ES5 Harmony derived wrapper traps. */
virtual bool has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp) M OZ_OVERRIDE; virtual bool has(JSContext *cx, JSObject *wrapper, jsid id, bool *bp) M OZ_OVERRIDE;
virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp ) MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp ) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp) MOZ_OVERRIDE;
virtual bool set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict, virtual bool set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict,
Value *vp) MOZ_OVERRIDE; Value *vp) MOZ_OVERRIDE;
virtual bool keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props ) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props ) MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp) MOZ_OVERRIDE;
/* Spidermonkey extensions. */ /* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Valu e *vp) MOZ_OVERRIDE; virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Valu e *vp) MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp
Native native, CallArgs args) MOZ_OVERRIDE; l impl,
CallArgs args) MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE;
virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE;
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo
ntext *cx) MOZ_OVERRIDE;
virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OV ERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OV ERRIDE;
virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsign ed indent) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsign ed indent) MOZ_OVERRIDE;
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar virtual bool defaultValue(JSContext *cx, JSObject *wrapper_, JSType hin
d *g) MOZ_OVERRIDE; t,
virtual bool defaultValue(JSContext *cx, JSObject *wrapper, JSType hint Value *vp) MOZ_OVERRIDE;
, Value *vp) MOZ_OVERRIDE;
virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp)
MOZ_OVERRIDE;
virtual void trace(JSTracer *trc, JSObject *wrapper) MOZ_OVERRIDE;
using AbstractWrapper::Action;
static Wrapper singleton;
static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSO
bject *parent,
Wrapper *handler);
using AbstractWrapper::wrappedObject; static DirectWrapper singleton;
using AbstractWrapper::wrapperHandler; static DirectWrapper singletonWithPrototype;
enum {
CROSS_COMPARTMENT = 1 << 0,
LAST_USED_FLAG = CROSS_COMPARTMENT
};
static void *getWrapperFamily(); static void *getWrapperFamily();
}; };
/* Base class for all cross compartment wrapper handlers. */ /* Base class for all cross compartment wrapper handlers. */
class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper
{ {
public: public:
CrossCompartmentWrapper(unsigned flags); CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false);
virtual ~CrossCompartmentWrapper(); virtual ~CrossCompartmentWrapper();
/* ES5 Harmony fundamental wrapper traps. */ /* ES5 Harmony fundamental wrapper traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, js id id, bool set, virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, js id id, bool set,
PropertyDescriptor *desc) MOZ_OVERRI DE; PropertyDescriptor *desc) MOZ_OVERRI DE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, bool set, virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVE RRIDE; PropertyDescriptor *desc) MOZ_OVE RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id, virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc) MOZ_OVERRIDE; PropertyDescriptor *desc) MOZ_OVERRIDE;
skipping to change at line 198 skipping to change at line 254
virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp ) MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp ) MOZ_OVERRIDE;
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp) MOZ_OVERRIDE; virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp) MOZ_OVERRIDE;
virtual bool set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict, virtual bool set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool strict,
Value *vp) MOZ_OVERRIDE; Value *vp) MOZ_OVERRIDE;
virtual bool keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props ) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JSObject *wrapper, AutoIdVector &props ) MOZ_OVERRIDE;
virtual bool iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JSObject *wrapper, unsigned flags, Value *vp) MOZ_OVERRIDE;
/* Spidermonkey extensions. */ /* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Valu e *vp) MOZ_OVERRIDE; virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Valu e *vp) MOZ_OVERRIDE;
virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE;
virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp
Native native, CallArgs args) MOZ_OVERRIDE; l impl,
CallArgs args) MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE;
virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OV ERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OV ERRIDE;
virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsign ed indent) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsign ed indent) MOZ_OVERRIDE;
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar d *g) MOZ_OVERRIDE;
virtual bool defaultValue(JSContext *cx, JSObject *wrapper, JSType hint , Value *vp) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, JSObject *wrapper, JSType hint , Value *vp) MOZ_OVERRIDE;
virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp); virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp);
virtual void trace(JSTracer *trc, JSObject *wrapper) MOZ_OVERRIDE;
static CrossCompartmentWrapper singleton; static CrossCompartmentWrapper singleton;
static CrossCompartmentWrapper singletonWithPrototype;
}; };
/* /*
* Base class for security wrappers. A security wrapper is potentially hidi ng * Base class for security wrappers. A security wrapper is potentially hidi ng
* all or part of some wrapped object thus SecurityWrapper defaults to deny ing * all or part of some wrapped object thus SecurityWrapper defaults to deny ing
* access to the wrappee. This is the opposite of Wrapper which tries to be * access to the wrappee. This is the opposite of Wrapper which tries to be
* completely transparent. * completely transparent.
* *
* NB: Currently, only a few ProxyHandler operations are overridden to deny * NB: Currently, only a few ProxyHandler operations are overridden to deny
* access, relying on derived SecurityWrapper to block access when necessar y. * access, relying on derived SecurityWrapper to block access when necessar y.
*/ */
template <class Base> template <class Base>
class JS_FRIEND_API(SecurityWrapper) : public Base class JS_FRIEND_API(SecurityWrapper) : public Base
{ {
public: public:
SecurityWrapper(unsigned flags); SecurityWrapper(unsigned flags);
virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp
Native native, CallArgs args) MOZ_OVERRIDE; l impl,
CallArgs args) MOZ_OVERRIDE;
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo ntext *cx) MOZ_OVERRIDE; virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo ntext *cx) MOZ_OVERRIDE;
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar d *g) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar d *g) MOZ_OVERRIDE;
}; };
typedef SecurityWrapper<Wrapper> SameCompartmentSecurityWrapper; typedef SecurityWrapper<DirectWrapper> SameCompartmentSecurityWrapper;
typedef SecurityWrapper<CrossCompartmentWrapper> CrossCompartmentSecurityWr apper; typedef SecurityWrapper<CrossCompartmentWrapper> CrossCompartmentSecurityWr apper;
/* class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
* A hacky class that lets a friend force a fake frame. We must already be
* in the compartment of |target| when we enter the forced frame.
*/
class JS_FRIEND_API(ForceFrame)
{ {
public: public:
JSContext * const context; static int sDeadObjectFamily;
JSObject * const target;
private:
DummyFrameGuard *frame;
public: explicit DeadObjectProxy();
ForceFrame(JSContext *cx, JSObject *target);
~ForceFrame(); /* ES5 Harmony fundamental wrapper traps. */
bool enter(); virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, js
id id, bool set,
PropertyDescriptor *desc) MOZ_OVERRI
DE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JSObject *wrapper,
jsid id, bool set,
PropertyDescriptor *desc) MOZ_OVE
RRIDE;
virtual bool defineProperty(JSContext *cx, JSObject *wrapper, jsid id,
PropertyDescriptor *desc) MOZ_OVERRIDE;
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, Auto
IdVector &props) MOZ_OVERRIDE;
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *b
p) MOZ_OVERRIDE;
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &
props) MOZ_OVERRIDE;
/* Spidermonkey extensions. */
virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value
*vp);
virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, V
alue *argv, Value *rval);
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImp
l impl,
CallArgs args) MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *v
p, bool *bp);
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSCo
ntext *cx);
virtual JSString *obj_toString(JSContext *cx, JSObject *proxy);
virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned
indent);
virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuar
d *g);
virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Va
lue *vp);
virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp);
virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject
*receiver,
uint32_t index, Value *vp, bool *prese
nt);
static DeadObjectProxy singleton;
}; };
extern JSObject * extern JSObject *
TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedPro to, JSObject *parent, TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedPro to, JSObject *parent,
unsigned flags); unsigned flags);
// Proxy family for wrappers. Public so that IsWrapper() can be fully inlin ed by // Proxy family for wrappers. Public so that IsWrapper() can be fully inlin ed by
// jsfriendapi users. // jsfriendapi users.
extern JS_FRIEND_DATA(int) sWrapperFamily; extern JS_FRIEND_DATA(int) sWrapperFamily;
inline bool inline bool
IsWrapper(const JSObject *obj) IsWrapper(RawObject obj)
{ {
return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamil y; return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamil y;
} }
// Given a JSObject, returns that object stripped of wrappers. If // Given a JSObject, returns that object stripped of wrappers. If
// stopAtOuter is true, then this returns the outer window if it was // stopAtOuter is true, then this returns the outer window if it was
// previously wrapped. Otherwise, this returns the first object for // previously wrapped. Otherwise, this returns the first object for
// which JSObject::isWrapper returns false. // which JSObject::isWrapper returns false.
JS_FRIEND_API(JSObject *) UnwrapObject(JSObject *obj, bool stopAtOuter = tr JS_FRIEND_API(JSObject *)
ue, UnwrapObject(JSObject *obj, bool stopAtOuter = true, unsigned *flagsp = NUL
unsigned *flagsp = NULL); L);
// Given a JSObject, returns that object stripped of wrappers. At each stag e, // Given a JSObject, returns that object stripped of wrappers. At each stag e,
// the security wrapper has the opportunity to veto the unwrap. Since check ed // the security wrapper has the opportunity to veto the unwrap. Since check ed
// code should never be unwrapping outer window wrappers, we always stop at // code should never be unwrapping outer window wrappers, we always stop at
// outer windows. // outer windows.
JS_FRIEND_API(JSObject *) UnwrapObjectChecked(JSContext *cx, JSObject *obj) JS_FRIEND_API(JSObject *)
; UnwrapObjectChecked(JSContext *cx, JSObject *obj);
// Unwrap only the outermost security wrapper, with the same semantics as
// above. This is the checked version of Wrapper::wrappedObject.
JS_FRIEND_API(JSObject *)
UnwrapOneChecked(JSContext *cx, JSObject *obj);
JS_FRIEND_API(bool)
IsCrossCompartmentWrapper(RawObject obj);
bool IsCrossCompartmentWrapper(const JSObject *obj); JSObject *
NewDeadProxyObject(JSContext *cx, JSObject *parent);
void void
NukeCrossCompartmentWrapper(JSObject *wrapper); NukeCrossCompartmentWrapper(JSObject *wrapper);
bool
RemapWrapper(JSContext *cx, JSObject *wobj, JSObject *newTarget);
JS_FRIEND_API(bool)
RemapAllWrappersForObject(JSContext *cx, JSObject *oldTarget,
JSObject *newTarget);
// API to recompute all cross-compartment wrappers whose source and target
// match the given filters.
JS_FRIEND_API(bool)
RecomputeWrappers(JSContext *cx, const CompartmentFilter &sourceFilter,
const CompartmentFilter &targetFilter);
} /* namespace js */ } /* namespace js */
#endif #endif
 End of changes. 35 change blocks. 
150 lines changed or deleted 258 lines changed or added


 list.h   list.h 
skipping to change at line 56 skipping to change at line 56
* @user: extra user provided data to the walker * @user: extra user provided data to the walker
* *
* Callback function used when walking a list with xmlListWalk(). * Callback function used when walking a list with xmlListWalk().
* *
* Returns 0 to stop walking the list, 1 otherwise. * Returns 0 to stop walking the list, 1 otherwise.
*/ */
typedef int (*xmlListWalker) (const void *data, const void *user); typedef int (*xmlListWalker) (const void *data, const void *user);
/* Creation/Deletion */ /* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL XMLPUBFUN xmlListPtr XMLCALL
xmlListCreate (xmlListDeallocator deallocator, xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare); xmlListDataCompare compare);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListDelete (xmlListPtr l); xmlListDelete (xmlListPtr l);
/* Basic Operators */ /* Basic Operators */
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlListSearch (xmlListPtr l, xmlListSearch (xmlListPtr l,
void *data); void *data);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlListReverseSearch (xmlListPtr l, xmlListReverseSearch (xmlListPtr l,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListInsert (xmlListPtr l, xmlListInsert (xmlListPtr l,
void *data) ; void *data) ;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListAppend (xmlListPtr l, xmlListAppend (xmlListPtr l,
void *data) ; void *data) ;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListRemoveFirst (xmlListPtr l, xmlListRemoveFirst (xmlListPtr l,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListRemoveLast (xmlListPtr l, xmlListRemoveLast (xmlListPtr l,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListRemoveAll (xmlListPtr l, xmlListRemoveAll (xmlListPtr l,
void *data); void *data);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListClear (xmlListPtr l); xmlListClear (xmlListPtr l);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListEmpty (xmlListPtr l); xmlListEmpty (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL XMLPUBFUN xmlLinkPtr XMLCALL
xmlListFront (xmlListPtr l); xmlListFront (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL XMLPUBFUN xmlLinkPtr XMLCALL
xmlListEnd (xmlListPtr l); xmlListEnd (xmlListPtr l);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListSize (xmlListPtr l); xmlListSize (xmlListPtr l);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListPopFront (xmlListPtr l); xmlListPopFront (xmlListPtr l);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListPopBack (xmlListPtr l); xmlListPopBack (xmlListPtr l);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListPushFront (xmlListPtr l, xmlListPushFront (xmlListPtr l,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListPushBack (xmlListPtr l, xmlListPushBack (xmlListPtr l,
void *data); void *data);
/* Advanced Operators */ /* Advanced Operators */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListReverse (xmlListPtr l); xmlListReverse (xmlListPtr l);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListSort (xmlListPtr l); xmlListSort (xmlListPtr l);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListWalk (xmlListPtr l, xmlListWalk (xmlListPtr l,
xmlListWalker walker, xmlListWalker walker,
const void *user); const void *user);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListReverseWalk (xmlListPtr l, xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker, xmlListWalker walker,
const void *user); const void *user);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlListMerge (xmlListPtr l1, xmlListMerge (xmlListPtr l1,
xmlListPtr l2); xmlListPtr l2);
XMLPUBFUN xmlListPtr XMLCALL XMLPUBFUN xmlListPtr XMLCALL
xmlListDup (const xmlListPtr old); xmlListDup (const xmlListPtr old);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlListCopy (xmlListPtr cur, xmlListCopy (xmlListPtr cur,
const xmlListPtr old); const xmlListPtr old);
/* Link operators */ /* Link operators */
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlLinkGetData (xmlLinkPtr lk); xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */ /* xmlListUnique() */
/* xmlListSwap */ /* xmlListSwap */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __XML_LINK_INCLUDE__ */ #endif /* __XML_LINK_INCLUDE__ */
 End of changes. 26 change blocks. 
42 lines changed or deleted 42 lines changed or added


 nanohttp.h   nanohttp.h 
skipping to change at line 22 skipping to change at line 22
#define __NANO_HTTP_H__ #define __NANO_HTTP_H__
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_ENABLED #ifdef LIBXML_HTTP_ENABLED
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoHTTPInit (void); xmlNanoHTTPInit (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoHTTPCleanup (void); xmlNanoHTTPCleanup (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoHTTPScanProxy (const char *URL); xmlNanoHTTPScanProxy (const char *URL);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoHTTPFetch (const char *URL, xmlNanoHTTPFetch (const char *URL,
const char *filename, const char *filename,
char **contentType); char **contentType);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethod (const char *URL, xmlNanoHTTPMethod (const char *URL,
const char *method, const char *method,
const char *input, const char *input,
char **contentType, char **contentType,
const char *headers, const char *headers,
int ilen); int ilen);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethodRedir (const char *URL, xmlNanoHTTPMethodRedir (const char *URL,
const char *method, const char *method,
const char *input, const char *input,
char **contentType, char **contentType,
char **redir, char **redir,
const char *headers, const char *headers,
int ilen); int ilen);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpen (const char *URL, xmlNanoHTTPOpen (const char *URL,
char **contentType); char **contentType);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpenRedir (const char *URL, xmlNanoHTTPOpenRedir (const char *URL,
char **contentType, char **contentType,
char **redir); char **redir);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoHTTPReturnCode (void *ctx); xmlNanoHTTPReturnCode (void *ctx);
XMLPUBFUN const char * XMLCALL XMLPUBFUN const char * XMLCALL
xmlNanoHTTPAuthHeader (void *ctx); xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL XMLPUBFUN const char * XMLCALL
xmlNanoHTTPRedir (void *ctx); xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoHTTPContentLength( void * ctx ); xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL XMLPUBFUN const char * XMLCALL
xmlNanoHTTPEncoding (void *ctx); xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL XMLPUBFUN const char * XMLCALL
xmlNanoHTTPMimeType (void *ctx); xmlNanoHTTPMimeType (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoHTTPRead (void *ctx, xmlNanoHTTPRead (void *ctx,
void *dest, void *dest,
int len); int len);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoHTTPSave (void *ctxt, xmlNanoHTTPSave (void *ctxt,
const char *filename); const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoHTTPClose (void *ctx); xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_HTTP_ENABLED */ #endif /* LIBXML_HTTP_ENABLED */
#endif /* __NANO_HTTP_H__ */ #endif /* __NANO_HTTP_H__ */
 End of changes. 17 change blocks. 
36 lines changed or deleted 36 lines changed or added


 parserInternals.h   parserInternals.h 
skipping to change at line 56 skipping to change at line 56
* at runtime. * at runtime.
*/ */
#define XML_MAX_NAMELEN 100 #define XML_MAX_NAMELEN 100
/** /**
* INPUT_CHUNK: * INPUT_CHUNK:
* *
* The parser tries to always have that amount of input ready. * The parser tries to always have that amount of input ready.
* One of the point is providing context when reporting errors. * One of the point is providing context when reporting errors.
*/ */
#define INPUT_CHUNK 250 #define INPUT_CHUNK 250
/************************************************************************ /************************************************************************
* * * *
* UNICODE version of the macros. * UNICODE version of the macros. *
* * *
* *
************************************************************************/ ************************************************************************/
/** /**
* IS_BYTE_CHAR: * IS_BYTE_CHAR:
* @c: an byte value (int) * @c: an byte value (int)
* *
* Macro to check the following production in the XML spec: * Macro to check the following production in the XML spec:
* *
* [2] Char ::= #x9 | #xA | #xD | [#x20...] * [2] Char ::= #x9 | #xA | #xD | [#x20...]
* any byte character in the accepted range * any byte character in the accepted range
*/ */
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) #define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
/** /**
* IS_CHAR: * IS_CHAR:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
* *
* Macro to check the following production in the XML spec: * Macro to check the following production in the XML spec:
* *
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
* | [#x10000-#x10FFFF] * | [#x10000-#x10FFFF]
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
skipping to change at line 217 skipping to change at line 217
*/ */
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) #define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
/** /**
* IS_ASCII_LETTER: * IS_ASCII_LETTER:
* @c: an xmlChar value * @c: an xmlChar value
* *
* Macro to check [a-zA-Z] * Macro to check [a-zA-Z]
* *
*/ */
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ #define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a))) ((0x61 <= (c)) && ((c) <= 0x7a)))
/** /**
* IS_ASCII_DIGIT: * IS_ASCII_DIGIT:
* @c: an xmlChar value * @c: an xmlChar value
* *
* Macro to check [0-9] * Macro to check [0-9]
* *
*/ */
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) #define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
/** /**
* IS_PUBIDCHAR: * IS_PUBIDCHAR:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
* *
* Macro to check the following production in the XML spec: * Macro to check the following production in the XML spec:
* *
* *
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_% ] * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_% ]
*/ */
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) #define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
/** /**
* IS_PUBIDCHAR_CH: * IS_PUBIDCHAR_CH:
* @c: an xmlChar value (normally unsigned char) * @c: an xmlChar value (normally unsigned char)
* *
* Same as IS_PUBIDCHAR but for single-byte value * Same as IS_PUBIDCHAR but for single-byte value
*/ */
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/** /**
* SKIP_EOL: * SKIP_EOL:
* @p: and UTF8 string pointer * @p: and UTF8 string pointer
* *
* Skips the end of line chars. * Skips the end of line chars.
*/ */
#define SKIP_EOL(p) \ #define SKIP_EOL(p) \
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
/** /**
* MOVETO_ENDTAG: * MOVETO_ENDTAG:
* @p: and UTF8 string pointer * @p: and UTF8 string pointer
* *
* Skips to the next '>' char. * Skips to the next '>' char.
*/ */
#define MOVETO_ENDTAG(p) \ #define MOVETO_ENDTAG(p) \
while ((*p) && (*(p) != '>')) (p)++ while ((*p) && (*(p) != '>')) (p)++
/** /**
* MOVETO_STARTTAG: * MOVETO_STARTTAG:
* @p: and UTF8 string pointer * @p: and UTF8 string pointer
* *
* Skips to the next '<' char. * Skips to the next '<' char.
*/ */
#define MOVETO_STARTTAG(p) \ #define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++ while ((*p) && (*(p) != '<')) (p)++
/** /**
* Global variables used for predefined strings. * Global variables used for predefined strings.
*/ */
XMLPUBVAR const xmlChar xmlStringText[]; XMLPUBVAR const xmlChar xmlStringText[];
XMLPUBVAR const xmlChar xmlStringTextNoenc[]; XMLPUBVAR const xmlChar xmlStringTextNoenc[];
XMLPUBVAR const xmlChar xmlStringComment[]; XMLPUBVAR const xmlChar xmlStringComment[];
/* /*
* Function to finish the work of the macros where needed. * Function to finish the work of the macros where needed.
*/ */
XMLPUBFUN int XMLCALL xmlIsLetter (int c); XMLPUBFUN int XMLCALL xmlIsLetter (int c);
/** /**
* Parser context. * Parser context.
*/ */
XMLPUBFUN xmlParserCtxtPtr XMLCALL XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateFileParserCtxt (const char *filename); xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxtPtr XMLCALL XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateURLParserCtxt (const char *filename, xmlCreateURLParserCtxt (const char *filename,
int options); int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer, xmlCreateMemoryParserCtxt(const char *buffer,
int size); int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL, xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID, const xmlChar *ID,
const xmlChar *base); const xmlChar *base);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSwitchEncoding (xmlParserCtxtPtr ctxt, xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc); xmlCharEncoding enc);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler); xmlCharEncodingHandlerPtr handler);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler); xmlCharEncodingHandlerPtr handler);
#ifdef IN_LIBXML #ifdef IN_LIBXML
/* internal error reporting */ /* internal error reporting */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
__xmlErrEncoding (xmlParserCtxtPtr ctxt, __xmlErrEncoding (xmlParserCtxtPtr ctxt,
xmlParserErrors xmlerr, xmlParserErrors xmlerr,
const char *msg, const char *msg,
const xmlChar * str1, const xmlChar * str1,
const xmlChar * str2); const xmlChar * str2);
#endif #endif
/** /**
* Input Streams. * Input Streams.
*/ */
XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewStringInputStream (xmlParserCtxtPtr ctxt, xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar *buffer); const xmlChar *buffer);
XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity); xmlEntityPtr entity);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPushInput (xmlParserCtxtPtr ctxt, xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input); xmlParserInputPtr input);
XMLPUBFUN xmlChar XMLCALL XMLPUBFUN xmlChar XMLCALL
xmlPopInput (xmlParserCtxtPtr ctxt); xmlPopInput (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeInputStream (xmlParserInputPtr input); xmlFreeInputStream (xmlParserInputPtr input);
XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputFromFile (xmlParserCtxtPtr ctxt, xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename); const char *filename);
XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputStream (xmlParserCtxtPtr ctxt); xmlNewInputStream (xmlParserCtxtPtr ctxt);
/** /**
* Namespaces. * Namespaces.
*/ */
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlSplitQName (xmlParserCtxtPtr ctxt, xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar *name, const xmlChar *name,
xmlChar **prefix); xmlChar **prefix);
/** /**
* Generic production rules. * Generic production rules.
*/ */
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlParseName (xmlParserCtxtPtr ctxt); xmlParseName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseNmtoken (xmlParserCtxtPtr ctxt); xmlParseNmtoken (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseEntityValue (xmlParserCtxtPtr ctxt, xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig); xmlChar **orig);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseAttValue (xmlParserCtxtPtr ctxt); xmlParseAttValue (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseCharData (xmlParserCtxtPtr ctxt, xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata); int cdata);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseExternalID (xmlParserCtxtPtr ctxt, xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID, xmlChar **publicID,
int strict); int strict);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseComment (xmlParserCtxtPtr ctxt); xmlParseComment (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlParsePITarget (xmlParserCtxtPtr ctxt); xmlParsePITarget (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParsePI (xmlParserCtxtPtr ctxt); xmlParsePI (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseNotationDecl (xmlParserCtxtPtr ctxt); xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseEntityDecl (xmlParserCtxtPtr ctxt); xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value); xmlChar **value);
XMLPUBFUN xmlEnumerationPtr XMLCALL XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseNotationType (xmlParserCtxtPtr ctxt); xmlParseNotationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEnumerationPtr XMLCALL XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseEnumerationType (xmlParserCtxtPtr ctxt); xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree); xmlEnumerationPtr *tree);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseAttributeType (xmlParserCtxtPtr ctxt, xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree); xmlEnumerationPtr *tree);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlElementContentPtr XMLCALL XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementMixedContentDecl xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt, (xmlParserCtxtPtr ctxt,
int inputchk); int inputchk);
XMLPUBFUN xmlElementContentPtr XMLCALL XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementChildrenContentDecl xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt, (xmlParserCtxtPtr ctxt,
int inputchk); int inputchk);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name, const xmlChar *name,
xmlElementContentPtr *resul xmlElementContentPtr *result);
t);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseElementDecl (xmlParserCtxtPtr ctxt); xmlParseElementDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseCharRef (xmlParserCtxtPtr ctxt); xmlParseCharRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEntityPtr XMLCALL XMLPUBFUN xmlEntityPtr XMLCALL
xmlParseEntityRef (xmlParserCtxtPtr ctxt); xmlParseEntityRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseReference (xmlParserCtxtPtr ctxt); xmlParseReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParsePEReference (xmlParserCtxtPtr ctxt); xmlParsePEReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED #ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlParseAttribute (xmlParserCtxtPtr ctxt, xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value); xmlChar **value);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlParseStartTag (xmlParserCtxtPtr ctxt); xmlParseStartTag (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseEndTag (xmlParserCtxtPtr ctxt); xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseCDSect (xmlParserCtxtPtr ctxt); xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseContent (xmlParserCtxtPtr ctxt); xmlParseContent (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseElement (xmlParserCtxtPtr ctxt); xmlParseElement (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionNum (xmlParserCtxtPtr ctxt); xmlParseVersionNum (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionInfo (xmlParserCtxtPtr ctxt); xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseEncName (xmlParserCtxtPtr ctxt); xmlParseEncName (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseSDDecl (xmlParserCtxtPtr ctxt); xmlParseSDDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseXMLDecl (xmlParserCtxtPtr ctxt); xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseTextDecl (xmlParserCtxtPtr ctxt); xmlParseTextDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseMisc (xmlParserCtxtPtr ctxt); xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseExternalSubset (xmlParserCtxtPtr ctxt, xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar *ExternalID, const xmlChar *ExternalID,
const xmlChar *SystemID); const xmlChar *SystemID);
/** /**
* XML_SUBSTITUTE_NONE: * XML_SUBSTITUTE_NONE:
* *
* If no entities need to be substituted. * If no entities need to be substituted.
*/ */
#define XML_SUBSTITUTE_NONE 0 #define XML_SUBSTITUTE_NONE 0
/** /**
* XML_SUBSTITUTE_REF: * XML_SUBSTITUTE_REF:
* *
* Whether general entities need to be substituted. * Whether general entities need to be substituted.
*/ */
#define XML_SUBSTITUTE_REF 1 #define XML_SUBSTITUTE_REF 1
/** /**
* XML_SUBSTITUTE_PEREF: * XML_SUBSTITUTE_PEREF:
* *
* Whether parameter entities need to be substituted. * Whether parameter entities need to be substituted.
*/ */
#define XML_SUBSTITUTE_PEREF 2 #define XML_SUBSTITUTE_PEREF 2
/** /**
* XML_SUBSTITUTE_BOTH: * XML_SUBSTITUTE_BOTH:
* *
* Both general and parameter entities need to be substituted. * Both general and parameter entities need to be substituted.
*/ */
#define XML_SUBSTITUTE_BOTH 3 #define XML_SUBSTITUTE_BOTH 3
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str, const xmlChar *str,
int what, int what,
xmlChar end, xmlChar end,
xmlChar end2, xmlChar end2,
xmlChar end3); xmlChar end3);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str, const xmlChar *str,
int len, int len,
int what, int what,
xmlChar end, xmlChar end,
xmlChar end2, xmlChar end2,
xmlChar end3); xmlChar end3);
/* /*
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
*/ */
XMLPUBFUN int XMLCALL nodePush (xmlParserCt XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
xtPtr ctxt, xmlNodePtr value);
xmlNodePtr value); XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ct
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCt xt);
xtPtr ctxt); XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
XMLPUBFUN int XMLCALL inputPush (xmlParserCt xmlParserInputPtr value);
xtPtr ctxt, XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ct
xmlParserInputPtr value); xt);
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCt XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr c
xtPtr ctxt); txt);
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCt XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
xtPtr ctxt); const xmlChar *value);
XMLPUBFUN int XMLCALL namePush (xmlParserCt
xtPtr ctxt,
const xmlChar *value);
/* /*
* other commodities shared between parser.c and parserInternals. * other commodities shared between parser.c and parserInternals.
*/ */
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCt XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctx
xtPtr ctxt); t);
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCt XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr
xtPtr ctxt, ctxt,
const xmlChar *cur, const xmlChar *cur,
int *len); int *len);
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParser XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtP
CtxtPtr ctxt); tr ctxt);
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlCh XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang
ar *lang); );
/* /*
* Really core function shared with HTML parser. * Really core function shared with HTML parser.
*/ */
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCt XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ct
xtPtr ctxt, xt,
int *len); int *len);
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
int val); int val);
XMLPUBFUN int XMLCALL xmlCopyChar (int len, XMLPUBFUN int XMLCALL xmlCopyChar (int len,
xmlChar *out, xmlChar *out,
int val); int val);
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCt XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt
xtPtr ctxt); );
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserIn XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPt
putPtr in); r in);
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
/* /*
* Actually comes from the HTML parser but launched from the init stuff. * Actually comes from the HTML parser but launched from the init stuff.
*/ */
XMLPUBFUN void XMLCALL htmlInitAutoClose (void); XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char
*filename, *filename,
const char *encoding); const char *encoding);
#endif #endif
/* /*
* Specific function to keep track of entities references * Specific function to keep track of entities references
* and used by the XSLT debugger. * and used by the XSLT debugger.
*/ */
#ifdef LIBXML_LEGACY_ENABLED #ifdef LIBXML_LEGACY_ENABLED
/** /**
* xmlEntityReferenceFunc: * xmlEntityReferenceFunc:
* @ent: the entity * @ent: the entity
* @firstNode: the fist node in the chunk * @firstNode: the fist node in the chunk
* @lastNode: the last nod in the chunk * @lastNode: the last nod in the chunk
* *
* Callback function used when one needs to be able to track back the * Callback function used when one needs to be able to track back the
* provenance of a chunk of nodes inherited from an entity replacement. * provenance of a chunk of nodes inherited from an entity replacement.
*/ */
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr firstNode, xmlNodePtr firstNode,
xmlNodePtr lastNode); xmlNodePtr lastNode);
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityRe ferenceFunc func); XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityRefere nceFunc func);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlParseQuotedString (xmlParserCtxtPtr ctxt); xmlParseQuotedString (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlParseNamespace (xmlParserCtxtPtr ctxt); xmlParseNamespace (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlScanName (xmlParserCtxtPtr ctxt); xmlScanName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar **prefix); xmlChar **prefix);
/** /**
* Entities * Entities
*/ */
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlDecodeEntities (xmlParserCtxtPtr ctxt, xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len, int len,
int what, int what,
xmlChar end, xmlChar end,
xmlChar end2, xmlChar end2,
xmlChar end3); xmlChar end3);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlHandleEntity (xmlParserCtxtPtr ctxt, xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity); xmlEntityPtr entity);
#endif /* LIBXML_LEGACY_ENABLED */ #endif /* LIBXML_LEGACY_ENABLED */
#ifdef IN_LIBXML #ifdef IN_LIBXML
/* /*
* internal only * internal only
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlErrMemory (xmlParserCtxtPtr ctxt, xmlErrMemory (xmlParserCtxtPtr ctxt,
const char *extra); const char *extra);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __XML_PARSER_INTERNALS_H__ */ #endif /* __XML_PARSER_INTERNALS_H__ */
 End of changes. 85 change blocks. 
192 lines changed or deleted 187 lines changed or added


 pattern.h   pattern.h 
skipping to change at line 40 skipping to change at line 40
typedef xmlPattern *xmlPatternPtr; typedef xmlPattern *xmlPatternPtr;
/** /**
* xmlPatternFlags: * xmlPatternFlags:
* *
* This is the set of options affecting the behaviour of pattern * This is the set of options affecting the behaviour of pattern
* matching with this module * matching with this module
* *
*/ */
typedef enum { typedef enum {
XML_PATTERN_DEFAULT = 0, /* simple pattern match */ XML_PATTERN_DEFAULT = 0, /* simple pattern match */
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector
*/ */
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema f XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field *
ield */ /
} xmlPatternFlags; } xmlPatternFlags;
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreePattern (xmlPatternPtr comp); xmlFreePattern (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreePatternList (xmlPatternPtr comp); xmlFreePatternList (xmlPatternPtr comp);
XMLPUBFUN xmlPatternPtr XMLCALL XMLPUBFUN xmlPatternPtr XMLCALL
xmlPatterncompile (const xmlChar *pattern, xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict, xmlDict *dict,
int flags, int flags,
const xmlChar **namespaces) const xmlChar **namespaces);
;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPatternMatch (xmlPatternPtr comp, xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node); xmlNodePtr node);
/* streaming interfaces */ /* streaming interfaces */
typedef struct _xmlStreamCtxt xmlStreamCtxt; typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr; typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPatternStreamable (xmlPatternPtr comp); xmlPatternStreamable (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPatternMaxDepth (xmlPatternPtr comp); xmlPatternMaxDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPatternMinDepth (xmlPatternPtr comp); xmlPatternMinDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlPatternFromRoot (xmlPatternPtr comp); xmlPatternFromRoot (xmlPatternPtr comp);
XMLPUBFUN xmlStreamCtxtPtr XMLCALL XMLPUBFUN xmlStreamCtxtPtr XMLCALL
xmlPatternGetStreamCtxt (xmlPatternPtr comp); xmlPatternGetStreamCtxt (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlStreamPushNode (xmlStreamCtxtPtr stream, xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *name,
const xmlChar *ns, const xmlChar *ns,
int nodeType); int nodeType);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlStreamPush (xmlStreamCtxtPtr stream, xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *name,
const xmlChar *ns); const xmlChar *ns);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlStreamPushAttr (xmlStreamCtxtPtr stream, xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *name,
const xmlChar *ns); const xmlChar *ns);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlStreamPop (xmlStreamCtxtPtr stream); xmlStreamPop (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_PATTERN_ENABLED */ #endif /* LIBXML_PATTERN_ENABLED */
#endif /* __XML_PATTERN_H__ */ #endif /* __XML_PATTERN_H__ */
 End of changes. 16 change blocks. 
33 lines changed or deleted 32 lines changed or added


 pngconf.h   pngconf.h 
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.4.8 - July 7, 2011 * libpng version 1.4.5beta04 - November 8, 2010
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. ) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. )
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
* *
*/ */
/* Any machine specific code is near the front of this file, so if you /* Any machine specific code is near the front of this file, so if you
skipping to change at line 87 skipping to change at line 87
# ifdef PRIVATEBUILD # ifdef PRIVATEBUILD
# pragma message("PRIVATEBUILD is deprecated.\ # pragma message("PRIVATEBUILD is deprecated.\
Use PNG_USER_PRIVATEBUILD instead.") Use PNG_USER_PRIVATEBUILD instead.")
# define PNG_USER_PRIVATEBUILD PRIVATEBUILD # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
# endif # endif
#endif /* __STDC__ */ #endif /* __STDC__ */
/* End of material added to libpng-1.2.8 */ /* End of material added to libpng-1.2.8 */
/* Added at libpng-1.4.6 */
#ifndef PNG_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely). Note that if you replace
* it with something other than whitespace, you must include the terminatin
g
* semicolon.
*/
# define PNG_UNUSED(param) (void)param;
#endif
/* End of material added to libpng-1.4.6 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
/* This is the size of the compression buffer, and thus the size of /* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your * an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this * machine. One of these will be allocated per png_struct. When this
* is full, it writes the data to the disk, and does some other * is full, it writes the data to the disk, and does some other
* calculations. Making this an extremely small size will slow * calculations. Making this an extremely small size will slow
* the library down, but you may want to experiment to determine * the library down, but you may want to experiment to determine
* where it becomes significant, if you are concerned with memory * where it becomes significant, if you are concerned with memory
* usage. Note that zlib allocates at least 32Kb also. For readers, * usage. Note that zlib allocates at least 32Kb also. For readers,
skipping to change at line 1393 skipping to change at line 1381
# ifdef __GNUC__ # ifdef __GNUC__
# ifndef PNG_USE_RESULT # ifndef PNG_USE_RESULT
# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif # endif
# ifndef PNG_NORETURN # ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__)) # define PNG_NORETURN __attribute__((__noreturn__))
# endif # endif
# ifndef PNG_ALLOCATED # ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__)) # define PNG_ALLOCATED __attribute__((__malloc__))
# endif # endif
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
/* This specifically protects structure members that should only be /* This specifically protects structure members that should only be
* accessed from within the library, therefore should be empty during * accessed from within the library, therefore should be empty during
* a library build. * a library build.
*/ */
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# ifndef PNG_DEPSTRUCT # ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT __attribute__((__deprecated__)) # define PNG_DEPSTRUCT __attribute__((__deprecated__))
# endif # endif
# ifndef PNG_PRIVATE # ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/ # if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \ # define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng." ))) __attribute__((warning("This function is not exported by libpng." )))
# else # else
# define PNG_PRIVATE \ # define PNG_PRIVATE \
__attribute__((__deprecated__)) __attribute__((__deprecated__))
 End of changes. 5 change blocks. 
18 lines changed or deleted 5 lines changed or added


 relaxng.h   relaxng.h 
skipping to change at line 115 skipping to change at line 115
* *
* List of possible Relax NG Parser flags * List of possible Relax NG Parser flags
*/ */
typedef enum { typedef enum {
XML_RELAXNGP_NONE = 0, XML_RELAXNGP_NONE = 0,
XML_RELAXNGP_FREE_DOC = 1, XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2 XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag; } xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void); xmlRelaxNGInitTypes (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void); xmlRelaxNGCleanupTypes (void);
/* /*
* Interfaces for parsing. * Interfaces for parsing.
*/ */
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewParserCtxt (const char *URL); xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewMemParserCtxt (const char *buffer, xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size); int size);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctx
int flag); t,
int flag);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctx t);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err, xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn, xmlRelaxNGValidityWarningFunc warn,
void *ctx); void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err, xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn, xmlRelaxNGValidityWarningFunc *warn
void **ctx); ,
void **ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserStructuredErrors( xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror, xmlStructuredErrorFunc serror,
void *ctx); void *ctx);
XMLPUBFUN xmlRelaxNGPtr XMLCALL XMLPUBFUN xmlRelaxNGPtr XMLCALL
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctx t);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGFree (xmlRelaxNGPtr schema); xmlRelaxNGFree (xmlRelaxNGPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGDump (FILE *output, xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema); xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree (FILE * output, xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema); xmlRelaxNGPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
/* /*
* Interfaces for validating * Interfaces for validating
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err, xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn, xmlRelaxNGValidityWarningFunc warn,
void *ctx); void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err, xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn, xmlRelaxNGValidityWarningFunc *warn
void **ctx); ,
void **ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCt
xmlStructuredErrorFunc serror, void *ctx); xtPtr ctxt,
xmlStructuredErrorFunc serror, voi
d *ctx);
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt );
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt
xmlDocPtr doc); ,
xmlDocPtr doc);
/* /*
* Interfaces for progressive validation when possible * Interfaces for progressive validation when possible
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxt
xmlDocPtr doc, Ptr ctxt,
xmlNodePtr elem); xmlDocPtr doc,
XMLPUBFUN int XMLCALL xmlNodePtr elem);
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, XMLPUBFUN int XMLCALL
const xmlChar *data, xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt
int len); ,
XMLPUBFUN int XMLCALL const xmlChar *data,
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, int len);
xmlDocPtr doc, XMLPUBFUN int XMLCALL
xmlNodePtr elem); xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxt
XMLPUBFUN int XMLCALL Ptr ctxt,
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc,
xmlDocPtr doc, xmlNodePtr elem);
xmlNodePtr elem); XMLPUBFUN int XMLCALL
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxt
Ptr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_RELAX_NG__ */ #endif /* __XML_RELAX_NG__ */
 End of changes. 20 change blocks. 
57 lines changed or deleted 67 lines changed or added


 schemasInternals.h   schemasInternals.h 
/* /*
* Summary: internal interfaces for XML Schemas * Summary: internal interfaces for XML Schemas
* Description: internal interfaces for the XML Schemas handling * Description: internal interfaces for the XML Schemas handling
* and schema validity checking * and schema validity checking
* The Schemas development is a Work In Progress. * The Schemas development is a Work In Progress.
* Some of those interfaces are not garanteed to be API or ABI stable ! * Some of those interfaces are not garanteed to be API or ABI stable !
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.
* *
* Author: Daniel Veillard * Author: Daniel Veillard
*/ */
#ifndef __XML_SCHEMA_INTERNALS_H__ #ifndef __XML_SCHEMA_INTERNALS_H__
#define __XML_SCHEMA_INTERNALS_H__ #define __XML_SCHEMA_INTERNALS_H__
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 schematron.h   schematron.h 
skipping to change at line 24 skipping to change at line 24
#ifdef LIBXML_SCHEMATRON_ENABLED #ifdef LIBXML_SCHEMATRON_ENABLED
#include <libxml/tree.h> #include <libxml/tree.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef enum { typedef enum {
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFun c */ XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFun c */
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
} xmlSchematronValidOptions; } xmlSchematronValidOptions;
/** /**
* The schemas related types are kept internal * The schemas related types are kept internal
*/ */
typedef struct _xmlSchematron xmlSchematron; typedef struct _xmlSchematron xmlSchematron;
typedef xmlSchematron *xmlSchematronPtr; typedef xmlSchematron *xmlSchematronPtr;
/** /**
* xmlSchematronValidityErrorFunc: * xmlSchematronValidityErrorFunc:
skipping to change at line 72 skipping to change at line 72
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
/* /*
* Interfaces for parsing. * Interfaces for parsing.
*/ */
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewParserCtxt (const char *URL); xmlSchematronNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewMemParserCtxt(const char *buffer, xmlSchematronNewMemParserCtxt(const char *buffer,
int size); int size);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewDocParserCtxt(xmlDocPtr doc); xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
/***** /*****
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err, xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn, xmlSchematronValidityWarningFunc wa
void *ctx); rn,
XMLPUBFUN int XMLCALL void *ctx);
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, XMLPUBFUN int XMLCALL
xmlSchematronValidityErrorFunc * err, xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt
xmlSchematronValidityWarningFunc * warn, ,
void **ctx); xmlSchematronValidityErrorFunc * err
,
xmlSchematronValidityWarningFunc * w
arn,
void **ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
*****/ *****/
XMLPUBFUN xmlSchematronPtr XMLCALL XMLPUBFUN xmlSchematronPtr XMLCALL
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronFree (xmlSchematronPtr schema); xmlSchematronFree (xmlSchematronPtr schema);
/* /*
* Interfaces for validating * Interfaces for validating
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronSetValidStructuredErrors( xmlSchematronSetValidStructuredErrors(
xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, xmlStructuredErrorFunc serror,
void *ctx); void *ctx);
/****** /******
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err, xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn, xmlSchematronValidityWarningFunc wa
void *ctx); rn,
XMLPUBFUN int XMLCALL void *ctx);
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, XMLPUBFUN int XMLCALL
xmlSchematronValidityErrorFunc *err, xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityWarningFunc *warn, xmlSchematronValidityErrorFunc *err
void **ctx); ,
xmlSchematronValidityWarningFunc *w
arn,
void **ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
int options); int options);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt) ;
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt , xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt ,
xmlNodePtr elem); xmlNodePtr elem);
*******/ *******/
XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
xmlSchematronNewValidCtxt (xmlSchematronPtr schema, xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options); int options);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance); xmlDocPtr instance);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_SCHEMATRON_ENABLED */ #endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */ #endif /* __XML_SCHEMATRON_H__ */
 End of changes. 18 change blocks. 
45 lines changed or deleted 52 lines changed or added


 testBasic.h   testBasic.h 
#ifndef _TEST_BASIC_H_ #ifndef _TEST_BASIC_H_
#define _TEST_BASIC_H_ #define _TEST_BASIC_H_
#include "cocos2d.h" #include "cocos2d.h"
#include "VisibleRect.h"
USING_NS_CC; USING_NS_CC;
using namespace std; using namespace std;
class TestScene : public CCScene class TestScene : public CCScene
{ {
public: public:
TestScene(bool bPortrait = false); TestScene(bool bPortrait = false);
virtual void onEnter(); virtual void onEnter();
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 threads.h   threads.h 
skipping to change at line 40 skipping to change at line 40
typedef xmlRMutex *xmlRMutexPtr; typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include <libxml/globals.h> #include <libxml/globals.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
XMLPUBFUN xmlMutexPtr XMLCALL XMLPUBFUN xmlMutexPtr XMLCALL
xmlNewMutex (void); xmlNewMutex (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlMutexLock (xmlMutexPtr tok); xmlMutexLock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlMutexUnlock (xmlMutexPtr tok); xmlMutexUnlock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeMutex (xmlMutexPtr tok); xmlFreeMutex (xmlMutexPtr tok);
XMLPUBFUN xmlRMutexPtr XMLCALL XMLPUBFUN xmlRMutexPtr XMLCALL
xmlNewRMutex (void); xmlNewRMutex (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRMutexLock (xmlRMutexPtr tok); xmlRMutexLock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRMutexUnlock (xmlRMutexPtr tok); xmlRMutexUnlock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeRMutex (xmlRMutexPtr tok); xmlFreeRMutex (xmlRMutexPtr tok);
/* /*
* Library wide APIs. * Library wide APIs.
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlInitThreads (void); xmlInitThreads (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlLockLibrary (void); xmlLockLibrary (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlUnlockLibrary(void); xmlUnlockLibrary(void);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlGetThreadId (void); xmlGetThreadId (void);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlIsMainThread (void); xmlIsMainThread (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlCleanupThreads(void); xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(void); xmlGetGlobalState(void);
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(L IBXML_STATIC_FOR_DLL) #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(L IBXML_STATIC_FOR_DLL)
int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvRe served); int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvRe served);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __XML_THREADS_H__ */ #endif /* __XML_THREADS_H__ */
 End of changes. 15 change blocks. 
15 lines changed or deleted 15 lines changed or added


 uri.h   uri.h 
skipping to change at line 34 skipping to change at line 34
* A parsed URI reference. This is a struct containing the various fields * A parsed URI reference. This is a struct containing the various fields
* as described in RFC 2396 but separated for further processing. * as described in RFC 2396 but separated for further processing.
* *
* Note: query is a deprecated field which is incorrectly unescaped. * Note: query is a deprecated field which is incorrectly unescaped.
* query_raw takes precedence over query if the former is set. * query_raw takes precedence over query if the former is set.
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
*/ */
typedef struct _xmlURI xmlURI; typedef struct _xmlURI xmlURI;
typedef xmlURI *xmlURIPtr; typedef xmlURI *xmlURIPtr;
struct _xmlURI { struct _xmlURI {
char *scheme; /* the URI scheme */ char *scheme; /* the URI scheme */
char *opaque; /* opaque part */ char *opaque; /* opaque part */
char *authority; /* the authority part */ char *authority; /* the authority part */
char *server; /* the server part */ char *server; /* the server part */
char *user; /* the user part */ char *user; /* the user part */
int port; /* the port number */ int port; /* the port number */
char *path; /* the path string */ char *path; /* the path string */
char *query; /* the query string (deprecated - use with caution) char *query; /* the query string (deprecated - use with caution) */
*/ char *fragment; /* the fragment identifier */
char *fragment; /* the fragment identifier */ int cleanup; /* parsing potentially unclean URI */
int cleanup; /* parsing potentially unclean URI */ char *query_raw; /* the query string (as it appears in the URI) */
char *query_raw; /* the query string (as it appears in the URI) */
}; };
/* /*
* This function is in tree.h: * This function is in tree.h:
* xmlChar * xmlNodeGetBase (xmlDocPtr doc, * xmlChar * xmlNodeGetBase (xmlDocPtr doc,
* xmlNodePtr cur); * xmlNodePtr cur);
*/ */
XMLPUBFUN xmlURIPtr XMLCALL XMLPUBFUN xmlURIPtr XMLCALL
xmlCreateURI (void); xmlCreateURI (void);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlBuildURI (const xmlChar *URI, xmlBuildURI (const xmlChar *URI,
const xmlChar *base); const xmlChar *base);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlBuildRelativeURI (const xmlChar *URI, xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base); const xmlChar *base);
XMLPUBFUN xmlURIPtr XMLCALL XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURI (const char *str); xmlParseURI (const char *str);
XMLPUBFUN xmlURIPtr XMLCALL XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURIRaw (const char *str, xmlParseURIRaw (const char *str,
int raw); int raw);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlParseURIReference (xmlURIPtr uri, xmlParseURIReference (xmlURIPtr uri,
const char *str); const char *str);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlSaveUri (xmlURIPtr uri); xmlSaveUri (xmlURIPtr uri);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlPrintURI (FILE *stream, xmlPrintURI (FILE *stream,
xmlURIPtr uri); xmlURIPtr uri);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlURIEscapeStr (const xmlChar *str, xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list); const xmlChar *list);
XMLPUBFUN char * XMLCALL XMLPUBFUN char * XMLCALL
xmlURIUnescapeString (const char *str, xmlURIUnescapeString (const char *str,
int len, int len,
char *target); char *target);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNormalizeURIPath (char *path); xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlURIEscape (const xmlChar *str); xmlURIEscape (const xmlChar *str);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeURI (xmlURIPtr uri); xmlFreeURI (xmlURIPtr uri);
XMLPUBFUN xmlChar* XMLCALL XMLPUBFUN xmlChar* XMLCALL
xmlCanonicPath (const xmlChar *path); xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar* XMLCALL XMLPUBFUN xmlChar* XMLCALL
xmlPathToURI (const xmlChar *path); xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __XML_URI_H__ */ #endif /* __XML_URI_H__ */
 End of changes. 17 change blocks. 
36 lines changed or deleted 35 lines changed or added


 xmlautomata.h   xmlautomata.h 
skipping to change at line 44 skipping to change at line 44
* *
* A state int the automata description, * A state int the automata description,
*/ */
typedef struct _xmlAutomataState xmlAutomataState; typedef struct _xmlAutomataState xmlAutomataState;
typedef xmlAutomataState *xmlAutomataStatePtr; typedef xmlAutomataState *xmlAutomataStatePtr;
/* /*
* Building API * Building API
*/ */
XMLPUBFUN xmlAutomataPtr XMLCALL XMLPUBFUN xmlAutomataPtr XMLCALL
xmlNewAutomata (void); xmlNewAutomata (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlFreeAutomata (xmlAutomataPtr am); xmlFreeAutomata (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataGetInitState (xmlAutomataPtr am); xmlAutomataGetInitState (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlAutomataSetFinalState (xmlAutomataPtr am, xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state); xmlAutomataStatePtr state);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewState (xmlAutomataPtr am); xmlAutomataNewState (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition (xmlAutomataPtr am, xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition2 (xmlAutomataPtr am, xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
const xmlChar *token2, const xmlChar *token2,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewNegTrans (xmlAutomataPtr am, xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
const xmlChar *token2, const xmlChar *token2,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans (xmlAutomataPtr am, xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
int min, int min,
int max, int max,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans2 (xmlAutomataPtr am, xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
const xmlChar *token2, const xmlChar *token2,
int min, int min,
int max, int max,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans (xmlAutomataPtr am, xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
int min, int min,
int max, int max,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
const xmlChar *token, const xmlChar *token,
const xmlChar *token2, const xmlChar *token2,
int min, int min,
int max, int max,
void *data); void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewAllTrans (xmlAutomataPtr am, xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
int lax); int lax);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewEpsilon (xmlAutomataPtr am, xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to); xmlAutomataStatePtr to);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountedTrans (xmlAutomataPtr am, xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
int counter); int counter);
XMLPUBFUN xmlAutomataStatePtr XMLCALL XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCounterTrans (xmlAutomataPtr am, xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, xmlAutomataStatePtr to,
int counter); int counter);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlAutomataNewCounter (xmlAutomataPtr am, xmlAutomataNewCounter (xmlAutomataPtr am,
int min, int min,
int max); int max);
XMLPUBFUN xmlRegexpPtr XMLCALL XMLPUBFUN xmlRegexpPtr XMLCALL
xmlAutomataCompile (xmlAutomataPtr am); xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlAutomataIsDeterminist (xmlAutomataPtr am); xmlAutomataIsDeterminist (xmlAutomataPtr am);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_AUTOMATA_ENABLED */ #endif /* LIBXML_AUTOMATA_ENABLED */
#endif /* LIBXML_REGEXP_ENABLED */ #endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */ #endif /* __XML_AUTOMATA_H__ */
 End of changes. 9 change blocks. 
84 lines changed or deleted 84 lines changed or added


 xmlregexp.h   xmlregexp.h 
skipping to change at line 52 skipping to change at line 52
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/dict.h> #include <libxml/dict.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* /*
* The POSIX like API * The POSIX like API
*/ */
XMLPUBFUN xmlRegexpPtr XMLCALL XMLPUBFUN xmlRegexpPtr XMLCALL
xmlRegexpCompile (const xmlChar *regexp); xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regex XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
p);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegexpExec (xmlRegexpPtr comp, xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value); const xmlChar *value);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRegexpPrint (FILE *output, xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp); xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegexpIsDeterminist(xmlRegexpPtr comp); xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/** /**
* xmlRegExecCallbacks: * xmlRegExecCallbacks:
* @exec: the regular expression context * @exec: the regular expression context
* @token: the current token string * @token: the current token string
* @transdata: transition data * @transdata: transition data
* @inputdata: input data * @inputdata: input data
* *
* Callback function when doing a transition in the automata * Callback function when doing a transition in the automata
*/ */
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
const xmlChar *token, const xmlChar *token,
void *transdata, void *transdata,
void *inputdata); void *inputdata);
/* /*
* The progressive API * The progressive API
*/ */
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
xmlRegNewExecCtxt (xmlRegexpPtr comp, xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback, xmlRegExecCallbacks callback,
void *data); void *data);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegExecPushString(xmlRegExecCtxtPtr exec, xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value, const xmlChar *value,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegExecPushString2(xmlRegExecCtxtPtr exec, xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value, const xmlChar *value,
const xmlChar *value2, const xmlChar *value2,
void *data); void *data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegExecNextValues(xmlRegExecCtxtPtr exec, xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval, int *nbval,
int *nbneg, int *nbneg,
xmlChar **values, xmlChar **values,
int *terminal); int *terminal);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string, const xmlChar **string,
int *nbval, int *nbval,
int *nbneg, int *nbneg,
xmlChar **values, xmlChar **values,
int *terminal); int *terminal);
#ifdef LIBXML_EXPR_ENABLED #ifdef LIBXML_EXPR_ENABLED
/* /*
* Formal regular expression handling * Formal regular expression handling
* Its goal is to do some formal work on content models * Its goal is to do some formal work on content models
*/ */
/* expressions are used within a context */ /* expressions are used within a context */
typedef struct _xmlExpCtxt xmlExpCtxt; typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr; typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL XMLPUBFUN xmlExpCtxtPtr XMLCALL
xmlExpNewCtxt (int maxNodes, xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict); xmlDictPtr dict);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */ /* Expressions are trees but the tree is opaque */
typedef struct _xmlExpNode xmlExpNode; typedef struct _xmlExpNode xmlExpNode;
typedef xmlExpNode *xmlExpNodePtr; typedef xmlExpNode *xmlExpNodePtr;
typedef enum { typedef enum {
XML_EXP_EMPTY = 0, XML_EXP_EMPTY = 0,
XML_EXP_FORBID = 1, XML_EXP_FORBID = 1,
XML_EXP_ATOM = 2, XML_EXP_ATOM = 2,
XML_EXP_SEQ = 3, XML_EXP_SEQ = 3,
skipping to change at line 154 skipping to change at line 154
* 2 core expressions shared by all for the empty language set * 2 core expressions shared by all for the empty language set
* and for the set with just the empty token * and for the set with just the empty token
*/ */
XMLPUBVAR xmlExpNodePtr forbiddenExp; XMLPUBVAR xmlExpNodePtr forbiddenExp;
XMLPUBVAR xmlExpNodePtr emptyExp; XMLPUBVAR xmlExpNodePtr emptyExp;
/* /*
* Expressions are reference counted internally * Expressions are reference counted internally
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlExpFree (xmlExpCtxtPtr ctxt, xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr); xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlExpRef (xmlExpNodePtr expr); xmlExpRef (xmlExpNodePtr expr);
/* /*
* constructors can be either manual or from a string * constructors can be either manual or from a string
*/ */
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpParse (xmlExpCtxtPtr ctxt, xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr); const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewAtom (xmlExpCtxtPtr ctxt, xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name, const xmlChar *name,
int len); int len);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewOr (xmlExpCtxtPtr ctxt, xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left, xmlExpNodePtr left,
xmlExpNodePtr right); xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewSeq (xmlExpCtxtPtr ctxt, xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left, xmlExpNodePtr left,
xmlExpNodePtr right); xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewRange (xmlExpCtxtPtr ctxt, xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset, xmlExpNodePtr subset,
int min, int min,
int max); int max);
/* /*
* The really interesting APIs * The really interesting APIs
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpIsNillable(xmlExpNodePtr expr); xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpMaxToken (xmlExpNodePtr expr); xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr, xmlExpNodePtr expr,
const xmlChar**langList, const xmlChar**langList,
int len); int len);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpGetStart (xmlExpCtxtPtr ctxt, xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr, xmlExpNodePtr expr,
const xmlChar**tokList, const xmlChar**tokList,
int len); int len);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr, xmlExpNodePtr expr,
const xmlChar *str, const xmlChar *str,
int len); int len);
XMLPUBFUN xmlExpNodePtr XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpExpDerive (xmlExpCtxtPtr ctxt, xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr, xmlExpNodePtr expr,
xmlExpNodePtr sub); xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlExpSubsume (xmlExpCtxtPtr ctxt, xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr, xmlExpNodePtr expr,
xmlExpNodePtr sub); xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlExpDump (xmlBufferPtr buf, xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr); xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */ #endif /* LIBXML_EXPR_ENABLED */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_REGEXP_ENABLED */ #endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */ #endif /*__XML_REGEXP_H__ */
 End of changes. 18 change blocks. 
91 lines changed or deleted 90 lines changed or added


 xmlsave.h   xmlsave.h 
skipping to change at line 30 skipping to change at line 30
extern "C" { extern "C" {
#endif #endif
/** /**
* xmlSaveOption: * xmlSaveOption:
* *
* This is the set of XML save options that can be passed down * This is the set of XML save options that can be passed down
* to the xmlSaveToFd() and similar calls. * to the xmlSaveToFd() and similar calls.
*/ */
typedef enum { typedef enum {
XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_FORMAT = 1<<0, /* format save output */
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */ XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace *
/
} xmlSaveOption; } xmlSaveOption;
typedef struct _xmlSaveCtxt xmlSaveCtxt; typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr; typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxtPtr XMLCALL XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFd (int fd, xmlSaveToFd (int fd,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFilename (const char *filename, xmlSaveToFilename (const char *filename,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToBuffer (xmlBufferPtr buffer, xmlSaveToBuffer (xmlBufferPtr buffer,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToIO (xmlOutputWriteCallback iowrite, xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose, xmlOutputCloseCallback ioclose,
void *ioctx, void *ioctx,
const char *encoding, const char *encoding,
int options); int options);
XMLPUBFUN long XMLCALL XMLPUBFUN long XMLCALL
xmlSaveDoc (xmlSaveCtxtPtr ctxt, xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc); xmlDocPtr doc);
XMLPUBFUN long XMLCALL XMLPUBFUN long XMLCALL
xmlSaveTree (xmlSaveCtxtPtr ctxt, xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node); xmlNodePtr node);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSaveFlush (xmlSaveCtxtPtr ctxt); xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSaveClose (xmlSaveCtxtPtr ctxt); xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape); xmlCharEncodingOutputFunc escape);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape); xmlCharEncodingOutputFunc escape);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_XMLSAVE_H__ */ #endif /* __XML_XMLSAVE_H__ */
 End of changes. 12 change blocks. 
30 lines changed or deleted 32 lines changed or added


 xmlschemas.h   xmlschemas.h 
skipping to change at line 28 skipping to change at line 28
#include <libxml/tree.h> #include <libxml/tree.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* This error codes are obsolete; not used any more. * This error codes are obsolete; not used any more.
*/ */
typedef enum { typedef enum {
XML_SCHEMAS_ERR_OK = 0, XML_SCHEMAS_ERR_OK = 0,
XML_SCHEMAS_ERR_NOROOT = 1, XML_SCHEMAS_ERR_NOROOT = 1,
XML_SCHEMAS_ERR_UNDECLAREDELEM, XML_SCHEMAS_ERR_UNDECLAREDELEM,
XML_SCHEMAS_ERR_NOTTOPLEVEL, XML_SCHEMAS_ERR_NOTTOPLEVEL,
XML_SCHEMAS_ERR_MISSING, XML_SCHEMAS_ERR_MISSING,
XML_SCHEMAS_ERR_WRONGELEM, XML_SCHEMAS_ERR_WRONGELEM,
XML_SCHEMAS_ERR_NOTYPE, XML_SCHEMAS_ERR_NOTYPE,
XML_SCHEMAS_ERR_NOROLLBACK, XML_SCHEMAS_ERR_NOROLLBACK,
XML_SCHEMAS_ERR_ISABSTRACT, XML_SCHEMAS_ERR_ISABSTRACT,
XML_SCHEMAS_ERR_NOTEMPTY, XML_SCHEMAS_ERR_NOTEMPTY,
XML_SCHEMAS_ERR_ELEMCONT, XML_SCHEMAS_ERR_ELEMCONT,
XML_SCHEMAS_ERR_HAVEDEFAULT, XML_SCHEMAS_ERR_HAVEDEFAULT,
skipping to change at line 67 skipping to change at line 67
* ATTENTION: Change xmlSchemaSetValidOptions's check * ATTENTION: Change xmlSchemaSetValidOptions's check
* for invalid values, if adding to the validation * for invalid values, if adding to the validation
* options below. * options below.
*/ */
/** /**
* xmlSchemaValidOption: * xmlSchemaValidOption:
* *
* This is the set of XML Schema validation options. * This is the set of XML Schema validation options.
*/ */
typedef enum { typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
/* Default/fixed: create an attribute node /* Default/fixed: create an attribute node
* or an element's text node on the instance. * or an element's text node on the instance.
*/ */
} xmlSchemaValidOption; } xmlSchemaValidOption;
/* /*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
* assemble schemata using * assemble schemata using
* xsi:schemaLocation and * xsi:schemaLocation and
* xsi:noNamespaceSchemaLocation * xsi:noNamespaceSchemaLocation
*/ */
/** /**
* The schemas related types are kept internal * The schemas related types are kept internal
*/ */
typedef struct _xmlSchema xmlSchema; typedef struct _xmlSchema xmlSchema;
typedef xmlSchema *xmlSchemaPtr; typedef xmlSchema *xmlSchemaPtr;
/** /**
* xmlSchemaValidityErrorFunc: * xmlSchemaValidityErrorFunc:
skipping to change at line 119 skipping to change at line 119
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
/* /*
* Interfaces for parsing. * Interfaces for parsing.
*/ */
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewParserCtxt (const char *URL); xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewMemParserCtxt (const char *buffer, xmlSchemaNewMemParserCtxt (const char *buffer,
int size); int size);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewDocParserCtxt (xmlDocPtr doc); xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err, xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn, xmlSchemaValidityWarningFunc warn,
void *ctx); void *ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror, xmlStructuredErrorFunc serror,
void *ctx); void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err, xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn, xmlSchemaValidityWarningFunc * warn,
void **ctx); void **ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaPtr XMLCALL XMLPUBFUN xmlSchemaPtr XMLCALL
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaFree (xmlSchemaPtr schema); xmlSchemaFree (xmlSchemaPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaDump (FILE *output, xmlSchemaDump (FILE *output,
xmlSchemaPtr schema); xmlSchemaPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
/* /*
* Interfaces for validating * Interfaces for validating
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err, xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn, xmlSchemaValidityWarningFunc warn,
void *ctx); void *ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, xmlStructuredErrorFunc serror,
void *ctx); void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc *err, xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn, xmlSchemaValidityWarningFunc *warn,
void **ctx); void **ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options); int options);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
xmlSchemaNewValidCtxt (xmlSchemaPtr schema); xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr instance); xmlDocPtr instance);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem); xmlNodePtr elem);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input, xmlParserInputBufferPtr input,
xmlCharEncoding enc, xmlCharEncoding enc,
xmlSAXHandlerPtr sax, xmlSAXHandlerPtr sax,
void *user_data); void *user_data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename, const char * filename,
int options); int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
/* /*
* Interface to insert Schemas SAX validation in a SAX stream * Interface to insert Schemas SAX validation in a SAX stream
*/ */
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr *sax, xmlSAXHandlerPtr *sax,
void **user_data); void **user_data);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_H__ */ #endif /* __XML_SCHEMA_H__ */
 End of changes. 25 change blocks. 
66 lines changed or deleted 66 lines changed or added


 xmlschemastypes.h   xmlschemastypes.h 
skipping to change at line 33 skipping to change at line 33
#endif #endif
typedef enum { typedef enum {
XML_SCHEMA_WHITESPACE_UNKNOWN = 0, XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
XML_SCHEMA_WHITESPACE_PRESERVE = 1, XML_SCHEMA_WHITESPACE_PRESERVE = 1,
XML_SCHEMA_WHITESPACE_REPLACE = 2, XML_SCHEMA_WHITESPACE_REPLACE = 2,
XML_SCHEMA_WHITESPACE_COLLAPSE = 3 XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType; } xmlSchemaWhitespaceValueType;
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaInitTypes (void); xmlSchemaInitTypes (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaCleanupTypes (void); xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetPredefinedType (const xmlChar *name, xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns); const xmlChar *ns);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar *value, const xmlChar *value,
xmlSchemaValPtr *val); xmlSchemaValPtr *val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar *value, const xmlChar *value,
xmlSchemaValPtr *val, xmlSchemaValPtr *val,
xmlNodePtr node); xmlNodePtr node);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateFacet (xmlSchemaTypePtr base, xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet, xmlSchemaFacetPtr facet,
const xmlChar *value, const xmlChar *value,
xmlSchemaValPtr val); xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws, xmlSchemaWhitespaceValueTyp
xmlSchemaValType valType, e fws,
const xmlChar *value, xmlSchemaValType valType,
xmlSchemaValPtr val, const xmlChar *value,
xmlSchemaWhitespaceValueType ws); xmlSchemaValPtr val,
xmlSchemaWhitespaceValueTyp
e ws);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaFreeValue (xmlSchemaValPtr val); xmlSchemaFreeValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaFacetPtr XMLCALL XMLPUBFUN xmlSchemaFacetPtr XMLCALL
xmlSchemaNewFacet (void); xmlSchemaNewFacet (void);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl, xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr ctxt, xmlSchemaParserCtxtPtr ctxt
const xmlChar *name); ,
const xmlChar *name);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaCompareValues (xmlSchemaValPtr x, xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y); xmlSchemaValPtr y);
XMLPUBFUN xmlSchemaTypePtr XMLCALL XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar *value, const xmlChar *value,
unsigned long actualLen, unsigned long actualLen,
unsigned long *expectedLen); unsigned long *expectedLen)
;
XMLPUBFUN xmlSchemaTypePtr XMLCALL XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInType (xmlSchemaValType type); xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType); int facetType);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlSchemaCollapseString (const xmlChar *value); xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlSchemaWhiteSpaceReplace (const xmlChar *value); xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long XMLCALL XMLPUBFUN unsigned long XMLCALL
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet, xmlSchemaFacetPtr facet,
const xmlChar *value, const xmlChar *value,
xmlSchemaValPtr val, xmlSchemaValPtr val,
unsigned long *length); unsigned long *length);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
xmlSchemaValType valType, xmlSchemaValType valType,
const xmlChar *value, const xmlChar *value,
xmlSchemaValPtr val, xmlSchemaValPtr val,
unsigned long *length, unsigned long *length,
xmlSchemaWhitespaceValueType ws); xmlSchemaWhitespaceValueTy
XMLPUBFUN int XMLCALL pe ws);
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, XMLPUBFUN int XMLCALL
const xmlChar *value, xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
xmlSchemaValPtr *val, const xmlChar *value,
xmlNodePtr node); xmlSchemaValPtr *val,
XMLPUBFUN int XMLCALL xmlNodePtr node);
xmlSchemaGetCanonValue (xmlSchemaValPtr val, XMLPUBFUN int XMLCALL
const xmlChar **retValue); xmlSchemaGetCanonValue (xmlSchemaValPtr val,
XMLPUBFUN int XMLCALL const xmlChar **retValue);
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, XMLPUBFUN int XMLCALL
const xmlChar **retValue, xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws); const xmlChar **retValue,
xmlSchemaWhitespaceValueTyp
e ws);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValueAppend (xmlSchemaValPtr prev, xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur); xmlSchemaValPtr cur);
XMLPUBFUN xmlSchemaValPtr XMLCALL XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaValueGetNext (xmlSchemaValPtr cur); xmlSchemaValueGetNext (xmlSchemaValPtr cur);
XMLPUBFUN const xmlChar * XMLCALL XMLPUBFUN const xmlChar * XMLCALL
xmlSchemaValueGetAsString (xmlSchemaValPtr val); xmlSchemaValueGetAsString (xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValPtr XMLCALL XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewStringValue (xmlSchemaValType type, xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value); const xmlChar *value);
XMLPUBFUN xmlSchemaValPtr XMLCALL XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewNOTATIONValue (const xmlChar *name, xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns); const xmlChar *ns);
XMLPUBFUN xmlSchemaValPtr XMLCALL XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewQNameValue (const xmlChar *namespaceName, xmlSchemaNewQNameValue (const xmlChar *namespaceNam
const xmlChar *localName); e,
const xmlChar *localName);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws, xmlSchemaWhitespaceValueTyp
xmlSchemaValPtr y, e xws,
xmlSchemaWhitespaceValueType yws); xmlSchemaValPtr y,
xmlSchemaWhitespaceValueTyp
e yws);
XMLPUBFUN xmlSchemaValPtr XMLCALL XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaCopyValue (xmlSchemaValPtr val); xmlSchemaCopyValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValType XMLCALL XMLPUBFUN xmlSchemaValType XMLCALL
xmlSchemaGetValType (xmlSchemaValPtr val); xmlSchemaGetValType (xmlSchemaValPtr val);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_TYPES_H__ */ #endif /* __XML_SCHEMA_TYPES_H__ */
 End of changes. 27 change blocks. 
85 lines changed or deleted 94 lines changed or added


 xmlunicode.h   xmlunicode.h 
skipping to change at line 26 skipping to change at line 26
#define __XML_UNICODE_H__ #define __XML_UNICODE_H__
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED #ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code);
XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code);
XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int
code); code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int c XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int
ode); code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code);
); XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsLao (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code) XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code);
; XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int cod XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int
e); code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int cod XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code);
e); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code);
XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code);
XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int cod XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code);
e); XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); XMLPUBFUN int XMLCALL xmlUCSIsTags (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); XMLPUBFUN int XMLCALL xmlUCSIsThai (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int
XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); code);
XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int co XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code);
de); XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block);
XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_UNICODE_ENABLED */ #endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */ #endif /* __XML_UNICODE_H__ */
 End of changes. 2 change blocks. 
176 lines changed or deleted 174 lines changed or added


 xpath.h   xpath.h 
skipping to change at line 80 skipping to change at line 80
XPATH_INVALID_CHAR_ERROR, XPATH_INVALID_CHAR_ERROR,
XPATH_INVALID_CTXT XPATH_INVALID_CTXT
} xmlXPathError; } xmlXPathError;
/* /*
* A node-set (an unordered collection of nodes without duplicates). * A node-set (an unordered collection of nodes without duplicates).
*/ */
typedef struct _xmlNodeSet xmlNodeSet; typedef struct _xmlNodeSet xmlNodeSet;
typedef xmlNodeSet *xmlNodeSetPtr; typedef xmlNodeSet *xmlNodeSetPtr;
struct _xmlNodeSet { struct _xmlNodeSet {
int nodeNr; /* number of nodes in the set */ int nodeNr; /* number of nodes in the set */
int nodeMax; /* size of the array as allocated */ int nodeMax; /* size of the array as allocated */
xmlNodePtr *nodeTab; /* array of nodes in no particular order */ xmlNodePtr *nodeTab; /* array of nodes in no particular order */
/* @@ with_ns to check wether namespace nodes should be looked at @@ */ /* @@ with_ns to check wether namespace nodes should be looked at @@ */
}; };
/* /*
* An expression is evaluated to yield an object, which * An expression is evaluated to yield an object, which
* has one of the following four basic types: * has one of the following four basic types:
* - node-set * - node-set
* - boolean * - boolean
* - number * - number
* - string * - string
skipping to change at line 143 skipping to change at line 143
*/ */
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
/* /*
* Extra type: a name and a conversion function. * Extra type: a name and a conversion function.
*/ */
typedef struct _xmlXPathType xmlXPathType; typedef struct _xmlXPathType xmlXPathType;
typedef xmlXPathType *xmlXPathTypePtr; typedef xmlXPathType *xmlXPathTypePtr;
struct _xmlXPathType { struct _xmlXPathType {
const xmlChar *name; /* the type name */ const xmlChar *name; /* the type name */
xmlXPathConvertFunc func; /* the conversion function */ xmlXPathConvertFunc func; /* the conversion function */
}; };
/* /*
* Extra variable: a name and a value. * Extra variable: a name and a value.
*/ */
typedef struct _xmlXPathVariable xmlXPathVariable; typedef struct _xmlXPathVariable xmlXPathVariable;
typedef xmlXPathVariable *xmlXPathVariablePtr; typedef xmlXPathVariable *xmlXPathVariablePtr;
struct _xmlXPathVariable { struct _xmlXPathVariable {
const xmlChar *name; /* the variable name */ const xmlChar *name; /* the variable name */
xmlXPathObjectPtr value; /* the value */ xmlXPathObjectPtr value; /* the value */
}; };
/** /**
* xmlXPathEvalFunc: * xmlXPathEvalFunc:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments passed to the function * @nargs: the number of arguments passed to the function
* *
* An XPath evaluation function, the parameters are on the XPath context st ack. * An XPath evaluation function, the parameters are on the XPath context st ack.
*/ */
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
int nargs); int nargs);
/* /*
* Extra function: a name and a evaluation function. * Extra function: a name and a evaluation function.
*/ */
typedef struct _xmlXPathFunct xmlXPathFunct; typedef struct _xmlXPathFunct xmlXPathFunct;
typedef xmlXPathFunct *xmlXPathFuncPtr; typedef xmlXPathFunct *xmlXPathFuncPtr;
struct _xmlXPathFunct { struct _xmlXPathFunct {
const xmlChar *name; /* the function name */ const xmlChar *name; /* the function name */
xmlXPathEvalFunc func; /* the evaluation function */ xmlXPathEvalFunc func; /* the evaluation function */
}; };
/** /**
* xmlXPathAxisFunc: * xmlXPathAxisFunc:
* @ctxt: the XPath interpreter context * @ctxt: the XPath interpreter context
* @cur: the previous node being explored on that axis * @cur: the previous node being explored on that axis
* *
* An axis traversal function. To traverse an axis, the engine calls * An axis traversal function. To traverse an axis, the engine calls
* the first time with cur == NULL and repeat until the function returns * the first time with cur == NULL and repeat until the function returns
* NULL indicating the end of the axis traversal. * NULL indicating the end of the axis traversal.
* *
* Returns the next node in that axis or NULL if at the end of the axis. * Returns the next node in that axis or NULL if at the end of the axis.
*/ */
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctx t, typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctx t,
xmlXPathObjectPtr cur); xmlXPathObjectPtr cur);
/* /*
* Extra axis: a name and an axis function. * Extra axis: a name and an axis function.
*/ */
typedef struct _xmlXPathAxis xmlXPathAxis; typedef struct _xmlXPathAxis xmlXPathAxis;
typedef xmlXPathAxis *xmlXPathAxisPtr; typedef xmlXPathAxis *xmlXPathAxisPtr;
struct _xmlXPathAxis { struct _xmlXPathAxis {
const xmlChar *name; /* the axis name */ const xmlChar *name; /* the axis name */
xmlXPathAxisFunc func; /* the search function */ xmlXPathAxisFunc func; /* the search function */
}; };
/** /**
* xmlXPathFunction: * xmlXPathFunction:
* @ctxt: the XPath interprestation context * @ctxt: the XPath interprestation context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* An XPath function. * An XPath function.
* The arguments (if any) are popped out from the context stack * The arguments (if any) are popped out from the context stack
* and the result is pushed on the stack. * and the result is pushed on the stack.
skipping to change at line 249 skipping to change at line 249
* @ctxt: an XPath context * @ctxt: an XPath context
* @name: name of the function * @name: name of the function
* @ns_uri: the namespace name hosting this function * @ns_uri: the namespace name hosting this function
* *
* Prototype for callbacks used to plug function lookup in the XPath * Prototype for callbacks used to plug function lookup in the XPath
* engine. * engine.
* *
* Returns the XPath function or NULL if not found. * Returns the XPath function or NULL if not found.
*/ */
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name, const xmlChar *name,
const xmlChar *ns_uri); const xmlChar *ns_uri);
/** /**
* xmlXPathFlags: * xmlXPathFlags:
* Flags for XPath engine compilation and runtime * Flags for XPath engine compilation and runtime
*/ */
/** /**
* XML_XPATH_CHECKNS: * XML_XPATH_CHECKNS:
* *
* check namespaces at compilation * check namespaces at compilation
*/ */
#define XML_XPATH_CHECKNS (1<<0) #define XML_XPATH_CHECKNS (1<<0)
/** /**
* XML_XPATH_NOVAR: * XML_XPATH_NOVAR:
* *
* forbid variables in expression * forbid variables in expression
*/ */
#define XML_XPATH_NOVAR (1<<1) #define XML_XPATH_NOVAR (1<<1)
/** /**
* xmlXPathContext: * xmlXPathContext:
* *
* Expression evaluation occurs with respect to a context. * Expression evaluation occurs with respect to a context.
* he context consists of: * he context consists of:
* - a node (the context node) * - a node (the context node)
* - a node list (the context node list) * - a node list (the context node list)
* - a set of variable bindings * - a set of variable bindings
* - a function library * - a function library
* - the set of namespace declarations in scope for the expression * - the set of namespace declarations in scope for the expression
* Following the switch to hash tables, this need to be trimmed up at * Following the switch to hash tables, this need to be trimmed up at
* the next binary incompatible release. * the next binary incompatible release.
* The node may be modified when the context is passed to libxml2 * The node may be modified when the context is passed to libxml2
* for an XPath evaluation so you may need to initialize it again * for an XPath evaluation so you may need to initialize it again
* before the next call. * before the next call.
*/ */
struct _xmlXPathContext { struct _xmlXPathContext {
xmlDocPtr doc; /* The current document */ xmlDocPtr doc; /* The current document */
xmlNodePtr node; /* The current node */ xmlNodePtr node; /* The current node */
int nb_variables_unused; /* unused (hash table) */ int nb_variables_unused; /* unused (hash table) */
int max_variables_unused; /* unused (hash table) */ int max_variables_unused; /* unused (hash table) */
xmlHashTablePtr varHash; /* Hash table of defined variables */ xmlHashTablePtr varHash; /* Hash table of defined variables *
/
int nb_types; /* number of defined types */
int max_types; /* max number of types */ int nb_types; /* number of defined types */
xmlXPathTypePtr types; /* Array of defined types */ int max_types; /* max number of types */
xmlXPathTypePtr types; /* Array of defined types */
int nb_funcs_unused; /* unused (hash table) */
int max_funcs_unused; /* unused (hash table) */ int nb_funcs_unused; /* unused (hash table) */
xmlHashTablePtr funcHash; /* Hash table of defined funcs */ int max_funcs_unused; /* unused (hash table) */
xmlHashTablePtr funcHash; /* Hash table of defined funcs */
int nb_axis; /* number of defined axis */
int max_axis; /* max number of axis */ int nb_axis; /* number of defined axis */
xmlXPathAxisPtr axis; /* Array of defined axis */ int max_axis; /* max number of axis */
xmlXPathAxisPtr axis; /* Array of defined axis */
/* the namespace nodes of the context node */ /* the namespace nodes of the context node */
xmlNsPtr *namespaces; /* Array of namespaces */ xmlNsPtr *namespaces; /* Array of namespaces */
int nsNr; /* number of namespace in scope */ int nsNr; /* number of namespace in scope */
void *user; /* function to free */ void *user; /* function to free */
/* extra variables */ /* extra variables */
int contextSize; /* the context size */ int contextSize; /* the context size */
int proximityPosition; /* the proximity position */ int proximityPosition; /* the proximity position */
/* extra stuff for XPointer */ /* extra stuff for XPointer */
int xptr; /* is this an XPointer context? */ int xptr; /* is this an XPointer context? */
xmlNodePtr here; /* for here() */ xmlNodePtr here; /* for here() */
xmlNodePtr origin; /* for origin() */ xmlNodePtr origin; /* for origin() */
/* the set of namespace declarations in scope for the expression */ /* the set of namespace declarations in scope for the expression */
xmlHashTablePtr nsHash; /* The namespaces hash table */ xmlHashTablePtr nsHash; /* The namespaces hash table */
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
void *varLookupData; /* variable lookup data */ void *varLookupData; /* variable lookup data */
/* Possibility to link in an extra item */ /* Possibility to link in an extra item */
void *extra; /* needed for XSLT */ void *extra; /* needed for XSLT */
/* The function name and URI when calling a function */ /* The function name and URI when calling a function */
const xmlChar *function; const xmlChar *function;
const xmlChar *functionURI; const xmlChar *functionURI;
/* function lookup function and data */ /* function lookup function and data */
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
void *funcLookupData; /* function lookup data */ void *funcLookupData; /* function lookup data */
/* temporary namespace lists kept for walking the namespace axis */ /* temporary namespace lists kept for walking the namespace axis */
xmlNsPtr *tmpNsList; /* Array of namespaces */ xmlNsPtr *tmpNsList; /* Array of namespaces */
int tmpNsNr; /* number of namespaces in scope */ int tmpNsNr; /* number of namespaces in scope */
/* error reporting mechanism */ /* error reporting mechanism */
void *userData; /* user specific data block */ void *userData; /* user specific data block */
xmlStructuredErrorFunc error; /* the callback in case of errors * / xmlStructuredErrorFunc error; /* the callback in case of errors * /
xmlError lastError; /* the last error */ xmlError lastError; /* the last error */
xmlNodePtr debugNode; /* the source node XSLT */ xmlNodePtr debugNode; /* the source node XSLT */
/* dictionary */ /* dictionary */
xmlDictPtr dict; /* dictionary if any */ xmlDictPtr dict; /* dictionary if any */
int flags; /* flags to control compilation */ int flags; /* flags to control compilation */
/* Cache for reusal of XPath objects */ /* Cache for reusal of XPath objects */
void *cache; void *cache;
}; };
/* /*
* The structure of a compiled expression form is not public. * The structure of a compiled expression form is not public.
*/ */
typedef struct _xmlXPathCompExpr xmlXPathCompExpr; typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
typedef xmlXPathCompExpr *xmlXPathCompExprPtr; typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
/** /**
* xmlXPathParserContext: * xmlXPathParserContext:
* *
* An XPath parser context. It contains pure parsing informations, * An XPath parser context. It contains pure parsing informations,
* an xmlXPathContext, and the stack of objects. * an xmlXPathContext, and the stack of objects.
*/ */
struct _xmlXPathParserContext { struct _xmlXPathParserContext {
const xmlChar *cur; /* the current char being parsed */ const xmlChar *cur; /* the current char being pa
const xmlChar *base; /* the full expression */ rsed */
const xmlChar *base; /* the full expression */
int error; /* error code */ int error; /* error code */
xmlXPathContextPtr context; /* the evaluation context */ xmlXPathContextPtr context; /* the evaluation context */
xmlXPathObjectPtr value; /* the current value */ xmlXPathObjectPtr value; /* the current value */
int valueNr; /* number of values stacked */ int valueNr; /* number of values stacked */
int valueMax; /* max number of values stacked */ int valueMax; /* max number of values stacked */
xmlXPathObjectPtr *valueTab; /* stack of values */ xmlXPathObjectPtr *valueTab; /* stack of values */
xmlXPathCompExprPtr comp; /* the precompiled expression */ xmlXPathCompExprPtr comp; /* the precompiled expression */
int xptr; /* it this an XPointer expression */ int xptr; /* it this an XPointer expression */
xmlNodePtr ancestor; /* used for walking preceding axis */ xmlNodePtr ancestor; /* used for walking preceding axis *
/
}; };
/************************************************************************ /************************************************************************
* * * *
* Public API * * Public API *
* * * *
************************************************************************/ ************************************************************************/
/** /**
* Objects and Nodesets handling * Objects and Nodesets handling
*/ */
XMLPUBVAR double xmlXPathNAN; XMLPUBVAR double xmlXPathNAN;
XMLPUBVAR double xmlXPathPINF; XMLPUBVAR double xmlXPathPINF;
XMLPUBVAR double xmlXPathNINF; XMLPUBVAR double xmlXPathNINF;
skipping to change at line 419 skipping to change at line 419
/** /**
* xmlXPathNodeSetItem: * xmlXPathNodeSetItem:
* @ns: a node-set * @ns: a node-set
* @index: index of a node in the set * @index: index of a node in the set
* *
* Implements a functionality similar to the DOM NodeList.item(). * Implements a functionality similar to the DOM NodeList.item().
* *
* Returns the xmlNodePtr at the given @index in @ns or NULL if * Returns the xmlNodePtr at the given @index in @ns or NULL if
* @index is out of range (0 to length-1) * @index is out of range (0 to length-1)
*/ */
#define xmlXPathNodeSetItem(ns, index) \ #define xmlXPathNodeSetItem(ns, index) \
((((ns) != NULL) && \ ((((ns) != NULL) && \
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
(ns)->nodeTab[(index)] \ (ns)->nodeTab[(index)] \
: NULL) : NULL)
/** /**
* xmlXPathNodeSetIsEmpty: * xmlXPathNodeSetIsEmpty:
* @ns: a node-set * @ns: a node-set
* *
* Checks whether @ns is empty or not. * Checks whether @ns is empty or not.
* *
* Returns %TRUE if @ns is an empty node-set. * Returns %TRUE if @ns is an empty node-set.
*/ */
#define xmlXPathNodeSetIsEmpty(ns) \ #define xmlXPathNodeSetIsEmpty(ns) \
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathFreeObject (xmlXPathObjectPtr obj); xmlXPathFreeObject (xmlXPathObjectPtr obj);
XMLPUBFUN xmlNodeSetPtr XMLCALL XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeSetCreate (xmlNodePtr val); xmlXPathNodeSetCreate (xmlNodePtr val);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSet (xmlNodeSetPtr obj); xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathObjectCopy (xmlXPathObjectPtr val); xmlXPathObjectCopy (xmlXPathObjectPtr val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCmpNodes (xmlNodePtr node1, xmlXPathCmpNodes (xmlNodePtr node1,
xmlNodePtr node2); xmlNodePtr node2);
/** /**
* Conversion functions to basic types. * Conversion functions to basic types.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCastNumberToBoolean (double val); xmlXPathCastNumberToBoolean (double val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCastStringToBoolean (const xmlChar * val); xmlXPathCastStringToBoolean (const xmlChar * val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCastToBoolean (xmlXPathObjectPtr val); xmlXPathCastToBoolean (xmlXPathObjectPtr val);
XMLPUBFUN double XMLCALL XMLPUBFUN double XMLCALL
xmlXPathCastBooleanToNumber (int val); xmlXPathCastBooleanToNumber (int val);
XMLPUBFUN double XMLCALL XMLPUBFUN double XMLCALL
xmlXPathCastStringToNumber (const xmlChar * val); xmlXPathCastStringToNumber (const xmlChar * val);
XMLPUBFUN double XMLCALL XMLPUBFUN double XMLCALL
xmlXPathCastNodeToNumber (xmlNodePtr node); xmlXPathCastNodeToNumber (xmlNodePtr node);
XMLPUBFUN double XMLCALL XMLPUBFUN double XMLCALL
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
XMLPUBFUN double XMLCALL XMLPUBFUN double XMLCALL
xmlXPathCastToNumber (xmlXPathObjectPtr val); xmlXPathCastToNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastBooleanToString (int val); xmlXPathCastBooleanToString (int val);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNumberToString (double val); xmlXPathCastNumberToString (double val);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeToString (xmlNodePtr node); xmlXPathCastNodeToString (xmlNodePtr node);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastToString (xmlXPathObjectPtr val); xmlXPathCastToString (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertBoolean (xmlXPathObjectPtr val); xmlXPathConvertBoolean (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertNumber (xmlXPathObjectPtr val); xmlXPathConvertNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertString (xmlXPathObjectPtr val); xmlXPathConvertString (xmlXPathObjectPtr val);
/** /**
* Context handling. * Context handling.
*/ */
XMLPUBFUN xmlXPathContextPtr XMLCALL XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPathNewContext (xmlDocPtr doc); xmlXPathNewContext (xmlDocPtr doc);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathFreeContext (xmlXPathContextPtr ctxt); xmlXPathFreeContext (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathContextSetCache(xmlXPathContextPtr ctxt, xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
int active, int active,
int value, int value,
int options); int options);
/** /**
* Evaluation functions. * Evaluation functions.
*/ */
XMLPUBFUN long XMLCALL XMLPUBFUN long XMLCALL
xmlXPathOrderDocElems (xmlDocPtr doc); xmlXPathOrderDocElems (xmlDocPtr doc);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEval (const xmlChar *str, xmlXPathEval (const xmlChar *str,
xmlXPathContextPtr ctx); xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEvalExpression (const xmlChar *str, xmlXPathEvalExpression (const xmlChar *str,
xmlXPathContextPtr ctxt); xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
xmlXPathObjectPtr res); xmlXPathObjectPtr res);
/** /**
* Separate compilation/evaluation entry points. * Separate compilation/evaluation entry points.
*/ */
XMLPUBFUN xmlXPathCompExprPtr XMLCALL XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCompile (const xmlChar *str); xmlXPathCompile (const xmlChar *str);
XMLPUBFUN xmlXPathCompExprPtr XMLCALL XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
const xmlChar *str); const xmlChar *str);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathCompiledEval (xmlXPathCompExprPtr comp, xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctx); xmlXPathContextPtr ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctxt); xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
#endif /* LIBXML_XPATH_ENABLED */ #endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPathInit (void); xmlXPathInit (void);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathIsNaN (double val); xmlXPathIsNaN (double val);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlXPathIsInf (double val); xmlXPathIsInf (double val);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ #endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
#endif /* ! __XML_XPATH_H__ */ #endif /* ! __XML_XPATH_H__ */
 End of changes. 64 change blocks. 
118 lines changed or deleted 121 lines changed or added


 xpointer.h   xpointer.h 
skipping to change at line 37 skipping to change at line 37
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* /*
* A Location Set * A Location Set
*/ */
typedef struct _xmlLocationSet xmlLocationSet; typedef struct _xmlLocationSet xmlLocationSet;
typedef xmlLocationSet *xmlLocationSetPtr; typedef xmlLocationSet *xmlLocationSetPtr;
struct _xmlLocationSet { struct _xmlLocationSet {
int locNr; /* number of locations in the set */ int locNr; /* number of locations in the set */
int locMax; /* size of the array as allocated */ int locMax; /* size of the array as allocated */
xmlXPathObjectPtr *locTab;/* array of locations */ xmlXPathObjectPtr *locTab;/* array of locations */
}; };
/* /*
* Handling of location sets. * Handling of location sets.
*/ */
XMLPUBFUN xmlLocationSetPtr XMLCALL XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
XMLPUBFUN xmlLocationSetPtr XMLCALL XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2); xmlLocationSetPtr val2);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRange (xmlNodePtr start, xmlXPtrNewRange (xmlNodePtr start,
int startindex, int startindex,
xmlNodePtr end, xmlNodePtr end,
int endindex); int endindex);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePoints (xmlXPathObjectPtr start, xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end); xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodePoint (xmlNodePtr start, xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end); xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end); xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodes (xmlNodePtr start, xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end); xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodes (xmlNodePtr start, xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end); xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodeObject (xmlNodePtr start, xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end); xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewCollapsedRange (xmlNodePtr start); xmlXPtrNewCollapsedRange (xmlNodePtr start);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val); xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrWrapLocationSet (xmlLocationSetPtr val); xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrLocationSetDel (xmlLocationSetPtr cur, xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val); xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val); int val);
/* /*
* Functions. * Functions.
*/ */
XMLPUBFUN xmlXPathContextPtr XMLCALL XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPtrNewContext (xmlDocPtr doc, xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here, xmlNodePtr here,
xmlNodePtr origin); xmlNodePtr origin);
XMLPUBFUN xmlXPathObjectPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrEval (const xmlChar *str, xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx); xmlXPathContextPtr ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, xmlXPtrRangeToFunction (xmlXPathParserContextPtr ct
int nargs); xt,
int nargs);
XMLPUBFUN xmlNodePtr XMLCALL XMLPUBFUN xmlNodePtr XMLCALL
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ct xt);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_XPTR_ENABLED */ #endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XPTR_H__ */ #endif /* __XML_XPTR_H__ */
 End of changes. 22 change blocks. 
40 lines changed or deleted 41 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/