AccelerometerSimulation.h | AccelerometerSimulation.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
@interface UIAccelerationSimulation: NSObject | @interface UIAccelerationSimulation: NSObject | |||
{ | { | |||
NSTimeInterval timestamp; | NSTimeInterval timestamp; | |||
UIAccelerationValue x, y, z; | UIAccelerationValue x, y, z; | |||
} | } | |||
@property(nonatomic, readonly) NSTimeInterval timestamp; | @property(nonatomic, readonly) NSTimeInterval timestamp; | |||
@property(nonatomic, readonly) UIAccelerationValue x, y, z; | @property(nonatomic, readonly) UIAccelerationValue x, y, z; | |||
@end | @end | |||
// override UIAccelerometer behaviour | // override UIAccelerometer behavior | |||
@interface UIAccelerometer (Simulation) | @interface UIAccelerometer (Simulation) | |||
+ (UIAccelerometer *)sharedAccelerometer; | + (UIAccelerometer *)sharedAccelerometer; | |||
@end | @end | |||
// our own version of the Accelerometer | // our own version of the Accelerometer | |||
@interface AccelerometerSimulation : UIAccelerometer <NSMachPortDelegate> | @interface AccelerometerSimulation : UIAccelerometer <NSMachPortDelegate> | |||
{ | { | |||
//CFSocketRef udpSocket; | //CFSocketRef udpSocket; | |||
int udpSocket; | int udpSocket; | |||
End of changes. 1 change blocks. | ||||
1 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. | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
#pragma once | @class RootViewController; | |||
#import "cocos2d.h" | @interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDe | |||
#import "EAGLView.h" | legate, UITextFieldDelegate,UIApplicationDelegate> { | |||
UIWindow *window; | ||||
@interface AppController : NSObject <NSApplicationDelegate> | RootViewController *viewController; | |||
{ | } | |||
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. | ||||
15 lines changed or deleted | 6 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: 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: | * vim: set ts=8 sw=4 et tw=99 ft=cpp: | |||
* | * | |||
* ***** BEGIN LICENSE BLOCK ***** | * ***** BEGIN LICENSE BLOCK ***** | |||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
* | * | |||
* The contents of this file are subject to the Mozilla Public License Vers ion | * 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 | * 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: | * the License. You may obtain a copy of the License at: | |||
* http://www.mozilla.org/MPL/ | * http://www.mozilla.org/MPL/ | |||
* | * | |||
skipping to change at line 49 | skipping to change at line 49 | |||
* ***** END LICENSE BLOCK ***** */ | * ***** 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 "mozilla/Types.h" | |||
#include <stdio.h> | ||||
#include <stdlib.h> | ||||
#ifndef WIN32 | ||||
# include <signal.h> | ||||
#endif | ||||
#ifdef ANDROID | ||||
# include <android/log.h> | ||||
#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 | |||
* size of a struct is a multiple of the target architecture's word size: | * size of a struct is a multiple of the target architecture's word size: | |||
* | * | |||
* struct S { ... }; | * struct S { ... }; | |||
* MOZ_STATIC_ASSERT(sizeof(S) % sizeof(size_t) == 0, | * MOZ_STATIC_ASSERT(sizeof(S) % sizeof(size_t) == 0, | |||
* "S should be a multiple of word size for efficiency" ); | * "S should be a multiple of word size for efficiency" ); | |||
* | * | |||
skipping to change at line 134 | skipping to change at line 143 | |||
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 | |||
extern MFBT_API(void) | #if defined(WIN32) | |||
MOZ_Crash(void); | /* | |||
* We used to call DebugBreak() on Windows, but amazingly, it causes | ||||
* the MSVS 2010 debugger not to be able to recover a call stack. | ||||
*/ | ||||
# define MOZ_CRASH() \ | ||||
do { \ | ||||
*((volatile int *) NULL) = 123; \ | ||||
exit(3); \ | ||||
} while (0) | ||||
#elif defined(ANDROID) | ||||
/* | ||||
* On Android, raise(SIGABRT) is handled asynchronously. Seg fault now | ||||
* so we crash immediately and capture the current call stack. We need | ||||
* to specifically use the global namespace in the C++ case. | ||||
*/ | ||||
# ifdef __cplusplus | ||||
# define MOZ_CRASH() \ | ||||
do { \ | ||||
*((volatile int *) NULL) = 123; \ | ||||
::abort(); \ | ||||
} while (0) | ||||
# else | ||||
# define MOZ_CRASH() \ | ||||
do { \ | ||||
*((volatile int *) NULL) = 123; \ | ||||
abort(); \ | ||||
} while (0) | ||||
# 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 | ||||
extern MFBT_API(void) | extern MFBT_API(void) | |||
MOZ_Assert(const char* s, const char* file, int ln); | MOZ_Assert(const char* s, const char* file, int ln); | |||
static MOZ_ALWAYS_INLINE void | ||||
MOZ_OutputAssertMessage(const char* s, const char *file, int ln) | ||||
{ | ||||
#ifdef ANDROID | ||||
__android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert", | ||||
"Assertion failure: %s, at %s:%d\n", s, file, ln); | ||||
#else | ||||
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln); | ||||
fflush(stderr); | ||||
#endif | ||||
} | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
/* | /* | |||
* MOZ_ASSERT(expr [, explanation-string]) asserts that |expr| must be trut hy in | * MOZ_ASSERT(expr [, explanation-string]) asserts that |expr| must be trut hy in | |||
* debug builds. If it is, execution continues. Otherwise, an error messa ge | * debug builds. If it is, execution continues. Otherwise, an error messa ge | |||
* including the expression and the explanation-string (if provided) is pri nted, | * including the expression and the explanation-string (if provided) is pri nted, | |||
* an attempt is made to invoke any existing debugger, and execution halts. | * an attempt is made to invoke any existing debugger, and execution halts. | |||
* MOZ_ASSERT is fatal: no recovery is possible. Do not assert a condition | * MOZ_ASSERT is fatal: no recovery is possible. Do not assert a condition | |||
skipping to change at line 179 | skipping to change at line 243 | |||
* "we already set [[PrimitiveThis]] for this Boolean object") ; | * "we already set [[PrimitiveThis]] for this Boolean object") ; | |||
* MOZ_ASSERT(getSlot(PRIMITIVE_THIS_SLOT).isUndefined(), | * MOZ_ASSERT(getSlot(PRIMITIVE_THIS_SLOT).isUndefined(), | |||
* "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) \ | |||
((expr) ? ((void)0) : MOZ_Assert(#expr, __FILE__, __LINE__)) | do { \ | |||
if (!(expr)) { \ | ||||
MOZ_OutputAssertMessage(#expr, __FILE__, __LINE__); \ | ||||
MOZ_CRASH(); \ | ||||
} \ | ||||
} while (0) | ||||
/* Now the two-argument form. */ | /* Now the two-argument form. */ | |||
# define MOZ_ASSERT_HELPER2(expr, explain) \ | # define MOZ_ASSERT_HELPER2(expr, explain) \ | |||
((expr) ? ((void)0) : MOZ_Assert(#expr " (" explain ")", __FILE__, __L | do { \ | |||
INE__)) | if (!(expr)) { \ | |||
MOZ_OutputAssertMessage(#expr " (" explain ")", __FILE__, __LINE__ | ||||
); \ | ||||
MOZ_CRASH(); \ | ||||
} \ | ||||
} 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 | |||
* http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of -arguments/#comment-644 | * http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of -arguments/#comment-644 | |||
*/ | */ | |||
# define MOZ_COUNT_ASSERT_ARGS_IMPL2(_1, _2, count, ...) \ | # define MOZ_COUNT_ASSERT_ARGS_IMPL2(_1, _2, count, ...) \ | |||
skipping to change at line 208 | skipping to change at line 282 | |||
/* Pick the right helper macro to invoke. */ | /* Pick the right helper macro to invoke. */ | |||
# define MOZ_ASSERT_CHOOSE_HELPER2(count) MOZ_ASSERT_HELPER##count | # define MOZ_ASSERT_CHOOSE_HELPER2(count) MOZ_ASSERT_HELPER##count | |||
# define MOZ_ASSERT_CHOOSE_HELPER1(count) MOZ_ASSERT_CHOOSE_HELPER2(count) | # define MOZ_ASSERT_CHOOSE_HELPER1(count) MOZ_ASSERT_CHOOSE_HELPER2(count) | |||
# define MOZ_ASSERT_CHOOSE_HELPER(count) MOZ_ASSERT_CHOOSE_HELPER1(count) | # define MOZ_ASSERT_CHOOSE_HELPER(count) MOZ_ASSERT_CHOOSE_HELPER1(count) | |||
/* The actual macro. */ | /* The actual macro. */ | |||
# define MOZ_ASSERT_GLUE(x, y) x y | # define MOZ_ASSERT_GLUE(x, y) x y | |||
# define MOZ_ASSERT(...) \ | # define MOZ_ASSERT(...) \ | |||
MOZ_ASSERT_GLUE(MOZ_ASSERT_CHOOSE_HELPER(MOZ_COUNT_ASSERT_ARGS(__VA_AR GS__)), \ | MOZ_ASSERT_GLUE(MOZ_ASSERT_CHOOSE_HELPER(MOZ_COUNT_ASSERT_ARGS(__VA_AR GS__)), \ | |||
(__VA_ARGS__)) | (__VA_ARGS__)) | |||
#else | #else | |||
# define MOZ_ASSERT(...) ((void)0) | # define MOZ_ASSERT(...) do { } while(0) | |||
#endif /* DEBUG */ | #endif /* DEBUG */ | |||
/* | /* | |||
* MOZ_ASSERT_IF(cond1, cond2) is equivalent to MOZ_ASSERT(cond2) if cond1 is | * MOZ_ASSERT_IF(cond1, cond2) is equivalent to MOZ_ASSERT(cond2) if cond1 is | |||
* true. | * true. | |||
* | * | |||
* MOZ_ASSERT_IF(isPrime(num), num == 2 || isOdd(num)); | * MOZ_ASSERT_IF(isPrime(num), num == 2 || isOdd(num)); | |||
* | * | |||
* As with MOZ_ASSERT, MOZ_ASSERT_IF has effect only in debug builds. It i s | * As with MOZ_ASSERT, MOZ_ASSERT_IF has effect only in debug builds. It i s | |||
* designed to catch bugs during debugging, not "in the field". | * designed to catch bugs during debugging, not "in the field". | |||
*/ | */ | |||
#ifdef DEBUG | #ifdef DEBUG | |||
# define MOZ_ASSERT_IF(cond, expr) ((cond) ? MOZ_ASSERT(expr) : ((void)0) | # define MOZ_ASSERT_IF(cond, expr) \ | |||
) | do { \ | |||
if (cond) \ | ||||
MOZ_ASSERT(expr); \ | ||||
} while (0) | ||||
#else | #else | |||
# define MOZ_ASSERT_IF(cond, expr) ((void)0) | # define MOZ_ASSERT_IF(cond, expr) do { } while (0) | |||
#endif | #endif | |||
/* MOZ_NOT_REACHED_MARKER() expands (in compilers which support it) to an | /* MOZ_NOT_REACHED_MARKER() expands (in compilers which support it) to an | |||
* expression which states that it is undefined behavior for the compiler t o | * expression which states that it is undefined behavior for the compiler t o | |||
* reach this point. Most code should probably use the higher level | * reach this point. Most code should probably use the higher level | |||
* MOZ_NOT_REACHED (which expands to this when appropriate). | * MOZ_NOT_REACHED (which expands to 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__) | |||
End of changes. 9 change blocks. | ||||
10 lines changed or deleted | 88 lines changed or added | |||
Barrier.h | Barrier.h | |||
---|---|---|---|---|
skipping to change at line 155 | skipping to change at line 155 | |||
* use the "obj->field.init(value)" method instead of "obj->field = value". | * use the "obj->field.init(value)" method instead of "obj->field = value". | |||
* We use the init naming idiom in many places to signify that a field is b eing | * We use the init naming idiom in many places to signify that a field is b eing | |||
* assigned for the first time, and that no GCs have taken place between th e | * assigned for the first time, and that no GCs have taken place between th e | |||
* object allocation and the assignment. | * object allocation and the assignment. | |||
*/ | */ | |||
struct JSXML; | struct JSXML; | |||
namespace js { | namespace js { | |||
/* | ||||
* Ideally, we would like to make the argument to functions like MarkShape | ||||
be a | ||||
* HeapPtr<const js::Shape>. That would ensure that we don't forget to | ||||
* barrier any fields that we mark through. However, that would prohibit us | ||||
from | ||||
* passing in a derived class like HeapPtr<js::EmptyShape>. | ||||
* | ||||
* To overcome the problem, we make the argument to MarkShape be a | ||||
* MarkablePtr<const js::Shape>. And we allow conversions from HeapPtr<T> | ||||
* to MarkablePtr<U> as long as T can be converted to U. | ||||
*/ | ||||
template<class T> | ||||
class MarkablePtr | ||||
{ | ||||
public: | ||||
T *value; | ||||
explicit MarkablePtr(T *value) : value(value) {} | ||||
}; | ||||
template<class T, typename Unioned = uintptr_t> | template<class T, typename Unioned = uintptr_t> | |||
class HeapPtr | class HeapPtr | |||
{ | { | |||
union { | union { | |||
T *value; | T *value; | |||
Unioned other; | Unioned other; | |||
}; | }; | |||
public: | public: | |||
HeapPtr() : value(NULL) {} | HeapPtr() : value(NULL) {} | |||
skipping to change at line 235 | skipping to change at line 216 | |||
value = v.value; | value = v.value; | |||
post(); | post(); | |||
return *this; | return *this; | |||
} | } | |||
T &operator*() const { return *value; } | T &operator*() const { return *value; } | |||
T *operator->() const { return value; } | T *operator->() const { return value; } | |||
operator T*() const { return value; } | operator T*() const { return value; } | |||
/* | ||||
* This coerces to MarkablePtr<U> as long as T can coerce to U. See the | ||||
* comment for MarkablePtr above. | ||||
*/ | ||||
template<class U> | ||||
operator MarkablePtr<U>() const { return MarkablePtr<U>(value); } | ||||
private: | private: | |||
void pre() { T::writeBarrierPre(value); } | void pre() { T::writeBarrierPre(value); } | |||
void post() { T::writeBarrierPost(value, (void *)&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); | |||
skipping to change at line 278 | skipping to change at line 252 | |||
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 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 423 | skipping to change at line 398 | |||
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 slotno); | |||
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. | ||||
* | ||||
* Run a post write barrier that encompasses multiple contiguous slots in a | ||||
* single step. | ||||
*/ | ||||
static inline void | ||||
SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t star | ||||
t, uint32_t count) | ||||
{ | ||||
} | ||||
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; | |||
} | } | |||
class HeapSlotArray | class HeapSlotArray | |||
{ | { | |||
skipping to change at line 510 | skipping to change at line 496 | |||
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; } | |||
template<class U> | ||||
operator MarkablePtr<U>() const { return MarkablePtr<U>(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; | |||
inline operator const Value &() const; | inline operator const Value &() const; | |||
inline JSObject &toObject() const; | inline JSObject &toObject() const; | |||
}; | }; | |||
} | namespace tl { | |||
template <class T> struct IsPostBarrieredType<HeapPtr<T> > { | ||||
static const bool resul | ||||
t = true; }; | ||||
template <> struct IsPostBarrieredType<HeapSlot> { static const bool resul | ||||
t = true; }; | ||||
template <> struct IsPostBarrieredType<HeapValue> { static const bool resul | ||||
t = true; }; | ||||
template <> struct IsPostBarrieredType<HeapId> { static const bool resul | ||||
t = true; }; | ||||
} /* namespace tl */ | ||||
} /* namespace js */ | ||||
#endif /* jsgc_barrier_h___ */ | #endif /* jsgc_barrier_h___ */ | |||
End of changes. 6 change blocks. | ||||
32 lines changed or deleted | 27 lines changed or added | |||
BloomFilter.h | BloomFilter.h | |||
---|---|---|---|---|
skipping to change at line 136 | skipping to change at line 136 | |||
* Remove an item from the filter. | * Remove an item from the filter. | |||
*/ | */ | |||
void remove(const T* t); | void remove(const T* t); | |||
/* | /* | |||
* Check whether the filter might contain an item. This can | * Check whether the filter might contain an item. This can | |||
* sometimes return true even if the item is not in the filter, | * sometimes return true even if the item is not in the filter, | |||
* but will never return false for items that are actually in the | * but will never return false for items that are actually in the | |||
* filter. | * filter. | |||
*/ | */ | |||
bool mayContain(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 mayContain(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)]; } | |||
skipping to change at line 216 | skipping to change at line 216 | |||
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>::mayContain(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>::mayContain(const T* t) const | BloomFilter<KeySize, T>::mightContain(const T* t) const | |||
{ | { | |||
uint32_t hash = t->hash(); | uint32_t hash = t->hash(); | |||
return mayContain(hash); | return mightContain(hash); | |||
} | } | |||
} // namespace mozilla | } // namespace mozilla | |||
#endif /* mozilla_BloomFilter_h_ */ | #endif /* mozilla_BloomFilter_h_ */ | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 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_IPHONE_CCACCELEROMETER_H__ | #ifndef __PLATFORM_MAC_CCACCELEROMETER_H__ | |||
#define __PLATFORM_IPHONE_CCACCELEROMETER_H__ | #define __PLATFORM_MAC_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); | void setDelegate(CCAccelerometerDelegate* pDelegate) { CC_UNUSED_PARAM( pDelegate); } | |||
}; | }; | |||
NS_CC_END | NS_CC_END | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
CCAction.h | CCAction.h | |||
---|---|---|---|---|
skipping to change at line 237 | skipping to change at line 237 | |||
bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZ ero); | bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZ ero); | |||
virtual CCObject* copyWithZone(CCZone *pZone); | virtual CCObject* copyWithZone(CCZone *pZone); | |||
virtual void step(float dt); | virtual void step(float dt); | |||
virtual bool isDone(void); | virtual bool isDone(void); | |||
virtual void stop(void); | virtual void stop(void); | |||
public: | public: | |||
/** creates the action with a set boundary, | /** creates the action with a set boundary, | |||
It will work with no boundary if @param rect is equal to CCRectZero . | It will work with no boundary if @param rect is equal to CCRectZero . | |||
@deprecated: Please use create(CCNode*, const CCRect&) intead. This int erface will be deprecated sooner or later. | @deprecated: Please use create(CCNode*, const CCRect&) instead. This in terface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFoll owedNode, const CCRect& rect = CCRectZero); | CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFoll owedNode, const CCRect& rect = CCRectZero); | |||
/** creates the action with a set boundary, | /** creates the action with a set boundary, | |||
It will work with no boundary if @param rect is equal to CCRectZero. | It will work with no boundary if @param rect is equal to CCRectZero. | |||
*/ | */ | |||
static CCFollow* create(CCNode *pFollowedNode, const CCRect& rect = CCR ectZero); | static CCFollow* create(CCNode *pFollowedNode, const CCRect& rect = CCR ectZero); | |||
protected: | protected: | |||
// node to follow | // node to follow | |||
CCNode *m_pobFollowedNode; | CCNode *m_pobFollowedNode; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionCamera.h | CCActionCamera.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionCatmullRom.h | CCActionCatmullRom.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
* | * | |||
* 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 FROM, | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N | |||
* THE SOFTWARE. | * THE SOFTWARE. | |||
* | * | |||
* | * | |||
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/O verhauser-Catmull-Rom-Splines-for-Camera-Animatio.So | * Original code by Radu Gruian: http://www.codeproject.com/Articles/30838/ Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So | |||
* | * | |||
* Adapted to cocos2d-x by Vit Valentin | * Adapted to cocos2d-x by Vit Valentin | |||
* | * | |||
* Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada | * Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada | |||
*/ | */ | |||
#ifndef __CCACTION_CATMULLROM_H__ | #ifndef __CCACTION_CATMULLROM_H__ | |||
#define __CCACTION_CATMULLROM_H__ | #define __CCACTION_CATMULLROM_H__ | |||
#include "CCActionInterval.h" | #include "CCActionInterval.h" | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionEase.h | CCActionEase.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2009 Jason Booth | Copyright (c) 2008-2009 Jason Booth | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 313 | skipping to change at line 313 | |||
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); | |||
0.3f); | 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 fucntion. 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 CCEaseElasticIn : public CCEaseElastic | class CC_DLL CCEaseElasticIn : public CCEaseElastic | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
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 | |||
= 0.3f); | ); | |||
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 fucntion. 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 | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
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 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 | static CCEaseElasticOut* create(CCActionInterval *pAction, float fPerio | |||
d = 0.3f); | d); | |||
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 fucntion. 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 | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
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 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 | static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPer | |||
iod = 0.3f); | iod); | |||
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: | |||
skipping to change at line 431 | skipping to change at line 443 | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCEaseBounceIn* actionWithAction(CCActio nInterval* pAction); | CC_DEPRECATED_ATTRIBUTE static CCEaseBounceIn* actionWithAction(CCActio nInterval* pAction); | |||
/** creates the action */ | /** creates the action */ | |||
static CCEaseBounceIn* create(CCActionInterval* pAction); | static CCEaseBounceIn* create(CCActionInterval* pAction); | |||
}; | }; | |||
/** | /** | |||
@brief EaseBounceOut action. | @brief EaseBounceOut action. | |||
@warning This action doesn't use a bijective fucntion. 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 CCEaseBounceOut : public CCEaseBounce | class CC_DLL CCEaseBounceOut : public CCEaseBounce | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCActionInterval* reverse(void); | virtual CCActionInterval* reverse(void); | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
skipping to change at line 453 | skipping to change at line 465 | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCEaseBounceOut* actionWithAction(CCActi onInterval* pAction); | CC_DEPRECATED_ATTRIBUTE static CCEaseBounceOut* actionWithAction(CCActi onInterval* pAction); | |||
/** creates the action */ | /** creates the action */ | |||
static CCEaseBounceOut* create(CCActionInterval* pAction); | static CCEaseBounceOut* create(CCActionInterval* pAction); | |||
}; | }; | |||
/** | /** | |||
@brief CCEaseBounceInOut action. | @brief CCEaseBounceInOut action. | |||
@warning This action doesn't use a bijective fucntion. 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 CCEaseBounceInOut : public CCEaseBounce | class CC_DLL CCEaseBounceInOut : public CCEaseBounce | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
virtual CCActionInterval* reverse(); | virtual CCActionInterval* reverse(); | |||
skipping to change at line 475 | skipping to change at line 487 | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCEaseBounceInOut* actionWithAction(CCAc tionInterval* pAction); | CC_DEPRECATED_ATTRIBUTE static CCEaseBounceInOut* actionWithAction(CCAc tionInterval* pAction); | |||
/** creates the action */ | /** creates the action */ | |||
static CCEaseBounceInOut* create(CCActionInterval* pAction); | static CCEaseBounceInOut* create(CCActionInterval* pAction); | |||
}; | }; | |||
/** | /** | |||
@brief CCEaseBackIn action. | @brief CCEaseBackIn action. | |||
@warning This action doesn't use a bijective fucntion. 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 CCEaseBackIn : public CCActionEase | class CC_DLL CCEaseBackIn : public CCActionEase | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCActionInterval* reverse(void); | virtual CCActionInterval* reverse(void); | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
skipping to change at line 497 | skipping to change at line 509 | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCEaseBackIn* actionWithAction(CCActionI nterval* pAction); | CC_DEPRECATED_ATTRIBUTE static CCEaseBackIn* actionWithAction(CCActionI nterval* pAction); | |||
/** creates the action */ | /** creates the action */ | |||
static CCEaseBackIn* create(CCActionInterval* pAction); | static CCEaseBackIn* create(CCActionInterval* pAction); | |||
}; | }; | |||
/** | /** | |||
@brief CCEaseBackOut action. | @brief CCEaseBackOut action. | |||
@warning This action doesn't use a bijective fucntion. 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 CCEaseBackOut : public CCActionEase | class CC_DLL CCEaseBackOut : public CCActionEase | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCActionInterval* reverse(void); | virtual CCActionInterval* reverse(void); | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
skipping to change at line 519 | skipping to change at line 531 | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCEaseBackOut* actionWithAction(CCAction Interval* pAction); | CC_DEPRECATED_ATTRIBUTE static CCEaseBackOut* actionWithAction(CCAction Interval* pAction); | |||
/** creates the action */ | /** creates the action */ | |||
static CCEaseBackOut* create(CCActionInterval* pAction); | static CCEaseBackOut* create(CCActionInterval* pAction); | |||
}; | }; | |||
/** | /** | |||
@brief CCEaseBackInOut action. | @brief CCEaseBackInOut action. | |||
@warning This action doesn't use a bijective fucntion. 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 CCEaseBackInOut : public CCActionEase | class CC_DLL CCEaseBackInOut : public CCActionEase | |||
{ | { | |||
public: | public: | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
virtual CCActionInterval* reverse(); | virtual CCActionInterval* reverse(); | |||
End of changes. 13 change blocks. | ||||
17 lines changed or deleted | 28 lines changed or added | |||
CCActionGrid.h | CCActionGrid.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 On-Core | Copyright (c) 2009 On-Core | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionInstant.h | CCActionInstant.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
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 __CCINSTANT_ACTION_H__ | #ifndef __CCINSTANT_ACTION_H__ | |||
#define __CCINSTANT_ACTION_H__ | #define __CCINSTANT_ACTION_H__ | |||
#include <string> | #include <string> | |||
#include "ccTypeInfo.h" | ||||
#include "CCAction.h" | #include "CCAction.h" | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
/** | /** | |||
* @addtogroup actions | * @addtogroup actions | |||
* @{ | * @{ | |||
*/ | */ | |||
/** | /** | |||
skipping to change at line 264 | skipping to change at line 265 | |||
inline void setTargetCallback(CCObject* pSel) | inline void setTargetCallback(CCObject* pSel) | |||
{ | { | |||
if (pSel != m_pSelectorTarget) | if (pSel != m_pSelectorTarget) | |||
{ | { | |||
CC_SAFE_RETAIN(pSel); | CC_SAFE_RETAIN(pSel); | |||
CC_SAFE_RELEASE(m_pSelectorTarget); | CC_SAFE_RELEASE(m_pSelectorTarget); | |||
m_pSelectorTarget = pSel; | m_pSelectorTarget = pSel; | |||
} | } | |||
} | } | |||
inline int getScriptHandler() { return m_nScriptHandler; }; | ||||
protected: | protected: | |||
/** Target that will be called */ | /** Target that will be called */ | |||
CCObject* m_pSelectorTarget; | CCObject* m_pSelectorTarget; | |||
int m_nScriptHandler; | int m_nScriptHandler; | |||
union | union | |||
{ | { | |||
SEL_CallFunc m_pCallFunc; | SEL_CallFunc m_pCallFunc; | |||
SEL_CallFuncN m_pCallFuncN; | SEL_CallFuncN m_pCallFuncN; | |||
SEL_CallFuncND m_pCallFuncND; | SEL_CallFuncND m_pCallFuncND; | |||
SEL_CallFuncO m_pCallFuncO; | SEL_CallFuncO m_pCallFuncO; | |||
}; | }; | |||
}; | }; | |||
/** | /** | |||
@brief Calls a 'callback' with the node as the first argument | @brief Calls a 'callback' with the node as the first argument | |||
N means Node | N means Node | |||
*/ | */ | |||
class CC_DLL CCCallFuncN : public CCCallFunc | class CC_DLL CCCallFuncN : public CCCallFunc, public TypeInfo | |||
{ | { | |||
public: | public: | |||
CCCallFuncN(){} | CCCallFuncN(){} | |||
virtual ~CCCallFuncN(){} | virtual ~CCCallFuncN(){} | |||
virtual long getClassTypeInfo() { | ||||
static const long id = cocos2d::getHashCodeByString(typeid(c | ||||
ocos2d::CCCallFunc).name()); | ||||
return id; | ||||
} | ||||
/** creates the action with the callback | /** creates the action with the callback | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
typedef void (CCObject::*SEL_CallFuncN)(CCNode*); | typedef void (CCObject::*SEL_CallFuncN)(CCNode*); | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector); | CC_DEPRECATED_ATTRIBUTE static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector); | |||
/** creates the action with the callback | /** creates the action with the callback | |||
typedef void (CCObject::*SEL_CallFuncN)(CCNode*); | typedef void (CCObject::*SEL_CallFuncN)(CCNode*); | |||
*/ | */ | |||
skipping to change at line 320 | skipping to change at line 327 | |||
virtual void execute(); | virtual void execute(); | |||
}; | }; | |||
/** | /** | |||
@brief Calls a 'callback' with the node as the first argument and the 2nd a rgument is data | @brief Calls a 'callback' with the node as the first argument and the 2nd a rgument is data | |||
* ND means: Node and Data. Data is void *, so it could be anything. | * ND means: Node and Data. Data is void *, so it could be anything. | |||
*/ | */ | |||
class CC_DLL CCCallFuncND : public CCCallFuncN | class CC_DLL CCCallFuncND : public CCCallFuncN | |||
{ | { | |||
public: | public: | |||
virtual long getClassTypeInfo() { | ||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d: | ||||
:CCCallFunc).name()); | ||||
return id; | ||||
} | ||||
/** creates the action with the callback and the data to pass as an arg ument | /** creates the action with the callback and the data to pass as an arg ument | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCCallFuncND * actionWithTarget(CCObject * pSelectorTarget, SEL_CallFuncND selector, void* d); | CC_DEPRECATED_ATTRIBUTE static CCCallFuncND * actionWithTarget(CCObject * pSelectorTarget, SEL_CallFuncND selector, void* d); | |||
/** creates the action with the callback and the data to pass as an arg ument */ | /** creates the action with the callback and the data to pass as an arg ument */ | |||
static CCCallFuncND * create(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d); | static CCCallFuncND * create(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d); | |||
/** initializes the action with the callback and the data to pass as an argument */ | /** initializes the action with the callback and the data to pass as an argument */ | |||
skipping to change at line 344 | skipping to change at line 355 | |||
protected: | protected: | |||
void *m_pData; | void *m_pData; | |||
}; | }; | |||
/** | /** | |||
@brief Calls a 'callback' with an object as the first argument. | @brief Calls a 'callback' with an object as the first argument. | |||
O means Object. | O means Object. | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
class CC_DLL CCCallFuncO : public CCCallFunc | ||||
class CC_DLL CCCallFuncO : public CCCallFunc, public TypeInfo | ||||
{ | { | |||
public: | public: | |||
CCCallFuncO(); | CCCallFuncO(); | |||
virtual ~CCCallFuncO(); | virtual ~CCCallFuncO(); | |||
virtual long getClassTypeInfo() { | ||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos | ||||
2d::CCCallFunc).name()); | ||||
return id; | ||||
} | ||||
/** creates the action with the callback | /** creates the action with the callback | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
typedef void (CCObject::*SEL_CallFuncO)(CCObject*); | typedef void (CCObject::*SEL_CallFuncO)(CCObject*); | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject); | CC_DEPRECATED_ATTRIBUTE static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject); | |||
/** creates the action with the callback | /** creates the action with the callback | |||
typedef void (CCObject::*SEL_CallFuncO)(CCObject*); | typedef void (CCObject::*SEL_CallFuncO)(CCObject*); | |||
*/ | */ | |||
End of changes. 7 change blocks. | ||||
2 lines changed or deleted | 23 lines changed or added | |||
CCActionInterval.h | CCActionInterval.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2011 Ricardo Quesada | Copyright (c) 2008-2011 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 119 | skipping to change at line 119 | |||
virtual void startWithTarget(CCNode *pTarget); | virtual void startWithTarget(CCNode *pTarget); | |||
virtual void stop(void); | virtual void stop(void); | |||
virtual void update(float t); | virtual void update(float t); | |||
virtual CCActionInterval* reverse(void); | virtual CCActionInterval* reverse(void); | |||
public: | public: | |||
/** helper constructor to create an array of sequenceable actions | /** helper constructor to create an array of sequenceable actions | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTime Action *pAction1, ...); | CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTime Action *pAction1, ...); | |||
/** helper contructor to create an array of sequenceable actions given an array | /** helper constructor to create an array of sequenceable actions given an array | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCAr ray *arrayOfActions); | CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCAr ray *arrayOfActions); | |||
/** creates the action | /** creates the action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCSequence* actionOneTwo(CCFiniteTimeAct ion *pActionOne, CCFiniteTimeAction *pActionTwo); | CC_DEPRECATED_ATTRIBUTE static CCSequence* actionOneTwo(CCFiniteTimeAct ion *pActionOne, CCFiniteTimeAction *pActionTwo); | |||
/** helper constructor to create an array of sequenceable actions */ | /** helper constructor to create an array of sequenceable actions */ | |||
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...); | static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...); | |||
/** helper contructor to create an array of sequenceable actions given an array */ | /** helper constructor to create an array of sequenceable actions given an array */ | |||
static CCFiniteTimeAction* create(CCArray *arrayOfActions); | static CCFiniteTimeAction* create(CCArray *arrayOfActions); | |||
/** creates the action */ | /** creates the action */ | |||
static CCSequence* createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo); | static CCSequence* createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo); | |||
protected: | protected: | |||
CCFiniteTimeAction *m_pActions[2]; | CCFiniteTimeAction *m_pActions[2]; | |||
float m_split; | float m_split; | |||
int m_last; | int m_last; | |||
}; | }; | |||
skipping to change at line 260 | skipping to change at line 260 | |||
virtual void stop(void); | virtual void stop(void); | |||
virtual void update(float time); | virtual void update(float time); | |||
virtual CCActionInterval* reverse(void); | virtual CCActionInterval* reverse(void); | |||
public: | public: | |||
/** helper constructor to create an array of spawned actions | /** helper constructor to create an array of spawned actions | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTime Action *pAction1, ...); | CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTime Action *pAction1, ...); | |||
/** helper contructor to create an array of spawned actions given an ar ray | /** helper constructor to create an array of spawned actions given an a rray | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCAr ray *arrayOfActions); | CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCAr ray *arrayOfActions); | |||
/** creates the Spawn action | /** creates the Spawn action | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2); | CC_DEPRECATED_ATTRIBUTE static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2); | |||
/** helper constructor to create an array of spawned actions */ | /** helper constructor to create an array of spawned actions */ | |||
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...); | static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...); | |||
/** helper contructor to create an array of spawned actions given an ar ray */ | /** helper constructor to create an array of spawned actions given an a rray */ | |||
static CCFiniteTimeAction* create(CCArray *arrayOfActions); | static CCFiniteTimeAction* create(CCArray *arrayOfActions); | |||
/** creates the Spawn action */ | /** creates the Spawn action */ | |||
static CCSpawn* createWithTwoActions(CCFiniteTimeAction *pAction1, CCFi niteTimeAction *pAction2); | static CCSpawn* createWithTwoActions(CCFiniteTimeAction *pAction1, CCFi niteTimeAction *pAction2); | |||
protected: | protected: | |||
CCFiniteTimeAction *m_pOne; | CCFiniteTimeAction *m_pOne; | |||
CCFiniteTimeAction *m_pTwo; | CCFiniteTimeAction *m_pTwo; | |||
}; | }; | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
CCActionManager.h | CCActionManager.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2009 Valentin Milea | Copyright (c) 2009 Valentin Milea | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionPageTurn3D.h | CCActionPageTurn3D.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ | Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionProgressTimer.h | CCActionProgressTimer.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (C) 2010 Lam Pham | Copyright (C) 2010 Lam Pham | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionTiledGrid.h | CCActionTiledGrid.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 On-Core | Copyright (c) 2009 On-Core | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCActionTween.h | CCActionTween.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright 2009 lhunath (Maarten Billemont) | Copyright 2009 lhunath (Maarten Billemont) | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 52 | skipping to change at line 52 | |||
}; | }; | |||
/** CCActionTween | /** CCActionTween | |||
CCActionTween is an action that lets you update any property of an object. | CCActionTween is an action that lets you update any property of an object. | |||
For example, if you want to modify the "width" property of a target from 2 00 to 300 in 2 seconds, then: | For example, if you want to modify the "width" property of a target from 2 00 to 300 in 2 seconds, then: | |||
id modifyWidth = [CCActionTween actionWithDuration:2 key:@"width" from: 200 to:300]; | id modifyWidth = [CCActionTween actionWithDuration:2 key:@"width" from: 200 to:300]; | |||
[target runAction:modifyWidth]; | [target runAction:modifyWidth]; | |||
Another example: CCScaleTo action could be rewriten using CCPropertyAction : | Another example: CCScaleTo action could be rewritten using CCPropertyActio n: | |||
// scaleA and scaleB are equivalents | // scaleA and scaleB are equivalents | |||
id scaleA = [CCScaleTo actionWithDuration:2 scale:3]; | id scaleA = [CCScaleTo actionWithDuration:2 scale:3]; | |||
id scaleB = [CCActionTween actionWithDuration:2 key:@"scale" from:1 to: 3]; | id scaleB = [CCActionTween actionWithDuration:2 key:@"scale" from:1 to: 3]; | |||
@since v0.99.2 | @since v0.99.2 | |||
*/ | */ | |||
class CC_DLL CCActionTween : public CCActionInterval | class CC_DLL CCActionTween : public CCActionInterval | |||
{ | { | |||
public: | public: | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCAnimation.h | CCAnimation.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 70 | skipping to change at line 70 | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
/** initializes the animation frame with a spriteframe, number of delay units and a notification user info */ | /** initializes the animation frame with a spriteframe, number of delay units and a notification user info */ | |||
bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo); | bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo); | |||
/** CCSpriteFrameName to be used */ | /** CCSpriteFrameName to be used */ | |||
CC_SYNTHESIZE_RETAIN(CCSpriteFrame*, m_pSpriteFrame, SpriteFrame) | CC_SYNTHESIZE_RETAIN(CCSpriteFrame*, m_pSpriteFrame, SpriteFrame) | |||
/** how many units of time the frame takes */ | /** how many units of time the frame takes */ | |||
CC_SYNTHESIZE(float, m_fDelayUnits, DelayUnits) | CC_SYNTHESIZE(float, m_fDelayUnits, DelayUnits) | |||
/** A CCAnimationFrameDisplayedNotification notification will be broad casted when the frame is displayed with this dictionary as UserInfo. If Use rInfo is nil, then no notification will be broadcasted. */ | /** A CCAnimationFrameDisplayedNotification notification will be broad cast when the frame is displayed with this dictionary as UserInfo. If UserI nfo is nil, then no notification will be broadcast. */ | |||
CC_SYNTHESIZE_RETAIN(CCDictionary*, m_pUserInfo, UserInfo) | CC_SYNTHESIZE_RETAIN(CCDictionary*, m_pUserInfo, UserInfo) | |||
}; | }; | |||
/** A CCAnimation object is used to perform animations on the CCSprite obje cts. | /** A CCAnimation object is used to perform animations on the CCSprite obje cts. | |||
The CCAnimation object contains CCAnimationFrame objects, and a possible de lay between the frames. | The CCAnimation object contains CCAnimationFrame objects, and a possible de lay between the frames. | |||
You can animate a CCAnimation object by using the CCAnimate action. Example : | You can animate a CCAnimation object by using the CCAnimate action. Example : | |||
[sprite runAction:[CCAnimate actionWithAnimation:animation]]; | [sprite runAction:[CCAnimate actionWithAnimation:animation]]; | |||
skipping to change at line 122 | skipping to change at line 122 | |||
/* Creates an animation with an array of CCSpriteFrame and a delay betw een frames in seconds. | /* Creates an animation with an array of CCSpriteFrame and a delay betw een frames in seconds. | |||
The frames will be added with one "delay unit". | The frames will be added with one "delay unit". | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameN ames, float delay = 0.0f); | static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameN ames, float delay = 0.0f); | |||
/* Creates an animation with an array of CCAnimationFrame, the delay pe r units in seconds and and how many times it should be executed. | /* Creates an animation with an array of CCAnimationFrame, the delay pe r units in seconds and and how many times it should be executed. | |||
@since v2.0 | @since v2.0 | |||
*/ | */ | |||
static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float d elayPerUnit, unsigned int loops); | static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float d elayPerUnit, unsigned int loops); | |||
static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float d | ||||
elayPerUnit) { | ||||
return CCAnimation::create(arrayOfAnimationFrameNames, delayPerUnit | ||||
, 1); | ||||
} | ||||
/** Adds a CCSpriteFrame to a CCAnimation. | /** Adds a CCSpriteFrame to a CCAnimation. | |||
The frame will be added with one "delay unit". | The frame will be added with one "delay unit". | |||
*/ | */ | |||
void addSpriteFrame(CCSpriteFrame *pFrame); | void addSpriteFrame(CCSpriteFrame *pFrame); | |||
/** Adds a frame with an image filename. Internally it will create a CC SpriteFrame and it will add it. | /** Adds a frame with an image filename. Internally it will create a CC SpriteFrame and it will add it. | |||
The frame will be added with one "delay unit". | The frame will be added with one "delay unit". | |||
Added to facilitate the migration from v0.8 to v0.9. | Added to facilitate the migration from v0.8 to v0.9. | |||
*/ | */ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added | |||
CCAnimationCache.h | CCAnimationCache.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2010 Ricardo Quesada | Copyright (c) 2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 55 | skipping to change at line 55 | |||
Before v0.99.5, the recommend way was to save them on the CCSprite. Since v 0.99.5, you should use this class instead. | Before v0.99.5, the recommend way was to save them on the CCSprite. Since v 0.99.5, you should use this class instead. | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
class CC_DLL CCAnimationCache : public CCObject | class CC_DLL CCAnimationCache : public CCObject | |||
{ | { | |||
public: | public: | |||
CCAnimationCache(); | CCAnimationCache(); | |||
~CCAnimationCache(); | ~CCAnimationCache(); | |||
/** Retruns ths shared instance of the Animation cache */ | /** Returns the shared instance of the Animation cache */ | |||
static CCAnimationCache* sharedAnimationCache(void); | static CCAnimationCache* sharedAnimationCache(void); | |||
/** Purges the cache. It releases all the CCAnimation objects and the s hared instance. | /** Purges the cache. It releases all the CCAnimation objects and the s hared instance. | |||
*/ | */ | |||
static void purgeSharedAnimationCache(void); | static void purgeSharedAnimationCache(void); | |||
/** Adds a CCAnimation with a name. | /** Adds a CCAnimation with a name. | |||
*/ | */ | |||
void addAnimation(CCAnimation *animation, const char * name); | void addAnimation(CCAnimation *animation, const char * name); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCApplication.h | CCApplication.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 __CC_APPLICATION_IOS_H__ | #ifndef __CC_APPLICATION_MAC_H__ | |||
#define __CC_APPLICATION_IOS_H__ | #define __CC_APPLICATION_MAC_H__ | |||
#include "platform/CCCommon.h" | #include "platform/CCCommon.h" | |||
#include "platform/CCApplicationProtocol.h" | #include "platform/CCApplicationProtocol.h" | |||
#include <string> | ||||
NS_CC_BEGIN | NS_CC_BEGIN | |||
class CCRect; | ||||
class CC_DLL CCApplication : public CCApplicationProtocol | class CC_DLL CCApplication : public CCApplicationProtocol | |||
{ | { | |||
public: | public: | |||
CCApplication(); | CCApplication(); | |||
virtual ~CCApplication(); | virtual ~CCApplication(); | |||
/** | /** | |||
@brief Run the message loop. | @brief Callback by CCDirector for limit FPS. | |||
@interval The time, which expressed in second in second, between | ||||
current frame and next. | ||||
*/ | ||||
virtual void setAnimationInterval(double interval); | ||||
/** | ||||
@brief Get status bar rectangle in EGLView window. | ||||
*/ | ||||
/** | ||||
@brief Run the message loop. | ||||
*/ | */ | |||
int run(); | int run(); | |||
/** | /** | |||
@brief Get current applicaiton instance. | @brief Get current applicaiton instance. | |||
@return Current application instance pointer. | @return Current application instance pointer. | |||
*/ | */ | |||
static CCApplication* sharedApplication(); | static CCApplication* sharedApplication(); | |||
/** | /** | |||
@brief Callback by CCDirector for limit FPS. | ||||
@interval The time, which expressed in second in second, between | ||||
current frame and next. | ||||
*/ | ||||
virtual void setAnimationInterval(double interval); | ||||
/** | ||||
@brief Get current language config | @brief Get current language config | |||
@return Current language config | @return Current language config | |||
*/ | */ | |||
virtual ccLanguageType getCurrentLanguage(); | virtual ccLanguageType getCurrentLanguage(); | |||
/** | /** | |||
@brief Get target platform | @brief Get target platform | |||
*/ | */ | |||
virtual TargetPlatform getTargetPlatform(); | virtual TargetPlatform getTargetPlatform(); | |||
/* set the Resource root path */ | ||||
void setResourceRootPath(const std::string& rootResDir); | ||||
/* get the Resource root path */ | ||||
const std::string& getResourceRootPath(void); | ||||
void setStartupScriptFilename(const std::string& startupScriptFile); | ||||
const std::string& getStartupScriptFilename(void); | ||||
protected: | protected: | |||
static CCApplication * sm_pSharedApplication; | static CCApplication * sm_pSharedApplication; | |||
std::string m_resourceRootPath; | ||||
std::string m_startupScriptFilename; | ||||
}; | }; | |||
NS_CC_END | NS_CC_END | |||
#endif // end of __CC_APPLICATION_IOS_H__ | #endif // end of __CC_APPLICATION_MAC_H__; | |||
End of changes. 9 change blocks. | ||||
13 lines changed or deleted | 29 lines changed or added | |||
CCApplicationProtocol.h | CCApplicationProtocol.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
virtual void applicationDidEnterBackground() = 0; | virtual void applicationDidEnterBackground() = 0; | |||
/** | /** | |||
@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() = 0; | virtual void applicationWillEnterForeground() = 0; | |||
/** | /** | |||
@brief Callback by CCDirector for limit FPS. | @brief Callback by CCDirector for limit FPS. | |||
@interval The time, which expressed in second in second, between current frame and next. | @interval The time, expressed in seconds, between current frame a nd next. | |||
*/ | */ | |||
virtual void setAnimationInterval(double interval) = 0; | virtual void setAnimationInterval(double interval) = 0; | |||
/** | /** | |||
@brief Get current language config | @brief Get current language config | |||
@return Current language config | @return Current language config | |||
*/ | */ | |||
virtual ccLanguageType getCurrentLanguage() = 0; | virtual ccLanguageType getCurrentLanguage() = 0; | |||
/** | /** | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCArray.h | CCArray.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
#define __CCARRAY_H__ | #define __CCARRAY_H__ | |||
#include "support/data_support/ccCArray.h" | #include "support/data_support/ccCArray.h" | |||
/** | /** | |||
* @addtogroup data_structures | * @addtogroup data_structures | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @def CCARRAY_FOREACH | /** @def CCARRAY_FOREACH | |||
A convience macro to iterate over a CCArray using. It is faster than the "f ast enumeration" interface. | A convenience macro to iterate over a CCArray using. It is faster than the "fast enumeration" interface. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
/* | /* | |||
In cocos2d-iphone 1.0.0, This macro have been update to like this: | In cocos2d-iphone 1.0.0, This macro have been update to like this: | |||
#define CCARRAY_FOREACH(__array__, __object__) \ | #define CCARRAY_FOREACH(__array__, __object__) \ | |||
if (__array__ && __array__->data->num > 0) \ | if (__array__ && __array__->data->num > 0) \ | |||
for(id *__arr__ = __array__->data->arr, *end = __array__->data->arr + __arr ay__->data->num-1; \ | for(id *__arr__ = __array__->data->arr, *end = __array__->data->arr + __arr ay__->data->num-1; \ | |||
__arr__ <= end && ((__object__ = *__arr__) != nil || true); \ | __arr__ <= end && ((__object__ = *__arr__) != nil || true); \ | |||
skipping to change at line 141 | skipping to change at line 141 | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithCapacity(unsigned int capacity); | CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithCapacity(unsigned int capacity); | |||
/** Create an array with an existing array | /** Create an array with an existing array | |||
@deprecated: Please use createWithArray(CCArray*) instead. This interfa ce will be deprecated sooner or later. | @deprecated: Please use createWithArray(CCArray*) instead. This interfa ce will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithArray(CCArray* otherAr ray); | CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithArray(CCArray* otherAr ray); | |||
/** | /** | |||
@brief Generate a CCArray pointer by file | @brief Generate a CCArray pointer by file | |||
@param pFileName The file name of *.plist file | @param pFileName The file name of *.plist file | |||
@return The CCArray pointer generated from the file | @return The CCArray pointer generated from the file | |||
@deprecated: Please use createWithContentsOfFile(const char*) intead. This interface will be deprecated sooner or later. | @deprecated: Please use createWithContentsOfFile(const char*) instead. This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFile(const char* pFileName); | CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFile(const char* pFileName); | |||
/* | /* | |||
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't c all autorelease, so the | @brief The same meaning as arrayWithContentsOfFile(), but it doesn't c all autorelease, so the | |||
invoker should call release(). | invoker should call release(). | |||
@deprecated: Please use createWithContentsOfFileThreadSafe(const char* ) instead. This interface will be deprecated sooner or later. | @deprecated: Please use createWithContentsOfFileThreadSafe(const char* ) instead. This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFileThreadSa fe(const char* pFileName); | CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFileThreadSa fe(const char* pFileName); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCAtlasNode.h | CCAtlasNode.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 101 | skipping to change at line 101 | |||
unsigned int itemsToRender); | unsigned int itemsToRender); | |||
/** creates a CCAtlasNode with an Atlas file the width and height o f each item and the quantity of items to render*/ | /** creates a CCAtlasNode with an Atlas file the width and height o f each item and the quantity of items to render*/ | |||
static CCAtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight, | static CCAtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight, | |||
unsigned int itemsToRender); | unsigned int itemsToRender); | |||
/** initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/ | /** initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/ | |||
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigne d int tileHeight, unsigned int itemsToRender); | bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigne d int tileHeight, unsigned int itemsToRender); | |||
/** updates the Atlas (indexed vertex array). | /** updates the Atlas (indexed vertex array). | |||
* Shall be overriden in subclasses | * Shall be overridden in subclasses | |||
*/ | */ | |||
virtual void updateAtlasValues(); | virtual void updateAtlasValues(); | |||
virtual void draw(void); | virtual void draw(void); | |||
// CC Texture protocol | // CC Texture protocol | |||
/** returns the used texture*/ | /** returns the used texture*/ | |||
virtual CCTexture2D* getTexture(void); | virtual CCTexture2D* getTexture(void); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCBFileLoader.h | CCBFileLoader.h | |||
---|---|---|---|---|
#ifndef _CCB_CCBFILELOADER_H_ | #ifndef _CCB_CCBFILELOADER_H_ | |||
#define _CCB_CCBFILELOADER_H_ | #define _CCB_CCBFILELOADER_H_ | |||
#include "CCNodeLoader.h" | #include "CCNodeLoader.h" | |||
#include "CCBReader.h" | ||||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/* Forward declaration. */ | /* Forward declaration. */ | |||
class CCBReader; | class CCBReader; | |||
class CCBFileLoader : public CCNodeLoader { | class CCBFileLoader : public CCNodeLoader { | |||
public: | public: | |||
virtual ~CCBFileLoader() {}; | virtual ~CCBFileLoader() {}; | |||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader); | CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader); | |||
protected: | protected: | |||
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCNode); | CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCBFile); | |||
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pPare nt, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader ); | virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pPare nt, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader ); | |||
}; | }; | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
CCBMemberVariableAssigner.h | CCBMemberVariableAssigner.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
CC_SAFE_RELEASE(pOldVar); \ | CC_SAFE_RELEASE(pOldVar); \ | |||
MEMBERVARIABLE->retain(); \ | MEMBERVARIABLE->retain(); \ | |||
} \ | } \ | |||
return true; \ | return true; \ | |||
} | } | |||
class CCBMemberVariableAssigner { | class CCBMemberVariableAssigner { | |||
public: | public: | |||
virtual ~CCBMemberVariableAssigner() {}; | virtual ~CCBMemberVariableAssigner() {}; | |||
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, cocos2d: :CCString * pMemberVariableName, CCNode * pNode) = 0; | virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) = 0; | |||
}; | }; | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCBReader.h | CCBReader.h | |||
---|---|---|---|---|
#ifndef _CCB_CCBREADER_H_ | #ifndef _CCB_CCBREADER_H_ | |||
#define _CCB_CCBREADER_H_ | #define _CCB_CCBREADER_H_ | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
#include <string> | ||||
#include <vector> | ||||
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METH OD() { \ | #define CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METH OD() { \ | |||
T * ptr = new T(); \ | T * ptr = new T(); \ | |||
if(ptr != NULL) { \ | if(ptr != NULL) { \ | |||
ptr->autorelease(); \ | ptr->autorelease(); \ | |||
return ptr; \ | return ptr; \ | |||
} \ | } \ | |||
CC_SAFE_DELETE(ptr); \ | CC_SAFE_DELETE(ptr); \ | |||
return NULL; \ | return NULL; \ | |||
} | } | |||
skipping to change at line 27 | skipping to change at line 29 | |||
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(T, METHOD) stati c T * METHOD() { \ | #define CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(T, METHOD) stati c T * METHOD() { \ | |||
T * ptr = new T(); \ | T * ptr = new T(); \ | |||
if(ptr != NULL && ptr->init()) { \ | if(ptr != NULL && ptr->init()) { \ | |||
ptr->autorelease(); \ | ptr->autorelease(); \ | |||
return ptr; \ | return ptr; \ | |||
} \ | } \ | |||
CC_SAFE_DELETE(ptr); \ | CC_SAFE_DELETE(ptr); \ | |||
return NULL; \ | return NULL; \ | |||
} | } | |||
#define kCCBVersion 2 | #define kCCBVersion 3 | |||
#define kCCBPropTypePosition 0 | enum { | |||
#define kCCBPropTypeSize 1 | kCCBPropTypePosition = 0, | |||
#define kCCBPropTypePoint 2 | kCCBPropTypeSize, | |||
#define kCCBPropTypePointLock 3 | kCCBPropTypePoint, | |||
#define kCCBPropTypeScaleLock 4 | kCCBPropTypePointLock, | |||
#define kCCBPropTypeDegrees 5 | kCCBPropTypeScaleLock, | |||
#define kCCBPropTypeInteger 6 | kCCBPropTypeDegrees, | |||
#define kCCBPropTypeFloat 7 | kCCBPropTypeInteger, | |||
#define kCCBPropTypeFloatVar 8 | kCCBPropTypeFloat, | |||
#define kCCBPropTypeCheck 9 | kCCBPropTypeFloatVar, | |||
#define kCCBPropTypeSpriteFrame 10 | kCCBPropTypeCheck, | |||
#define kCCBPropTypeTexture 11 | kCCBPropTypeSpriteFrame, | |||
#define kCCBPropTypeByte 12 | kCCBPropTypeTexture, | |||
#define kCCBPropTypeColor3 13 | kCCBPropTypeByte, | |||
#define kCCBPropTypeColor4FVar 14 | kCCBPropTypeColor3, | |||
#define kCCBPropTypeFlip 15 | kCCBPropTypeColor4FVar, | |||
#define kCCBPropTypeBlendFunc 16 | kCCBPropTypeFlip, | |||
#define kCCBPropTypeFntFile 17 | kCCBPropTypeBlendmode, | |||
#define kCCBPropTypeText 18 | kCCBPropTypeFntFile, | |||
#define kCCBPropTypeFontTTF 19 | kCCBPropTypeText, | |||
#define kCCBPropTypeIntegerLabeled 20 | kCCBPropTypeFontTTF, | |||
#define kCCBPropTypeBlock 21 | kCCBPropTypeIntegerLabeled, | |||
#define kCCBPropTypeAnimation 22 | kCCBPropTypeBlock, | |||
#define kCCBPropTypeCCBFile 23 | kCCBPropTypeAnimation, | |||
#define kCCBPropTypeString 24 | kCCBPropTypeCCBFile, | |||
#define kCCBPropTypeBlockCCControl 25 | kCCBPropTypeString, | |||
#define kCCBPropTypeFloatScale 26 | kCCBPropTypeBlockCCControl, | |||
kCCBPropTypeFloatScale | ||||
#define kCCBFloat0 0 | }; | |||
#define kCCBFloat1 1 | ||||
#define kCCBFloatMinus1 2 | enum { | |||
#define kCCBFloat05 3 | kCCBFloat0 = 0, | |||
#define kCCBFloatInteger 4 | kCCBFloat1, | |||
#define kCCBFloatFull 5 | kCCBFloatMinus1, | |||
kCCBFloat05, | ||||
#define kCCBPlatformAll 0 | kCCBFloatInteger, | |||
#define kCCBPlatformIOS 1 | kCCBFloatFull | |||
#define kCCBPlatformMac 2 | }; | |||
#define kCCBTargetTypeNone 0 | enum { | |||
#define kCCBTargetTypeDocumentRoot 1 | kCCBPlatformAll = 0, | |||
#define kCCBTargetTypeOwner 2 | kCCBPlatformIOS, | |||
kCCBPlatformMac | ||||
#define kCCBPositionTypeRelativeBottomLeft 0 | }; | |||
#define kCCBPositionTypeRelativeTopLeft 1 | ||||
#define kCCBPositionTypeRelativeTopRight 2 | enum { | |||
#define kCCBPositionTypeRelativeBottomRight 3 | kCCBTargetTypeNone = 0, | |||
#define kCCBPositionTypePercent 4 | kCCBTargetTypeDocumentRoot = 1, | |||
kCCBTargetTypeOwner = 2, | ||||
#define kCCBSizeTypeAbsolute 0 | }; | |||
#define kCCBSizeTypePercent 1 | ||||
#define kCCBSizeTypeRelativeContainer 2 | enum | |||
#define kCCBSizeTypeHorizontalPercent 3 | { | |||
#define kCCBSzieTypeVerticalPercent 4 | kCCBKeyframeEasingInstant, | |||
kCCBKeyframeEasingLinear, | ||||
kCCBKeyframeEasingCubicIn, | ||||
kCCBKeyframeEasingCubicOut, | ||||
kCCBKeyframeEasingCubicInOut, | ||||
kCCBKeyframeEasingElasticIn, | ||||
kCCBKeyframeEasingElasticOut, | ||||
kCCBKeyframeEasingElasticInOut, | ||||
kCCBKeyframeEasingBounceIn, | ||||
kCCBKeyframeEasingBounceOut, | ||||
kCCBKeyframeEasingBounceInOut, | ||||
kCCBKeyframeEasingBackIn, | ||||
kCCBKeyframeEasingBackOut, | ||||
kCCBKeyframeEasingBackInOut, | ||||
}; | ||||
enum | ||||
{ | ||||
kCCBPositionTypeRelativeBottomLeft, | ||||
kCCBPositionTypeRelativeTopLeft, | ||||
kCCBPositionTypeRelativeTopRight, | ||||
kCCBPositionTypeRelativeBottomRight, | ||||
kCCBPositionTypePercent, | ||||
kCCBPositionTypeMultiplyResolution, | ||||
}; | ||||
#define kCCBScaleTypeAbsolute 0 | enum | |||
#define kCCBScaleTypeMultiplyResolution 1 | { | |||
kCCBSizeTypeAbsolute, | ||||
kCCBSizeTypePercent, | ||||
kCCBSizeTypeRelativeContainer, | ||||
kCCBSizeTypeHorizontalPercent, | ||||
kCCBSizeTypeVerticalPercent, | ||||
kCCBSizeTypeMultiplyResolution, | ||||
}; | ||||
enum | ||||
{ | ||||
kCCBScaleTypeAbsolute, | ||||
kCCBScaleTypeMultiplyResolution | ||||
}; | ||||
USING_NS_CC; | ||||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
* @addtogroup cocosbuilder | * @addtogroup cocosbuilder | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCBFile : public CCNode | ||||
{ | ||||
private: | ||||
CCNode *mCCBFileNode; | ||||
public: | ||||
CCBFile(); | ||||
static CCBFile* create(); | ||||
CCNode* getCCBFileNode(); | ||||
void setCCBFileNode(CCNode *pNode); // retain | ||||
}; | ||||
/* Forward declaration. */ | /* Forward declaration. */ | |||
class CCNodeLoader; | class CCNodeLoader; | |||
class CCNodeLoaderLibrary; | class CCNodeLoaderLibrary; | |||
class CCNodeLoaderListener; | class CCNodeLoaderListener; | |||
class CCBMemberVariableAssigner; | class CCBMemberVariableAssigner; | |||
class CCBSelectorResolver; | class CCBSelectorResolver; | |||
class CCBAnimationManager; | ||||
class CCData; | ||||
class CCBKeyframe; | ||||
/** | /** | |||
* @brief Parse CCBI file which is generated by CocosBuilder | * @brief Parse CCBI file which is generated by CocosBuilder | |||
*/ | */ | |||
class CCBReader : public CCObject { | class CCBReader : public CCObject | |||
private: | { | |||
CCString * mCCBRootPath; | private: | |||
bool mRootCCBReader; | CCData *mData; | |||
unsigned char *mBytes; | ||||
unsigned char * mBytes; | int mCurrentByte; | |||
int mCurrentByte; | int mCurrentBit; | |||
int mCurrentBit; | ||||
CCObject * mOwner; | std::vector<CCString *> mStringCache; | |||
CCNode * mRootNode; | std::set<std::string> mLoadedSpriteSheets; | |||
CCSize mRootContainerSize; | ||||
float mResolutionScale; | CCObject *mOwner; | |||
CCNodeLoaderLibrary * mCCNodeLoaderLibrary; | CCBAnimationManager *mActionManager; | |||
CCNodeLoaderListener * mCCNodeLoaderListener; | std::set<std::string> *mAnimatedProps; | |||
CCBMemberVariableAssigner * mCCBMemberVariableAssigner; | ||||
CCBSelectorResolver * mCCBSelectorResolver; | CCNodeLoaderLibrary *mCCNodeLoaderLibrary; | |||
CCNodeLoaderListener *mCCNodeLoaderListener; | ||||
std::vector<CCString *> mStringCache; | CCBMemberVariableAssigner *mCCBMemberVariableAssigner; | |||
std::set<std::string> mLoadedSpriteSheets; | CCBSelectorResolver *mCCBSelectorResolver; | |||
public: | public: | |||
CCBReader(CCNodeLoaderLibrary * pCCNodeLoaderLibrary, CCBMemberVari | CCBReader(CCNodeLoaderLibrary *pCCNodeLoaderLibrary, CCBMemberVariableA | |||
ableAssigner * pCCBMemberVariableAssigner = NULL, CCBSelectorResolver * pCC | ssigner *pCCBMemberVariableAssigner = NULL, CCBSelectorResolver *pCCBSelect | |||
BSelectorResolver = NULL, CCNodeLoaderListener * pCCNodeLoaderListener = NU | orResolver = NULL, CCNodeLoaderListener *pCCNodeLoaderListener = NULL); | |||
LL); | CCBReader(CCBReader *pCCBReader); | |||
CCBReader(CCBReader * pCCBReader); | virtual ~CCBReader(); | |||
virtual ~CCBReader(); | CCBReader(); | |||
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const cha | bool initWithData(CCData *pData, CCObject *pOwner); | |||
r * pCCBFileName, CCObject * pOwner = NULL); | ||||
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * | CCNode* readNodeGraphFromFile(const char *pCCBFileName); | |||
pCCBFileName, CCObject * pOwner = NULL); | CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwne | |||
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const cha | r); | |||
r * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize); | CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwne | |||
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * | r, const CCSize &parentSize); | |||
pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize); | CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwne | |||
r, CCBAnimationManager **ppAnimationManager); | ||||
CCBMemberVariableAssigner * getCCBMemberVariableAssigner(); | CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwne | |||
CCBSelectorResolver * getCCBSelectorResolver(); | r, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager); | |||
CCString * getCCBRootPath(); | CCNode* readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CC | |||
CCObject * getOwner(); | Size &parentSize, CCBAnimationManager **ppAnimationManager); | |||
CCNode * getRootNode(); | CCNode* readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CC | |||
CCSize getContainerSize(CCNode * pNode); | Size &parentSize); | |||
float getResolutionScale(); | ||||
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName); | ||||
bool isSpriteSheetLoaded(CCString * pSpriteSheet); | CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCO | |||
void addLoadedSpriteSheet(CCString * pSpriteSheet); | bject *pOwner); | |||
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCO | ||||
/* Utility methods. */ | bject *pOwner, const CCSize &parentSize); | |||
static CCString * lastPathComponent(CCString * pString); | CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCO | |||
static CCString * deletePathExtension(CCString * pString); | bject *pOwner, CCBAnimationManager **ppAnimationManager); | |||
static CCString * toLowerCase(CCString * pCCString); | CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCO | |||
static bool endsWith(CCString * pString, CCString * pEnding); | bject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationM | |||
static CCString * concat(CCString * pStringA, CCString * pStringB); | anager); | |||
/* Parse methods. */ | CCBMemberVariableAssigner* getCCBMemberVariableAssigner(); | |||
int readInt(bool pSigned); | CCBSelectorResolver* getCCBSelectorResolver(); | |||
unsigned char readByte(); | ||||
bool readBool(); | CCBAnimationManager* getAnimationManager(); | |||
float readFloat(); | void setAnimationManager(CCBAnimationManager *pAnimationManager); | |||
CCString * readCachedString(); | ||||
// Used in CCNodeLoader::parseProperties() | ||||
private: | std::set<std::string>* getAnimatedProperties(); | |||
bool readHeader(); | std::set<std::string>& getLoadedSpriteSheet(); | |||
bool readStringCache(); | CCObject* getOwner(); | |||
void readStringCacheEntry(); | ||||
CCNode * readNodeGraph(); | /* Utility methods. */ | |||
CCNode * readNodeGraph(CCNode * pParent); | static CCString* lastPathComponent(CCString * pString); | |||
static CCString* deletePathExtension(CCString * pString); | ||||
bool getBit(); | static CCString* toLowerCase(CCString * pCCString); | |||
void alignBits(); | static bool endsWith(CCString * pString, CCString * pEnding); | |||
CCString * readUTF8(); | static CCString* concat(CCString * pStringA, CCString * pStringB); | |||
/* Parse methods. */ | ||||
int readInt(bool pSigned); | ||||
unsigned char readByte(); | ||||
bool readBool(); | ||||
float readFloat(); | ||||
CCString* readCachedString(); | ||||
static float getResolutionScale(); | ||||
CCNode* readFileWithCleanUp(bool bCleanUp); | ||||
bool hasScriptingOwner; | ||||
private: | ||||
void cleanUpNodeGraph(CCNode *pNode); | ||||
bool readSequences(); | ||||
CCBKeyframe* readKeyframe(int type); | ||||
bool readHeader(); | ||||
bool readStringCache(); | ||||
void readStringCacheEntry(); | ||||
CCNode* readNodeGraph(); | ||||
CCNode* readNodeGraph(CCNode * pParent); | ||||
bool getBit(); | ||||
void alignBits(); | ||||
CCString* readUTF8(); | ||||
}; | }; | |||
// end of effects group | // end of effects group | |||
/// @} | /// @} | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
132 lines changed or deleted | 220 lines changed or added | |||
CCBSelectorResolver.h | CCBSelectorResolver.h | |||
---|---|---|---|---|
#ifndef _CCB_CCBSELECTORRESOLVER_H_ | #ifndef _CCB_CCBSELECTORRESOLVER_H_ | |||
#define _CCB_CCBSELECTORRESOLVER_H_ | #define _CCB_CCBSELECTORRESOLVER_H_ | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
#include "../GUI/CCControlExtension/CCInvocation.h" | ||||
USING_NS_CC; | ||||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \ | #define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \ | |||
return menu_selector(METHOD); \ | return menu_selector(METHOD); \ | |||
} | } | |||
#define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) i f(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \ | #define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) i f(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \ | |||
return cccontrol_selector(METHOD); \ | return cccontrol_selector(METHOD); \ | |||
} | } | |||
class CCBSelectorResolver { | class CCBSelectorResolver { | |||
public: | public: | |||
virtual ~CCBSelectorResolver() {}; | virtual ~CCBSelectorResolver() {}; | |||
virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarg et, CCString * pSelectorName) = 0; | ||||
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCO | virtual extension::SEL_CCControlHandler onResolveCCBCCControlSelector(C | |||
bject * pTarget, CCString * pSelectorName) = 0; | CObject * pTarget, CCString * pSelectorName) = 0; | |||
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlS | }; | |||
elector(CCObject * pTarget, CCString * pSelectorName) = 0; | ||||
class CCBScriptOwnerProtocol { | ||||
public: | ||||
virtual ~CCBScriptOwnerProtocol() {}; | ||||
virtual CCBSelectorResolver * createNew() = 0; | ||||
}; | }; | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 10 lines changed or added | |||
CCCamera.h | CCCamera.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 61 | skipping to change at line 61 | |||
IMPORTANT: Either your use the camera or the rotation/scale/position proper ties. You can't use both. | IMPORTANT: Either your use the camera or the rotation/scale/position proper ties. You can't use both. | |||
World coordinates won't work if you use the camera. | World coordinates won't work if you use the camera. | |||
Limitations: | Limitations: | |||
- Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors) | - Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors) | |||
using the camera. | using the camera. | |||
- It doesn't work on batched nodes like CCSprite objects when they are pare nted to a CCSpriteBatchNode object. | - It doesn't work on batched nodes like CCSprite objects when they are pare nted to a CCSpriteBatchNode object. | |||
- It is recommended to use it ONLY if you are going to create 3D effects. F or 2D effecs, use the action CCFollow or position/scale/rotate. | - It is recommended to use it ONLY if you are going to create 3D effects. F or 2D effects, use the action CCFollow or position/scale/rotate. | |||
*/ | */ | |||
class CC_DLL CCCamera : public CCObject | class CC_DLL CCCamera : public CCObject | |||
{ | { | |||
protected: | protected: | |||
float m_fEyeX; | float m_fEyeX; | |||
float m_fEyeY; | float m_fEyeY; | |||
float m_fEyeZ; | float m_fEyeZ; | |||
float m_fCenterX; | float m_fCenterX; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCCommon.h | CCCommon.h | |||
---|---|---|---|---|
skipping to change at line 56 | skipping to change at line 56 | |||
* lua can not deal with ... | * lua can not deal with ... | |||
*/ | */ | |||
void CC_DLL CCLuaLog(const char * pszFormat); | void CC_DLL CCLuaLog(const char * pszFormat); | |||
/** | /** | |||
@brief Pop out a message box | @brief Pop out a message box | |||
*/ | */ | |||
void CC_DLL CCMessageBox(const char * pszMsg, const char * pszTitle); | void CC_DLL CCMessageBox(const char * pszMsg, const char * pszTitle); | |||
/** | /** | |||
@brief Enum the language type supportted 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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCControl.h | CCControl.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControl.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2011 Yannick Loriot. | * Copyright 2011 Yannick Loriot. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | |||
* 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: | |||
skipping to change at line 33 | skipping to change at line 34 | |||
* THE SOFTWARE. | * THE SOFTWARE. | |||
* | * | |||
* Converted to c++ / cocos2d-x by Angus C | * Converted to c++ / cocos2d-x by Angus C | |||
*/ | */ | |||
#ifndef __CCCONTROL_H__ | #ifndef __CCCONTROL_H__ | |||
#define __CCCONTROL_H__ | #define __CCCONTROL_H__ | |||
#include "CCInvocation.h" | #include "CCInvocation.h" | |||
#include "CCControlUtils.h" | #include "CCControlUtils.h" | |||
#include "layers_scenes_transitions_nodes/CCLayer.h" | #include "cocos2d.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
class CCInvocation; | class CCInvocation; | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
/** Number of kinds of control event. */ | /** Number of kinds of control event. */ | |||
#define CONTROL_EVENT_TOTAL_NUMBER 9 | #define kControlEventTotalNumber 9 | |||
/** Kinds of possible events for the control objects. */ | /** Kinds of possible events for the control objects. */ | |||
enum | enum | |||
{ | { | |||
CCControlEventTouchDown = 1 << 0, // A touch-down event in the control. | CCControlEventTouchDown = 1 << 0, // A touch-down event in the control. | |||
CCControlEventTouchDragInside = 1 << 1, // An event where a fing er is dragged inside the bounds of the control. | CCControlEventTouchDragInside = 1 << 1, // An event where a fing er is dragged inside the bounds of the control. | |||
CCControlEventTouchDragOutside = 1 << 2, // An event where a fing er is dragged just outside the bounds of the control. | CCControlEventTouchDragOutside = 1 << 2, // An event where a fing er is dragged just outside the bounds of the control. | |||
CCControlEventTouchDragEnter = 1 << 3, // An event where a fing er is dragged into the bounds of the control. | CCControlEventTouchDragEnter = 1 << 3, // An event where a fing er is dragged into the bounds of the control. | |||
CCControlEventTouchDragExit = 1 << 4, // An event where a fing er is dragged from within a control to outside its bounds. | CCControlEventTouchDragExit = 1 << 4, // An event where a fing er is dragged from within a control to outside its bounds. | |||
CCControlEventTouchUpInside = 1 << 5, // A touch-up event in t he control where the finger is inside the bounds of the control. | CCControlEventTouchUpInside = 1 << 5, // A touch-up event in t he control where the finger is inside the bounds of the control. | |||
CCControlEventTouchUpOutside = 1 << 6, // A touch-up event in t he control where the finger is outside the bounds of the control. | CCControlEventTouchUpOutside = 1 << 6, // A touch-up event in t he control where the finger is outside the bounds of the control. | |||
CCControlEventTouchCancel = 1 << 7, // A system event cancel ing the current touches for the control. | CCControlEventTouchCancel = 1 << 7, // A system event cancel ing the current touches for the control. | |||
CCControlEventValueChanged = 1 << 8 // A touch dragging or otherwise manipulating a control, causing it to emit a series of different values. | CCControlEventValueChanged = 1 << 8 // A touch dragging or otherwise manipulating a control, causing it to emit a series of different values. | |||
}; | }; | |||
typedef unsigned int CCControlEvent; | typedef unsigned int CCControlEvent; | |||
/** The possible state for a control. */ | /** The possible state for a control. */ | |||
enum | enum | |||
{ | { | |||
CCControlStateNormal = 1 << 0, // The normal, or default state of a control | CCControlStateNormal = 1 << 0, // The normal, or default state of a control | |||
CCControlStateHighlighted = 1 << 1, // Highlighted state of a control. A control enters this state when a touch down, drag inside or drag enter i s performed. You can retrieve and set this value through the highlighted pr operty. | CCControlStateHighlighted = 1 << 1, // Highlighted state of a control. A control enters this state when a touch down, drag inside or drag enter i s performed. You can retrieve and set this value through the highlighted pr operty. | |||
CCControlStateDisabled = 1 << 2, // Disabled state of a control. Th is state indicates that the control is currently disabled. You can retrieve and set this value through the enabled property. | CCControlStateDisabled = 1 << 2, // Disabled state of a control. Th is state indicates that the control is currently disabled. You can retrieve and set this value through the enabled property. | |||
CCControlStateSelected = 1 << 3, // Selected state of a control. T | CCControlStateSelected = 1 << 3 // Selected state of a control. Th | |||
his state indicates that the control is currently selected. You can retriev | is state indicates that the control is currently selected. You can retrieve | |||
e and set this value through the selected property. | and set this value through the selected property. | |||
CCControlStateInitial = 1 << 3 | ||||
}; | }; | |||
typedef unsigned int CCControlState; | typedef unsigned int CCControlState; | |||
/* | /* | |||
* @class | * @class | |||
* CCControl is inspired by the UIControl API class from the UIKit library of | * CCControl is inspired by the UIControl API class from the UIKit library of | |||
* CocoaTouch. It provides a base class for control CCSprites such as CCBut ton | * CocoaTouch. It provides a base class for control CCSprites such as CCBut ton | |||
* or CCSlider that convey user intent to the application. | * or CCSlider that convey user intent to the application. | |||
* | * | |||
* The goal of CCControl is to define an interface and base implementation for | * The goal of CCControl is to define an interface and base implementation for | |||
skipping to change at line 95 | skipping to change at line 95 | |||
* To use the CCControl you have to subclass it. | * To use the CCControl you have to subclass it. | |||
*/ | */ | |||
class CCControl : public CCLayer, public CCRGBAProtocol | class CCControl : public CCLayer, public CCRGBAProtocol | |||
{ | { | |||
//CCRGBAProtocol | //CCRGBAProtocol | |||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | |||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | |||
bool m_bIsOpacityModifyRGB; | bool m_bIsOpacityModifyRGB; | |||
bool isOpacityModifyRGB(); | bool isOpacityModifyRGB(); | |||
void setOpacityModifyRGB(bool isOpacityModifyRGB); | void setOpacityModifyRGB(bool bOpacityModifyRGB); | |||
/** Changes the priority of the button. The lower the number, the highe r the priority. */ | /** Changes the priority of the button. The lower the number, the highe r the priority. */ | |||
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority); | CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority); | |||
/** The current control state constant. */ | /** The current control state constant. */ | |||
CC_SYNTHESIZE_READONLY(CCControlState, m_nState, State); | CC_SYNTHESIZE_READONLY(CCControlState, m_eState, State); | |||
/** True if all of the controls parents are visible */ | ||||
protected: | ||||
bool m_hasVisibleParents; | ||||
public: | public: | |||
/** Tells whether the control is enabled. */ | /** Tells whether the control is enabled. */ | |||
virtual void setEnabled(bool bEnabled); | virtual void setEnabled(bool bEnabled); | |||
virtual bool isEnabled(); | virtual bool isEnabled(); | |||
/** A Boolean value that determines the control selected state. */ | /** A Boolean value that determines the control selected state. */ | |||
virtual void setSelected(bool bSelected); | virtual void setSelected(bool bSelected); | |||
virtual bool isSelected(); | virtual bool isSelected(); | |||
/** A Boolean value that determines whether the control is highlighted. */ | /** A Boolean value that determines whether the control is highlighted. */ | |||
virtual void setHighlighted(bool bHighlighted); | virtual void setHighlighted(bool bHighlighted); | |||
virtual bool isHighlighted(); | virtual bool isHighlighted(); | |||
bool hasVisibleParents(); | ||||
/** | ||||
* Updates the control layout using its current internal state. | ||||
*/ | ||||
virtual void needsLayout(); | ||||
protected: | protected: | |||
bool m_bEnabled; | bool m_bEnabled; | |||
bool m_bSelected; | bool m_bSelected; | |||
bool m_bHighlighted; | bool m_bHighlighted; | |||
// CCControlState, CCArray<CCInvocation*> | /** | |||
CCDictionary* dispatchTable; | * Table of connection between the CCControlEvents and their associated | |||
* target-actions pairs. For each CCButtonEvents a list of NSInvocation | ||||
* (which contains the target-action pair) is linked. | ||||
*/ | ||||
CCDictionary* m_pDispatchTable; | ||||
public: | public: | |||
CCControl(); | CCControl(); | |||
virtual bool init(void); | virtual bool init(void); | |||
virtual ~CCControl(); | virtual ~CCControl(); | |||
virtual void onEnter(); | virtual void onEnter(); | |||
virtual void onExit(); | virtual void onExit(); | |||
virtual void registerWithTouchDispatcher(); | virtual void registerWithTouchDispatcher(); | |||
skipping to change at line 145 | skipping to change at line 158 | |||
*/ | */ | |||
virtual void sendActionsForControlEvents(CCControlEvent controlEvents); | virtual void sendActionsForControlEvents(CCControlEvent controlEvents); | |||
/** | /** | |||
* Adds a target and action for a particular event (or events) to an int ernal | * Adds a target and action for a particular event (or events) to an int ernal | |||
* dispatch table. | * dispatch table. | |||
* The action message may optionnaly include the sender and the event as | * The action message may optionnaly include the sender and the event as | |||
* parameters, in that order. | * parameters, in that order. | |||
* When you call this method, target is not retained. | * When you call this method, target is not retained. | |||
* | * | |||
* @param target The target object | * @param target The target object that is, the object to which the acti on | |||
* message is sent. It cannot be nil. The target is not retained. | * message is sent. It cannot be nil. The target is not retained. | |||
* @param action A selector identifying an action message. It cannot be NULL. | * @param action A selector identifying an action message. It cannot be NULL. | |||
* @param controlEvents A bitmask specifying the control events for whic h the | * @param controlEvents A bitmask specifying the control events for whic h the | |||
* action message is sent. See "CCControlEvent" for bitmask constants. | * action message is sent. See "CCControlEvent" for bitmask constants. | |||
*/ | */ | |||
virtual void addTargetWithActionForControlEvents(CCObject* target, SEL_ CCControlHandler action, CCControlEvent controlEvents); | virtual void addTargetWithActionForControlEvents(CCObject* target, SEL_ CCControlHandler action, CCControlEvent controlEvents); | |||
/** | /** | |||
* Removes a target and action for a particular event (or events) from a n | * Removes a target and action for a particular event (or events) from a n | |||
* internal dispatch table. | * internal dispatch table. | |||
skipping to change at line 180 | skipping to change at line 193 | |||
* @param touch A CCTouch object that represents a touch. | * @param touch A CCTouch object that represents a touch. | |||
*/ | */ | |||
virtual CCPoint getTouchLocation(CCTouch* touch); | virtual CCPoint getTouchLocation(CCTouch* touch); | |||
/** | /** | |||
* Returns a boolean value that indicates whether a touch is inside the bounds | * Returns a boolean value that indicates whether a touch is inside the bounds | |||
* of the receiver. The given touch must be relative to the world. | * of the receiver. The given touch must be relative to the world. | |||
* | * | |||
* @param touch A CCTouch object that represents a touch. | * @param touch A CCTouch object that represents a touch. | |||
* | * | |||
* @return YES whether a touch is inside the receiver | * @return YES whether a touch is inside the receiver | |||
*/ | */ | |||
virtual bool isTouchInside(CCTouch * touch); | virtual bool isTouchInside(CCTouch * touch); | |||
protected: | protected: | |||
/** | /** | |||
* Returns an CCInvocation object able to construct messages using a given | * Returns an CCInvocation object able to construct messages using a gi | |||
* target-action pair. (The invocation may optionnaly include the sender an | ven | |||
d | * target-action pair. (The invocation may optionnaly include the sende | |||
* the event as parameters, in that order) | r and | |||
* | * the event as parameters, in that order) | |||
* @param target The target object. | * | |||
* @param action A selector identifying an action message. | * @param target The target object. | |||
* @param controlEvent A control events for which the action message is sen | * @param action A selector identifying an action message. | |||
t. | * @param controlEvent A control events for which the action message is | |||
* See "CCControlEvent" for constants. | sent. | |||
* | * See "CCControlEvent" for constants. | |||
* @return an CCInvocation object able to construct messages using a given | * | |||
* target-action pair. | * @return an CCInvocation object able to construct messages using a gi | |||
*/ | ven | |||
* target-action pair. | ||||
*/ | ||||
CCInvocation* invocationWithTargetAndActionForControlEvent(CCObject* ta rget, SEL_CCControlHandler action, CCControlEvent controlEvent); | CCInvocation* invocationWithTargetAndActionForControlEvent(CCObject* ta rget, SEL_CCControlHandler action, CCControlEvent controlEvent); | |||
/** | /** | |||
* Returns the CCInvocation list for the given control event. If the lis t does | * Returns the CCInvocation list for the given control event. If the lis t does | |||
* not exist, it'll create an empty array before returning it. | * not exist, it'll create an empty array before returning it. | |||
* | * | |||
* @param controlEvent A control events for which the action message is sent. | * @param controlEvent A control events for which the action message is sent. | |||
* See "CCControlEvent" for constants. | * See "CCControlEvent" for constants. | |||
* | * | |||
* @return the CCInvocation list for the given control event. | * @return the CCInvocation list for the given control event. | |||
*/ | */ | |||
//<CCInvocation*> | //<CCInvocation*> | |||
CCArray* dispatchListforControlEvent(CCControlEvent controlEvent); | CCArray* dispatchListforControlEvent(CCControlEvent controlEvent); | |||
public: | /** | |||
* Adds a target and action for a particular event to an internal dispa | ||||
tch | ||||
* table. | ||||
* The action message may optionnaly include the sender and the event a | ||||
s | ||||
* parameters, in that order. | ||||
* When you call this method, target is not retained. | ||||
* | ||||
* @param target The target object | ||||
* message is sent. It cannot be nil. The target is not retained. | ||||
* @param action A selector identifying an action message. It cannot be | ||||
NULL. | ||||
* @param controlEvent A control event for which the action message is | ||||
sent. | ||||
* See "CCControlEvent" for constants. | ||||
*/ | ||||
void addTargetWithActionForControlEvent(CCObject* target, SEL_CCControl Handler action, CCControlEvent controlEvent); | void addTargetWithActionForControlEvent(CCObject* target, SEL_CCControl Handler action, CCControlEvent controlEvent); | |||
/** | ||||
* Removes a target and action for a particular event from an internal | ||||
dispatch | ||||
* table. | ||||
* | ||||
* @param target The target object | ||||
* message is sent. Pass nil to remove all targets paired with action a | ||||
nd the | ||||
* specified control events. | ||||
* @param action A selector identifying an action message. Pass NULL to | ||||
remove | ||||
* all action messages paired with target. | ||||
* @param controlEvent A control event for which the action message is | ||||
sent. | ||||
* See "CCControlEvent" for constants. | ||||
*/ | ||||
void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCCont rolHandler action, CCControlEvent controlEvent); | void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCCont rolHandler action, CCControlEvent controlEvent); | |||
CREATE_FUNC(CCControl); | CREATE_FUNC(CCControl); | |||
}; | }; | |||
// end of GUI group | // end of GUI group | |||
/// @} | /// @} | |||
/// @} | /// @} | |||
End of changes. 14 change blocks. | ||||
29 lines changed or deleted | 77 lines changed or added | |||
CCControlButton.h | CCControlButton.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlButton.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2011 Yannick Loriot. All rights reserved. | * Copyright 2011 Yannick Loriot. All rights reserved. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | |||
* 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: | |||
skipping to change at line 37 | skipping to change at line 38 | |||
#ifndef __CCCONTROL_BUTTON_H__ | #ifndef __CCCONTROL_BUTTON_H__ | |||
#define __CCCONTROL_BUTTON_H__ | #define __CCCONTROL_BUTTON_H__ | |||
#include "CCControl.h" | #include "CCControl.h" | |||
#include "CCInvocation.h" | #include "CCInvocation.h" | |||
#include "CCScale9Sprite.h" | #include "CCScale9Sprite.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/* Define the button margin for Left/Right edge */ | ||||
#define CCControlButtonMarginLR 8 // px | ||||
/* Define the button margin for Top/Bottom edge */ | ||||
#define CCControlButtonMarginTB 2 // px | ||||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @class CCControlButton Button control for Cocos2D. */ | /** @class CCControlButton Button control for Cocos2D. */ | |||
class CCControlButton : public CCControl | class CCControlButton : public CCControl | |||
{ | { | |||
public: | public: | |||
CCControlButton(); | ||||
virtual ~CCControlButton(); | virtual ~CCControlButton(); | |||
virtual void needsLayout(void); | virtual void needsLayout(void); | |||
virtual void setEnabled(bool enabled); | virtual void setEnabled(bool enabled); | |||
virtual void setSelected(bool enabled); | virtual void setSelected(bool enabled); | |||
virtual void setHighlighted(bool enabled); | virtual void setHighlighted(bool enabled); | |||
protected: | protected: | |||
// CCRGBAProtocol | // CCRGBAProtocol | |||
//bool m_bIsOpacityModifyRGB; | //bool m_bIsOpacityModifyRGB; | |||
/** The current title that is displayed on the button. */ | ||||
CC_SYNTHESIZE_READONLY(CCString*, m_currentTitle, CurrentTitle); | ||||
/** The current color used to display the title. */ | ||||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_currentTitleColor, Curr | ||||
entTitleColor); | ||||
/** Adjust the background image. YES by default. If the property is set to NO, the | /** Adjust the background image. YES by default. If the property is set to NO, the | |||
background will use the prefered size of the background image. */ | background will use the prefered size of the background image. */ | |||
CC_PROPERTY(bool, m_adjustBackgroundImage, AdjustBackgroundImage); | bool doesAdjustBackgroundImage(); | |||
void setAdjustBackgroundImage(bool adjustBackgroundImage); | ||||
bool m_doesAdjustBackgroundImage; | ||||
/** Adjust the button zooming on touchdown. Default value is YES. */ | /** The current title label. */ | |||
CC_PROPERTY(bool, m_zoomOnTouchDown, ZoomOnTouchDown); | CC_SYNTHESIZE_RETAIN(CCNode*, m_titleLabel, TitleLabel); | |||
/** The current background sprite. */ | ||||
CC_SYNTHESIZE_RETAIN(CCScale9Sprite*, m_backgroundSprite, BackgroundSpr | ||||
ite); | ||||
/** The prefered size of the button, if label is larger it will be expa nded. */ | /** The prefered size of the button, if label is larger it will be expa nded. */ | |||
CC_PROPERTY(CCSize, m_preferredSize, PreferredSize); | CC_PROPERTY(CCSize, m_preferredSize, PreferredSize); | |||
CC_PROPERTY(CCPoint, m_labelAnchorPoint, LabelAnchorPoint); | /** Adjust the button zooming on touchdown. Default value is YES. */ | |||
CC_PROPERTY(bool, m_zoomOnTouchDown, ZoomOnTouchDown); | ||||
/** The current title that is displayed on the button. */ | CC_PROPERTY(CCPoint, m_labelAnchorPoint, LabelAnchorPoint); | |||
CC_SYNTHESIZE_READONLY(CCString*, m_currentTitle, CurrentTitle); | ||||
/** The current color used to display the title. */ | ||||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_currentTitleColor, Curr | ||||
entTitleColor); | ||||
/** The current title label. */ | ||||
//CC_PROPERTY(CCNode*, m_titleLabel, TitleLabel); | ||||
CCNode* m_titleLabel; | ||||
/** The current background sprite. */ | ||||
//CC_PROPERTY(CCScale9Sprite*, m_backgroundSprite, BackgroundSprite); | ||||
CCScale9Sprite* m_backgroundSprite; | ||||
/* Override setter to affect a background sprite too */ | /* Override setter to affect a background sprite too */ | |||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | virtual GLubyte getOpacity(void); | |||
virtual void setOpacity(GLubyte var); | ||||
/** Flag to know if the button is currently pushed. */ | /** Flag to know if the button is currently pushed. */ | |||
CC_SYNTHESIZE_READONLY(bool, pushed, IsPushed); | protected: | |||
bool m_isPushed; | ||||
bool m_bParentInited; | ||||
public: | ||||
bool isPushed() { return m_isPushed; } | ||||
// <CCControlState, CCString*> | // <CCControlState, CCString*> | |||
CCDictionary* m_titleDispatchTable; | CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleDispatchTable, TitleDispatch Table); | |||
// <CCControlState, CCColor3bObject*> | // <CCControlState, CCColor3bObject*> | |||
CCDictionary* m_titleColorDispatchTable; | CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleColorDispatchTable, TitleCol orDispatchTable); | |||
// <CCControlState, CCNode*> | // <CCControlState, CCNode*> | |||
CCDictionary* m_titleLabelDispatchTable; | CC_SYNTHESIZE_RETAIN(CCDictionary*, m_titleLabelDispatchTable, TitleLab elDispatchTable); | |||
// <CCControlState, CCScale9Sprite*> | // <CCControlState, CCScale9Sprite*> | |||
CCDictionary* m_backgroundSpriteDispatchTable; | CC_SYNTHESIZE_RETAIN(CCDictionary*, m_backgroundSpriteDispatchTable, Ba ckgroundSpriteDispatchTable); | |||
/* Define the button margin for Top/Bottom edge */ | /* Define the button margin for Top/Bottom edge */ | |||
CC_SYNTHESIZE_READONLY(int, m_marginV, VerticalMargin); | CC_SYNTHESIZE_READONLY(int, m_marginV, VerticalMargin); | |||
/* Define the button margin for Left/Right edge */ | /* Define the button margin for Left/Right edge */ | |||
CC_SYNTHESIZE_READONLY(int, m_marginH, HorizontalOrigin); | CC_SYNTHESIZE_READONLY(int, m_marginH, HorizontalOrigin); | |||
//set the margins at once (so we only have to do one call of needsLayou t) | //set the margins at once (so we only have to do one call of needsLayou t) | |||
virtual void setMargins(int marginH, int marginV); | virtual void setMargins(int marginH, int marginV); | |||
public: | public: | |||
virtual bool init(); | virtual bool init(); | |||
End of changes. 14 change blocks. | ||||
22 lines changed or deleted | 39 lines changed or added | |||
CCControlColourPicker.h | CCControlColourPicker.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlColourPicker.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2012 Stewart Hamilton-Arrandale. | * Copyright 2012 Stewart Hamilton-Arrandale. | |||
* http://creativewax.co.uk | * http://creativewax.co.uk | |||
* | * | |||
* Modified by Yannick Loriot. | * Modified by Yannick Loriot. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
skipping to change at line 50 | skipping to change at line 51 | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCControlColourPicker: public CCControl | class CCControlColourPicker: public CCControl | |||
{ | { | |||
CC_SYNTHESIZE_READONLY_PASS_BY_REF(ccColor3B, m_colorValue, ColorValue) | public: | |||
; | CCControlColourPicker(); | |||
virtual void setColorValue(const ccColor3B& colorValue); | virtual ~CCControlColourPicker(); | |||
virtual void setColor(const ccColor3B& colorValue); | ||||
virtual void setEnabled(bool bEnabled); | ||||
protected: | protected: | |||
HSV m_hsv; | HSV m_hsv; | |||
CCControlSaturationBrightnessPicker* m_colourPicker; | CC_SYNTHESIZE_RETAIN(CCControlSaturationBrightnessPicker*, m_colourPick | |||
CCControlHuePicker* m_huePicker; | er, colourPicker) | |||
CC_SYNTHESIZE_RETAIN(CCControlHuePicker*, m_huePicker, HuePicker) | ||||
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background); | CC_SYNTHESIZE_RETAIN(CCSprite*, m_background, Background) | |||
public: | public: | |||
//@deprecated: This interface will be deprecated sooner or later. | //@deprecated: This interface will be deprecated sooner or later. | |||
CC_DEPRECATED_ATTRIBUTE static CCControlColourPicker* colourPicker(); | CC_DEPRECATED_ATTRIBUTE static CCControlColourPicker* colourPicker(); | |||
static CCControlColourPicker* create(); | static CCControlColourPicker* create(); | |||
virtual bool init(); | virtual bool init(); | |||
//virtual ~CCControlColourPicker(); | //virtual ~CCControlColourPicker(); | |||
void hueSliderValueChanged(CCObject * sender, CCControlEvent controlEve nt); | void hueSliderValueChanged(CCObject * sender, CCControlEvent controlEve nt); | |||
End of changes. 3 change blocks. | ||||
9 lines changed or deleted | 11 lines changed or added | |||
CCControlExtensions.h | CCControlExtensions.h | |||
---|---|---|---|---|
/************************************************************************** | ||||
** | ||||
Copyright (c) 2012 cocos2d-x.org | ||||
http://www.cocos2d-x.org | ||||
Permission is hereby granted, free of charge, to any person obtaining a cop | ||||
y | ||||
of this software and associated documentation files (the "Software"), to de | ||||
al | ||||
in the Software without restriction, including without limitation the right | ||||
s | ||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
copies of the Software, and to permit persons to whom the Software is | ||||
furnished to do so, subject to the following conditions: | ||||
The above copyright notice and this permission notice shall be included in | ||||
all copies or substantial portions of the Software. | ||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
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, | ||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
THE SOFTWARE. | ||||
*************************************************************************** | ||||
*/ | ||||
#ifndef __CCCONTROL_EXTENSIONS_H__ | #ifndef __CCCONTROL_EXTENSIONS_H__ | |||
#define __CCCONTROL_EXTENSIONS_H__ | #define __CCCONTROL_EXTENSIONS_H__ | |||
#include "CCScale9Sprite.h" | ||||
#include "CCControl.h" | #include "CCControl.h" | |||
#include "CCControlButton.h" | #include "CCControlButton.h" | |||
#include "CCControlColourPicker.h" | #include "CCControlColourPicker.h" | |||
#include "CCControlHuePicker.h" | #include "CCControlPotentiometer.h" | |||
#include "CCControlSaturationBrightnessPicker.h" | ||||
#include "CCControlSlider.h" | #include "CCControlSlider.h" | |||
#include "CCControlStepper.h" | ||||
#include "CCControlSwitch.h" | #include "CCControlSwitch.h" | |||
#include "CCMenuPassive.h" | ||||
#include "CCSpacer.h" | ||||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 33 lines changed or added | |||
CCControlHuePicker.h | CCControlHuePicker.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlHuePicker.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2012 Stewart Hamilton-Arrandale. | * Copyright 2012 Stewart Hamilton-Arrandale. | |||
* http://creativewax.co.uk | * http://creativewax.co.uk | |||
* | * | |||
* Modified by Yannick Loriot. | * Modified by Yannick Loriot. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
skipping to change at line 55 | skipping to change at line 56 | |||
class CCControlHuePicker : public CCControl | class CCControlHuePicker : public CCControl | |||
{ | { | |||
//maunally put in the setters | //maunally put in the setters | |||
CC_SYNTHESIZE_READONLY(float, m_hue, Hue); | CC_SYNTHESIZE_READONLY(float, m_hue, Hue); | |||
virtual void setHue(float val); | virtual void setHue(float val); | |||
CC_SYNTHESIZE_READONLY(float, m_huePercentage, HuePercentage); | CC_SYNTHESIZE_READONLY(float, m_huePercentage, HuePercentage); | |||
virtual void setHuePercentage(float val); | virtual void setHuePercentage(float val); | |||
//not sure if these need to be there actually. I suppose someone might want to access the sprite? | //not sure if these need to be there actually. I suppose someone might want to access the sprite? | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background); | CC_SYNTHESIZE_RETAIN(CCSprite*, m_background, Background); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_slider, Slider); | CC_SYNTHESIZE_RETAIN(CCSprite*, m_slider, Slider); | |||
CC_SYNTHESIZE_READONLY(CCPoint, m_startPos, StartPos); | CC_SYNTHESIZE_READONLY(CCPoint, m_startPos, StartPos); | |||
public: | public: | |||
CCControlHuePicker(); | ||||
virtual ~CCControlHuePicker(); | virtual ~CCControlHuePicker(); | |||
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos); | virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos); | |||
//@deprecated: This interface will be deprecated sooner or later. | //@deprecated: This interface will be deprecated sooner or later. | |||
CC_DEPRECATED_ATTRIBUTE static CCControlHuePicker* pickerWithTargetAndP os(CCNode* target, CCPoint pos); | CC_DEPRECATED_ATTRIBUTE static CCControlHuePicker* pickerWithTargetAndP os(CCNode* target, CCPoint pos); | |||
static CCControlHuePicker* create(CCNode* target, CCPoint pos); | static CCControlHuePicker* create(CCNode* target, CCPoint pos); | |||
virtual void setEnabled(bool enabled); | ||||
protected: | protected: | |||
void updateSliderPosition(CCPoint location); | void updateSliderPosition(CCPoint location); | |||
bool checkSliderPosition(CCPoint location); | bool checkSliderPosition(CCPoint location); | |||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | |||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent); | virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent); | |||
}; | }; | |||
// end of GUI group | // end of GUI group | |||
/// @} | /// @} | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 6 lines changed or added | |||
CCControlSaturationBrightnessPicker.h | CCControlSaturationBrightnessPicker.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlSaturationBrightnessPicker.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2012 Stewart Hamilton-Arrandale. | * Copyright 2012 Stewart Hamilton-Arrandale. | |||
* http://creativewax.co.uk | * http://creativewax.co.uk | |||
* | * | |||
* Modified by Yannick Loriot. | * Modified by Yannick Loriot. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
skipping to change at line 48 | skipping to change at line 49 | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCControlSaturationBrightnessPicker : public CCControl | class CCControlSaturationBrightnessPicker : public CCControl | |||
{ | { | |||
/** Contains the receiver | ||||
CC_SYNTHESIZE_READONLY(float, m_saturation, Saturation); | CC_SYNTHESIZE_READONLY(float, m_saturation, Saturation); | |||
/** Contains the receiver | ||||
CC_SYNTHESIZE_READONLY(float, m_brightness, Brightness); | CC_SYNTHESIZE_READONLY(float, m_brightness, Brightness); | |||
//not sure if these need to be there actually. I suppose someone might want to access the sprite? | //not sure if these need to be there actually. I suppose someone might want to access the sprite? | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background); | CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_overlay, Overlay); | CC_SYNTHESIZE_READONLY(CCSprite*, m_overlay, Overlay); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_shadow, Shadow); | CC_SYNTHESIZE_READONLY(CCSprite*, m_shadow, Shadow); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_slider, Slider); | CC_SYNTHESIZE_READONLY(CCSprite*, m_slider, Slider); | |||
CC_SYNTHESIZE_READONLY(CCPoint, m_startPos, StartPos); | CC_SYNTHESIZE_READONLY(CCPoint, m_startPos, StartPos); | |||
protected: | protected: | |||
int boxPos; | int boxPos; | |||
int boxSize; | int boxSize; | |||
public: | public: | |||
CCControlSaturationBrightnessPicker(); | ||||
virtual ~CCControlSaturationBrightnessPicker(); | virtual ~CCControlSaturationBrightnessPicker(); | |||
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos); | virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos); | |||
//@deprecated: This interface will be deprecated sooner or later. | //@deprecated: This interface will be deprecated sooner or later. | |||
CC_DEPRECATED_ATTRIBUTE static CCControlSaturationBrightnessPicker* pic kerWithTargetAndPos(CCNode* target, CCPoint pos); | CC_DEPRECATED_ATTRIBUTE static CCControlSaturationBrightnessPicker* pic kerWithTargetAndPos(CCNode* target, CCPoint pos); | |||
static CCControlSaturationBrightnessPicker* create(CCNode* target, CCPo int pos); | static CCControlSaturationBrightnessPicker* create(CCNode* target, CCPo int pos); | |||
virtual void setEnabled(bool enabled); | ||||
virtual void updateWithHSV(HSV hsv); | virtual void updateWithHSV(HSV hsv); | |||
virtual void updateDraggerWithHSV(HSV hsv); | virtual void updateDraggerWithHSV(HSV hsv); | |||
protected: | protected: | |||
void updateSliderPosition(CCPoint location); | void updateSliderPosition(CCPoint location); | |||
bool checkSliderPosition(CCPoint location); | bool checkSliderPosition(CCPoint location); | |||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | |||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent); | virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent); | |||
}; | }; | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
CCControlSlider.h | CCControlSlider.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlSlider | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2011 Yannick Loriot. All rights reserved. | * Copyright 2011 Yannick Loriot. All rights reserved. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | |||
* 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: | |||
skipping to change at line 33 | skipping to change at line 34 | |||
* THE SOFTWARE. | * THE SOFTWARE. | |||
* | * | |||
* Converted to c++ / cocos2d-x by Angus C | * Converted to c++ / cocos2d-x by Angus C | |||
*/ | */ | |||
#ifndef __CCCONTROL_SLIDER_H__ | #ifndef __CCCONTROL_SLIDER_H__ | |||
#define __CCCONTROL_SLIDER_H__ | #define __CCCONTROL_SLIDER_H__ | |||
#include "CCControl.h" | #include "CCControl.h" | |||
#include "CCInvocation.h" | #include "CCInvocation.h" | |||
#include "sprite_nodes/CCSprite.h" | ||||
#include "menu_nodes/CCMenuItem.h" | ||||
#define SLIDER_MARGIN_H 24 | ||||
#define SLIDER_MARGIN_V 8 | ||||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCControlSlider: public CCControl | class CCControlSlider: public CCControl | |||
{ | { | |||
//maunally put in the setters | //maunally put in the setters | |||
/** Contains the receiver | ||||
CC_SYNTHESIZE_READONLY(float, m_value, Value); | CC_SYNTHESIZE_READONLY(float, m_value, Value); | |||
virtual void setValue(float val); | virtual void setValue(float val); | |||
/** Contains the minimum value of the receiver. | ||||
* The default value of this property is 0.0. */ | ||||
CC_SYNTHESIZE_READONLY(float, m_minimumValue, MinimumValue); | CC_SYNTHESIZE_READONLY(float, m_minimumValue, MinimumValue); | |||
virtual void setMinimumValue(float val); | virtual void setMinimumValue(float val); | |||
/** Contains the maximum value of the receiver. | ||||
* The default value of this property is 1.0. */ | ||||
CC_SYNTHESIZE_READONLY(float, m_maximumValue, MaximumValue); | CC_SYNTHESIZE_READONLY(float, m_maximumValue, MaximumValue); | |||
virtual void setMaximumValue(float val); | virtual void setMaximumValue(float val); | |||
virtual void setEnabled(bool enabled); | ||||
virtual bool isTouchInside(CCTouch * touch); | ||||
CCPoint locationFromTouch(CCTouch* touch); | ||||
//interval to snap to | CC_SYNTHESIZE(float, m_minimumAllowedValue, MinimumAllowedValue); | |||
CC_SYNTHESIZE(float, m_snappingInterval, SnappingInterval); | CC_SYNTHESIZE(float, m_maximumAllowedValue, MaximumAllowedValue); | |||
// maybe this should be read-only | // maybe this should be read-only | |||
CC_SYNTHESIZE_READONLY(CCMenuItem*, m_thumbItem, ThumbItem); | CC_SYNTHESIZE_RETAIN(CCSprite*, m_thumbSprite, ThumbSprite); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_progressSprite, ProgressSprite); | CC_SYNTHESIZE_RETAIN(CCSprite*, m_progressSprite, ProgressSprite); | |||
CC_SYNTHESIZE_READONLY(CCSprite*, m_backgroundSprite, BackgroundSprite) | CC_SYNTHESIZE_RETAIN(CCSprite*, m_backgroundSprite, BackgroundSprite); | |||
; | ||||
public: | public: | |||
CCControlSlider(); | ||||
virtual ~CCControlSlider(); | virtual ~CCControlSlider(); | |||
/** | /** | |||
* Initializes a slider with a background sprite, a progress bar and a t humb | * Initializes a slider with a background sprite, a progress bar and a t humb | |||
* item. | * item. | |||
* | * | |||
* @param backgroundSprite CCSprite, that is used as a background. | * @param backgroundSprite CCSprite, that is used as a background. | |||
* @param progressSprite CCSprite, that is used as a progress bar. | * @param progressSprite CCSprite, that is used as a progress bar. | |||
* @param thumbItem CCMenuItem, that is used as a thumb. | * @param thumbItem CCSprite, that is used as a thumb. | |||
*/ | */ | |||
virtual bool initWithSprites(CCSprite * backgroundSprite, CCSprite* pro gessSprite, CCMenuItem* thumbItem); | virtual bool initWithSprites(CCSprite * backgroundSprite, CCSprite* pro gressSprite, CCSprite* thumbSprite); | |||
/** | /** | |||
* Creates slider with a background filename, a progress filename and a | * Creates slider with a background filename, a progress filename and a | |||
* thumb image filename. | * thumb image filename. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithFiles(const c har* bgFile, const char* progressFile, const char* thumbFile); | CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithFiles(const c har* bgFile, const char* progressFile, const char* thumbFile); | |||
/** | /** | |||
* Creates a slider with a given background sprite and a progress bar an d a | * Creates a slider with a given background sprite and a progress bar an d a | |||
* thumb item. | * thumb item. | |||
*@deprecated: This interface will be deprecated sooner or later. | *@deprecated: This interface will be deprecated sooner or later. | |||
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem: | * @see initWithBackgroundSprite:progressSprite:thumbMenuItem: | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithSprites(CCSpr ite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem); | CC_DEPRECATED_ATTRIBUTE static CCControlSlider* sliderWithSprites(CCSpr ite * backgroundSprite, CCSprite* pogressSprite, CCSprite* thumbSprite); | |||
/** | /** | |||
* Creates slider with a background filename, a progress filename and a | * Creates slider with a background filename, a progress filename and a | |||
* thumb image filename. | * thumb image filename. | |||
*/ | */ | |||
static CCControlSlider* create(const char* bgFile, const char* progress File, const char* thumbFile); | static CCControlSlider* create(const char* bgFile, const char* progress File, const char* thumbFile); | |||
/** | /** | |||
* Creates a slider with a given background sprite and a progress bar an d a | * Creates a slider with a given background sprite and a progress bar an d a | |||
* thumb item. | * thumb item. | |||
* | * | |||
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem: | * @see initWithBackgroundSprite:progressSprite:thumbMenuItem: | |||
*/ | */ | |||
static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* p ogressSprite, CCMenuItem* thumbItem); | static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* p ogressSprite, CCSprite* thumbSprite); | |||
virtual void needsLayout(); | ||||
protected: | protected: | |||
void sliderBegan(CCPoint location); | void sliderBegan(CCPoint location); | |||
void sliderMoved(CCPoint location); | void sliderMoved(CCPoint location); | |||
void sliderEnded(CCPoint location); | void sliderEnded(CCPoint location); | |||
virtual CCPoint getTouchLocationInControl(CCTouch* touch); | ||||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | virtual bool ccTouchBegan(CCTouch* touch, CCEvent* pEvent); | |||
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); | |||
/** Returns the value for the given location. */ | /** Returns the value for the given location. */ | |||
float valueForLocation(CCPoint location); | float valueForLocation(CCPoint location); | |||
}; | }; | |||
// end of GUI group | // end of GUI group | |||
/// @} | /// @} | |||
End of changes. 15 change blocks. | ||||
19 lines changed or deleted | 21 lines changed or added | |||
CCControlSwitch.h | CCControlSwitch.h | |||
---|---|---|---|---|
/* | /* | |||
* CCControlSwitch.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | * | |||
* Copyright 2012 Yannick Loriot. All rights reserved. | * Copyright 2012 Yannick Loriot. All rights reserved. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l | |||
* 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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
CCControlUtils.h | CCControlUtils.h | |||
---|---|---|---|---|
/* | /* | |||
* ColourUtils.h | * Copyright (c) 2012 cocos2d-x.org | |||
* http://www.cocos2d-x.org | ||||
* | ||||
* | * | |||
* Copyright 2012 Stewart Hamilton-Arrandale. | * Copyright 2012 Stewart Hamilton-Arrandale. | |||
* http://creativewax.co.uk | * http://creativewax.co.uk | |||
* | * | |||
* Modified by Yannick Loriot. | * Modified by Yannick Loriot. | |||
* http://yannickloriot.com | * http://yannickloriot.com | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining a copy | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* of this software and associated documentation files (the "Software"), to deal | * of this software and associated documentation files (the "Software"), to deal | |||
* in the Software without restriction, including without limitation the ri ghts | * in the Software without restriction, including without limitation the ri ghts | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
CCDictionary.h | CCDictionary.h | |||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
int len = strlen(pszKey); | int len = strlen(pszKey); | |||
if (len > MAX_KEY_LEN ) | if (len > MAX_KEY_LEN ) | |||
{ | { | |||
char* pEnd = (char*)&pszKey[len-1]; | char* pEnd = (char*)&pszKey[len-1]; | |||
pStart = pEnd - (MAX_KEY_LEN-1); | pStart = pEnd - (MAX_KEY_LEN-1); | |||
} | } | |||
strcpy(m_szKey, pStart); | strcpy(m_szKey, pStart); | |||
} | } | |||
CCDictElement(int iKey, CCObject* pObject) | CCDictElement(intptr_t iKey, CCObject* pObject) | |||
{ | { | |||
init(); | init(); | |||
m_iKey = iKey; | m_iKey = iKey; | |||
m_pObject = pObject; | m_pObject = pObject; | |||
} | } | |||
inline const char* getStrKey() const | inline const char* getStrKey() const | |||
{ | { | |||
CCAssert(m_szKey[0] != '\0', "Should not call this function for int eger dictionary"); | CCAssert(m_szKey[0] != '\0', "Should not call this function for int eger dictionary"); | |||
return m_szKey; | return m_szKey; | |||
} | } | |||
inline int getIntKey() const | inline intptr_t getIntKey() const | |||
{ | { | |||
CCAssert(m_szKey[0] == '\0', "Should not call this function for str ing dictionary"); | CCAssert(m_szKey[0] == '\0', "Should not call this function for str ing dictionary"); | |||
return m_iKey; | return m_iKey; | |||
} | } | |||
inline CCObject* getObject() const | inline CCObject* getObject() const | |||
{ | { | |||
return m_pObject; | return m_pObject; | |||
} | } | |||
skipping to change at line 98 | skipping to change at line 98 | |||
inline void init() | inline void init() | |||
{ | { | |||
m_iKey = 0; | m_iKey = 0; | |||
m_pObject = NULL; | m_pObject = NULL; | |||
memset(m_szKey, 0, sizeof(m_szKey)); | memset(m_szKey, 0, sizeof(m_szKey)); | |||
memset(&hh, 0, sizeof(hh)); | memset(&hh, 0, sizeof(hh)); | |||
} | } | |||
private: | private: | |||
char m_szKey[MAX_KEY_LEN+1]; /** hash key of string type*/ | char m_szKey[MAX_KEY_LEN+1]; /** hash key of string type*/ | |||
int m_iKey; /** hash key of integer type */ | intptr_t m_iKey; /** hash key of integer type */ | |||
CCObject* m_pObject;/** hash value */ | CCObject* m_pObject;/** hash value */ | |||
public: | public: | |||
UT_hash_handle hh; /* makes this class hashable */ | UT_hash_handle hh; /* makes this class hashable */ | |||
friend class CCDictionary; | friend class CCDictionary; | |||
}; | }; | |||
#define CCDICT_FOREACH(__dict__, __el__) \ | #define CCDICT_FOREACH(__dict__, __el__) \ | |||
CCDictElement* pTmp##__dict__##__el__ = NULL; \ | CCDictElement* pTmp##__dict__##__el__ = NULL; \ | |||
HASH_ITER(hh, (__dict__)->m_pElements, __el__, pTmp##__dict__##__el__) | HASH_ITER(hh, (__dict__)->m_pElements, __el__, pTmp##__dict__##__el__) | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
CCDirector.h | CCDirector.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#define __CCDIRECTOR_H__ | #define __CCDIRECTOR_H__ | |||
#include "platform/CCPlatformMacros.h" | #include "platform/CCPlatformMacros.h" | |||
#include "cocoa/CCObject.h" | #include "cocoa/CCObject.h" | |||
#include "ccTypes.h" | #include "ccTypes.h" | |||
#include "cocoa/CCGeometry.h" | #include "cocoa/CCGeometry.h" | |||
#include "cocoa/CCArray.h" | #include "cocoa/CCArray.h" | |||
#include "CCGL.h" | #include "CCGL.h" | |||
#include "kazmath/mat4.h" | #include "kazmath/mat4.h" | |||
#include "label_nodes/CCLabelTTF.h" | #include "label_nodes/CCLabelTTF.h" | |||
#include "ccTypeInfo.h" | ||||
NS_CC_BEGIN | NS_CC_BEGIN | |||
/** | /** | |||
* @addtogroup base_nodes | * @addtogroup base_nodes | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @typedef ccDirectorProjection | /** @typedef ccDirectorProjection | |||
Possible OpenGL projections used by director | Possible OpenGL projections used by director | |||
skipping to change at line 59 | skipping to change at line 60 | |||
typedef enum { | typedef enum { | |||
/// sets a 2D projection (orthogonal projection) | /// sets a 2D projection (orthogonal projection) | |||
kCCDirectorProjection2D, | kCCDirectorProjection2D, | |||
/// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. | /// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. | |||
kCCDirectorProjection3D, | kCCDirectorProjection3D, | |||
/// it calls "updateProjection" on the projection delegate. | /// it calls "updateProjection" on the projection delegate. | |||
kCCDirectorProjectionCustom, | kCCDirectorProjectionCustom, | |||
/// Detault projection is 3D projection | /// Default projection is 3D projection | |||
kCCDirectorProjectionDefault = kCCDirectorProjection3D, | kCCDirectorProjectionDefault = kCCDirectorProjection3D, | |||
} ccDirectorProjection; | } ccDirectorProjection; | |||
/* Forward declarations. */ | /* Forward declarations. */ | |||
class CCLabelAtlas; | class CCLabelAtlas; | |||
class CCScene; | class CCScene; | |||
class CCEGLView; | class CCEGLView; | |||
class CCDirectorDelegate; | class CCDirectorDelegate; | |||
class CCNode; | class CCNode; | |||
class CCScheduler; | class CCScheduler; | |||
skipping to change at line 84 | skipping to change at line 85 | |||
/** | /** | |||
@brief Class that creates and handle the main Window and manages how | @brief Class that creates and handle the main Window and manages how | |||
and when to execute the Scenes. | and when to execute the Scenes. | |||
The CCDirector is also responsible for: | The CCDirector is also responsible for: | |||
- initializing the OpenGL context | - initializing the OpenGL context | |||
- setting the OpenGL pixel format (default on is RGB565) | - setting the OpenGL pixel format (default on is RGB565) | |||
- setting the OpenGL buffer depth (default one is 0-bit) | - setting the OpenGL buffer depth (default one is 0-bit) | |||
- setting the projection (default one is 3D) | - setting the projection (default one is 3D) | |||
- setting the orientation (default one is Protrait) | - setting the orientation (default one is Portrait) | |||
Since the CCDirector is a singleton, the standard way to use it is by call ing: | Since the CCDirector is a singleton, the standard way to use it is by call ing: | |||
_ CCDirector::sharedDirector()->methodName(); | _ CCDirector::sharedDirector()->methodName(); | |||
The CCDirector also sets the default OpenGL context: | The CCDirector also sets the default OpenGL context: | |||
- GL_TEXTURE_2D is enabled | - GL_TEXTURE_2D is enabled | |||
- GL_VERTEX_ARRAY is enabled | - GL_VERTEX_ARRAY is enabled | |||
- GL_COLOR_ARRAY is enabled | - GL_COLOR_ARRAY is enabled | |||
- GL_TEXTURE_COORD_ARRAY is enabled | - GL_TEXTURE_COORD_ARRAY is enabled | |||
*/ | */ | |||
class CC_DLL CCDirector : public CCObject | class CC_DLL CCDirector : public CCObject, public TypeInfo | |||
{ | { | |||
public: | public: | |||
CCDirector(void); | CCDirector(void); | |||
virtual ~CCDirector(void); | virtual ~CCDirector(void); | |||
virtual bool init(void); | virtual bool init(void); | |||
virtual long getClassTypeInfo() { | ||||
static const long id = cocos2d::getHashCodeByString(typeid(c | ||||
ocos2d::CCDirector).name()); | ||||
return id; | ||||
} | ||||
// attribute | // attribute | |||
/** Get current running Scene. Director can only run one Scene at the t ime */ | /** Get current running Scene. Director can only run one Scene at the t ime */ | |||
inline CCScene* getRunningScene(void) { return m_pRunningScene; } | inline CCScene* getRunningScene(void) { return m_pRunningScene; } | |||
/** Get the FPS value */ | /** Get the FPS value */ | |||
inline double getAnimationInterval(void) { return m_dAnimationInterval; } | inline double getAnimationInterval(void) { return m_dAnimationInterval; } | |||
/** Set the FPS value. */ | /** Set the FPS value. */ | |||
virtual void setAnimationInterval(double dValue) = 0; | virtual void setAnimationInterval(double dValue) = 0; | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 10 lines changed or added | |||
CCDrawingPrimitives.h | CCDrawingPrimitives.h | |||
---|---|---|---|---|
skipping to change at line 58 | skipping to change at line 58 | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
/** | /** | |||
* @addtogroup global | * @addtogroup global | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCPointArray; | class CCPointArray; | |||
/** initlialize context */ | /** initialize context */ | |||
void CC_DLL ccDrawInit(); | void CC_DLL ccDrawInit(); | |||
/** draws a point given x and y coordinate measured in points */ | /** draws a point given x and y coordinate measured in points */ | |||
void CC_DLL ccDrawPoint( const CCPoint& point ); | void CC_DLL ccDrawPoint( const CCPoint& point ); | |||
/** draws an array of points. | /** draws an array of points. | |||
@since v0.7.2 | @since v0.7.2 | |||
*/ | */ | |||
void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoint s ); | void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoint s ); | |||
skipping to change at line 80 | skipping to change at line 80 | |||
void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination ) ; | void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination ) ; | |||
/** draws a rectangle given the origin and destination point measured in po ints. */ | /** draws a rectangle given the origin and destination point measured in po ints. */ | |||
void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination ); | void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination ); | |||
/** draws a solid rectangle given the origin and destination point measured in points. | /** draws a solid rectangle given the origin and destination point measured in points. | |||
@since 1.1 | @since 1.1 | |||
*/ | */ | |||
void CC_DLL ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color ); | void CC_DLL ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color ); | |||
/** draws a poligon given a pointer to CCPoint coordiantes and the number o f vertices measured in points. | /** draws a polygon given a pointer to CCPoint coordinates and the number o f vertices measured in points. | |||
The polygon can be closed or open | The polygon can be closed or open | |||
*/ | */ | |||
void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices , bool closePolygon ); | void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices , bool closePolygon ); | |||
/** draws a solid polygon given a pointer to CGPoint coordiantes, the numbe r of vertices measured in points, and a color. | /** draws a solid polygon given a pointer to CGPoint coordinates, the numbe r of vertices measured in points, and a color. | |||
*/ | */ | |||
void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoin ts, ccColor4F color ); | void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoin ts, ccColor4F color ); | |||
/** draws a circle given the center, radius and number of segments. */ | /** draws a circle given the center, radius and number of segments. */ | |||
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY); | ||||
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); | void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); | |||
/** draws a quad bezier path | /** draws a quad bezier path | |||
@warning This function could be pretty slow. Use it only for debugging pur poses. | @warning This function could be pretty slow. Use it only for debugging pur poses. | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments); | void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments); | |||
/** draws a cubic bezier path | /** draws a cubic bezier path | |||
@warning This function could be pretty slow. Use it only for debugging pur poses. | @warning This function could be pretty slow. Use it only for debugging pur poses. | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||
CCEGLView.h | CCEGLView.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 __CC_EGLVIEW_MAC_H__ | #ifndef __CC_EGLVIEW_IPHONE_H__ | |||
#define __CC_EGLVIEW_MAC_H__ | #define __CC_EGLVIEW_IPHONE_H__ | |||
#include "platform/CCCommon.h" | #include "platform/CCCommon.h" | |||
#include "platform/CCEGLViewProtocol.h" | #include "platform/CCEGLViewProtocol.h" | |||
namespace cocos2d { | NS_CC_BEGIN | |||
class CCSet; | ||||
class CCTouch; | ||||
class CCSize; | ||||
class CC_DLL CCEGLView : public CCEGLViewProtocol | class CC_DLL CCEGLView : public CCEGLViewProtocol | |||
{ | { | |||
public: | public: | |||
CCEGLView(); | CCEGLView(); | |||
virtual ~CCEGLView(); | ~CCEGLView(); | |||
bool isOpenGLReady(); | virtual bool isOpenGLReady(); | |||
virtual bool setContentScaleFactor(float contentScaleFactor); | virtual bool setContentScaleFactor(float contentScaleFactor); | |||
void end(); | virtual bool enableRetina(); | |||
void swapBuffers(); | ||||
void setIMEKeyboardState(bool bOpen); | // keep compatible | |||
virtual void end(); | ||||
virtual void swapBuffers(); | ||||
void setMultiTouchMask(bool mask); | virtual void setIMEKeyboardState(bool bOpen); | |||
static CCEGLView* sharedOpenGLView(); | static CCEGLView* sharedOpenGLView(); | |||
}; | }; | |||
} // end of namespace cocos2d | NS_CC_END | |||
#endif // end of __CC_EGLVIEW_MAC_H__ | #endif // end of __CC_EGLVIEW_IPHONE_H__ | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 12 lines changed or added | |||
CCEGLViewProtocol.h | CCEGLViewProtocol.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
* @addtogroup platform | * @addtogroup platform | |||
* @{ | * @{ | |||
*/ | */ | |||
class CC_DLL CCEGLViewProtocol | class CC_DLL CCEGLViewProtocol | |||
{ | { | |||
public: | public: | |||
CCEGLViewProtocol(); | CCEGLViewProtocol(); | |||
virtual ~CCEGLViewProtocol(); | virtual ~CCEGLViewProtocol(); | |||
/** Force destorying EGL view, subclass must implement this method. */ | /** Force destroying EGL view, subclass must implement this method. */ | |||
virtual void end() = 0; | virtual void end() = 0; | |||
/** 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; | |||
skipping to change at line 80 | skipping to change at line 80 | |||
* Get the visible area size of opengl viewport. | * Get the visible area size of opengl viewport. | |||
*/ | */ | |||
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 resolutin size. | * Set the design resolution size. | |||
* You can't use it with enableRetina together. | * 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 you need, there are: | * @param resolutionPolicy The resolution policy desired, you may choos | |||
* [1] kCCResolutionExactFit Fill screen, if th | e: | |||
e design resolution ratio of width and height is different from the screen | * [1] kCCResolutionExactFit Fill screen by str | |||
resolution ratio, your game view will be stretched. | etch-to-fit: if the design resolution ratio of width to height is different | |||
* [2] kCCResolutionNoBorder Full screen withou | from the screen resolution ratio, your game view will be stretched. | |||
t black border, if the design resolution ratio of width and height is diffe | * [2] kCCResolutionNoBorder Full screen withou | |||
rent from the screen resolution ratio, two areas of your game view will be | t black border: if the design resolution ratio of width to height is differ | |||
cut. | ent from the screen resolution ratio, two areas of your game view will be c | |||
* [3] kCCResolutionShowAll Full screen with b | ut. | |||
lack border, if the design resolution ratio of width and height is differen | * [3] kCCResolutionShowAll Full screen with b | |||
t from the screen resolution ratio, two black border will be shown on the s | lack border: if the design resolution ratio of width to height is different | |||
creen; | from 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); | |||
/** Set touch delegate */ | /** Set touch delegate */ | |||
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate); | virtual void setTouchDelegate(EGLTouchDelegate * pDelegate); | |||
/** | /** | |||
* Set content scale factor. | * Set content scale factor. | |||
* @return If return true, it means the plaform supports retina display . | * @return If the return value is true, the platform supports retina di splay mode. | |||
*/ | */ | |||
virtual bool setContentScaleFactor(float contentScaleFactor); | 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); | |||
/** | /** | |||
* Enable retina mode. | * Enable retina mode. | |||
* You can't use it with setDesignResolutionSize | * You can't use it with setDesignResolutionSize | |||
*/ | */ | |||
virtual bool enableRetina(); | virtual bool enableRetina(); | |||
/** handle touch events by default, if you want to custom your handles, 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 opengl view port rectangle. | * Get the opengl view port rectangle. | |||
*/ | */ | |||
const CCRect& getViewPortRect() const; | const CCRect& getViewPortRect() const; | |||
/** | /** | |||
* Get the scale factor of horizontal direction. | * Get scale factor of the horizontal direction. | |||
* | ||||
*/ | */ | |||
float getScaleX() const; | float getScaleX() const; | |||
/** | /** | |||
* Get the scale factor of vertical direction. | * Get scale factor of the vertical direction. | |||
*/ | */ | |||
float getScaleY() const; | float getScaleY() const; | |||
/** | /** | |||
* Get whether the retina mode is enabled. | * Get retina mode status (on if true). | |||
*/ | */ | |||
bool isRetinaEnabled() const; | 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 size of screen | // real screen size | |||
CCSize m_obScreenSize; | CCSize m_obScreenSize; | |||
// resolution size, it is the size the app resources designed for | // 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; | bool m_bIsRetinaEnabled; | |||
End of changes. 11 change blocks. | ||||
24 lines changed or deleted | 23 lines changed or added | |||
CCFileUtils.h | CCFileUtils.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
//! @brief Helper class to handle file operations | //! @brief Helper class to handle file operations | |||
class CC_DLL CCFileUtils | class CC_DLL CCFileUtils | |||
{ | { | |||
public: | public: | |||
static CCFileUtils* sharedFileUtils(); | static CCFileUtils* sharedFileUtils(); | |||
static void purgeFileUtils(); | static void purgeFileUtils(); | |||
void purgeCachedEntries(); | void purgeCachedEntries(); | |||
/** | /** | |||
@brief Get resource file data | @brief Get resource file data | |||
@param[in] pszFileName The resource file name which contain the path | @param[in] pszFileName The resource file name which contains the path. | |||
@param[in] pszMode The read mode of the file | @param[in] pszMode The read mode of the file. | |||
@param[out] pSize If get the file data succeed the it will be the data | @param[out] pSize If the file read operation succeeds, it will be the d | |||
size,or it will be 0 | ata size, otherwise 0. | |||
@return if success,the pointer of data will be returned,or NULL is retu | @return Upon success, a pointer to the data is returned, otherwise NULL | |||
rned | . | |||
@warning If you get the file data succeed,you must delete[] it after us | @warning Recall: you are responsible for calling delete[] on any Non-NU | |||
ed. | LL pointer returned. | |||
*/ | */ | |||
unsigned char* getFileData(const char* pszFileName, const char* pszMode , unsigned long * pSize); | unsigned char* getFileData(const char* pszFileName, const char* pszMode , unsigned long * pSize); | |||
/** | /** | |||
@brief Get resource file data from zip file | @brief Get resource file data from a zip file. | |||
@param[in] pszFileName The resource file name which contain the relati | @param[in] pszFileName The resource file name which contains the relat | |||
ve path of zip file | ive path of the zip file. | |||
@param[out] pSize If get the file data succeed the it will be the data | @param[out] pSize If the file read operation succeeds, it will be the d | |||
size,or it will be 0 | ata size, otherwise 0. | |||
@return if success,the pointer of data will be returned,or NULL is retu | @return Upon success, a pointer to the data is returned, otherwise NULL | |||
rned | . | |||
@warning If you get the file data succeed,you must delete[] it after us | @warning Recall: you are responsible for calling delete[] on any Non-NU | |||
ed. | LL pointer returned. | |||
*/ | */ | |||
unsigned char* getFileDataFromZip(const char* pszZipFilePath, const cha r* pszFileName, unsigned long * pSize); | unsigned char* getFileDataFromZip(const char* pszZipFilePath, const cha r* pszFileName, unsigned long * pSize); | |||
/** | /** | |||
@brief Generate the absolute path of the file. | @brief Generate the absolute path of the file. | |||
@param pszRelativePath The relative path of the file. | @param pszRelativePath The relative path of the file. | |||
@return The absolute path of the file. | @return The absolute path of the file. | |||
@warning We only add the ResourcePath before the relative path of the f ile. | @warning We only add the ResourcePath before the relative path of the f ile. | |||
If you have not set the ResourcePath,the function add "/NEWPLUS/TDA_DAT | If you have not set the ResourcePath, the function appends "/NEWPLUS/TD | |||
A/UserData/" as default. | A_DATA/UserData/" by default. | |||
You can set ResourcePath by function void setResourcePath(const char *p | You can set ResourcePath with void setResourcePath(const char *pszResou | |||
szResourcePath); | rcePath); | |||
*/ | */ | |||
const char* fullPathFromRelativePath(const char *pszRelativePath); | const char* fullPathFromRelativePath(const char *pszRelativePath); | |||
/// @cond | /// @cond | |||
const char* fullPathFromRelativeFile(const char *pszFilename, const cha r *pszRelativeFile); | const char* fullPathFromRelativeFile(const char *pszFilename, const cha r *pszRelativeFile); | |||
/// @endcond | /// @endcond | |||
/** | /** | |||
@brief Set the resource directory,we will find resource relative to th | @brief Set the resource directory; we will find resources relative to | |||
is directory | this directory. | |||
@param pszDirectoryName Relative path to root | @param pszDirectoryName Relative path to root. | |||
*/ | */ | |||
void setResourceDirectory(const char *pszDirectoryName); | void setResourceDirectory(const char *pszDirectoryName); | |||
/** | /** | |||
@brief Get the resource directory | @brief Get the resource directory | |||
*/ | */ | |||
const char* getResourceDirectory(); | const char* getResourceDirectory(); | |||
/** | /** | |||
@brief Get the writeable path | @brief Get the writeable path | |||
skipping to change at line 103 | skipping to change at line 103 | |||
*/ | */ | |||
std::string getWriteablePath(); | std::string getWriteablePath(); | |||
/** | /** | |||
@brief Set/Get whether pop-up a message box when the image load failed | @brief Set/Get whether pop-up a message box when the image load failed | |||
*/ | */ | |||
void setPopupNotify(bool bNotify); | void setPopupNotify(bool bNotify); | |||
bool isPopupNotify(); | bool isPopupNotify(); | |||
protected: | protected: | |||
CCFileUtils(void) | ||||
{ | ||||
} | ||||
std::string m_obDirectory; | std::string m_obDirectory; | |||
}; | }; | |||
// end of platform group | // end of platform group | |||
/// @} | /// @} | |||
NS_CC_END | NS_CC_END | |||
#endif // __CC_FILEUTILS_PLATFORM_H__ | #endif // __CC_FILEUTILS_PLATFORM_H__ | |||
End of changes. 5 change blocks. | ||||
24 lines changed or deleted | 28 lines changed or added | |||
CCFileUtilsCommon_cpp.h | CCFileUtilsCommon_cpp.h | |||
---|---|---|---|---|
skipping to change at line 202 | skipping to change at line 202 | |||
{ | { | |||
preState = m_tStateStack.top(); | preState = m_tStateStack.top(); | |||
} | } | |||
if (preState == SAX_DICT) | if (preState == SAX_DICT) | |||
{ | { | |||
m_pCurDict->setObject(m_pArray, m_sCurKey.c_str()); | m_pCurDict->setObject(m_pArray, m_sCurKey.c_str()); | |||
} | } | |||
else if (preState == SAX_ARRAY) | else if (preState == SAX_ARRAY) | |||
{ | { | |||
CCAssert(! m_tArrayStack.empty(), "The state is worng!"); | CCAssert(! m_tArrayStack.empty(), "The state is wrong!"); | |||
CCArray* pPreArray = m_tArrayStack.top(); | CCArray* pPreArray = m_tArrayStack.top(); | |||
pPreArray->addObject(m_pArray); | pPreArray->addObject(m_pArray); | |||
} | } | |||
m_pArray->release(); | m_pArray->release(); | |||
// record the array state | // record the array state | |||
m_tStateStack.push(m_tState); | m_tStateStack.push(m_tState); | |||
m_tArrayStack.push(m_pArray); | m_tArrayStack.push(m_pArray); | |||
} | } | |||
else | else | |||
{ | { | |||
skipping to change at line 308 | skipping to change at line 308 | |||
{ | { | |||
case SAX_KEY: | case SAX_KEY: | |||
m_sCurKey = pText->getCString(); | m_sCurKey = pText->getCString(); | |||
break; | break; | |||
case SAX_INT: | case SAX_INT: | |||
case SAX_REAL: | case SAX_REAL: | |||
case SAX_STRING: | case SAX_STRING: | |||
{ | { | |||
if (curState == SAX_DICT) | if (curState == SAX_DICT) | |||
{ | { | |||
CCAssert(!m_sCurKey.empty(), "not found key : <integet/ real>"); | CCAssert(!m_sCurKey.empty(), "key not found : <integer/ real>"); | |||
} | } | |||
m_sCurValue.append(pText->getCString()); | m_sCurValue.append(pText->getCString()); | |||
} | } | |||
break; | break; | |||
default: | default: | |||
break; | break; | |||
} | } | |||
pText->release(); | pText->release(); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCGL.h | CCGL.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#ifndef __CCGL_H__ | #ifndef __CCGL_H__ | |||
#define __CCGL_H__ | #define __CCGL_H__ | |||
#define glClearDepth glClearDepthf | #define glClearDepth glClearDepthf | |||
#define glDeleteVertexArrays glDeleteVertexArraysOES | #define glDeleteVertexArrays glDeleteVertexArraysOES | |||
#define glGenVertexArrays glGenVertexArraysOES | #define glGenVertexArrays glGenVertexArraysOES | |||
#define glBindVertexArray glBindVertexArrayOES | #define glBindVertexArray glBindVertexArrayOES | |||
#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES | #define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES | |||
#include <OpenGLES/ES2/gl.h> | #include <OpenGLES/ES2/gl.h> | |||
#include <OPenGLES/ES2/glext.h> | #include <OpenGLES/ES2/glext.h> | |||
#endif // __CCGL_H__ | #endif // __CCGL_H__ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCGrabber.h | CCGrabber.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 On-Core | Copyright (c) 2009 On-Core | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCGrid.h | CCGrid.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 On-Core | Copyright (c) 2009 On-Core | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 54 | skipping to change at line 54 | |||
* @{ | * @{ | |||
*/ | */ | |||
/** Base class for other | /** Base class for other | |||
*/ | */ | |||
class CC_DLL CCGridBase : public CCObject | class CC_DLL CCGridBase : public CCObject | |||
{ | { | |||
public: | public: | |||
virtual ~CCGridBase(void); | virtual ~CCGridBase(void); | |||
/** wheter or not the grid is active */ | /** whether or not the grid is active */ | |||
inline bool isActive(void) { return m_bActive; } | inline bool isActive(void) { return m_bActive; } | |||
void setActive(bool bActive); | void setActive(bool bActive); | |||
/** number of times that the grid will be reused */ | /** number of times that the grid will be reused */ | |||
inline int getReuseGrid(void) { return m_nReuseGrid; } | inline int getReuseGrid(void) { return m_nReuseGrid; } | |||
inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; } | inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; } | |||
/** size of the grid */ | /** size of the grid */ | |||
inline const ccGridSize& getGridSize(void) { return m_sGridSize; } | inline const ccGridSize& getGridSize(void) { return m_sGridSize; } | |||
inline void setGridSize(const ccGridSize& gridSize) { m_sGridSize = gri dSize; } | inline void setGridSize(const ccGridSize& gridSize) { m_sGridSize = gri dSize; } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCIMEDelegate.h | CCIMEDelegate.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
/** | /** | |||
* @addtogroup input | * @addtogroup input | |||
* @{ | * @{ | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
CCRect begin; // the soft keyboard rectangle when animati | CCRect begin; // the soft keyboard rectangle when animati | |||
n begin | on begins | |||
CCRect end; // the soft keyboard rectangle when animati | CCRect end; // the soft keyboard rectangle when animati | |||
n end | on ends | |||
float duration; // the soft keyboard animation duration | float duration; // the soft keyboard animation duration | |||
} CCIMEKeyboardNotificationInfo; | } CCIMEKeyboardNotificationInfo; | |||
/** | /** | |||
@brief Input method editor delegate. | @brief Input method editor delegate. | |||
*/ | */ | |||
class CC_DLL CCIMEDelegate | class CC_DLL CCIMEDelegate | |||
{ | { | |||
public: | public: | |||
virtual ~CCIMEDelegate(); | virtual ~CCIMEDelegate(); | |||
virtual bool attachWithIME(); | virtual bool attachWithIME(); | |||
virtual bool detachWithIME(); | virtual bool detachWithIME(); | |||
protected: | protected: | |||
friend class CCIMEDispatcher; | friend class CCIMEDispatcher; | |||
/** | /** | |||
@brief Decide the delegate instance is ready for receive ime message or not. | @brief Decide if the delegate instance is ready to receive an IME me ssage. | |||
Called by CCIMEDispatcher. | Called by CCIMEDispatcher. | |||
*/ | */ | |||
virtual bool canAttachWithIME() { return false; } | virtual bool canAttachWithIME() { return false; } | |||
/** | /** | |||
@brief When the delegate detach with IME, this method call by CCIMED ispatcher. | @brief When the delegate detaches from the IME, this method is calle d by CCIMEDispatcher. | |||
*/ | */ | |||
virtual void didAttachWithIME() {} | virtual void didAttachWithIME() {} | |||
/** | /** | |||
@brief Decide the delegate instance can stop receive ime message or not. | @brief Decide if the delegate instance can stop receiving IME messag es. | |||
*/ | */ | |||
virtual bool canDetachWithIME() { return false; } | virtual bool canDetachWithIME() { return false; } | |||
/** | /** | |||
@brief When the delegate detach with IME, this method call by CCIMED ispatcher. | @brief When the delegate detaches from the IME, this method is calle d by CCIMEDispatcher. | |||
*/ | */ | |||
virtual void didDetachWithIME() {} | virtual void didDetachWithIME() {} | |||
/** | /** | |||
@brief Called by CCIMEDispatcher when some text input from IME. | @brief Called by CCIMEDispatcher when text input received from the I ME. | |||
*/ | */ | |||
virtual void insertText(const char * text, int len) {CC_UNUSED_PARAM(te xt);CC_UNUSED_PARAM(len);} | virtual void insertText(const char * text, int len) {CC_UNUSED_PARAM(te xt);CC_UNUSED_PARAM(len);} | |||
/** | /** | |||
@brief Called by CCIMEDispatcher when user clicked the backward key. | @brief Called by CCIMEDispatcher after the user clicks the backward key. | |||
*/ | */ | |||
virtual void deleteBackward() {} | virtual void deleteBackward() {} | |||
/** | /** | |||
@brief Called by CCIMEDispatcher for get text which delegate already has. | @brief Called by CCIMEDispatcher for text stored in delegate. | |||
*/ | */ | |||
virtual const char * getContentText() { return 0; } | virtual const char * getContentText() { return 0; } | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
// keyboard show/hide notification | // keyboard show/hide notification | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | |||
virtual void keyboardDidShow(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | virtual void keyboardDidShow(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | |||
virtual void keyboardWillHide(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | virtual void keyboardWillHide(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | |||
virtual void keyboardDidHide(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | virtual void keyboardDidHide(CCIMEKeyboardNotificationInfo& info) {C C_UNUSED_PARAM(info);} | |||
End of changes. 8 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
CCIMEDispatcher.h | CCIMEDispatcher.h | |||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
{ | { | |||
public: | public: | |||
~CCIMEDispatcher(); | ~CCIMEDispatcher(); | |||
/** | /** | |||
@brief Returns the shared CCIMEDispatcher object for the system. | @brief Returns the shared CCIMEDispatcher object for the system. | |||
*/ | */ | |||
static CCIMEDispatcher* sharedDispatcher(); | static CCIMEDispatcher* sharedDispatcher(); | |||
// /** | // /** | |||
// @brief Release all CCIMEDelegates from shared dispatcher. | // @brief Releases all CCIMEDelegates from the shared dispatcher. | |||
// */ | // */ | |||
// static void purgeSharedDispatcher(); | // static void purgeSharedDispatcher(); | |||
/** | /** | |||
@brief dispatch the input text from ime | @brief Dispatches the input text from IME. | |||
*/ | */ | |||
void dispatchInsertText(const char * pText, int nLen); | void dispatchInsertText(const char * pText, int nLen); | |||
/** | /** | |||
@brief dispatch the delete backward operation | @brief Dispatches the delete-backward operation. | |||
*/ | */ | |||
void dispatchDeleteBackward(); | void dispatchDeleteBackward(); | |||
/** | /** | |||
@brief get the content text, which current CCIMEDelegate which attac hed with IME has. | @brief Get the content text from CCIMEDelegate, retrieved previously fr om IME. | |||
*/ | */ | |||
const char * getContentText(); | const char * getContentText(); | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
// dispatch keyboard notification | // dispatch keyboard notification | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
void dispatchKeyboardWillShow(CCIMEKeyboardNotificationInfo& info); | void dispatchKeyboardWillShow(CCIMEKeyboardNotificationInfo& info); | |||
void dispatchKeyboardDidShow(CCIMEKeyboardNotificationInfo& info); | void dispatchKeyboardDidShow(CCIMEKeyboardNotificationInfo& info); | |||
void dispatchKeyboardWillHide(CCIMEKeyboardNotificationInfo& info); | void dispatchKeyboardWillHide(CCIMEKeyboardNotificationInfo& info); | |||
void dispatchKeyboardDidHide(CCIMEKeyboardNotificationInfo& info); | void dispatchKeyboardDidHide(CCIMEKeyboardNotificationInfo& info); | |||
protected: | protected: | |||
friend class CCIMEDelegate; | friend class CCIMEDelegate; | |||
/** | /** | |||
@brief add delegate to concern ime msg | @brief Add delegate to receive IME messages. | |||
*/ | */ | |||
void addDelegate(CCIMEDelegate * pDelegate); | void addDelegate(CCIMEDelegate * pDelegate); | |||
/** | /** | |||
@brief attach the pDeleate with ime. | @brief Attach the pDelegate to the IME. | |||
@return If the old delegate can detattach with ime and the new delegate | @return If the old delegate can detach from the IME, and the new delega | |||
can attach with ime, return true, otherwise return false. | te | |||
can attach to the IME, return true, otherwise false. | ||||
*/ | */ | |||
bool attachDelegateWithIME(CCIMEDelegate * pDelegate); | bool attachDelegateWithIME(CCIMEDelegate * pDelegate); | |||
bool detachDelegateWithIME(CCIMEDelegate * pDelegate); | bool detachDelegateWithIME(CCIMEDelegate * pDelegate); | |||
/** | /** | |||
@brief remove the delegate from the delegates who concern ime msg | @brief Remove the delegate from the delegates which receive IME message s. | |||
*/ | */ | |||
void removeDelegate(CCIMEDelegate * pDelegate); | void removeDelegate(CCIMEDelegate * pDelegate); | |||
private: | private: | |||
CCIMEDispatcher(); | CCIMEDispatcher(); | |||
class Impl; | class Impl; | |||
Impl * m_pImpl; | Impl * m_pImpl; | |||
}; | }; | |||
End of changes. 7 change blocks. | ||||
9 lines changed or deleted | 10 lines changed or added | |||
CCImage.h | CCImage.h | |||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
kAlignRight = 0x32, ///< Horizontal right and vertical cent er. | kAlignRight = 0x32, ///< Horizontal right and vertical cent er. | |||
kAlignBottomRight = 0x22, ///< Horizontal right and vertical bott om. | kAlignBottomRight = 0x22, ///< Horizontal right and vertical bott om. | |||
kAlignBottom = 0x23, ///< Horizontal center and vertical bot tom. | kAlignBottom = 0x23, ///< Horizontal center and vertical bot tom. | |||
kAlignBottomLeft = 0x21, ///< Horizontal left and vertical botto m. | kAlignBottomLeft = 0x21, ///< Horizontal left and vertical botto m. | |||
kAlignLeft = 0x31, ///< Horizontal left and vertical cente r. | kAlignLeft = 0x31, ///< Horizontal left and vertical cente r. | |||
kAlignTopLeft = 0x11, ///< Horizontal left and vertical top. | kAlignTopLeft = 0x11, ///< Horizontal left and vertical top. | |||
}ETextAlign; | }ETextAlign; | |||
/** | /** | |||
@brief Load the image from the specified path. | @brief Load the image from the specified path. | |||
@param strPath the absolute file path | @param strPath the absolute file path. | |||
@param imageType the type of image, now only support tow types. | @param imageType the type of image, currently only supporting two types | |||
@return true if load correctly | . | |||
@return true if loaded correctly. | ||||
*/ | */ | |||
bool initWithImageFile(const char * strPath, EImageFormat imageType = k FmtPng); | bool initWithImageFile(const char * strPath, EImageFormat imageType = k FmtPng); | |||
/* | /* | |||
@brief The same meaning as initWithImageFile, but it is thread safe. I t is casued by | @brief The same result as with initWithImageFile, but thread safe. It is caused by | |||
loadImage() in CCTextureCache.cpp. | loadImage() in CCTextureCache.cpp. | |||
@param fullpath full path of the file | @param fullpath full path of the file. | |||
@param imageType the type of image, now only support tow types. | @param imageType the type of image, currently only supporting two type | |||
@return true if load correctly | s. | |||
@return true if loaded correctly. | ||||
*/ | */ | |||
bool initWithImageFileThreadSafe(const char *fullpath, EImageFormat ima geType = kFmtPng); | bool initWithImageFileThreadSafe(const char *fullpath, EImageFormat ima geType = kFmtPng); | |||
/** | /** | |||
@brief Load image from stream buffer. | @brief Load image from stream buffer. | |||
@warning kFmtRawData only support RGBA8888 | @warning kFmtRawData only supports RGBA8888. | |||
@param pBuffer stream buffer that hold the image data | @param pBuffer stream buffer which holds the image data. | |||
@param nLength the length of data(managed in byte) | @param nLength data length expressed in (number of) bytes. | |||
@param nWidth, nHeight, nBitsPerComponent are used for kFmtRawData | @param nWidth, nHeight, nBitsPerComponent are used for kFmtRawData. | |||
@return true if load correctly | @return true if loaded correctly. | |||
*/ | */ | |||
bool initWithImageData(void * pData, | bool initWithImageData(void * pData, | |||
int nDataLen, | int nDataLen, | |||
EImageFormat eFmt = kFmtUnKnown, | EImageFormat eFmt = kFmtUnKnown, | |||
int nWidth = 0, | int nWidth = 0, | |||
int nHeight = 0, | int nHeight = 0, | |||
int nBitsPerComponent = 8); | int nBitsPerComponent = 8); | |||
/** | /** | |||
@brief Create image with specified string. | @brief Create image with specified string. | |||
@param pText the text which the image show, nil cause init fail | @param pText the text the image will show (cannot be nil). | |||
@param nWidth the image width, if 0, the width match the text's w | @param nWidth the image width, if 0, the width will match the tex | |||
idth | t's width. | |||
@param nHeight the image height, if 0, the height match the text's | @param nHeight the image height, if 0, the height will match the t | |||
height | ext's height. | |||
@param eAlignMask the test Alignment | @param eAlignMask the test Alignment | |||
@param pFontName the name of the font which use to draw the text. If nil, use the default system font. | @param pFontName the name of the font used to draw the text. If nil, use the default system font. | |||
@param nSize the font size, if 0, use the system default size. | @param nSize the font size, if 0, use the system default size. | |||
*/ | */ | |||
bool initWithString( | bool initWithString( | |||
const char * pText, | const char * pText, | |||
int nWidth = 0, | int nWidth = 0, | |||
int nHeight = 0, | int nHeight = 0, | |||
ETextAlign eAlignMask = kAlignCenter, | ETextAlign eAlignMask = kAlignCenter, | |||
const char * pFontName = 0, | const char * pFontName = 0, | |||
int nSize = 0); | int nSize = 0); | |||
unsigned char * getData() { return m_pData; } | unsigned char * getData() { return m_pData; } | |||
int getDataLen() { return m_nWidth * m_nHeight; } | int getDataLen() { return m_nWidth * m_nHeight; } | |||
bool hasAlpha() { return m_bHasAlpha; } | bool hasAlpha() { return m_bHasAlpha; } | |||
bool isPremultipliedAlpha() { return m_bPreMulti; } | bool isPremultipliedAlpha() { return m_bPreMulti; } | |||
/** | /** | |||
@brief Save the CCImage data to specified file with specified format | @brief Save CCImage data to the specified file, with specified forma | |||
. | t. | |||
@param pszFilePath the file's absolute path, including file s | @param pszFilePath the file's absolute path, including file s | |||
ubfix | uffix. | |||
@param bIsToRGB if the image is saved as RGB format | @param bIsToRGB whether the image is saved as RGB format. | |||
*/ | */ | |||
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true); | bool saveToFile(const char *pszFilePath, bool bIsToRGB = true); | |||
CC_SYNTHESIZE_READONLY(unsigned short, m_nWidth, Width); | CC_SYNTHESIZE_READONLY(unsigned short, m_nWidth, Width); | |||
CC_SYNTHESIZE_READONLY(unsigned short, m_nHeight, Height); | CC_SYNTHESIZE_READONLY(unsigned short, m_nHeight, Height); | |||
CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent ); | CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent ); | |||
protected: | protected: | |||
bool _initWithJpgData(void *pData, int nDatalen); | bool _initWithJpgData(void *pData, int nDatalen); | |||
bool _initWithPngData(void *pData, int nDatalen); | bool _initWithPngData(void *pData, int nDatalen); | |||
End of changes. 7 change blocks. | ||||
23 lines changed or deleted | 25 lines changed or added | |||
CCImageCommon_cpp.h | CCImageCommon_cpp.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
#include "png.h" | #include "png.h" | |||
#include "jpeglib.h" | #include "jpeglib.h" | |||
#include "tiffio.h" | #include "tiffio.h" | |||
#include <string> | #include <string> | |||
#include <ctype.h> | #include <ctype.h> | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
// premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D, | // premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D, | |||
// such as RGB888, RGB5A1 | // such as RGB888, RGB5A1 | |||
#define CC_RGB_PREMULTIPLY_APLHA(vr, vg, vb, va) \ | #define CC_RGB_PREMULTIPLY_ALPHA(vr, vg, vb, va) \ | |||
(unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \ | (unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \ | |||
((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \ | ((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \ | |||
((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16 ) | \ | ((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16 ) | \ | |||
((unsigned)(unsigned char)(va) << 24)) | ((unsigned)(unsigned char)(va) << 24)) | |||
// on ios, we should use platform/ios/CCImage_ios.mm instead | // on ios, we should use platform/ios/CCImage_ios.mm instead | |||
typedef struct | typedef struct | |||
{ | { | |||
unsigned char* data; | unsigned char* data; | |||
skipping to change at line 74 | skipping to change at line 74 | |||
memcpy(data, isource->data+isource->offset, length); | memcpy(data, isource->data+isource->offset, length); | |||
isource->offset += length; | isource->offset += length; | |||
} | } | |||
else | else | |||
{ | { | |||
png_error(png_ptr, "pngReaderCallback failed"); | png_error(png_ptr, "pngReaderCallback failed"); | |||
} | } | |||
} | } | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
// Impliment CCImage | // Implement CCImage | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
CCImage::CCImage() | CCImage::CCImage() | |||
: m_nWidth(0) | : m_nWidth(0) | |||
, m_nHeight(0) | , m_nHeight(0) | |||
, m_nBitsPerComponent(0) | , m_nBitsPerComponent(0) | |||
, m_pData(0) | , m_pData(0) | |||
, m_bHasAlpha(false) | , m_bHasAlpha(false) | |||
, m_bPreMulti(false) | , m_bPreMulti(false) | |||
{ | { | |||
skipping to change at line 328 | skipping to change at line 328 | |||
png_uint_32 color_type = png_get_color_type(png_ptr, info_ptr); | png_uint_32 color_type = png_get_color_type(png_ptr, info_ptr); | |||
//CCLOG("color type %u", color_type); | //CCLOG("color type %u", color_type); | |||
// force palette images to be expanded to 24-bit RGB | // force palette images to be expanded to 24-bit RGB | |||
// it may include alpha channel | // it may include alpha channel | |||
if (color_type == PNG_COLOR_TYPE_PALETTE) | if (color_type == PNG_COLOR_TYPE_PALETTE) | |||
{ | { | |||
png_set_palette_to_rgb(png_ptr); | png_set_palette_to_rgb(png_ptr); | |||
} | } | |||
// low-bit-depth grayscale iamges are to be expanded to 8 bits | // low-bit-depth grayscale images are to be expanded to 8 bits | |||
if (color_type == PNG_COLOR_TYPE_GRAY && m_nBitsPerComponent < 8) | if (color_type == PNG_COLOR_TYPE_GRAY && m_nBitsPerComponent < 8) | |||
{ | { | |||
png_set_expand_gray_1_2_4_to_8(png_ptr); | png_set_expand_gray_1_2_4_to_8(png_ptr); | |||
} | } | |||
// expand any tRNS chunk data into a full alpha channel | // expand any tRNS chunk data into a full alpha channel | |||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) | if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) | |||
{ | { | |||
png_set_tRNS_to_alpha(png_ptr); | png_set_tRNS_to_alpha(png_ptr); | |||
} | } | |||
// reduce images with 16-bit samples to 8 bits | // reduce images with 16-bit samples to 8 bits | |||
skipping to change at line 379 | skipping to change at line 379 | |||
png_uint_32 channel = rowbytes/m_nWidth; | png_uint_32 channel = rowbytes/m_nWidth; | |||
if (channel == 4) | if (channel == 4) | |||
{ | { | |||
m_bHasAlpha = true; | m_bHasAlpha = true; | |||
unsigned int *tmp = (unsigned int *)m_pData; | unsigned int *tmp = (unsigned int *)m_pData; | |||
for(unsigned short i = 0; i < m_nHeight; i++) | for(unsigned short i = 0; i < m_nHeight; i++) | |||
{ | { | |||
for(unsigned int j = 0; j < rowbytes; j += 4) | for(unsigned int j = 0; j < rowbytes; j += 4) | |||
{ | { | |||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1], | *tmp++ = CC_RGB_PREMULTIPLY_ALPHA( row_pointers[i][j], row_pointers[i][j + 1], | |||
row_pointers[i][j + 2 ], row_pointers[i][j + 3] ); | row_pointers[i][j + 2 ], row_pointers[i][j + 3] ); | |||
} | } | |||
} | } | |||
m_bPreMulti = true; | m_bPreMulti = true; | |||
} | } | |||
CC_SAFE_FREE(row_pointers); | CC_SAFE_FREE(row_pointers); | |||
bRet = true; | bRet = true; | |||
skipping to change at line 554 | skipping to change at line 554 | |||
{ | { | |||
if (TIFFReadRGBAImageOriented(tif, w, h, raster, ORIENTATION_TOP LEFT, 0)) | if (TIFFReadRGBAImageOriented(tif, w, h, raster, ORIENTATION_TOP LEFT, 0)) | |||
{ | { | |||
unsigned char* src = (unsigned char*)raster; | unsigned char* src = (unsigned char*)raster; | |||
unsigned int* tmp = (unsigned int*)m_pData; | unsigned int* tmp = (unsigned int*)m_pData; | |||
/* the raster data is pre-multiplied by the alpha component | /* the raster data is pre-multiplied by the alpha component | |||
after invoking TIFFReadRGBAImageOriented | after invoking TIFFReadRGBAImageOriented | |||
for(int j = 0; j < m_nWidth * m_nHeight * 4; j += 4) | for(int j = 0; j < m_nWidth * m_nHeight * 4; j += 4) | |||
{ | { | |||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( src[j], src[j + 1], | *tmp++ = CC_RGB_PREMULTIPLY_ALPHA( src[j], src[j + 1], | |||
src[j + 2], src[j + 3] ); | src[j + 2], src[j + 3] ); | |||
} | } | |||
*/ | */ | |||
m_bPreMulti = true; | m_bPreMulti = true; | |||
memcpy(m_pData, raster, npixels*sizeof (uint32)); | memcpy(m_pData, raster, npixels*sizeof (uint32)); | |||
} | } | |||
_TIFFfree(raster); | _TIFFfree(raster); | |||
} | } | |||
skipping to change at line 585 | skipping to change at line 585 | |||
bool bRet = false; | bool bRet = false; | |||
do | do | |||
{ | { | |||
CC_BREAK_IF(0 == nWidth || 0 == nHeight); | CC_BREAK_IF(0 == nWidth || 0 == nHeight); | |||
m_nBitsPerComponent = nBitsPerComponent; | m_nBitsPerComponent = nBitsPerComponent; | |||
m_nHeight = (short)nHeight; | m_nHeight = (short)nHeight; | |||
m_nWidth = (short)nWidth; | m_nWidth = (short)nWidth; | |||
m_bHasAlpha = true; | m_bHasAlpha = true; | |||
// only RGBA8888 surported | // only RGBA8888 supported | |||
int nBytesPerComponent = 4; | int nBytesPerComponent = 4; | |||
int nSize = nHeight * nWidth * nBytesPerComponent; | int nSize = nHeight * nWidth * nBytesPerComponent; | |||
m_pData = new unsigned char[nSize]; | m_pData = new unsigned char[nSize]; | |||
CC_BREAK_IF(! m_pData); | CC_BREAK_IF(! m_pData); | |||
memcpy(m_pData, pData, nSize); | memcpy(m_pData, pData, nSize); | |||
bRet = true; | bRet = true; | |||
} while (0); | } while (0); | |||
return bRet; | return bRet; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
CCInvocation.h | CCInvocation.h | |||
---|---|---|---|---|
/* | /* | |||
* Copyright (c) 2012 cocos2d-x.org | ||||
* http://www.cocos2d-x.org | ||||
* | ||||
* Permission is hereby granted, free of charge, to any person obtaining a | ||||
copy | ||||
* of this software and associated documentation files (the "Software"), to | ||||
deal | ||||
* in the Software without restriction, including without limitation the ri | ||||
ghts | ||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel | ||||
l | ||||
* copies of the Software, and to permit persons to whom the Software is | ||||
* furnished to do so, subject to the following conditions: | ||||
* | ||||
* The above copyright notice and this permission notice shall be included | ||||
in | ||||
* all copies or substantial portions of the Software. | ||||
* | ||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||
OR | ||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||||
THE | ||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
FROM, | ||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I | ||||
N | ||||
* THE SOFTWARE. | ||||
* | ||||
* | ||||
* Converted to c++ / cocos2d-x by Angus C | ||||
*/ | ||||
/* | ||||
* | * | |||
* Helper class to store targets and selectors (and eventually, params?) in the same CCMutableArray. Basically a very crude form of a NSInvocation | * Helper class to store targets and selectors (and eventually, params?) in the same CCMutableArray. Basically a very crude form of a NSInvocation | |||
*/ | */ | |||
#ifndef __CCINVOCATION_H__ | #ifndef __CCINVOCATION_H__ | |||
#define __CCINVOCATION_H__ | #define __CCINVOCATION_H__ | |||
#include "cocoa/CCObject.h" | #include "cocoa/CCObject.h" | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
typedef unsigned int CCControlEvent; | typedef unsigned int CCControlEvent; | |||
typedef void (cocos2d::CCObject::*SEL_CCControlHandler)(cocos2d::CCObject*, CCControlEvent); | typedef void (CCObject::*SEL_CCControlHandler)(CCObject*, CCControlEvent); | |||
#define cccontrol_selector(_SELECTOR) (SEL_CCControlHandler)(&_SELECTOR) | #define cccontrol_selector(_SELECTOR) (SEL_CCControlHandler)(&_SELECTOR) | |||
class CCInvocation : public cocos2d::CCObject | class CCInvocation : public CCObject | |||
{ | { | |||
CC_SYNTHESIZE_READONLY(SEL_CCControlHandler, m_action, Action); | CC_SYNTHESIZE_READONLY(SEL_CCControlHandler, m_action, Action); | |||
CC_SYNTHESIZE_READONLY(CCObject*, m_target, Target); | CC_SYNTHESIZE_READONLY(CCObject*, m_target, Target); | |||
CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent); | CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent); | |||
public: | public: | |||
CCInvocation(cocos2d::CCObject* target, SEL_CCControlHandler action, CC | static CCInvocation* create(CCObject* target, SEL_CCControlHandler acti | |||
ControlEvent controlEvent); | on, CCControlEvent controlEvent); | |||
CCInvocation(CCObject* target, SEL_CCControlHandler action, CCControlEv | ||||
ent controlEvent); | ||||
void invoke(cocos2d::CCObject* sender); | void invoke(CCObject* sender); | |||
}; | }; | |||
// end of GUI group | // end of GUI group | |||
/// @} | /// @} | |||
/// @} | /// @} | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 42 lines changed or added | |||
CCKeypadDelegate.h | CCKeypadDelegate.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
* @addtogroup input | * @addtogroup input | |||
* @{ | * @{ | |||
*/ | */ | |||
class CC_DLL CCKeypadDelegate | class CC_DLL CCKeypadDelegate | |||
{ | { | |||
public: | public: | |||
// The back key clicked | // The back key clicked | |||
virtual void keyBackClicked() {} | virtual void keyBackClicked() {} | |||
// The menu key clicked. only avialble on wophone & android | // The menu key clicked. only available on wophone & android | |||
virtual void keyMenuClicked() {}; | virtual void keyMenuClicked() {}; | |||
}; | }; | |||
/** | /** | |||
@brief | @brief | |||
CCKeypadHandler | CCKeypadHandler | |||
Object than contains the CCKeypadDelegate. | Object than contains the CCKeypadDelegate. | |||
*/ | */ | |||
class CC_DLL CCKeypadHandler : public CCObject | class CC_DLL CCKeypadHandler : public CCObject | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCLabelAtlas.h | CCLabelAtlas.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCLabelBMFont.h | CCLabelBMFont.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 95 | skipping to change at line 95 | |||
int right; | int right; | |||
/// padding bottom | /// padding bottom | |||
int bottom; | int bottom; | |||
} ccBMFontPadding; | } ccBMFontPadding; | |||
/** @brief CCBMFontConfiguration has parsed configuration of the the .fnt f ile | /** @brief CCBMFontConfiguration has parsed configuration of the the .fnt f ile | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
class CC_DLL CCBMFontConfiguration : public CCObject | class CC_DLL CCBMFontConfiguration : public CCObject | |||
{ | { | |||
// XXX: Creating a public interface so that the bitmapFontArray[] is ac cesible | // XXX: Creating a public interface so that the bitmapFontArray[] is ac cessible | |||
public://@public | public://@public | |||
// BMFont definitions | // BMFont definitions | |||
struct _FontDefHashElement* m_pFontDefDictionary; | struct _FontDefHashElement* m_pFontDefDictionary; | |||
//! FNTConfig: Common Height Should be signed (issue #1343) | //! FNTConfig: Common Height Should be signed (issue #1343) | |||
int m_nCommonHeight; | int m_nCommonHeight; | |||
//! Padding | //! Padding | |||
ccBMFontPadding m_tPadding; | ccBMFontPadding m_tPadding; | |||
//! atlas name | //! atlas name | |||
std::string m_sAtlasName; | std::string m_sAtlasName; | |||
skipping to change at line 144 | skipping to change at line 144 | |||
}; | }; | |||
/** @brief CCLabelBMFont is a subclass of CCSpriteSheet. | /** @brief CCLabelBMFont is a subclass of CCSpriteSheet. | |||
Features: | Features: | |||
- Treats each character like a CCSprite. This means that each individual ch aracter can be: | - Treats each character like a CCSprite. This means that each individual ch aracter can be: | |||
- rotated | - rotated | |||
- scaled | - scaled | |||
- translated | - translated | |||
- tinted | - tinted | |||
- chage the opacity | - change the opacity | |||
- It can be used as part of a menu item. | - It can be used as part of a menu item. | |||
- anchorPoint can be used to align the "label" | - anchorPoint can be used to align the "label" | |||
- Supports AngelCode text format | - Supports AngelCode text format | |||
Limitations: | Limitations: | |||
- All inner characters are using an anchorPoint of (0.5f, 0.5f) and it is n ot recommend to change it | - All inner characters are using an anchorPoint of (0.5f, 0.5f) and it is n ot recommend to change it | |||
because it might affect the rendering | because it might affect the rendering | |||
CCLabelBMFont implements the protocol CCLabelProtocol, like CCLabel and CCL abelAtlas. | CCLabelBMFont implements the protocol CCLabelProtocol, like CCLabel and CCL abelAtlas. | |||
CCLabelBMFont has the flexibility of CCLabel, the speed of CCLabelAtlas and all the features of CCSprite. | CCLabelBMFont has the flexibility of CCLabel, the speed of CCLabelAtlas and all the features of CCSprite. | |||
skipping to change at line 204 | skipping to change at line 204 | |||
CCPoint m_tImageOffset; | CCPoint m_tImageOffset; | |||
public: | public: | |||
CCLabelBMFont(); | CCLabelBMFont(); | |||
virtual ~CCLabelBMFont(); | virtual ~CCLabelBMFont(); | |||
/** Purges the cached data. | /** Purges the cached data. | |||
Removes from memory the cached configurations and the atlas name dictio nary. | Removes from memory the cached configurations and the atlas name dictio nary. | |||
@since v0.99.3 | @since v0.99.3 | |||
*/ | */ | |||
static void purgeCachedData(); | static void purgeCachedData(); | |||
/** creates a bitmap font altas 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 altas 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 | static CCLabelBMFont * create(const char *str, const char *fntFile, flo | |||
at width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlign | at width, CCTextAlignment alignment, CCPoint imageOffset); | |||
mentLeft, CCPoint imageOffset = CCPointZero); | ||||
static CCLabelBMFont * create(const char *str, const char *fntFile, | ||||
float width, CCTextAlignment alignment) { | ||||
return CCLabelBMFont::create(str, fntFile, width, alignment, | ||||
CCPointZero); | ||||
} | ||||
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(); | |||
bool init(); | bool init(); | |||
/** init a bitmap font altas with an initial string and the FNT file */ | /** init a bitmap font atlas with an initial string and the FNT file */ | |||
bool initWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero); | bool initWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero); | |||
/** updates the font chars based on the string to render */ | /** updates the font chars based on the string to render */ | |||
void createFontChars(); | void createFontChars(); | |||
// super method | // super method | |||
virtual void setString(const char *label); | virtual void setString(const char *label); | |||
virtual void setString(const char *label, bool fromUpdate); | virtual void setString(const char *label, bool fromUpdate); | |||
virtual void updateString(bool fromUpdate); | virtual void updateString(bool fromUpdate); | |||
virtual const char* getString(void); | virtual const char* getString(void); | |||
virtual void setCString(const char *label); | virtual void setCString(const char *label); | |||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 27 lines changed or added | |||
CCLabelTTF.h | CCLabelTTF.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCLayer.h | CCLayer.h | |||
---|---|---|---|---|
skipping to change at line 122 | skipping to change at line 122 | |||
*/ | */ | |||
bool isAccelerometerEnabled(); | bool isAccelerometerEnabled(); | |||
void setAccelerometerEnabled(bool value); | void setAccelerometerEnabled(bool value); | |||
/** 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; }; | ||||
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 excuteScriptTouchHandler(int nEventType, CCTouch *pTouch); | int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch); | |||
int excuteScriptTouchHandler(int nEventType, CCSet *pTouches); | int excuteScriptTouchHandler(int nEventType, CCSet *pTouches); | |||
skipping to change at line 150 | skipping to change at line 151 | |||
- opacity | - opacity | |||
- RGB colors | - RGB colors | |||
*/ | */ | |||
class CC_DLL CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol | class CC_DLL CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol | |||
{ | { | |||
protected: | protected: | |||
ccVertex2F m_pSquareVertices[4]; | ccVertex2F m_pSquareVertices[4]; | |||
ccColor4F m_pSquareColors[4]; | ccColor4F m_pSquareColors[4]; | |||
public: | public: | |||
CCLayerColor(); | CCLayerColor(); | |||
virtual ~CCLayerColor(); | virtual ~CCLayerColor(); | |||
virtual void draw(); | virtual void draw(); | |||
virtual void setContentSize(const CCSize & var); | virtual void setContentSize(const CCSize & var); | |||
/** 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); | |||
skipping to change at line 228 | skipping to change at line 228 | |||
non-cardinal vectors; a smooth gradient implying both end points will be st ill | non-cardinal vectors; a smooth gradient implying both end points will be st ill | |||
be drawn, however. | be drawn, however. | |||
If ' compressedInterpolation' is enabled (default mode) you will see both t he start and end colors of the gradient. | If ' compressedInterpolation' is enabled (default mode) you will see both t he start and end colors of the gradient. | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
class CC_DLL CCLayerGradient : public CCLayerColor | class CC_DLL CCLayerGradient : public CCLayerColor | |||
{ | { | |||
public: | public: | |||
/** Creates a full-screen CCLayer with a gradient between start and end . | /** Creates a full-screen CCLayer with a gradient between start and end . | |||
@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); | CC_DEPRECATED_ATTRIBUTE static CCLayerGradient* layerWithColor(const cc Color4B& 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. | |||
@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); | |||
skipping to change at line 283 | skipping to change at line 284 | |||
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 | |||
{ | { | |||
protected: | protected: | |||
unsigned int m_nEnabledLayer; | unsigned int m_nEnabledLayer; | |||
CCArray* m_pLayers; | CCArray* m_pLayers; | |||
public: | public: | |||
CCLayerMultiplex(); | CCLayerMultiplex(); | |||
virtual ~CCLayerMultiplex(); | virtual ~CCLayerMultiplex(); | |||
/** creates a CCLayerMultiplex with one or more layers using a variable argument list. | /** creates a CCLayerMultiplex with one or more layers using a variable argument list. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayers(CCLay er* layer, ... ); | CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayers(CCLay er* layer, ... ); | |||
/** | /** | |||
* lua script can not init with undetermined number of variables | * lua script can not init with undetermined number of variables | |||
* so add these functinons to be used with lua. | * so add these functions to be used with lua. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayer(CCLaye r* layer); | CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayer(CCLaye r* layer); | |||
/** creates a CCLayerMultiplex with one or more layers using a variable argument list. */ | /** creates a CCLayerMultiplex with one or more layers using a variable argument list. */ | |||
static CCLayerMultiplex * create(CCLayer* layer, ... ); | static CCLayerMultiplex * create(CCLayer* layer, ... ); | |||
/** | /** | |||
* lua script can not init with undetermined number of variables | * lua script can not init with undetermined number of variables | |||
* so add these functinons to be used with lua. | * so add these functions to be used with lua. | |||
*/ | */ | |||
static CCLayerMultiplex * createWithLayer(CCLayer* layer); | static CCLayerMultiplex * createWithLayer(CCLayer* layer); | |||
void addLayer(CCLayer* layer); | void addLayer(CCLayer* layer); | |||
/** initializes a MultiplexLayer with one or more layers using a variab le argument list. */ | /** initializes a MultiplexLayer with one or more layers using a variab le argument list. */ | |||
bool initWithLayers(CCLayer* layer, va_list params); | bool initWithLayers(CCLayer* layer, va_list params); | |||
/** 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'. | |||
*/ | */ | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
CCLuaEngine.h | CCLuaEngine.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#include "ccTypes.h" | #include "ccTypes.h" | |||
#include "cocoa/CCObject.h" | #include "cocoa/CCObject.h" | |||
#include "touch_dispatcher/CCTouch.h" | #include "touch_dispatcher/CCTouch.h" | |||
#include "cocoa/CCSet.h" | #include "cocoa/CCSet.h" | |||
#include "base_nodes/CCNode.h" | #include "base_nodes/CCNode.h" | |||
#include "script_support/CCScriptSupport.h" | #include "script_support/CCScriptSupport.h" | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
// Lua support for cocos2d-x | typedef int LUA_FUNCTION; | |||
class CCLuaEngine : public CCScriptEngineProtocol | typedef int LUA_TABLE; | |||
typedef int LUA_STRING; | ||||
class CCLuaValue; | ||||
typedef std::map<std::string, CCLuaValue> CCLuaValueDict; | ||||
typedef CCLuaValueDict::const_iterator CCLuaValueDictIterator; | ||||
typedef std::list<CCLuaValue> CCLuaValueArray; | ||||
typedef CCLuaValueArray::const_iterator CCLuaValueArrayIterator; | ||||
typedef enum { | ||||
CCLuaValueTypeInt, | ||||
CCLuaValueTypeFloat, | ||||
CCLuaValueTypeBoolean, | ||||
CCLuaValueTypeString, | ||||
CCLuaValueTypeDict, | ||||
CCLuaValueTypeArray, | ||||
CCLuaValueTypeCCObject | ||||
} CCLuaValueType; | ||||
typedef union { | ||||
int intValue; | ||||
float floatValue; | ||||
bool booleanValue; | ||||
std::string* stringValue; | ||||
CCLuaValueDict* dictValue; | ||||
CCLuaValueArray* arrayValue; | ||||
CCObject* ccobjectValue; | ||||
} CCLuaValueField; | ||||
class CCLuaValue | ||||
{ | { | |||
public: | public: | |||
~CCLuaEngine(); | static const CCLuaValue intValue(const int intValue); | |||
static const CCLuaValue floatValue(const float floatValue); | ||||
static const CCLuaValue booleanValue(const bool booleanValue); | ||||
static const CCLuaValue stringValue(const char* stringValue); | ||||
static const CCLuaValue stringValue(const std::string& stringValue); | ||||
static const CCLuaValue dictValue(const CCLuaValueDict& dictValue); | ||||
static const CCLuaValue arrayValue(const CCLuaValueArray& arrayValue); | ||||
static const CCLuaValue ccobjectValue(CCObject* ccobjectValue, const ch | ||||
ar* objectTypename); | ||||
static const CCLuaValue ccobjectValue(CCObject* ccobjectValue, const st | ||||
d::string& objectTypename); | ||||
CCLuaValue(void) | ||||
: m_type(CCLuaValueTypeInt) | ||||
, m_ccobjectType(NULL) | ||||
{ | ||||
memset(&m_field, 0, sizeof(m_field)); | ||||
} | ||||
CCLuaValue(const CCLuaValue& rhs); | ||||
CCLuaValue& operator=(const CCLuaValue& rhs); | ||||
~CCLuaValue(void); | ||||
/** | const CCLuaValueType getType(void) const { | |||
@brief Method used to get a pointer to the lua_State that the script m | return m_type; | |||
odule is attached to. | } | |||
@return A pointer to the lua_State that the script module is attached | ||||
to. | const std::string& getCCObjectTypename(void) const { | |||
*/ | return *m_ccobjectType; | |||
virtual lua_State* getLuaState(void) { | } | |||
return m_state; | ||||
int intValue(void) const { | ||||
return m_field.intValue; | ||||
} | ||||
float floatValue(void) const { | ||||
return m_field.floatValue; | ||||
} | ||||
bool booleanValue(void) const { | ||||
return m_field.booleanValue; | ||||
} | ||||
const std::string& stringValue(void) const { | ||||
return *m_field.stringValue; | ||||
} | ||||
const CCLuaValueDict& dictValue(void) const { | ||||
return *m_field.dictValue; | ||||
} | ||||
const CCLuaValueArray& arrayValue(void) const { | ||||
return *m_field.arrayValue; | ||||
} | } | |||
CCObject* ccobjectValue(void) const { | ||||
return m_field.ccobjectValue; | ||||
} | ||||
private: | ||||
CCLuaValueField m_field; | ||||
CCLuaValueType m_type; | ||||
std::string* m_ccobjectType; | ||||
void copy(const CCLuaValue& rhs); | ||||
}; | ||||
// Lua support for cocos2d-x | ||||
class CCLuaEngine : public CCScriptEngineProtocol | ||||
{ | ||||
public: | ||||
static CCLuaEngine* defaultEngine(void); | ||||
static CCLuaEngine* create(void); | ||||
virtual ~CCLuaEngine(void); | ||||
virtual ccScriptType getScriptType() { | ||||
return kScriptTypeLua; | ||||
}; | ||||
/** | /** | |||
@brief Remove CCObject from lua state | @brief Remove CCObject from lua state | |||
@param object to remove | @param object to remove | |||
*/ | */ | |||
virtual void removeCCObjectByID(int nLuaID); | virtual void removeScriptObjectByCCObject(CCObject* pObj); | |||
/** | /** | |||
@brief Remove Lua function reference | @brief Remove Lua function reference | |||
*/ | */ | |||
virtual void removeLuaHandler(int nHandler); | virtual void removeScriptHandler(int nHandler); | |||
/** | /** | |||
@brief Add a path to find lua files in | @brief Add a path to find lua files in | |||
@param path to be added to the Lua path | @param path to be added to the Lua path | |||
*/ | */ | |||
virtual void addSearchPath(const char* path); | virtual void addSearchPath(const char* path); | |||
/** | /** | |||
@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. | |||
skipping to change at line 94 | skipping to change at line 190 | |||
virtual int executeScriptFile(const char* filename); | virtual int executeScriptFile(const char* filename); | |||
/** | /** | |||
@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. | |||
@param functionName String object holding the name of the function, in the global script environment, that is to be executed. | @param functionName String object holding the name of the function, in the global script environment, that is to be executed. | |||
@return The integer value returned from the script function. | @return The integer value returned from the script function. | |||
*/ | */ | |||
virtual int executeGlobalFunction(const char* functionName); | virtual int executeGlobalFunction(const char* functionName); | |||
virtual int executeNodeEvent(CCNode* pNode, int nAction); | ||||
virtual int executeMenuItemEvent(CCMenuItem* pMenuItem); | ||||
virtual int executeNotificationEvent(CCNotificationCenter* pNotificatio | ||||
nCenter, const char* pszName); | ||||
virtual int executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* p | ||||
Target = NULL); | ||||
virtual int executeSchedule(CCTimer* pTimer, float dt, CCNode* pNode = | ||||
NULL); | ||||
virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CC | ||||
Set *pTouches); | ||||
virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTo | ||||
uch *pTouch); | ||||
/** | /** | |||
@brief Execute a function by ref id | @brief Method used to get a pointer to the lua_State that the script m | |||
@param The function ref id | odule is attached to. | |||
@param Number of parameters | @return A pointer to the lua_State that the script module is attached | |||
@return The integer value returned from the script function. | to. | |||
*/ | */ | |||
virtual int executeFunctionByHandler(int nHandler, int numArgs = 0); | lua_State* getLuaState(void) { | |||
virtual int executeFunctionWithIntegerData(int nHandler, int data); | return m_state; | |||
virtual int executeFunctionWithFloatData(int nHandler, float data); | } | |||
virtual int executeFunctionWithBooleanData(int nHandler, bool data); | ||||
virtual int executeFunctionWithCCObject(int nHandler, CCObject* pObject | ||||
, const char* typeName); | ||||
virtual int pushIntegerToLuaStack(int data); | ||||
virtual int pushFloatToLuaStack(int data); | ||||
virtual int pushBooleanToLuaStack(int data); | ||||
virtual int pushCCObjectToLuaStack(CCObject* pObject, const char* typeN | ||||
ame); | ||||
// functions for excute touch event | ||||
virtual int executeTouchEvent(int nHandler, int eventType, cocos2d::CCT | ||||
ouch *pTouch); | ||||
virtual int executeTouchesEvent(int nHandler, int eventType, cocos2d::C | ||||
CSet *pTouches); | ||||
// execute a schedule function | int pushInt(int data); | |||
virtual int executeSchedule(int nHandler, float dt); | int pushFloat(float data); | |||
int pushBoolean(bool data); | ||||
int pushString(const char* data); | ||||
int pushString(const char* data, int length); | ||||
int pushNil(void); | ||||
int pushCCObject(CCObject* pObject, const char* typeName); | ||||
int pushCCLuaValue(const CCLuaValue& value); | ||||
int pushCCLuaValueDict(const CCLuaValueDict& dict); | ||||
int pushCCLuaValueArray(const CCLuaValueArray& array); | ||||
int executeFunctionByHandler(int nHandler, int numArgs); | ||||
void cleanStack(void); | ||||
// Add lua loader, now it is used on android | // Add lua loader, now it is used on android | |||
virtual void addLuaLoader(lua_CFunction func); | void addLuaLoader(lua_CFunction func); | |||
static CCLuaEngine* engine(); | ||||
private: | private: | |||
CCLuaEngine(void) | CCLuaEngine(void) | |||
: m_state(NULL) | : m_state(NULL) | |||
{ | { | |||
} | } | |||
bool init(void); | bool init(void); | |||
bool pushFunctionByHandler(int nHandler); | bool pushFunction(int nHandler); | |||
lua_State* m_state; | lua_State* m_state; | |||
static CCLuaEngine* m_defaultEngine; | ||||
}; | }; | |||
NS_CC_END | NS_CC_END | |||
#endif // __CC_LUA_ENGINE_H__ | #endif // __CC_LUA_ENGINE_H__ | |||
End of changes. 13 change blocks. | ||||
40 lines changed or deleted | 144 lines changed or added | |||
CCMenu.h | CCMenu.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
enum { | enum { | |||
//* priority used by the menu for the event handler | //* priority used by the menu for the event handler | |||
kCCMenuHandlerPriority = -128, | kCCMenuHandlerPriority = -128, | |||
}; | }; | |||
/** @brief A CCMenu | /** @brief A CCMenu | |||
* | * | |||
* Features and Limitation: | * Features and Limitation: | |||
* - You can add MenuItem objects in runtime using addChild: | * - You can add MenuItem objects in runtime using addChild: | |||
* - But the only accecpted children are MenuItem objects | * - But the only accepted children are MenuItem objects | |||
*/ | */ | |||
class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol | class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol | |||
{ | { | |||
/** Color: conforms with CCRGBAProtocol protocol */ | /** Color: conforms with CCRGBAProtocol protocol */ | |||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | |||
/** Opacity: conforms with CCRGBAProtocol protocol */ | /** Opacity: conforms with CCRGBAProtocol protocol */ | |||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | |||
/** whether or not the menu will receive events */ | /** whether or not the menu will receive events */ | |||
bool m_bEnabled; | bool m_bEnabled; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCMenuItem.h | CCMenuItem.h | |||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
*/ | */ | |||
bool m_bIsSelected; | bool m_bIsSelected; | |||
bool m_bIsEnabled; | bool m_bIsEnabled; | |||
public: | public: | |||
CCMenuItem() | CCMenuItem() | |||
: m_bIsSelected(false) | : m_bIsSelected(false) | |||
, m_bIsEnabled(false) | , m_bIsEnabled(false) | |||
, m_pListener(NULL) | , m_pListener(NULL) | |||
, m_pfnSelector(NULL) | , m_pfnSelector(NULL) | |||
, m_nScriptHandler(0) | , m_nScriptTapHandler(0) | |||
{} | {} | |||
virtual ~CCMenuItem(); | virtual ~CCMenuItem(); | |||
/** Creates a CCMenuItem with a target/selector | /** Creates a CCMenuItem with a target/selector | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItem * itemWithTarget(CCObject *re c, SEL_MenuHandler selector); | CC_DEPRECATED_ATTRIBUTE static CCMenuItem * itemWithTarget(CCObject *re c, SEL_MenuHandler selector); | |||
/** Creates a CCMenuItem with no target/selector */ | ||||
static CCMenuItem* create(); | ||||
/** Creates a CCMenuItem with a target/selector */ | /** Creates a CCMenuItem with a target/selector */ | |||
static CCMenuItem * create(CCObject *rec, SEL_MenuHandler selector); | static CCMenuItem* create(CCObject *rec, SEL_MenuHandler selector); | |||
/** Initializes a CCMenuItem with a target/selector */ | /** Initializes a CCMenuItem with a target/selector */ | |||
bool initWithTarget(CCObject *rec, SEL_MenuHandler selector); | bool initWithTarget(CCObject *rec, SEL_MenuHandler selector); | |||
/** Returns the outside box */ | /** Returns the outside box */ | |||
CCRect rect(); | CCRect rect(); | |||
/** Activate the item */ | /** Activate the item */ | |||
virtual void activate(); | virtual void activate(); | |||
/** The item was selected (not activated), similar to "mouse-over" */ | /** The item was selected (not activated), similar to "mouse-over" */ | |||
virtual void selected(); | virtual void selected(); | |||
/** The item was unselected */ | /** The item was unselected */ | |||
virtual void unselected(); | virtual void unselected(); | |||
/** Register menu handler script function */ | /** Register menu handler script function */ | |||
virtual void registerScriptHandler(int nHandler); | virtual void registerScriptTapHandler(int nHandler); | |||
virtual void unregisterScriptHandler(void); | virtual void unregisterScriptTapHandler(void); | |||
int getScriptTapHandler() { return m_nScriptTapHandler; }; | ||||
virtual bool isEnabled(); | virtual bool isEnabled(); | |||
//@note: It's 'setIsEnable' in cocos2d-iphone. | //@note: It's 'setIsEnable' in cocos2d-iphone. | |||
virtual void setEnabled(bool value); | virtual void setEnabled(bool value); | |||
virtual bool isSelected(); | virtual bool isSelected(); | |||
/** set the target/selector of the menu item*/ | /** set the target/selector of the menu item*/ | |||
void setTarget(CCObject *rec, SEL_MenuHandler selector); | void setTarget(CCObject *rec, SEL_MenuHandler selector); | |||
protected: | protected: | |||
CCObject* m_pListener; | CCObject* m_pListener; | |||
SEL_MenuHandler m_pfnSelector; | SEL_MenuHandler m_pfnSelector; | |||
int m_nScriptHandler; | int m_nScriptTapHandler; | |||
}; | }; | |||
/** @brief An abstract class for "label" CCMenuItemLabel items | /** @brief An abstract class for "label" CCMenuItemLabel items | |||
Any CCNode that supports the CCLabelProtocol protocol can be added. | Any CCNode that supports the CCLabelProtocol protocol can be added. | |||
Supported nodes: | Supported nodes: | |||
- CCBitmapFontAtlas | - CCBitmapFontAtlas | |||
- CCLabelAtlas | - CCLabelAtlas | |||
- CCLabelTTF | - CCLabelTTF | |||
*/ | */ | |||
class CC_DLL CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol | class CC_DLL CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol | |||
skipping to change at line 128 | skipping to change at line 132 | |||
public: | public: | |||
CCMenuItemLabel() | CCMenuItemLabel() | |||
: m_pLabel(NULL) | : m_pLabel(NULL) | |||
, m_fOriginalScale(0.0) | , m_fOriginalScale(0.0) | |||
{} | {} | |||
virtual ~CCMenuItemLabel(); | virtual ~CCMenuItemLabel(); | |||
/** creates a CCMenuItemLabel with a Label, target and selector | /** creates a CCMenuItemLabel with a Label, target and selector | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel * itemWithLabel(CCNode*l abel, CCObject* target, SEL_MenuHandler selector); | CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel * itemWithLabel(CCNode*l abel, CCObject* target, SEL_MenuHandler selector); | |||
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill | /** creates a CCMenuItemLabel with a Label. Target and selector will be nil | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel* itemWithLabel(CCNode *l abel); | CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel* itemWithLabel(CCNode *l abel); | |||
/** creates a CCMenuItemLabel with a Label, target and selector */ | /** creates a CCMenuItemLabel with a Label, target and selector */ | |||
static CCMenuItemLabel * create(CCNode*label, CCObject* target, SEL_Men uHandler selector); | static CCMenuItemLabel * create(CCNode*label, CCObject* target, SEL_Men uHandler selector); | |||
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill */ | /** creates a CCMenuItemLabel with a Label. Target and selector will be nil */ | |||
static CCMenuItemLabel* create(CCNode *label); | static CCMenuItemLabel* create(CCNode *label); | |||
/** initializes a CCMenuItemLabel with a Label, target and selector */ | /** initializes a CCMenuItemLabel with a Label, target and selector */ | |||
bool initWithLabel(CCNode* label, CCObject* target, SEL_MenuHandler sel ector); | bool initWithLabel(CCNode* label, CCObject* target, SEL_MenuHandler sel ector); | |||
/** sets a new string to the inner label */ | /** sets a new string to the inner label */ | |||
void setString(const char * label); | void setString(const char * label); | |||
// super methods | // super methods | |||
virtual void activate(); | virtual void activate(); | |||
virtual void selected(); | virtual void selected(); | |||
virtual void unselected(); | virtual void unselected(); | |||
skipping to change at line 367 | skipping to change at line 371 | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItemImage* node(); | CC_DEPRECATED_ATTRIBUTE static CCMenuItemImage* node(); | |||
/** Creates an CCMenuItemImage. | /** Creates an CCMenuItemImage. | |||
*/ | */ | |||
static CCMenuItemImage* create(); | static CCMenuItemImage* create(); | |||
}; | }; | |||
/** @brief A CCMenuItemToggle | /** @brief A CCMenuItemToggle | |||
A simple container class that "toggles" it's inner items | A simple container class that "toggles" it's inner items | |||
The inner itmes can be any MenuItem | The inner items can be any MenuItem | |||
*/ | */ | |||
class CC_DLL CCMenuItemToggle : public CCMenuItem, public CCRGBAProtocol | class CC_DLL CCMenuItemToggle : public CCMenuItem, public CCRGBAProtocol | |||
{ | { | |||
/** conforms with CCRGBAProtocol protocol */ | /** conforms with CCRGBAProtocol protocol */ | |||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | CC_PROPERTY(GLubyte, m_cOpacity, Opacity); | |||
/** conforms with CCRGBAProtocol protocol */ | /** conforms with CCRGBAProtocol protocol */ | |||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color); | |||
/** returns the selected item */ | /** returns the selected item */ | |||
CC_PROPERTY(unsigned int, m_uSelectedIndex, SelectedIndex); | CC_PROPERTY(unsigned int, m_uSelectedIndex, SelectedIndex); | |||
/** CCMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one. | /** CCMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one. | |||
skipping to change at line 397 | skipping to change at line 401 | |||
virtual ~CCMenuItemToggle(); | virtual ~CCMenuItemToggle(); | |||
/** creates a menu item from a list of items with a target/selector | /** creates a menu item from a list of items with a target/selector | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithTarget(CCObjec t* target, SEL_MenuHandler selector, CCMenuItem* item, ...); | CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithTarget(CCObjec t* target, SEL_MenuHandler selector, CCMenuItem* item, ...); | |||
/** creates a menu item from a list of items with a target/selector */ | /** creates a menu item from a list of items with a target/selector */ | |||
static CCMenuItemToggle* createWithTarget(CCObject* target, SEL_MenuHan dler selector, CCMenuItem* item, ...); | static CCMenuItemToggle* createWithTarget(CCObject* target, SEL_MenuHan dler selector, CCMenuItem* item, ...); | |||
/** creates a menu item with no target/selector and no items */ | ||||
static CCMenuItemToggle* create(); | ||||
/** initializes a menu item from a list of items with a target selector */ | /** initializes a menu item from a list of items with a target selector */ | |||
bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuI tem* item, va_list args); | bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuI tem* item, va_list args); | |||
// The follow methods offered to lua | // The follow methods offered to lua | |||
/** creates a menu item with a item | /** creates a menu item with a item | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithItem(CCMenuIte m *item); | CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithItem(CCMenuIte m *item); | |||
/** creates a menu item with a item */ | /** creates a menu item with a item */ | |||
End of changes. 10 change blocks. | ||||
8 lines changed or deleted | 15 lines changed or added | |||
CCMotionStreak.h | CCMotionStreak.h | |||
---|---|---|---|---|
skipping to change at line 90 | skipping to change at line 90 | |||
virtual void setTexture(CCTexture2D *texture); | virtual void setTexture(CCTexture2D *texture); | |||
virtual void setBlendFunc(ccBlendFunc blendFunc); | virtual void setBlendFunc(ccBlendFunc blendFunc); | |||
virtual ccBlendFunc getBlendFunc(void); | virtual ccBlendFunc getBlendFunc(void); | |||
virtual void setColor(const ccColor3B& color); | virtual void setColor(const ccColor3B& color); | |||
virtual const ccColor3B& getColor(void); | virtual const ccColor3B& getColor(void); | |||
virtual GLubyte getOpacity(void); | virtual GLubyte getOpacity(void); | |||
virtual void setOpacity(GLubyte opacity); | virtual void setOpacity(GLubyte opacity); | |||
virtual void setOpacityModifyRGB(bool bValue); | virtual void setOpacityModifyRGB(bool bValue); | |||
virtual bool isOpacityModifyRGB(void); | virtual bool isOpacityModifyRGB(void); | |||
/** When fast mode is enbled, new points are added faster but with lowe r precision */ | /** When fast mode is enabled, new points are added faster but with low er precision */ | |||
inline bool isFastMode() { return m_bFastMode; } | inline bool isFastMode() { return m_bFastMode; } | |||
inline void setFastMode(bool bFastMode) { m_bFastMode = bFastMode; } | inline void setFastMode(bool bFastMode) { m_bFastMode = bFastMode; } | |||
inline bool isStartingPositionInitialized() { return m_bStartingPositio nInitialized; } | inline bool isStartingPositionInitialized() { return m_bStartingPositio nInitialized; } | |||
inline void setStartingPositionInitialized(bool bStartingPositionInitia lized) | inline void setStartingPositionInitialized(bool bStartingPositionInitia lized) | |||
{ | { | |||
m_bStartingPositionInitialized = bStartingPositionInitialized; | m_bStartingPositionInitialized = bStartingPositionInitialized; | |||
} | } | |||
protected: | protected: | |||
bool m_bFastMode; | bool m_bFastMode; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCNode.h | CCNode.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
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. | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
#ifndef __PLATFOMR_CCNODE_H__ | #ifndef __PLATFORM_CCNODE_H__ | |||
#define __PLATFOMR_CCNODE_H__ | #define __PLATFORM_CCNODE_H__ | |||
#include "ccMacros.h" | #include "ccMacros.h" | |||
#include "cocoa/CCAffineTransform.h" | #include "cocoa/CCAffineTransform.h" | |||
#include "cocoa/CCArray.h" | #include "cocoa/CCArray.h" | |||
#include "CCGL.h" | #include "CCGL.h" | |||
#include "shaders/ccGLStateCache.h" | #include "shaders/ccGLStateCache.h" | |||
#include "shaders/CCGLProgram.h" | #include "shaders/CCGLProgram.h" | |||
#include "kazmath/kazmath.h" | #include "kazmath/kazmath.h" | |||
#include "script_support/CCScriptSupport.h" | ||||
NS_CC_BEGIN | NS_CC_BEGIN | |||
class CCCamera; | class CCCamera; | |||
class CCGridBase; | class CCGridBase; | |||
class CCPoint; | class CCPoint; | |||
class CCTouch; | class CCTouch; | |||
class CCAction; | class CCAction; | |||
class CCRGBAProtocol; | class CCRGBAProtocol; | |||
class CCLabelProtocol; | class CCLabelProtocol; | |||
skipping to change at line 62 | skipping to change at line 63 | |||
* @addtogroup base_nodes | * @addtogroup base_nodes | |||
* @{ | * @{ | |||
*/ | */ | |||
enum { | enum { | |||
kCCNodeTagInvalid = -1, | kCCNodeTagInvalid = -1, | |||
}; | }; | |||
enum { | enum { | |||
kCCNodeOnEnter, | kCCNodeOnEnter, | |||
kCCNodeOnExit | kCCNodeOnExit, | |||
kCCNodeOnEnterTransitionDidFinish, | ||||
kCCNodeOnExitTransitionDidStart | ||||
}; | }; | |||
/** @brief CCNode is the main element. Anything thats gets drawn or contain s 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) | |||
Some CCNode nodes provide extra functionality for them or their children. | Some CCNode nodes provide extra functionality for them or their children. | |||
Subclassing a CCNode usually means (one/all) of: | Subclassing a CCNode usually means (one/all) of: | |||
skipping to change at line 238 | skipping to change at line 241 | |||
*/ | */ | |||
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize) | CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize) | |||
/** whether or not the node is running */ | /** whether or not the node is running */ | |||
bool m_bIsRunning; | bool m_bIsRunning; | |||
bool isRunning(); | bool isRunning(); | |||
/** A weak reference to the parent */ | /** A weak reference to the parent */ | |||
CC_PROPERTY(CCNode *, m_pParent, Parent) | CC_PROPERTY(CCNode *, m_pParent, Parent) | |||
// If ture, the Anchor Point will be (0,0) when you position the CCNode . | // If true, the Anchor Point will be (0,0) when you position the CCNode . | |||
// Used by CCLayer and CCScene | // Used by CCLayer and CCScene | |||
bool m_bIgnoreAnchorPointForPosition; | bool m_bIgnoreAnchorPointForPosition; | |||
bool isIgnoreAnchorPointForPosition(); | bool isIgnoreAnchorPointForPosition(); | |||
void ignoreAnchorPointForPosition(bool isIgnoreAnchorPointForPosition); | void ignoreAnchorPointForPosition(bool isIgnoreAnchorPointForPosition); | |||
/** A tag used to identify the node easily */ | /** A tag used to identify the node easily */ | |||
CC_PROPERTY(int, m_nTag, Tag) | CC_PROPERTY(int, m_nTag, Tag) | |||
/** A custom user data pointer */ | /** A custom user data pointer */ | |||
CC_PROPERTY(void *, m_pUserData, UserData) | CC_PROPERTY(void *, m_pUserData, UserData) | |||
skipping to change at line 277 | skipping to change at line 280 | |||
@since v2.0 | @since v2.0 | |||
*/ | */ | |||
CC_PROPERTY(CCActionManager*, m_pActionManager, ActionManager); | CC_PROPERTY(CCActionManager*, m_pActionManager, ActionManager); | |||
/** CCScheduler used to schedule all "updates" and timers. | /** CCScheduler used to schedule all "updates" and timers. | |||
IMPORTANT: If you set a new CCScheduler, then previously created timer s/update are going to be removed. | IMPORTANT: If you set a new CCScheduler, then previously created timer s/update are going to be removed. | |||
@since v2.0 | @since v2.0 | |||
*/ | */ | |||
CC_PROPERTY(CCScheduler*, m_pScheduler, Scheduler); | CC_PROPERTY(CCScheduler*, m_pScheduler, Scheduler); | |||
inline int getScriptHandler() { return m_nScriptHandler; }; | ||||
protected: | protected: | |||
// transform | // transform | |||
CCAffineTransform m_tTransform, m_tInverse; | CCAffineTransform m_tTransform, m_tInverse; | |||
// To reduce memory, place bools that are not properties here: | // To reduce memory, place bools that are not properties here: | |||
bool m_bIsTransformDirty; | bool m_bIsTransformDirty; | |||
bool m_bIsInverseDirty; | bool m_bIsInverseDirty; | |||
bool m_bReorderChildDirty; | bool m_bReorderChildDirty; | |||
int m_nScriptHandler; | int m_nScriptHandler; | |||
ccScriptType m_eScriptType; | ||||
private: | private: | |||
//! lazy allocs | //! lazy allocs | |||
void childrenAlloc(void); | void childrenAlloc(void); | |||
//! helper that reorder a child | //! helper that reorder a child | |||
void insertChild(CCNode* child, int z); | void insertChild(CCNode* child, int z); | |||
//! used internally to alter the zOrder variable. DON'T call this metho d manually | //! used internally to alter the zOrder variable. DON'T call this metho d manually | |||
void setZOrder(int z); | void setZOrder(int z); | |||
skipping to change at line 321 | skipping to change at line 326 | |||
The node will be created as "autorelease". | The node will be created as "autorelease". | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCNode * node(void); | CC_DEPRECATED_ATTRIBUTE static CCNode * node(void); | |||
/** allocates and initializes a node. | /** allocates and initializes a node. | |||
The node will be created as "autorelease". | The node will be created as "autorelease". | |||
*/ | */ | |||
static CCNode * create(void); | static CCNode * create(void); | |||
//scene managment | //scene management | |||
/** callback that is called every time the CCNode enters the 'stage'. | /** callback that is called every time the CCNode enters the 'stage'. | |||
If the CCNode enters the 'stage' with a transition, this callback is c alled when the transition starts. | If the CCNode enters the 'stage' with a transition, this callback is c alled when the transition starts. | |||
During onEnter you can't a "sister/brother" node. | During onEnter you can't a "sister/brother" node. | |||
*/ | */ | |||
virtual void onEnter(); | virtual void onEnter(); | |||
/** callback that is called when the CCNode enters in the 'stage'. | /** callback that is called when the CCNode enters in the 'stage'. | |||
If the CCNode enters the 'stage' with a transition, this callback is c alled when the transition finishes. | If the CCNode enters the 'stage' with a transition, this callback is c alled when the transition finishes. | |||
@since v0.8 | @since v0.8 | |||
skipping to change at line 572 | skipping to change at line 577 | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
virtual CCAffineTransform nodeToParentTransform(void); | virtual CCAffineTransform nodeToParentTransform(void); | |||
/** Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates. | /** Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates. | |||
The matrix is in Pixels. | The matrix is in Pixels. | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
virtual CCAffineTransform parentToNodeTransform(void); | virtual CCAffineTransform parentToNodeTransform(void); | |||
/** Retrusn the world affine transform matrix. The matrix is in Pixels. | /** Returns the world affine transform matrix. The matrix is in Pixels. | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
virtual CCAffineTransform nodeToWorldTransform(void); | virtual CCAffineTransform nodeToWorldTransform(void); | |||
/** Returns the inverse world affine transform matrix. The matrix is in Pixels. | /** Returns the inverse world affine transform matrix. The matrix is in Pixels. | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
virtual CCAffineTransform worldToNodeTransform(void); | virtual CCAffineTransform worldToNodeTransform(void); | |||
/** Converts a Point to node (local) space coordinates. The result is i n Points. | /** Converts a Point to node (local) space coordinates. The result is i n Points. | |||
skipping to change at line 606 | skipping to change at line 611 | |||
treating the returned/received node point as anchor relative. | treating the returned/received node point as anchor relative. | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint); | CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint); | |||
/** convenience methods which take a CCTouch instead of CCPoint | /** convenience methods which take a CCTouch instead of CCPoint | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
CCPoint convertTouchToNodeSpace(CCTouch * touch); | CCPoint convertTouchToNodeSpace(CCTouch * touch); | |||
/** converts a CCTouch (world coordinates) into a local coordiante. Thi s method is AR (Anchor Relative). | /** converts a CCTouch (world coordinates) into a local coordinate. Thi s method is AR (Anchor Relative). | |||
@since v0.7.1 | @since v0.7.1 | |||
*/ | */ | |||
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch); | CCPoint convertTouchToNodeSpaceAR(CCTouch * touch); | |||
}; | }; | |||
// end of base_node group | // end of base_node group | |||
/// @} | /// @} | |||
NS_CC_END | NS_CC_END | |||
#endif // __PLATFOMR_CCNODE_H__ | #endif // __PLATFORM_CCNODE_H__ | |||
End of changes. 11 change blocks. | ||||
9 lines changed or deleted | 14 lines changed or added | |||
CCNodeLoader.h | CCNodeLoader.h | |||
---|---|---|---|---|
#ifndef _CCB_CCNODELOADER_H_ | #ifndef _CCB_CCNODELOADER_H_ | |||
#define _CCB_CCNODELOADER_H_ | #define _CCB_CCNODELOADER_H_ | |||
#include "../GUI/CCControlExtension/CCInvocation.h" | #include "../GUI/CCControlExtension/CCInvocation.h" | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "CCBReader.h" | #include "CCBReader.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
#define PROPERTY_POSITION "position" | ||||
#define PROPERTY_CONTENTSIZE "contentSize" | ||||
#define PROPERTY_ANCHORPOINT "anchorPoint" | ||||
#define PROPERTY_SCALE "scale" | ||||
#define PROPERTY_ROTATION "rotation" | ||||
#define PROPERTY_TAG "tag" | ||||
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition | ||||
" | ||||
#define PROPERTY_VISIBLE "visible" | ||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected propert | ||||
y: '%s'!\n", PROPERTY->getCString()); assert(false) | ||||
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLog("Unexpected | ||||
property type: '%d'!\n", PROPERTYTYPE); assert(false) | ||||
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * crea teCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBRea der) { \ | #define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * crea teCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBRea der) { \ | |||
return T::create(); \ | return T::create(); \ | |||
} | } | |||
#define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pC CBReader) = 0 | #define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pC CBReader) = 0 | |||
struct BlockData { | struct BlockData { | |||
SEL_MenuHandler mSELMenuHandler; | SEL_MenuHandler mSELMenuHandler; | |||
CCObject * mTarget; | CCObject * mTarget; | |||
}; | }; | |||
skipping to change at line 41 | skipping to change at line 53 | |||
public: | public: | |||
virtual ~CCNodeLoader() {}; | virtual ~CCNodeLoader() {}; | |||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader); | CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader); | |||
virtual CCNode * loadCCNode(CCNode *, CCBReader * pCCBReader); | virtual CCNode * loadCCNode(CCNode *, CCBReader * pCCBReader); | |||
virtual void parseProperties(CCNode * pNode, CCNode * pParent, CCBR eader * pCCBReader); | virtual void parseProperties(CCNode * pNode, CCNode * pParent, CCBR eader * pCCBReader); | |||
protected: | protected: | |||
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCNode); | CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCNode); | |||
virtual CCPoint parsePropTypePosition(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | virtual CCPoint parsePropTypePosition(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual CCPoint parsePropTypePoint(CCNode * pNode, CCNode * pParent , CCBReader * pCCBReader); | virtual CCPoint parsePropTypePoint(CCNode * pNode, CCNode * pParent , CCBReader * pCCBReader); | |||
virtual CCPoint parsePropTypePointLock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | virtual CCPoint parsePropTypePointLock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | |||
virtual CCSize parsePropTypeSize(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual CCSize parsePropTypeSize(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual float * parsePropTypeScaleLock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | virtual float * parsePropTypeScaleLock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual float parsePropTypeFloat(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual float parsePropTypeFloat(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual float parsePropTypeDegrees(CCNode * pNode, CCNode * pParent , CCBReader * pCCBReader); | virtual float parsePropTypeDegrees(CCNode * pNode, CCNode * pParent , CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual float parsePropTypeFloatScale(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | virtual float parsePropTypeFloatScale(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | |||
virtual int parsePropTypeInteger(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual int parsePropTypeInteger(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual int parsePropTypeIntegerLabeled(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | virtual int parsePropTypeIntegerLabeled(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | |||
virtual float * parsePropTypeFloatVar(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | virtual float * parsePropTypeFloatVar(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | |||
virtual bool parsePropTypeCheck(CCNode * pNode, CCNode * pParent, C | virtual bool parsePropTypeCheck(CCNode * pNode, CCNode * pParent, C | |||
CBReader * pCCBReader); | CBReader * pCCBReader, const char *pPropertyName); | |||
virtual CCSpriteFrame * parsePropTypeSpriteFrame(CCNode * pNode, CC | virtual CCSpriteFrame * parsePropTypeSpriteFrame(CCNode * pNode, CC | |||
Node * pParent, CCBReader * pCCBReader); | Node * pParent, CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual CCAnimation * parsePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual CCAnimation * parsePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual CCTexture2D * parsePropTypeTexture(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual CCTexture2D * parsePropTypeTexture(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual unsigned char parsePropTypeByte(CCNode * pNode, CCNode * pP | virtual unsigned char parsePropTypeByte(CCNode * pNode, CCNode * pP | |||
arent, CCBReader * pCCBReader); | arent, CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual ccColor3B parsePropTypeColor3(CCNode * pNode, CCNode * pPar | virtual ccColor3B parsePropTypeColor3(CCNode * pNode, CCNode * pPar | |||
ent, CCBReader * pCCBReader); | ent, CCBReader * pCCBReader, const char *pPropertyName); | |||
virtual ccColor4F * parsePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual ccColor4F * parsePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual bool * parsePropTypeFlip(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual bool * parsePropTypeFlip(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual ccBlendFunc parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | virtual ccBlendFunc parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual CCString * parsePropTypeFntFile(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | virtual CCString * parsePropTypeFntFile(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | |||
virtual CCString * parsePropTypeString(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | virtual CCString * parsePropTypeString(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | |||
virtual CCString * parsePropTypeText(CCNode * pNode, CCNode * pPare nt, CCBReader * pCCBReader); | virtual CCString * parsePropTypeText(CCNode * pNode, CCNode * pPare nt, CCBReader * pCCBReader); | |||
virtual CCString * parsePropTypeFontTTF(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | virtual CCString * parsePropTypeFontTTF(CCNode * pNode, CCNode * pP arent, CCBReader * pCCBReader); | |||
virtual BlockData * parsePropTypeBlock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | virtual BlockData * parsePropTypeBlock(CCNode * pNode, CCNode * pPa rent, CCBReader * pCCBReader); | |||
virtual BlockCCControlData * parsePropTypeBlockCCControl(CCNode * p Node, CCNode * pParent, CCBReader * pCCBReader); | virtual BlockCCControlData * parsePropTypeBlockCCControl(CCNode * p Node, CCNode * pParent, CCBReader * pCCBReader); | |||
virtual CCNode * parsePropTypeCCBFile(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | virtual CCNode * parsePropTypeCCBFile(CCNode * pNode, CCNode * pPar ent, CCBReader * pCCBReader); | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 26 lines changed or added | |||
CCNodeLoaderLibrary.h | CCNodeLoaderLibrary.h | |||
---|---|---|---|---|
#ifndef _CCB_CCNODELOADERLIBRARY_H_ | #ifndef _CCB_CCNODELOADERLIBRARY_H_ | |||
#define _CCB_CCNODELOADERLIBRARY_H_ | #define _CCB_CCNODELOADERLIBRARY_H_ | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "CCBReader.h" | #include "CCBReader.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
class CCNodeLoader; | ||||
typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderM ap; | typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderM ap; | |||
typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry; | typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry; | |||
class CCNodeLoaderLibrary : public CCObject { | class CCNodeLoaderLibrary : public CCObject { | |||
private: | private: | |||
CCNodeLoaderMap mCCNodeLoaders; | CCNodeLoaderMap mCCNodeLoaders; | |||
public: | public: | |||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, libra ry); | CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, libra ry); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
CCNotificationCenter.h | CCNotificationCenter.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2011 Erawppa | Copyright (c) 2011 Erawppa | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 49 | skipping to change at line 49 | |||
static CCNotificationCenter *sharedNotificationCenter(void); | static CCNotificationCenter *sharedNotificationCenter(void); | |||
static void purgeNotificationCenter(void); | static void purgeNotificationCenter(void); | |||
void addObserver(CCObject *target, | void addObserver(CCObject *target, | |||
SEL_CallFuncO selector, | SEL_CallFuncO selector, | |||
const char *name, | const char *name, | |||
CCObject *obj); | CCObject *obj); | |||
void removeObserver(CCObject *target,const char *name); | void removeObserver(CCObject *target,const char *name); | |||
void registerScriptObserver(int handler); | ||||
void unregisterScriptObserver(void); | ||||
void postNotification(const char *name); | void postNotification(const char *name); | |||
void postNotification(const char *name, CCObject *object); | void postNotification(const char *name, CCObject *object); | |||
inline int getScriptHandler() { return m_scriptHandler; }; | ||||
private: | private: | |||
// | // | |||
// internal functions | // internal functions | |||
// | // | |||
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; | ||||
}; | }; | |||
class CC_DLL CCNotificationObserver : public CCObject | class CC_DLL CCNotificationObserver : public CCObject | |||
{ | { | |||
public: | public: | |||
CCNotificationObserver(CCObject *target, | CCNotificationObserver(CCObject *target, | |||
SEL_CallFuncO selector, | SEL_CallFuncO selector, | |||
const char *name, | const char *name, | |||
CCObject *obj); | CCObject *obj); | |||
~CCNotificationObserver(); | ~CCNotificationObserver(); | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
CCObject.h | CCObject.h | |||
---|---|---|---|---|
skipping to change at line 56 | skipping to change at line 56 | |||
}; | }; | |||
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 refrence | // count of references | |||
unsigned int m_uReference; | unsigned int m_uReference; | |||
// is the object autoreleased | // is the object autoreleased | |||
bool m_bManaged; | bool m_bManaged; | |||
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); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCParallaxNode.h | CCParallaxNode.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009-2010 Ricardo Quesada | Copyright (c) 2009-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCParticleExamples.h | CCParticleExamples.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCParticleSystem.h | CCParticleSystem.h | |||
---|---|---|---|---|
skipping to change at line 133 | skipping to change at line 133 | |||
} modeB; | } modeB; | |||
}tCCParticle; | }tCCParticle; | |||
//typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tCCParticle*, CCPoint); | //typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tCCParticle*, CCPoint); | |||
class CCTexture2D; | class CCTexture2D; | |||
/** @brief Particle System base class. | /** @brief Particle System base class. | |||
Attributes of a Particle System: | Attributes of a Particle System: | |||
- emmision rate of the particles | - emission rate of the particles | |||
- Gravity Mode (Mode A): | - Gravity Mode (Mode A): | |||
- gravity | - gravity | |||
- direction | - direction | |||
- speed +- variance | - speed +- variance | |||
- tangential acceleration +- variance | - tangential acceleration +- variance | |||
- radial acceleration +- variance | - radial acceleration +- variance | |||
- Radius Mode (Mode B): | - Radius Mode (Mode B): | |||
- startRadius +- variance | - startRadius +- variance | |||
- endRadius +- variance | - endRadius +- variance | |||
- rotate +- variance | - rotate +- variance | |||
skipping to change at line 157 | skipping to change at line 157 | |||
- end spin +- variance | - end spin +- variance | |||
- start size +- variance | - start size +- variance | |||
- end size +- variance | - end size +- variance | |||
- start color +- variance | - start color +- variance | |||
- end color +- variance | - end color +- variance | |||
- life +- variance | - life +- variance | |||
- blending function | - blending function | |||
- texture | - texture | |||
cocos2d also supports particles generated by Particle Designer (http://part icledesigner.71squared.com/). | cocos2d also supports particles generated by Particle Designer (http://part icledesigner.71squared.com/). | |||
'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since t hat can't be guarateed in cocos2d, | 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since t hat can't be guaranteed in cocos2d, | |||
cocos2d uses a another approach, but the results are almost identical. | cocos2d uses a another approach, but the results are almost identical. | |||
cocos2d supports all the variables used by Particle Designer plus a bit mor e: | cocos2d supports all the variables used by Particle Designer plus a bit mor e: | |||
- spinning particles (supported when using CCParticleSystemQuad) | - spinning particles (supported when using CCParticleSystemQuad) | |||
- tangential acceleration (Gravity mode) | - tangential acceleration (Gravity mode) | |||
- radial acceleration (Gravity mode) | - radial acceleration (Gravity mode) | |||
- radius direction (Radius mode) (Particle Designer supports outwards to in wards direction only) | - radius direction (Radius mode) (Particle Designer supports outwards to in wards direction only) | |||
It is possible to customize any of the above mentioned properties in runtim e. Example: | It is possible to customize any of the above mentioned properties in runtim e. Example: | |||
skipping to change at line 210 | skipping to change at line 210 | |||
//! Mode B: circular movement (gravity, radial accel and tangential acc el don't are not used in this mode) | //! Mode B: circular movement (gravity, radial accel and tangential acc el don't are not used in this mode) | |||
struct { | struct { | |||
/** The starting radius of the particles. Only available in 'Radius ' mode. */ | /** The starting radius of the particles. Only available in 'Radius ' mode. */ | |||
float startRadius; | float startRadius; | |||
/** The starting radius variance of the particles. Only available i n 'Radius' mode. */ | /** The starting radius variance of the particles. Only available i n 'Radius' mode. */ | |||
float startRadiusVar; | float startRadiusVar; | |||
/** The ending radius of the particles. Only available in 'Radius' mode. */ | /** The ending radius of the particles. Only available in 'Radius' mode. */ | |||
float endRadius; | float endRadius; | |||
/** The ending radius variance of the particles. Only available in 'Radius' mode. */ | /** The ending radius variance of the particles. Only available in 'Radius' mode. */ | |||
float endRadiusVar; | float endRadiusVar; | |||
/** Number of degress to rotate a particle around the source pos pe r second. Only available in 'Radius' mode. */ | /** Number of degrees to rotate a particle around the source pos pe r second. Only available in 'Radius' mode. */ | |||
float rotatePerSecond; | float rotatePerSecond; | |||
/** Variance in degrees for rotatePerSecond. Only available in 'Rad ius' mode. */ | /** Variance in degrees for rotatePerSecond. Only available in 'Rad ius' mode. */ | |||
float rotatePerSecondVar; | float rotatePerSecondVar; | |||
} modeB; | } modeB; | |||
//! Array of particles | //! Array of particles | |||
tCCParticle *m_pParticles; | tCCParticle *m_pParticles; | |||
// color modulate | // color modulate | |||
// BOOL colorModulate; | // BOOL colorModulate; | |||
skipping to change at line 247 | skipping to change at line 247 | |||
//true if scaled or rotated | //true if scaled or rotated | |||
bool m_bTransformSystemDirty; | bool m_bTransformSystemDirty; | |||
// Number of allocated particles | // Number of allocated particles | |||
unsigned int m_uAllocatedParticles; | unsigned int m_uAllocatedParticles; | |||
/** Is the emitter active */ | /** Is the emitter active */ | |||
bool m_bIsActive; | bool m_bIsActive; | |||
/** Quantity of particles that are being simulated at the moment */ | /** Quantity of particles that are being simulated at the moment */ | |||
CC_PROPERTY_READONLY(unsigned int, m_uParticleCount, ParticleCount) | CC_PROPERTY_READONLY(unsigned int, m_uParticleCount, ParticleCount) | |||
/** How many seconds the emitter wil run. -1 means 'forever' */ | /** How many seconds the emitter will run. -1 means 'forever' */ | |||
CC_PROPERTY(float, m_fDuration, Duration) | CC_PROPERTY(float, m_fDuration, Duration) | |||
/** sourcePosition of the emitter */ | /** sourcePosition of the emitter */ | |||
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tSourcePosition, SourcePosition) | CC_PROPERTY_PASS_BY_REF(CCPoint, m_tSourcePosition, SourcePosition) | |||
/** Position variance of the emitter */ | /** Position variance of the emitter */ | |||
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosVar, PosVar) | CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosVar, PosVar) | |||
/** life, and life variation of each particle */ | /** life, and life variation of each particle */ | |||
CC_PROPERTY(float, m_fLife, Life) | CC_PROPERTY(float, m_fLife, Life) | |||
/** life variance of each particle */ | /** life variance of each particle */ | |||
CC_PROPERTY(float, m_fLifeVar, LifeVar) | CC_PROPERTY(float, m_fLifeVar, LifeVar) | |||
/** angle and angle variation of each particle */ | /** angle and angle variation of each particle */ | |||
skipping to change at line 370 | skipping to change at line 370 | |||
/** Switch between different kind of emitter modes: | /** Switch between different kind of emitter modes: | |||
- kCCParticleModeGravity: uses gravity, speed, radial and tangential ac celeration | - kCCParticleModeGravity: uses gravity, speed, radial and tangential ac celeration | |||
- kCCParticleModeRadius: uses radius movement + rotation | - kCCParticleModeRadius: uses radius movement + rotation | |||
*/ | */ | |||
CC_PROPERTY(int, m_nEmitterMode, EmitterMode) | CC_PROPERTY(int, m_nEmitterMode, EmitterMode) | |||
public: | public: | |||
CCParticleSystem(); | CCParticleSystem(); | |||
virtual ~CCParticleSystem(); | virtual ~CCParticleSystem(); | |||
/** creates an initializes a CCParticleSystem from a plist file. | /** creates an initializes a CCParticleSystem from a plist file. | |||
This plist files can be creted manually or with Particle Designer: | This plist files can be created manually or with Particle Designer: | |||
http://particledesigner.71squared.com/ | http://particledesigner.71squared.com/ | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
@since v0.99.3 | @since v0.99.3 | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCParticleSystem * particleWithFile(cons t char *plistFile); | CC_DEPRECATED_ATTRIBUTE static CCParticleSystem * particleWithFile(cons t char *plistFile); | |||
/** creates an initializes a CCParticleSystem from a plist file. | /** creates an initializes a CCParticleSystem from a plist file. | |||
This plist files can be creted manually or with Particle Designer: | This plist files can be created manually or with Particle Designer: | |||
http://particledesigner.71squared.com/ | http://particledesigner.71squared.com/ | |||
@since v2.0 | @since v2.0 | |||
*/ | */ | |||
static CCParticleSystem * create(const char *plistFile); | static CCParticleSystem * create(const char *plistFile); | |||
//! create a system with a fixed number of particles | ||||
static CCParticleSystem* createWithTotalParticles(unsigned int numberOf | ||||
Particles); | ||||
/** initializes a CCParticleSystem*/ | /** initializes a CCParticleSystem*/ | |||
bool init(); | bool init(); | |||
/** initializes a CCParticleSystem from a plist file. | /** initializes a CCParticleSystem from a plist file. | |||
This plist files can be creted manually or with Particle Designer: | This plist files can be created manually or with Particle Designer: | |||
http://particledesigner.71squared.com/ | http://particledesigner.71squared.com/ | |||
@since v0.99.3 | @since v0.99.3 | |||
*/ | */ | |||
bool initWithFile(const char *plistFile); | bool initWithFile(const char *plistFile); | |||
/** initializes a CCQuadParticleSystem from a CCDictionary. | /** initializes a CCQuadParticleSystem from a CCDictionary. | |||
@since v0.99.3 | @since v0.99.3 | |||
*/ | */ | |||
bool initWithDictionary(CCDictionary *dictionary); | bool initWithDictionary(CCDictionary *dictionary); | |||
skipping to change at line 411 | skipping to change at line 414 | |||
bool addParticle(); | bool addParticle(); | |||
//! Initializes a particle | //! Initializes a particle | |||
void initParticle(tCCParticle* particle); | void initParticle(tCCParticle* particle); | |||
//! stop emitting particles. Running particles will continue to run unt il they die | //! stop emitting particles. Running particles will continue to run unt il they die | |||
void stopSystem(); | void stopSystem(); | |||
//! Kill all living particles. | //! Kill all living particles. | |||
void resetSystem(); | void resetSystem(); | |||
//! whether or not the system is full | //! whether or not the system is full | |||
bool isFull(); | bool isFull(); | |||
//! should be overriden by subclasses | //! should be overridden by subclasses | |||
virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoin t& newPosition); | virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoin t& newPosition); | |||
//! should be overriden by subclasses | //! should be overridden by subclasses | |||
virtual void postStep(); | virtual void postStep(); | |||
virtual void update(float dt); | virtual void update(float dt); | |||
virtual void updateWithNoTime(void); | virtual void updateWithNoTime(void); | |||
protected: | protected: | |||
virtual void updateBlendFunc(); | virtual void updateBlendFunc(); | |||
}; | }; | |||
// end of particle_nodes group | // end of particle_nodes group | |||
End of changes. 10 change blocks. | ||||
9 lines changed or deleted | 13 lines changed or added | |||
CCParticleSystemQuad.h | CCParticleSystemQuad.h | |||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
GLuint m_uVAOname; | GLuint m_uVAOname; | |||
#endif | #endif | |||
GLuint m_pBuffersVBO[2]; //0: vertex 1: indices | GLuint m_pBuffersVBO[2]; //0: vertex 1: indices | |||
public: | public: | |||
CCParticleSystemQuad(); | CCParticleSystemQuad(); | |||
virtual ~CCParticleSystemQuad(); | virtual ~CCParticleSystemQuad(); | |||
/** creates an initializes a CCParticleSystemQuad from a plist file. | /** creates an initializes a CCParticleSystemQuad from a plist file. | |||
This plist files can be creted manually or with Particle Designer: | This plist files can be created manually or with Particle Designer: | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCParticleSystemQuad * particleWithFile( const char *plistFile); | CC_DEPRECATED_ATTRIBUTE static CCParticleSystemQuad * particleWithFile( const char *plistFile); | |||
/** creates an initializes a CCParticleSystemQuad from a plist file. | /** creates an initializes a CCParticleSystemQuad from a plist file. | |||
This plist files can be creted manually or with Particle Designer: | This plist files can be created manually or with Particle Designer: | |||
*/ | */ | |||
static CCParticleSystemQuad * create(const char *plistFile); | static CCParticleSystemQuad * create(const char *plistFile); | |||
/** initialices the indices for the vertices*/ | /** initializes the indices for the vertices*/ | |||
void setupIndices(); | void setupIndices(); | |||
/** initilizes the texture with a rectangle measured Points */ | /** initializes the texture with a rectangle measured Points */ | |||
void initTexCoordsWithRect(const CCRect& rect); | void initTexCoordsWithRect(const CCRect& rect); | |||
/** Sets a new CCSpriteFrame as particle. | /** Sets a new CCSpriteFrame as particle. | |||
WARNING: this method is experimental. Use setTexture:withRect instead. | WARNING: this method is experimental. Use setTexture:withRect instead. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
void setDisplayFrame(CCSpriteFrame *spriteFrame); | void setDisplayFrame(CCSpriteFrame *spriteFrame); | |||
/** Sets a new texture with a rect. The rect is in Points. | /** Sets a new texture with a rect. The rect is in Points. | |||
@since v0.99.4 | @since v0.99.4 | |||
skipping to change at line 113 | skipping to change at line 113 | |||
virtual void setTotalParticles(unsigned int tp); | virtual void setTotalParticles(unsigned int tp); | |||
/** listen the event that coming to foreground on Android | /** listen the event that coming to foreground on Android | |||
*/ | */ | |||
void listenBackToForeground(CCObject *obj); | void listenBackToForeground(CCObject *obj); | |||
//@deprecated: This interface will be deprecated sooner or later. | //@deprecated: This interface will be deprecated sooner or later. | |||
CC_DEPRECATED_ATTRIBUTE static CCParticleSystemQuad * node(); | CC_DEPRECATED_ATTRIBUTE static CCParticleSystemQuad * node(); | |||
static CCParticleSystemQuad * create(); | static CCParticleSystemQuad * create(); | |||
static CCParticleSystemQuad * createWithTotalParticles(unsigned int num berOfParticles); | ||||
private: | private: | |||
#if CC_TEXTURE_ATLAS_USE_VAO | #if CC_TEXTURE_ATLAS_USE_VAO | |||
void setupVBOandVAO(); | void setupVBOandVAO(); | |||
#else | #else | |||
void setupVBO(); | void setupVBO(); | |||
#endif | #endif | |||
bool allocMemory(); | bool allocMemory(); | |||
}; | }; | |||
// end of particle_nodes group | // end of particle_nodes group | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added | |||
CCPlatformConfig.h | CCPlatformConfig.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
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 __CC_PLATFORM_CONFIG_H__ | #ifndef __CC_PLATFORM_CONFIG_H__ | |||
#define __CC_PLATFORM_CONFIG_H__ | #define __CC_PLATFORM_CONFIG_H__ | |||
/** | /** | |||
Config of cocos2d-x project. | Config of cocos2d-x project, per target platform. | |||
There are config below: | ||||
build for which target platform | ||||
*/ | */ | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
// pre configure | // pre configure | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
// define supported target platform macro which CC uses. | // define supported target platform macro which CC uses. | |||
#define CC_PLATFORM_UNKNOWN 0 | #define CC_PLATFORM_UNKNOWN 0 | |||
#define CC_PLATFORM_IOS 1 | #define CC_PLATFORM_IOS 1 | |||
#define CC_PLATFORM_ANDROID 2 | #define CC_PLATFORM_ANDROID 2 | |||
#define CC_PLATFORM_WIN32 3 | #define CC_PLATFORM_WIN32 3 | |||
#define CC_PLATFORM_MARMALADE 4 | #define CC_PLATFORM_MARMALADE 4 | |||
#define CC_PLATFORM_LINUX 5 | #define CC_PLATFORM_LINUX 5 | |||
#define CC_PLATFORM_BADA 6 | #define CC_PLATFORM_BADA 6 | |||
#define CC_PLATFORM_BLACKBERRY 7 | #define CC_PLATFORM_BLACKBERRY 7 | |||
#define CC_PLATFORM_MAC 8 | #define CC_PLATFORM_MAC 8 | |||
// Determine tartet platform by compile environment macro. | // Determine target platform by compile environment macro. | |||
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN | #define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN | |||
// iphone | // iphone | |||
#if ! CC_TARGET_PLATFORM && (defined(TARGET_OS_IPHONE) || defined(TARGET_IP HONE_SIMULATOR)) | #if ! CC_TARGET_PLATFORM && (defined(TARGET_OS_IPHONE) || defined(TARGET_IP HONE_SIMULATOR)) | |||
#undef CC_TARGET_PLATFORM | #undef CC_TARGET_PLATFORM | |||
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS | #define CC_TARGET_PLATFORM CC_PLATFORM_IOS | |||
#define CC_SUPPORT_PVRTC | #define CC_SUPPORT_PVRTC | |||
#endif | #endif | |||
// android | // android | |||
skipping to change at line 109 | skipping to change at line 106 | |||
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC | #define CC_TARGET_PLATFORM CC_PLATFORM_MAC | |||
//#define CC_SUPPORT_PVRTC | //#define CC_SUPPORT_PVRTC | |||
#endif | #endif | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
// post configure | // post configure | |||
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// | |||
// check user set platform | // check user set platform | |||
#if ! CC_TARGET_PLATFORM | #if ! CC_TARGET_PLATFORM | |||
#error "Can not recognize the target platform, compling under a unsupp orted platform?" | #error "Cannot recognize the target platform; are you targeting an uns upported platform?" | |||
#endif | #endif | |||
// Check the supportive of platform | ||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) | #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) | |||
#pragma warning (disable:4127) | #pragma warning (disable:4127) | |||
#endif // CC_PLATFORM_WIN32 | #endif // CC_PLATFORM_WIN32 | |||
#endif // __CC_PLATFORM_CONFIG_H__ | #endif // __CC_PLATFORM_CONFIG_H__ | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 3 lines changed or added | |||
CCPointExtension.h | CCPointExtension.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2007 Scott Lembcke | Copyright (c) 2007 Scott Lembcke | |||
Copyright (c) 2010 Lam Pham | Copyright (c) 2010 Lam Pham | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 270 | skipping to change at line 270 | |||
otherwise a value between a..b | otherwise a value between a..b | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
CCPoint CC_DLL ccpLerp(const CCPoint& a, const CCPoint& b, float alpha); | CCPoint CC_DLL ccpLerp(const CCPoint& a, const CCPoint& b, float alpha); | |||
/** @returns if points have fuzzy equality which means equal with some degr ee of variance. | /** @returns if points have fuzzy equality which means equal with some degr ee of variance. | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
bool CC_DLL ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float varianc e); | bool CC_DLL ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float varianc e); | |||
/** Multiplies a nd b components, a.x*b.x, a.y*b.y | /** Multiplies a and b components, a.x*b.x, a.y*b.y | |||
@returns a component-wise multiplication | @returns a component-wise multiplication | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
CCPoint CC_DLL ccpCompMult(const CCPoint& a, const CCPoint& b); | CCPoint CC_DLL ccpCompMult(const CCPoint& a, const CCPoint& b); | |||
/** @returns the signed angle in radians between two vector directions | /** @returns the signed angle in radians between two vector directions | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
float CC_DLL ccpAngleSigned(const CCPoint& a, const CCPoint& b); | float CC_DLL ccpAngleSigned(const CCPoint& a, const CCPoint& b); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCProfiling.h | CCProfiling.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2010 Stuart Carnie | Copyright (c) 2010 Stuart Carnie | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCProgressTimer.h | CCProgressTimer.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
/// Radial Counter-Clockwise | /// Radial Counter-Clockwise | |||
kCCProgressTimerTypeRadial, | kCCProgressTimerTypeRadial, | |||
/// Bar | /// Bar | |||
kCCProgressTimerTypeBar, | kCCProgressTimerTypeBar, | |||
} CCProgressTimerType; | } CCProgressTimerType; | |||
/** | /** | |||
@brief CCProgresstimer is a subclass of CCNode. | @brief CCProgressTimer is a subclass of CCNode. | |||
It renders the inner sprite according to the percentage. | It renders the inner sprite according to the percentage. | |||
The progress can be Radial, Horizontal or vertical. | The progress can be Radial, Horizontal or vertical. | |||
@since v0.99.1 | @since v0.99.1 | |||
*/ | */ | |||
class CC_DLL CCProgressTimer : public CCNode, public CCRGBAProtocol | class CC_DLL CCProgressTimer : public CCNode, public CCRGBAProtocol | |||
{ | { | |||
public: | public: | |||
CCProgressTimer(); | CCProgressTimer(); | |||
~CCProgressTimer(void); | ~CCProgressTimer(void); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCProtocols.h | CCProtocols.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 53 | skipping to change at line 53 | |||
/** returns the color | /** returns the color | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
virtual const ccColor3B& getColor(void) = 0; | virtual const ccColor3B& getColor(void) = 0; | |||
// returns the opacity | // returns the opacity | |||
virtual GLubyte getOpacity(void) = 0; | virtual GLubyte getOpacity(void) = 0; | |||
/** sets the opacity. | /** sets the opacity. | |||
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed. | @warning If the the texture has premultiplied alpha then, the R, G and B channels will be modified. | |||
Values goes from 0 to 255, where 255 means fully opaque. | Values goes from 0 to 255, where 255 means fully opaque. | |||
*/ | */ | |||
virtual void setOpacity(GLubyte opacity) = 0; | virtual void setOpacity(GLubyte opacity) = 0; | |||
// optional | // optional | |||
/** sets the premultipliedAlphaOpacity property. | /** sets the premultipliedAlphaOpacity property. | |||
If set to NO then opacity will be applied as: glColor(R,G,B,opacity); | If set to NO then opacity will be applied as: glColor(R,G,B,opacity); | |||
If set to YES then oapcity will be applied as: glColor(opacity, opacit y, opacity, opacity ); | If set to YES then opacity will be applied as: glColor(opacity, opacit y, opacity, opacity ); | |||
Textures with premultiplied alpha will have this property by default o n YES. Otherwise the default value is NO | Textures with premultiplied alpha will have this property by default o n YES. Otherwise the default value is NO | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
virtual void setOpacityModifyRGB(bool bValue) = 0; | virtual void setOpacityModifyRGB(bool bValue) = 0; | |||
/** returns whether or not the opacity will be applied using glColor(R, G,B,opacity) or glColor(opacity, opacity, opacity, opacity); | /** returns whether or not the opacity will be applied using glColor(R, G,B,opacity) or glColor(opacity, opacity, opacity, opacity); | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
virtual bool isOpacityModifyRGB(void) = 0; | virtual bool isOpacityModifyRGB(void) = 0; | |||
}; | }; | |||
/** | /** | |||
@brief You can specify the blending fuction. | @brief You can specify the blending function. | |||
@since v0.99.0 | @since v0.99.0 | |||
*/ | */ | |||
class CC_DLL CCBlendProtocol | class CC_DLL CCBlendProtocol | |||
{ | { | |||
public: | public: | |||
// set the source blending function for the texture | // set the source blending function for the texture | |||
virtual void setBlendFunc(ccBlendFunc blendFunc) = 0; | virtual void setBlendFunc(ccBlendFunc blendFunc) = 0; | |||
// returns the blending function used for the texture | // returns the blending function used for the texture | |||
virtual ccBlendFunc getBlendFunc(void) = 0; | virtual ccBlendFunc getBlendFunc(void) = 0; | |||
}; | }; | |||
/** @brief CCNode objects that uses a Texture2D to render the images. | /** @brief CCNode objects that uses a Texture2D to render the images. | |||
The texture can have a blending function. | The texture can have a blending function. | |||
If the texture has alpha premultiplied the default blending function is: | If the texture has alpha premultiplied the default blending function is: | |||
src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA | src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA | |||
else | else | |||
src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA | src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA | |||
But you can change the blending funtion at any time. | But you can change the blending function at any time. | |||
@since v0.8.0 | @since v0.8.0 | |||
*/ | */ | |||
class CC_DLL CCTextureProtocol : public CCBlendProtocol | class CC_DLL CCTextureProtocol : public CCBlendProtocol | |||
{ | { | |||
public: | public: | |||
// returns the used texture | // returns the used texture | |||
virtual CCTexture2D* getTexture(void) = 0; | virtual CCTexture2D* getTexture(void) = 0; | |||
// sets a new texture. it will be retained | // sets a new texture. it will be retained | |||
virtual void setTexture(CCTexture2D *texture) = 0; | virtual void setTexture(CCTexture2D *texture) = 0; | |||
skipping to change at line 122 | skipping to change at line 122 | |||
virtual void setString(const char *label) = 0; | virtual void setString(const char *label) = 0; | |||
/** returns the string that is rendered */ | /** returns the string that is rendered */ | |||
virtual const char* getString(void) = 0; | virtual const char* getString(void) = 0; | |||
}; | }; | |||
/** OpenGL projection protocol */ | /** OpenGL projection protocol */ | |||
class CC_DLL CCDirectorDelegate | class CC_DLL CCDirectorDelegate | |||
{ | { | |||
public: | public: | |||
/** Called by CCDirector when the porjection is updated, and "custom" p rojection is used | /** Called by CCDirector when the projection is updated, and "custom" p rojection is used | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
virtual void updateProjection(void) = 0; | virtual void updateProjection(void) = 0; | |||
}; | }; | |||
NS_CC_END | NS_CC_END | |||
#endif // __CCPROTOCOLS_H__ | #endif // __CCPROTOCOLS_H__ | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
CCRenderTexture.h | CCRenderTexture.h | |||
---|---|---|---|---|
skipping to change at line 47 | skipping to change at line 47 | |||
*/ | */ | |||
typedef enum eImageFormat | typedef enum eImageFormat | |||
{ | { | |||
kCCImageFormatJPEG = 0, | kCCImageFormatJPEG = 0, | |||
kCCImageFormatPNG = 1, | kCCImageFormatPNG = 1, | |||
} tCCImageFormat; | } tCCImageFormat; | |||
/** | /** | |||
@brief CCRenderTexture is a generic rendering target. To render things into it, | @brief CCRenderTexture is a generic rendering target. To render things into it, | |||
simply construct a render target, call begin on it, call visit on any cocos | simply construct a render target, call begin on it, call visit on any cocos | |||
scenes or objects to render them, and call end. For convienience, render te xture | scenes or objects to render them, and call end. For convenience, render tex ture | |||
adds a sprite as it's display child with the results, so you can simply add | adds a sprite as it's display child with the results, so you can simply add | |||
the render texture to your scene and treat it like any other CocosNode. | the render texture to your scene and treat it like any other CocosNode. | |||
There are also functions for saving the render texture to disk in PNG or JP G format. | There are also functions for saving the render texture to disk in PNG or JP G format. | |||
@since v0.8.1 | @since v0.8.1 | |||
*/ | */ | |||
class CC_DLL CCRenderTexture : public CCNode | class CC_DLL CCRenderTexture : public CCNode | |||
{ | { | |||
/** The CCSprite being used. | /** The CCSprite being used. | |||
The sprite, by default, will use the following blending function: GL_ON E, GL_ONE_MINUS_SRC_ALPHA. | The sprite, by default, will use the following blending function: GL_ON E, GL_ONE_MINUS_SRC_ALPHA. | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCScale9Sprite.h | CCScale9Sprite.h | |||
---|---|---|---|---|
// | /************************************************************************** | |||
// CCScale9Sprite.h | ** | |||
// PlantCaring | Copyright (c) 2012 cocos2d-x.org | |||
// | ||||
// Created by Jung Sang-Taik on 12. 3. 16.. | http://www.cocos2d-x.org | |||
// Copyright (c) 2012 Neofect. All rights reserved. | ||||
// | Created by Jung Sang-Taik on 12. 3. 16.. | |||
Copyright (c) 2012 Neofect. All rights reserved. | ||||
Permission is hereby granted, free of charge, to any person obtaining a cop | ||||
y | ||||
of this software and associated documentation files (the "Software"), to de | ||||
al | ||||
in the Software without restriction, including without limitation the right | ||||
s | ||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
copies of the Software, and to permit persons to whom the Software is | ||||
furnished to do so, subject to the following conditions: | ||||
The above copyright notice and this permission notice shall be included in | ||||
all copies or substantial portions of the Software. | ||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
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, | ||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
THE SOFTWARE. | ||||
*************************************************************************** | ||||
*/ | ||||
#ifndef __CCScale9Sprite_H__ | #ifndef __CCScale9Sprite_H__ | |||
#define __CCScale9Sprite_H__ | #define __CCScale9Sprite_H__ | |||
#include "base_nodes/CCNode.h" | #include "cocos2d.h" | |||
#include "CCProtocols.h" | ||||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
namespace cocos2d { class CCSprite; } | ||||
namespace cocos2d { class CCSpriteBatchNode; } | ||||
namespace cocos2d { class CCSpriteFrame; } | ||||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
enum positions | ||||
{ | ||||
pCentre = 0, | ||||
pTop, | ||||
pLeft, | ||||
pRight, | ||||
pBottom, | ||||
pTopRight, | ||||
pTopLeft, | ||||
pBottomRight, | ||||
pBottomLeft | ||||
}; | ||||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
* @addtogroup control_extension | * @addtogroup control_extension | |||
* @{ | * @{ | |||
*/ | */ | |||
class CCScale9Sprite : public CCNode, CCRGBAProtocol | class CCScale9Sprite : public CCNode, public CCRGBAProtocol | |||
{ | { | |||
public: | public: | |||
CCScale9Sprite(); | CCScale9Sprite(); | |||
virtual ~CCScale9Sprite(); | virtual ~CCScale9Sprite(); | |||
public: | public: | |||
/** Original sprite's size. */ | /** Original sprite's size. */ | |||
CC_SYNTHESIZE(CCSize, m_originalSize, OriginalSize); | CC_SYNTHESIZE_READONLY(CCSize, m_originalSize, OriginalSize); | |||
/** Prefered sprite's size. By default the prefered size is the origina l size. */ | /** Prefered sprite's size. By default the prefered size is the origina l size. */ | |||
//if the preferredSize component is given as -1, it is ignored | //if the preferredSize component is given as -1, it is ignored | |||
CC_PROPERTY(CCSize, m_preferredSize, PreferredSize); | CC_PROPERTY(CCSize, m_preferredSize, PreferredSize); | |||
/** | /** | |||
* The end-cap insets. | * The end-cap insets. | |||
* On a non-resizeable sprite, this property is set to CGRectZero; the sprite | * On a non-resizeable sprite, this property is set to CGRectZero; the sprite | |||
* does not use end caps and the entire sprite is subject to stretching . | * does not use end caps and the entire sprite is subject to stretching . | |||
*/ | */ | |||
/** Opacity: conforms to CCRGBAProtocol protocol */ | ||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity) | ||||
/** Color: conforms to CCRGBAProtocol protocol */ | ||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color) | ||||
CC_PROPERTY(CCRect, m_capInsets, CapInsets); | CC_PROPERTY(CCRect, m_capInsets, CapInsets); | |||
/** Sets the left side inset */ | ||||
CC_PROPERTY(float, m_insetLeft, InsetLeft); | CC_PROPERTY(float, m_insetLeft, InsetLeft); | |||
/** Sets the top side inset */ | ||||
CC_PROPERTY(float, m_insetTop, InsetTop); | CC_PROPERTY(float, m_insetTop, InsetTop); | |||
/** Sets the right side inset */ | ||||
CC_PROPERTY(float, m_insetRight, InsetRight); | CC_PROPERTY(float, m_insetRight, InsetRight); | |||
/** Sets the bottom side inset */ | ||||
CC_PROPERTY(float, m_insetBottom, InsetBottom); | CC_PROPERTY(float, m_insetBottom, InsetBottom); | |||
/** Opacity: conforms to CCRGBAProtocol protocol */ | ||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity) | ||||
/** Color: conforms to CCRGBAProtocol protocol */ | ||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color) | ||||
protected: | protected: | |||
bool m_bSpritesGenerated; | ||||
CCRect m_spriteRect; | CCRect m_spriteRect; | |||
bool m_bSpriteFrameRotated; | ||||
CCRect m_capInsetsInternal; | CCRect m_capInsetsInternal; | |||
bool m_positionsAreDirty; | bool m_positionsAreDirty; | |||
CCSpriteBatchNode* scale9Image; | CCSpriteBatchNode* scale9Image; | |||
CCSprite* topLeft; | CCSprite* topLeft; | |||
CCSprite* top; | CCSprite* top; | |||
CCSprite* topRight; | CCSprite* topRight; | |||
CCSprite* left; | CCSprite* left; | |||
CCSprite* centre; | CCSprite* centre; | |||
CCSprite* right; | CCSprite* right; | |||
skipping to change at line 101 | skipping to change at line 108 | |||
void updateCapInset(); | void updateCapInset(); | |||
void updatePositions(); | void updatePositions(); | |||
public: | public: | |||
virtual void setContentSize(const CCSize & size); | virtual void setContentSize(const CCSize & size); | |||
virtual void visit(); | virtual void visit(); | |||
virtual bool init(); | virtual bool init(); | |||
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rec t, bool rotated, CCRect capInsets); | ||||
virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rec t, CCRect capInsets); | virtual bool initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rec t, CCRect capInsets); | |||
/** | /** | |||
* Initializes a 9-slice sprite with a texture file, a delimitation zon e and | * Initializes a 9-slice sprite with a texture file, a delimitation zon e and | |||
* with the specified cap insets. | * with the specified cap insets. | |||
* Once the sprite is created, you can then call its "setContentSize:" method | * Once the sprite is created, you can then call its "setContentSize:" method | |||
* to resize the sprite will all it's 9-slice goodness intract. | * to resize the sprite will all it's 9-slice goodness intract. | |||
* It respects the anchorPoint too. | * It respects the anchorPoint too. | |||
* | * | |||
* @param file The name of the texture file. | * @param file The name of the texture file. | |||
* @param rect The rectangle that describes the sub-part of the texture that | * @param rect The rectangle that describes the sub-part of the texture that | |||
skipping to change at line 155 | skipping to change at line 163 | |||
*/ | */ | |||
virtual bool initWithFile(const char* file, CCRect rect); | virtual bool initWithFile(const char* file, CCRect rect); | |||
/** | /** | |||
* Creates a 9-slice sprite with a texture file and a delimitation zone . The | * Creates a 9-slice sprite with a texture file and a delimitation zone . The | |||
* texture will be broken down into a 3×3 grid of equal blocks. | * texture will be broken down into a 3×3 grid of equal blocks. | |||
* | * | |||
* @see initWithFile:rect: | * @see initWithFile:rect: | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect); | CC_DEPRECATED_ATTRIBUTE static CCScale9Sprite* spriteWithFile(const cha r* file, CCRect rect); | |||
/** | /** | |||
* Creates a 9-slice sprite with a texture file and a delimitation zone . The | * Creates a 9-slice sprite with a texture file and a delimitation zone . The | |||
* texture will be broken down into a 3×3 grid of equal blocks. | * texture will be broken down into a 3×3 grid of equal blocks. | |||
* | * | |||
* @see initWithFile:rect: | * @see initWithFile:rect: | |||
*/ | */ | |||
static CCScale9Sprite* create(const char* file, CCRect rect); | static CCScale9Sprite* create(const char* file, CCRect rect); | |||
/** | /** | |||
skipping to change at line 379 | skipping to change at line 387 | |||
Textures with premultiplied alpha will have this property by default o n YES. Otherwise the default value is NO | Textures with premultiplied alpha will have this property by default o n YES. Otherwise the default value is NO | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
virtual void setOpacityModifyRGB(bool bValue); | virtual void setOpacityModifyRGB(bool bValue); | |||
/** returns whether or not the opacity will be applied using glColor(R, G,B,opacity) or glColor(opacity, opacity, opacity, opacity); | /** returns whether or not the opacity will be applied using glColor(R, G,B,opacity) or glColor(opacity, opacity, opacity, opacity); | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
virtual bool isOpacityModifyRGB(void); | virtual bool isOpacityModifyRGB(void); | |||
virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect r ect, CCRect capInsets); | virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect r ect, bool rotated, CCRect capInsets); | |||
virtual void setSpriteFrame(CCSpriteFrame * spriteFrame); | virtual void setSpriteFrame(CCSpriteFrame * spriteFrame); | |||
}; | }; | |||
// end of GUI group | // end of GUI group | |||
/// @} | /// @} | |||
/// @} | /// @} | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
End of changes. 17 change blocks. | ||||
35 lines changed or deleted | 49 lines changed or added | |||
CCScheduler.h | CCScheduler.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 50 | skipping to change at line 50 | |||
// Priority level reserved for system services. | // Priority level reserved for system services. | |||
#define kCCPrioritySystem INT_MIN | #define kCCPrioritySystem INT_MIN | |||
// Minimum priority level for user scheduling. | // Minimum priority level for user scheduling. | |||
#define kCCPriorityNonSystemMin (kCCPrioritySystem+1) | #define kCCPriorityNonSystemMin (kCCPrioritySystem+1) | |||
class CCSet; | class CCSet; | |||
// | // | |||
// CCTimer | // CCTimer | |||
// | // | |||
/** @brief Light weight timer */ | /** @brief Light-weight timer */ | |||
class CC_DLL CCTimer : public CCObject | class CC_DLL CCTimer : public CCObject | |||
{ | { | |||
public: | public: | |||
CCTimer(void); | CCTimer(void); | |||
/** get interval in seconds */ | /** get interval in seconds */ | |||
inline float getInterval(void) { return m_fInterval; } | inline float getInterval(void) { return m_fInterval; } | |||
/** set interval in seconds */ | /** set interval in seconds */ | |||
inline void setInterval(float fInterval){ m_fInterval = fInterval; } | inline void setInterval(float fInterval){ m_fInterval = fInterval; } | |||
skipping to change at line 83 | skipping to change at line 83 | |||
public: | public: | |||
/** Allocates a timer with a target and a selector. */ | /** Allocates a timer with a target and a selector. */ | |||
static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSele ctor); | static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSele ctor); | |||
/** Allocates a timer with a target, a selector and an interval in seco nds. */ | /** Allocates a timer with a target, a selector and an interval in seco nds. */ | |||
static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSele ctor, float fSeconds); | static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSele ctor, float fSeconds); | |||
/** Allocates a timer with a script callback function and an interval i n seconds. */ | /** Allocates a timer with a script callback function and an interval i n seconds. */ | |||
static CCTimer* timerWithScriptHandler(int nHandler, float fSeconds); | static CCTimer* timerWithScriptHandler(int nHandler, float fSeconds); | |||
inline int getScriptHandler() { return m_nScriptHandler; }; | ||||
public: | public: | |||
SEL_SCHEDULE m_pfnSelector; | SEL_SCHEDULE m_pfnSelector; | |||
float m_fInterval; | float m_fInterval; | |||
protected: | protected: | |||
CCObject *m_pTarget; | CCObject *m_pTarget; | |||
float m_fElapsed; | float m_fElapsed; | |||
bool m_bRunForever; | bool m_bRunForever; | |||
bool m_bUseDelay; | bool m_bUseDelay; | |||
unsigned int m_nTimesExecuted; | unsigned int m_nTimesExecuted; | |||
unsigned int m_nRepeat; //0 = once, 1 is 2 x executed | unsigned int m_nRepeat; //0 = once, 1 is 2 x executed | |||
float m_fDelay; | float m_fDelay; | |||
int m_nScriptHandler; | int m_nScriptHandler; | |||
}; | }; | |||
// | // | |||
// CCScheduler | // CCScheduler | |||
// | // | |||
struct _listEntry; | struct _listEntry; | |||
struct _hashSelectorEntry; | struct _hashSelectorEntry; | |||
struct _hashUpdateEntry; | struct _hashUpdateEntry; | |||
class CCArray; | class CCArray; | |||
/** @brief Scheduler is responsible of triggering the scheduled callbacks. | /** @brief Scheduler is responsible for triggering the scheduled callbacks. | |||
You should not use NSTimer. Instead use this class. | You should not use NSTimer. Instead use this class. | |||
There are 2 different types of callbacks (selectors): | There are 2 different types of callbacks (selectors): | |||
- update selector: the 'update' selector will be called every frame. You ca n customize the priority. | - update selector: the 'update' selector will be called every frame. You ca n customize the priority. | |||
- custom selector: A custom selector will be called every frame, or with a custom interval of time | - custom selector: A custom selector will be called every frame, or with a custom interval of time | |||
The 'custom selectors' should be avoided when possible. It is faster, and c onsumes less memory to use the 'update selector'. | The 'custom selectors' should be avoided when possible. It is faster, and c onsumes less memory to use the 'update selector'. | |||
*/ | */ | |||
skipping to change at line 142 | skipping to change at line 145 | |||
*/ | */ | |||
inline void setTimeScale(float fTimeScale) { m_fTimeScale = fTimeScale; } | inline void setTimeScale(float fTimeScale) { m_fTimeScale = fTimeScale; } | |||
/** 'update' the scheduler. | /** 'update' the scheduler. | |||
You should NEVER call this method, unless you know what you are doing. | You should NEVER call this method, unless you know what you are doing. | |||
*/ | */ | |||
void update(float dt); | void update(float dt); | |||
/** The scheduled method will be called every 'interval' seconds. | /** The scheduled method will be called every 'interval' seconds. | |||
If paused is YES, then it won't be called until it is resumed. | If paused is YES, then it won't be called until it is resumed. | |||
If 'interval' is 0, it will be called every frame, but if so, it recom mened to use 'scheduleUpdateForTarget:' instead. | If 'interval' is 0, it will be called every frame, but if so, it's rec ommended to use 'scheduleUpdateForTarget:' instead. | |||
If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again. | If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again. | |||
repeat let the action be repeated repeat + 1 times, use kCCRepeatForev er to let the action run continiously | repeat let the action be repeated repeat + 1 times, use kCCRepeatForev er to let the action run continuously | |||
delay is the amount of time the action will wait before it'll start | delay is the amount of time the action will wait before it'll start | |||
@since v0.99.3, repeat and delay added in v1.1 | @since v0.99.3, repeat and delay added in v1.1 | |||
*/ | */ | |||
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, floa t fInterval, bool bPaused, unsigned int repeat, float delay); | void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, floa t fInterval, bool bPaused, unsigned int repeat, float delay); | |||
/** calls scheduleSelector with kCCRepeatForever and a 0 delay */ | /** calls scheduleSelector with kCCRepeatForever and a 0 delay */ | |||
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, floa t fInterval, bool bPaused); | void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, floa t fInterval, bool bPaused); | |||
/** Schedules the 'update' selector for a given target with a given pri ority. | /** Schedules the 'update' selector for a given target with a given pri ority. | |||
The 'update' selector will be called every frame. | The 'update' selector will be called every frame. | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||
CCScriptSupport.h | CCScriptSupport.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 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 __SCRIPT_SUPPORT_H__ | #ifndef __SCRIPT_SUPPORT_H__ | |||
#define __SCRIPT_SUPPORT_H__ | #define __SCRIPT_SUPPORT_H__ | |||
#include "platform/CCCommon.h" | #include "platform/CCCommon.h" | |||
#include "touch_dispatcher/CCTouch.h" | #include "touch_dispatcher/CCTouch.h" | |||
#include "cocoa/CCSet.h" | #include "cocoa/CCSet.h" | |||
#include <map> | ||||
#include <string> | ||||
#include <list> | ||||
typedef struct lua_State lua_State; | typedef struct lua_State lua_State; | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
class CCTimer; | class CCTimer; | |||
class CCLayer; | ||||
class CCMenuItem; | ||||
class CCNotificationCenter; | ||||
class CCCallFunc; | ||||
enum ccScriptType { | ||||
kScriptTypeNone = 0, | ||||
kScriptTypeLua, | ||||
kScriptTypeJavascript | ||||
}; | ||||
// #pragma mark - | ||||
// #pragma mark CCScriptHandlerEntry | ||||
class CCScriptHandlerEntry : public CCObject | ||||
{ | ||||
public: | ||||
static CCScriptHandlerEntry* create(int nHandler); | ||||
~CCScriptHandlerEntry(void); | ||||
int getHandler(void) { | ||||
return m_nHandler; | ||||
} | ||||
int getEntryId(void) { | ||||
return m_nEntryId; | ||||
} | ||||
protected: | ||||
CCScriptHandlerEntry(int nHandler) | ||||
: m_nHandler(nHandler) | ||||
{ | ||||
static int newEntryId = 0; | ||||
newEntryId++; | ||||
m_nEntryId = newEntryId; | ||||
} | ||||
int m_nHandler; | ||||
int m_nEntryId; | ||||
}; | ||||
/** | /** | |||
* @addtogroup script_support | * @addtogroup script_support | |||
* @{ | * @{ | |||
*/ | */ | |||
// Lua support for CCScheduler | // #pragma mark - | |||
class CCSchedulerScriptHandlerEntry : public CCObject | // #pragma mark CCSchedulerScriptHandlerEntry | |||
class CCSchedulerScriptHandlerEntry : public CCScriptHandlerEntry | ||||
{ | { | |||
public: | public: | |||
// nHandler return by tolua_ref_function(), called from LuaCocos2d.cpp | // nHandler return by tolua_ref_function(), called from LuaCocos2d.cpp | |||
static CCSchedulerScriptHandlerEntry* entryWithHandler(int nHandler, fl oat fInterval, bool bPaused); | static CCSchedulerScriptHandlerEntry* create(int nHandler, float fInter val, bool bPaused); | |||
~CCSchedulerScriptHandlerEntry(void); | ~CCSchedulerScriptHandlerEntry(void); | |||
inline cocos2d::CCTimer* getTimer(void) { | cocos2d::CCTimer* getTimer(void) { | |||
return m_pTimer; | return m_pTimer; | |||
} | } | |||
inline bool isPaused(void) { | bool isPaused(void) { | |||
return m_bPaused; | return m_bPaused; | |||
} | } | |||
inline int getEntryID(void) { | void markedForDeletion(void) { | |||
return m_nEntryID; | ||||
} | ||||
inline void markedForDeletion(void) { | ||||
m_bMarkedForDeletion = true; | m_bMarkedForDeletion = true; | |||
} | } | |||
inline bool isMarkedForDeletion(void) { | bool isMarkedForDeletion(void) { | |||
return m_bMarkedForDeletion; | return m_bMarkedForDeletion; | |||
} | } | |||
private: | private: | |||
CCSchedulerScriptHandlerEntry(void); | CCSchedulerScriptHandlerEntry(int nHandler) | |||
bool initWithHandler(int nHandler, float fInterval, bool bPaused); | : CCScriptHandlerEntry(nHandler) | |||
, m_pTimer(NULL) | ||||
, m_bPaused(false) | ||||
, m_bMarkedForDeletion(false) | ||||
{ | ||||
} | ||||
bool init(float fInterval, bool bPaused); | ||||
cocos2d::CCTimer* m_pTimer; | cocos2d::CCTimer* m_pTimer; | |||
bool m_bPaused; | bool m_bPaused; | |||
bool m_bMarkedForDeletion; | bool m_bMarkedForDeletion; | |||
int m_nHandler; | ||||
int m_nEntryID; | ||||
}; | }; | |||
// Lua support for touch events | // #pragma mark - | |||
class CCTouchScriptHandlerEntry : public CCObject | // #pragma mark CCTouchScriptHandlerEntry | |||
class CCTouchScriptHandlerEntry : public CCScriptHandlerEntry | ||||
{ | { | |||
public: | public: | |||
static CCTouchScriptHandlerEntry* entryWithHandler(int nHandler, bool b IsMultiTouches, int nPriority, bool bSwallowsTouches); | static CCTouchScriptHandlerEntry* create(int nHandler, bool bIsMultiTou ches, int nPriority, bool bSwallowsTouches); | |||
~CCTouchScriptHandlerEntry(void); | ~CCTouchScriptHandlerEntry(void); | |||
inline int getHandler(void) { | bool isMultiTouches(void) { | |||
return m_nHandler; | ||||
} | ||||
inline bool isMultiTouches(void) { | ||||
return m_bIsMultiTouches; | return m_bIsMultiTouches; | |||
} | } | |||
inline int getPriority(void) { | int getPriority(void) { | |||
return m_nPriority; | return m_nPriority; | |||
} | } | |||
inline bool getSwallowsTouches(void) { | bool getSwallowsTouches(void) { | |||
return m_bSwallowsTouches; | return m_bSwallowsTouches; | |||
} | } | |||
private: | private: | |||
CCTouchScriptHandlerEntry(void); | CCTouchScriptHandlerEntry(int nHandler) | |||
bool initWithHandler(int nHandler, bool bIsMultiTouches, int nPriority, | : CCScriptHandlerEntry(nHandler) | |||
bool bSwallowsTouches); | , m_bIsMultiTouches(false) | |||
, m_nPriority(0) | ||||
, m_bSwallowsTouches(false) | ||||
{ | ||||
} | ||||
bool init(bool bIsMultiTouches, int nPriority, bool bSwallowsTouches); | ||||
int m_nHandler; | ||||
bool m_bIsMultiTouches; | bool m_bIsMultiTouches; | |||
int m_nPriority; | int m_nPriority; | |||
bool m_bSwallowsTouches; | bool m_bSwallowsTouches; | |||
}; | }; | |||
class CC_DLL CCScriptEngineProtocol : public CCObject | // #pragma mark - | |||
// #pragma mark CCScriptEngineProtocol | ||||
// Don't make CCScriptEngineProtocol inherits from CCObject since setScript | ||||
Engine is invoked only once in AppDelegate.cpp, | ||||
// It will affect the lifecycle of ScriptCore instance, the autorelease poo | ||||
l will be destroyed before destructing ScriptCore. | ||||
// So a crash will appear on Win32 if you click the close button. | ||||
class CC_DLL CCScriptEngineProtocol | ||||
{ | { | |||
public: | public: | |||
/** | virtual ~CCScriptEngineProtocol() {}; | |||
@brief Method used to get a pointer to the lua_State that the script m | ||||
odule is attached to. | ||||
@return A pointer to the lua_State that the script module is attached | ||||
to. | ||||
*/ | ||||
virtual lua_State* getLuaState(void) = 0; | ||||
/** | /** Get script type */ | |||
@brief Remove CCObject from lua state | virtual ccScriptType getScriptType() { return kScriptTypeNone; }; | |||
@param object to remove | ||||
*/ | ||||
virtual void removeCCObjectByID(int nLuaID) = 0; | ||||
/** | /** Remove script object. */ | |||
@brief Remove Lua function handler | virtual void removeScriptObjectByCCObject(CCObject* pObj) = 0; | |||
*/ | ||||
virtual void removeLuaHandler(int nHandler) = 0; | ||||
/** | /** Remove script function handler, only CCLuaEngine class need to impl | |||
@brief Add a path to find lua files in | ement this function. */ | |||
@param path to be added to the Lua path | virtual void removeScriptHandler(int nHandler) {}; | |||
*/ | ||||
virtual void addSearchPath(const char* path) = 0; | ||||
/** | /** | |||
@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 executed correctly. | |||
@return other if the string is excuted wrongly. | @return other if the string is executed wrongly. | |||
*/ | */ | |||
virtual int executeString(const char* codes) = 0; | virtual int executeString(const char* codes) = 0; | |||
/** | /** | |||
@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) = 0; | virtual int executeScriptFile(const char* filename) = 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. | |||
@param functionName String object holding the name of the function, in the global script environment, that is to be executed. | @param functionName String object holding the name of the function, in the global script environment, that is to be executed. | |||
@return The integer value returned from the script function. | @return The integer value returned from the script function. | |||
*/ | */ | |||
virtual int executeGlobalFunction(const char* functionName) = 0; | virtual int executeGlobalFunction(const char* functionName) = 0; | |||
/** | /** | |||
@brief Execute a function by handler | @brief Execute a node event function | |||
@param The function handler | @param pNode which node produce this event | |||
@param Number of parameters | @param nAction kCCNodeOnEnter,kCCNodeOnExit,kCCMenuItemActivated,kCCNo | |||
deOnEnterTransitionDidFinish,kCCNodeOnExitTransitionDidStart | ||||
@return The integer value returned from the script function. | @return The integer value returned from the script function. | |||
*/ | */ | |||
virtual int executeFunctionByHandler(int nHandler, int numArgs = 0) = 0 | virtual int executeNodeEvent(CCNode* pNode, int nAction) = 0; | |||
; | ||||
virtual int executeFunctionWithIntegerData(int nHandler, int data) = 0; | ||||
virtual int executeFunctionWithFloatData(int nHandler, float data) = 0; | ||||
virtual int executeFunctionWithBooleanData(int nHandler, bool data) = 0 | ||||
; | ||||
virtual int executeFunctionWithCCObject(int nHandler, CCObject* pObject | ||||
, const char* typeName) = 0; | ||||
virtual int pushIntegerToLuaStack(int data) = 0; | ||||
virtual int pushFloatToLuaStack(int data) = 0; | ||||
virtual int pushBooleanToLuaStack(int data) = 0; | ||||
virtual int pushCCObjectToLuaStack(CCObject* pObject, const char* typeN | ||||
ame) = 0; | ||||
// functions for excute touch event | ||||
virtual int executeTouchEvent(int nHandler, int eventType, CCTouch *pTo | ||||
uch) = 0; | ||||
virtual int executeTouchesEvent(int nHandler, int eventType, CCSet *pTo | ||||
uches) = 0; | ||||
// execute a schedule function | virtual int executeMenuItemEvent(CCMenuItem* pMenuItem) = 0; | |||
virtual int executeSchedule(int nHandler, float dt) = 0; | /** Execute a notification event function */ | |||
virtual int executeNotificationEvent(CCNotificationCenter* pNotificatio | ||||
nCenter, const char* pszName) = 0; | ||||
/** execute a callfun event */ | ||||
virtual int executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* p | ||||
Target = NULL) = 0; | ||||
/** execute a schedule function */ | ||||
virtual int executeSchedule(CCTimer* pTimer, float dt, CCNode* pNode = | ||||
NULL) = 0; | ||||
/** functions for execute touch event */ | ||||
virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CC | ||||
Set *pTouches) = 0; | ||||
virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTo | ||||
uch *pTouch) = 0; | ||||
}; | }; | |||
/** | /** | |||
CCScriptEngineManager is a singleton which holds an object instance of CCS criptEngineProtocl | CCScriptEngineManager is a singleton which holds an object instance of CCS criptEngineProtocl | |||
It helps cocos2d-x and the user code to find back LuaEngine object | It helps cocos2d-x and the user code to find back LuaEngine object | |||
@since v0.99.5-x-0.8.5 | @since v0.99.5-x-0.8.5 | |||
*/ | */ | |||
class CC_DLL CCScriptEngineManager | class CC_DLL CCScriptEngineManager | |||
{ | { | |||
public: | public: | |||
End of changes. 29 change blocks. | ||||
102 lines changed or deleted | 143 lines changed or added | |||
CCScrollView.h | CCScrollView.h | |||
---|---|---|---|---|
// | /************************************************************************** | |||
// SWScrollView.h | ** | |||
// SWGameLib | Copyright (c) 2012 cocos2d-x.org | |||
// | Copyright (c) 2010 Sangwoo Im | |||
// Copyright (c) 2010-2012 cocos2d-x.org | ||||
// Copyright (c) 2010 Sangwoo Im | http://www.cocos2d-x.org | |||
// | ||||
// Permission is hereby granted, free of charge, to any person obtaining a | Permission is hereby granted, free of charge, to any person obtaining a co | |||
copy | py | |||
// of this software and associated documentation files (the "Software"), t | of this software and associated documentation files (the "Software"), to d | |||
o deal | eal | |||
// in the Software without restriction, including without limitation the r | in the Software without restriction, including without limitation the righ | |||
ights | ts | |||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or se | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
ll | 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 | all copies or substantial portions of the Software. | |||
in | ||||
// all copies or substantial portions of the Software. | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH | |||
OR | E | |||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
, | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FR | |||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | OM, | |||
THE | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | THE SOFTWARE. | |||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ************************************************************************** | |||
FROM, | **/ | |||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||||
IN | ||||
// THE SOFTWARE. | ||||
// | ||||
// | ||||
// Created by Sangwoo Im on 6/3/10. | ||||
// Copyright 2010 Sangwoo Im. All rights reserved. | ||||
// | ||||
#ifndef __CCSCROLLVIEW_H__ | #ifndef __CCSCROLLVIEW_H__ | |||
#define __CCSCROLLVIEW_H__ | #define __CCSCROLLVIEW_H__ | |||
#include "layers_scenes_transitions_nodes/CCLayer.h" | #include "layers_scenes_transitions_nodes/CCLayer.h" | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
* @addtogroup GUI | * @addtogroup GUI | |||
* @{ | * @{ | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
CCScrollViewDirectionHorizontal = 0, | kCCScrollViewDirectionNone = -1, | |||
CCScrollViewDirectionVertical, | kCCScrollViewDirectionHorizontal = 0, | |||
CCScrollViewDirectionBoth | kCCScrollViewDirectionVertical, | |||
kCCScrollViewDirectionBoth | ||||
} CCScrollViewDirection; | } CCScrollViewDirection; | |||
class CCScrollView; | class CCScrollView; | |||
class CCScrollViewDelegate | class CCScrollViewDelegate | |||
{ | { | |||
public: | public: | |||
virtual ~CCScrollViewDelegate() {} | virtual ~CCScrollViewDelegate() {} | |||
virtual void scrollViewDidScroll(CCScrollView* view) = 0; | virtual void scrollViewDidScroll(CCScrollView* view) = 0; | |||
virtual void scrollViewDidZoom(CCScrollView* view) = 0; | virtual void scrollViewDidZoom(CCScrollView* view) = 0; | |||
skipping to change at line 195 | skipping to change at line 191 | |||
CCSize getViewSize() { return m_tViewSize; } | CCSize getViewSize() { return m_tViewSize; } | |||
void setViewSize(CCSize size); | void setViewSize(CCSize size); | |||
CCNode * getContainer(); | CCNode * getContainer(); | |||
void setContainer(CCNode * pContainer); | void setContainer(CCNode * pContainer); | |||
/** | /** | |||
* direction allowed to scroll. CCScrollViewDirectionBoth by default. | * direction allowed to scroll. CCScrollViewDirectionBoth by default. | |||
*/ | */ | |||
CCScrollViewDirection getDirection() { return m_eDirection; } | CCScrollViewDirection getDirection() { return m_eDirection; } | |||
void setDirection(CCScrollViewDirection eDirection) { m_eDirection = eD irection; } | virtual void setDirection(CCScrollViewDirection eDirection) { m_eDirect ion = eDirection; } | |||
CCScrollViewDelegate* getDelegate() { return m_pDelegate; } | CCScrollViewDelegate* getDelegate() { return m_pDelegate; } | |||
void setDelegate(CCScrollViewDelegate* pDelegate) { m_pDelegate = pDele gate; } | void setDelegate(CCScrollViewDelegate* pDelegate) { m_pDelegate = pDele gate; } | |||
/** override functions */ | /** override functions */ | |||
// optional | // optional | |||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent); | virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent); | |||
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); | |||
virtual void setContentSize(const CCSize & size); | virtual void setContentSize(const CCSize & size); | |||
virtual const CCSize & getContentSize(); | virtual const CCSize & getContentSize(); | |||
void updateInset(); | ||||
/** | /** | |||
* Determines whether it clips its children or not. | * Determines whether it clips its children or not. | |||
*/ | */ | |||
bool isClippingToBounds() { return m_bClippingToBounds; } | bool isClippingToBounds() { return m_bClippingToBounds; } | |||
void setClippingToBounds(bool bClippingToBounds) { m_bClippingToBounds = bClippingToBounds; } | void setClippingToBounds(bool bClippingToBounds) { m_bClippingToBounds = bClippingToBounds; } | |||
virtual void visit(); | virtual void visit(); | |||
virtual void addChild(CCNode * child, int zOrder, int tag); | virtual void addChild(CCNode * child, int zOrder, int tag); | |||
virtual void addChild(CCNode * child, int zOrder); | virtual void addChild(CCNode * child, int zOrder); | |||
virtual void addChild(CCNode * child); | virtual void addChild(CCNode * child); | |||
End of changes. 4 change blocks. | ||||
43 lines changed or deleted | 37 lines changed or added | |||
CCScrollViewLoader.h | CCScrollViewLoader.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
/* Forward declaration. */ | /* Forward declaration. */ | |||
class CCBReader; | class CCBReader; | |||
class CCScrollViewLoader : public CCNodeLoader { | class CCScrollViewLoader : public CCNodeLoader { | |||
public: | public: | |||
virtual ~CCScrollViewLoader() {}; | virtual ~CCScrollViewLoader() {}; | |||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScrollViewLoader, loader ); | CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScrollViewLoader, loader ); | |||
protected: | protected: | |||
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScrollView); | CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScrollView); | |||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * p Parent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader); | ||||
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pPare nt, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader ); | virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pPare nt, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader ); | |||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent , CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader); | virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent , CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader); | |||
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent , CCString * pPropertyName, float pFloat, CCBReader * pCCBReader); | virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent , CCString * pPropertyName, float pFloat, CCBReader * pCCBReader); | |||
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBR eader); | virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBR eader); | |||
}; | }; | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCSet.h | CCSet.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
typedef std::set<CCObject *>::iterator CCSetIterator; | typedef std::set<CCObject *>::iterator CCSetIterator; | |||
class CC_DLL CCSet : public CCObject | class CC_DLL CCSet : public CCObject | |||
{ | { | |||
public: | public: | |||
CCSet(void); | CCSet(void); | |||
CCSet(const CCSet &rSetObject); | CCSet(const CCSet &rSetObject); | |||
virtual ~CCSet(void); | virtual ~CCSet(void); | |||
/** | /** | |||
*@brief Return a copy of the CCSet, it will copy all the elelments. | *@brief Return a copy of the CCSet, it will copy all the elements. | |||
*/ | */ | |||
CCSet* copy(); | CCSet* copy(); | |||
/** | /** | |||
*@brief It is the same as copy(). | *@brief It is the same as copy(). | |||
*/ | */ | |||
CCSet* mutableCopy(); | CCSet* mutableCopy(); | |||
/** | /** | |||
*@brief Return the number of elements the CCSet contains. | *@brief Return the number of elements the CCSet contains. | |||
*/ | */ | |||
int count(); | int count(); | |||
skipping to change at line 76 | skipping to change at line 76 | |||
void removeObject(CCObject *pObject); | void removeObject(CCObject *pObject); | |||
/** | /** | |||
*@brief Check if CCSet contains a element equals pObject. | *@brief Check if CCSet contains a element equals pObject. | |||
*/ | */ | |||
bool containsObject(CCObject *pObject); | bool containsObject(CCObject *pObject); | |||
/** | /** | |||
*@brief Return the iterator that points to the first element. | *@brief Return the iterator that points to the first element. | |||
*/ | */ | |||
CCSetIterator begin(); | CCSetIterator begin(); | |||
/** | /** | |||
*@brief Return the iterator that points to the poisition after the last element. | *@brief Return the iterator that points to the position after the last element. | |||
*/ | */ | |||
CCSetIterator end(); | CCSetIterator end(); | |||
/** | /** | |||
*@brief Return the first element if it contains elements, or null if it doesn't contain any element. | *@brief Return the first element if it contains elements, or null if it doesn't contain any element. | |||
*/ | */ | |||
CCObject* anyObject(); | CCObject* anyObject(); | |||
private: | private: | |||
std::set<CCObject *> *m_pSet; | std::set<CCObject *> *m_pSet; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCShaderCache.h | CCShaderCache.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2011 Ricardo Quesada | Copyright (c) 2011 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCSprite.h | CCSprite.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 53 | skipping to change at line 53 | |||
class CCPoint; | class CCPoint; | |||
class CCSize; | class CCSize; | |||
class CCTexture2D; | class CCTexture2D; | |||
struct transformValues_; | struct transformValues_; | |||
/** | /** | |||
* @addtogroup sprite_nodes | * @addtogroup sprite_nodes | |||
* @{ | * @{ | |||
*/ | */ | |||
#define CCSpriteIndexNotInitialized 0xffffffff /// CCSprite invalid ind ex on the CCSpriteBatchode | #define CCSpriteIndexNotInitialized 0xffffffff /// CCSprite invalid ind ex on the CCSpriteBatchNode | |||
/** CCSprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_ graphics) ) | /** CCSprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_ graphics) ) | |||
* | * | |||
* CCSprite can be created with an image, or with a sub-rectangle of an imag e. | * CCSprite can be created with an image, or with a sub-rectangle of an imag e. | |||
* | * | |||
* If the parent or any of its ancestors is a CCSpriteBatchNode then the fol lowing features/limitations are valid | * If the parent or any of its ancestors is a CCSpriteBatchNode then the fol lowing features/limitations are valid | |||
* - Features when the parent is a CCBatchNode: | * - Features when the parent is a CCBatchNode: | |||
* - MUCH faster rendering, specially if the CCSpriteBatchNode has ma ny children. All the children will be drawn in a single batch. | * - MUCH faster rendering, specially if the CCSpriteBatchNode has ma ny children. All the children will be drawn in a single batch. | |||
* | * | |||
* - Limitations | * - Limitations | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCSpriteBatchNode.h | CCSpriteBatchNode.h | |||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, e tc) and capacity of children. | /** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, e tc) and capacity of children. | |||
The capacity will be increased in 33% in runtime if it run out of space . | The capacity will be increased in 33% in runtime if it run out of space . | |||
The file will be loaded using the TextureMgr. | The file will be loaded using the TextureMgr. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCSpriteBatchNode* batchNodeWithFile(con st char* fileImage, unsigned int capacity = kDefaultSpriteBatchCapacity); | CC_DEPRECATED_ATTRIBUTE static CCSpriteBatchNode* batchNodeWithFile(con st char* fileImage, unsigned int capacity = kDefaultSpriteBatchCapacity); | |||
/** creates a CCSpriteBatchNode with a texture2d and capacity of childr en. | /** creates a CCSpriteBatchNode with a texture2d and capacity of childr en. | |||
The capacity will be increased in 33% in runtime if it run out of space . | The capacity will be increased in 33% in runtime if it run out of space . | |||
*/ | */ | |||
static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex, unsigned | static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex, unsigned | |||
int capacity = kDefaultSpriteBatchCapacity); | int capacity); | |||
static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex) { | ||||
return CCSpriteBatchNode::createWithTexture(tex, kDefaultSpriteBatc | ||||
hCapacity); | ||||
} | ||||
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, e tc) and capacity of children. | /** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, e tc) and capacity of children. | |||
The capacity will be increased in 33% in runtime if it run out of space . | The capacity will be increased in 33% in runtime if it run out of space . | |||
The file will be loaded using the TextureMgr. | The file will be loaded using the TextureMgr. | |||
*/ | */ | |||
static CCSpriteBatchNode* create(const char* fileImage, unsigned int ca | static CCSpriteBatchNode* create(const char* fileImage, unsigned int ca | |||
pacity = kDefaultSpriteBatchCapacity); | pacity); | |||
static CCSpriteBatchNode* create(const char* fileImage) { | ||||
return CCSpriteBatchNode::create(fileImage, kDefaultSpriteBatchCapa | ||||
city); | ||||
} | ||||
/** initializes a CCSpriteBatchNode with a texture2d and capacity of ch ildren. | /** initializes a CCSpriteBatchNode with a texture2d and capacity of ch ildren. | |||
The capacity will be increased in 33% in runtime if it run out of space . | The capacity will be increased in 33% in runtime if it run out of space . | |||
*/ | */ | |||
bool initWithTexture(CCTexture2D *tex, unsigned int capacity); | bool initWithTexture(CCTexture2D *tex, unsigned int capacity); | |||
/** initializes a CCSpriteBatchNode with a file image (.png, .jpeg, .pv r, etc) and a capacity of children. | /** initializes a CCSpriteBatchNode with a file image (.png, .jpeg, .pv r, etc) and a capacity of children. | |||
The capacity will be increased in 33% in runtime if it run out of space . | The capacity will be increased in 33% in runtime if it run out of space . | |||
The file will be loaded using the TextureMgr. | The file will be loaded using the TextureMgr. | |||
*/ | */ | |||
bool initWithFile(const char* fileImage, unsigned int capacity); | bool initWithFile(const char* fileImage, unsigned int capacity); | |||
skipping to change at line 154 | skipping to change at line 160 | |||
virtual void addChild(CCNode * child, int zOrder); | virtual void addChild(CCNode * child, int zOrder); | |||
virtual void addChild(CCNode * child, int zOrder, int tag); | virtual void addChild(CCNode * child, int zOrder, int tag); | |||
virtual void reorderChild(CCNode * child, int zOrder); | virtual void reorderChild(CCNode * child, int zOrder); | |||
virtual void removeChild(CCNode* child, bool cleanup); | virtual void removeChild(CCNode* child, bool cleanup); | |||
virtual void removeAllChildrenWithCleanup(bool cleanup); | virtual void removeAllChildrenWithCleanup(bool cleanup); | |||
virtual void sortAllChildren(); | virtual void sortAllChildren(); | |||
virtual void draw(void); | virtual void draw(void); | |||
protected: | protected: | |||
/* IMPORTANT XXX IMPORTNAT: | /* IMPORTANT XXX IMPORTANT: | |||
* These 2 methods can't be part of CCTMXLayer since they call [super ad d...], and CCSpriteSheet#add SHALL not be called | * These 2 methods can't be part of CCTMXLayer since they call [super ad d...], and CCSpriteSheet#add SHALL not be called | |||
*/ | */ | |||
/* Adds a quad into the texture atlas but it won't be added into the ch ildren array. | /* Adds a quad into the texture atlas but it won't be added into the ch ildren array. | |||
This method should be called only when you are dealing with very big At lasSrite and when most of the CCSprite won't be updated. | This method should be called only when you are dealing with very big At lasSprite and when most of the CCSprite won't be updated. | |||
For example: a tile map (CCTMXMap) or a label with lots of characters ( BitmapFontAtlas) | For example: a tile map (CCTMXMap) or a label with lots of characters ( BitmapFontAtlas) | |||
*/ | */ | |||
void addQuadFromSprite(CCSprite *sprite, unsigned int index); | void addQuadFromSprite(CCSprite *sprite, unsigned int index); | |||
/* This is the opposite of "addQuadFromSprite. | /* This is the opposite of "addQuadFromSprite. | |||
It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas | It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas | |||
*/ | */ | |||
CCSpriteBatchNode * addSpriteWithoutQuad(CCSprite*child, unsigned int z , int aTag); | CCSpriteBatchNode * addSpriteWithoutQuad(CCSprite*child, unsigned int z , int aTag); | |||
private: | private: | |||
void updateAtlasIndex(CCSprite* sprite, int* curIndex); | void updateAtlasIndex(CCSprite* sprite, int* curIndex); | |||
void swap(int oldIndex, int newIndex); | void swap(int oldIndex, int newIndex); | |||
void updateBlendFunc(); | void updateBlendFunc(); | |||
protected: | protected: | |||
CCTextureAtlas *m_pobTextureAtlas; | CCTextureAtlas *m_pobTextureAtlas; | |||
ccBlendFunc m_blendFunc; | ccBlendFunc m_blendFunc; | |||
// all descendants: chlidren, gran children, etc... | // all descendants: children, gran children, etc... | |||
CCArray* m_pobDescendants; | CCArray* m_pobDescendants; | |||
}; | }; | |||
// end of sprite_nodes group | // end of sprite_nodes group | |||
/// @} | /// @} | |||
NS_CC_END | NS_CC_END | |||
#endif // __CC_SPRITE_BATCH_NODE_H__ | #endif // __CC_SPRITE_BATCH_NODE_H__ | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 15 lines changed or added | |||
CCSpriteFrame.h | CCSpriteFrame.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2011 Ricardo Quesada | Copyright (c) 2008-2011 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCSpriteFrameCache.h | CCSpriteFrameCache.h | |||
---|---|---|---|---|
skipping to change at line 107 | skipping to change at line 107 | |||
* Sprite Frames that have a retain count of 1 will be deleted. | * Sprite Frames that have a retain count of 1 will be deleted. | |||
* It is convenient to call this method after when starting a new Scene . | * It is convenient to call this method after when starting a new Scene . | |||
*/ | */ | |||
void removeUnusedSpriteFrames(void); | void removeUnusedSpriteFrames(void); | |||
/** Deletes an sprite frame from the sprite frame cache. */ | /** Deletes an sprite frame from the sprite frame cache. */ | |||
void removeSpriteFrameByName(const char *pszName); | void removeSpriteFrameByName(const char *pszName); | |||
/** Removes multiple Sprite Frames from a plist file. | /** Removes multiple Sprite Frames from a plist file. | |||
* Sprite Frames stored in this file will be removed. | * Sprite Frames stored in this file will be removed. | |||
* It is convinient to call this method when a specific texture needs to be removed. | * It is convenient to call this method when a specific texture needs to be removed. | |||
* @since v0.99.5 | * @since v0.99.5 | |||
*/ | */ | |||
void removeSpriteFramesFromFile(const char* plist); | void removeSpriteFramesFromFile(const char* plist); | |||
private: | private: | |||
/** Removes multiple Sprite Frames from CCDictionary. | /** Removes multiple Sprite Frames from CCDictionary. | |||
* @since v0.99.5 | * @since v0.99.5 | |||
*/ | */ | |||
void removeSpriteFramesFromDictionary(CCDictionary* dictionary); | void removeSpriteFramesFromDictionary(CCDictionary* dictionary); | |||
public: | public: | |||
/** Removes all Sprite Frames associated with the specified textures. | /** Removes all Sprite Frames associated with the specified textures. | |||
* It is convinient to call this method when a specific texture needs to be removed. | * It is convenient to call this method when a specific texture needs to be removed. | |||
* @since v0.995. | * @since v0.995. | |||
*/ | */ | |||
void removeSpriteFramesFromTexture(CCTexture2D* texture); | void removeSpriteFramesFromTexture(CCTexture2D* texture); | |||
/** Returns an Sprite Frame that was previously added. | /** Returns an Sprite Frame that was previously added. | |||
If the name is not found it will return nil. | If the name is not found it will return nil. | |||
You should retain the returned copy if you are going to use it. | You should retain the returned copy if you are going to use it. | |||
*/ | */ | |||
CCSpriteFrame* spriteFrameByName(const char *pszName); | CCSpriteFrame* spriteFrameByName(const char *pszName); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCStdC.h | CCStdC.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
#include "platform/CCPlatformMacros.h" | #include "platform/CCPlatformMacros.h" | |||
#include <float.h> | #include <float.h> | |||
#include <math.h> | #include <math.h> | |||
#include <string.h> | #include <string.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <time.h> | #include <time.h> | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#include <stdint.h> | ||||
#ifndef MIN | #ifndef MIN | |||
#define MIN(x,y) (((x) > (y)) ? (y) : (x)) | #define MIN(x,y) (((x) > (y)) ? (y) : (x)) | |||
#endif // MIN | #endif // MIN | |||
#ifndef MAX | #ifndef MAX | |||
#define MAX(x,y) (((x) < (y)) ? (y) : (x)) | #define MAX(x,y) (((x) < (y)) ? (y) : (x)) | |||
#endif // MAX | #endif // MAX | |||
#endif // __CC_STD_C_H__ | #endif // __CC_STD_C_H__ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
CCString.h | CCString.h | |||
---|---|---|---|---|
skipping to change at line 87 | skipping to change at line 87 | |||
/** get the length of string */ | /** get the length of string */ | |||
unsigned int length() const; | unsigned int length() const; | |||
/** compare to a c string */ | /** compare to a c string */ | |||
int compare(const char *) const; | int compare(const char *) const; | |||
/* override functions */ | /* override functions */ | |||
virtual CCObject* copyWithZone(CCZone* pZone); | virtual CCObject* copyWithZone(CCZone* pZone); | |||
virtual bool isEqual(const CCObject* pObject); | virtual bool isEqual(const CCObject* pObject); | |||
/* static funcitons */ | /* static functions */ | |||
/** create a string with c string | /** create a string with c string | |||
* @return A CCString pointer which is an autorelease object pointer, | * @return A CCString pointer which is an autorelease object pointer, | |||
* it means that you needn't do a release operation unless you retain it. | * it means that you needn't do a release operation unless you retain it. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCString* stringWithCString(const char* pStr); | CC_DEPRECATED_ATTRIBUTE static CCString* stringWithCString(const char* pStr); | |||
/** create a string with std::string | /** create a string with std::string | |||
* @return A CCString pointer which is an autorelease object pointer, | * @return A CCString pointer which is an autorelease object pointer, | |||
* it means that you needn't do a release operation unless you retain it. | * it means that you needn't do a release operation unless you retain it. | |||
skipping to change at line 123 | skipping to change at line 123 | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCString* stringWithData(const unsigned char* pData, unsigned long nLen); | CC_DEPRECATED_ATTRIBUTE static CCString* stringWithData(const unsigned char* pData, unsigned long nLen); | |||
/** create a string with a file, | /** create a string with a file, | |||
* @return A CCString pointer which is an autorelease object pointer, | * @return A CCString pointer which is an autorelease object pointer, | |||
* it means that you needn't do a release operation unless you retain it. | * it means that you needn't do a release operation unless you retain it. | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
*/ | */ | |||
CC_DEPRECATED_ATTRIBUTE static CCString* stringWithContentsOfFile(const char* pszFileName); | CC_DEPRECATED_ATTRIBUTE static CCString* stringWithContentsOfFile(const char* pszFileName); | |||
/** create a string with std string, you can also pass a c string point er because the default constuctor of std::string can access a c string poin ter. | /** create a string with std string, you can also pass a c string point er because the default constructor of std::string can access a c string poi nter. | |||
* @return A CCString pointer which is an autorelease object pointer, | * @return A CCString pointer which is an autorelease object pointer, | |||
* it means that you needn't do a release operation unless you retain it. | * it means that you needn't do a release operation unless you retain it. | |||
*/ | */ | |||
static CCString* create(const std::string& str); | static CCString* create(const std::string& str); | |||
/** create a string with format, it's similar with the c function 'spri ntf', the default buffer size is (1024*100) bytes, | /** create a string with format, it's similar with the c function 'spri ntf', the default buffer size is (1024*100) bytes, | |||
* if you want to change it, you should modify the kMaxStringLen macro in CCString.cpp file. | * if you want to change it, you should modify the kMaxStringLen macro in CCString.cpp file. | |||
* @return A CCString pointer which is an autorelease object pointer, | * @return A CCString pointer which is an autorelease object pointer, | |||
* it means that you needn't do a release operation unless you retain it. | * it means that you needn't do a release operation unless you retain it. | |||
*/ | */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCTMXLayer.h | CCTMXLayer.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009-2010 Ricardo Quesada | Copyright (c) 2009-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 56 | skipping to change at line 56 | |||
It is a subclass of CCSpriteBatchNode. By default the tiles are rendered us ing a CCTextureAtlas. | It is a subclass of CCSpriteBatchNode. By default the tiles are rendered us ing a CCTextureAtlas. | |||
If you modify a tile on runtime, then, that tile will become a CCSprite, ot herwise no CCSprite objects are created. | If you modify a tile on runtime, then, that tile will become a CCSprite, ot herwise no CCSprite objects are created. | |||
The benefits of using CCSprite objects as tiles are: | The benefits of using CCSprite objects as tiles are: | |||
- tiles (CCSprite) can be rotated/scaled/moved with a nice API | - tiles (CCSprite) can be rotated/scaled/moved with a nice API | |||
If the layer contains a property named "cc_vertexz" with an integer (in can be positive or negative), | If the layer contains a property named "cc_vertexz" with an integer (in can be positive or negative), | |||
then all the tiles belonging to the layer will use that value as their Open GL vertex Z for depth. | then all the tiles belonging to the layer will use that value as their Open GL vertex Z for depth. | |||
On the other hand, if the "cc_vertexz" property has the "automatic" value, then the tiles will use an automatic vertex Z value. | On the other hand, if the "cc_vertexz" property has the "automatic" value, then the tiles will use an automatic vertex Z value. | |||
Also before drawing the tiles, GL_ALPHA_TEST will be enabled, and disabled after drawin them. The used alpha func will be: | Also before drawing the tiles, GL_ALPHA_TEST will be enabled, and disabled after drawing them. The used alpha func will be: | |||
glAlphaFunc( GL_GREATER, value ) | glAlphaFunc( GL_GREATER, value ) | |||
"value" by default is 0, but you can change it from Tiled by adding the "cc _alpha_func" property to the layer. | "value" by default is 0, but you can change it from Tiled by adding the "cc _alpha_func" property to the layer. | |||
The value 0 should work for most cases, but if you have tiles that are semi -transparent, then you might want to use a differnt | The value 0 should work for most cases, but if you have tiles that are semi -transparent, then you might want to use a different | |||
value, like 0.5. | value, like 0.5. | |||
For further information, please see the programming guide: | For further information, please see the programming guide: | |||
http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps | http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps | |||
@since v0.8.1 | @since v0.8.1 | |||
Tiles can have tile flags for additional properties. At the moment only fli p horizontal and flip vertical are used. These bit flags are defined in CCT MXXMLParser.h. | Tiles can have tile flags for additional properties. At the moment only fli p horizontal and flip vertical are used. These bit flags are defined in CCT MXXMLParser.h. | |||
@since 1.1 | @since 1.1 | |||
*/ | */ | |||
class CC_DLL CCTMXLayer : public CCSpriteBatchNode | class CC_DLL CCTMXLayer : public CCSpriteBatchNode | |||
{ | { | |||
/** size of the layer in tiles */ | /** size of the layer in tiles */ | |||
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tLayerSize, LayerSize); | CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tLayerSize, LayerSize); | |||
/** size of the map's tile (could be differnt from the tile's size) */ | /** size of the map's tile (could be different from the tile's size) */ | |||
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapTileSize, MapTileSize); | CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapTileSize, MapTileSize); | |||
/** pointer to the map of tiles */ | /** pointer to the map of tiles */ | |||
CC_SYNTHESIZE(unsigned int*, m_pTiles, Tiles); | CC_SYNTHESIZE(unsigned int*, m_pTiles, Tiles); | |||
/** Tilset information for the layer */ | /** Tileset information for the layer */ | |||
CC_PROPERTY(CCTMXTilesetInfo*, m_pTileSet, TileSet); | CC_PROPERTY(CCTMXTilesetInfo*, m_pTileSet, TileSet); | |||
/** Layer orientation, which is the same as the map orientation */ | /** Layer orientation, which is the same as the map orientation */ | |||
CC_SYNTHESIZE(unsigned int, m_uLayerOrientation, LayerOrientation); | CC_SYNTHESIZE(unsigned int, m_uLayerOrientation, LayerOrientation); | |||
/** properties from the layer. They can be added using Tiled */ | /** properties from the layer. They can be added using Tiled */ | |||
CC_PROPERTY(CCDictionary*, m_pProperties, Properties); | CC_PROPERTY(CCDictionary*, m_pProperties, Properties); | |||
public: | public: | |||
CCTMXLayer(); | CCTMXLayer(); | |||
virtual ~CCTMXLayer(); | virtual ~CCTMXLayer(); | |||
/** creates a CCTMXLayer with an tileset info, a layer info and a map i nfo | /** creates a CCTMXLayer with an tileset info, a layer info and a map i nfo | |||
@deprecated: This interface will be deprecated sooner or later. | @deprecated: This interface will be deprecated sooner or later. | |||
skipping to change at line 162 | skipping to change at line 162 | |||
/** Creates the tiles */ | /** Creates the tiles */ | |||
void setupTiles(); | void setupTiles(); | |||
/** CCTMXLayer doesn't support adding a CCSprite manually. | /** CCTMXLayer doesn't support adding a CCSprite manually. | |||
@warning addchild(z, tag); is not supported on CCTMXLayer. Instead of s etTileGID. | @warning addchild(z, tag); is not supported on CCTMXLayer. Instead of s etTileGID. | |||
*/ | */ | |||
virtual void addChild(CCNode * child, int zOrder, int tag); | virtual void addChild(CCNode * child, int zOrder, int tag); | |||
// super method | // super method | |||
void removeChild(CCNode* child, bool cleanup); | void removeChild(CCNode* child, bool cleanup); | |||
/** listen the event to invoke CCTexture2D::setAliasTexParameters() aft | ||||
er | ||||
comming to foreground on android | ||||
*/ | ||||
void listenBackToForeground(CCObject *sender); | ||||
inline const char* getLayerName(){ return m_sLayerName.c_str(); } | inline const char* getLayerName(){ return m_sLayerName.c_str(); } | |||
inline void setLayerName(const char *layerName){ m_sLayerName = layerNa me; } | inline void setLayerName(const char *layerName){ m_sLayerName = layerNa me; } | |||
private: | private: | |||
CCPoint positionForIsoAt(const CCPoint& pos); | CCPoint positionForIsoAt(const CCPoint& pos); | |||
CCPoint positionForOrthoAt(const CCPoint& pos); | CCPoint positionForOrthoAt(const CCPoint& pos); | |||
CCPoint positionForHexAt(const CCPoint& pos); | CCPoint positionForHexAt(const CCPoint& pos); | |||
CCPoint calculateLayerOffset(const CCPoint& offset); | CCPoint calculateLayerOffset(const CCPoint& offset); | |||
/* optimization methos */ | /* optimization methods */ | |||
CCSprite* appendTileForGID(unsigned int gid, const CCPoint& pos); | CCSprite* appendTileForGID(unsigned int gid, const CCPoint& pos); | |||
CCSprite* insertTileForGID(unsigned int gid, const CCPoint& pos); | CCSprite* insertTileForGID(unsigned int gid, const CCPoint& pos); | |||
CCSprite* updateTileForGID(unsigned int gid, const CCPoint& pos); | CCSprite* updateTileForGID(unsigned int gid, const CCPoint& pos); | |||
/* The layer recognizes some special properties, like cc_vertez */ | /* The layer recognizes some special properties, like cc_vertez */ | |||
void parseInternalProperties(); | void parseInternalProperties(); | |||
void setupTileSprite(CCSprite* sprite, CCPoint pos, unsigned int gid); | void setupTileSprite(CCSprite* sprite, CCPoint pos, unsigned int gid); | |||
CCSprite* reusedTileWithRect(CCRect rect); | CCSprite* reusedTileWithRect(CCRect rect); | |||
int vertexZForPos(const CCPoint& pos); | int vertexZForPos(const CCPoint& pos); | |||
End of changes. 7 change blocks. | ||||
12 lines changed or deleted | 6 lines changed or added | |||
CCTMXObjectGroup.h | CCTMXObjectGroup.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2010 Neophit | Copyright (c) 2010 Neophit | |||
Copyright (c) 2010 Ricardo Quesada | Copyright (c) 2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCTMXTiledMap.h | CCTMXTiledMap.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009-2010 Ricardo Quesada | Copyright (c) 2009-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 45 | skipping to change at line 45 | |||
class CCTMXLayer; | class CCTMXLayer; | |||
class CCTMXLayerInfo; | class CCTMXLayerInfo; | |||
class CCTMXTilesetInfo; | class CCTMXTilesetInfo; | |||
class CCTMXMapInfo; | class CCTMXMapInfo; | |||
/** | /** | |||
* @addtogroup tilemap_parallax_nodes | * @addtogroup tilemap_parallax_nodes | |||
* @{ | * @{ | |||
*/ | */ | |||
/** Possible oritentations of the TMX map */ | /** Possible orientations of the TMX map */ | |||
enum | enum | |||
{ | { | |||
/** Orthogonal orientation */ | /** Orthogonal orientation */ | |||
CCTMXOrientationOrtho, | CCTMXOrientationOrtho, | |||
/** Hexagonal orientation */ | /** Hexagonal orientation */ | |||
CCTMXOrientationHex, | CCTMXOrientationHex, | |||
/** Isometric orientation */ | /** Isometric orientation */ | |||
CCTMXOrientationIso, | CCTMXOrientationIso, | |||
skipping to change at line 67 | skipping to change at line 67 | |||
/** @brief CCTMXTiledMap knows how to parse and render a TMX map. | /** @brief CCTMXTiledMap knows how to parse and render a TMX map. | |||
It adds support for the TMX tiled map format used by http://www.mapeditor.o rg | It adds support for the TMX tiled map format used by http://www.mapeditor.o rg | |||
It supports isometric, hexagonal and orthogonal tiles. | It supports isometric, hexagonal and orthogonal tiles. | |||
It also supports object groups, objects, and properties. | It also supports object groups, objects, and properties. | |||
Features: | Features: | |||
- Each tile will be treated as an CCSprite | - Each tile will be treated as an CCSprite | |||
- The sprites are created on demand. They will be created only when you cal l "layer->tileAt(position)" | - The sprites are created on demand. They will be created only when you cal l "layer->tileAt(position)" | |||
- Each tile can be rotated / moved / scaled / tinted / "opacitied", since e ach tile is a CCSprite | - Each tile can be rotated / moved / scaled / tinted / "opaqued", since eac h tile is a CCSprite | |||
- Tiles can be added/removed in runtime | - Tiles can be added/removed in runtime | |||
- The z-order of the tiles can be modified in runtime | - The z-order of the tiles can be modified in runtime | |||
- Each tile has an anchorPoint of (0,0) | - Each tile has an anchorPoint of (0,0) | |||
- The anchorPoint of the TMXTileMap is (0,0) | - The anchorPoint of the TMXTileMap is (0,0) | |||
- The TMX layers will be added as a child | - The TMX layers will be added as a child | |||
- The TMX layers will be aliased by default | - The TMX layers will be aliased by default | |||
- The tileset image will be loaded using the CCTextureCache | - The tileset image will be loaded using the CCTextureCache | |||
- Each tile will have a unique tag | - Each tile will have a unique tag | |||
- Each tile will have a unique z value. top-left: z=1, bottom-right: z=max z | - Each tile will have a unique z value. top-left: z=1, bottom-right: z=max z | |||
- Each object group will be treated as an CCMutableArray | - Each object group will be treated as an CCMutableArray | |||
- Object class which will contain all the properties in a dictionary | - Object class which will contain all the properties in a dictionary | |||
- Properties can be assigned to the Map, Layer, Object Group, and Object | - Properties can be assigned to the Map, Layer, Object Group, and Object | |||
Limitations: | Limitations: | |||
- It only supports one tileset per layer. | - It only supports one tileset per layer. | |||
- Embeded images are not supported | - Embedded images are not supported | |||
- It only supports the XML format (the JSON format is not supported) | - It only supports the XML format (the JSON format is not supported) | |||
Technical description: | Technical description: | |||
Each layer is created using an CCTMXLayer (subclass of CCSpriteBatchNode). If you have 5 layers, then 5 CCTMXLayer will be created, | Each layer is created using an CCTMXLayer (subclass of CCSpriteBatchNode). If you have 5 layers, then 5 CCTMXLayer will be created, | |||
unless the layer visibility is off. In that case, the layer won't be create d at all. | unless the layer visibility is off. In that case, the layer won't be create d at all. | |||
You can obtain the layers (CCTMXLayer objects) at runtime by: | You can obtain the layers (CCTMXLayer objects) at runtime by: | |||
- map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer , etc... | - map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer , etc... | |||
- map->layerNamed(name_of_the_layer); | - map->layerNamed(name_of_the_layer); | |||
Each object group is created using a CCTMXObjectGroup which is a subclass o f CCMutableArray. | Each object group is created using a CCTMXObjectGroup which is a subclass o f CCMutableArray. | |||
skipping to change at line 150 | skipping to change at line 150 | |||
/** initializes a TMX Tiled Map with a TMX file */ | /** initializes a TMX Tiled Map with a TMX file */ | |||
bool initWithTMXFile(const char *tmxFile); | bool initWithTMXFile(const char *tmxFile); | |||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a p ath to TMX resources */ | /** initializes a TMX Tiled Map with a TMX formatted XML string and a p ath to TMX resources */ | |||
bool initWithXML(const char* tmxString, const char* resourcePath); | bool initWithXML(const char* tmxString, const char* resourcePath); | |||
/** return the TMXLayer for the specific layer */ | /** return the TMXLayer for the specific layer */ | |||
CCTMXLayer* layerNamed(const char *layerName); | CCTMXLayer* layerNamed(const char *layerName); | |||
/** return the TMXObjectGroup for the secific group */ | /** return the TMXObjectGroup for the specific group */ | |||
CCTMXObjectGroup* objectGroupNamed(const char *groupName); | CCTMXObjectGroup* objectGroupNamed(const char *groupName); | |||
/** return the value for the specific property name */ | /** return the value for the specific property name */ | |||
CCString *propertyNamed(const char *propertyName); | CCString *propertyNamed(const char *propertyName); | |||
/** return properties dictionary for tile GID */ | /** return properties dictionary for tile GID */ | |||
CCDictionary* propertiesForGID(int GID); | CCDictionary* propertiesForGID(int GID); | |||
private: | private: | |||
CCTMXLayer * parseLayer(CCTMXLayerInfo *layerInfo, CCTMXMapInfo *mapInf o); | CCTMXLayer * parseLayer(CCTMXLayerInfo *layerInfo, CCTMXMapInfo *mapInf o); | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
CCTMXXMLParser.h | CCTMXXMLParser.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009-2010 Ricardo Quesada | Copyright (c) 2009-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 108 | skipping to change at line 108 | |||
unsigned int m_uMinGID; | unsigned int m_uMinGID; | |||
unsigned int m_uMaxGID; | unsigned int m_uMaxGID; | |||
CCPoint m_tOffset; | CCPoint m_tOffset; | |||
public: | public: | |||
CCTMXLayerInfo(); | CCTMXLayerInfo(); | |||
virtual ~CCTMXLayerInfo(); | virtual ~CCTMXLayerInfo(); | |||
}; | }; | |||
/** @brief CCTMXTilesetInfo contains the information about the tilesets lik e: | /** @brief CCTMXTilesetInfo contains the information about the tilesets lik e: | |||
- Tileset name | - Tileset name | |||
- Tilset spacing | - Tileset spacing | |||
- Tileset margin | - Tileset margin | |||
- size of the tiles | - size of the tiles | |||
- Image used for the tiles | - Image used for the tiles | |||
- Image size | - Image size | |||
This information is obtained from the TMX file. | This information is obtained from the TMX file. | |||
*/ | */ | |||
class CC_DLL CCTMXTilesetInfo : public CCObject | class CC_DLL CCTMXTilesetInfo : public CCObject | |||
{ | { | |||
public: | public: | |||
skipping to change at line 168 | skipping to change at line 168 | |||
/// tilesets | /// tilesets | |||
CC_PROPERTY(CCArray*, m_pTilesets, Tilesets); | CC_PROPERTY(CCArray*, m_pTilesets, Tilesets); | |||
/// ObjectGroups | /// ObjectGroups | |||
CC_PROPERTY(CCArray*, m_pObjectGroups, ObjectGroups); | CC_PROPERTY(CCArray*, m_pObjectGroups, ObjectGroups); | |||
/// parent element | /// parent element | |||
CC_SYNTHESIZE(int, m_nParentElement, ParentElement); | CC_SYNTHESIZE(int, m_nParentElement, ParentElement); | |||
/// parent GID | /// parent GID | |||
CC_SYNTHESIZE(unsigned int, m_uParentGID, ParentGID); | CC_SYNTHESIZE(unsigned int, m_uParentGID, ParentGID); | |||
/// layer attribs | /// layer attribs | |||
CC_SYNTHESIZE(int, m_nLayerAttribs, LayerAttribs); | CC_SYNTHESIZE(int, m_nLayerAttribs, LayerAttribs); | |||
/// is stroing characters? | /// is storing characters? | |||
CC_SYNTHESIZE(bool, m_bStoringCharacters, StoringCharacters); | CC_SYNTHESIZE(bool, m_bStoringCharacters, StoringCharacters); | |||
/// properties | /// properties | |||
CC_PROPERTY(CCDictionary*, m_pProperties, Properties); | CC_PROPERTY(CCDictionary*, m_pProperties, Properties); | |||
public: | public: | |||
CCTMXMapInfo(); | CCTMXMapInfo(); | |||
virtual ~CCTMXMapInfo(); | virtual ~CCTMXMapInfo(); | |||
/** creates a TMX Format with a tmx file */ | /** creates a TMX Format with a tmx file */ | |||
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile); | static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile); | |||
/** creates a TMX Format with an XML string and a TMX resource path */ | /** creates a TMX Format with an XML string and a TMX resource path */ | |||
static CCTMXMapInfo * formatWithXML(const char* tmxString, const char* resourcePath); | static CCTMXMapInfo * formatWithXML(const char* tmxString, const char* resourcePath); | |||
/** initializes a TMX format witha tmx file */ | /** initializes a TMX format with a tmx file */ | |||
bool initWithTMXFile(const char *tmxFile); | bool initWithTMXFile(const char *tmxFile); | |||
/** initializes a TMX format with an XML string and a TMX resource path */ | /** initializes a TMX format with an XML string and a TMX resource path */ | |||
bool initWithXML(const char* tmxString, const char* resourcePath); | bool initWithXML(const char* tmxString, const char* resourcePath); | |||
/** initalises parsing of an XML file, either a tmx (Map) file or tsx ( Tileset) file */ | /** initializes parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */ | |||
bool parseXMLFile(const char *xmlFilename); | bool parseXMLFile(const char *xmlFilename); | |||
/* initalises parsing of an XML string, either a tmx (Map) string or ts x (Tileset) string */ | /* initializes parsing of an XML string, either a tmx (Map) string or t sx (Tileset) string */ | |||
bool parseXMLString(const char *xmlString); | bool parseXMLString(const char *xmlString); | |||
CCDictionary* getTileProperties(); | CCDictionary* getTileProperties(); | |||
void setTileProperties(CCDictionary* tileProperties); | void setTileProperties(CCDictionary* tileProperties); | |||
// implement pure virtual methods of CCSAXDelegator | // implement pure virtual methods of CCSAXDelegator | |||
void startElement(void *ctx, const char *name, const char **atts); | void startElement(void *ctx, const char *name, const char **atts); | |||
void endElement(void *ctx, const char *name); | void endElement(void *ctx, const char *name); | |||
void textHandler(void *ctx, const char *ch, int len); | void textHandler(void *ctx, const char *ch, int len); | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
CCTextFieldTTF.h | CCTextFieldTTF.h | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
/** | /** | |||
* @addtogroup input | * @addtogroup input | |||
* @{ | * @{ | |||
*/ | */ | |||
class CC_DLL CCTextFieldDelegate | class CC_DLL CCTextFieldDelegate | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
@brief If the sender doesn't want to attach with IME, return true; | @brief If the sender doesn't want to attach to the IME, return true; | |||
*/ | */ | |||
virtual bool onTextFieldAttachWithIME(CCTextFieldTTF * sender) | virtual bool onTextFieldAttachWithIME(CCTextFieldTTF * sender) | |||
{ | { | |||
CC_UNUSED_PARAM(sender); | CC_UNUSED_PARAM(sender); | |||
return false; | return false; | |||
} | } | |||
/** | /** | |||
@brief If the sender doesn't want to detach with IME, return true; | @brief If the sender doesn't want to detach from the IME, return tru e; | |||
*/ | */ | |||
virtual bool onTextFieldDetachWithIME(CCTextFieldTTF * sender) | virtual bool onTextFieldDetachWithIME(CCTextFieldTTF * sender) | |||
{ | { | |||
CC_UNUSED_PARAM(sender); | CC_UNUSED_PARAM(sender); | |||
return false; | return false; | |||
} | } | |||
/** | /** | |||
@brief If the sender doesn't want to insert the text, return true; | @brief If the sender doesn't want to insert the text, return true; | |||
*/ | */ | |||
skipping to change at line 85 | skipping to change at line 85 | |||
*/ | */ | |||
virtual bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const c har * delText, int nLen) | virtual bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const c har * delText, int nLen) | |||
{ | { | |||
CC_UNUSED_PARAM(sender); | CC_UNUSED_PARAM(sender); | |||
CC_UNUSED_PARAM(delText); | CC_UNUSED_PARAM(delText); | |||
CC_UNUSED_PARAM(nLen); | CC_UNUSED_PARAM(nLen); | |||
return false; | return false; | |||
} | } | |||
/** | /** | |||
@brief If doesn't want draw sender as default, return true. | @brief If the sender doesn't want to draw, return true. | |||
*/ | */ | |||
virtual bool onDraw(CCTextFieldTTF * sender) | virtual bool onDraw(CCTextFieldTTF * sender) | |||
{ | { | |||
CC_UNUSED_PARAM(sender); | CC_UNUSED_PARAM(sender); | |||
return false; | return false; | |||
} | } | |||
}; | }; | |||
/** | /** | |||
@brief A simple text input field with TTF font. | @brief A simple text input field with TTF font. | |||
skipping to change at line 120 | skipping to change at line 120 | |||
bool initWithPlaceHolder(const char *placeholder, const CCSize& dimensi ons, CCTextAlignment alignment, const char *fontName, float fontSize); | bool initWithPlaceHolder(const char *placeholder, const CCSize& dimensi ons, CCTextAlignment alignment, const char *fontName, float fontSize); | |||
/** initializes the CCTextFieldTTF with a font name and font size */ | /** initializes the CCTextFieldTTF with a font name and font size */ | |||
bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize); | bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize); | |||
/** | /** | |||
@brief Open keyboard and receive input text. | @brief Open keyboard and receive input text. | |||
*/ | */ | |||
virtual bool attachWithIME(); | virtual bool attachWithIME(); | |||
/** | /** | |||
@brief End text input and close keyboard. | @brief End text input and close keyboard. | |||
*/ | */ | |||
virtual bool detachWithIME(); | virtual bool detachWithIME(); | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
// properties | // properties | |||
/////////////////////////////////////////////////////////////////////// /// | /////////////////////////////////////////////////////////////////////// /// | |||
CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate); | CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate); | |||
CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount); | CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount); | |||
CC_SYNTHESIZE_PASS_BY_REF(ccColor3B, m_ColorSpaceHolder, ColorSpaceHold er); | CC_SYNTHESIZE_PASS_BY_REF(ccColor3B, m_ColorSpaceHolder, ColorSpaceHold er); | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
CCTexture2D.h | CCTexture2D.h | |||
---|---|---|---|---|
skipping to change at line 117 | skipping to change at line 117 | |||
public: | public: | |||
CCTexture2D(); | CCTexture2D(); | |||
virtual ~CCTexture2D(); | virtual ~CCTexture2D(); | |||
const char* description(void); | const char* description(void); | |||
/** These functions are needed to create mutable textures */ | /** These functions are needed to create mutable textures */ | |||
void releaseData(void *data); | void releaseData(void *data); | |||
void* keepData(void *data, unsigned int length); | void* keepData(void *data, unsigned int length); | |||
/** Intializes with a texture2d with data */ | /** Initializes with a texture2d with data */ | |||
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSiz e); | bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSiz e); | |||
/** | /** | |||
Drawing extensions to make it easy to draw basic quads using a CCTextur e2D object. | Drawing extensions to make it easy to draw basic quads using a CCTextur e2D object. | |||
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_T EXTURE_COORD_ARRAY client states to be enabled. | These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_T EXTURE_COORD_ARRAY client states to be enabled. | |||
*/ | */ | |||
/** draws a texture at a given point */ | /** draws a texture at a given point */ | |||
void drawAtPoint(const CCPoint& point); | void drawAtPoint(const CCPoint& point); | |||
/** draws a texture inside a rect */ | /** draws a texture inside a rect */ | |||
void drawInRect(const CCRect& rect); | void drawInRect(const CCRect& rect); | |||
skipping to change at line 253 | skipping to change at line 253 | |||
private: | private: | |||
bool initPremultipliedATextureWithImage(CCImage * image, unsigned int p ixelsWide, unsigned int pixelsHigh); | bool initPremultipliedATextureWithImage(CCImage * image, unsigned int p ixelsWide, unsigned int pixelsHigh); | |||
// By default PVR images are treated as if they don't have the alpha ch annel premultiplied | // By default PVR images are treated as if they don't have the alpha ch annel premultiplied | |||
bool m_bPVRHaveAlphaPremultiplied; | bool m_bPVRHaveAlphaPremultiplied; | |||
/** pixel format of the texture */ | /** pixel format of the texture */ | |||
CC_PROPERTY_READONLY(CCTexture2DPixelFormat, m_ePixelFormat, PixelForma t) | CC_PROPERTY_READONLY(CCTexture2DPixelFormat, m_ePixelFormat, PixelForma t) | |||
/** width in pixels */ | /** width in pixels */ | |||
CC_PROPERTY_READONLY(unsigned int, m_uPixelsWide, PixelsWide) | CC_PROPERTY_READONLY(unsigned int, m_uPixelsWide, PixelsWide) | |||
/** hight in pixels */ | /** height in pixels */ | |||
CC_PROPERTY_READONLY(unsigned int, m_uPixelsHigh, PixelsHigh) | CC_PROPERTY_READONLY(unsigned int, m_uPixelsHigh, PixelsHigh) | |||
/** texture name */ | /** texture name */ | |||
CC_PROPERTY_READONLY(GLuint, m_uName, Name) | CC_PROPERTY_READONLY(GLuint, m_uName, Name) | |||
/** texture max S */ | /** texture max S */ | |||
CC_PROPERTY(GLfloat, m_fMaxS, MaxS) | CC_PROPERTY(GLfloat, m_fMaxS, MaxS) | |||
/** texture max T */ | /** texture max T */ | |||
CC_PROPERTY(GLfloat, m_fMaxT, MaxT) | CC_PROPERTY(GLfloat, m_fMaxT, MaxT) | |||
/** content size */ | /** content size */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCTextureAtlas.h | CCTextureAtlas.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 46 | skipping to change at line 46 | |||
class CCTexture2D; | class CCTexture2D; | |||
/** | /** | |||
* @addtogroup textures | * @addtogroup textures | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @brief A class that implements a Texture Atlas. | /** @brief A class that implements a Texture Atlas. | |||
Supported features: | Supported features: | |||
* The atlas file can be a PVRTC, PNG or any other fomrat supported by Textu | * The atlas file can be a PVRTC, PNG or any other format supported by Textu | |||
re2D | re2D | |||
* Quads can be udpated in runtime | * Quads can be updated in runtime | |||
* Quads can be added in runtime | * Quads can be added in runtime | |||
* Quads can be removed in runtime | * Quads can be removed in runtime | |||
* Quads can be re-ordered in runtime | * Quads can be re-ordered in runtime | |||
* The TextureAtlas capacity can be increased or decreased in runtime | * The TextureAtlas capacity can be increased or decreased in runtime | |||
* OpenGL component: V3F, C4B, T2F. | * OpenGL component: V3F, C4B, T2F. | |||
The quads are rendered using an OpenGL ES VBO. | The quads are rendered using an OpenGL ES VBO. | |||
To render the quads using an interleaved vertex array list, you should modi fy the ccConfig.h file | To render the quads using an interleaved vertex array list, you should modi fy the ccConfig.h file | |||
*/ | */ | |||
class CC_DLL CCTextureAtlas : public CCObject | class CC_DLL CCTextureAtlas : public CCObject | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
CCTextureCache.h | CCTextureCache.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 73 | skipping to change at line 73 | |||
public: | public: | |||
CCTextureCache(); | CCTextureCache(); | |||
virtual ~CCTextureCache(); | virtual ~CCTextureCache(); | |||
const char* description(void); | const char* description(void); | |||
CCDictionary* snapshotTextures(); | CCDictionary* snapshotTextures(); | |||
/** Retruns ths shared instance of the cache */ | /** Returns the shared instance of the cache */ | |||
static CCTextureCache * sharedTextureCache(); | static CCTextureCache * sharedTextureCache(); | |||
/** purges the cache. It releases the retained instance. | /** purges the cache. It releases the retained instance. | |||
@since v0.99.0 | @since v0.99.0 | |||
*/ | */ | |||
static void purgeSharedTextureCache(); | static void purgeSharedTextureCache(); | |||
/** Returns a Texture2D object given an file image | /** Returns a Texture2D object given an file image | |||
* If the file image was not previously loaded, it will create a new CCT exture2D | * If the file image was not previously loaded, it will create a new CCT exture2D | |||
* object and it will return it. It will use the filename as a key. | * object and it will return it. It will use the filename as a key. | |||
* Otherwise it will return a reference of a previosly loaded image. | * Otherwise it will return a reference of a previously loaded image. | |||
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif | * Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif | |||
*/ | */ | |||
CCTexture2D* addImage(const char* fileimage); | CCTexture2D* addImage(const char* fileimage); | |||
/* Returns a Texture2D object given a file image | /* Returns a Texture2D object given a file image | |||
* If the file image was not previously loaded, it will create a new CCT exture2D object and it will return it. | * If the file image was not previously loaded, it will create a new CCT exture2D object and it will return it. | |||
* Otherwise it will load a texture in a new thread, and when the image is loaded, the callback will be called with the Texture2D as a parameter. | * Otherwise it will load a texture in a new thread, and when the image is loaded, the callback will be called with the Texture2D as a parameter. | |||
* The callback will be called from the main thread, so it is safe to cr eate any cocos2d object from the callback. | * The callback will be called from the main thread, so it is safe to cr eate any cocos2d object from the callback. | |||
* Supported image extensions: .png, .jpg | * Supported image extensions: .png, .jpg | |||
* @since v0.8 | * @since v0.8 | |||
skipping to change at line 129 | skipping to change at line 129 | |||
/** Purges the dictionary of loaded textures. | /** Purges the dictionary of loaded textures. | |||
* Call this method if you receive the "Memory Warning" | * Call this method if you receive the "Memory Warning" | |||
* In the short term: it will free some resources preventing your app fr om being killed | * In the short term: it will free some resources preventing your app fr om being killed | |||
* In the medium term: it will allocate more resources | * In the medium term: it will allocate more resources | |||
* In the long term: it will be the same | * In the long term: it will be the same | |||
*/ | */ | |||
void removeAllTextures(); | void removeAllTextures(); | |||
/** Removes unused textures | /** Removes unused textures | |||
* Textures that have a retain count of 1 will be deleted | * Textures that have a retain count of 1 will be deleted | |||
* It is convinient to call this method after when starting a new Scene | * It is convenient to call this method after when starting a new Scene | |||
* @since v0.8 | * @since v0.8 | |||
*/ | */ | |||
void removeUnusedTextures(); | void removeUnusedTextures(); | |||
/** Deletes a texture from the cache given a texture | /** Deletes a texture from the cache given a texture | |||
*/ | */ | |||
void removeTexture(CCTexture2D* texture); | void removeTexture(CCTexture2D* texture); | |||
/** Deletes a texture from the cache given a its key name | /** Deletes a texture from the cache given a its key name | |||
@since v0.99.4 | @since v0.99.4 | |||
skipping to change at line 153 | skipping to change at line 153 | |||
/** Output to CCLOG the current contents of this CCTextureCache | /** Output to CCLOG the current contents of this CCTextureCache | |||
* This will attempt to calculate the size of each texture, and the tota l texture memory in use | * This will attempt to calculate the size of each texture, and the tota l texture memory in use | |||
* | * | |||
* @since v1.0 | * @since v1.0 | |||
*/ | */ | |||
void dumpCachedTextureInfo(); | void dumpCachedTextureInfo(); | |||
#ifdef CC_SUPPORT_PVRTC | #ifdef CC_SUPPORT_PVRTC | |||
/** Returns a Texture2D object given an PVRTC RAW filename | /** Returns a Texture2D object given an PVRTC RAW filename | |||
* If the file image was not previously loaded, it will create a new CCT exture2D | * If the file image was not previously loaded, it will create a new CCT exture2D | |||
* object and it will return it. Otherwise it will return a reference o f a previosly loaded image | * object and it will return it. Otherwise it will return a reference o f a previously loaded image | |||
* | * | |||
* It can only load square images: width == height, and it must be a pow er of 2 (128,256,512...) | * It can only load square images: width == height, and it must be a pow er of 2 (128,256,512...) | |||
* bpp can only be 2 or 4. 2 means more compression but lower quality. | * bpp can only be 2 or 4. 2 means more compression but lower quality. | |||
* hasAlpha: whether or not the image contains alpha channel | * hasAlpha: whether or not the image contains alpha channel | |||
*/ | */ | |||
CCTexture2D* addPVRTCImage(const char* fileimage, int bpp, bool hasAlph a, int width); | CCTexture2D* addPVRTCImage(const char* fileimage, int bpp, bool hasAlph a, int width); | |||
#endif // CC_SUPPORT_PVRTC | #endif // CC_SUPPORT_PVRTC | |||
/** Returns a Texture2D object given an PVR filename | /** Returns a Texture2D object given an PVR filename | |||
* If the file image was not previously loaded, it will create a new CCT exture2D | * If the file image was not previously loaded, it will create a new CCT exture2D | |||
* object and it will return it. Otherwise it will return a reference o f a previosly loaded image | * object and it will return it. Otherwise it will return a reference o f a previously loaded image | |||
*/ | */ | |||
CCTexture2D* addPVRImage(const char* filename); | CCTexture2D* addPVRImage(const char* filename); | |||
/** Reload all textures | /** Reload all textures | |||
It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1 | It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1 | |||
*/ | */ | |||
static void reloadAllTextures(); | static void reloadAllTextures(); | |||
}; | }; | |||
#if CC_ENABLE_CACHE_TEXTURE_DATA | #if CC_ENABLE_CACHE_TEXTURE_DATA | |||
skipping to change at line 196 | skipping to change at line 196 | |||
public: | public: | |||
VolatileTexture(CCTexture2D *t); | VolatileTexture(CCTexture2D *t); | |||
~VolatileTexture(); | ~VolatileTexture(); | |||
static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format); | static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format); | |||
static void addStringTexture(CCTexture2D *tt, const char* text, const C CSize& dimensions, CCTextAlignment alignment, | static void addStringTexture(CCTexture2D *tt, const char* text, const C CSize& dimensions, CCTextAlignment alignment, | |||
CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize); | CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize); | |||
static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixe lFormat pixelFormat, const CCSize& contentSize); | static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixe lFormat pixelFormat, const CCSize& contentSize); | |||
static void addCCImage(CCTexture2D *tt, CCImage *image); | static void addCCImage(CCTexture2D *tt, CCImage *image); | |||
static void setTexParameters(CCTexture2D *t, ccTexParams *texParams); | ||||
static void removeTexture(CCTexture2D *t); | static void removeTexture(CCTexture2D *t); | |||
static void reloadAllTextures(); | static void reloadAllTextures(); | |||
public: | public: | |||
static std::list<VolatileTexture*> textures; | static std::list<VolatileTexture*> textures; | |||
static bool isReloading; | static bool isReloading; | |||
private: | private: | |||
// find VolatileTexture by CCTexture2D* | // find VolatileTexture by CCTexture2D* | |||
// if not found, create a new one | // if not found, create a new one | |||
skipping to change at line 222 | skipping to change at line 223 | |||
ccCachedImageType m_eCashedImageType; | ccCachedImageType m_eCashedImageType; | |||
void *m_pTextureData; | void *m_pTextureData; | |||
CCSize m_TextureSize; | CCSize m_TextureSize; | |||
CCTexture2DPixelFormat m_PixelFormat; | CCTexture2DPixelFormat m_PixelFormat; | |||
std::string m_strFileName; | std::string m_strFileName; | |||
CCImage::EImageFormat m_FmtImage; | CCImage::EImageFormat m_FmtImage; | |||
ccTexParams m_texParams; | ||||
CCSize m_size; | CCSize m_size; | |||
CCTextAlignment m_alignment; | CCTextAlignment m_alignment; | |||
CCVerticalTextAlignment m_vAlignment; | CCVerticalTextAlignment m_vAlignment; | |||
std::string m_strFontName; | std::string m_strFontName; | |||
std::string m_strText; | std::string m_strText; | |||
float m_fFontSize; | float m_fFontSize; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added | |||
CCTexturePVR.h | CCTexturePVR.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#include "cocoa/CCArray.h" | #include "cocoa/CCArray.h" | |||
NS_CC_BEGIN | NS_CC_BEGIN | |||
/** | /** | |||
* @addtogroup textures | * @addtogroup textures | |||
* @{ | * @{ | |||
*/ | */ | |||
/** | /** | |||
@brief Structure which can tell where mimap begins and how long is it | @brief Structure which can tell where mipmap begins and how long is it | |||
*/ | */ | |||
struct CCPVRMipmap { | struct CCPVRMipmap { | |||
unsigned char *address; | unsigned char *address; | |||
unsigned int len; | unsigned int len; | |||
}; | }; | |||
/** | /** | |||
@brief Detemine how many mipmaps can we have. | @brief Determine how many mipmaps can we have. | |||
Its same as define but it respects namespaces | Its same as define but it respects namespaces | |||
*/ | */ | |||
enum { | enum { | |||
CC_PVRMIPMAP_MAX = 16, | CC_PVRMIPMAP_MAX = 16, | |||
}; | }; | |||
/** CCTexturePVR | /** CCTexturePVR | |||
Object that loads PVR images. | Object that loads PVR images. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCTileMapAtlas.h | CCTileMapAtlas.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 95 | skipping to change at line 95 | |||
void setTile(const ccColor3B& tile, const ccGridSize& position); | void setTile(const ccColor3B& tile, const ccGridSize& position); | |||
/** dealloc the map from memory */ | /** dealloc the map from memory */ | |||
void releaseMap(); | void releaseMap(); | |||
private: | private: | |||
void loadTGAfile(const char *file); | void loadTGAfile(const char *file); | |||
void calculateItemsToRender(); | void calculateItemsToRender(); | |||
void updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index); | void updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index); | |||
void updateAtlasValues(); | void updateAtlasValues(); | |||
protected: | protected: | |||
//! x,y to altas dicctionary | //! x,y to atlas dictionary | |||
CCDictionary* m_pPosToAtlasIndex; | CCDictionary* m_pPosToAtlasIndex; | |||
//! numbers of tiles to render | //! numbers of tiles to render | |||
int m_nItemsToRender; | int m_nItemsToRender; | |||
}; | }; | |||
// end of tilemap_parallax_nodes group | // end of tilemap_parallax_nodes group | |||
/// @} | /// @} | |||
NS_CC_END | NS_CC_END | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
CCTouchDelegateProtocol.h | CCTouchDelegateProtocol.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Valentin Milea | Copyright (c) 2009 Valentin Milea | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 75 | skipping to change at line 75 | |||
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_ UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_ UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | |||
}; | }; | |||
/** | /** | |||
@brief | @brief | |||
Using this type of delegate results in two benefits: | Using this type of delegate results in two benefits: | |||
- 1. You don't need to deal with CCSets, the dispatcher does the job of sp litting | - 1. You don't need to deal with CCSets, the dispatcher does the job of sp litting | |||
them. You get exactly one UITouch per call. | them. You get exactly one UITouch per call. | |||
- 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates o f claimed | - 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates o f claimed | |||
touches are sent only to the delegate(s) that claimed them. So if you get a move/ | touches are sent only to the delegate(s) that claimed them. So if you get a move/ | |||
ended/cancelled update you're sure it's your touch. This frees you from do ing a | ended/canceled update you're sure it's your touch. This frees you from doi ng a | |||
lot of checks when doing multi-touch. | lot of checks when doing multi-touch. | |||
(The name TargetedTouchDelegate relates to updates "targeting" their speci fic | (The name TargetedTouchDelegate relates to updates "targeting" their speci fic | |||
handler, without bothering the other handlers.) | handler, without bothering the other handlers.) | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
class CC_DLL CCTargetedTouchDelegate : public CCTouchDelegate | class CC_DLL CCTargetedTouchDelegate : public CCTouchDelegate | |||
{ | { | |||
public: | public: | |||
/** Return YES to claim the touch. | /** Return YES to claim the touch. | |||
skipping to change at line 97 | skipping to change at line 97 | |||
*/ | */ | |||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CC_UNUSE D_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;}; | virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CC_UNUSE D_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;}; | |||
// optional | // optional | |||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED _PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED _PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | |||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED _PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED _PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | |||
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UN USED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UN USED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);} | |||
}; | }; | |||
/** @brief | /** @brief | |||
This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled). | This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Canceled). | |||
@since v0.8 | @since v0.8 | |||
*/ | */ | |||
class CC_DLL CCStandardTouchDelegate : public CCTouchDelegate | class CC_DLL CCStandardTouchDelegate : public CCTouchDelegate | |||
{ | { | |||
public: | public: | |||
// optional | // optional | |||
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | |||
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | |||
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUS ED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | |||
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_U NUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_U NUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
CCTouchDispatcher.h | CCTouchDispatcher.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Valentin Milea | Copyright (c) 2009 Valentin Milea | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCTouchHandler.h | CCTouchHandler.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Valentin Milea | Copyright (c) 2009 Valentin Milea | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 76 | skipping to change at line 76 | |||
/** allocates a TouchHandler with a delegate and a priority */ | /** allocates a TouchHandler with a delegate and a priority */ | |||
static CCTouchHandler* handlerWithDelegate(CCTouchDelegate *pDelegate, int nPriority); | static CCTouchHandler* handlerWithDelegate(CCTouchDelegate *pDelegate, int nPriority); | |||
protected: | protected: | |||
CCTouchDelegate *m_pDelegate; | CCTouchDelegate *m_pDelegate; | |||
int m_nPriority; | int m_nPriority; | |||
int m_nEnabledSelectors; | int m_nEnabledSelectors; | |||
}; | }; | |||
/** CCStandardTouchHandler | /** CCStandardTouchHandler | |||
It forwardes each event to the delegate. | It forwards each event to the delegate. | |||
*/ | */ | |||
class CC_DLL CCStandardTouchHandler : public CCTouchHandler | class CC_DLL CCStandardTouchHandler : public CCTouchHandler | |||
{ | { | |||
public: | public: | |||
/** initializes a TouchHandler with a delegate and a priority */ | /** initializes a TouchHandler with a delegate and a priority */ | |||
virtual bool initWithDelegate(CCTouchDelegate *pDelegate, int nPriority ); | virtual bool initWithDelegate(CCTouchDelegate *pDelegate, int nPriority ); | |||
public: | public: | |||
/** allocates a TouchHandler with a delegate and a priority */ | /** allocates a TouchHandler with a delegate and a priority */ | |||
static CCStandardTouchHandler* handlerWithDelegate(CCTouchDelegate *pDe legate, int nPriority); | static CCStandardTouchHandler* handlerWithDelegate(CCTouchDelegate *pDe legate, int nPriority); | |||
}; | }; | |||
/** | /** | |||
CCTargetedTouchHandler | CCTargetedTouchHandler | |||
Object than contains the claimed touches and if it swallos touches. | Object than contains the claimed touches and if it swallows touches. | |||
Used internally by TouchDispatcher | Used internally by TouchDispatcher | |||
*/ | */ | |||
class CC_DLL CCTargetedTouchHandler : public CCTouchHandler | class CC_DLL CCTargetedTouchHandler : public CCTouchHandler | |||
{ | { | |||
public: | public: | |||
~CCTargetedTouchHandler(void); | ~CCTargetedTouchHandler(void); | |||
/** whether or not the touches are swallowed */ | /** whether or not the touches are swallowed */ | |||
bool isSwallowsTouches(void); | bool isSwallowsTouches(void); | |||
void setSwallowsTouches(bool bSwallowsTouches); | void setSwallowsTouches(bool bSwallowsTouches); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
CCTransition.h | CCTransition.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 133 | skipping to change at line 133 | |||
/** creates a base transition with duration and incoming scene */ | /** creates a base transition with duration and incoming scene */ | |||
static CCTransitionScene * create(float t, CCScene *scene); | static CCTransitionScene * create(float t, CCScene *scene); | |||
/** initializes a transition with duration and incoming scene */ | /** initializes a transition with duration and incoming scene */ | |||
virtual bool initWithDuration(float t,CCScene* scene); | virtual bool initWithDuration(float t,CCScene* scene); | |||
/** called after the transition finishes */ | /** called after the transition finishes */ | |||
void finish(void); | void finish(void); | |||
/** used by some transitions to hide the outter scene */ | /** used by some transitions to hide the outer scene */ | |||
void hideOutShowIn(void); | void hideOutShowIn(void); | |||
protected: | protected: | |||
virtual void sceneOrder(); | virtual void sceneOrder(); | |||
private: | private: | |||
void setNewScene(float dt); | void setNewScene(float dt); | |||
}; | }; | |||
/** @brief A CCTransition that supports orientation like. | /** @brief A CCTransition that supports orientation like. | |||
skipping to change at line 269 | skipping to change at line 269 | |||
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 incomming and outg oing 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); | TRANSITION_CREATE_FUNC(CCTransitionSlideInL); | |||
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInL); | OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInL); | |||
protected: | protected: | |||
virtual void sceneOrder(); | virtual void sceneOrder(); | |||
skipping to change at line 293 | skipping to change at line 293 | |||
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 incomming and outg oing 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); | TRANSITION_CREATE_FUNC(CCTransitionSlideInR); | |||
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInR); | OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInR); | |||
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 incomming and outg oing 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); | TRANSITION_CREATE_FUNC(CCTransitionSlideInB); | |||
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInB); | OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInB); | |||
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 incomming and outg oing 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); | TRANSITION_CREATE_FUNC(CCTransitionSlideInT); | |||
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInT); | OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInT); | |||
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 | |||
skipping to change at line 372 | skipping to change at line 372 | |||
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); | |||
kOrientationRightOver); | 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); | |||
kOrientationUpOver); | 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 | static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientatio | |||
n o = kOrientationRightOver); | n o); | |||
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 | static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation | |||
o = kOrientationRightOver); | o); | |||
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 | static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation | |||
o = kOrientationUpOver); | o); | |||
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 | static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrient | |||
ation o = kOrientationRightOver); | ation o); | |||
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 482 | skipping to change at line 500 | |||
/** 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 | static CCTransitionFade* create(float duration,CCScene* scene, const cc | |||
Color3B& color = ccBLACK); | Color3B& color); | |||
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; | |||
End of changes. 13 change blocks. | ||||
20 lines changed or deleted | 40 lines changed or added | |||
CCTransitionPageTurn.h | CCTransitionPageTurn.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ | Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCTransitionProgress.h | CCTransitionProgress.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Lam Pham | Copyright (c) 2009 Lam Pham | |||
Copyright (c) 2012 Ricardo Quesada | Copyright (c) 2012 Ricardo Quesada | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 61 | skipping to change at line 61 | |||
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 colock-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) | OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) | |||
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) | TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) | |||
protected: | protected: | |||
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | |||
}; | }; | |||
/** CCTransitionRadialCW transition. | /** CCTransitionRadialCW transition. | |||
A counter colock-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) | OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) | |||
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) | TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) | |||
protected: | protected: | |||
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | |||
}; | }; | |||
/** CCTransitionProgressHorizontal transition. | /** CCTransitionProgressHorizontal transition. | |||
A colock-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) | OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) | |||
TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) | TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) | |||
protected: | protected: | |||
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTex ture* texture); | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
CCUserDefault.h | CCUserDefault.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 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 y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CCVertex.h | CCVertex.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
/** | /** | |||
* @addtogroup data_structures | * @addtogroup data_structures | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @file CCVertex.h */ | /** @file CCVertex.h */ | |||
/** converts a line to a polygon */ | /** converts a line to a polygon */ | |||
void CC_DLL ccVertexLineToPolygon(CCPoint *points, float stroke, ccVertex2F *vertices, unsigned int offset, unsigned int nuPoints); | void CC_DLL ccVertexLineToPolygon(CCPoint *points, float stroke, ccVertex2F *vertices, unsigned int offset, unsigned int nuPoints); | |||
/** returns wheter or not the line intersects */ | /** returns whether or not the line intersects */ | |||
bool CC_DLL ccVertexLineIntersect(float Ax, float Ay, | bool CC_DLL ccVertexLineIntersect(float Ax, float Ay, | |||
float Bx, float By, | float Bx, float By, | |||
float Cx, float Cy, | float Cx, float Cy, | |||
float Dx, float Dy, float *T); | float Dx, float Dy, float *T); | |||
// end of data_structures group | // end of data_structures group | |||
/// @} | /// @} | |||
NS_CC_END | NS_CC_END | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ExtensionMacros.h | ExtensionMacros.h | |||
---|---|---|---|---|
/************************************************************************** | ||||
** | ||||
Copyright (c) 2012 cocos2d-x.org | ||||
http://www.cocos2d-x.org | ||||
Permission is hereby granted, free of charge, to any person obtaining a co | ||||
py | ||||
of this software and associated documentation files (the "Software"), to d | ||||
eal | ||||
in the Software without restriction, including without limitation the righ | ||||
ts | ||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
copies of the Software, and to permit persons to whom the Software is | ||||
furnished to do so, subject to the following conditions: | ||||
The above copyright notice and this permission notice shall be included in | ||||
all copies or substantial portions of the Software. | ||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH | ||||
E | ||||
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, | ||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
THE SOFTWARE. | ||||
************************************************************************** | ||||
**/ | ||||
#ifndef __EXTENSIONMARCROS_H__ | #ifndef __EXTENSIONMARCROS_H__ | |||
#define __EXTENSIONMARCROS_H__ | #define __EXTENSIONMARCROS_H__ | |||
#define NS_CC_EXT_BEGIN namespace cocos2d { namespace e xtension { | #define NS_CC_EXT_BEGIN namespace cocos2d { namespace e xtension { | |||
#define NS_CC_EXT_END }} | #define NS_CC_EXT_END }} | |||
#define USING_NS_CC_EXT using namespace cocos2d::extens ion | #define USING_NS_CC_EXT using namespace cocos2d::extens ion | |||
#endif /* __EXTENSIONMARCROS_H__ */ | #endif /* __EXTENSIONMARCROS_H__ */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 31 lines changed or added | |||
HTMLparser.h | HTMLparser.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
typedef xmlDocPtr htmlDocPtr; | typedef xmlDocPtr htmlDocPtr; | |||
typedef xmlNodePtr htmlNodePtr; | typedef xmlNodePtr htmlNodePtr; | |||
/* | /* | |||
* Internal description of an HTML element, representing HTML 4.01 | * Internal description of an HTML element, representing HTML 4.01 | |||
* and XHTML 1.0 (which share the same structure). | * and XHTML 1.0 (which share the same structure). | |||
*/ | */ | |||
typedef struct _htmlElemDesc htmlElemDesc; | typedef struct _htmlElemDesc htmlElemDesc; | |||
typedef htmlElemDesc *htmlElemDescPtr; | typedef htmlElemDesc *htmlElemDescPtr; | |||
struct _htmlElemDesc { | struct _htmlElemDesc { | |||
const char *name; /* The tag name */ | const char *name; /* The tag name */ | |||
char startTag; /* Whether the start tag can be implied */ | char startTag; /* Whether the start tag can be implied */ | |||
char endTag; /* Whether the end tag can be implied */ | char endTag; /* Whether the end tag can be implied */ | |||
char saveEndTag; /* Whether the end tag should be saved */ | char saveEndTag; /* Whether the end tag should be saved */ | |||
char empty; /* Is this an empty element ? */ | char empty; /* Is this an empty element ? */ | |||
char depr; /* Is this a deprecated element ? */ | char depr; /* Is this a deprecated element ? */ | |||
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ | char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ | |||
char isinline; /* is this a block 0 or inline 1 element */ | char isinline; /* is this a block 0 or inline 1 element */ | |||
const char *desc; /* the description */ | const char *desc; /* the description */ | |||
/* NRK Jan.2003 | /* NRK Jan.2003 | |||
* New fields encapsulating HTML structure | * New fields encapsulating HTML structure | |||
* | * | |||
* Bugs: | * Bugs: | |||
* This is a very limited representation. It fails to tell us when | * This is a very limited representation. It fails to tell us when | |||
* an element *requires* subelements (we only have whether they're | * an element *requires* subelements (we only have whether they're | |||
* allowed or not), and it doesn't tell us where CDATA and PCDATA | * allowed or not), and it doesn't tell us where CDATA and PCDATA | |||
* are allowed. Some element relationships are not fully represented: | * are allowed. Some element relationships are not fully represented: | |||
* these are flagged with the word MODIFIER | * these are flagged with the word MODIFIER | |||
*/ | */ | |||
const char** subelts; /* allowed sub-elements of this elem | const char** subelts; /* allowed sub-elements of this element */ | |||
ent */ | const char* defaultsubelt; /* subelement for suggested auto-repair | |||
const char* defaultsubelt; /* subelement for suggested auto-repair | if necessary or NULL */ | |||
if necessary or NULL */ | const char** attrs_opt; /* Optional Attributes */ | |||
const char** attrs_opt; /* Optional Attributes */ | const char** attrs_depr; /* Additional deprecated attributes */ | |||
const char** attrs_depr; /* Additional deprecated attributes | const char** attrs_req; /* Required attributes */ | |||
*/ | ||||
const char** attrs_req; /* Required attributes */ | ||||
}; | }; | |||
/* | /* | |||
* Internal description of an HTML entity. | * Internal description of an HTML entity. | |||
*/ | */ | |||
typedef struct _htmlEntityDesc htmlEntityDesc; | typedef struct _htmlEntityDesc htmlEntityDesc; | |||
typedef htmlEntityDesc *htmlEntityDescPtr; | typedef htmlEntityDesc *htmlEntityDescPtr; | |||
struct _htmlEntityDesc { | struct _htmlEntityDesc { | |||
unsigned int value; /* the UNICODE value for the character */ | unsigned int value; /* the UNICODE value for the character */ | |||
const char *name; /* The entity name */ | const char *name; /* The entity name */ | |||
const char *desc; /* the description */ | const char *desc; /* the description */ | |||
}; | }; | |||
/* | /* | |||
* There is only few public functions. | * There is only few public functions. | |||
*/ | */ | |||
XMLPUBFUN const htmlElemDesc * XMLCALL | XMLPUBFUN const htmlElemDesc * XMLCALL | |||
htmlTagLookup (const xmlChar *tag); | htmlTagLookup (const xmlChar *tag); | |||
XMLPUBFUN const htmlEntityDesc * XMLCALL | XMLPUBFUN const htmlEntityDesc * XMLCALL | |||
htmlEntityLookup(const xmlChar *name); | htmlEntityLookup(const xmlChar *name); | |||
XMLPUBFUN const htmlEntityDesc * XMLCALL | XMLPUBFUN const htmlEntityDesc * XMLCALL | |||
htmlEntityValueLookup(unsigned int value); | htmlEntityValueLookup(unsigned int value); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlIsAutoClosed(htmlDocPtr doc, | htmlIsAutoClosed(htmlDocPtr doc, | |||
htmlNodePtr elem); | htmlNodePtr elem); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlAutoCloseTag(htmlDocPtr doc, | htmlAutoCloseTag(htmlDocPtr doc, | |||
const xmlChar *name, | const xmlChar *name, | |||
htmlNodePtr elem); | htmlNodePtr elem); | |||
XMLPUBFUN const htmlEntityDesc * XMLCALL | XMLPUBFUN const htmlEntityDesc * XMLCALL | |||
htmlParseEntityRef(htmlParserCtxtPtr ctxt, | htmlParseEntityRef(htmlParserCtxtPtr ctxt, | |||
const xmlChar **str); | const xmlChar **str); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlParseCharRef(htmlParserCtxtPtr ctxt); | htmlParseCharRef(htmlParserCtxtPtr ctxt); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
htmlParseElement(htmlParserCtxtPtr ctxt); | htmlParseElement(htmlParserCtxtPtr ctxt); | |||
XMLPUBFUN htmlParserCtxtPtr XMLCALL | XMLPUBFUN htmlParserCtxtPtr XMLCALL | |||
htmlNewParserCtxt(void); | htmlNewParserCtxt(void); | |||
XMLPUBFUN htmlParserCtxtPtr XMLCALL | XMLPUBFUN htmlParserCtxtPtr XMLCALL | |||
htmlCreateMemoryParserCtxt(const char *buffer, | htmlCreateMemoryParserCtxt(const char *buffer, | |||
int size); | int size); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlParseDocument(htmlParserCtxtPtr ctxt); | htmlParseDocument(htmlParserCtxtPtr ctxt); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlSAXParseDoc (xmlChar *cur, | htmlSAXParseDoc (xmlChar *cur, | |||
const char *encoding, | const char *encoding, | |||
htmlSAXHandlerPtr sax, | htmlSAXHandlerPtr sax, | |||
void *userData); | void *userData); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlParseDoc (xmlChar *cur, | htmlParseDoc (xmlChar *cur, | |||
const char *encoding); | const char *encoding); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlSAXParseFile(const char *filename, | htmlSAXParseFile(const char *filename, | |||
const char *encoding, | const char *encoding, | |||
htmlSAXHandlerPtr sax, | htmlSAXHandlerPtr sax, | |||
void *userData); | void *userData); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlParseFile (const char *filename, | htmlParseFile (const char *filename, | |||
const char *encoding); | const char *encoding); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
UTF8ToHtml (unsigned char *out, | UTF8ToHtml (unsigned char *out, | |||
int *outlen, | int *outlen, | |||
const unsigned char *in, | const unsigned char *in, | |||
int *inlen); | int *inlen); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlEncodeEntities(unsigned char *out, | htmlEncodeEntities(unsigned char *out, | |||
int *outlen, | int *outlen, | |||
const unsigned char *in, | const unsigned char *in, | |||
int *inlen, int quoteChar); | int *inlen, int quoteChar); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlIsScriptAttribute(const xmlChar *name); | htmlIsScriptAttribute(const xmlChar *name); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlHandleOmittedElem(int val); | htmlHandleOmittedElem(int val); | |||
#ifdef LIBXML_PUSH_ENABLED | #ifdef LIBXML_PUSH_ENABLED | |||
/** | /** | |||
* Interfaces for the Push mode. | * Interfaces for the Push mode. | |||
*/ | */ | |||
XMLPUBFUN htmlParserCtxtPtr XMLCALL | XMLPUBFUN htmlParserCtxtPtr XMLCALL | |||
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, | htmlCreatePushParserCtxt(htmlSAXHandlerPtr 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 | |||
htmlParseChunk (htmlParserCtxtPtr ctxt, | htmlParseChunk (htmlParserCtxtPtr ctxt, | |||
const char *chunk, | const char *chunk, | |||
int size, | int size, | |||
int terminate); | int terminate); | |||
#endif /* LIBXML_PUSH_ENABLED */ | #endif /* LIBXML_PUSH_ENABLED */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); | htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); | |||
/* | /* | |||
* New set of simpler/more flexible APIs | * New set of simpler/more flexible APIs | |||
*/ | */ | |||
/** | /** | |||
* xmlParserOption: | * xmlParserOption: | |||
* | * | |||
* This is the set of XML parser options that can be passed down | * This is the set of XML parser options that can be passed down | |||
* to the xmlReadDoc() and similar calls. | * to the xmlReadDoc() and similar calls. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ | HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ | |||
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ | HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ | |||
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ | HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ | |||
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ | HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ | |||
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ | HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ | |||
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ | HTML_PARSE_NONET = 1<<11,/* Forbid network access */ | |||
HTML_PARSE_NONET = 1<<11,/* Forbid network access */ | ||||
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ | HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ | |||
HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ | HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ | |||
} htmlParserOption; | } htmlParserOption; | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
htmlCtxtReset (htmlParserCtxtPtr ctxt); | htmlCtxtReset (htmlParserCtxtPtr ctxt); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, | htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlReadDoc (const xmlChar *cur, | htmlReadDoc (const xmlChar *cur, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlReadFile (const char *URL, | htmlReadFile (const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlReadMemory (const char *buffer, | htmlReadMemory (const char *buffer, | |||
int size, | int size, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlReadFd (int fd, | htmlReadFd (int fd, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlReadIO (xmlInputReadCallback ioread, | htmlReadIO (xmlInputReadCallback ioread, | |||
xmlInputCloseCallback ioclose, | xmlInputCloseCallback ioclose, | |||
void *ioctx, | void *ioctx, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, | htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, | |||
const xmlChar *cur, | const xmlChar *cur, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlCtxtReadFile (xmlParserCtxtPtr ctxt, | htmlCtxtReadFile (xmlParserCtxtPtr ctxt, | |||
const char *filename, | const char *filename, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, | htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, | |||
const char *buffer, | const char *buffer, | |||
int size, | int size, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlCtxtReadFd (xmlParserCtxtPtr ctxt, | htmlCtxtReadFd (xmlParserCtxtPtr ctxt, | |||
int fd, | int fd, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
XMLPUBFUN htmlDocPtr XMLCALL | XMLPUBFUN htmlDocPtr XMLCALL | |||
htmlCtxtReadIO (xmlParserCtxtPtr ctxt, | htmlCtxtReadIO (xmlParserCtxtPtr ctxt, | |||
xmlInputReadCallback ioread, | xmlInputReadCallback ioread, | |||
xmlInputCloseCallback ioclose, | xmlInputCloseCallback ioclose, | |||
void *ioctx, | void *ioctx, | |||
const char *URL, | const char *URL, | |||
const char *encoding, | const char *encoding, | |||
int options); | int options); | |||
/* NRK/Jan2003: further knowledge of HTML structure | /* NRK/Jan2003: further knowledge of HTML structure | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
HTML_NA = 0 , /* something we don't check at all */ | HTML_NA = 0 , /* something we don't check at all */ | |||
HTML_INVALID = 0x1 , | HTML_INVALID = 0x1 , | |||
HTML_DEPRECATED = 0x2 , | HTML_DEPRECATED = 0x2 , | |||
HTML_VALID = 0x4 , | HTML_VALID = 0x4 , | |||
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ | HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ | |||
} htmlStatus ; | } htmlStatus ; | |||
/* Using htmlElemDesc rather than name here, to emphasise the fact | /* Using htmlElemDesc rather than name here, to emphasise the fact | |||
that otherwise there's a lookup overhead | that otherwise there's a lookup overhead | |||
*/ | */ | |||
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xml Char*, int) ; | XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xml Char*, int) ; | |||
skipping to change at line 290 | skipping to change at line 289 | |||
* htmlElementAllowedHereDesc: | * htmlElementAllowedHereDesc: | |||
* @parent: HTML parent element | * @parent: HTML parent element | |||
* @elt: HTML element | * @elt: HTML element | |||
* | * | |||
* Checks whether an HTML element description may be a | * Checks whether an HTML element description may be a | |||
* direct child of the specified element. | * direct child of the specified element. | |||
* | * | |||
* Returns 1 if allowed; 0 otherwise. | * Returns 1 if allowed; 0 otherwise. | |||
*/ | */ | |||
#define htmlElementAllowedHereDesc(parent,elt) \ | #define htmlElementAllowedHereDesc(parent,elt) \ | |||
htmlElementAllowedHere((parent), (elt)->name) | htmlElementAllowedHere((parent), (elt)->name) | |||
/** | /** | |||
* htmlRequiredAttrs: | * htmlRequiredAttrs: | |||
* @elt: HTML element | * @elt: HTML element | |||
* | * | |||
* Returns the attributes required for the specified element. | * Returns the attributes required for the specified element. | |||
*/ | */ | |||
#define htmlRequiredAttrs(elt) (elt)->attrs_req | #define htmlRequiredAttrs(elt) (elt)->attrs_req | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
End of changes. 29 change blocks. | ||||
137 lines changed or deleted | 134 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: | * 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, | ||||
* including: | ||||
* | ||||
* - HashString Hash a char* or uint16_t/wchar_t* of known or unknown | ||||
* length. | ||||
* | ||||
* - HashBytes Hash a byte array of known length. | ||||
* | ||||
* - HashGeneric Hash one or more values. Currently, we support uint32_ | ||||
t, | ||||
* types which can be implicitly cast to uint32_t, data | ||||
* pointers, and function pointers. | ||||
* | ||||
* - AddToHash Add one or more values to the given hash. This support | ||||
s the | ||||
* same list of types as HashGeneric. | ||||
* | ||||
* | ||||
* You can chain these functions together to hash complex objects. For exa | ||||
mple: | ||||
* | ||||
* class ComplexObject { | ||||
* char* str; | ||||
* uint32_t uint1, uint2; | ||||
* void (*callbackFn)(); | ||||
* | ||||
* uint32_t Hash() { | ||||
* 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 | ||||
* 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" | |||
#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 | |||
RotateLeft32(uint32_t value, uint8_t bits) | RotateBitsLeft32(uint32_t value, uint8_t bits) | |||
{ | { | |||
MOZ_ASSERT(bits < 32); | MOZ_ASSERT(bits < 32); | |||
return (value << bits) | (value >> (32 - bits)); | return (value << bits) | (value >> (32 - bits)); | |||
} | } | |||
/** | namespace detail { | |||
* Add the given value(s) to the given hashcode and return the new hashcode | ||||
. | ||||
* | ||||
* AddToHash(h, x, y) is equivalent to AddToHash(AddToHash(h, x), y). | ||||
*/ | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | inline uint32_t | |||
AddToHash(uint32_t hash, uint32_t value) | AddU32ToHash(uint32_t hash, uint32_t value) | |||
{ | { | |||
/* | /* | |||
* This is not a sophisticated hash routine, but it seems to work well fo | * This is the meat of all our hash routines. This hash function is not | |||
r our | * particularly sophisticated, but it seems to work well for our mostly | |||
* mostly plain-text inputs. Implementation notes follow. | * plain-text inputs. Implementation notes follow. | |||
* | * | |||
* Our use of the golden ratio here is arbitrary; we could pick almost an y | * Our use of the golden ratio here is arbitrary; we could pick almost an y | |||
* number which: | * number which: | |||
* | * | |||
* * is odd (because otherwise, all our hash values will be even) | * * is odd (because otherwise, all our hash values will be even) | |||
* | * | |||
* * has a reasonably-even mix of 1's and 0's (consider the extreme case | * * has a reasonably-even mix of 1's and 0's (consider the extreme case | |||
* where we multiply by 0x3 or 0xeffffff -- this will not produce good | * where we multiply by 0x3 or 0xeffffff -- this will not produce good | |||
* mixing across all bits of the hash). | * mixing across all bits of the hash). | |||
* | * | |||
* The rotation length of 5 is also arbitrary, although an odd number is again | * The rotation length of 5 is also arbitrary, although an odd number is again | |||
* preferable so our hash explores the whole universe of possible rotatio ns. | * preferable so our hash explores the whole universe of possible rotatio ns. | |||
* | * | |||
* Finally, we multiply by the golden ratio *after* xor'ing, not before. | * Finally, we multiply by the golden ratio *after* xor'ing, not before. | |||
* Otherwise, if |hash| is 0 (as it often is for the beginning of a messa ge), | * Otherwise, if |hash| is 0 (as it often is for the beginning of a messa ge), | |||
* the expression | * the expression | |||
* | * | |||
* (GoldenRatioU32 * RotateLeft(hash, 5)) ^ value | * (GoldenRatioU32 * RotateBitsLeft(hash, 5)) |xor| value | |||
* | * | |||
* evaluates to |value|. | * evaluates to |value|. | |||
* | * | |||
* (Number-theoretic aside: Because any odd number |m| is relatively prim e to | * (Number-theoretic aside: Because any odd number |m| is relatively prim e to | |||
* our modulus (2^32), the list | * our modulus (2^32), the list | |||
* | * | |||
* [x * m (mod 2^32) for 0 <= x < 2^32] | * [x * m (mod 2^32) for 0 <= x < 2^32] | |||
* | * | |||
* has no duplicate elements. This means that multiplying by |m| does no t | * has no duplicate elements. This means that multiplying by |m| does no t | |||
* cause us to skip any possible hash values. | * cause us to skip any possible hash values. | |||
* | * | |||
* It's also nice if |m| has larger order mod 2^32 -- that is, if the sma | * It's also nice if |m| has large-ish order mod 2^32 -- that is, if the | |||
llest | * smallest k such that m^k == 1 (mod 2^32) is large -- so we can safely | |||
* k such that m^k == 1 (mod 2^32) is large -- so we can safely multiply | * multiply our hash value by |m| a few times without negating the | |||
our | * multiplicative effect. Our golden ratio constant has order 2^29, whic | |||
* hash value by |m| a few times without negating the multiplicative effe | h is | |||
ct. | * more than enough for our purposes.) | |||
* Our golden ratio constant has order 2^29, which is more than enough fo | ||||
r our | ||||
* purposes.) | ||||
*/ | */ | |||
return GoldenRatioU32 * (RotateLeft32(hash, 5) ^ value); | return GoldenRatioU32 * (RotateBitsLeft32(hash, 5) ^ value); | |||
} | } | |||
/** | ||||
* AddUintptrToHash takes sizeof(uintptr_t) as a template parameter. | ||||
*/ | ||||
template<size_t PtrSize> | ||||
inline uint32_t | ||||
AddUintptrToHash(uint32_t hash, uintptr_t value); | ||||
template<> | ||||
inline uint32_t | ||||
AddUintptrToHash<4>(uint32_t hash, uintptr_t value) | ||||
{ | ||||
return AddU32ToHash(hash, static_cast<uint32_t>(value)); | ||||
} | ||||
template<> | ||||
inline uint32_t | ||||
AddUintptrToHash<8>(uint32_t hash, uintptr_t value) | ||||
{ | ||||
/* | ||||
* The static cast to uint64_t below is necessary because this function | ||||
* sometimes gets compiled on 32-bit platforms (yes, even though it's a | ||||
* template and we never call this particular override in a 32-bit build) | ||||
. If | ||||
* we do value >> 32 on a 32-bit machine, we're shifting a 32-bit uintptr | ||||
_t | ||||
* right 32 bits, and the compiler throws an error. | ||||
*/ | ||||
uint32_t v1 = static_cast<uint32_t>(value); | ||||
uint32_t v2 = static_cast<uint32_t>(static_cast<uint64_t>(value) >> 32); | ||||
return AddU32ToHash(AddU32ToHash(hash, v1), v2); | ||||
} | ||||
} /* namespace detail */ | ||||
/** | ||||
* AddToHash takes a hash and some values and returns a new hash based on t | ||||
he | ||||
* inputs. | ||||
* | ||||
* Currently, we support hashing uint32_t's, values which we can implicitly | ||||
* convert to uint32_t, data pointers, and function pointers. | ||||
*/ | ||||
template<typename A> | ||||
MOZ_WARN_UNUSED_RESULT | MOZ_WARN_UNUSED_RESULT | |||
inline uint32_t | inline uint32_t | |||
AddToHash(uint32_t hash, uint32_t v1, uint32_t v2) | AddToHash(uint32_t hash, A a) | |||
{ | { | |||
return AddToHash(AddToHash(hash, v1), v2); | /* | |||
* Try to convert |A| to uint32_t implicitly. If this works, great. If | ||||
not, | ||||
* we'll error out. | ||||
*/ | ||||
return detail::AddU32ToHash(hash, a); | ||||
} | } | |||
template<typename A> | ||||
MOZ_WARN_UNUSED_RESULT | MOZ_WARN_UNUSED_RESULT | |||
inline uint32_t | inline uint32_t | |||
AddToHash(uint32_t hash, uint32_t v1, uint32_t v2, uint32_t v3) | AddToHash(uint32_t hash, A* a) | |||
{ | ||||
/* | ||||
* You might think this function should just take a void*. But then we'd | ||||
only | ||||
* catch data pointers and couldn't handle function pointers. | ||||
*/ | ||||
MOZ_STATIC_ASSERT(sizeof(a) == sizeof(uintptr_t), | ||||
"Strange pointer!"); | ||||
return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, uintptr_t(a)); | ||||
} | ||||
template<typename A, typename B> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
uint32_t | ||||
AddToHash(uint32_t hash, A a, B b) | ||||
{ | ||||
return AddToHash(AddToHash(hash, a), b); | ||||
} | ||||
template<typename A, typename B, typename C> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
uint32_t | ||||
AddToHash(uint32_t hash, A a, B b, C c) | ||||
{ | ||||
return AddToHash(AddToHash(hash, a, b), c); | ||||
} | ||||
template<typename A, typename B, typename C, typename D> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
uint32_t | ||||
AddToHash(uint32_t hash, A a, B b, C c, D d) | ||||
{ | { | |||
return AddToHash(AddToHash(hash, v1, v2), v3); | return AddToHash(AddToHash(hash, a, b, c), d); | |||
} | } | |||
template<typename A, typename B, typename C, typename D, typename E> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
uint32_t | ||||
AddToHash(uint32_t hash, A a, B b, C c, D d, E e) | ||||
{ | ||||
return AddToHash(AddToHash(hash, a, b, c, d), e); | ||||
} | ||||
/** | ||||
* The HashGeneric class of functions let you hash one or more values. | ||||
* | ||||
* If you want to hash together two values x and y, calling HashGeneric(x, | ||||
y) is | ||||
* much better than calling AddToHash(x, y), because AddToHash(x, y) assume | ||||
s | ||||
* that x has already been hashed. | ||||
*/ | ||||
template<typename A> | ||||
MOZ_WARN_UNUSED_RESULT | MOZ_WARN_UNUSED_RESULT | |||
inline uint32_t | inline uint32_t | |||
AddToHash(uint32_t hash, uint32_t v1, uint32_t v2, uint32_t v3, uint32_t v4 ) | HashGeneric(A a) | |||
{ | { | |||
return AddToHash(AddToHash(hash, v1, v2, v3), v4); | return AddToHash(0, a); | |||
} | } | |||
template<typename A, typename B> | ||||
MOZ_WARN_UNUSED_RESULT | MOZ_WARN_UNUSED_RESULT | |||
inline uint32_t | inline uint32_t | |||
AddToHash(uint32_t hash, uint32_t v1, uint32_t v2, uint32_t v3, uint32_t v4 , uint32_t v5) | HashGeneric(A a, B b) | |||
{ | { | |||
return AddToHash(AddToHash(hash, v1, v2, v3, v4), v5); | return AddToHash(0, a, b); | |||
} | } | |||
template<typename A, typename B, typename C> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashGeneric(A a, B b, C c) | ||||
{ | ||||
return AddToHash(0, a, b, c); | ||||
} | ||||
template<typename A, typename B, typename C, typename D> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashGeneric(A a, B b, C c, D d) | ||||
{ | ||||
return AddToHash(0, a, b, c, d); | ||||
} | ||||
template<typename A, typename B, typename C, typename D, typename E> | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashGeneric(A a, B b, C c, D d, E e) | ||||
{ | ||||
return AddToHash(0, a, b, c, d, e); | ||||
} | ||||
namespace detail { | ||||
template<typename T> | ||||
uint32_t | ||||
HashUntilZero(const T* str) | ||||
{ | ||||
uint32_t hash = 0; | ||||
for (T c; (c = *str); str++) | ||||
hash = AddToHash(hash, c); | ||||
return hash; | ||||
} | ||||
template<typename T> | ||||
uint32_t | ||||
HashKnownLength(const T* str, size_t length) | ||||
{ | ||||
uint32_t hash = 0; | ||||
for (size_t i = 0; i < length; i++) | ||||
hash = AddToHash(hash, str[i]); | ||||
return hash; | ||||
} | ||||
} /* namespace detail */ | ||||
/** | ||||
* The HashString overloads below do just what you'd expect. | ||||
* | ||||
* If you have the string's length, you might as well call the overload whi | ||||
ch | ||||
* includes the length. It may be marginally faster. | ||||
*/ | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const char* str) | ||||
{ | ||||
return detail::HashUntilZero(str); | ||||
} | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const char* str, size_t length) | ||||
{ | ||||
return detail::HashKnownLength(str, length); | ||||
} | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const uint16_t* str) | ||||
{ | ||||
return detail::HashUntilZero(str); | ||||
} | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const uint16_t* str, size_t length) | ||||
{ | ||||
return detail::HashKnownLength(str, length); | ||||
} | ||||
/* | ||||
* On Windows, wchar_t (PRUnichar) is not the same as uint16_t, even though | ||||
it's | ||||
* the same width! | ||||
*/ | ||||
#ifdef WIN32 | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const wchar_t* str) | ||||
{ | ||||
return detail::HashUntilZero(str); | ||||
} | ||||
MOZ_WARN_UNUSED_RESULT | ||||
inline uint32_t | ||||
HashString(const wchar_t* str, size_t length) | ||||
{ | ||||
return detail::HashKnownLength(str, length); | ||||
} | ||||
#endif | ||||
/** | ||||
* Hash some number of bytes. | ||||
* | ||||
* This hash walks word-by-word, rather than byte-by-byte, so you won't get | ||||
the | ||||
* same result out of HashBytes as you would out of HashString. | ||||
*/ | ||||
MOZ_WARN_UNUSED_RESULT | ||||
extern MFBT_API(uint32_t) | ||||
HashBytes(const void* bytes, size_t length); | ||||
} /* namespace mozilla */ | } /* namespace mozilla */ | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#endif /* mozilla_HashFunctions_h_ */ | #endif /* mozilla_HashFunctions_h_ */ | |||
End of changes. 21 change blocks. | ||||
31 lines changed or deleted | 278 lines changed or added | |||
HashTable.h | HashTable.h | |||
---|---|---|---|---|
skipping to change at line 99 | skipping to change at line 99 | |||
void setFree() { keyHash = sFreeKey; t = T(); } | void setFree() { keyHash = sFreeKey; t = T(); } | |||
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() { JS_ASSERT(isLive()); keyHash &= ~sColli sionBit; } | void unsetCollision() { keyHash &= ~sCollisionBit; } | |||
bool hasCollision() const { JS_ASSERT(isLive()); return keyHash & s CollisionBit; } | bool hasCollision() const { JS_ASSERT(isLive()); return keyHash & s CollisionBit; } | |||
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 161 | skipping to change at line 161 | |||
T &operator*() const { return entry->t; } | T &operator*() const { return entry->t; } | |||
T *operator->() const { return &entry->t; } | T *operator->() const { return &entry->t; } | |||
}; | }; | |||
/* A Ptr that can be used to add a key after a failed lookup. */ | /* A Ptr that can be used to add a key after a failed lookup. */ | |||
class AddPtr : public Ptr | class AddPtr : public Ptr | |||
{ | { | |||
friend class HashTable; | friend class HashTable; | |||
HashNumber keyHash; | HashNumber keyHash; | |||
#ifdef DEBUG | DebugOnly<uint64_t> mutationCount; | |||
uint64_t mutationCount; | ||||
AddPtr(Entry &entry, HashNumber hn, uint64_t mutationCount) | ||||
: Ptr(entry), keyHash(hn), mutationCount(mutationCount) {} | ||||
#else | ||||
AddPtr(Entry &entry, HashNumber hn) : Ptr(entry), keyHash(hn) {} | AddPtr(Entry &entry, HashNumber hn) : Ptr(entry), keyHash(hn) {} | |||
#endif | ||||
public: | public: | |||
/* Leaves AddPtr uninitialized. */ | /* Leaves AddPtr uninitialized. */ | |||
AddPtr() {} | AddPtr() {} | |||
}; | }; | |||
/* | /* | |||
* 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. | |||
skipping to change at line 225 | skipping to change at line 220 | |||
* |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 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), removed(false) {} | Enum(Map &map) : Range(map.all()), table(map.impl), added(false), r emoved(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; | |||
} | } | |||
/* | ||||
* 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 | ||||
* this operation until the next call to |popFront()|. | ||||
*/ | ||||
void rekeyFront(Key &k) { | ||||
JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); | ||||
JS_ASSERT(!table.match(*this->cur, k)); | ||||
Entry e = *this->cur; | ||||
HashPolicy::setKey(e.t, k); | ||||
table.remove(*this->cur); | ||||
table.add(k, e); | ||||
added = true; | ||||
} | ||||
/* Potentially rehashes the table. */ | /* Potentially rehashes the table. */ | |||
~Enum() { | ~Enum() { | |||
if (added) | ||||
table.checkOverloaded(); | ||||
if (removed) | if (removed) | |||
table.checkUnderloaded(); | table.checkUnderloaded(); | |||
} | } | |||
/* Can be used to end the enumeration before the destructor. */ | /* Can be used to end the enumeration before the destructor. */ | |||
void endEnumeration() { | void endEnumeration() { | |||
if (added) { | ||||
table.checkOverloaded(); | ||||
added = false; | ||||
} | ||||
if (removed) { | if (removed) { | |||
table.checkUnderloaded(); | table.checkUnderloaded(); | |||
removed = false; | 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 */ | |||
skipping to change at line 293 | skipping to change at line 310 | |||
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 */ | |||
} stats; | } stats; | |||
# define METER(x) x | # define METER(x) x | |||
#else | #else | |||
# define METER(x) | # define METER(x) | |||
#endif | #endif | |||
#ifdef DEBUG | ||||
friend class js::ReentrancyGuard; | friend class js::ReentrancyGuard; | |||
mutable bool entered; | mutable DebugOnly<bool> entered; | |||
uint64_t mutationCount; | DebugOnly<uint64_t> mutationCount; | |||
#endif | ||||
/* The default initial capacity is 16, but you can ask for as small as 4. */ | /* The default initial capacity is 16, but you can ask for as small as 4. */ | |||
static const unsigned sMinSizeLog2 = 2; | static const unsigned sMinSizeLog2 = 2; | |||
static const unsigned sMinSize = 1 << sMinSizeLog2; | static const unsigned sMinSize = 1 << sMinSizeLog2; | |||
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); | |||
skipping to change at line 367 | skipping to change at line 382 | |||
alloc.free_(oldTable); | alloc.free_(oldTable); | |||
} | } | |||
public: | public: | |||
HashTable(AllocPolicy ap) | HashTable(AllocPolicy ap) | |||
: AllocPolicy(ap), | : AllocPolicy(ap), | |||
hashShift(sHashBits), | hashShift(sHashBits), | |||
entryCount(0), | entryCount(0), | |||
gen(0), | gen(0), | |||
removedCount(0), | removedCount(0), | |||
table(NULL) | table(NULL), | |||
#ifdef DEBUG | entered(false), | |||
, entered(false), | ||||
mutationCount(0) | mutationCount(0) | |||
#endif | ||||
{} | {} | |||
bool init(uint32_t length) | 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. | |||
skipping to change at line 427 | skipping to change at line 440 | |||
{ | { | |||
if (table) | if (table) | |||
destroyTable(*this, table, capacity()); | destroyTable(*this, table, capacity()); | |||
} | } | |||
private: | private: | |||
static HashNumber hash1(HashNumber hash0, uint32_t shift) { | static HashNumber hash1(HashNumber hash0, uint32_t shift) { | |||
return hash0 >> shift; | return hash0 >> shift; | |||
} | } | |||
static HashNumber hash2(HashNumber hash0, uint32_t log2, uint32_t shift | struct DoubleHash { | |||
) { | HashNumber h2; | |||
return ((hash0 << log2) >> shift) | 1; | HashNumber sizeMask; | |||
}; | ||||
DoubleHash hash2(HashNumber curKeyHash, uint32_t hashShift) const { | ||||
unsigned sizeLog2 = sHashBits - hashShift; | ||||
DoubleHash dh = { | ||||
((curKeyHash << sizeLog2) >> hashShift) | 1, | ||||
(HashNumber(1) << sizeLog2) - 1 | ||||
}; | ||||
return dh; | ||||
} | ||||
static HashNumber applyDoubleHash(HashNumber h1, const DoubleHash &dh) | ||||
{ | ||||
return (h1 - dh.h2) & dh.sizeMask; | ||||
} | } | |||
bool overloaded() { | bool overloaded() { | |||
return entryCount + removedCount >= ((sMaxAlphaFrac * capacity()) > > 8); | return entryCount + removedCount >= ((sMaxAlphaFrac * capacity()) > > 8); | |||
} | } | |||
bool underloaded() { | bool underloaded() { | |||
uint32_t tableCapacity = capacity(); | uint32_t tableCapacity = capacity(); | |||
return tableCapacity > sMinSize && | return tableCapacity > sMinSize && | |||
entryCount <= ((sMinAlphaFrac * tableCapacity) >> 8); | entryCount <= ((sMinAlphaFrac * tableCapacity) >> 8); | |||
skipping to change at line 470 | skipping to change at line 497 | |||
return *entry; | return *entry; | |||
} | } | |||
/* Hit: return entry. */ | /* Hit: return entry. */ | |||
if (entry->matchHash(keyHash) && match(*entry, l)) { | if (entry->matchHash(keyHash) && match(*entry, l)) { | |||
METER(stats.hits++); | METER(stats.hits++); | |||
return *entry; | return *entry; | |||
} | } | |||
/* Collision: double hash. */ | /* Collision: double hash. */ | |||
unsigned sizeLog2 = sHashBits - hashShift; | DoubleHash dh = hash2(keyHash, hashShift); | |||
HashNumber h2 = hash2(keyHash, sizeLog2, hashShift); | ||||
HashNumber sizeMask = (HashNumber(1) << sizeLog2) - 1; | ||||
/* Save the first removed entry pointer so we can recycle later. */ | /* Save the first removed entry pointer so we can recycle later. */ | |||
Entry *firstRemoved = NULL; | Entry *firstRemoved = NULL; | |||
while(true) { | while(true) { | |||
if (JS_UNLIKELY(entry->isRemoved())) { | if (JS_UNLIKELY(entry->isRemoved())) { | |||
if (!firstRemoved) | if (!firstRemoved) | |||
firstRemoved = entry; | firstRemoved = entry; | |||
} else { | } else { | |||
entry->setCollision(collisionBit); | entry->setCollision(collisionBit); | |||
} | } | |||
METER(stats.steps++); | METER(stats.steps++); | |||
h1 -= h2; | h1 = applyDoubleHash(h1, dh); | |||
h1 &= sizeMask; | ||||
entry = &table[h1]; | entry = &table[h1]; | |||
if (entry->isFree()) { | if (entry->isFree()) { | |||
METER(stats.misses++); | METER(stats.misses++); | |||
return firstRemoved ? *firstRemoved : *entry; | return firstRemoved ? *firstRemoved : *entry; | |||
} | } | |||
if (entry->matchHash(keyHash) && match(*entry, l)) { | if (entry->matchHash(keyHash) && match(*entry, l)) { | |||
METER(stats.hits++); | METER(stats.hits++); | |||
return *entry; | return *entry; | |||
skipping to change at line 528 | skipping to change at line 552 | |||
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->isFree()) { | |||
METER(stats.misses++); | METER(stats.misses++); | |||
return *entry; | return *entry; | |||
} | } | |||
/* Collision: double hash. */ | /* Collision: double hash. */ | |||
unsigned sizeLog2 = sHashBits - hashShift; | DoubleHash dh = hash2(keyHash, hashShift); | |||
HashNumber h2 = hash2(keyHash, sizeLog2, hashShift); | ||||
HashNumber sizeMask = (HashNumber(1) << sizeLog2) - 1; | ||||
while(true) { | while(true) { | |||
JS_ASSERT(!entry->isRemoved()); | JS_ASSERT(!entry->isRemoved()); | |||
entry->setCollision(); | entry->setCollision(); | |||
METER(stats.steps++); | METER(stats.steps++); | |||
h1 -= h2; | h1 = applyDoubleHash(h1, dh); | |||
h1 &= sizeMask; | ||||
entry = &table[h1]; | entry = &table[h1]; | |||
if (entry->isFree()) { | if (entry->isFree()) { | |||
METER(stats.misses++); | METER(stats.misses++); | |||
return *entry; | return *entry; | |||
} | } | |||
} | } | |||
} | } | |||
bool changeTableSize(int deltaLog2) | bool changeTableSize(int deltaLog2) | |||
skipping to change at line 582 | skipping to change at line 603 | |||
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 true; | |||
} | } | |||
void add(const Lookup &l, const Entry &e) | ||||
{ | ||||
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()) | ||||
return false; | ||||
/* Compress if a quarter or more of all entries are removed. */ | ||||
int deltaLog2; | ||||
if (removedCount >= (capacity() >> 2)) { | ||||
METER(stats.compresses++); | ||||
deltaLog2 = 0; | ||||
} else { | ||||
METER(stats.grows++); | ||||
deltaLog2 = 1; | ||||
} | ||||
return changeTableSize(deltaLog2); | ||||
} | ||||
void remove(Entry &e) | void remove(Entry &e) | |||
{ | { | |||
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--; | |||
#ifdef DEBUG | ||||
mutationCount++; | mutationCount++; | |||
#endif | ||||
} | } | |||
void checkUnderloaded() | void checkUnderloaded() | |||
{ | { | |||
if (underloaded()) { | if (underloaded()) { | |||
METER(stats.shrinks++); | METER(stats.shrinks++); | |||
(void) changeTableSize(-1); | (void) changeTableSize(-1); | |||
} | } | |||
} | } | |||
skipping to change at line 618 | skipping to change at line 672 | |||
{ | { | |||
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()); | |||
} | } | |||
removedCount = 0; | removedCount = 0; | |||
entryCount = 0; | entryCount = 0; | |||
#ifdef DEBUG | ||||
mutationCount++; | mutationCount++; | |||
#endif | ||||
} | } | |||
void finish() | void finish() | |||
{ | { | |||
JS_ASSERT(!entered); | JS_ASSERT(!entered); | |||
if (!table) | if (!table) | |||
return; | return; | |||
destroyTable(*this, table, capacity()); | destroyTable(*this, table, capacity()); | |||
table = NULL; | table = NULL; | |||
gen++; | gen++; | |||
entryCount = 0; | entryCount = 0; | |||
removedCount = 0; | removedCount = 0; | |||
#ifdef DEBUG | ||||
mutationCount++; | mutationCount++; | |||
#endif | ||||
} | } | |||
Range all() const { | Range all() const { | |||
return Range(table, table + capacity()); | return Range(table, table + capacity()); | |||
} | } | |||
bool empty() const { | bool empty() const { | |||
return !entryCount; | return !entryCount; | |||
} | } | |||
skipping to change at line 678 | skipping to change at line 728 | |||
Ptr lookup(const Lookup &l) const { | Ptr lookup(const Lookup &l) const { | |||
ReentrancyGuard g(*this); | ReentrancyGuard g(*this); | |||
HashNumber keyHash = prepareHash(l); | HashNumber keyHash = prepareHash(l); | |||
return Ptr(lookup(l, keyHash, 0)); | return Ptr(lookup(l, keyHash, 0)); | |||
} | } | |||
AddPtr lookupForAdd(const Lookup &l) const { | AddPtr lookupForAdd(const Lookup &l) const { | |||
ReentrancyGuard g(*this); | ReentrancyGuard g(*this); | |||
HashNumber keyHash = prepareHash(l); | HashNumber keyHash = prepareHash(l); | |||
Entry &entry = lookup(l, keyHash, sCollisionBit); | Entry &entry = lookup(l, keyHash, sCollisionBit); | |||
#ifdef DEBUG | AddPtr p(entry, keyHash); | |||
return AddPtr(entry, keyHash, mutationCount); | p.mutationCount = mutationCount; | |||
#else | return p; | |||
return AddPtr(entry, keyHash); | ||||
#endif | ||||
} | } | |||
bool add(AddPtr &p) | bool add(AddPtr &p) | |||
{ | { | |||
ReentrancyGuard g(*this); | ReentrancyGuard g(*this); | |||
JS_ASSERT(mutationCount == p.mutationCount); | JS_ASSERT(mutationCount == p.mutationCount); | |||
JS_ASSERT(table); | JS_ASSERT(table); | |||
JS_ASSERT(!p.found()); | JS_ASSERT(!p.found()); | |||
JS_ASSERT(!(p.keyHash & sCollisionBit)); | JS_ASSERT(!(p.keyHash & sCollisionBit)); | |||
/* | /* | |||
* 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 alpha is >= .75, grow or compress the table. */ | if (checkOverloaded()) | |||
if (overloaded()) { | ||||
/* Compress if a quarter or more of all entries are removed | ||||
. */ | ||||
int deltaLog2; | ||||
if (removedCount >= (capacity() >> 2)) { | ||||
METER(stats.compresses++); | ||||
deltaLog2 = 0; | ||||
} else { | ||||
METER(stats.grows++); | ||||
deltaLog2 = 1; | ||||
} | ||||
if (!changeTableSize(deltaLog2)) | ||||
return false; | ||||
/* Preserve the validity of |p.entry|. */ | /* Preserve the validity of |p.entry|. */ | |||
p.entry = &findFreeEntry(p.keyHash); | p.entry = &findFreeEntry(p.keyHash); | |||
} | ||||
} | } | |||
p.entry->setLive(p.keyHash); | p.entry->setLive(p.keyHash); | |||
entryCount++; | entryCount++; | |||
#ifdef DEBUG | ||||
mutationCount++; | mutationCount++; | |||
#endif | ||||
return true; | return true; | |||
} | } | |||
/* | /* | |||
* There is an important contract between the caller and callee for thi s | * There is an important contract between the caller and callee for thi s | |||
* function: if add() returns true, the caller must assign the T value | * function: if add() returns true, the caller must assign the T value | |||
* which produced p before using the hashtable again. | * which produced p before using the hashtable again. | |||
*/ | */ | |||
bool add(AddPtr &p, T** pentry) | bool add(AddPtr &p, T** pentry) | |||
{ | { | |||
skipping to change at line 753 | skipping to change at line 784 | |||
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; | |||
} | } | |||
bool relookupOrAdd(AddPtr& p, const Lookup &l, const T& t) | bool relookupOrAdd(AddPtr& p, const Lookup &l, const T& t) | |||
{ | { | |||
#ifdef DEBUG | ||||
p.mutationCount = mutationCount; | p.mutationCount = mutationCount; | |||
#endif | ||||
{ | { | |||
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) | |||
{ | { | |||
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 */ | |||
/************************************************************************** ***/ | /************************************************************************** ***/ | |||
/* | /* | |||
* Hash policy | * Hash policy | |||
* | * | |||
skipping to change at line 942 | skipping to change at line 972 | |||
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; | |||
static const Key &getKey(Entry &e) { return e.key; } | static const Key &getKey(Entry &e) { return e.key; } | |||
static void setKey(Entry &e, Key &k) { const_cast<Key &>(e.key) = k ; } | ||||
}; | }; | |||
typedef detail::HashTable<Entry, MapHashPolicy, AllocPolicy> Impl; | typedef detail::HashTable<Entry, MapHashPolicy, AllocPolicy> Impl; | |||
friend class Impl::Enum; | friend class Impl::Enum; | |||
/* Not implicitly copyable (expensive). May add explicit |clone| later. */ | /* Not implicitly copyable (expensive). May add explicit |clone| later. */ | |||
HashMap(const HashMap &); | HashMap(const HashMap &); | |||
HashMap &operator=(const HashMap &); | HashMap &operator=(const HashMap &); | |||
Impl impl; | Impl impl; | |||
public: | public: | |||
const static unsigned sDefaultInitSize = Impl::sDefaultInitSize; | ||||
/* | /* | |||
* HashMap construction is fallible (due to OOM); thus the user must ca ll | * HashMap construction is fallible (due to OOM); thus the user must ca ll | |||
* init after constructing a HashMap and check the return value. | * init after constructing a HashMap and check the return value. | |||
*/ | */ | |||
HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {} | HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {} | |||
bool init(uint32_t len = Impl::sDefaultInitSize) { return impl.init(le | bool init(uint32_t len = sDefaultInitSize) { return impl.init(le | |||
n); } | n); } | |||
bool initialized() const { return impl.initial ized(); } | bool initialized() const { return impl.initial ized(); } | |||
/* | /* | |||
* Return whether the given lookup value is present in the map. E.g.: | * Return whether the given lookup value is present in the map. E.g.: | |||
* | * | |||
* typedef HashMap<int,char> HM; | * typedef HashMap<int,char> HM; | |||
* HM h; | * HM h; | |||
* if (HM::Ptr p = h.lookup(3)) { | * if (HM::Ptr p = h.lookup(3)) { | |||
* const HM::Entry &e = *p; // p acts like a pointer to Entry | * const HM::Entry &e = *p; // p acts like a pointer to Entry | |||
* assert(p->key == 3); // Entry contains the key | * assert(p->key == 3); // Entry contains the key | |||
skipping to change at line 1120 | skipping to change at line 1153 | |||
* pointers into the table remain valid. | * pointers into the table remain valid. | |||
*/ | */ | |||
unsigned generation() const { return impl.generat ion(); } | unsigned generation() const { return impl.generat ion(); } | |||
/* Shorthand operations: */ | /* Shorthand operations: */ | |||
bool has(const Lookup &l) const { | bool has(const Lookup &l) const { | |||
return impl.lookup(l) != NULL; | return impl.lookup(l) != NULL; | |||
} | } | |||
/* Overwrite existing value with v. Return NULL on oom. */ | /* Overwrite existing value with v. Return false on oom. */ | |||
template<typename KeyInput, typename ValueInput> | template<typename KeyInput, typename ValueInput> | |||
Entry *put(const KeyInput &k, const ValueInput &v) { | bool put(const KeyInput &k, const ValueInput &v) { | |||
AddPtr p = lookupForAdd(k); | AddPtr p = lookupForAdd(k); | |||
if (p) { | if (p) { | |||
p->value = v; | p->value = v; | |||
return &*p; | return true; | |||
} | } | |||
return add(p, k, v) ? &*p : NULL; | 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); | AddPtr p = lookupForAdd(k); | |||
JS_ASSERT(!p); | JS_ASSERT(!p); | |||
return add(p, k, v); | 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. */ | |||
skipping to change at line 1179 | skipping to change at line 1212 | |||
*/ | */ | |||
template <class T, class HashPolicy = DefaultHasher<T>, class AllocPolicy = TempAllocPolicy> | template <class T, class HashPolicy = DefaultHasher<T>, class AllocPolicy = TempAllocPolicy> | |||
class HashSet | class HashSet | |||
{ | { | |||
typedef typename HashPolicy::Lookup Lookup; | typedef typename HashPolicy::Lookup Lookup; | |||
/* Implement HashSet in terms of HashTable. */ | /* Implement HashSet in terms of HashTable. */ | |||
struct SetOps : HashPolicy { | struct SetOps : HashPolicy { | |||
typedef T KeyType; | typedef T KeyType; | |||
static const KeyType &getKey(const T &t) { return t; } | static const KeyType &getKey(const T &t) { return t; } | |||
static void setKey(T &t, KeyType &k) { t = k; } | ||||
}; | }; | |||
typedef detail::HashTable<const T, SetOps, AllocPolicy> Impl; | typedef detail::HashTable<const T, SetOps, AllocPolicy> Impl; | |||
friend class Impl::Enum; | friend class Impl::Enum; | |||
/* Not implicitly copyable (expensive). May add explicit |clone| later. */ | /* Not implicitly copyable (expensive). May add explicit |clone| later. */ | |||
HashSet(const HashSet &); | HashSet(const HashSet &); | |||
HashSet &operator=(const HashSet &); | HashSet &operator=(const HashSet &); | |||
Impl impl; | Impl impl; | |||
public: | public: | |||
const static unsigned sDefaultInitSize = Impl::sDefaultInitSize; | ||||
/* | /* | |||
* HashSet construction is fallible (due to OOM); thus the user must ca ll | * HashSet construction is fallible (due to OOM); thus the user must ca ll | |||
* init after constructing a HashSet and check the return value. | * init after constructing a HashSet and check the return value. | |||
*/ | */ | |||
HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {} | HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {} | |||
bool init(uint32_t len = Impl::sDefaultInitSize) { return impl.init(le | bool init(uint32_t len = sDefaultInitSize) { return impl.init(le | |||
n); } | n); } | |||
bool initialized() const { return impl.initial ized(); } | bool initialized() const { return impl.initial ized(); } | |||
/* | /* | |||
* Return whether the given lookup value is present in the map. E.g.: | * Return whether the given lookup value is present in the map. E.g.: | |||
* | * | |||
* typedef HashSet<int> HS; | * typedef HashSet<int> HS; | |||
* HS h; | * HS h; | |||
* if (HS::Ptr p = h.lookup(3)) { | * if (HS::Ptr p = h.lookup(3)) { | |||
* assert(*p == 3); // p acts like a pointer to int | * assert(*p == 3); // p acts like a pointer to int | |||
* } | * } | |||
skipping to change at line 1330 | skipping to change at line 1366 | |||
* pointers into the table remain valid. | * pointers into the table remain valid. | |||
*/ | */ | |||
unsigned generation() const { return impl.generat ion(); } | unsigned generation() const { return impl.generat ion(); } | |||
/* Shorthand operations: */ | /* Shorthand operations: */ | |||
bool has(const Lookup &l) const { | bool has(const Lookup &l) const { | |||
return impl.lookup(l) != NULL; | return impl.lookup(l) != NULL; | |||
} | } | |||
/* Overwrite existing value with v. Return NULL on oom. */ | /* Overwrite existing value with v. Return false on oom. */ | |||
const T *put(const T &t) { | bool put(const T &t) { | |||
AddPtr p = lookupForAdd(t); | AddPtr p = lookupForAdd(t); | |||
return p ? &*p : (add(p, t) ? &*p : NULL); | 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); | AddPtr p = lookupForAdd(t); | |||
JS_ASSERT(!p); | JS_ASSERT(!p); | |||
return add(p, t); | return add(p, t); | |||
} | } | |||
bool putNew(const Lookup &l, const T &t) { | bool putNew(const Lookup &l, const T &t) { | |||
End of changes. 45 change blocks. | ||||
74 lines changed or deleted | 111 lines changed or added | |||
HelloCocosBuilderLayer.h | HelloCocosBuilderLayer.h | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
* Note: for some pretty hard fucked up reason, the order of inheritance is important! | * Note: for some pretty hard fucked up reason, the order of inheritance is important! | |||
* When CCLayer is the 'first' inherited object: | * When CCLayer is the 'first' inherited object: | |||
* During runtime the method call to the (pure virtual) 'interfaces' fails jumping into a bogus method or just doing nothing: | * During runtime the method call to the (pure virtual) 'interfaces' fails jumping into a bogus method or just doing nothing: | |||
* #0 0x000cf840 in non-virtual thunk to HelloCocos.... | * #0 0x000cf840 in non-virtual thunk to HelloCocos.... | |||
* #1 .... | * #1 .... | |||
* | * | |||
* This thread describes the problem: | * This thread describes the problem: | |||
* http://www.cocoabuilder.com/archive/xcode/265549-crash-in-virtual-method -call.html | * http://www.cocoabuilder.com/archive/xcode/265549-crash-in-virtual-method -call.html | |||
*/ | */ | |||
class HelloCocosBuilderLayer | class HelloCocosBuilderLayer | |||
: public cocos2d::CCLayer | : public cocos2d::CCLayer | |||
, public cocos2d::extension::CCBSelectorResolver | , public cocos2d::extension::CCBSelectorResolver | |||
, public cocos2d::extension::CCBMemberVariableAssigner | , public cocos2d::extension::CCBMemberVariableAssigner | |||
, public cocos2d::extension::CCNodeLoaderListener | , public cocos2d::extension::CCNodeLoaderListener | |||
{ | { | |||
public: | public: | |||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(HelloCocosBuilde rLayer, create); | CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(HelloCocosBuilde rLayer, create); | |||
HelloCocosBuilderLayer(); | HelloCocosBuilderLayer(); | |||
virtual ~HelloCocosBuilderLayer(); | virtual ~HelloCocosBuilderLayer(); | |||
void openTest(const char * pCCBFileName, const char * pCCNodeName = NULL, cocos2d::extension::CCNodeLoader * pCCNodeLoader = NULL); | void openTest(const char * pCCBFileName, const char * pCCNodeName = NULL, cocos2d::extension::CCNodeLoader * pCCNodeLoader = NULL); | |||
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(coc os2d::CCObject * pTarget, cocos2d::CCString * pSelectorName); | virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(coc os2d::CCObject * pTarget, cocos2d::CCString * pSelectorName); | |||
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCCont rolSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName) ; | virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCCont rolSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName) ; | |||
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode); | virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode); | |||
virtual void onNodeLoaded(cocos2d::CCNode * pNode, cocos2d::extensi on::CCNodeLoader * pNodeLoader); | virtual void onNodeLoaded(cocos2d::CCNode * pNode, cocos2d::extensi on::CCNodeLoader * pNodeLoader); | |||
void onMenuTestClicked(cocos2d::CCObject * pSender, cocos2d::extens ion::CCControlEvent pCCControlEvent); | void onMenuTestClicked(cocos2d::CCObject * pSender, cocos2d::extens ion::CCControlEvent pCCControlEvent); | |||
void onSpriteTestClicked(cocos2d::CCObject * pSender, cocos2d::exte nsion::CCControlEvent pCCControlEvent); | void onSpriteTestClicked(cocos2d::CCObject * pSender, cocos2d::exte nsion::CCControlEvent pCCControlEvent); | |||
void onButtonTestClicked(cocos2d::CCObject * pSender, cocos2d::exte nsion::CCControlEvent pCCControlEvent); | void onButtonTestClicked(cocos2d::CCObject * pSender, cocos2d::exte nsion::CCControlEvent pCCControlEvent); | |||
void onLabelTestClicked(cocos2d::CCObject * pSender, cocos2d::exten sion::CCControlEvent pCCControlEvent); | void onAnimationsTestClicked(cocos2d::CCObject * pSender, cocos2d:: extension::CCControlEvent pCCControlEvent); | |||
void onParticleSystemTestClicked(cocos2d::CCObject * pSender, cocos 2d::extension::CCControlEvent pCCControlEvent); | void onParticleSystemTestClicked(cocos2d::CCObject * pSender, cocos 2d::extension::CCControlEvent pCCControlEvent); | |||
void onScrollViewTestClicked(cocos2d::CCObject * pSender, cocos2d:: extension::CCControlEvent pCCControlEvent); | void onScrollViewTestClicked(cocos2d::CCObject * pSender, cocos2d:: extension::CCControlEvent pCCControlEvent); | |||
private: | private: | |||
cocos2d::CCSprite * mBurstSprite; | cocos2d::CCSprite * mBurstSprite; | |||
cocos2d::CCLabelTTF * mTestTitleLabelTTF; | cocos2d::CCLabelTTF * mTestTitleLabelTTF; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
HttpClient.h | HttpClient.h | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
* @addtogroup Network | * @addtogroup Network | |||
* @{ | * @{ | |||
*/ | */ | |||
/** @brief Singleton that handles asynchrounous http requests | /** @brief Singleton that handles asynchrounous http requests | |||
* Once the request completed, a callback will issued in main thread when i t provided during make request | * Once the request completed, a callback will issued in main thread when i t provided during make request | |||
*/ | */ | |||
class CCHttpClient : public cocos2d::CCObject | class CCHttpClient : public CCObject | |||
{ | { | |||
public: | public: | |||
/** Return the shared instance **/ | /** Return the shared instance **/ | |||
static CCHttpClient *getInstance(); | static CCHttpClient *getInstance(); | |||
/** Relase the shared instance **/ | /** Relase the shared instance **/ | |||
static void destroyInstance(); | static void destroyInstance(); | |||
/** | /** | |||
* Add a get request to task queue | * Add a get request to task queue | |||
* @param request a CCHttpRequest object, which includes url, response callback etc. | * @param request a CCHttpRequest object, which includes url, response callback etc. | |||
please make sure request->_requestData is clear befor e calling "send" here. | ||||
* @return NULL | * @return NULL | |||
*/ | */ | |||
void send(CCHttpRequest* request); | void send(CCHttpRequest* request); | |||
/** | /** | |||
* Change the connect timeout | * Change the connect timeout | |||
* @param timeout | * @param timeout | |||
* @return NULL | * @return NULL | |||
*/ | */ | |||
inline void setTimeoutForConnect(int value) {_timeoutForConnect = value ;}; | inline void setTimeoutForConnect(int value) {_timeoutForConnect = value ;}; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
HttpRequest.h | HttpRequest.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
@brief defines the object which users must packed for CCHttpClient::send(H ttpRequest*) method. | @brief defines the object which users must packed for CCHttpClient::send(H ttpRequest*) method. | |||
Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClie ntTest.cpp as a sample | Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClie ntTest.cpp as a sample | |||
@since v2.0.2 | @since v2.0.2 | |||
*/ | */ | |||
class CCHttpRequest : public cocos2d::CCObject | class CCHttpRequest : public CCObject | |||
{ | { | |||
public: | public: | |||
/** Use this enum type as param in setReqeustType(param) */ | /** Use this enum type as param in setReqeustType(param) */ | |||
typedef enum | typedef enum | |||
{ | { | |||
kHttpGet, | kHttpGet, | |||
kHttpPost, | kHttpPost, | |||
kHttpUnkown, | kHttpUnkown, | |||
} HttpRequestType; | } HttpRequestType; | |||
skipping to change at line 158 | skipping to change at line 158 | |||
/** Get the pre-setted custom data pointer back. | /** Get the pre-setted custom data pointer back. | |||
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer | Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer | |||
*/ | */ | |||
inline void* getUserData() | inline void* getUserData() | |||
{ | { | |||
return _pUserData; | return _pUserData; | |||
}; | }; | |||
/** Required field. You should set the callback selector function at ac k the http request completed | /** Required field. You should set the callback selector function at ac k the http request completed | |||
*/ | */ | |||
inline void setResponseCallback(cocos2d::CCObject* pTarget, cocos2d::SE L_CallFuncND pSelector) | inline void setResponseCallback(CCObject* pTarget, SEL_CallFuncND pSele ctor) | |||
{ | { | |||
_pTarget = pTarget; | _pTarget = pTarget; | |||
_pSelector = pSelector; | _pSelector = pSelector; | |||
if (_pTarget) | if (_pTarget) | |||
{ | { | |||
_pTarget->retain(); | _pTarget->retain(); | |||
} | } | |||
} | } | |||
/** Get the target of callback selector funtion, mainly used by CCHttpC lient */ | /** Get the target of callback selector funtion, mainly used by CCHttpC lient */ | |||
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 cocos2d::SEL_CallFuncND getSelector() | inline SEL_CallFuncND getSelector() | |||
{ | { | |||
return _pSelector; | return _pSelector; | |||
} | } | |||
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 | |||
cocos2d::CCObject* _pTarget; /// callback target of pSe | CCObject* _pTarget; /// callback target of pSelector fu | |||
lector function | nction | |||
cocos2d::SEL_CallFuncND _pSelector; /// callback function, e.g | SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer | |||
. MyLayer::onHttpResponse(CCObject *sender, void *data) | ::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 | |||
}; | }; | |||
NS_CC_EXT_END | NS_CC_EXT_END | |||
#endif //__HTTP_REQUEST_H__ | #endif //__HTTP_REQUEST_H__ | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
HttpResponse.h | HttpResponse.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
#include "ExtensionMacros.h" | #include "ExtensionMacros.h" | |||
#include "HttpRequest.h" | #include "HttpRequest.h" | |||
NS_CC_EXT_BEGIN | NS_CC_EXT_BEGIN | |||
/** | /** | |||
@brief defines the object which users will receive at onHttpCompleted(send er, HttpResponse) callback | @brief defines the object which users will receive at onHttpCompleted(send er, HttpResponse) callback | |||
Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClie ntTest.cpp as a sample | Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClie ntTest.cpp as a sample | |||
@since v2.0.2 | @since v2.0.2 | |||
*/ | */ | |||
class CCHttpResponse : public cocos2d::CCObject | class CCHttpResponse : public CCObject | |||
{ | { | |||
public: | public: | |||
/** Constructor, it's used by CCHttpClient internal, users don't need t o create HttpResponse manually | /** Constructor, it's used by CCHttpClient internal, users don't need t o create HttpResponse manually | |||
@param request the corresponding HttpRequest which leads to this respo nse | @param request the corresponding HttpRequest which leads to this respo nse | |||
*/ | */ | |||
CCHttpResponse(CCHttpRequest* request) | CCHttpResponse(CCHttpRequest* request) | |||
{ | { | |||
_pHttpRequest = request; | _pHttpRequest = request; | |||
if (_pHttpRequest) | if (_pHttpRequest) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
IMEJni.h | IMEJni.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
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 __ANDROID_IME_JNI_H__ | #ifndef __ANDROID_IME_JNI_H__ | |||
#define __ANDROID_IME_JNI_H__ | #define __ANDROID_IME_JNI_H__ | |||
extern "C" | extern "C" { | |||
{ | ||||
extern void setKeyboardStateJNI(int bOpen); | extern void setKeyboardStateJNI(int bOpen); | |||
extern void openKeyboardJNI(); | ||||
extern void closeKeyboardJNI(); | ||||
} | } | |||
#endif // __ANDROID_IME_JNI_H__ | #endif // __ANDROID_IME_JNI_H__ | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
JniHelper.h | JniHelper.h | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
JNIEnv * env; | JNIEnv * env; | |||
jclass classID; | jclass classID; | |||
jmethodID methodID; | jmethodID methodID; | |||
} JniMethodInfo; | } JniMethodInfo; | |||
class CC_DLL JniHelper | class CC_DLL JniHelper | |||
{ | { | |||
public: | public: | |||
static JavaVM* getJavaVM(); | static JavaVM* getJavaVM(); | |||
static void setJavaVM(JavaVM *javaVM); | static void setJavaVM(JavaVM *javaVM); | |||
static const char* getExternalAssetPath(); | ||||
static void setExternalAssetPath(const char* externalAssetPath); | ||||
static jclass getClassID(const char *className, JNIEnv *env=0); | static jclass getClassID(const char *className, JNIEnv *env=0); | |||
static bool getStaticMethodInfo(JniMethodInfo &methodinfo, const char * className, const char *methodName, const char *paramCode); | static bool getStaticMethodInfo(JniMethodInfo &methodinfo, const char * className, const char *methodName, const char *paramCode); | |||
static bool getMethodInfo(JniMethodInfo &methodinfo, const char *classN ame, const char *methodName, const char *paramCode); | static bool getMethodInfo(JniMethodInfo &methodinfo, const char *classN ame, const char *methodName, const char *paramCode); | |||
static std::string jstring2string(jstring str); | static std::string jstring2string(jstring str); | |||
private: | private: | |||
static JavaVM *m_psJavaVM; | static JavaVM *m_psJavaVM; | |||
static std::string m_externalAssetPath; | ||||
}; | }; | |||
NS_CC_END | NS_CC_END | |||
#endif // __ANDROID_JNI_HELPER_H__ | #endif // __ANDROID_JNI_HELPER_H__ | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
LinkedList.h | LinkedList.h | |||
---|---|---|---|---|
skipping to change at line 359 | skipping to change at line 359 | |||
/* | /* | |||
* Return true if the list is empty, or false otherwise. | * Return true if the list is empty, or false otherwise. | |||
*/ | */ | |||
bool isEmpty() | bool isEmpty() | |||
{ | { | |||
return !sentinel.isInList(); | return !sentinel.isInList(); | |||
} | } | |||
/* | /* | |||
* Remove all the elements from the list. | ||||
* | ||||
* This runs in time linear to the list's length, because we have to ma | ||||
rk | ||||
* each element as not in the list. | ||||
*/ | ||||
void clear() | ||||
{ | ||||
while (popFirst()) | ||||
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() | |||
{ | { | |||
#ifdef DEBUG | #ifdef DEBUG | |||
/* | /* | |||
* Check for cycles in the forward singly-linked list using the | * Check for cycles in the forward singly-linked list using the | |||
* tortoise/hare algorithm. | * tortoise/hare algorithm. | |||
*/ | */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 13 lines changed or added | |||
LuaCocos2d.h | LuaCocos2d.h | |||
---|---|---|---|---|
/************************************************************************** | ||||
** | ||||
Copyright (c) 2011 cocos2d-x.org | ||||
Copyright (c) 2011 NetDragon.com | ||||
http://www.cocos2d-x.org | ||||
Permission is hereby granted, free of charge, to any person obtaining a co | ||||
py | ||||
of this software and associated documentation files (the "Software"), to d | ||||
eal | ||||
in the Software without restriction, including without limitation the righ | ||||
ts | ||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
copies of the Software, and to permit persons to whom the Software is | ||||
furnished to do so, subject to the following conditions: | ||||
The above copyright notice and this permission notice shall be included in | ||||
all copies or substantial portions of the Software. | ||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH | ||||
E | ||||
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, | ||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
THE SOFTWARE. | ||||
************************************************************************** | ||||
**/ | ||||
#ifndef __LUACOCOS2D_H | ||||
#define __LUACOCOS2D_H | ||||
#if defined(_WIN32) && defined(_DEBUG) | ||||
#pragma warning (disable:4800) | ||||
#endif | ||||
#define TOLUA_RELEASE | ||||
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 | ||||
#define TOLUA_RELEASE | ||||
#endif | ||||
#ifndef __LUACOCOS2D_H_ | ||||
#define __LUACOCOS2D_H_ | ||||
extern "C" { | ||||
#include "tolua++.h" | #include "tolua++.h" | |||
#include "tolua_fix.h" | ||||
} | ||||
#include <map> | ||||
#include <string> | ||||
#include "tolua_fix.h" | ||||
#include "cocos2d.h" | ||||
#include "CCLuaEngine.h" | ||||
#include "SimpleAudioEngine.h" | ||||
using namespace cocos2d; | ||||
using namespace CocosDenshion; | ||||
int tolua_Cocos2d_open(lua_State* tolua_S); | TOLUA_API int tolua_Cocos2d_open(lua_State* tolua_S); | |||
#endif // __LUACOCOS2D_H | #endif // __LUACOCOS2D_H_ | |||
End of changes. 5 change blocks. | ||||
45 lines changed or deleted | 17 lines changed or added | |||
SAX2.h | SAX2.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#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 __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
XMLPUBFUN const xmlChar * XMLCALL | XMLPUBFUN const xmlChar * XMLCALL | |||
xmlSAX2GetPublicId (void *ctx); | xmlSAX2GetPublicId (void *ctx); | |||
XMLPUBFUN const xmlChar * XMLCALL | XMLPUBFUN const xmlChar * XMLCALL | |||
xmlSAX2GetSystemId (void *ctx); | xmlSAX2GetSystemId (void *ctx); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2SetDocumentLocator (void *ctx, | xmlSAX2SetDocumentLocator (void *ctx, | |||
xmlSAXLocatorPtr loc); | xmlSAXLocatorPtr loc); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAX2GetLineNumber (void *ctx); | xmlSAX2GetLineNumber (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAX2GetColumnNumber (void *ctx); | xmlSAX2GetColumnNumber (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAX2IsStandalone (void *ctx); | xmlSAX2IsStandalone (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAX2HasInternalSubset (void *ctx); | xmlSAX2HasInternalSubset (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAX2HasExternalSubset (void *ctx); | xmlSAX2HasExternalSubset (void *ctx); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2InternalSubset (void *ctx, | xmlSAX2InternalSubset (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 | |||
xmlSAX2ExternalSubset (void *ctx, | xmlSAX2ExternalSubset (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 | |||
xmlSAX2GetEntity (void *ctx, | xmlSAX2GetEntity (void *ctx, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlEntityPtr XMLCALL | XMLPUBFUN xmlEntityPtr XMLCALL | |||
xmlSAX2GetParameterEntity (void *ctx, | xmlSAX2GetParameterEntity (void *ctx, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlParserInputPtr XMLCALL | XMLPUBFUN xmlParserInputPtr XMLCALL | |||
xmlSAX2ResolveEntity (void *ctx, | xmlSAX2ResolveEntity (void *ctx, | |||
const xmlChar *publicId, | const xmlChar *publicId, | |||
const xmlChar *systemId); | const xmlChar *systemId); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2EntityDecl (void *ctx, | xmlSAX2EntityDecl (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 | |||
xmlSAX2AttributeDecl (void *ctx, | xmlSAX2AttributeDecl (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 | xmlSAX2ElementDecl (void *ctx, | |||
xmlSAX2ElementDecl (void *ctx, | const xmlChar *name, | |||
const xmlChar *name, | int type, | |||
int type, | xmlElementContentPtr content); | |||
xmlElementContentPtr conten | XMLPUBFUN void XMLCALL | |||
t); | xmlSAX2NotationDecl (void *ctx, | |||
XMLPUBFUN void XMLCALL | const xmlChar *name, | |||
xmlSAX2NotationDecl (void *ctx, | const xmlChar *publicId, | |||
const xmlChar *name, | const xmlChar *systemId); | |||
const xmlChar *publicId, | XMLPUBFUN void XMLCALL | |||
const xmlChar *systemId); | xmlSAX2UnparsedEntityDecl (void *ctx, | |||
XMLPUBFUN void XMLCALL | const xmlChar *name, | |||
xmlSAX2UnparsedEntityDecl (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 | XMLPUBFUN void XMLCALL | |||
xmlSAX2StartDocument (void *ctx); | xmlSAX2StartDocument (void *ctx); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2EndDocument (void *ctx); | xmlSAX2EndDocument (void *ctx); | |||
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined (LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) | #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined (LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2StartElement (void *ctx, | xmlSAX2StartElement (void *ctx, | |||
const xmlChar *fullname, | const xmlChar *fullname, | |||
const xmlChar **atts); | const xmlChar **atts); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2EndElement (void *ctx, | xmlSAX2EndElement (void *ctx, | |||
const xmlChar *name); | const xmlChar *name); | |||
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ | #endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2StartElementNs (void *ctx, | xmlSAX2StartElementNs (void *ctx, | |||
const xmlChar *localname, | const xmlChar *localname, | |||
const xmlChar *prefix, | const xmlChar *prefix, | |||
const xmlChar *URI, | const xmlChar *URI, | |||
int nb_namespaces, | int nb_namespaces, | |||
const xmlChar **namespaces, | const xmlChar **namespaces, | |||
int nb_attributes, | int nb_attributes, | |||
int nb_defaulted, | int nb_defaulted, | |||
const xmlChar **attributes) | const xmlChar **attributes); | |||
; | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2EndElementNs (void *ctx, | |||
xmlSAX2EndElementNs (void *ctx, | const xmlChar *localname, | |||
const xmlChar *localname, | const xmlChar *prefix, | |||
const xmlChar *prefix, | const xmlChar *URI); | |||
const xmlChar *URI); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2Reference (void *ctx, | |||
xmlSAX2Reference (void *ctx, | const xmlChar *name); | |||
const xmlChar *name); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2Characters (void *ctx, | |||
xmlSAX2Characters (void *ctx, | const xmlChar *ch, | |||
const xmlChar *ch, | int len); | |||
int len); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2IgnorableWhitespace (void *ctx, | |||
xmlSAX2IgnorableWhitespace (void *ctx, | const xmlChar *ch, | |||
const xmlChar *ch, | int len); | |||
int len); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2ProcessingInstruction (void *ctx, | |||
xmlSAX2ProcessingInstruction (void *ctx, | const xmlChar *target, | |||
const xmlChar *target, | const xmlChar *data); | |||
const xmlChar *data); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2Comment (void *ctx, | |||
xmlSAX2Comment (void *ctx, | const xmlChar *value); | |||
const xmlChar *value); | XMLPUBFUN void XMLCALL | |||
XMLPUBFUN void XMLCALL | xmlSAX2CDataBlock (void *ctx, | |||
xmlSAX2CDataBlock (void *ctx, | const xmlChar *value, | |||
const xmlChar *value, | int len); | |||
int len); | ||||
#ifdef LIBXML_SAX1_ENABLED | #ifdef LIBXML_SAX1_ENABLED | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAXDefaultVersion (int version); | xmlSAXDefaultVersion (int version); | |||
#endif /* LIBXML_SAX1_ENABLED */ | #endif /* LIBXML_SAX1_ENABLED */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSAXVersion (xmlSAXHandler *hdlr, | xmlSAXVersion (xmlSAXHandler *hdlr, | |||
int version); | int version); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, | xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, | |||
int warning); | int warning); | |||
#ifdef LIBXML_HTML_ENABLED | #ifdef LIBXML_HTML_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); | xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
htmlDefaultSAXHandlerInit (void); | htmlDefaultSAXHandlerInit (void); | |||
#endif | #endif | |||
#ifdef LIBXML_DOCB_ENABLED | #ifdef LIBXML_DOCB_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); | xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
docbDefaultSAXHandlerInit (void); | docbDefaultSAXHandlerInit (void); | |||
#endif | #endif | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDefaultSAXHandlerInit (void); | xmlDefaultSAXHandlerInit (void); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __XML_SAX2_H__ */ | #endif /* __XML_SAX2_H__ */ | |||
End of changes. 26 change blocks. | ||||
113 lines changed or deleted | 109 lines changed or added | |||
ScriptingCore.h | ScriptingCore.h | |||
---|---|---|---|---|
// | // | |||
// ScriptingCore.h | // ScriptingCore.h | |||
// testmonkey | // testmonkey | |||
// | // | |||
// Created by Rolando Abarca on 3/14/12. | // Created by Rolando Abarca on 3/14/12. | |||
// Copyright (c) 2012 Zynga Inc. All rights reserved. | // Copyright (c) 2012 Zynga Inc. All rights reserved. | |||
// | // | |||
#ifndef cocos2dx_ScriptingCore_h | #ifndef __SCRIPTING_CORE_H__ | |||
#define cocos2dx_ScriptingCore_h | #define __SCRIPTING_CORE_H__ | |||
#include "jsapi.h" | #include <assert.h> | |||
#include "cocos2d.h" | #include "cocos2d.h" | |||
#include "uthash.h" | ||||
#include "jsapi.h" | ||||
#include "jsfriendapi.h" | ||||
#include "spidermonkey_specifics.h" | ||||
/* Since there is an ugly bug in spiderMonkey-win32(cocos2d-2.0-rc0a), we u | void js_log(const char *format, ...); | |||
pdated spiderMonkey to v1.8.5 to resolve it. | ||||
But the api is a little different from the old version, so we define tw | ||||
o marco here. | ||||
*/ | ||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PL | ||||
ATFORM_LINUX) | ||||
typedef unsigned int uint32_t; | ||||
typedef int int32_t; | ||||
#define JS_GetPrivate(obj) JS_GetPrivate(cx, obj) | using namespace cocos2d; | |||
#define JS_SetPrivate(obj, data) JS_SetPrivate(cx, obj, data) | ||||
#endif | typedef void (*sc_register_sth)(JSContext* cx, JSObject* global); | |||
void registerDefaultClasses(JSContext* cx, JSObject* global); | ||||
class ScriptingCore | 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 instance; | ||||
return instance; | ||||
}; | ||||
/** | ||||
* will eval the specified string | ||||
* @param string The string with the javascript code to be evaluated | ||||
* @param outVal The jsval that will hold the return value of the evalu | ||||
ation. | ||||
* Can be NULL. | ||||
*/ | ||||
bool evalString(const char *string, jsval *outVal); | ||||
/** | ||||
* will run the specified string | ||||
* @param string The path of the script to be run | ||||
*/ | ||||
void runScript(const char *path); | ||||
/** | ||||
* @return the global context | ||||
*/ | ||||
JSContext* getGlobalContext() { | ||||
return cx; | ||||
}; | ||||
/** | ||||
* @param cx | ||||
* @param message | ||||
* @param report | ||||
*/ | ||||
static void reportError(JSContext *cx, const char *message, JSErrorRepo | ||||
rt *report) | ||||
{ | ||||
fprintf(stderr, "%s:%u:%s\n", | ||||
report->filename ? report->filename : "<no filename=\"filen | ||||
ame\">", | ||||
(unsigned int) report->lineno, | ||||
message); | ||||
}; | ||||
/** | static ScriptingCore *getInstance() { | |||
* Log something using CCLog | static ScriptingCore* pInstance = NULL; | |||
* @param cx | if (pInstance == NULL) { | |||
* @param argc | pInstance = new ScriptingCore(); | |||
* @param vp | ||||
*/ | ||||
static JSBool log(JSContext *cx, uint32_t argc, jsval *vp) | ||||
{ | ||||
if (argc > 0) { | ||||
JSString *string = NULL; | ||||
JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &string); | ||||
if (string) { | ||||
char *cstr = JS_EncodeString(cx, string); | ||||
cocos2d::CCLog(cstr); | ||||
} | ||||
} | } | |||
return JS_TRUE; | return pInstance; | |||
}; | }; | |||
/** | virtual ccScriptType getScriptType() { return kScriptTypeJavascript; }; | |||
* run a script from script :) | ||||
*/ | ||||
static JSBool executeScript(JSContext *cx, uint32_t argc, jsval *vp) | ||||
{ | ||||
if (argc == 1) { | ||||
JSString *string; | ||||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &string | ||||
) == JS_TRUE) { | ||||
ScriptingCore::getInstance().runScript(JS_EncodeString(cx, | ||||
string)); | ||||
} | ||||
} | ||||
return JS_TRUE; | ||||
}; | ||||
/** | /** | |||
* Register an object as a member of the GC's root set, preventing | @brief Remove CCObject from lua state | |||
* them from being GC'ed | @param object to remove | |||
*/ | */ | |||
static JSBool addRootJS(JSContext *cx, uint32_t argc, jsval *vp) | virtual void removeScriptObjectByCCObject(CCObject* pObj); | |||
{ | ||||
if (argc == 1) { | /** | |||
JSObject *o = NULL; | @brief Execute script code contained in the given string. | |||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "o", &o) == | @param codes holding the valid script code that should be executed. | |||
JS_TRUE) { | @return 0 if the string is excuted correctly. | |||
if (JS_AddObjectRoot(cx, &o) == JS_FALSE) { | @return other if the string is excuted wrongly. | |||
cocos2d::CCLog("something went wrong when setting an ob | */ | |||
ject to the root"); | virtual int executeString(const char* codes) { return 0; } | |||
} | ||||
} | /** | |||
} | @brief Execute a script file. | |||
return JS_TRUE; | @param filename String object holding the filename of the script file | |||
}; | that is to be executed | |||
*/ | ||||
virtual int executeScriptFile(const char* filename) { return 0; } | ||||
/** | ||||
@brief Execute a scripted global function. | ||||
@brief The function should not take any parameters and should return a | ||||
n integer. | ||||
@param functionName String object holding the name of the function, in | ||||
the global script environment, that is to be executed. | ||||
@return The integer value returned from the script function. | ||||
*/ | ||||
virtual int executeGlobalFunction(const char* functionName) { return | ||||
0; } | ||||
virtual int executeNodeEvent(CCNode* pNode, int nAction); | ||||
virtual int executeMenuItemEvent(CCMenuItem* pMenuItem); | ||||
virtual int executeNotificationEvent(CCNotificationCenter* pNotificatio | ||||
nCenter, const char* pszName); | ||||
virtual int executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* p | ||||
Target = NULL); | ||||
virtual int executeSchedule(CCTimer* pTimer, float dt, CCNode* pNode = | ||||
NULL); | ||||
virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CC | ||||
Set *pTouches); | ||||
virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTo | ||||
uch *pTouch); | ||||
int executeFunctionWithObjectData(CCNode *self, const char *name, JSObj | ||||
ect *obj); | ||||
int executeFunctionWithOwner(jsval owner, const char *name, jsval data) | ||||
; | ||||
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, jsval | ||||
data); | ||||
/** | ||||
* will eval the specified string | ||||
* @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. | ||||
* Can be NULL. | ||||
*/ | ||||
JSBool evalString(const char *string, jsval *outVal, const char *fil | ||||
ename = NULL); | ||||
/** | ||||
* will run the specified string | ||||
* @param string The path of the script to be run | ||||
*/ | ||||
JSBool runScript(const char *path); | ||||
/** | ||||
* initialize everything | ||||
*/ | ||||
void start(); | ||||
/** | ||||
* will add the register_sth callback to the list of functions that | ||||
need to be called | ||||
* after the creation of the context | ||||
*/ | ||||
void addRegisterCallback(sc_register_sth callback); | ||||
/** | ||||
* Will create a new context. If one is already there, it will destr | ||||
oy the old context | ||||
* and create a new one. | ||||
*/ | ||||
void createGlobalContext(); | ||||
static void removeAllRoots(JSContext *cx); | ||||
int executeCustomTouchEvent(int eventType, | ||||
CCTouch *pTouch, JSObject *obj, jsval &retv | ||||
al); | ||||
int executeCustomTouchEvent(int eventType, | ||||
CCTouch *pTouch, JSObject *obj); | ||||
int executeCustomTouchesEvent(int eventType, | ||||
CCSet *pTouches, JSObject *obj); | ||||
/** | ||||
* @return the global context | ||||
*/ | ||||
JSContext* getGlobalContext() { | ||||
return cx; | ||||
}; | ||||
/** | ||||
* @param cx | ||||
* @param message | ||||
* @param report | ||||
*/ | ||||
static void reportError(JSContext *cx, const char *message, JSErrorR | ||||
eport *report); | ||||
/** | ||||
* Log something using CCLog | ||||
* @param cx | ||||
* @param argc | ||||
* @param vp | ||||
*/ | ||||
static JSBool log(JSContext *cx, uint32_t argc, jsval *vp); | ||||
JSBool setReservedSpot(uint32_t i, JSObject *obj, jsval value); | ||||
/** | ||||
* run a script from script :) | ||||
*/ | ||||
static JSBool executeScript(JSContext *cx, uint32_t argc, jsval *vp) | ||||
; | ||||
/** | ||||
* Force a cycle of GC | ||||
* @param cx | ||||
* @param argc | ||||
* @param vp | ||||
*/ | ||||
static JSBool forceGC(JSContext *cx, uint32_t argc, jsval *vp); | ||||
static JSBool dumpRoot(JSContext *cx, uint32_t argc, jsval *vp); | ||||
static JSBool addRootJS(JSContext *cx, uint32_t argc, jsval *vp); | ||||
static JSBool removeRootJS(JSContext *cx, uint32_t argc, jsval *vp); | ||||
/** | private: | |||
* removes an object from the GC's root, allowing them to be GC'ed if n | void string_report(jsval val); | |||
o | ||||
* longer referenced. | ||||
*/ | ||||
static JSBool removeRootJS(JSContext *cx, uint32_t argc, jsval *vp) | ||||
{ | ||||
if (argc == 1) { | ||||
JSObject *o = NULL; | ||||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "o", &o) == | ||||
JS_TRUE) { | ||||
JS_RemoveObjectRoot(cx, &o); | ||||
} | ||||
} | ||||
return JS_TRUE; | ||||
}; | ||||
/** | ||||
* Force a cycle of GC | ||||
* @param cx | ||||
* @param argc | ||||
* @param vp | ||||
*/ | ||||
static JSBool forceGC(JSContext *cx, uint32_t argc, jsval *vp) | ||||
{ | ||||
JS_GC(cx); | ||||
return JS_TRUE; | ||||
}; | ||||
}; | }; | |||
// some utility functions | ||||
// to native | ||||
long long jsval_to_long_long(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 | ||||
const char* jsval_to_c_string(JSContext *cx, jsval v); | ||||
CCPoint jsval_to_ccpoint(JSContext *cx, jsval v); | ||||
CCRect jsval_to_ccrect(JSContext *cx, jsval v); | ||||
CCSize jsval_to_ccsize(JSContext *cx, jsval v); | ||||
ccGridSize jsval_to_ccgridsize(JSContext *cx, jsval v); | ||||
ccColor4B jsval_to_cccolor4b(JSContext *cx, jsval v); | ||||
ccColor4F jsval_to_cccolor4f(JSContext *cx, jsval v); | ||||
ccColor3B jsval_to_cccolor3b(JSContext *cx, jsval v); | ||||
CCArray* jsval_to_ccarray(JSContext* cx, jsval v); | ||||
jsval ccarray_to_jsval(JSContext* cx, CCArray *arr); | ||||
// from native | ||||
jsval long_long_to_jsval(JSContext* cx, long long v); | ||||
jsval std_string_to_jsval(JSContext* cx, std::string& v); | ||||
jsval c_string_to_jsval(JSContext* cx, const char* v); | ||||
jsval ccpoint_to_jsval(JSContext* cx, CCPoint& v); | ||||
jsval ccrect_to_jsval(JSContext* cx, CCRect& v); | ||||
jsval ccsize_to_jsval(JSContext* cx, CCSize& v); | ||||
jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v); | ||||
jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v); | ||||
jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v); | ||||
jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v); | ||||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
139 lines changed or deleted | 190 lines changed or added | |||
SimpleAudioEngine.h | SimpleAudioEngine.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2010 Steve Oldmeadow | Copyright (c) 2010 Steve Oldmeadow | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
skipping to change at line 29 | skipping to change at line 29 | |||
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 _SIMPLE_AUDIO_ENGINE_H_ | #ifndef _SIMPLE_AUDIO_ENGINE_H_ | |||
#define _SIMPLE_AUDIO_ENGINE_H_ | #define _SIMPLE_AUDIO_ENGINE_H_ | |||
#include "Export.h" | ||||
#include <stddef.h> | #include <stddef.h> | |||
#include "Export.h" | ||||
#include <typeinfo> | ||||
#include <ctype.h> | ||||
#include <string.h> | ||||
namespace CocosDenshion { | namespace CocosDenshion { | |||
class TypeInfo | ||||
{ | ||||
public: | ||||
virtual long getClassTypeInfo() = 0; | ||||
}; | ||||
static inline unsigned int getHashCodeByString(const char *key) | ||||
{ | ||||
unsigned int len = strlen(key); | ||||
const char *end=key+len; | ||||
unsigned int hash; | ||||
for (hash = 0; key < end; key++) | ||||
{ | ||||
hash *= 16777619; | ||||
hash ^= (unsigned int) (unsigned char) toupper(*key); | ||||
} | ||||
return (hash); | ||||
} | ||||
/** | /** | |||
@class SimpleAudioEngine | @class SimpleAudioEngine | |||
@brief offer a VERY simple interface to play background music & so und effect | @brief offer a VERY simple interface to play background music & so und effect | |||
*/ | */ | |||
class EXPORT_DLL SimpleAudioEngine | ||||
class EXPORT_DLL SimpleAudioEngine : public TypeInfo | ||||
{ | { | |||
public: | public: | |||
SimpleAudioEngine(); | SimpleAudioEngine(); | |||
~SimpleAudioEngine(); | ~SimpleAudioEngine(); | |||
virtual long getClassTypeInfo() { | ||||
return getHashCodeByString(typeid(CocosDenshion::SimpleAudioEngine) | ||||
.name()); | ||||
} | ||||
/** | /** | |||
@brief Get the shared Engine object,it will new one when first time be called | @brief Get the shared Engine object,it will new one when first time be called | |||
*/ | */ | |||
static SimpleAudioEngine* sharedEngine(); | static SimpleAudioEngine* sharedEngine(); | |||
/** | /** | |||
@brief Release the shared Engine object | @brief Release the shared Engine object | |||
@warning It must be called before the application exit, or a memroy lea k will be casued. | @warning It must be called before the application exit, or a memroy lea k will be casued. | |||
*/ | */ | |||
static void end(); | static void end(); | |||
skipping to change at line 66 | skipping to change at line 94 | |||
@brief Preload background music | @brief Preload background music | |||
@param pszFilePath The path of the background music file,or the FileNa me of T_SoundResInfo | @param pszFilePath The path of the background music file,or the FileNa me of T_SoundResInfo | |||
*/ | */ | |||
void preloadBackgroundMusic(const char* pszFilePath); | void preloadBackgroundMusic(const char* pszFilePath); | |||
/** | /** | |||
@brief Play background music | @brief Play background music | |||
@param pszFilePath The path of the background music file,or the FileNam e of T_SoundResInfo | @param pszFilePath The path of the background music file,or the FileNam e of T_SoundResInfo | |||
@param bLoop Whether the background music loop or not | @param bLoop Whether the background music loop or not | |||
*/ | */ | |||
void playBackgroundMusic(const char* pszFilePath, bool bLoop = false); | void playBackgroundMusic(const char* pszFilePath, bool bLoop); | |||
void playBackgroundMusic(const char* pszFilePath) { | ||||
this->playBackgroundMusic(pszFilePath, false); | ||||
} | ||||
/** | /** | |||
@brief Stop playing background music | @brief Stop playing background music | |||
@param bReleaseData If release the background music data or not.As defa ult value is false | @param bReleaseData If release the background music data or not.As defa ult value is false | |||
*/ | */ | |||
void stopBackgroundMusic(bool bReleaseData = false); | void stopBackgroundMusic(bool bReleaseData); | |||
void stopBackgroundMusic() { | ||||
this->stopBackgroundMusic(false); | ||||
} | ||||
/** | /** | |||
@brief Pause playing background music | @brief Pause playing background music | |||
*/ | */ | |||
void pauseBackgroundMusic(); | void pauseBackgroundMusic(); | |||
/** | /** | |||
@brief Resume playing background music | @brief Resume playing background music | |||
*/ | */ | |||
void resumeBackgroundMusic(); | void resumeBackgroundMusic(); | |||
skipping to change at line 126 | skipping to change at line 160 | |||
@param volume must be in 0.0~1.0 | @param volume must be in 0.0~1.0 | |||
*/ | */ | |||
void setEffectsVolume(float volume); | void setEffectsVolume(float volume); | |||
// for sound effects | // for sound effects | |||
/** | /** | |||
@brief Play sound effect | @brief Play sound effect | |||
@param pszFilePath The path of the effect file,or the FileName of T_Sou ndResInfo | @param pszFilePath The path of the effect file,or the FileName of T_Sou ndResInfo | |||
@bLoop Whether to loop the effect playing, default value is false | @bLoop Whether to loop the effect playing, default value is false | |||
*/ | */ | |||
unsigned int playEffect(const char* pszFilePath, bool bLoop = false); | unsigned int playEffect(const char* pszFilePath, bool bLoop); | |||
unsigned int playEffect(const char* pszFilePath) { | ||||
return this->playEffect(pszFilePath, false); | ||||
} | ||||
/** | /** | |||
@brief Pause playing sound effect | @brief Pause playing sound effect | |||
@param nSoundId The return value of function playEffect | @param nSoundId The return value of function playEffect | |||
*/ | */ | |||
void pauseEffect(unsigned int nSoundId); | void pauseEffect(unsigned int nSoundId); | |||
/** | /** | |||
@brief Pause all playing sound effect | @brief Pause all playing sound effect | |||
@param nSoundId The return value of function playEffect | @param nSoundId The return value of function playEffect | |||
End of changes. 9 change blocks. | ||||
6 lines changed or deleted | 44 lines changed or added | |||
Statistics.h | Statistics.h | |||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
#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_WAIT_BACKGROUND_THREAD, | ||||
PHASE_PURGE, | ||||
PHASE_MARK, | PHASE_MARK, | |||
PHASE_MARK_ROOTS, | PHASE_MARK_ROOTS, | |||
PHASE_MARK_DELAYED, | PHASE_MARK_DELAYED, | |||
PHASE_MARK_OTHER, | PHASE_MARK_OTHER, | |||
PHASE_FINALIZE_START, | ||||
PHASE_SWEEP, | PHASE_SWEEP, | |||
PHASE_SWEEP_COMPARTMENTS, | ||||
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_DISCARD_CODE, | |||
PHASE_DISCARD_ANALYSIS, | PHASE_DISCARD_ANALYSIS, | |||
PHASE_XPCONNECT, | PHASE_DISCARD_TI, | |||
PHASE_SWEEP_TYPES, | ||||
PHASE_CLEAR_SCRIPT_ANALYSIS, | ||||
PHASE_FINALIZE_END, | ||||
PHASE_DESTROY, | PHASE_DESTROY, | |||
PHASE_GC_END, | ||||
PHASE_LIMIT | PHASE_LIMIT | |||
}; | }; | |||
enum Stat { | enum Stat { | |||
STAT_NEW_CHUNK, | STAT_NEW_CHUNK, | |||
STAT_DESTROY_CHUNK, | STAT_DESTROY_CHUNK, | |||
STAT_LIMIT | STAT_LIMIT | |||
}; | }; | |||
static const size_t BUFFER_SIZE = 8192; | class StatisticsSerializer; | |||
struct Statistics { | struct Statistics { | |||
Statistics(JSRuntime *rt); | Statistics(JSRuntime *rt); | |||
~Statistics(); | ~Statistics(); | |||
void beginPhase(Phase phase); | void beginPhase(Phase phase); | |||
void endPhase(Phase phase); | void endPhase(Phase phase); | |||
void beginSlice(JSCompartment *comp, gcreason::Reason reason); | void beginSlice(int collectedCount, int compartmentCount, gcreason::Rea son reason); | |||
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]++; | |||
} | } | |||
jschar *formatMessage(); | ||||
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; | |||
JSCompartment *compartment; | int collectedCount; | |||
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) | |||
: reason(reason), resetReason(NULL), start(start) | : reason(reason), resetReason(NULL), start(start) | |||
{ | { | |||
PodArrayZero(phaseTimes); | PodArrayZero(phaseTimes); | |||
} | } | |||
gcreason::Reason reason; | gcreason::Reason reason; | |||
skipping to change at line 139 | skipping to change at line 152 | |||
/* 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]; | |||
char buffer[BUFFER_SIZE]; | /* Allocated space before the GC started. */ | |||
bool needComma; | size_t preBytes; | |||
void beginGC(); | void beginGC(); | |||
void endGC(); | void endGC(); | |||
int64_t gcDuration(); | int64_t gcDuration(); | |||
double t(int64_t t); | ||||
void printStats(); | void printStats(); | |||
void fmt(const char *f, ...); | bool formatData(StatisticsSerializer &ss, uint64_t timestamp); | |||
void fmtIfNonzero(const char *name, double t); | ||||
void formatPhases(int64_t *times); | ||||
const char *formatData(); | ||||
double computeMMU(int64_t resolution); | double computeMMU(int64_t resolution); | |||
}; | }; | |||
struct AutoGCSlice { | struct AutoGCSlice { | |||
AutoGCSlice(Statistics &stats, JSCompartment *comp, gcreason::Reason re ason | AutoGCSlice(Statistics &stats, int collectedCount, int compartmentCount , gcreason::Reason reason | |||
JS_GUARD_OBJECT_NOTIFIER_PARAM) | JS_GUARD_OBJECT_NOTIFIER_PARAM) | |||
: stats(stats) { JS_GUARD_OBJECT_NOTIFIER_INIT; stats.beginSlice(comp | : stats(stats) | |||
, reason); } | { | |||
JS_GUARD_OBJECT_NOTIFIER_INIT; | ||||
stats.beginSlice(collectedCount, compartmentCount, reason); | ||||
} | ||||
~AutoGCSlice() { stats.endSlice(); } | ~AutoGCSlice() { stats.endSlice(); } | |||
Statistics &stats; | Statistics &stats; | |||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER | JS_DECL_USE_GUARD_OBJECT_NOTIFIER | |||
}; | }; | |||
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); } | |||
End of changes. 14 change blocks. | ||||
14 lines changed or deleted | 26 lines changed or added | |||
TGAlib.h | TGAlib.h | |||
---|---|---|---|---|
skipping to change at line 64 | skipping to change at line 64 | |||
/// load the image header fields. We only keep those that matter! | /// load the image header fields. We only keep those that matter! | |||
bool tgaLoadHeader(unsigned char *Buffer, unsigned long bufSize, tImageTGA *psInfo); | bool tgaLoadHeader(unsigned char *Buffer, unsigned long bufSize, tImageTGA *psInfo); | |||
/// loads the image pixels. You shouldn't call this function directly | /// loads the image pixels. You shouldn't call this function directly | |||
bool tgaLoadImageData(unsigned char *Buffer, unsigned long bufSize, tImageT GA *psInfo); | bool tgaLoadImageData(unsigned char *Buffer, unsigned long bufSize, tImageT GA *psInfo); | |||
/// this is the function to call when we want to load an image | /// this is the function to call when we want to load an image | |||
tImageTGA * tgaLoad(const char *pszFilename); | tImageTGA * tgaLoad(const char *pszFilename); | |||
// /converts RGB to greyscale | // /converts RGB to grayscale | |||
void tgaRGBtogreyscale(tImageTGA *psInfo); | void tgaRGBtogreyscale(tImageTGA *psInfo); | |||
/// releases the memory used for the image | /// releases the memory used for the image | |||
void tgaDestroy(tImageTGA *psInfo); | void tgaDestroy(tImageTGA *psInfo); | |||
}//namespace cocos2d | }//namespace cocos2d | |||
#endif // __SUPPORT_DATA_SUPPORT_TGALIB_H__ | #endif // __SUPPORT_DATA_SUPPORT_TGALIB_H__ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
TemplateLib.h | TemplateLib.h | |||
---|---|---|---|---|
skipping to change at line 177 | skipping to change at line 177 | |||
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; }; | |||
/* | ||||
* Traits class for identifying types that are implicitly barriered. | ||||
*/ | ||||
template <class T> struct IsPostBarrieredType { static const bool result = | ||||
false; }; | ||||
} /* namespace tl */ | } /* namespace tl */ | |||
} /* namespace js */ | } /* namespace js */ | |||
#endif /* js_template_lib_h__ */ | #endif /* js_template_lib_h__ */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
TransformUtils.h | TransformUtils.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2009 Valentin Milea | Copyright (c) 2009 Valentin Milea | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Utility.h | Utility.h | |||
---|---|---|---|---|
skipping to change at line 161 | skipping to change at line 161 | |||
# define JS_OOM_POSSIBLY_FAIL() \ | # define JS_OOM_POSSIBLY_FAIL() \ | |||
do \ | do \ | |||
{ \ | { \ | |||
if (++OOM_counter > OOM_maxAllocations) { \ | if (++OOM_counter > OOM_maxAllocations) { \ | |||
JS_OOM_EMIT_BACKTRACE();\ | JS_OOM_EMIT_BACKTRACE();\ | |||
return NULL; \ | return NULL; \ | |||
} \ | } \ | |||
} while (0) | } while (0) | |||
# define JS_OOM_POSSIBLY_FAIL_REPORT(cx) \ | ||||
do \ | ||||
{ \ | ||||
if (++OOM_counter > OOM_maxAllocations) { \ | ||||
JS_OOM_EMIT_BACKTRACE();\ | ||||
js_ReportOutOfMemory(cx);\ | ||||
return NULL; \ | ||||
} \ | ||||
} while (0) | ||||
# else | # else | |||
# define JS_OOM_POSSIBLY_FAIL() do {} while(0) | # define JS_OOM_POSSIBLY_FAIL() do {} while(0) | |||
# endif | # define JS_OOM_POSSIBLY_FAIL_REPORT(cx) do {} while(0) | |||
# endif /* DEBUG */ | ||||
/* | /* | |||
* SpiderMonkey code should not be calling these allocation functions direc tly. | * SpiderMonkey code should not be calling these allocation functions direc tly. | |||
* Instead, all calls should go through JSRuntime, JSContext or OffTheBooks . | * Instead, all calls should go through JSRuntime, JSContext or OffTheBooks . | |||
* However, js_free() can be called directly. | * However, js_free() can be called directly. | |||
*/ | */ | |||
static JS_INLINE void* js_malloc(size_t bytes) | static JS_INLINE void* js_malloc(size_t bytes) | |||
{ | { | |||
JS_OOM_POSSIBLY_FAIL(); | JS_OOM_POSSIBLY_FAIL(); | |||
return malloc(bytes); | return malloc(bytes); | |||
skipping to change at line 335 | skipping to change at line 346 | |||
(_log2) += 8, (j_) >>= 8; \ | (_log2) += 8, (j_) >>= 8; \ | |||
if ((j_) >> 4) \ | if ((j_) >> 4) \ | |||
(_log2) += 4, (j_) >>= 4; \ | (_log2) += 4, (j_) >>= 4; \ | |||
if ((j_) >> 2) \ | if ((j_) >> 2) \ | |||
(_log2) += 2, (j_) >>= 2; \ | (_log2) += 2, (j_) >>= 2; \ | |||
if ((j_) >> 1) \ | if ((j_) >> 1) \ | |||
(_log2) += 1; \ | (_log2) += 1; \ | |||
JS_END_MACRO | JS_END_MACRO | |||
#endif | #endif | |||
/* | ||||
* Internal function. | ||||
* Compute the log of the least power of 2 greater than or equal to n. This | ||||
is | ||||
* a version of JS_CeilingLog2 that operates on unsigned integers with | ||||
* CPU-dependant size. | ||||
*/ | ||||
#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1)) | ||||
/* | ||||
* Internal function. | ||||
* Compute the log of the greatest power of 2 less than or equal to n. | ||||
* This is a version of JS_FloorLog2 that operates on unsigned integers wit | ||||
h | ||||
* CPU-dependant size and requires that n != 0. | ||||
*/ | ||||
#define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n)) | ||||
#if JS_BYTES_PER_WORD == 4 | #if JS_BYTES_PER_WORD == 4 | |||
# ifdef JS_HAS_BUILTIN_BITSCAN32 | # ifdef JS_HAS_BUILTIN_BITSCAN32 | |||
# define js_FloorLog2wImpl(n) \ | # define js_FloorLog2wImpl(n) \ | |||
((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) | ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) | |||
# else | # else | |||
JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); | JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); | |||
# endif | # endif | |||
#elif JS_BYTES_PER_WORD == 8 | #elif JS_BYTES_PER_WORD == 8 | |||
# ifdef JS_HAS_BUILTIN_BITSCAN64 | # ifdef JS_HAS_BUILTIN_BITSCAN64 | |||
# define js_FloorLog2wImpl(n) \ | # define js_FloorLog2wImpl(n) \ | |||
((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n))) | ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n))) | |||
# else | # else | |||
JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); | JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); | |||
# endif | # endif | |||
#else | #else | |||
# error "NOT SUPPORTED" | # error "NOT SUPPORTED" | |||
#endif | #endif | |||
/* | ||||
* Internal function. | ||||
* Compute the log of the least power of 2 greater than or equal to n. This | ||||
is | ||||
* a version of JS_CeilingLog2 that operates on unsigned integers with | ||||
* CPU-dependant size. | ||||
*/ | ||||
#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1)) | ||||
/* | ||||
* Internal function. | ||||
* Compute the log of the greatest power of 2 less than or equal to n. | ||||
* This is a version of JS_FloorLog2 that operates on unsigned integers wit | ||||
h | ||||
* CPU-dependant size and requires that n != 0. | ||||
*/ | ||||
static MOZ_ALWAYS_INLINE size_t | ||||
JS_FLOOR_LOG2W(size_t n) | ||||
{ | ||||
JS_ASSERT(n != 0); | ||||
return js_FloorLog2wImpl(n); | ||||
} | ||||
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 900 | skipping to change at line 916 | |||
* 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); | |||
} | } | |||
} /* namespace js */ | } /* namespace js */ | |||
namespace JS { | ||||
/* | ||||
* 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. | ||||
* | ||||
* 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 | ||||
* 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 | ||||
* a live integer value. | ||||
*/ | ||||
inline void PoisonPtr(uintptr_t *v) | ||||
{ | ||||
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) | ||||
uint8_t *ptr = (uint8_t *) v + 3; | ||||
*ptr = JS_FREE_PATTERN; | ||||
#endif | ||||
} | ||||
template <typename T> | ||||
inline bool IsPoisonedPtr(T *v) | ||||
{ | ||||
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) | ||||
uint32_t mask = uintptr_t(v) & 0xff000000; | ||||
return mask == uint32_t(JS_FREE_PATTERN << 24); | ||||
#else | ||||
return false; | ||||
#endif | ||||
} | ||||
} | ||||
#endif /* defined(__cplusplus) */ | #endif /* defined(__cplusplus) */ | |||
/* | /* | |||
* This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|. | * This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|. | |||
*/ | */ | |||
typedef size_t(*JSMallocSizeOfFun)(const void *p); | typedef size_t(*JSMallocSizeOfFun)(const void *p); | |||
/* sixgill annotation defines */ | /* sixgill annotation defines */ | |||
#ifndef HAVE_STATIC_ANNOTATIONS | #ifndef HAVE_STATIC_ANNOTATIONS | |||
# define HAVE_STATIC_ANNOTATIONS | # define HAVE_STATIC_ANNOTATIONS | |||
End of changes. 5 change blocks. | ||||
19 lines changed or deleted | 74 lines changed or added | |||
Vector.h | Vector.h | |||
---|---|---|---|---|
skipping to change at line 216 | skipping to change at line 216 | |||
* - 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 _; | ||||
/* 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); | |||
bool convertToHeapStorage(size_t lengthInc); | bool convertToHeapStorage(size_t lengthInc); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
ZipUtils.h | ZipUtils.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
namespace cocos2d | namespace cocos2d | |||
{ | { | |||
/* XXX: pragma pack ??? */ | /* XXX: pragma pack ??? */ | |||
/** @struct CCZHeader | /** @struct CCZHeader | |||
*/ | */ | |||
struct CCZHeader { | struct CCZHeader { | |||
unsigned char sig[4]; // signature. Shoul d be 'CCZ!' 4 bytes | unsigned char sig[4]; // signature. Shoul d be 'CCZ!' 4 bytes | |||
unsigned short compression_type; // should 0 | unsigned short compression_type; // should 0 | |||
unsigned short version; // should be 2 (altho ugh version type==1 is also supported) | unsigned short version; // should be 2 (altho ugh version type==1 is also supported) | |||
unsigned int reserved; // Reserverd for user s. | unsigned int reserved; // Reserved for users . | |||
unsigned int len; // size of the uncompre ssed file | unsigned int len; // size of the uncompre ssed file | |||
}; | }; | |||
enum { | enum { | |||
CCZ_COMPRESSION_ZLIB, // zlib format. | CCZ_COMPRESSION_ZLIB, // zlib format. | |||
CCZ_COMPRESSION_BZIP2, // bzip2 format (not supporte d yet) | CCZ_COMPRESSION_BZIP2, // bzip2 format (not supporte d yet) | |||
CCZ_COMPRESSION_GZIP, // gzip format (not supported yet) | CCZ_COMPRESSION_GZIP, // gzip format (not supported yet) | |||
CCZ_COMPRESSION_NONE, // plain (not supported yet) | CCZ_COMPRESSION_NONE, // plain (not supported yet) | |||
}; | }; | |||
class ZipUtils | class ZipUtils | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* Inflates either zlib or gzip deflated memory. The inflated memory is | * Inflates either zlib or gzip deflated memory. The inflated memory is | |||
* expected to be freed by the caller. | * expected to be freed by the caller. | |||
* | * | |||
* It will allocate 256k for the destination buffer. If it is not en ought it will multiply the previous buffer size per 2, until there is enoug h memory. | * It will allocate 256k for the destination buffer. If it is not en ough it will multiply the previous buffer size per 2, until there is enough memory. | |||
* @returns the length of the deflated buffer | * @returns the length of the deflated buffer | |||
* | * | |||
@since v0.8.1 | @since v0.8.1 | |||
*/ | */ | |||
static int ccInflateMemory(unsigned char *in, unsigned int inLength , unsigned char **out); | static int ccInflateMemory(unsigned char *in, unsigned int inLength , unsigned char **out); | |||
/** | /** | |||
* Inflates either zlib or gzip deflated memory. The inflated memory is | * Inflates either zlib or gzip deflated memory. The inflated memory is | |||
* expected to be freed by the caller. | * expected to be freed by the caller. | |||
* | * | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
aabb.h | aabb.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
#include "platform/CCPlatformMacros.h" | #include "platform/CCPlatformMacros.h" | |||
#include "vec3.h" | #include "vec3.h" | |||
#include "utility.h" | #include "utility.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* A struture that represents an axis-aligned | * A structure that represents an axis-aligned | |||
* bounding box. | * bounding box. | |||
*/ | */ | |||
typedef struct kmAABB { | typedef struct kmAABB { | |||
kmVec3 min; /** The max corner of the box */ | kmVec3 min; /** The max corner of the box */ | |||
kmVec3 max; /** The min corner of the box */ | kmVec3 max; /** The min corner of the box */ | |||
} kmAABB; | } kmAABB; | |||
CC_DLL const int kmAABBContainsPoint(const kmVec3* pPoint, const kmAABB* pB ox); | CC_DLL const int kmAABBContainsPoint(const kmVec3* pPoint, const kmAABB* pB ox); | |||
CC_DLL kmAABB* const kmAABBAssign(kmAABB* pOut, const kmAABB* pIn); | CC_DLL kmAABB* const kmAABBAssign(kmAABB* pOut, const kmAABB* pIn); | |||
CC_DLL kmAABB* const kmAABBScale(kmAABB* pOut, const kmAABB* pIn, kmScalar s); | CC_DLL kmAABB* const kmAABBScale(kmAABB* pOut, const kmAABB* pIn, kmScalar s); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ccCArray.h | ccCArray.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
based on Chipmunk cpArray. | based on Chipmunk cpArray. | |||
ccArray is a faster alternative to NSMutableArray, it does pretty much the | ccArray is a faster alternative to NSMutableArray, it does pretty much the | |||
same thing (stores NSObjects and retains/releases them appropriately). It' s | same thing (stores NSObjects and retains/releases them appropriately). It' s | |||
faster because: | faster because: | |||
- it uses a plain C interface so it doesn't incur Objective-c messaging ov erhead | - it uses a plain C interface so it doesn't incur Objective-c messaging ov erhead | |||
- it assumes you know what you're doing, so it doesn't spend time on safet y checks | - it assumes you know what you're doing, so it doesn't spend time on safet y checks | |||
(index out of bounds, required capacity etc.) | (index out of bounds, required capacity etc.) | |||
- comparisons are done using pointer equality instead of isEqual | - comparisons are done using pointer equality instead of isEqual | |||
There are 2 kind of functions: | There are 2 kind of functions: | |||
- ccArray functions that manipulates objective-c objects (retain and relea se are performanced) | - ccArray functions that manipulates objective-c objects (retain and relea se are performed) | |||
- ccCArray functions that manipulates values like if they were standard C structures (no retain/release is performed) | - ccCArray functions that manipulates values like if they were standard C structures (no retain/release is performed) | |||
*/ | */ | |||
#ifndef CC_ARRAY_H | #ifndef CC_ARRAY_H | |||
#define CC_ARRAY_H | #define CC_ARRAY_H | |||
#include "ccMacros.h" | #include "ccMacros.h" | |||
#include "cocoa/CCObject.h" | #include "cocoa/CCObject.h" | |||
#include <stdlib.h> | #include <stdlib.h> | |||
skipping to change at line 80 | skipping to change at line 80 | |||
/** Doubles array capacity */ | /** Doubles array capacity */ | |||
void ccArrayDoubleCapacity(ccArray *arr); | void ccArrayDoubleCapacity(ccArray *arr); | |||
/** Increases array capacity such that max >= num + extra. */ | /** Increases array capacity such that max >= num + extra. */ | |||
void ccArrayEnsureExtraCapacity(ccArray *arr, unsigned int extra); | void ccArrayEnsureExtraCapacity(ccArray *arr, unsigned int extra); | |||
/** shrinks the array so the memory footprint corresponds with the number o f items */ | /** shrinks the array so the memory footprint corresponds with the number o f items */ | |||
void ccArrayShrink(ccArray *arr); | void ccArrayShrink(ccArray *arr); | |||
/** Returns index of first occurence of object, NSNotFound if object not fo und. */ | /** Returns index of first occurrence of object, NSNotFound if object not f ound. */ | |||
unsigned int ccArrayGetIndexOfObject(ccArray *arr, CCObject* object); | unsigned int ccArrayGetIndexOfObject(ccArray *arr, CCObject* object); | |||
/** Returns a Boolean value that indicates whether object is present in arr ay. */ | /** Returns a Boolean value that indicates whether object is present in arr ay. */ | |||
bool ccArrayContainsObject(ccArray *arr, CCObject* object); | bool ccArrayContainsObject(ccArray *arr, CCObject* object); | |||
/** Appends an object. Bahaviour undefined if array doesn't have enough cap acity. */ | /** Appends an object. Behavior undefined if array doesn't have enough capa city. */ | |||
void ccArrayAppendObject(ccArray *arr, CCObject* object); | void ccArrayAppendObject(ccArray *arr, CCObject* object); | |||
/** Appends an object. Capacity of arr is increased if needed. */ | /** Appends an object. Capacity of arr is increased if needed. */ | |||
void ccArrayAppendObjectWithResize(ccArray *arr, CCObject* object); | void ccArrayAppendObjectWithResize(ccArray *arr, CCObject* object); | |||
/** Appends objects from plusArr to arr. | /** Appends objects from plusArr to arr. | |||
Behaviour undefined if arr doesn't have enough capacity. */ | Behavior undefined if arr doesn't have enough capacity. */ | |||
void ccArrayAppendArray(ccArray *arr, ccArray *plusArr); | void ccArrayAppendArray(ccArray *arr, ccArray *plusArr); | |||
/** Appends objects from plusArr to arr. Capacity of arr is increased if ne eded. */ | /** Appends objects from plusArr to arr. Capacity of arr is increased if ne eded. */ | |||
void ccArrayAppendArrayWithResize(ccArray *arr, ccArray *plusArr); | void ccArrayAppendArrayWithResize(ccArray *arr, ccArray *plusArr); | |||
/** Inserts an object at index */ | /** Inserts an object at index */ | |||
void ccArrayInsertObjectAtIndex(ccArray *arr, CCObject* object, unsigned in t index); | void ccArrayInsertObjectAtIndex(ccArray *arr, CCObject* object, unsigned in t index); | |||
/** Swaps two objects */ | /** Swaps two objects */ | |||
void ccArraySwapObjectsAtIndexes(ccArray *arr, unsigned int index1, unsigne d int index2); | void ccArraySwapObjectsAtIndexes(ccArray *arr, unsigned int index1, unsigne d int index2); | |||
/** Removes all objects from arr */ | /** Removes all objects from arr */ | |||
void ccArrayRemoveAllObjects(ccArray *arr); | void ccArrayRemoveAllObjects(ccArray *arr); | |||
/** Removes object at specified index and pushes back all subsequent object s. | /** Removes object at specified index and pushes back all subsequent object s. | |||
Behaviour undefined if index outside [0, num-1]. */ | Behavior undefined if index outside [0, num-1]. */ | |||
void ccArrayRemoveObjectAtIndex(ccArray *arr, unsigned int index, bool bRel easeObj = true); | void ccArrayRemoveObjectAtIndex(ccArray *arr, unsigned int index, bool bRel easeObj = true); | |||
/** Removes object at specified index and fills the gap with the last objec t, | /** Removes object at specified index and fills the gap with the last objec t, | |||
thereby avoiding the need to push back subsequent objects. | thereby avoiding the need to push back subsequent objects. | |||
Behaviour undefined if index outside [0, num-1]. */ | Behavior undefined if index outside [0, num-1]. */ | |||
void ccArrayFastRemoveObjectAtIndex(ccArray *arr, unsigned int index); | void ccArrayFastRemoveObjectAtIndex(ccArray *arr, unsigned int index); | |||
void ccArrayFastRemoveObject(ccArray *arr, CCObject* object); | void ccArrayFastRemoveObject(ccArray *arr, CCObject* object); | |||
/** Searches for the first occurance of object and removes it. If object is not | /** Searches for the first occurrence of object and removes it. If object i s not | |||
found the function has no effect. */ | found the function has no effect. */ | |||
void ccArrayRemoveObject(ccArray *arr, CCObject* object, bool bReleaseObj = true); | void ccArrayRemoveObject(ccArray *arr, CCObject* object, bool bReleaseObj = true); | |||
/** Removes from arr all objects in minusArr. For each object in minusArr, the | /** Removes from arr all objects in minusArr. For each object in minusArr, the | |||
first matching instance in arr will be removed. */ | first matching instance in arr will be removed. */ | |||
void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr); | void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr); | |||
/** Removes from arr all objects in minusArr. For each object in minusArr, all | /** Removes from arr all objects in minusArr. For each object in minusArr, all | |||
matching instances in arr will be removed. */ | matching instances in arr will be removed. */ | |||
void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr); | void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr); | |||
skipping to change at line 151 | skipping to change at line 151 | |||
/** Frees C array after removing all remaining values. Silently ignores nil arr. */ | /** Frees C array after removing all remaining values. Silently ignores nil arr. */ | |||
void ccCArrayFree(ccCArray *arr); | void ccCArrayFree(ccCArray *arr); | |||
/** Doubles C array capacity */ | /** Doubles C array capacity */ | |||
void ccCArrayDoubleCapacity(ccCArray *arr); | void ccCArrayDoubleCapacity(ccCArray *arr); | |||
/** Increases array capacity such that max >= num + extra. */ | /** Increases array capacity such that max >= num + extra. */ | |||
void ccCArrayEnsureExtraCapacity(ccCArray *arr, unsigned int extra); | void ccCArrayEnsureExtraCapacity(ccCArray *arr, unsigned int extra); | |||
/** Returns index of first occurence of value, NSNotFound if value not foun d. */ | /** Returns index of first occurrence of value, NSNotFound if value not fou nd. */ | |||
unsigned int ccCArrayGetIndexOfValue(ccCArray *arr, void* value); | unsigned int ccCArrayGetIndexOfValue(ccCArray *arr, void* value); | |||
/** Returns a Boolean value that indicates whether value is present in the C array. */ | /** Returns a Boolean value that indicates whether value is present in the C array. */ | |||
bool ccCArrayContainsValue(ccCArray *arr, void* value); | bool ccCArrayContainsValue(ccCArray *arr, void* value); | |||
/** Inserts a value at a certain position. Behaviour undefined if aray does n't have enough capacity */ | /** Inserts a value at a certain position. Behavior undefined if array does n't have enough capacity */ | |||
void ccCArrayInsertValueAtIndex( ccCArray *arr, void* value, unsigned int i ndex); | void ccCArrayInsertValueAtIndex( ccCArray *arr, void* value, unsigned int i ndex); | |||
/** Appends an value. Bahaviour undefined if array doesn't have enough capa city. */ | /** Appends an value. Behavior undefined if array doesn't have enough capac ity. */ | |||
void ccCArrayAppendValue(ccCArray *arr, void* value); | void ccCArrayAppendValue(ccCArray *arr, void* value); | |||
/** Appends an value. Capacity of arr is increased if needed. */ | /** Appends an value. Capacity of arr is increased if needed. */ | |||
void ccCArrayAppendValueWithResize(ccCArray *arr, void* value); | void ccCArrayAppendValueWithResize(ccCArray *arr, void* value); | |||
/** Appends values from plusArr to arr. Behaviour undefined if arr doesn't have | /** Appends values from plusArr to arr. Behavior undefined if arr doesn't h ave | |||
enough capacity. */ | enough capacity. */ | |||
void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr); | void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr); | |||
/** Appends values from plusArr to arr. Capacity of arr is increased if nee ded. */ | /** Appends values from plusArr to arr. Capacity of arr is increased if nee ded. */ | |||
void ccCArrayAppendArrayWithResize(ccCArray *arr, ccCArray *plusArr); | void ccCArrayAppendArrayWithResize(ccCArray *arr, ccCArray *plusArr); | |||
/** Removes all values from arr */ | /** Removes all values from arr */ | |||
void ccCArrayRemoveAllValues(ccCArray *arr); | void ccCArrayRemoveAllValues(ccCArray *arr); | |||
/** Removes value at specified index and pushes back all subsequent values. | /** Removes value at specified index and pushes back all subsequent values. | |||
Behaviour undefined if index outside [0, num-1]. | Behavior undefined if index outside [0, num-1]. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
void ccCArrayRemoveValueAtIndex(ccCArray *arr, unsigned int index); | void ccCArrayRemoveValueAtIndex(ccCArray *arr, unsigned int index); | |||
/** Removes value at specified index and fills the gap with the last value, | /** Removes value at specified index and fills the gap with the last value, | |||
thereby avoiding the need to push back subsequent values. | thereby avoiding the need to push back subsequent values. | |||
Behaviour undefined if index outside [0, num-1]. | Behavior undefined if index outside [0, num-1]. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, unsigned int index); | void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, unsigned int index); | |||
/** Searches for the first occurance of value and removes it. If value is n ot found the function has no effect. | /** Searches for the first occurrence of value and removes it. If value is not found the function has no effect. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
void ccCArrayRemoveValue(ccCArray *arr, void* value); | void ccCArrayRemoveValue(ccCArray *arr, void* value); | |||
/** Removes from arr all values in minusArr. For each Value in minusArr, th e first matching instance in arr will be removed. | /** Removes from arr all values in minusArr. For each Value in minusArr, th e first matching instance in arr will be removed. | |||
@since v0.99.4 | @since v0.99.4 | |||
*/ | */ | |||
void ccCArrayRemoveArray(ccCArray *arr, ccCArray *minusArr); | void ccCArrayRemoveArray(ccCArray *arr, ccCArray *minusArr); | |||
/** Removes from arr all values in minusArr. For each value in minusArr, al l matching instances in arr will be removed. | /** Removes from arr all values in minusArr. For each value in minusArr, al l matching instances in arr will be removed. | |||
End of changes. 14 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
ccConfig.h | ccConfig.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 39 | skipping to change at line 39 | |||
#include "platform/CCPlatformConfig.h" | #include "platform/CCPlatformConfig.h" | |||
/** | /** | |||
@file | @file | |||
cocos2d (cc) configuration file | cocos2d (cc) configuration file | |||
*/ | */ | |||
/** @def CC_ENABLE_GL_STATE_CACHE | /** @def CC_ENABLE_GL_STATE_CACHE | |||
If enabled, cocos2d will maintain an OpenGL state cache internally to avoi d unnecessary switches. | If enabled, cocos2d will maintain an OpenGL state cache internally to avoi d unnecessary switches. | |||
In order to use them, you have to use the following functions, insead of t he the GL ones: | In order to use them, you have to use the following functions, instead of the the GL ones: | |||
- ccGLUseProgram() instead of glUseProgram() | - ccGLUseProgram() instead of glUseProgram() | |||
- ccGLDeleteProgram() instead of glDeleteProgram() | - ccGLDeleteProgram() instead of glDeleteProgram() | |||
- ccGLBlendFunc() instead of glBlendFunc() | - ccGLBlendFunc() instead of glBlendFunc() | |||
If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgra m(), ccGLBlendFunc() will call the GL ones, without using the cache. | If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgra m(), ccGLBlendFunc() will call the GL ones, without using the cache. | |||
It is recommened to enable whenever possible to improve speed. | It is recommended to enable whenever possible to improve speed. | |||
If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on. | If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on. | |||
@since v2.0.0 | @since v2.0.0 | |||
*/ | */ | |||
#ifndef CC_ENABLE_GL_STATE_CACHE | #ifndef CC_ENABLE_GL_STATE_CACHE | |||
#define CC_ENABLE_GL_STATE_CACHE 1 | #define CC_ENABLE_GL_STATE_CACHE 1 | |||
#endif | #endif | |||
/** @def CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL | /** @def CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL | |||
If enabled, the texture coordinates will be calculated by using this formul a: | If enabled, the texture coordinates will be calculated by using this formul a: | |||
skipping to change at line 80 | skipping to change at line 80 | |||
To enabled set it to 1. Disabled by default. | To enabled set it to 1. Disabled by default. | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
#ifndef CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL | #ifndef CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL | |||
#define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 0 | #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 0 | |||
#endif | #endif | |||
/** @def CC_DIRECTOR_FPS_INTERVAL | /** @def CC_DIRECTOR_FPS_INTERVAL | |||
Senconds between FPS updates. | Seconds between FPS updates. | |||
0.5 seconds, means that the FPS number will be updated every 0.5 seconds. | 0.5 seconds, means that the FPS number will be updated every 0.5 seconds. | |||
Having a bigger number means a more reliable FPS | Having a bigger number means a more reliable FPS | |||
Default value: 0.1f | Default value: 0.1f | |||
*/ | */ | |||
#ifndef CC_DIRECTOR_STATS_INTERVAL | #ifndef CC_DIRECTOR_STATS_INTERVAL | |||
#define CC_DIRECTOR_STATS_INTERVAL (0.1f) | #define CC_DIRECTOR_STATS_INTERVAL (0.1f) | |||
#endif | #endif | |||
/** @def CC_DIRECTOR_FPS_POSITION | /** @def CC_DIRECTOR_FPS_POSITION | |||
skipping to change at line 168 | skipping to change at line 168 | |||
/** @def CC_TEXTURE_ATLAS_USE_VAO | /** @def CC_TEXTURE_ATLAS_USE_VAO | |||
By default, CCTextureAtlas (used by many cocos2d classes) will use VAO (Ve rtex Array Objects). | By default, CCTextureAtlas (used by many cocos2d classes) will use VAO (Ve rtex Array Objects). | |||
Apple recommends its usage but they might consume a lot of memory, special ly if you use many of them. | Apple recommends its usage but they might consume a lot of memory, special ly if you use many of them. | |||
So for certain cases, where you might need hundreds of VAO objects, it mig ht be a good idea to disable it. | So for certain cases, where you might need hundreds of VAO objects, it mig ht be a good idea to disable it. | |||
To disable it set it to 0. Enabled by default. | To disable it set it to 0. Enabled by default. | |||
*/ | */ | |||
#ifndef CC_TEXTURE_ATLAS_USE_VAO | #ifndef CC_TEXTURE_ATLAS_USE_VAO | |||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == C C_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) | #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == C C_PLATFORM_MAC) | |||
#define CC_TEXTURE_ATLAS_USE_VAO 1 | #define CC_TEXTURE_ATLAS_USE_VAO 1 | |||
#else | #else | |||
/* Some Windows display adapter driver cannot support VAO. */ | ||||
/* Some android devices cannot support VAO very well, so we disable it by default for android platform. */ | /* Some android devices cannot support VAO very well, so we disable it by default for android platform. */ | |||
/* Blackberry also doesn't support this feature. */ | /* Blackberry also doesn't support this feature. */ | |||
#define CC_TEXTURE_ATLAS_USE_VAO 0 | #define CC_TEXTURE_ATLAS_USE_VAO 0 | |||
#endif | #endif | |||
#endif | #endif | |||
/** @def CC_USE_LA88_LABELS | /** @def CC_USE_LA88_LABELS | |||
If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabel TTF objects. | If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabel TTF objects. | |||
If it is disabled, it will use A8 (Alpha 8-bit textures). | If it is disabled, it will use A8 (Alpha 8-bit textures). | |||
LA88 textures are 6% faster than A8 textures, but they will consume 2x mem ory. | LA88 textures are 6% faster than A8 textures, but they will consume 2x mem ory. | |||
skipping to change at line 192 | skipping to change at line 193 | |||
This feature is enabled by default. | This feature is enabled by default. | |||
@since v0.99.5 | @since v0.99.5 | |||
*/ | */ | |||
#ifndef CC_USE_LA88_LABELS | #ifndef CC_USE_LA88_LABELS | |||
#define CC_USE_LA88_LABELS 1 | #define CC_USE_LA88_LABELS 1 | |||
#endif | #endif | |||
/** @def CC_SPRITE_DEBUG_DRAW | /** @def CC_SPRITE_DEBUG_DRAW | |||
If enabled, all subclasses of CCSprite will draw a bounding box | If enabled, all subclasses of CCSprite will draw a bounding box | |||
Useful for debugging purposes only. It is recommened to leave it disabled. | Useful for debugging purposes only. It is recommended to leave it disabled . | |||
To enable set it to a value different than 0. Disabled by default: | To enable set it to a value different than 0. Disabled by default: | |||
0 -- disabled | 0 -- disabled | |||
1 -- draw bounding box | 1 -- draw bounding box | |||
2 -- draw texture box | 2 -- draw texture box | |||
0 -- disabled | 0 -- disabled | |||
1 -- draw bounding box | 1 -- draw bounding box | |||
2 -- draw texture box | 2 -- draw texture box | |||
*/ | */ | |||
#ifndef CC_SPRITE_DEBUG_DRAW | #ifndef CC_SPRITE_DEBUG_DRAW | |||
#define CC_SPRITE_DEBUG_DRAW 0 | #define CC_SPRITE_DEBUG_DRAW 0 | |||
#endif | #endif | |||
/** @def CC_SPRITEBATCHNODE_DEBUG_DRAW | /** @def CC_SPRITEBATCHNODE_DEBUG_DRAW | |||
If enabled, all subclasses of CCSprite that are rendered using an CCSpriteB atchNode draw a bounding box. | If enabled, all subclasses of CCSprite that are rendered using an CCSpriteB atchNode draw a bounding box. | |||
Useful for debugging purposes only. It is recommened to leave it disabled. | Useful for debugging purposes only. It is recommended to leave it disabled. | |||
To enable set it to a value different than 0. Disabled by default. | To enable set it to a value different than 0. Disabled by default. | |||
*/ | */ | |||
#ifndef CC_SPRITEBATCHNODE_DEBUG_DRAW | #ifndef CC_SPRITEBATCHNODE_DEBUG_DRAW | |||
#define CC_SPRITEBATCHNODE_DEBUG_DRAW 0 | #define CC_SPRITEBATCHNODE_DEBUG_DRAW 0 | |||
#endif | #endif | |||
/** @def CC_LABELBMFONT_DEBUG_DRAW | /** @def CC_LABELBMFONT_DEBUG_DRAW | |||
If enabled, all subclasses of CCLabelBMFont will draw a bounding box | If enabled, all subclasses of CCLabelBMFont will draw a bounding box | |||
Useful for debugging purposes only. It is recommened to leave it disabled. | Useful for debugging purposes only. It is recommended to leave it disabled. | |||
To enable set it to a value different than 0. Disabled by default. | To enable set it to a value different than 0. Disabled by default. | |||
*/ | */ | |||
#ifndef CC_LABELBMFONT_DEBUG_DRAW | #ifndef CC_LABELBMFONT_DEBUG_DRAW | |||
#define CC_LABELBMFONT_DEBUG_DRAW 0 | #define CC_LABELBMFONT_DEBUG_DRAW 0 | |||
#endif | #endif | |||
/** @def CC_LABELATLAS_DEBUG_DRAW | /** @def CC_LABELATLAS_DEBUG_DRAW | |||
If enabled, all subclasses of LabeltAtlas will draw a bounding box | If enabled, all subclasses of LabeltAtlas will draw a bounding box | |||
Useful for debugging purposes only. It is recommened to leave it disabled. | Useful for debugging purposes only. It is recommended to leave it disabled . | |||
To enable set it to a value different than 0. Disabled by default. | To enable set it to a value different than 0. Disabled by default. | |||
*/ | */ | |||
#ifndef CC_LABELATLAS_DEBUG_DRAW | #ifndef CC_LABELATLAS_DEBUG_DRAW | |||
#define CC_LABELATLAS_DEBUG_DRAW 0 | #define CC_LABELATLAS_DEBUG_DRAW 0 | |||
#endif | #endif | |||
/** @def CC_ENABLE_PROFILERS | /** @def CC_ENABLE_PROFILERS | |||
If enabled, will activate various profilers withing cocos2d. This statisti cal data will be output to the console | If enabled, will activate various profilers within cocos2d. This statistic al data will be output to the console | |||
once per second showing average time (in milliseconds) required to execute the specific routine(s). | once per second showing average time (in milliseconds) required to execute the specific routine(s). | |||
Useful for debugging purposes only. It is recommened to leave it disabled. | Useful for debugging purposes only. It is recommended to leave it disabled . | |||
To enable set it to a value different than 0. Disabled by default. | To enable set it to a value different than 0. Disabled by default. | |||
*/ | */ | |||
#ifndef CC_ENABLE_PROFILERS | #ifndef CC_ENABLE_PROFILERS | |||
#define CC_ENABLE_PROFILERS 0 | #define CC_ENABLE_PROFILERS 0 | |||
#endif | #endif | |||
/** Enable Lua engine debug log */ | /** Enable Lua engine debug log */ | |||
#ifndef CC_LUA_ENGINE_DEBUG | #ifndef CC_LUA_ENGINE_DEBUG | |||
#define CC_LUA_ENGINE_DEBUG 0 | #define CC_LUA_ENGINE_DEBUG 0 | |||
End of changes. 12 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added | |||
ccGLStateCache.h | ccGLStateCache.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2011 Ricardo Quesada | Copyright (c) 2011 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ccMacros.h | ccMacros.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 162 | skipping to change at line 162 | |||
#ifndef FLT_EPSILON | #ifndef FLT_EPSILON | |||
#define FLT_EPSILON 1.192092896e-07F | #define FLT_EPSILON 1.192092896e-07F | |||
#endif // FLT_EPSILON | #endif // FLT_EPSILON | |||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | |||
TypeName(const TypeName&);\ | TypeName(const TypeName&);\ | |||
void operator=(const TypeName&) | void operator=(const TypeName&) | |||
/** | /** | |||
Helper marcos which converts 4-byte little/big endian | Helper macros which converts 4-byte little/big endian | |||
integral number to the machine native number representation | integral number to the machine native number representation | |||
It should work same as apples CFSwapInt32LittleToHost(..) | It should work same as apples CFSwapInt32LittleToHost(..) | |||
*/ | */ | |||
/// when define returns true it means that our architecture uses big endian | /// when define returns true it means that our architecture uses big endian | |||
#define CC_HOST_IS_BIG_ENDIAN (bool)(*(unsigned short *)"\0\xff" < 0x100) | #define CC_HOST_IS_BIG_ENDIAN (bool)(*(unsigned short *)"\0\xff" < 0x100) | |||
#define CC_SWAP32(i) ((i & 0x000000ff) << 24 | (i & 0x0000ff00) << 8 | (i & 0x00ff0000) >> 8 | (i & 0xff000000) >> 24) | #define CC_SWAP32(i) ((i & 0x000000ff) << 24 | (i & 0x0000ff00) << 8 | (i & 0x00ff0000) >> 8 | (i & 0xff000000) >> 24) | |||
#define CC_SWAP16(i) ((i & 0x00ff) << 8 | (i &0xff00) >> 8) | #define CC_SWAP16(i) ((i & 0x00ff) << 8 | (i &0xff00) >> 8) | |||
#define CC_SWAP_INT32_LITTLE_TO_HOST(i) ((CC_HOST_IS_BIG_ENDIAN == true)? C C_SWAP32(i) : (i) ) | #define CC_SWAP_INT32_LITTLE_TO_HOST(i) ((CC_HOST_IS_BIG_ENDIAN == true)? C C_SWAP32(i) : (i) ) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
ccShaders.h | ccShaders.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ccTypes.h | ccTypes.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 252 | skipping to change at line 252 | |||
{ | { | |||
//! vertices (3F) | //! vertices (3F) | |||
ccVertex3F vertices; // 12 bytes | ccVertex3F vertices; // 12 bytes | |||
// char __padding__[4]; | // char __padding__[4]; | |||
//! colors (4B) | //! colors (4B) | |||
ccColor4B colors; // 4 bytes | ccColor4B colors; // 4 bytes | |||
// char __padding2__[4]; | // char __padding2__[4]; | |||
// tex coords (2F) | // tex coords (2F) | |||
ccTex2F texCoords; // 8 byts | ccTex2F texCoords; // 8 bytes | |||
} ccV3F_C4B_T2F; | } ccV3F_C4B_T2F; | |||
//! 4 ccVertex2FTex2FColor4B Quad | //! 4 ccVertex2FTex2FColor4B Quad | |||
typedef struct _ccV2F_C4B_T2F_Quad | typedef struct _ccV2F_C4B_T2F_Quad | |||
{ | { | |||
//! bottom left | //! bottom left | |||
ccV2F_C4B_T2F bl; | ccV2F_C4B_T2F bl; | |||
//! bottom right | //! bottom right | |||
ccV2F_C4B_T2F br; | ccV2F_C4B_T2F br; | |||
//! top left | //! top left | |||
skipping to change at line 303 | skipping to change at line 303 | |||
//! Blend Function used for textures | //! Blend Function used for textures | |||
typedef struct _ccBlendFunc | typedef struct _ccBlendFunc | |||
{ | { | |||
//! source blend function | //! source blend function | |||
GLenum src; | GLenum src; | |||
//! destination blend function | //! destination blend function | |||
GLenum dst; | GLenum dst; | |||
} ccBlendFunc; | } ccBlendFunc; | |||
// XXX: If any of these enums are edited and/or reordered, udpate CCTexture 2D.m | // XXX: If any of these enums are edited and/or reordered, update CCTexture 2D.m | |||
//! Vertical text alignment type | //! Vertical text alignment type | |||
typedef enum | typedef enum | |||
{ | { | |||
kCCVerticalTextAlignmentTop, | kCCVerticalTextAlignmentTop, | |||
kCCVerticalTextAlignmentCenter, | kCCVerticalTextAlignmentCenter, | |||
kCCVerticalTextAlignmentBottom, | kCCVerticalTextAlignmentBottom, | |||
} CCVerticalTextAlignment; | } CCVerticalTextAlignment; | |||
// XXX: If any of these enums are edited and/or reordered, udpate CCTexture 2D.m | // XXX: If any of these enums are edited and/or reordered, update CCTexture 2D.m | |||
//! Horizontal text alignment type | //! Horizontal text alignment type | |||
typedef enum | typedef enum | |||
{ | { | |||
kCCTextAlignmentLeft, | kCCTextAlignmentLeft, | |||
kCCTextAlignmentCenter, | kCCTextAlignmentCenter, | |||
kCCTextAlignmentRight, | kCCTextAlignmentRight, | |||
} CCTextAlignment; | } CCTextAlignment; | |||
// types for animation in particle systems | // types for animation in particle systems | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 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 *group); | xmlCharInRange(unsigned int val, const xmlChRangeGroup *grou p); | |||
/** | /** | |||
* 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 | |||
cocos-ext.h | cocos-ext.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#include "CCBReader/CCMenuItemImageLoader.h" | #include "CCBReader/CCMenuItemImageLoader.h" | |||
#include "CCBReader/CCMenuItemLoader.h" | #include "CCBReader/CCMenuItemLoader.h" | |||
#include "CCBReader/CCMenuLoader.h" | #include "CCBReader/CCMenuLoader.h" | |||
#include "CCBReader/CCNodeLoader.h" | #include "CCBReader/CCNodeLoader.h" | |||
#include "CCBReader/CCNodeLoaderLibrary.h" | #include "CCBReader/CCNodeLoaderLibrary.h" | |||
#include "CCBReader/CCNodeLoaderListener.h" | #include "CCBReader/CCNodeLoaderListener.h" | |||
#include "CCBReader/CCParticleSystemQuadLoader.h" | #include "CCBReader/CCParticleSystemQuadLoader.h" | |||
#include "CCBReader/CCScale9SpriteLoader.h" | #include "CCBReader/CCScale9SpriteLoader.h" | |||
#include "CCBReader/CCScrollViewLoader.h" | #include "CCBReader/CCScrollViewLoader.h" | |||
#include "CCBReader/CCSpriteLoader.h" | #include "CCBReader/CCSpriteLoader.h" | |||
#include "CCBReader/CCBAnimationManager.h" | ||||
#include "CCBReader/CCBKeyframe.h" | ||||
#include "CCBReader/CCBSequence.h" | ||||
#include "CCBReader/CCBSequenceProperty.h" | ||||
#include "CCBReader/CCBValue.h" | ||||
#include "CCBReader/CCData.h" | ||||
#include "CCBReader/CCNode+CCBRelativePositioning.h" | ||||
#include "GUI/CCControlExtension/CCControlExtensions.h" | #include "GUI/CCControlExtension/CCControlExtensions.h" | |||
#include "GUI/CCScrollView/CCScrollView.h" | #include "GUI/CCScrollView/CCScrollView.h" | |||
#include "GUI/CCScrollView/CCTableView.h" | ||||
#include "GUI/CCEditBox/CCEditBox.h" | #include "GUI/CCEditBox/CCEditBox.h" | |||
#include "network/HttpRequest.h" | #include "network/HttpRequest.h" | |||
#include "network/HttpResponse.h" | #include "network/HttpResponse.h" | |||
#include "network/HttpClient.h" | #include "network/HttpClient.h" | |||
#endif /* __COCOS2D_EXT_H__ */ | #endif /* __COCOS2D_EXT_H__ */ | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added | |||
cocos2d.h | cocos2d.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
Copyright (c) 2010-2011 cocos2d-x.org | Copyright (c) 2010-2012 cocos2d-x.org | |||
Copyright (c) 2008-2010 Ricardo Quesada | Copyright (c) 2008-2010 Ricardo Quesada | |||
Copyright (c) 2011 Zynga Inc. | Copyright (c) 2011 Zynga Inc. | |||
http://www.cocos2d-x.org | http://www.cocos2d-x.org | |||
Permission is hereby granted, free of charge, to any person obtaining a cop y | Permission is hereby granted, free of charge, to any person obtaining a cop y | |||
of this software and associated documentation files (the "Software"), to de al | of this software and associated documentation files (the "Software"), to de al | |||
in the Software without restriction, including without limitation the right s | in the Software without restriction, including without limitation the right s | |||
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 | |||
skipping to change at line 32 | skipping to change at line 32 | |||
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 __COCOS2D_H__ | #ifndef __COCOS2D_H__ | |||
#define __COCOS2D_H__ | #define __COCOS2D_H__ | |||
// 0x00 HI ME LO | // 0x00 HI ME LO | |||
// 00 02 00 00 | // 00 02 00 00 | |||
#define COCOS2D_VERSION 0x00020000 | #define COCOS2D_VERSION 0x00020003 | |||
// | // | |||
// all cocos2d include files | // all cocos2d include files | |||
// | // | |||
#include "ccConfig.h" | #include "ccConfig.h" | |||
// actions | // actions | |||
#include "actions/CCAction.h" | #include "actions/CCAction.h" | |||
#include "actions/CCActionInterval.h" | #include "actions/CCActionInterval.h" | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
debugXML.h | debugXML.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#include <libxml/xpath.h> | #include <libxml/xpath.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* | /* | |||
* The standard Dump routines. | * The standard Dump routines. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpString (FILE *output, | xmlDebugDumpString (FILE *output, | |||
const xmlChar *str); | const xmlChar *str); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpAttr (FILE *output, | xmlDebugDumpAttr (FILE *output, | |||
xmlAttrPtr attr, | xmlAttrPtr attr, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpAttrList (FILE *output, | xmlDebugDumpAttrList (FILE *output, | |||
xmlAttrPtr attr, | xmlAttrPtr attr, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpOneNode (FILE *output, | xmlDebugDumpOneNode (FILE *output, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpNode (FILE *output, | xmlDebugDumpNode (FILE *output, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpNodeList (FILE *output, | xmlDebugDumpNodeList (FILE *output, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpDocumentHead(FILE *output, | xmlDebugDumpDocumentHead(FILE *output, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpDocument (FILE *output, | xmlDebugDumpDocument (FILE *output, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpDTD (FILE *output, | xmlDebugDumpDTD (FILE *output, | |||
xmlDtdPtr dtd); | xmlDtdPtr dtd); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDebugDumpEntities (FILE *output, | xmlDebugDumpEntities (FILE *output, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
/**************************************************************** | /**************************************************************** | |||
* * | * * | |||
* Checking routines * | * Checking routines * | |||
* * | * * | |||
****************************************************************/ | ****************************************************************/ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDebugCheckDocument (FILE * output, | xmlDebugCheckDocument (FILE * output, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
/**************************************************************** | /**************************************************************** | |||
* * | * * | |||
* XML shell helpers * | * XML shell helpers * | |||
* * | * * | |||
****************************************************************/ | ****************************************************************/ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlLsOneNode (FILE *output, xmlNodePtr node); | xmlLsOneNode (FILE *output, xmlNodePtr node); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlLsCountNode (xmlNodePtr node); | xmlLsCountNode (xmlNodePtr node); | |||
XMLPUBFUN const char * XMLCALL | XMLPUBFUN const char * XMLCALL | |||
xmlBoolToText (int boolval); | xmlBoolToText (int boolval); | |||
/**************************************************************** | /**************************************************************** | |||
* * | * * | |||
* The XML shell related structures and functions * | * The XML shell related structures and functions * | |||
* * | * * | |||
****************************************************************/ | ****************************************************************/ | |||
#ifdef LIBXML_XPATH_ENABLED | #ifdef LIBXML_XPATH_ENABLED | |||
/** | /** | |||
* xmlShellReadlineFunc: | * xmlShellReadlineFunc: | |||
* @prompt: a string prompt | * @prompt: a string prompt | |||
* | * | |||
* This is a generic signature for the XML shell input function. | * This is a generic signature for the XML shell input function. | |||
* | * | |||
* Returns a string which will be freed by the Shell. | * Returns a string which will be freed by the Shell. | |||
skipping to change at line 136 | skipping to change at line 136 | |||
* @arg: a string argument | * @arg: a string argument | |||
* @node: a first node | * @node: a first node | |||
* @node2: a second node | * @node2: a second node | |||
* | * | |||
* This is a generic signature for the XML shell functions. | * This is a generic signature for the XML shell functions. | |||
* | * | |||
* Returns an int, negative returns indicating errors. | * Returns an int, negative returns indicating errors. | |||
*/ | */ | |||
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, | typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlShellPrintXPathError (int errorType, | xmlShellPrintXPathError (int errorType, | |||
const char *arg); | const char *arg); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlShellPrintXPathResult(xmlXPathObjectPtr list); | xmlShellPrintXPathResult(xmlXPathObjectPtr list); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellList (xmlShellCtxtPtr ctxt, | xmlShellList (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellBase (xmlShellCtxtPtr ctxt, | xmlShellBase (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellDir (xmlShellCtxtPtr ctxt, | xmlShellDir (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellLoad (xmlShellCtxtPtr ctxt, | xmlShellLoad (xmlShellCtxtPtr ctxt, | |||
char *filename, | char *filename, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
#ifdef LIBXML_OUTPUT_ENABLED | #ifdef LIBXML_OUTPUT_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlShellPrintNode (xmlNodePtr node); | xmlShellPrintNode (xmlNodePtr node); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellCat (xmlShellCtxtPtr ctxt, | xmlShellCat (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellWrite (xmlShellCtxtPtr ctxt, | xmlShellWrite (xmlShellCtxtPtr ctxt, | |||
char *filename, | char *filename, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellSave (xmlShellCtxtPtr ctxt, | xmlShellSave (xmlShellCtxtPtr ctxt, | |||
char *filename, | char *filename, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
#endif /* LIBXML_OUTPUT_ENABLED */ | #endif /* LIBXML_OUTPUT_ENABLED */ | |||
#ifdef LIBXML_VALID_ENABLED | #ifdef LIBXML_VALID_ENABLED | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellValidate (xmlShellCtxtPtr ctxt, | xmlShellValidate (xmlShellCtxtPtr ctxt, | |||
char *dtd, | char *dtd, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
#endif /* LIBXML_VALID_ENABLED */ | #endif /* LIBXML_VALID_ENABLED */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellDu (xmlShellCtxtPtr ctxt, | xmlShellDu (xmlShellCtxtPtr ctxt, | |||
char *arg, | char *arg, | |||
xmlNodePtr tree, | xmlNodePtr tree, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlShellPwd (xmlShellCtxtPtr ctxt, | xmlShellPwd (xmlShellCtxtPtr ctxt, | |||
char *buffer, | char *buffer, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr node2); | xmlNodePtr node2); | |||
/* | /* | |||
* The Shell interface. | * The Shell interface. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlShell (xmlDocPtr doc, | xmlShell (xmlDocPtr doc, | |||
char *filename, | char *filename, | |||
xmlShellReadlineFunc input, | xmlShellReadlineFunc input, | |||
FILE *output); | FILE *output); | |||
#endif /* LIBXML_XPATH_ENABLED */ | #endif /* LIBXML_XPATH_ENABLED */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* LIBXML_DEBUG_ENABLED */ | #endif /* LIBXML_DEBUG_ENABLED */ | |||
#endif /* __DEBUG_XML__ */ | #endif /* __DEBUG_XML__ */ | |||
End of changes. 26 change blocks. | ||||
95 lines changed or deleted | 95 lines changed or added | |||
encoding.h | encoding.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
*/ | */ | |||
#ifndef __XML_CHAR_ENCODING_H__ | #ifndef __XML_CHAR_ENCODING_H__ | |||
#define __XML_CHAR_ENCODING_H__ | #define __XML_CHAR_ENCODING_H__ | |||
#include <libxml/xmlversion.h> | #include <libxml/xmlversion.h> | |||
#ifdef LIBXML_ICONV_ENABLED | #ifdef LIBXML_ICONV_ENABLED | |||
#include <iconv.h> | #include <iconv.h> | |||
#endif | #endif | |||
#ifdef LIBXML_ICU_ENABLED | ||||
#include <unicode/ucnv.h> | ||||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* | /* | |||
* xmlCharEncoding: | * xmlCharEncoding: | |||
* | * | |||
* Predefined values for some standard encodings. | * Predefined values for some standard encodings. | |||
* Libxml does not do beforehand translation on UTF8 and ISOLatinX. | * Libxml does not do beforehand translation on UTF8 and ISOLatinX. | |||
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. | * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. | |||
skipping to change at line 60 | skipping to change at line 57 | |||
* problem agreed !). If iconv has been found it will be used | * problem agreed !). If iconv has been found it will be used | |||
* automatically and allow stateful transcoding, the simplest is then | * automatically and allow stateful transcoding, the simplest is then | |||
* to be sure to enable iconv and to provide iconv libs for the encoding | * to be sure to enable iconv and to provide iconv libs for the encoding | |||
* support needed. | * support needed. | |||
* | * | |||
* Note that the generic "UTF-16" is not a predefined value. Instead, only | * Note that the generic "UTF-16" is not a predefined value. Instead, only | |||
* the specific UTF-16LE and UTF-16BE are present. | * the specific UTF-16LE and UTF-16BE are present. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ | XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ | |||
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ | XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ | |||
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ | XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ | |||
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ | XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ | |||
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ | XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ | |||
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ | XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ | |||
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ | XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ | |||
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ | XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ | |||
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ | XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ | |||
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ | XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ | |||
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ | XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ | |||
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ | XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ | |||
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ | XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ | |||
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ | XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ | |||
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ | XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ | |||
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ | XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ | |||
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ | XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ | |||
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ | XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ | |||
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ | XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ | |||
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ | XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ | |||
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ | XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ | |||
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ | XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ | |||
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ | XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ | |||
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ | XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ | |||
} xmlCharEncoding; | } xmlCharEncoding; | |||
/** | /** | |||
* xmlCharEncodingInputFunc: | * xmlCharEncodingInputFunc: | |||
* @out: a pointer to an array of bytes to store the UTF-8 result | * @out: a pointer to an array of bytes to store the UTF-8 result | |||
* @outlen: the length of @out | * @outlen: the length of @out | |||
skipping to change at line 129 | skipping to change at line 126 | |||
* if the return value is positive, else unpredictiable. | * if the return value is positive, else unpredictiable. | |||
* The value of @outlen after return is the number of octets produced. | * The value of @outlen after return is the number of octets produced. | |||
*/ | */ | |||
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, | typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, | |||
const unsigned char *in, int *inl en); | const unsigned char *in, int *inl en); | |||
/* | /* | |||
* Block defining the handlers for non UTF-8 encodings. | * Block defining the handlers for non UTF-8 encodings. | |||
* If iconv is supported, there are two extra fields. | * If iconv is supported, there are two extra fields. | |||
*/ | */ | |||
#ifdef LIBXML_ICU_ENABLED | ||||
struct _uconv_t { | ||||
UConverter *uconv; /* for conversion between an encoding and UTF-16 */ | ||||
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ | ||||
}; | ||||
typedef struct _uconv_t uconv_t; | ||||
#endif | ||||
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; | typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; | |||
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; | typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; | |||
struct _xmlCharEncodingHandler { | struct _xmlCharEncodingHandler { | |||
char *name; | char *name; | |||
xmlCharEncodingInputFunc input; | xmlCharEncodingInputFunc input; | |||
xmlCharEncodingOutputFunc output; | xmlCharEncodingOutputFunc output; | |||
#ifdef LIBXML_ICONV_ENABLED | #ifdef LIBXML_ICONV_ENABLED | |||
iconv_t iconv_in; | iconv_t iconv_in; | |||
iconv_t iconv_out; | iconv_t iconv_out; | |||
#endif /* LIBXML_ICONV_ENABLED */ | #endif /* LIBXML_ICONV_ENABLED */ | |||
#ifdef LIBXML_ICU_ENABLED | ||||
uconv_t *uconv_in; | ||||
uconv_t *uconv_out; | ||||
#endif /* LIBXML_ICU_ENABLED */ | ||||
}; | }; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#include <libxml/tree.h> | #include <libxml/tree.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* | /* | |||
* Interfaces for encoding handlers. | * Interfaces for encoding handlers. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlInitCharEncodingHandlers (void); | xmlInitCharEncodingHandlers (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlCleanupCharEncodingHandlers (void); | xmlCleanupCharEncodingHandlers (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); | xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); | |||
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |||
xmlGetCharEncodingHandler (xmlCharEncoding enc); | xmlGetCharEncodingHandler (xmlCharEncoding enc); | |||
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |||
xmlFindCharEncodingHandler (const char *name); | xmlFindCharEncodingHandler (const char *name); | |||
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL | |||
xmlNewCharEncodingHandler (const char *name, | xmlNewCharEncodingHandler (const char *name, | |||
xmlCharEncodingInputFunc input, | xmlCharEncodingInputFunc input, | |||
xmlCharEncodingOutputFunc output); | xmlCharEncodingOutputFunc output); | |||
/* | /* | |||
* Interfaces for encoding names and aliases. | * Interfaces for encoding names and aliases. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlAddEncodingAlias (const char *name, | xmlAddEncodingAlias (const char *name, | |||
const char *alias); | const char *alias); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDelEncodingAlias (const char *alias); | xmlDelEncodingAlias (const char *alias); | |||
XMLPUBFUN const char * XMLCALL | XMLPUBFUN const char * XMLCALL | |||
xmlGetEncodingAlias (const char *alias); | xmlGetEncodingAlias (const char *alias); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlCleanupEncodingAliases (void); | xmlCleanupEncodingAliases (void); | |||
XMLPUBFUN xmlCharEncoding XMLCALL | XMLPUBFUN xmlCharEncoding XMLCALL | |||
xmlParseCharEncoding (const char *name); | xmlParseCharEncoding (const char *name); | |||
XMLPUBFUN const char * XMLCALL | XMLPUBFUN const char * XMLCALL | |||
xmlGetCharEncodingName (xmlCharEncoding enc); | xmlGetCharEncodingName (xmlCharEncoding enc); | |||
/* | /* | |||
* Interfaces directly used by the parsers. | * Interfaces directly used by the parsers. | |||
*/ | */ | |||
XMLPUBFUN xmlCharEncoding XMLCALL | XMLPUBFUN xmlCharEncoding XMLCALL | |||
xmlDetectCharEncoding (const unsigned char *in, | xmlDetectCharEncoding (const unsigned char *in, | |||
int len); | int len); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlCharEncOutFunc (xmlCharEncodingHandler *handler, | xmlCharEncOutFunc (xmlCharEncodingHandler *handler, | |||
xmlBufferPtr out, | xmlBufferPtr out, | |||
xmlBufferPtr in); | xmlBufferPtr in); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlCharEncInFunc (xmlCharEncodingHandler *handler, | xmlCharEncInFunc (xmlCharEncodingHandler *handler, | |||
xmlBufferPtr out, | xmlBufferPtr out, | |||
xmlBufferPtr in); | xmlBufferPtr in); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlCharEncFirstLine (xmlCharEncodingHandler *handler, | xmlCharEncFirstLine (xmlCharEncodingHandler *handler, | |||
xmlBufferPtr out, | xmlBufferPtr out, | |||
xmlBufferPtr in); | xmlBufferPtr in); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); | xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); | |||
/* | /* | |||
* Export a few useful functions | * Export a few useful functions | |||
*/ | */ | |||
#ifdef LIBXML_OUTPUT_ENABLED | #ifdef LIBXML_OUTPUT_ENABLED | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
UTF8Toisolat1 (unsigned char *out, | UTF8Toisolat1 (unsigned char *out, | |||
int *outlen, | int *outlen, | |||
const unsigned char *in, | const unsigned char *in, | |||
int *inlen); | int *inlen); | |||
#endif /* LIBXML_OUTPUT_ENABLED */ | #endif /* LIBXML_OUTPUT_ENABLED */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
isolat1ToUTF8 (unsigned char *out, | isolat1ToUTF8 (unsigned char *out, | |||
int *outlen, | int *outlen, | |||
const unsigned char *in, | const unsigned char *in, | |||
int *inlen); | int *inlen); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __XML_CHAR_ENCODING_H__ */ | #endif /* __XML_CHAR_ENCODING_H__ */ | |||
End of changes. 24 change blocks. | ||||
66 lines changed or deleted | 52 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 xmlC har *name, | xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, | |||
xmlHashDeallocator f); | xmlHashDeallocator f); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlHashRemoveEntry2(xmlHashTablePtr table, const xml Char *name, | xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, | |||
const xmlChar *name2, xmlHashDeallocator f); | const xmlChar *name2, xmlHashDeallocator f); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlHashRemoveEntry3(xmlHashTablePtr table, const xml Char *name, | xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *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. | ||||
93 lines changed or deleted | 92 lines changed or added | |||
ioapi.h | ioapi.h | |||
---|---|---|---|---|
skipping to change at line 83 | skipping to change at line 83 | |||
#include <stdint.h> | #include <stdint.h> | |||
#define ZPOS64_T uint64_t | #define ZPOS64_T uint64_t | |||
#endif | #endif | |||
#endif | #endif | |||
*/ | */ | |||
#ifdef HAVE_MINIZIP64_CONF_H | #ifdef HAVE_MINIZIP64_CONF_H | |||
#include "mz64conf.h" | #include "mz64conf.h" | |||
#endif | #endif | |||
/* a type choosen by DEFINE */ | /* a type chosen by DEFINE */ | |||
#ifdef HAVE_64BIT_INT_CUSTOM | #ifdef HAVE_64BIT_INT_CUSTOM | |||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; | typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; | |||
#else | #else | |||
#ifdef HAS_STDINT_H | #ifdef HAS_STDINT_H | |||
#include "stdint.h" | #include "stdint.h" | |||
typedef uint64_t ZPOS64_T; | typedef uint64_t ZPOS64_T; | |||
#else | #else | |||
#if defined(_MSC_VER) || defined(__BORLANDC__) | #if defined(_MSC_VER) || defined(__BORLANDC__) | |||
typedef unsigned __int64 ZPOS64_T; | typedef unsigned __int64 ZPOS64_T; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 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 exp ects %u") | "JPEG parameter struct mismatch: library thinks size is %u, caller expects %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 MULTI | #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires M | |||
SCAN)*/ | ULTISCAN)*/ | |||
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires | #define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DC | |||
DCT_ISLOW)*/ | T_ISLOW)*/ | |||
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parm | #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? | |||
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 MULTI | #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires M | |||
SCAN)*/ | ULTISCAN)*/ | |||
#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 element */ | #define RGB_RED 0 /* Offset of Red in an RGB scanline | |||
#define RGB_GREEN 1 /* Offset of Green */ | element */ | |||
#define RGB_BLUE 2 /* Offset of Blue */ | #define RGB_GREEN 1 /* Offset of Green */ | |||
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ | #define RGB_BLUE 2 /* Offset of Blue */ | |||
#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 inline */ | #ifdef __GNUC__ /* for instance, GNU C knows about i nline */ | |||
#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. | ||||
41 lines changed or deleted | 42 lines changed or added | |||
jsapi.h | jsapi.h | |||
---|---|---|---|---|
skipping to change at line 47 | skipping to change at line 47 | |||
* the terms of any one of the MPL, the GPL or the LGPL. | * the terms of any one of the MPL, the GPL or the LGPL. | |||
* | * | |||
* ***** END LICENSE BLOCK ***** */ | * ***** 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/FloatingPoint.h" | ||||
#include "mozilla/StandardInteger.h" | #include "mozilla/StandardInteger.h" | |||
#include <stddef.h> | #include <stddef.h> | |||
#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" | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
#include "jsalloc.h" | #include "jsalloc.h" | |||
#include "js/Vector.h" | #include "js/Vector.h" | |||
#include "mozilla/Attributes.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) | |||
/************************************************************************/ | /************************************************************************/ | |||
skipping to change at line 146 | skipping to change at line 148 | |||
* than that, we have avoided all garbage collection hazards. | * than that, we have avoided all garbage collection hazards. | |||
*/ | */ | |||
template<typename T> class AnchorPermitted; | template<typename T> class AnchorPermitted; | |||
template<> class AnchorPermitted<JSObject *> { }; | template<> class AnchorPermitted<JSObject *> { }; | |||
template<> class AnchorPermitted<const JSObject *> { }; | template<> class AnchorPermitted<const JSObject *> { }; | |||
template<> class AnchorPermitted<JSFunction *> { }; | template<> class AnchorPermitted<JSFunction *> { }; | |||
template<> class AnchorPermitted<const JSFunction *> { }; | template<> class AnchorPermitted<const JSFunction *> { }; | |||
template<> class AnchorPermitted<JSString *> { }; | template<> class AnchorPermitted<JSString *> { }; | |||
template<> class AnchorPermitted<const JSString *> { }; | template<> class AnchorPermitted<const JSString *> { }; | |||
template<> class AnchorPermitted<Value> { }; | template<> class AnchorPermitted<Value> { }; | |||
template<> class AnchorPermitted<const JSScript *> { }; | ||||
template<> class AnchorPermitted<JSScript *> { }; | ||||
template<typename T> | template<typename T> | |||
class Anchor: AnchorPermitted<T> | class Anchor: AnchorPermitted<T> | |||
{ | { | |||
public: | public: | |||
Anchor() { } | Anchor() { } | |||
explicit Anchor(T t) { hold = t; } | explicit Anchor(T t) { hold = t; } | |||
inline ~Anchor(); | inline ~Anchor(); | |||
T &get() { return hold; } | T &get() { return hold; } | |||
const T &get() const { return hold; } | const T &get() const { return hold; } | |||
void set(const T &t) { hold = t; } | void set(const T &t) { hold = t; } | |||
void operator=(const T &t) { hold = t; } | ||||
void clear() { hold = 0; } | void clear() { hold = 0; } | |||
private: | private: | |||
T hold; | T hold; | |||
/* Anchors should not be assigned or passed to functions. */ | Anchor(const Anchor &) MOZ_DELETE; | |||
Anchor(const Anchor &); | const Anchor &operator=(const Anchor &) MOZ_DELETE; | |||
const Anchor &operator=(const Anchor &); | ||||
}; | }; | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
template<typename T> | template<typename T> | |||
inline Anchor<T>::~Anchor() | inline Anchor<T>::~Anchor() | |||
{ | { | |||
/* | /* | |||
* No code is generated for this. But because this is marked 'volatile' , G++ will | * No code is generated for this. But because this is marked 'volatile' , G++ will | |||
* assume it has important side-effects, and won't delete it. (G++ neve r looks at | * assume it has important side-effects, and won't delete it. (G++ neve r looks at | |||
* the actual text and notices it's empty.) And because we have passed |hold| to | * the actual text and notices it's empty.) And because we have passed |hold| to | |||
skipping to change at line 217 | skipping to change at line 221 | |||
* We do need to use Anchors in some cases where cycles are tight. | * We do need to use Anchors in some cases where cycles are tight. | |||
* | * | |||
* NB: there is a Anchor<Value>::~Anchor() specialization below. | * NB: there is a Anchor<Value>::~Anchor() specialization below. | |||
*/ | */ | |||
volatile T sink; | volatile T sink; | |||
sink = hold; | sink = hold; | |||
} | } | |||
#endif /* defined(__GNUC__) */ | #endif /* defined(__GNUC__) */ | |||
/* | /* | |||
* 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. | ||||
* | ||||
* 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 | ||||
* 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 | ||||
* a live integer value. | ||||
*/ | ||||
inline void PoisonPtr(uintptr_t *v) | ||||
{ | ||||
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) | ||||
uint8_t *ptr = (uint8_t *) v + 3; | ||||
*ptr = JS_FREE_PATTERN; | ||||
#endif | ||||
} | ||||
template <typename T> | ||||
inline bool IsPoisonedPtr(T *v) | ||||
{ | ||||
#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) | ||||
uint32_t mask = uintptr_t(v) & 0xff000000; | ||||
return mask == uint32_t(JS_FREE_PATTERN << 24); | ||||
#else | ||||
return false; | ||||
#endif | ||||
} | ||||
/* | ||||
* JS::Value is the C++ interface for a single JavaScript Engine value. | * JS::Value is the C++ interface for a single JavaScript Engine value. | |||
* A few general notes on JS::Value: | * A few general notes on JS::Value: | |||
* | * | |||
* - JS::Value has setX() and isX() members for X in | * - JS::Value has setX() and isX() members for X in | |||
* | * | |||
* { Int32, Double, String, Boolean, Undefined, Null, Object, Magic } | * { Int32, Double, String, Boolean, Undefined, Null, Object, Magic } | |||
* | * | |||
* JS::Value also contains toX() for each of the non-singleton types. | * JS::Value also contains toX() for each of the non-singleton types. | |||
* | * | |||
* - Magic is a singleton type whose payload contains a JSWhyMagic "reason" for | * - Magic is a singleton type whose payload contains a JSWhyMagic "reason" for | |||
skipping to change at line 362 | skipping to change at line 336 | |||
return false; | return false; | |||
} else { | } else { | |||
setInt32((int32_t)ui); | setInt32((int32_t)ui); | |||
return true; | return true; | |||
} | } | |||
} | } | |||
JS_ALWAYS_INLINE | JS_ALWAYS_INLINE | |||
bool setNumber(double d) { | bool setNumber(double d) { | |||
int32_t i; | int32_t i; | |||
if (JSDOUBLE_IS_INT32(d, &i)) { | if (MOZ_DOUBLE_IS_INT32(d, &i)) { | |||
setInt32(i); | setInt32(i); | |||
return true; | return true; | |||
} else { | } else { | |||
setDouble(d); | setDouble(d); | |||
return false; | return false; | |||
} | } | |||
} | } | |||
JS_ALWAYS_INLINE | JS_ALWAYS_INLINE | |||
void setObjectOrNull(JSObject *arg) { | void setObjectOrNull(JSObject *arg) { | |||
skipping to change at line 474 | skipping to change at line 448 | |||
bool isMagic() const { | bool isMagic() const { | |||
return JSVAL_IS_MAGIC_IMPL(data); | return JSVAL_IS_MAGIC_IMPL(data); | |||
} | } | |||
JS_ALWAYS_INLINE | JS_ALWAYS_INLINE | |||
bool isMagic(JSWhyMagic why) const { | bool isMagic(JSWhyMagic why) const { | |||
JS_ASSERT_IF(isMagic(), data.s.payload.why == why); | JS_ASSERT_IF(isMagic(), data.s.payload.why == why); | |||
return JSVAL_IS_MAGIC_IMPL(data); | return JSVAL_IS_MAGIC_IMPL(data); | |||
} | } | |||
/* | ||||
* Although the Value class comment says 'magic' is a singleton type, i | ||||
t is | ||||
* technically possible to use the payload. This should be avoided to | ||||
* preserve the ability for the strong assertions in isMagic(). | ||||
*/ | ||||
JS_ALWAYS_INLINE | ||||
bool isParticularMagic(JSWhyMagic why) const { | ||||
return isMagic() && data.s.payload.why == why; | ||||
} | ||||
JS_ALWAYS_INLINE | JS_ALWAYS_INLINE | |||
bool isMarkable() const { | bool isMarkable() const { | |||
return JSVAL_IS_TRACEABLE_IMPL(data); | return JSVAL_IS_TRACEABLE_IMPL(data); | |||
} | } | |||
JS_ALWAYS_INLINE | JS_ALWAYS_INLINE | |||
JSGCTraceKind gcKind() const { | JSGCTraceKind gcKind() const { | |||
JS_ASSERT(isMarkable()); | JS_ASSERT(isMarkable()); | |||
return JSGCTraceKind(JSVAL_TRACE_KIND_IMPL(data)); | return JSGCTraceKind(JSVAL_TRACE_KIND_IMPL(data)); | |||
} | } | |||
skipping to change at line 642 | skipping to change at line 606 | |||
} | } | |||
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 | |||
} | } | |||
#ifndef _MSC_VER | #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). | ||||
*/ | */ | |||
private: | private: | |||
#endif | #endif | |||
jsval_layout data; | jsval_layout data; | |||
private: | private: | |||
void staticAssertions() { | void staticAssertions() { | |||
JS_STATIC_ASSERT(sizeof(JSValueType) == 1); | JS_STATIC_ASSERT(sizeof(JSValueType) == 1); | |||
JS_STATIC_ASSERT(sizeof(JSValueTag) == 4); | JS_STATIC_ASSERT(sizeof(JSValueTag) == 4); | |||
skipping to change at line 779 | skipping to change at line 744 | |||
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> | ||||
{ | ||||
static Value initial() { return UndefinedValue(); } | ||||
static ThingRootKind kind() { return THING_ROOT_VALUE; } | ||||
static bool poisoned(const Value &v) { return IsPoisonedValue(v); } | ||||
}; | ||||
template <> struct RootMethods<Value> | ||||
{ | ||||
static Value initial() { return UndefinedValue(); } | ||||
static ThingRootKind kind() { return THING_ROOT_VALUE; } | ||||
static bool poisoned(const Value &v) { return IsPoisonedValue(v); } | ||||
}; | ||||
/************************************************************************/ | /************************************************************************/ | |||
#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 821 | skipping to change at line 800 | |||
}; | }; | |||
# define CHECK_REQUEST(cx) \ | # define CHECK_REQUEST(cx) \ | |||
JS::AutoCheckRequestDepth _autoCheckRequestDepth(cx) | JS::AutoCheckRequestDepth _autoCheckRequestDepth(cx) | |||
#else | #else | |||
# define CHECK_REQUEST(cx) \ | # define CHECK_REQUEST(cx) \ | |||
((void) 0) | ((void) 0) | |||
#endif | #endif /* JS_THREADSAFE && 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. */ | ||||
JS_PUBLIC_API(void) | ||||
AssertArgumentsAreSane(JSContext *cx, const Value &v); | ||||
#else | ||||
inline void AssertArgumentsAreSane(JSContext *cx, const Value &v) { | ||||
/* Do nothing */ | ||||
} | ||||
#endif /* DEBUG */ | ||||
class JS_PUBLIC_API(AutoGCRooter) { | class JS_PUBLIC_API(AutoGCRooter) { | |||
public: | public: | |||
AutoGCRooter(JSContext *cx, ptrdiff_t tag); | AutoGCRooter(JSContext *cx, ptrdiff_t tag); | |||
~AutoGCRooter() { | ~AutoGCRooter() { | |||
JS_ASSERT(this == *stackTop); | JS_ASSERT(this == *stackTop); | |||
*stackTop = down; | *stackTop = down; | |||
} | } | |||
skipping to change at line 1051 | skipping to change at line 1041 | |||
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) | : AutoGCRooter(cx, tag), vector(cx), vectorRoot(cx, &vector) | |||
{ | { | |||
JS_GUARD_OBJECT_NOTIFIER_INIT; | JS_GUARD_OBJECT_NOTIFIER_INIT; | |||
} | } | |||
size_t length() const { return vector.length(); } | size_t length() const { return vector.length(); } | |||
bool append(const T &v) { return vector.append(v); } | bool append(const T &v) { return vector.append(v); } | |||
/* 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); } | |||
skipping to change at line 1114 | skipping to change at line 1104 | |||
private: | private: | |||
void makeRangeGCSafe(size_t oldLength) { | void makeRangeGCSafe(size_t oldLength) { | |||
T *t = vector.begin() + oldLength; | T *t = vector.begin() + oldLength; | |||
for (size_t i = oldLength; i < vector.length(); ++i, ++t) | for (size_t i = oldLength; i < vector.length(); ++i, ++t) | |||
memset(t, 0, sizeof(T)); | memset(t, 0, sizeof(T)); | |||
} | } | |||
typedef js::Vector<T, 8> VectorImpl; | typedef js::Vector<T, 8> VectorImpl; | |||
VectorImpl vector; | VectorImpl vector; | |||
/* Prevent overwriting of inline elements in vector. */ | ||||
SkipRoot vectorRoot; | ||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER | JS_DECL_USE_GUARD_OBJECT_NOTIFIER | |||
}; | }; | |||
class AutoValueVector : public AutoVectorRooter<Value> | class AutoValueVector : public AutoVectorRooter<Value> | |||
{ | { | |||
public: | public: | |||
explicit AutoValueVector(JSContext *cx | explicit AutoValueVector(JSContext *cx | |||
JS_GUARD_OBJECT_NOTIFIER_PARAM) | JS_GUARD_OBJECT_NOTIFIER_PARAM) | |||
: AutoVectorRooter<Value>(cx, VALVECTOR) | : AutoVectorRooter<Value>(cx, VALVECTOR) | |||
{ | { | |||
skipping to change at line 1345 | skipping to change at line 1339 | |||
*/ | */ | |||
typedef JSBool | typedef JSBool | |||
(* JSConvertOp)(JSContext *cx, JSObject *obj, JSType type, jsval *vp); | (* JSConvertOp)(JSContext *cx, JSObject *obj, JSType type, jsval *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, JSObject *obj); | |||
typedef struct JSFreeOp JSFreeOp; | ||||
struct JSFreeOp { | ||||
#ifndef __cplusplus | ||||
JSRuntime *runtime; | ||||
#else | ||||
private: | ||||
JSRuntime *runtime_; | ||||
protected: | ||||
JSFreeOp(JSRuntime *rt) | ||||
: runtime_(rt) { } | ||||
public: | ||||
JSRuntime *runtime() const { | ||||
return runtime_; | ||||
} | ||||
#endif | ||||
}; | ||||
/* | /* | |||
* Finalize obj, which the garbage collector has determined to be unreachab le | * Finalize obj, which the garbage collector has determined to be unreachab le | |||
* from other live objects or from GC roots. Obviously, finalizers must ne ver | * from other live objects or from GC roots. Obviously, finalizers must ne ver | |||
* store a reference to obj. | * store a reference to obj. | |||
*/ | */ | |||
typedef void | typedef void | |||
(* JSFinalizeOp)(JSContext *cx, JSObject *obj); | (* JSFinalizeOp)(JSFreeOp *fop, JSObject *obj); | |||
/* | /* | |||
* Finalizes external strings created by JS_NewExternalString. | * Finalizes external strings created by JS_NewExternalString. | |||
*/ | */ | |||
typedef struct JSStringFinalizer JSStringFinalizer; | typedef struct JSStringFinalizer JSStringFinalizer; | |||
struct JSStringFinalizer { | struct JSStringFinalizer { | |||
void (*finalize)(const JSStringFinalizer *fin, jschar *chars); | void (*finalize)(const JSStringFinalizer *fin, jschar *chars); | |||
}; | }; | |||
skipping to change at line 1456 | skipping to change at line 1470 | |||
typedef void | typedef void | |||
(* JSGCCallback)(JSRuntime *rt, JSGCStatus status); | (* JSGCCallback)(JSRuntime *rt, JSGCStatus status); | |||
typedef enum JSFinalizeStatus { | typedef enum JSFinalizeStatus { | |||
JSFINALIZE_START, | JSFINALIZE_START, | |||
JSFINALIZE_END | JSFINALIZE_END | |||
} JSFinalizeStatus; | } JSFinalizeStatus; | |||
typedef void | typedef void | |||
(* JSFinalizeCallback)(JSContext *cx, JSFinalizeStatus status); | (* JSFinalizeCallback)(JSFreeOp *fop, JSFinalizeStatus status, JSBool isCom partment); | |||
/* | /* | |||
* Generic trace operation that calls JS_CallTracer on each traceable thing | * Generic trace operation that calls JS_CallTracer on each traceable thing | |||
* stored in data. | * stored in data. | |||
*/ | */ | |||
typedef void | typedef void | |||
(* JSTraceDataOp)(JSTracer *trc, void *data); | (* JSTraceDataOp)(JSTracer *trc, void *data); | |||
typedef JSBool | typedef JSBool | |||
(* JSOperationCallback)(JSContext *cx); | (* JSOperationCallback)(JSContext *cx); | |||
skipping to change at line 1544 | skipping to change at line 1558 | |||
* Security protocol types. | * Security protocol types. | |||
*/ | */ | |||
typedef void | typedef void | |||
(* JSDestroyPrincipalsOp)(JSPrincipals *principals); | (* JSDestroyPrincipalsOp)(JSPrincipals *principals); | |||
typedef JSBool | typedef JSBool | |||
(* JSSubsumePrincipalsOp)(JSPrincipals *principals1, JSPrincipals *principa ls2); | (* JSSubsumePrincipalsOp)(JSPrincipals *principals1, JSPrincipals *principa ls2); | |||
/* | /* | |||
* XDR-encode or -decode a principals instance, based on whether xdr->mode | ||||
is | ||||
* JSXDR_ENCODE, in which case *principalsp should be encoded; or JSXDR_DEC | ||||
ODE, | ||||
* in which case implementations must return a held (via JSPRINCIPALS_HOLD) | ||||
, | ||||
* non-null *principalsp out parameter. Return true on success, false on a | ||||
ny | ||||
* error, which the implementation must have reported. | ||||
*/ | ||||
typedef JSBool | ||||
(* JSPrincipalsTranscoder)(JSXDRState *xdr, JSPrincipals **principalsp); | ||||
/* | ||||
* Return a weak reference to the principals associated with obj, possibly via | * 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., | * 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 | * 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; | * 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 | * in no event should an error be reported or an exception be thrown by thi s | |||
* callback's implementation. | * callback's implementation. | |||
*/ | */ | |||
typedef JSPrincipals * | typedef JSPrincipals * | |||
(* JSObjectPrincipalsFinder)(JSObject *obj); | (* 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 | |||
* for wrapping in a context. This might include unwrapping other wrappers | * for wrapping in a context. This might include unwrapping other wrappers | |||
* or even finding a more suitable object for the new compartment. | * or even finding a more suitable object for the new compartment. | |||
*/ | */ | |||
typedef JSObject * | typedef JSObject * | |||
(* JSPreWrapCallback)(JSContext *cx, JSObject *scope, JSObject *obj, unsign ed flags); | (* JSPreWrapCallback)(JSContext *cx, JSObject *scope, JSObject *obj, unsign ed flags); | |||
typedef enum { | /* | |||
JSCOMPARTMENT_DESTROY | * Callback used when wrapping determines that the underlying object is alr | |||
} JSCompartmentOp; | eady | |||
* in the compartment for which it is being wrapped. This allows consumers | ||||
to | ||||
* maintain same-compartment wrapping invariants. | ||||
* | ||||
* |obj| is guaranteed to be same-compartment as |cx|, but it may (or may n | ||||
ot) | ||||
* be a security or cross-compartment wrapper. This is an unfortunate contr | ||||
act, | ||||
* but is important for to avoid unnecessarily recomputing every cross- | ||||
* compartment wrapper that gets passed to wrap. | ||||
*/ | ||||
typedef JSObject * | ||||
(* JSSameCompartmentWrapObjectCallback)(JSContext *cx, JSObject *obj); | ||||
typedef JSBool | typedef void | |||
(* JSCompartmentCallback)(JSContext *cx, JSCompartment *compartment, unsign | (* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment) | |||
ed compartmentOp); | ; | |||
/* | /* | |||
* 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. | |||
*/ | */ | |||
skipping to change at line 2266 | skipping to change at line 2289 | |||
extern JS_PUBLIC_API(JSString *) | extern JS_PUBLIC_API(JSString *) | |||
JS_ValueToString(JSContext *cx, jsval v); | JS_ValueToString(JSContext *cx, jsval v); | |||
extern JS_PUBLIC_API(JSString *) | extern JS_PUBLIC_API(JSString *) | |||
JS_ValueToSource(JSContext *cx, jsval v); | JS_ValueToSource(JSContext *cx, jsval v); | |||
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 | ||||
namespace js { | ||||
/* | ||||
* DO NOT CALL THIS. Use JS::ToNumber | ||||
*/ | ||||
extern JS_PUBLIC_API(bool) | ||||
ToNumberSlow(JSContext *cx, JS::Value v, double *dp); | ||||
} /* namespace js */ | ||||
namespace JS { | ||||
/* ES5 9.3 ToNumber. */ | ||||
JS_ALWAYS_INLINE bool | ||||
ToNumber(JSContext *cx, const Value &v, double *out) | ||||
{ | ||||
AssertArgumentsAreSane(cx, v); | ||||
if (v.isNumber()) { | ||||
*out = v.toNumber(); | ||||
return true; | ||||
} | ||||
return js::ToNumberSlow(cx, v, out); | ||||
} | ||||
} /* namespace JS */ | ||||
#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 | ||||
*/ | ||||
extern JS_PUBLIC_API(bool) | ||||
ToInt32Slow(JSContext *cx, const JS::Value &v, int32_t *out); | ||||
} /* namespace js */ | ||||
namespace JS { | ||||
JS_ALWAYS_INLINE bool | ||||
ToInt32(JSContext *cx, const js::Value &v, int32_t *out) | ||||
{ | ||||
AssertArgumentsAreSane(cx, v); | ||||
if (v.isInt32()) { | ||||
*out = v.toInt32(); | ||||
return true; | ||||
} | ||||
return js::ToInt32Slow(cx, v, out); | ||||
} | ||||
} /* namespace JS */ | ||||
#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); | |||
/* | /* | |||
* Convert a value to a number, then to an int32_t if it fits by rounding t o | * Convert a value to a number, then to an int32_t if it fits by rounding t o | |||
* nearest; but failing with an error report if the double is out of range | * nearest; but failing with an error report if the double is out of range | |||
skipping to change at line 2389 | skipping to change at line 2463 | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_IsInRequest(JSRuntime *rt); | JS_IsInRequest(JSRuntime *rt); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_IsInSuspendedRequest(JSRuntime *rt); | JS_IsInSuspendedRequest(JSRuntime *rt); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
JS_END_EXTERN_C | JS_END_EXTERN_C | |||
namespace JS { | ||||
inline bool | inline bool | |||
IsPoisonedId(jsid iden) | IsPoisonedId(jsid iden) | |||
{ | { | |||
if (JSID_IS_STRING(iden)) | if (JSID_IS_STRING(iden)) | |||
return JS::IsPoisonedPtr(JSID_TO_STRING(iden)); | return JS::IsPoisonedPtr(JSID_TO_STRING(iden)); | |||
if (JSID_IS_OBJECT(iden)) | if (JSID_IS_OBJECT(iden)) | |||
return JS::IsPoisonedPtr(JSID_TO_OBJECT(iden)); | return JS::IsPoisonedPtr(JSID_TO_OBJECT(iden)); | |||
return false; | return false; | |||
} | } | |||
template <> struct RootMethods<const jsid> | ||||
{ | ||||
static jsid initial() { return JSID_VOID; } | ||||
static ThingRootKind kind() { return THING_ROOT_ID; } | ||||
static bool poisoned(jsid id) { return IsPoisonedId(id); } | ||||
}; | ||||
template <> struct RootMethods<jsid> | ||||
{ | ||||
static jsid initial() { return JSID_VOID; } | ||||
static ThingRootKind kind() { return THING_ROOT_ID; } | ||||
static bool poisoned(jsid id) { return IsPoisonedId(id); } | ||||
}; | ||||
} /* namespace JS */ | ||||
class JSAutoRequest { | class JSAutoRequest { | |||
public: | public: | |||
JSAutoRequest(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) | JSAutoRequest(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) | |||
: mContext(cx), mSaveDepth(0) { | : mContext(cx), mSaveDepth(0) { | |||
JS_GUARD_OBJECT_NOTIFIER_INIT; | JS_GUARD_OBJECT_NOTIFIER_INIT; | |||
JS_BeginRequest(mContext); | JS_BeginRequest(mContext); | |||
} | } | |||
~JSAutoRequest() { | ~JSAutoRequest() { | |||
JS_EndRequest(mContext); | JS_EndRequest(mContext); | |||
} | } | |||
skipping to change at line 2499 | skipping to change at line 2591 | |||
extern JS_PUBLIC_API(JSContext *) | extern JS_PUBLIC_API(JSContext *) | |||
JS_NewContext(JSRuntime *rt, size_t stackChunkSize); | JS_NewContext(JSRuntime *rt, size_t stackChunkSize); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_DestroyContext(JSContext *cx); | JS_DestroyContext(JSContext *cx); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_DestroyContextNoGC(JSContext *cx); | JS_DestroyContextNoGC(JSContext *cx); | |||
extern JS_PUBLIC_API(void) | ||||
JS_DestroyContextMaybeGC(JSContext *cx); | ||||
extern JS_PUBLIC_API(void *) | extern JS_PUBLIC_API(void *) | |||
JS_GetContextPrivate(JSContext *cx); | JS_GetContextPrivate(JSContext *cx); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_SetContextPrivate(JSContext *cx, void *data); | JS_SetContextPrivate(JSContext *cx, void *data); | |||
extern JS_PUBLIC_API(void *) | extern JS_PUBLIC_API(void *) | |||
JS_GetSecondContextPrivate(JSContext *cx); | JS_GetSecondContextPrivate(JSContext *cx); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
skipping to change at line 2620 | skipping to change at line 2709 | |||
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(JSCompartmentCallback) | extern JS_PUBLIC_API(void) | |||
JS_SetCompartmentCallback(JSRuntime *rt, JSCompartmentCallback callback); | JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallbac | |||
k callback); | ||||
extern JS_PUBLIC_API(JSWrapObjectCallback) | extern JS_PUBLIC_API(JSWrapObjectCallback) | |||
JS_SetWrapObjectCallbacks(JSRuntime *rt, | JS_SetWrapObjectCallbacks(JSRuntime *rt, | |||
JSWrapObjectCallback callback, | JSWrapObjectCallback callback, | |||
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, JSObject *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); | |||
skipping to change at line 2666 | skipping to change at line 2756 | |||
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); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
JS_END_EXTERN_C | JS_END_EXTERN_C | |||
namespace js { | ||||
class AutoCompartment; | ||||
} | ||||
class JS_PUBLIC_API(JSAutoEnterCompartment) | class JS_PUBLIC_API(JSAutoEnterCompartment) | |||
{ | { | |||
/* | /* | |||
* This is a poor man's Maybe<AutoCompartment>, because we don't have | * This is a poor man's Maybe<AutoCompartment>, because we don't have | |||
* access to the AutoCompartment definition here. We statically assert in | * access to the AutoCompartment definition here. We statically assert in | |||
* jsapi.cpp that we have the right size here. | * jsapi.cpp that we have the right size here. | |||
* | * | |||
* In practice, 32-bit Windows and Android get 16-word |bytes|, while | * In practice, 32-bit Windows and Android get 16-word |bytes|, while | |||
* other platforms get 13-word |bytes|. | * other platforms get 13-word |bytes|. | |||
*/ | */ | |||
void* bytes[sizeof(void*) == 4 && MOZ_ALIGNOF(uint64_t) == 8 ? 16 : 13] ; | 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 | * This object may be in one of three states. If enter() or | |||
* enterAndIgnoreErrors() hasn't been called, it's in STATE_UNENTERED. | * enterAndIgnoreErrors() hasn't been called, it's in STATE_UNENTERED. | |||
* Otherwise, if we were asked to enter into the current compartment, o ur | * Otherwise, if we were asked to enter into the current compartment, o ur | |||
* state is STATE_SAME_COMPARTMENT. If we actually created an | * state is STATE_SAME_COMPARTMENT. If we actually created an | |||
* AutoCompartment and entered another compartment, our state is | * AutoCompartment and entered another compartment, our state is | |||
* STATE_OTHER_COMPARTMENT. | * STATE_OTHER_COMPARTMENT. | |||
*/ | */ | |||
enum State { | enum State { | |||
STATE_UNENTERED, | STATE_UNENTERED, | |||
skipping to change at line 2787 | skipping to change at line 2887 | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_GetObjectPrototype(JSContext *cx, JSObject *forObj); | JS_GetObjectPrototype(JSContext *cx, JSObject *forObj); | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_GetGlobalForObject(JSContext *cx, JSObject *obj); | JS_GetGlobalForObject(JSContext *cx, JSObject *obj); | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_GetGlobalForScopeChain(JSContext *cx); | JS_GetGlobalForScopeChain(JSContext *cx); | |||
extern JS_PUBLIC_API(JSObject *) | ||||
JS_GetScriptedGlobal(JSContext *cx); | ||||
/* | /* | |||
* Initialize the 'Reflect' object on a global object. | * Initialize the 'Reflect' object on a global object. | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_InitReflect(JSContext *cx, JSObject *global); | JS_InitReflect(JSContext *cx, JSObject *global); | |||
#ifdef JS_HAS_CTYPES | #ifdef JS_HAS_CTYPES | |||
/* | /* | |||
* Initialize the 'ctypes' object on a global variable 'obj'. The 'ctypes' | * Initialize the 'ctypes' object on a global variable 'obj'. The 'ctypes' | |||
* object will be sealed. | * object will be sealed. | |||
skipping to change at line 2913 | skipping to change at line 3016 | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_FreeInCompartment(JSCompartment *comp, size_t nbytes); | JS_FreeInCompartment(JSCompartment *comp, size_t nbytes); | |||
extern JS_PUBLIC_API(void *) | extern JS_PUBLIC_API(void *) | |||
JS_malloc(JSContext *cx, size_t nbytes); | JS_malloc(JSContext *cx, size_t nbytes); | |||
extern JS_PUBLIC_API(void *) | extern JS_PUBLIC_API(void *) | |||
JS_realloc(JSContext *cx, void *p, size_t nbytes); | JS_realloc(JSContext *cx, void *p, size_t nbytes); | |||
/* | ||||
* A wrapper for js_free(p) that may delay js_free(p) invocation as a | ||||
* performance optimization. | ||||
*/ | ||||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_free(JSContext *cx, void *p); | JS_free(JSContext *cx, void *p); | |||
/* | ||||
* A wrapper for js_free(p) that may delay js_free(p) invocation as a | ||||
* performance optimization as specified by the given JSFreeOp instance. | ||||
*/ | ||||
extern JS_PUBLIC_API(void) | ||||
JS_freeop(JSFreeOp *fop, void *p); | ||||
extern JS_PUBLIC_API(JSFreeOp *) | ||||
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) | extern JS_PUBLIC_API(JSBool) | |||
JS_NewNumberValue(JSContext *cx, double d, jsval *rval); | JS_NewNumberValue(JSContext *cx, double d, jsval *rval); | |||
/* | /* | |||
skipping to change at line 2986 | skipping to change at line 3103 | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_AddNamedObjectRoot(JSContext *cx, JSObject **rp, const char *name); | JS_AddNamedObjectRoot(JSContext *cx, JSObject **rp, const char *name); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_AddNamedScriptRoot(JSContext *cx, JSScript **rp, const char *name); | JS_AddNamedScriptRoot(JSContext *cx, JSScript **rp, const char *name); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const char *name); | JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const char *name); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(void) | |||
JS_RemoveValueRoot(JSContext *cx, jsval *vp); | JS_RemoveValueRoot(JSContext *cx, jsval *vp); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(void) | |||
JS_RemoveStringRoot(JSContext *cx, JSString **rp); | JS_RemoveStringRoot(JSContext *cx, JSString **rp); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(void) | |||
JS_RemoveObjectRoot(JSContext *cx, JSObject **rp); | JS_RemoveObjectRoot(JSContext *cx, JSObject **rp); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(void) | |||
JS_RemoveScriptRoot(JSContext *cx, JSScript **rp); | JS_RemoveScriptRoot(JSContext *cx, JSScript **rp); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(void) | |||
JS_RemoveGCThingRoot(JSContext *cx, void **rp); | JS_RemoveGCThingRoot(JSContext *cx, void **rp); | |||
extern JS_PUBLIC_API(void) | ||||
JS_RemoveValueRootRT(JSRuntime *rt, jsval *vp); | ||||
extern JS_PUBLIC_API(void) | ||||
JS_RemoveStringRootRT(JSRuntime *rt, JSString **rp); | ||||
extern JS_PUBLIC_API(void) | ||||
JS_RemoveObjectRootRT(JSRuntime *rt, JSObject **rp); | ||||
extern JS_PUBLIC_API(void) | ||||
JS_RemoveScriptRootRT(JSRuntime *rt, JSScript **rp); | ||||
/* TODO: remove these APIs */ | /* TODO: remove these APIs */ | |||
extern JS_FRIEND_API(JSBool) | extern JS_FRIEND_API(JSBool) | |||
js_AddRootRT(JSRuntime *rt, jsval *vp, const char *name); | js_AddRootRT(JSRuntime *rt, jsval *vp, const char *name); | |||
extern JS_FRIEND_API(JSBool) | extern JS_FRIEND_API(JSBool) | |||
js_AddGCThingRootRT(JSRuntime *rt, void **rp, const char *name); | js_AddGCThingRootRT(JSRuntime *rt, void **rp, const char *name); | |||
extern JS_FRIEND_API(JSBool) | extern JS_FRIEND_API(void) | |||
js_RemoveRoot(JSRuntime *rt, void *rp); | js_RemoveRoot(JSRuntime *rt, void *rp); | |||
/* | /* | |||
* C-compatible version of the Anchor class. It should be called after the last | * C-compatible version of the Anchor class. It should be called after the last | |||
* use of the variable it protects. | * use of the variable it protects. | |||
*/ | */ | |||
extern JS_NEVER_INLINE JS_PUBLIC_API(void) | extern JS_NEVER_INLINE JS_PUBLIC_API(void) | |||
JS_AnchorPtr(void *p); | JS_AnchorPtr(void *p); | |||
/* | /* | |||
skipping to change at line 3036 | skipping to change at line 3165 | |||
#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. | |||
* | * | |||
* This function acquires and releases rt's GC lock around the mapping of t | ||||
he | ||||
* roots table, so the map function should run to completion in as few cycl | ||||
es | ||||
* as possible. Of course, map cannot call JS_GC, JS_MaybeGC, JS_BeginRequ | ||||
est, | ||||
* or any JS API entry point that acquires locks, without double-tripping o | ||||
r | ||||
* deadlocking on the GC lock. | ||||
* | ||||
* The JSGCRootType parameter indicates whether rp is a pointer to a Value | * The JSGCRootType parameter indicates whether rp is a pointer to a Value | |||
* (which is obtained by '(Value *)rp') or a pointer to a GC-thing pointer | * (which is obtained by '(Value *)rp') or a pointer to a GC-thing pointer | |||
* (which is obtained by '(void **)rp'). | * (which is obtained by '(void **)rp'). | |||
* | * | |||
* JS_MapGCRoots returns the count of roots that were successfully mapped. | * JS_MapGCRoots returns the count of roots that were successfully mapped. | |||
*/ | */ | |||
#define JS_MAP_GCROOT_NEXT 0 /* continue mapping entries */ | #define JS_MAP_GCROOT_NEXT 0 /* continue mapping entries */ | |||
#define JS_MAP_GCROOT_STOP 1 /* stop mapping entries */ | #define JS_MAP_GCROOT_STOP 1 /* stop mapping entries */ | |||
#define JS_MAP_GCROOT_REMOVE 2 /* remove and free the current entr y */ | #define JS_MAP_GCROOT_REMOVE 2 /* remove and free the current entr y */ | |||
skipping to change at line 3155 | skipping to change at line 3276 | |||
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 | ||||
void *realLocation; | ||||
#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. | |||
*/ | */ | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind); | JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind); | |||
skipping to change at line 3196 | skipping to change at line 3320 | |||
(trc)->debugPrintArg = (arg); \ | (trc)->debugPrintArg = (arg); \ | |||
(trc)->debugPrintIndex = (index); \ | (trc)->debugPrintIndex = (index); \ | |||
JS_END_MACRO | JS_END_MACRO | |||
#else | #else | |||
# define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \ | # define JS_SET_TRACING_DETAILS(trc, printer, arg, index) \ | |||
JS_BEGIN_MACRO \ | JS_BEGIN_MACRO \ | |||
JS_END_MACRO | JS_END_MACRO | |||
#endif | #endif | |||
/* | /* | |||
* Sets the real location for a marked reference, when passing the address | ||||
* directly is not feasable. | ||||
*/ | ||||
#ifdef DEBUG | ||||
# define JS_SET_TRACING_LOCATION(trc, location) | ||||
\ | ||||
JS_BEGIN_MACRO | ||||
\ | ||||
(trc)->realLocation = (location); | ||||
\ | ||||
JS_END_MACRO | ||||
#else | ||||
# define JS_SET_TRACING_LOCATION(trc, location) | ||||
\ | ||||
JS_BEGIN_MACRO | ||||
\ | ||||
JS_END_MACRO | ||||
#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. | |||
*/ | */ | |||
# define JS_SET_TRACING_INDEX(trc, name, index) \ | # define JS_SET_TRACING_INDEX(trc, name, index) \ | |||
JS_SET_TRACING_DETAILS(trc, NULL, name, index) | JS_SET_TRACING_DETAILS(trc, NULL, name, index) | |||
/* | /* | |||
* 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. | |||
*/ | */ | |||
# define JS_SET_TRACING_NAME(trc, name) \ | # define JS_SET_TRACING_NAME(trc, name) \ | |||
skipping to change at line 3290 | skipping to change at line 3429 | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind kind, | JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind kind, | |||
void *thingToFind, size_t maxDepth, void *thingToIgnore); | void *thingToFind, size_t maxDepth, void *thingToIgnore); | |||
#endif | #endif | |||
/* | /* | |||
* Garbage collector API. | * Garbage collector API. | |||
*/ | */ | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_GC(JSContext *cx); | JS_GC(JSRuntime *rt); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_CompartmentGC(JSContext *cx, JSCompartment *comp); | JS_CompartmentGC(JSRuntime *rt, JSCompartment *comp); | |||
extern JS_PUBLIC_API(void) | 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); | |||
skipping to change at line 3369 | skipping to change at line 3508 | |||
extern JS_PUBLIC_API(uint32_t) | extern JS_PUBLIC_API(uint32_t) | |||
JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key); | JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_SetGCParameterForThread(JSContext *cx, JSGCParamKey key, uint32_t value) ; | JS_SetGCParameterForThread(JSContext *cx, JSGCParamKey key, uint32_t value) ; | |||
extern JS_PUBLIC_API(uint32_t) | extern JS_PUBLIC_API(uint32_t) | |||
JS_GetGCParameterForThread(JSContext *cx, JSGCParamKey key); | JS_GetGCParameterForThread(JSContext *cx, JSGCParamKey key); | |||
/* | /* | |||
* Flush the code cache for the current thread. The operation might be | ||||
* delayed if the cache cannot be flushed currently because native | ||||
* code is currently executing. | ||||
*/ | ||||
extern JS_PUBLIC_API(void) | ||||
JS_FlushCaches(JSContext *cx); | ||||
/* | ||||
* Create a new JSString whose chars member refers to external memory, i.e. , | * Create a new JSString whose chars member refers to external memory, i.e. , | |||
* memory requiring application-specific finalization. | * memory requiring application-specific finalization. | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSString *) | extern JS_PUBLIC_API(JSString *) | |||
JS_NewExternalString(JSContext *cx, const jschar *chars, size_t length, | JS_NewExternalString(JSContext *cx, const jschar *chars, size_t length, | |||
const JSStringFinalizer *fin); | const JSStringFinalizer *fin); | |||
/* | /* | |||
* Return whether 'str' was created with JS_NewExternalString or | * Return whether 'str' was created with JS_NewExternalString or | |||
* JS_NewExternalStringWithClosure. | * JS_NewExternalStringWithClosure. | |||
skipping to change at line 3448 | skipping to change at line 3578 | |||
#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 ting | #define JSCLASS_NEW_RESOLVE_GETS_START (1<<4) /* JSNewResolveOp gets star ting | |||
object in prototype chai n | object in prototype chai n | |||
passed in via *objp in/o ut | passed in via *objp in/o ut | |||
parameter */ | 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. */ | ||||
/* | /* | |||
* 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. | |||
*/ | */ | |||
#define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below * / | #define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below * / | |||
#define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ | #define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ | |||
#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 ) \ | |||
skipping to change at line 3483 | skipping to change at line 3614 | |||
#define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2)) | #define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2)) | |||
#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3)) | #define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3)) | |||
#define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4)) | #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+5)) | |||
#define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6)) | #define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6)) | |||
#define JSCLASS_XPCONNECT_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7)) | #define JSCLASS_XPCONNECT_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7)) | |||
/* Reserved for embeddings. */ | ||||
#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8)) | ||||
#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+9)) | ||||
/* | ||||
* Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see | ||||
* 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. | |||
* | * | |||
skipping to change at line 3507 | skipping to change at line 3647 | |||
#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 8) | #define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 8) | |||
#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 + 8) | #define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10) | |||
#define JSCLASS_CACHED_PROTO_WIDTH 8 | #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) ((key) << JSCLASS_CACHED_PROTO_SHIF T) | |||
#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 | |||
skipping to change at line 3621 | skipping to change at line 3761 | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_EnumerateStub(JSContext *cx, JSObject *obj); | JS_EnumerateStub(JSContext *cx, JSObject *obj); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_ResolveStub(JSContext *cx, JSObject *obj, jsid id); | JS_ResolveStub(JSContext *cx, JSObject *obj, jsid 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, JSObject *obj, JSType type, jsval *vp); | |||
extern JS_PUBLIC_API(void) | ||||
JS_FinalizeStub(JSContext *cx, JSObject *obj); | ||||
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]; | |||
}; | }; | |||
/* | /* | |||
* 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 | |||
skipping to change at line 4141 | skipping to change at line 4278 | |||
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; | JSSubsumePrincipalsOp subsumePrincipals; | |||
JSPrincipalsTranscoder principalsTranscoder; | ||||
JSObjectPrincipalsFinder findObjectPrincipals; | 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 4231 | skipping to change at line 4369 | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_ObjectIsFunction(JSContext *cx, JSObject *obj); | JS_ObjectIsFunction(JSContext *cx, JSObject *obj); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_ObjectIsCallable(JSContext *cx, JSObject *obj); | JS_ObjectIsCallable(JSContext *cx, JSObject *obj); | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_IsNativeFunction(JSObject *funobj, JSNative call); | JS_IsNativeFunction(JSObject *funobj, JSNative call); | |||
/* | ||||
* Bind the given callable to use the given object as "this". | ||||
* | ||||
* If |callable| is not callable, will throw and return NULL. | ||||
*/ | ||||
extern JS_PUBLIC_API(JSObject*) | ||||
JS_BindCallable(JSContext *cx, JSObject *callable, JSObject *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, | |||
skipping to change at line 5050 | skipping to change at line 5196 | |||
JS_PUBLIC_API(void) | JS_PUBLIC_API(void) | |||
JS_SetStructuredCloneCallbacks(JSRuntime *rt, const JSStructuredCloneCallba cks *callbacks); | JS_SetStructuredCloneCallbacks(JSRuntime *rt, const JSStructuredCloneCallba cks *callbacks); | |||
JS_PUBLIC_API(JSBool) | JS_PUBLIC_API(JSBool) | |||
JS_ReadUint32Pair(JSStructuredCloneReader *r, uint32_t *p1, uint32_t *p2); | JS_ReadUint32Pair(JSStructuredCloneReader *r, uint32_t *p1, uint32_t *p2); | |||
JS_PUBLIC_API(JSBool) | JS_PUBLIC_API(JSBool) | |||
JS_ReadBytes(JSStructuredCloneReader *r, void *p, size_t len); | JS_ReadBytes(JSStructuredCloneReader *r, void *p, size_t len); | |||
JS_PUBLIC_API(JSBool) | JS_PUBLIC_API(JSBool) | |||
JS_ReadTypedArray(JSStructuredCloneReader *r, jsval *vp); | ||||
JS_PUBLIC_API(JSBool) | ||||
JS_WriteUint32Pair(JSStructuredCloneWriter *w, uint32_t tag, uint32_t data) ; | JS_WriteUint32Pair(JSStructuredCloneWriter *w, uint32_t tag, uint32_t data) ; | |||
JS_PUBLIC_API(JSBool) | JS_PUBLIC_API(JSBool) | |||
JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len); | JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len); | |||
JS_PUBLIC_API(JSBool) | ||||
JS_WriteTypedArray(JSStructuredCloneWriter *w, jsval v); | ||||
/************************************************************************/ | /************************************************************************/ | |||
/* | /* | |||
* Locale specific string conversion and error message callbacks. | * Locale specific string conversion and error message callbacks. | |||
*/ | */ | |||
struct JSLocaleCallbacks { | struct JSLocaleCallbacks { | |||
JSLocaleToUpperCase localeToUpperCase; | JSLocaleToUpperCase localeToUpperCase; | |||
JSLocaleToLowerCase localeToLowerCase; | JSLocaleToLowerCase localeToLowerCase; | |||
JSLocaleCompare localeCompare; | JSLocaleCompare localeCompare; | |||
JSLocaleToUnicode localeToUnicode; | JSLocaleToUnicode localeToUnicode; | |||
skipping to change at line 5392 | skipping to change at line 5544 | |||
JS_ASSERT(JS_GetClass(callee)->construct != NULL); | JS_ASSERT(JS_GetClass(callee)->construct != NULL); | |||
} | } | |||
#else | #else | |||
(void)cx; | (void)cx; | |||
#endif | #endif | |||
return JSVAL_IS_MAGIC_IMPL(JSVAL_TO_IMPL(vp[1])); | return JSVAL_IS_MAGIC_IMPL(JSVAL_TO_IMPL(vp[1])); | |||
} | } | |||
/* | /* | |||
* If a constructor does not have any static knowledge about the type of | * A constructor can request that the JS engine create a default new 'this' | |||
* object to create, it can request that the JS engine create a default new | * object of the given class, using the callee to determine parentage and | |||
* 'this' object, as is done for non-constructor natives when called with n | * [[Prototype]]. | |||
ew. | ||||
*/ | */ | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_NewObjectForConstructor(JSContext *cx, const jsval *vp); | JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp); | |||
/************************************************************************/ | /************************************************************************/ | |||
#ifdef DEBUG | #ifdef DEBUG | |||
#define JS_GC_ZEAL 1 | #define JS_GC_ZEAL 1 | |||
#endif | #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, JSBool compar tment); | 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, JSBool compartment); | JS_ScheduleGC(JSContext *cx, uint32_t count); | |||
#endif | #endif | |||
/* | /* | |||
* Convert a uint32_t index into a jsid. | * Convert a uint32_t index into a jsid. | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_IndexToId(JSContext *cx, uint32_t index, jsid *id); | JS_IndexToId(JSContext *cx, uint32_t index, jsid *id); | |||
/* | /* | |||
* Test if the given string is a valid ECMAScript identifier | * Test if the given string is a valid ECMAScript identifier | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSBool) | extern JS_PUBLIC_API(JSBool) | |||
JS_IsIdentifier(JSContext *cx, JSString *str, JSBool *isIdentifier); | JS_IsIdentifier(JSContext *cx, JSString *str, JSBool *isIdentifier); | |||
/* | ||||
* Return the current script and line number of the most currently running | ||||
* frame. Returns true if a scripted frame was found, false otherwise. | ||||
*/ | ||||
extern JS_PUBLIC_API(JSBool) | ||||
JS_DescribeScriptedCaller(JSContext *cx, JSScript **script, unsigned *linen | ||||
o); | ||||
/* | ||||
* Encode/Decode interpreted scripts and functions to/from memory. | ||||
*/ | ||||
extern JS_PUBLIC_API(void *) | ||||
JS_EncodeScript(JSContext *cx, JSScript *script, uint32_t *lengthp); | ||||
extern JS_PUBLIC_API(void *) | ||||
JS_EncodeInterpretedFunction(JSContext *cx, JSObject *funobj, uint32_t *len | ||||
gthp); | ||||
extern JS_PUBLIC_API(JSScript *) | ||||
JS_DecodeScript(JSContext *cx, const void *data, uint32_t length, | ||||
JSPrincipals *principals, JSPrincipals *originPrincipals); | ||||
extern JS_PUBLIC_API(JSObject *) | ||||
JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t leng | ||||
th, | ||||
JSPrincipals *principals, JSPrincipals *origin | ||||
Principals); | ||||
JS_END_EXTERN_C | JS_END_EXTERN_C | |||
#endif /* jsapi_h___ */ | #endif /* jsapi_h___ */ | |||
End of changes. 63 change blocks. | ||||
123 lines changed or deleted | 301 lines changed or added | |||
jsatom.h | jsatom.h | |||
---|---|---|---|---|
skipping to change at line 286 | skipping to change at line 286 | |||
* NB: booleanAtoms must come right before typeAtoms! | * NB: booleanAtoms must come right before typeAtoms! | |||
*/ | */ | |||
js::PropertyName *booleanAtoms[2]; | js::PropertyName *booleanAtoms[2]; | |||
js::PropertyName *typeAtoms[JSTYPE_LIMIT]; | js::PropertyName *typeAtoms[JSTYPE_LIMIT]; | |||
js::PropertyName *nullAtom; | js::PropertyName *nullAtom; | |||
/* Standard class constructor or prototype names. */ | /* Standard class constructor or prototype names. */ | |||
js::PropertyName *classAtoms[JSProto_LIMIT]; | js::PropertyName *classAtoms[JSProto_LIMIT]; | |||
/* Various built-in or commonly-used atoms, pinned on first context. */ | /* Various built-in or commonly-used atoms, pinned on first context. */ | |||
js::PropertyName *anonymousAtom; | #define DEFINE_ATOM(id, text) js::PropertyName *id##Atom; | |||
js::PropertyName *applyAtom; | #define DEFINE_PROTOTYPE_ATOM(id) js::PropertyName *id##Atom; | |||
js::PropertyName *argumentsAtom; | #define DEFINE_KEYWORD_ATOM(id) js::PropertyName *id##Atom; | |||
js::PropertyName *arityAtom; | #include "jsatom.tbl" | |||
js::PropertyName *BYTES_PER_ELEMENTAtom; | #undef DEFINE_ATOM | |||
js::PropertyName *callAtom; | #undef DEFINE_PROTOTYPE_ATOM | |||
js::PropertyName *calleeAtom; | #undef DEFINE_KEYWORD_ATOM | |||
js::PropertyName *callerAtom; | ||||
js::PropertyName *classPrototypeAtom; | ||||
js::PropertyName *constructorAtom; | ||||
js::PropertyName *eachAtom; | ||||
js::PropertyName *evalAtom; | ||||
js::PropertyName *fileNameAtom; | ||||
js::PropertyName *getAtom; | ||||
js::PropertyName *globalAtom; | ||||
js::PropertyName *ignoreCaseAtom; | ||||
js::PropertyName *indexAtom; | ||||
js::PropertyName *inputAtom; | ||||
js::PropertyName *toISOStringAtom; | ||||
js::PropertyName *iteratorAtom; | ||||
js::PropertyName *joinAtom; | ||||
js::PropertyName *lastIndexAtom; | ||||
js::PropertyName *lengthAtom; | ||||
js::PropertyName *lineNumberAtom; | ||||
js::PropertyName *messageAtom; | ||||
js::PropertyName *multilineAtom; | ||||
js::PropertyName *nameAtom; | ||||
js::PropertyName *nextAtom; | ||||
js::PropertyName *noSuchMethodAtom; | ||||
js::PropertyName *objectNullAtom; | ||||
js::PropertyName *objectUndefinedAtom; | ||||
js::PropertyName *ofAtom; | ||||
js::PropertyName *protoAtom; | ||||
js::PropertyName *setAtom; | ||||
js::PropertyName *sourceAtom; | ||||
js::PropertyName *stackAtom; | ||||
js::PropertyName *stickyAtom; | ||||
js::PropertyName *toGMTStringAtom; | ||||
js::PropertyName *toLocaleStringAtom; | ||||
js::PropertyName *toSourceAtom; | ||||
js::PropertyName *toStringAtom; | ||||
js::PropertyName *toUTCStringAtom; | ||||
js::PropertyName *valueOfAtom; | ||||
js::PropertyName *toJSONAtom; | ||||
js::PropertyName *void0Atom; | ||||
js::PropertyName *enumerableAtom; | ||||
js::PropertyName *configurableAtom; | ||||
js::PropertyName *writableAtom; | ||||
js::PropertyName *valueAtom; | ||||
js::PropertyName *testAtom; | ||||
js::PropertyName *useStrictAtom; | ||||
js::PropertyName *locAtom; | ||||
js::PropertyName *lineAtom; | ||||
js::PropertyName *InfinityAtom; | ||||
js::PropertyName *NaNAtom; | ||||
js::PropertyName *builderAtom; | ||||
#if JS_HAS_XML_SUPPORT | ||||
js::PropertyName *etagoAtom; | ||||
js::PropertyName *namespaceAtom; | ||||
js::PropertyName *ptagcAtom; | ||||
js::PropertyName *qualifierAtom; | ||||
js::PropertyName *spaceAtom; | ||||
js::PropertyName *stagoAtom; | ||||
js::PropertyName *starAtom; | ||||
js::PropertyName *starQualifierAtom; | ||||
js::PropertyName *tagcAtom; | ||||
js::PropertyName *xmlAtom; | ||||
/* Represents an invalid URI, for internal use only. */ | ||||
js::PropertyName *functionNamespaceURIAtom; | ||||
#endif | ||||
js::PropertyName *ProxyAtom; | ||||
js::PropertyName *getOwnPropertyDescriptorAtom; | ||||
js::PropertyName *getPropertyDescriptorAtom; | ||||
js::PropertyName *definePropertyAtom; | ||||
js::PropertyName *deleteAtom; | ||||
js::PropertyName *getOwnPropertyNamesAtom; | ||||
js::PropertyName *enumerateAtom; | ||||
js::PropertyName *fixAtom; | ||||
js::PropertyName *hasAtom; | ||||
js::PropertyName *hasOwnAtom; | ||||
js::PropertyName *keysAtom; | ||||
js::PropertyName *iterateAtom; | ||||
js::PropertyName *WeakMapAtom; | ||||
js::PropertyName *byteLengthAtom; | ||||
js::PropertyName *returnAtom; | ||||
js::PropertyName *throwAtom; | ||||
/* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass . */ | /* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass . */ | |||
struct { | struct { | |||
js::PropertyName *XMLListAtom; | js::PropertyName *XMLListAtom; | |||
js::PropertyName *decodeURIAtom; | js::PropertyName *decodeURIAtom; | |||
js::PropertyName *decodeURIComponentAtom; | js::PropertyName *decodeURIComponentAtom; | |||
js::PropertyName *defineGetterAtom; | js::PropertyName *defineGetterAtom; | |||
js::PropertyName *defineSetterAtom; | js::PropertyName *defineSetterAtom; | |||
js::PropertyName *encodeURIAtom; | js::PropertyName *encodeURIAtom; | |||
js::PropertyName *encodeURIComponentAtom; | js::PropertyName *encodeURIComponentAtom; | |||
skipping to change at line 453 | skipping to change at line 366 | |||
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)]) | |||
/* Type names. */ | ||||
extern const char js_object_str[]; | ||||
extern const char js_undefined_str[]; | ||||
/* Well-known predefined C strings. */ | /* Well-known predefined C strings. */ | |||
#define JS_PROTO(name,code,init) extern const char js_##name##_str[]; | #define JS_PROTO(name,code,init) extern const char js_##name##_str[]; | |||
#include "jsproto.tbl" | #include "jsproto.tbl" | |||
#undef JS_PROTO | #undef JS_PROTO | |||
extern const char js_anonymous_str[]; | #define DEFINE_ATOM(id, text) extern const char js_##id##_str[]; | |||
extern const char js_apply_str[]; | #define DEFINE_PROTOTYPE_ATOM(id) | |||
extern const char js_arguments_str[]; | #define DEFINE_KEYWORD_ATOM(id) | |||
extern const char js_arity_str[]; | #include "jsatom.tbl" | |||
extern const char js_BYTES_PER_ELEMENT_str[]; | #undef DEFINE_ATOM | |||
extern const char js_call_str[]; | #undef DEFINE_PROTOTYPE_ATOM | |||
extern const char js_callee_str[]; | #undef DEFINE_KEYWORD_ATOM | |||
extern const char js_caller_str[]; | ||||
extern const char js_class_prototype_str[]; | #if JS_HAS_GENERATORS | |||
extern const char js_close_str[]; | extern const char js_close_str[]; | |||
extern const char js_constructor_str[]; | ||||
extern const char js_count_str[]; | ||||
extern const char js_etago_str[]; | ||||
extern const char js_each_str[]; | ||||
extern const char js_eval_str[]; | ||||
extern const char js_fileName_str[]; | ||||
extern const char js_get_str[]; | ||||
extern const char js_getter_str[]; | ||||
extern const char js_global_str[]; | ||||
extern const char js_ignoreCase_str[]; | ||||
extern const char js_index_str[]; | ||||
extern const char js_input_str[]; | ||||
extern const char js_iterator_str[]; | ||||
extern const char js_join_str[]; | ||||
extern const char js_lastIndex_str[]; | ||||
extern const char js_length_str[]; | ||||
extern const char js_lineNumber_str[]; | ||||
extern const char js_message_str[]; | ||||
extern const char js_multiline_str[]; | ||||
extern const char js_name_str[]; | ||||
extern const char js_namespace_str[]; | ||||
extern const char js_next_str[]; | ||||
extern const char js_noSuchMethod_str[]; | ||||
extern const char js_object_str[]; | ||||
extern const char js_proto_str[]; | ||||
extern const char js_ptagc_str[]; | ||||
extern const char js_qualifier_str[]; | ||||
extern const char js_send_str[]; | extern const char js_send_str[]; | |||
#endif | ||||
/* Constant strings that are not atomized. */ | ||||
extern const char js_getter_str[]; | ||||
extern const char js_setter_str[]; | extern const char js_setter_str[]; | |||
extern const char js_set_str[]; | ||||
extern const char js_source_str[]; | ||||
extern const char js_space_str[]; | ||||
extern const char js_stack_str[]; | ||||
extern const char js_sticky_str[]; | ||||
extern const char js_stago_str[]; | ||||
extern const char js_star_str[]; | ||||
extern const char js_starQualifier_str[]; | ||||
extern const char js_tagc_str[]; | ||||
extern const char js_toGMTString_str[]; | ||||
extern const char js_toLocaleString_str[]; | ||||
extern const char js_toSource_str[]; | ||||
extern const char js_toString_str[]; | ||||
extern const char js_toUTCString_str[]; | ||||
extern const char js_undefined_str[]; | ||||
extern const char js_valueOf_str[]; | ||||
extern const char js_toJSON_str[]; | ||||
extern const char js_xml_str[]; | ||||
extern const char js_enumerable_str[]; | ||||
extern const char js_configurable_str[]; | ||||
extern const char js_writable_str[]; | ||||
extern const char js_value_str[]; | ||||
extern const char js_test_str[]; | ||||
/* | /* | |||
* 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); | js_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); | js_FinishAtomState(JSRuntime *rt); | |||
/* | /* | |||
* Atom tracing and garbage collection hooks. | * Atom tracing and garbage collection hooks. | |||
*/ | */ | |||
namespace js { | ||||
extern void | extern void | |||
js_TraceAtomState(JSTracer *trc); | MarkAtomState(JSTracer *trc, bool markAll); | |||
extern void | extern void | |||
js_SweepAtomState(JSRuntime *rt); | SweepAtomState(JSRuntime *rt); | |||
extern bool | extern bool | |||
js_InitCommonAtoms(JSContext *cx); | InitCommonAtoms(JSContext *cx); | |||
extern void | extern void | |||
js_FinishCommonAtoms(JSContext *cx); | FinishCommonAtoms(JSRuntime *rt); | |||
namespace js { | ||||
/* 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 */ | } /* namespace js */ | |||
skipping to change at line 602 | skipping to change at line 473 | |||
inline bool | inline bool | |||
js_ValueToStringId(JSContext *cx, const js::Value &v, jsid *idp); | js_ValueToStringId(JSContext *cx, const js::Value &v, jsid *idp); | |||
inline bool | inline bool | |||
js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv al, | js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv al, | |||
jsid *idp); | jsid *idp); | |||
inline bool | inline bool | |||
js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv al, | js_InternNonIntElementId(JSContext *cx, JSObject *obj, const js::Value &idv al, | |||
jsid *idp, js::Value *vp); | jsid *idp, js::Value *vp); | |||
namespace js { | ||||
/* | /* | |||
* For all unmapped atoms recorded in al, add a mapping from the atom's ind ex | * 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 | * 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. | * the list and map->vector must point to pre-allocated memory. | |||
*/ | */ | |||
extern void | extern void | |||
js_InitAtomMap(JSContext *cx, js::AtomIndexMap *indices, JSAtom **atoms); | InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtrAtom *atoms); | |||
template<XDRMode mode> | ||||
bool | ||||
XDRAtom(XDRState<mode> *xdr, JSAtom **atomp); | ||||
} /* namespace js */ | ||||
#endif /* jsatom_h___ */ | #endif /* jsatom_h___ */ | |||
End of changes. 13 change blocks. | ||||
160 lines changed or deleted | 39 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 ***** | * ***** BEGIN LICENSE BLOCK ***** | |||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
* | * | |||
* The contents of this file are subject to the Mozilla Public License Vers ion | * 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 | * 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 | * the License. You may obtain a copy of the License at | |||
* http://www.mozilla.org/MPL/ | * http://www.mozilla.org/MPL/ | |||
* | * | |||
skipping to change at line 251 | skipping to change at line 251 | |||
* If |obj| is now ready to become non-extensible, set |*fixed| to true and return true. | * 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 | * If |obj| refuses to become non-extensible, set |*fixed| to false and ret urn true; the | |||
* caller will throw an appropriate error. | * caller will throw an appropriate error. | |||
*/ | */ | |||
typedef JSBool | typedef JSBool | |||
(* FixOp)(JSContext *cx, JSObject *obj, bool *fixed, AutoIdVector *props); | (* FixOp)(JSContext *cx, JSObject *obj, bool *fixed, AutoIdVector *props); | |||
typedef JSObject * | typedef JSObject * | |||
(* ObjectOp)(JSContext *cx, JSObject *obj); | (* ObjectOp)(JSContext *cx, JSObject *obj); | |||
typedef void | typedef void | |||
(* FinalizeOp)(JSContext *cx, JSObject *obj); | (* FinalizeOp)(FreeOp *fop, JSObject *obj); | |||
typedef void | ||||
(* ClearOp)(JSContext *cx, 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; \ | |||
JSFinalizeOp 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; \ | JSNative construct; \ | |||
JSHasInstanceOp hasInstance; \ | JSHasInstanceOp hasInstance; \ | |||
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 | |||
skipping to change at line 335 | skipping to change at line 337 | |||
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; | FixOp fix; | |||
ObjectOp thisObject; | ObjectOp thisObject; | |||
FinalizeOp 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,NULL} | |||
struct Class | struct Class | |||
{ | { | |||
JS_CLASS_MEMBERS; | JS_CLASS_MEMBERS; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added | |||
jsdbgapi.h | jsdbgapi.h | |||
---|---|---|---|---|
skipping to change at line 94 | skipping to change at line 94 | |||
bool enter(JSContext *cx, JSStackFrame *target); | bool enter(JSContext *cx, JSStackFrame *target); | |||
}; | }; | |||
} /* namespace JS */ | } /* namespace JS */ | |||
#ifdef DEBUG | #ifdef DEBUG | |||
JS_FRIEND_API(void) js_DumpValue(const js::Value &val); | JS_FRIEND_API(void) js_DumpValue(const js::Value &val); | |||
JS_FRIEND_API(void) js_DumpId(jsid id); | JS_FRIEND_API(void) js_DumpId(jsid id); | |||
JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NULL); | JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NULL); | |||
#endif | #endif | |||
JS_FRIEND_API(void) js_DumpBacktrace(JSContext *cx); | ||||
JS_BEGIN_EXTERN_C | JS_BEGIN_EXTERN_C | |||
#endif | #endif | |||
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); | |||
/* | /* | |||
* Currently, we only support runtime-wide debugging. In the future, we sho uld | * Currently, we only support runtime-wide debugging. In the future, we sho uld | |||
* be able to support compartment-wide debugging. | * be able to support compartment-wide debugging. | |||
skipping to change at line 223 | skipping to change at line 224 | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark); | JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark); | |||
extern JS_PUBLIC_API(JSScript *) | extern JS_PUBLIC_API(JSScript *) | |||
JS_GetFunctionScript(JSContext *cx, JSFunction *fun); | JS_GetFunctionScript(JSContext *cx, JSFunction *fun); | |||
extern JS_PUBLIC_API(JSNative) | extern JS_PUBLIC_API(JSNative) | |||
JS_GetFunctionNative(JSContext *cx, JSFunction *fun); | JS_GetFunctionNative(JSContext *cx, JSFunction *fun); | |||
extern JS_PUBLIC_API(JSPrincipals *) | extern JS_PUBLIC_API(JSPrincipals *) | |||
JS_GetScriptPrincipals(JSContext *cx, JSScript *script); | JS_GetScriptPrincipals(JSScript *script); | |||
extern JS_PUBLIC_API(JSPrincipals *) | extern JS_PUBLIC_API(JSPrincipals *) | |||
JS_GetScriptOriginPrincipals(JSContext *cx, JSScript *script); | JS_GetScriptOriginPrincipals(JSScript *script); | |||
/* | /* | |||
* Stack Frame Iterator | * Stack Frame Iterator | |||
* | * | |||
* Used to iterate through the JS stack frames to extract | * Used to iterate through the JS stack frames to extract | |||
* information from the frames. | * information from the frames. | |||
*/ | */ | |||
extern JS_PUBLIC_API(JSStackFrame *) | extern JS_PUBLIC_API(JSStackFrame *) | |||
JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp); | JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp); | |||
extern JS_PUBLIC_API(JSScript *) | extern JS_PUBLIC_API(JSScript *) | |||
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp); | JS_GetFrameScript(JSContext *cx, JSStackFrame *fp); | |||
extern JS_PUBLIC_API(jsbytecode *) | extern JS_PUBLIC_API(jsbytecode *) | |||
JS_GetFramePC(JSContext *cx, JSStackFrame *fp); | JS_GetFramePC(JSContext *cx, JSStackFrame *fp); | |||
/* | ||||
* Get the closest scripted frame below fp. If fp is null, start from cx-> | ||||
fp. | ||||
*/ | ||||
extern JS_PUBLIC_API(JSStackFrame *) | ||||
JS_GetScriptedCaller(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) | extern JS_PUBLIC_API(JSBool) | |||
JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp); | JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp); | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
skipping to change at line 301 | skipping to change at line 296 | |||
extern JS_PUBLIC_API(jsval) | extern JS_PUBLIC_API(jsval) | |||
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp); | JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp); | |||
extern JS_PUBLIC_API(void) | extern JS_PUBLIC_API(void) | |||
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval); | JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval); | |||
/** | /** | |||
* 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. | |||
* | ||||
* This API began life as an infallible getter, but now it can return eithe | ||||
r: | ||||
* | ||||
* 1. An optimized closure that was compiled assuming the function could no | ||||
t | ||||
* escape and be called from sites the compiler could not see. | ||||
* | ||||
* 2. A "joined function object", an optimization whereby SpiderMonkey avoi | ||||
ds | ||||
* creating fresh function objects for every evaluation of a function | ||||
* expression that is used only once by a consumer that either promises | ||||
to | ||||
* clone later when asked for the value or that cannot leak the value. | ||||
* | ||||
* Because Mozilla's Gecko embedding of SpiderMonkey (and no doubt other | ||||
* embeddings) calls this API in potentially performance-sensitive ways (e. | ||||
g. | ||||
* in nsContentUtils::GetDocumentFromCaller), we are leaving this API alone | ||||
. It | ||||
* may now return an unwrapped non-escaping optimized closure, or a joined | ||||
* function object. Such optimized objects may work well if called from the | ||||
* correct context, never mutated or compared for identity, etc. | ||||
* | ||||
* However, if you really need to get the same callee object that JS code w | ||||
ould | ||||
* see, which means undoing the optimizations, where an undo attempt can fa | ||||
il, | ||||
* then use JS_GetValidFrameCalleeObject. | ||||
*/ | */ | |||
extern JS_PUBLIC_API(JSObject *) | extern JS_PUBLIC_API(JSObject *) | |||
JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp); | JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp); | |||
/** | ||||
* Return fp's callee function object after running the deferred closure | ||||
* cloning "method read barrier". This API can fail! If the frame has no | ||||
* callee, this API returns true with JSVAL_IS_VOID(*vp). | ||||
*/ | ||||
extern JS_PUBLIC_API(JSBool) | ||||
JS_GetValidFrameCalleeObject(JSContext *cx, JSStackFrame *fp, jsval *vp); | ||||
/************************************************************************/ | /************************************************************************/ | |||
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); | |||
skipping to change at line 584 | skipping to change at line 550 | |||
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); | |||
/* Call the context debug handler on the topmost scripted frame. */ | ||||
extern JS_FRIEND_API(JSBool) | ||||
js_CallContextDebugHandler(JSContext *cx); | ||||
JS_END_EXTERN_C | JS_END_EXTERN_C | |||
#endif /* jsdbgapi_h___ */ | #endif /* jsdbgapi_h___ */ | |||
End of changes. 7 change blocks. | ||||
46 lines changed or deleted | 7 lines changed or added | |||
jsfriendapi.h | jsfriendapi.h | |||
---|---|---|---|---|
skipping to change at line 192 | skipping to change at line 192 | |||
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 | |||
namespace js { | namespace js { | |||
struct ContextFriendFields { | ||||
JSRuntime *const runtime; | ||||
ContextFriendFields(JSRuntime *rt) | ||||
: runtime(rt) { } | ||||
static const ContextFriendFields *get(const JSContext *cx) { | ||||
return reinterpret_cast<const ContextFriendFields *>(cx); | ||||
} | ||||
}; | ||||
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. */ | |||
uintptr_t nativeStackLimit; | uintptr_t nativeStackLimit; | |||
skipping to change at line 523 | skipping to change at line 512 | |||
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(const JSObject *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 jsxdrapi.h' | * operand of JSOP_ITER, so don't change them without advancing vm/Xdr.h's | |||
s | * XDR_BYTECODE_VERSION. | |||
* JSXDR_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 * / | |||
#define JSITER_HIDDEN 0x10 /* also enumerate non-enumerable properties */ | #define JSITER_HIDDEN 0x10 /* also enumerate non-enumerable properties */ | |||
#define JSITER_FOR_OF 0x20 /* harmony for-of loop */ | #define JSITER_FOR_OF 0x20 /* harmony for-of loop */ | |||
inline uintptr_t | inline uintptr_t | |||
GetNativeStackLimit(const JSRuntime *rt) | GetNativeStackLimit(const JSRuntime *rt) | |||
skipping to change at line 572 | skipping to change at line 561 | |||
JS_FRIEND_API(JSString *) | JS_FRIEND_API(JSString *) | |||
GetPCCountScriptContents(JSContext *cx, size_t script); | GetPCCountScriptContents(JSContext *cx, size_t script); | |||
#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); | |||
class JS_FRIEND_API(AutoSkipConservativeScan) | ||||
{ | ||||
public: | ||||
AutoSkipConservativeScan(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) | ||||
; | ||||
~AutoSkipConservativeScan(); | ||||
private: | ||||
JSContext *context; | ||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER | ||||
}; | ||||
#endif | #endif | |||
JS_FRIEND_API(JSCompartment *) | JS_FRIEND_API(JSCompartment *) | |||
GetContextCompartment(const JSContext *cx); | GetContextCompartment(const JSContext *cx); | |||
JS_FRIEND_API(bool) | JS_FRIEND_API(bool) | |||
HasUnrootedGlobal(const JSContext *cx); | HasUnrootedGlobal(const JSContext *cx); | |||
typedef void | typedef void | |||
(* ActivityCallback)(void *arg, JSBool active); | (* ActivityCallback)(void *arg, JSBool active); | |||
skipping to change at line 670 | skipping to change at line 648 | |||
#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 | |||
}; | }; | |||
} /* namespace gcreason */ | } /* namespace gcreason */ | |||
extern JS_FRIEND_API(void) | extern JS_FRIEND_API(void) | |||
GCForReason(JSContext *cx, gcreason::Reason reason); | PrepareCompartmentForGC(JSCompartment *comp); | |||
extern JS_FRIEND_API(void) | extern JS_FRIEND_API(void) | |||
CompartmentGCForReason(JSContext *cx, JSCompartment *comp, gcreason::Reason | PrepareForFullGC(JSRuntime *rt); | |||
reason); | ||||
/* | ||||
* 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 | ||||
* PrepareCompartmentForGC on each compartment, or you can call PrepareForF | ||||
ullGC | ||||
* to select all compartments. Failing to select any compartment is an erro | ||||
r. | ||||
*/ | ||||
extern JS_FRIEND_API(void) | extern JS_FRIEND_API(void) | |||
ShrinkingGC(JSContext *cx, gcreason::Reason reason); | GCForReason(JSRuntime *rt, gcreason::Reason reason); | |||
extern JS_FRIEND_API(void) | extern JS_FRIEND_API(void) | |||
IncrementalGC(JSContext *cx, gcreason::Reason reason); | ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); | |||
extern JS_FRIEND_API(void) | ||||
IncrementalGC(JSRuntime *rt, gcreason::Reason reason); | ||||
extern JS_FRIEND_API(void) | extern JS_FRIEND_API(void) | |||
SetGCSliceTimeBudget(JSContext *cx, int64_t millis); | SetGCSliceTimeBudget(JSContext *cx, int64_t millis); | |||
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) | |||
skipping to change at line 701 | skipping to change at line 689 | |||
* ... | * ... | |||
* JSGC_SLICE_BEGIN, JSGC_CYCLE_END (last slice) | * JSGC_SLICE_BEGIN, JSGC_CYCLE_END (last slice) | |||
*/ | */ | |||
GC_CYCLE_BEGIN, | GC_CYCLE_BEGIN, | |||
GC_SLICE_BEGIN, | GC_SLICE_BEGIN, | |||
GC_SLICE_END, | GC_SLICE_END, | |||
GC_CYCLE_END | GC_CYCLE_END | |||
}; | }; | |||
struct GCDescription { | struct JS_FRIEND_API(GCDescription) { | |||
const char *logMessage; | ||||
bool isCompartment; | bool isCompartment; | |||
GCDescription(const char *msg, bool isCompartment) | GCDescription(bool isCompartment) | |||
: logMessage(msg), isCompartment(isCompartment) {} | : isCompartment(isCompartment) {} | |||
jschar *formatMessage(JSRuntime *rt) 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); | |||
extern JS_FRIEND_API(bool) | ||||
WantGCSlice(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(JSContext *cx); | 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); | |||
skipping to change at line 763 | skipping to change at line 750 | |||
ObjectPtr(JSObject *obj) : value(obj) {} | ObjectPtr(JSObject *obj) : value(obj) {} | |||
/* Always call finalize before the destructor. */ | /* Always call finalize before the destructor. */ | |||
~ObjectPtr() { JS_ASSERT(!value); } | ~ObjectPtr() { JS_ASSERT(!value); } | |||
void finalize(JSRuntime *rt) { | void finalize(JSRuntime *rt) { | |||
if (IsIncrementalBarrierNeeded(rt)) | if (IsIncrementalBarrierNeeded(rt)) | |||
IncrementalReferenceBarrier(value); | IncrementalReferenceBarrier(value); | |||
value = NULL; | value = NULL; | |||
} | } | |||
void finalize(JSContext *cx) { finalize(JS_GetRuntime(cx)); } | ||||
void init(JSObject *obj) { value = obj; } | void init(JSObject *obj) { value = obj; } | |||
JSObject *get() const { return value; } | JSObject *get() const { return value; } | |||
void writeBarrierPre(JSRuntime *rt) { | void writeBarrierPre(JSRuntime *rt) { | |||
IncrementalReferenceBarrier(value); | IncrementalReferenceBarrier(value); | |||
} | } | |||
ObjectPtr &operator=(JSObject *obj) { | ObjectPtr &operator=(JSObject *obj) { | |||
skipping to change at line 787 | skipping to change at line 773 | |||
} | } | |||
JSObject &operator*() const { return *value; } | JSObject &operator*() const { return *value; } | |||
JSObject *operator->() const { return value; } | JSObject *operator->() const { return value; } | |||
operator JSObject *() const { return value; } | operator JSObject *() const { return value; } | |||
}; | }; | |||
extern JS_FRIEND_API(JSObject *) | extern JS_FRIEND_API(JSObject *) | |||
GetTestingFunctions(JSContext *cx); | GetTestingFunctions(JSContext *cx); | |||
/* | ||||
* Helper to convert FreeOp to JSFreeOp when the definition of FreeOp is no | ||||
t | ||||
* available and the compiler does not know that FreeOp inherits from | ||||
* JSFreeOp. | ||||
*/ | ||||
inline JSFreeOp * | ||||
CastToJSFreeOp(FreeOp *fop) | ||||
{ | ||||
return reinterpret_cast<JSFreeOp *>(fop); | ||||
} | ||||
/* Implemented in jsexn.cpp. */ | ||||
/* | ||||
* Get an error type name from a number. | ||||
* If no exception is associated, return NULL. | ||||
*/ | ||||
extern JS_FRIEND_API(const jschar*) | ||||
GetErrorTypeNameFromNumber(JSContext* cx, const unsigned errorNumber); | ||||
} /* 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*) | |||
*/ | */ | |||
skipping to change at line 825 | skipping to change at line 831 | |||
} JSErrNum; | } JSErrNum; | |||
extern JS_FRIEND_API(const JSErrorFormatString *) | extern JS_FRIEND_API(const JSErrorFormatString *) | |||
js_GetErrorMessage(void *userRef, const char *locale, const unsigned errorN umber); | js_GetErrorMessage(void *userRef, const char *locale, const unsigned errorN umber); | |||
/* Implemented in jsclone.cpp. */ | /* Implemented in jsclone.cpp. */ | |||
extern JS_FRIEND_API(uint64_t) | extern JS_FRIEND_API(uint64_t) | |||
js_GetSCOffset(JSStructuredCloneWriter* writer); | js_GetSCOffset(JSStructuredCloneWriter* writer); | |||
/* Typed Array functions, implemented in jstypedarray.cpp */ | ||||
#ifdef __cplusplus | ||||
namespace js { | ||||
namespace ArrayBufferView { | ||||
enum ViewType { | ||||
TYPE_INT8 = 0, | ||||
TYPE_UINT8, | ||||
TYPE_INT16, | ||||
TYPE_UINT16, | ||||
TYPE_INT32, | ||||
TYPE_UINT32, | ||||
TYPE_FLOAT32, | ||||
TYPE_FLOAT64, | ||||
/* | ||||
* Special type that is a uint8_t, but assignments are clamped to [0, 2 | ||||
56). | ||||
* Treat the raw data type as a uint8_t. | ||||
*/ | ||||
TYPE_UINT8_CLAMPED, | ||||
TYPE_MAX | ||||
}; | ||||
} /* namespace ArrayBufferView */ | ||||
} /* namespace js */ | ||||
typedef js::ArrayBufferView::ViewType JSArrayBufferViewType; | ||||
#else | ||||
typedef uint32_t JSArrayBufferViewType; | ||||
#endif /* __cplusplus */ | ||||
/* | ||||
* Create a new typed array with nelements elements. | ||||
*/ | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt8Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8ClampedArray(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt16Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint16Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt32Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint32Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat32Array(JSContext *cx, uint32_t nelements); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat64Array(JSContext *cx, uint32_t nelements); | ||||
/* | ||||
* Create a new typed array and copy in values from the given object. The | ||||
* object is used as if it were an array; that is, the new array (if | ||||
* successfully created) will have length given by array.length, and its | ||||
* elements will be those specified by array[0], array[1], and so on, after | ||||
* conversion to the typed array element type. | ||||
*/ | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt8ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8ClampedArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt16ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint16ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt32ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint32ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat32ArrayFromArray(JSContext *cx, JSObject *array); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat64ArrayFromArray(JSContext *cx, JSObject *array); | ||||
/* | ||||
* Create a new typed array using the given ArrayBuffer for storage. byteOf | ||||
fset | ||||
* must not exceed (signed) INT32_MAX. The length value is optional; if -1 | ||||
is | ||||
* passed, enough elements to use up the remainder of the byte array is use | ||||
d as | ||||
* the default value. | ||||
*/ | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt8ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint8ClampedArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt16ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint16ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewInt32ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewUint32ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat32ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewFloat64ArrayWithBuffer(JSContext *cx, JSObject *arrayBuffer, | ||||
uint32_t byteOffset, int32_t length); | ||||
/* | ||||
* Create a new ArrayBuffer with the given byte length. | ||||
*/ | ||||
extern JS_FRIEND_API(JSObject *) | ||||
JS_NewArrayBuffer(JSContext *cx, uint32_t nbytes); | ||||
/* | ||||
* 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 | ||||
* 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. | ||||
*/ | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsTypedArrayObject(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Test for specific typed array types (ArrayBufferView subtypes) | ||||
*/ | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsInt8Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsUint8Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsUint8ClampedArray(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsInt16Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsUint16Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsInt32Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsUint32Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsFloat32Array(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsFloat64Array(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Get the type of elements in a typed array. | ||||
* | ||||
* |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 | ||||
* 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. | ||||
*/ | ||||
extern JS_FRIEND_API(JSArrayBufferViewType) | ||||
JS_GetTypedArrayType(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Check whether obj supports the JS_GetArrayBuffer* APIs. Note that this m | ||||
ay | ||||
* return false if a security wrapper is encountered that denies the | ||||
* unwrapping. If this test succeeds, then it is safe to call the various | ||||
* accessor JSAPI calls defined below. | ||||
*/ | ||||
extern JS_FRIEND_API(JSBool) | ||||
JS_IsArrayBufferObject(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Return the available byte length of an array buffer. | ||||
* | ||||
* |obj| must have passed a JS_IsArrayBufferObject test, or somehow be know | ||||
n | ||||
* that it would pass such a test: it is an ArrayBuffer or a wrapper of an | ||||
* ArrayBuffer, and the unwrapping will succeed. If cx is NULL, then DEBUG | ||||
* builds may be unable to assert when unwrapping should be disallowed. | ||||
*/ | ||||
extern JS_FRIEND_API(uint32_t) | ||||
JS_GetArrayBufferByteLength(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Return a pointer to an array buffer's data. The buffer is still owned by | ||||
the | ||||
* array buffer object, and should not be modified on another thread. | ||||
* | ||||
* |obj| must have passed a JS_IsArrayBufferObject test, or somehow be know | ||||
n | ||||
* that it would pass such a test: it is an ArrayBuffer or a wrapper of an | ||||
* ArrayBuffer, and the unwrapping will succeed. If cx is NULL, then DEBUG | ||||
* builds may be unable to assert when unwrapping should be disallowed. | ||||
*/ | ||||
extern JS_FRIEND_API(uint8_t *) | ||||
JS_GetArrayBufferData(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Return the number of elements in a typed array. | ||||
* | ||||
* |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 | ||||
* 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. | ||||
*/ | ||||
extern JS_FRIEND_API(uint32_t) | ||||
JS_GetTypedArrayLength(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Return the byte offset from the start of an array buffer to the start of | ||||
a | ||||
* typed array view. | ||||
* | ||||
* |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 | ||||
* 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. | ||||
*/ | ||||
extern JS_FRIEND_API(uint32_t) | ||||
JS_GetTypedArrayByteOffset(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Return the byte length of a typed array. | ||||
* | ||||
* |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 | ||||
* 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. | ||||
*/ | ||||
extern JS_FRIEND_API(uint32_t) | ||||
JS_GetTypedArrayByteLength(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* More generic name for JS_GetTypedArrayByteLength to cover DataViews as w | ||||
ell | ||||
*/ | ||||
extern JS_FRIEND_API(uint32_t) | ||||
JS_GetArrayBufferViewByteLength(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* 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 | ||||
* another thread. | ||||
* | ||||
* |obj| must have passed a JS_Is*Array test, or somehow be known that it w | ||||
ould | ||||
* pass such a test: it is a typed array or a wrapper of a typed array, and | ||||
the | ||||
* unwrapping will succeed. If cx is NULL, then DEBUG builds may be unable | ||||
to | ||||
* assert when unwrapping should be disallowed. | ||||
*/ | ||||
extern JS_FRIEND_API(int8_t *) | ||||
JS_GetInt8ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(uint8_t *) | ||||
JS_GetUint8ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(uint8_t *) | ||||
JS_GetUint8ClampedArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(int16_t *) | ||||
JS_GetInt16ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(uint16_t *) | ||||
JS_GetUint16ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(int32_t *) | ||||
JS_GetInt32ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(uint32_t *) | ||||
JS_GetUint32ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(float *) | ||||
JS_GetFloat32ArrayData(JSObject *obj, JSContext *cx); | ||||
extern JS_FRIEND_API(double *) | ||||
JS_GetFloat64ArrayData(JSObject *obj, JSContext *cx); | ||||
/* | ||||
* Same as above, but for any kind of ArrayBufferView. Prefer the type-spec | ||||
ific | ||||
* versions when possible. | ||||
*/ | ||||
extern JS_FRIEND_API(void *) | ||||
JS_GetArrayBufferViewData(JSObject *obj, JSContext *cx); | ||||
#endif /* jsfriendapi_h___ */ | #endif /* jsfriendapi_h___ */ | |||
End of changes. 14 change blocks. | ||||
40 lines changed or deleted | 355 lines changed or added | |||
jsgc.h | jsgc.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
* 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 "jsdhash.h" | ||||
#include "jslock.h" | #include "jslock.h" | |||
#include "jsutil.h" | #include "jsutil.h" | |||
#include "jsversion.h" | #include "jsversion.h" | |||
#include "jscell.h" | #include "jscell.h" | |||
#include "ds/BitArray.h" | #include "ds/BitArray.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" | |||
skipping to change at line 88 | skipping to change at line 87 | |||
class GCHelperThread; | class GCHelperThread; | |||
struct Shape; | struct Shape; | |||
namespace gc { | namespace gc { | |||
enum State { | enum State { | |||
NO_INCREMENTAL, | NO_INCREMENTAL, | |||
MARK_ROOTS, | MARK_ROOTS, | |||
MARK, | MARK, | |||
SWEEP, | ||||
INVALID | INVALID | |||
}; | }; | |||
struct Arena; | struct Arena; | |||
/* | /* | |||
* This must be an upper bound, but we do not need the least upper bound, s o | * This must be an upper bound, but we do not need the least upper bound, s o | |||
* we just exclude non-background objects. | * we just exclude non-background objects. | |||
*/ | */ | |||
const size_t MAX_BACKGROUND_FINALIZE_KINDS = FINALIZE_LIMIT - FINALIZE_OBJE CT_LIMIT / 2; | const size_t MAX_BACKGROUND_FINALIZE_KINDS = FINALIZE_LIMIT - FINALIZE_OBJE CT_LIMIT / 2; | |||
skipping to change at line 596 | skipping to change at line 594 | |||
uintptr_t thingsStart(AllocKind thingKind) { | uintptr_t thingsStart(AllocKind thingKind) { | |||
return address() | firstThingOffset(thingKind); | return address() | firstThingOffset(thingKind); | |||
} | } | |||
uintptr_t thingsEnd() { | uintptr_t thingsEnd() { | |||
return address() + ArenaSize; | return address() + ArenaSize; | |||
} | } | |||
template <typename T> | template <typename T> | |||
bool finalize(JSContext *cx, AllocKind thingKind, size_t thingSize, boo l background); | bool finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize); | |||
}; | }; | |||
/* The chunk header (located at the end of the chunk to preserve arena alig nment). */ | /* The chunk header (located at the end of the chunk to preserve arena alig nment). */ | |||
struct ChunkInfo { | struct ChunkInfo { | |||
Chunk *next; | Chunk *next; | |||
Chunk **prevp; | Chunk **prevp; | |||
/* Free arenas are linked together with aheader.next. */ | /* Free arenas are linked together with aheader.next. */ | |||
ArenaHeader *freeArenasHead; | ArenaHeader *freeArenasHead; | |||
skipping to change at line 1254 | skipping to change at line 1252 | |||
#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(JSContext *cx); | void finalizeObjects(FreeOp *fop); | |||
void finalizeStrings(JSContext *cx); | void finalizeStrings(FreeOp *fop); | |||
void finalizeShapes(JSContext *cx); | void finalizeShapes(FreeOp *fop); | |||
void finalizeScripts(JSContext *cx); | void finalizeScripts(FreeOp *fop); | |||
#ifdef JS_THREADSAFE | #ifdef JS_THREADSAFE | |||
static void backgroundFinalize(JSContext *cx, ArenaHeader *listHead); | static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead); | |||
#endif | #endif | |||
private: | private: | |||
inline void finalizeNow(JSContext *cx, AllocKind thingKind); | inline void finalizeNow(FreeOp *fop, AllocKind thingKind); | |||
inline void finalizeLater(JSContext *cx, AllocKind thingKind); | inline void finalizeLater(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 1386 | skipping to change at line 1384 | |||
/* Must be called with GC lock taken. */ | /* Must be called with GC lock taken. */ | |||
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 | ||||
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; | |||
/* Pass NULL for |comp| to get a full GC. */ | ||||
extern void | extern void | |||
GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind, js::gcrea | GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); | |||
son::Reason reason); | ||||
extern void | ||||
GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reas | ||||
on); | ||||
extern void | extern void | |||
GCSlice(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind, js:: gcreason::Reason reason); | GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount); | |||
extern void | extern void | |||
GCDebugSlice(JSContext *cx, int64_t objCount); | 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 | #ifdef JS_THREADSAFE | |||
skipping to change at line 1444 | skipping to change at line 1447 | |||
*/ | */ | |||
static const size_t FREE_ARRAY_SIZE = size_t(1) << 16; | static const size_t FREE_ARRAY_SIZE = size_t(1) << 16; | |||
static const size_t FREE_ARRAY_LENGTH = FREE_ARRAY_SIZE / sizeof(void * ); | static const size_t FREE_ARRAY_LENGTH = FREE_ARRAY_SIZE / sizeof(void * ); | |||
JSRuntime *const rt; | JSRuntime *const rt; | |||
PRThread *thread; | PRThread *thread; | |||
PRCondVar *wakeup; | PRCondVar *wakeup; | |||
PRCondVar *done; | PRCondVar *done; | |||
volatile State state; | volatile State state; | |||
JSContext *finalizationContext; | 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 ; | Vector<js::gc::ArenaHeader *, 64, js::SystemAllocPolicy> finalizeVector ; | |||
bool backgroundAllocation; | bool backgroundAllocation; | |||
skipping to change at line 1480 | skipping to change at line 1483 | |||
/* Must be called with the GC lock taken. */ | /* Must be called with the GC lock taken. */ | |||
void doSweep(); | void doSweep(); | |||
public: | public: | |||
GCHelperThread(JSRuntime *rt) | GCHelperThread(JSRuntime *rt) | |||
: rt(rt), | : rt(rt), | |||
thread(NULL), | thread(NULL), | |||
wakeup(NULL), | wakeup(NULL), | |||
done(NULL), | done(NULL), | |||
state(IDLE), | state(IDLE), | |||
finalizationContext(NULL), | sweepFlag(false), | |||
shrinkFlag(false), | shrinkFlag(false), | |||
freeCursor(NULL), | freeCursor(NULL), | |||
freeCursorEnd(NULL), | freeCursorEnd(NULL), | |||
backgroundAllocation(true) | backgroundAllocation(true) | |||
{ } | { } | |||
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(JSContext *cx, 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 with the GC lock taken. */ | |||
void waitBackgroundSweepEnd(); | void waitBackgroundSweepEnd(); | |||
/* Must be called with the GC lock taken. */ | /* Must be called with the GC lock taken. */ | |||
void waitBackgroundSweepOrAllocEnd(); | void waitBackgroundSweepOrAllocEnd(); | |||
skipping to change at line 1729 | skipping to change at line 1732 | |||
SliceBudget(); | SliceBudget(); | |||
/* Instantiate as SliceBudget(Time/WorkBudget(n)). */ | /* Instantiate as SliceBudget(Time/WorkBudget(n)). */ | |||
SliceBudget(int64_t budget); | SliceBudget(int64_t budget); | |||
void reset() { | void reset() { | |||
deadline = INT64_MAX; | deadline = INT64_MAX; | |||
counter = INTPTR_MAX; | counter = INTPTR_MAX; | |||
} | } | |||
void step() { | void step(intptr_t amt = 1) { | |||
counter--; | counter -= amt; | |||
} | } | |||
bool checkOverBudget(); | bool checkOverBudget(); | |||
bool isOverBudget() { | bool isOverBudget() { | |||
if (counter > 0) | if (counter >= 0) | |||
return false; | return false; | |||
return checkOverBudget(); | return checkOverBudget(); | |||
} | } | |||
}; | }; | |||
static const size_t MARK_STACK_LENGTH = 32768; | static const size_t MARK_STACK_LENGTH = 32768; | |||
struct GCMarker : public JSTracer { | struct GCMarker : public JSTracer { | |||
private: | private: | |||
/* | /* | |||
skipping to change at line 1859 | skipping to change at line 1862 | |||
checkCompartment(ptr); | checkCompartment(ptr); | |||
uintptr_t addr = reinterpret_cast<uintptr_t>(ptr); | uintptr_t addr = reinterpret_cast<uintptr_t>(ptr); | |||
JS_ASSERT(!(addr & StackTagMask)); | JS_ASSERT(!(addr & StackTagMask)); | |||
if (!stack.push(addr | uintptr_t(tag))) | if (!stack.push(addr | uintptr_t(tag))) | |||
delayMarkingChildren(ptr); | delayMarkingChildren(ptr); | |||
} | } | |||
void pushValueArray(JSObject *obj, void *start, void *end) { | void pushValueArray(JSObject *obj, void *start, void *end) { | |||
checkCompartment(obj); | checkCompartment(obj); | |||
if (start == end) | ||||
return; | ||||
JS_ASSERT(start <= end); | JS_ASSERT(start <= end); | |||
uintptr_t tagged = reinterpret_cast<uintptr_t>(obj) | GCMarker::Val ueArrayTag; | uintptr_t tagged = reinterpret_cast<uintptr_t>(obj) | GCMarker::Val ueArrayTag; | |||
uintptr_t startAddr = reinterpret_cast<uintptr_t>(start); | uintptr_t startAddr = reinterpret_cast<uintptr_t>(start); | |||
uintptr_t endAddr = reinterpret_cast<uintptr_t>(end); | uintptr_t endAddr = reinterpret_cast<uintptr_t>(end); | |||
/* | /* | |||
* Push in the reverse order so obj will be on top. If we cannot pu sh | * Push in the reverse order so obj will be on top. If we cannot pu sh | |||
* the array, we trigger delay marking for the whole object. | * the array, we trigger delay marking for the whole object. | |||
*/ | */ | |||
if (!stack.push(endAddr, startAddr, tagged)) | if (!stack.push(endAddr, startAddr, tagged)) | |||
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 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 1992 | skipping to change at line 1993 | |||
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 ZealVerifierValue = 4; | |||
const int ZealFrameVerifierValue = 5; | const int ZealFrameVerifierValue = 5; | |||
#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(JSContext *cx); | VerifyBarriers(JSRuntime *rt); | |||
void | void | |||
MaybeVerifyBarriers(JSContext *cx, bool always = false); | MaybeVerifyBarriers(JSContext *cx, bool always = false); | |||
#else | #else | |||
static inline void | static inline void | |||
VerifyBarriers(JSContext *cx) | VerifyBarriers(JSRuntime *rt) | |||
{ | { | |||
} | } | |||
static inline void | static inline void | |||
MaybeVerifyBarriers(JSContext *cx, bool always = false) | MaybeVerifyBarriers(JSContext *cx, bool always = false) | |||
{ | { | |||
} | } | |||
#endif | #endif | |||
End of changes. 20 change blocks. | ||||
26 lines changed or deleted | 27 lines changed or added | |||
jsproxy.h | jsproxy.h | |||
---|---|---|---|---|
skipping to change at line 90 | skipping to change at line 90 | |||
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, JSObject *proxy, Class *clasp, N ative native, 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(JSContext *cx, JSObject *proxy); | virtual void finalize(JSFreeOp *fop, JSObject *proxy); | |||
virtual void trace(JSTracer *trc, 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 isOuterWindow() { | virtual bool isOuterWindow() { | |||
return false; | return false; | |||
} | } | |||
inline void *family() { | inline void *family() { | |||
return mFamily; | return mFamily; | |||
skipping to change at line 210 | skipping to change at line 210 | |||
} | } | |||
inline void | inline void | |||
SetProxyExtra(JSObject *obj, size_t n, const Value &extra) | SetProxyExtra(JSObject *obj, size_t n, const Value &extra) | |||
{ | { | |||
JS_ASSERT(IsProxy(obj)); | JS_ASSERT(IsProxy(obj)); | |||
JS_ASSERT(n <= 1); | JS_ASSERT(n <= 1); | |||
SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra); | SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra); | |||
} | } | |||
inline void | ||||
SetProxyHandler(JSObject *obj, ProxyHandler *handler) | ||||
{ | ||||
JS_ASSERT(IsProxy(obj)); | ||||
SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); | ||||
} | ||||
inline void | ||||
SetProxyPrivate(JSObject *obj, const Value &value) | ||||
{ | ||||
JS_ASSERT(IsProxy(obj)); | ||||
SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value); | ||||
} | ||||
JS_FRIEND_API(JSObject *) | JS_FRIEND_API(JSObject *) | |||
NewProxyObject(JSContext *cx, ProxyHandler *handler, const Value &priv, | NewProxyObject(JSContext *cx, ProxyHandler *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 *) | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 15 lines changed or added | |||
jsprvtd.h | jsprvtd.h | |||
---|---|---|---|---|
skipping to change at line 132 | skipping to change at line 132 | |||
struct ArgumentsData; | struct ArgumentsData; | |||
struct Class; | struct Class; | |||
class RegExpGuard; | class RegExpGuard; | |||
class RegExpObject; | class RegExpObject; | |||
class RegExpObjectBuilder; | class RegExpObjectBuilder; | |||
class RegExpShared; | class RegExpShared; | |||
class RegExpStatics; | class RegExpStatics; | |||
class MatchPairs; | class MatchPairs; | |||
class PropertyName; | ||||
namespace detail { class RegExpCode; } | namespace detail { class RegExpCode; } | |||
enum RegExpFlag | enum RegExpFlag | |||
{ | { | |||
IgnoreCaseFlag = 0x01, | IgnoreCaseFlag = 0x01, | |||
GlobalFlag = 0x02, | GlobalFlag = 0x02, | |||
MultilineFlag = 0x04, | MultilineFlag = 0x04, | |||
StickyFlag = 0x08, | StickyFlag = 0x08, | |||
skipping to change at line 252 | skipping to change at line 253 | |||
namespace types { | namespace types { | |||
class TypeSet; | class TypeSet; | |||
struct TypeCallsite; | struct TypeCallsite; | |||
struct TypeObject; | struct TypeObject; | |||
struct TypeCompartment; | struct TypeCompartment; | |||
} /* namespace types */ | } /* namespace types */ | |||
enum ThingRootKind | typedef JS::Handle<Shape*> HandleShape; | |||
{ | typedef JS::Handle<BaseShape*> HandleBaseShape; | |||
THING_ROOT_OBJECT, | typedef JS::Handle<types::TypeObject*> HandleTypeObject; | |||
THING_ROOT_SHAPE, | typedef JS::Handle<JSAtom*> HandleAtom; | |||
THING_ROOT_BASE_SHAPE, | typedef JS::Handle<PropertyName*> HandlePropertyName; | |||
THING_ROOT_TYPE_OBJECT, | ||||
THING_ROOT_STRING, | typedef JS::Root<Shape*> RootShape; | |||
THING_ROOT_SCRIPT, | typedef JS::Root<BaseShape*> RootBaseShape; | |||
THING_ROOT_ID, | typedef JS::Root<types::TypeObject*> RootTypeObject; | |||
THING_ROOT_VALUE, | typedef JS::Root<JSAtom*> RootAtom; | |||
THING_ROOT_LIMIT | typedef JS::Root<PropertyName*> RootPropertyName; | |||
typedef JS::RootedVar<Shape*> RootedVarShape; | ||||
typedef JS::RootedVar<BaseShape*> RootedVarBaseShape; | ||||
typedef JS::RootedVar<types::TypeObject*> RootedVarTypeObject; | ||||
typedef JS::RootedVar<JSAtom*> RootedVarAtom; | ||||
typedef JS::RootedVar<PropertyName*> RootedVarPropertyName; | ||||
enum XDRMode { | ||||
XDR_ENCODE, | ||||
XDR_DECODE | ||||
}; | }; | |||
template <typename T> class Root; | template <XDRMode mode> | |||
template <typename T> class RootedVar; | class XDRState; | |||
template <typename T> | ||||
struct RootMethods { }; | ||||
/* | ||||
* Reference to a stack location rooted for GC. See "Moving GC Stack Rootin | ||||
g" | ||||
* comment in jscntxt.h. | ||||
*/ | ||||
template <typename T> | ||||
class Handle | ||||
{ | ||||
public: | ||||
/* Copy handles of different types, with implicit coercion. */ | ||||
template <typename S> Handle(Handle<S> handle) { | ||||
testAssign<S>(); | ||||
ptr = reinterpret_cast<const T *>(handle.address()); | ||||
} | ||||
/* Get a handle from a rooted stack location, with implicit coercion. * | ||||
/ | ||||
template <typename S> inline Handle(const Root<S> &root); | ||||
template <typename S> inline Handle(const RootedVar<S> &root); | ||||
const T *address() { return ptr; } | ||||
operator T () { return value(); } | ||||
T operator ->() { return value(); } | ||||
private: | ||||
const T *ptr; | ||||
T value() { return *ptr; } | ||||
template <typename S> | ||||
void testAssign() { | ||||
#ifdef DEBUG | ||||
T a = RootMethods<T>::initial(); | ||||
S b = RootMethods<S>::initial(); | ||||
a = b; | ||||
(void)a; | ||||
#endif | ||||
} | ||||
}; | ||||
typedef Handle<JSObject*> HandleObject; | class FreeOp; | |||
typedef Handle<JSFunction*> HandleFunction; | ||||
typedef Handle<Shape*> HandleShape; | ||||
typedef Handle<BaseShape*> HandleBaseShape; | ||||
typedef Handle<types::TypeObject*> HandleTypeObject; | ||||
typedef Handle<JSString*> HandleString; | ||||
typedef Handle<JSAtom*> HandleAtom; | ||||
typedef Handle<jsid> HandleId; | ||||
typedef Handle<Value> HandleValue; | ||||
} /* namespace js */ | } /* namespace js */ | |||
namespace JSC { | namespace JSC { | |||
class ExecutableAllocator; | class ExecutableAllocator; | |||
} /* namespace JSC */ | } /* namespace JSC */ | |||
namespace WTF { | namespace WTF { | |||
skipping to change at line 381 | skipping to change at line 343 | |||
typedef void | typedef void | |||
(* JSNewScriptHook)(JSContext *cx, | (* JSNewScriptHook)(JSContext *cx, | |||
const char *filename, /* URL of script */ | const char *filename, /* URL of script */ | |||
unsigned lineno, /* first line */ | unsigned lineno, /* first line */ | |||
JSScript *script, | JSScript *script, | |||
JSFunction *fun, | JSFunction *fun, | |||
void *callerdata); | void *callerdata); | |||
/* called just before script destruction */ | /* called just before script destruction */ | |||
typedef void | typedef void | |||
(* JSDestroyScriptHook)(JSContext *cx, | (* JSDestroyScriptHook)(JSFreeOp *fop, | |||
JSScript *script, | JSScript *script, | |||
void *callerdata); | void *callerdata); | |||
typedef void | typedef void | |||
(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *st r, | (* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *st r, | |||
size_t length, void **listenerTSData, void *closure); | size_t length, void **listenerTSData, void *closure); | |||
/* | /* | |||
* This hook captures high level script execution and function calls (JS or | * This hook captures high level script execution and function calls (JS or | |||
* native). It is used by JS_SetExecuteHook to hook top level scripts and by | * native). It is used by JS_SetExecuteHook to hook top level scripts and by | |||
End of changes. 5 change blocks. | ||||
66 lines changed or deleted | 26 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 ***** | * ***** BEGIN LICENSE BLOCK ***** | |||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
* | * | |||
* The contents of this file are subject to the Mozilla Public License Vers ion | * 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 | * 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 | * the License. You may obtain a copy of the License at | |||
* http://www.mozilla.org/MPL/ | * http://www.mozilla.org/MPL/ | |||
* | * | |||
* Software distributed under the License is distributed on an "AS IS" basi s, | * Software distributed under the License is distributed on an "AS IS" basi s, | |||
skipping to change at line 229 | skipping to change at line 229 | |||
typedef struct JSPropertyName JSPropertyName; | typedef struct JSPropertyName JSPropertyName; | |||
typedef struct JSPropertySpec JSPropertySpec; | typedef struct JSPropertySpec JSPropertySpec; | |||
typedef struct JSRuntime JSRuntime; | typedef struct JSRuntime JSRuntime; | |||
typedef struct JSSecurityCallbacks JSSecurityCallbacks; | typedef struct JSSecurityCallbacks JSSecurityCallbacks; | |||
typedef struct JSStackFrame JSStackFrame; | typedef struct JSStackFrame JSStackFrame; | |||
typedef struct JSScript JSScript; | typedef struct JSScript JSScript; | |||
typedef struct JSStructuredCloneCallbacks JSStructuredCloneCallbacks; | typedef struct JSStructuredCloneCallbacks JSStructuredCloneCallbacks; | |||
typedef struct JSStructuredCloneReader JSStructuredCloneReader; | typedef struct JSStructuredCloneReader JSStructuredCloneReader; | |||
typedef struct JSStructuredCloneWriter JSStructuredCloneWriter; | typedef struct JSStructuredCloneWriter JSStructuredCloneWriter; | |||
typedef struct JSTracer JSTracer; | typedef struct JSTracer JSTracer; | |||
typedef struct JSXDRState JSXDRState; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
class JSFlatString; | class JSFlatString; | |||
class JSString; | class JSString; | |||
#else | #else | |||
typedef struct JSFlatString JSFlatString; | typedef struct JSFlatString JSFlatString; | |||
typedef struct JSString JSString; | typedef struct JSString JSString; | |||
#endif | #endif /* !__cplusplus */ | |||
#ifdef JS_THREADSAFE | #ifdef JS_THREADSAFE | |||
typedef struct PRCallOnceType JSCallOnceType; | typedef struct PRCallOnceType JSCallOnceType; | |||
#else | #else | |||
typedef JSBool JSCallOnceType; | typedef JSBool JSCallOnceType; | |||
#endif | #endif | |||
typedef JSBool (*JSInitCallback)(void); | typedef JSBool (*JSInitCallback)(void); | |||
JS_END_EXTERN_C | JS_END_EXTERN_C | |||
#ifdef __cplusplus | ||||
namespace JS { | ||||
template <typename T> | ||||
class Root; | ||||
class SkipRoot; | ||||
enum ThingRootKind | ||||
{ | ||||
THING_ROOT_OBJECT, | ||||
THING_ROOT_SHAPE, | ||||
THING_ROOT_BASE_SHAPE, | ||||
THING_ROOT_TYPE_OBJECT, | ||||
THING_ROOT_STRING, | ||||
THING_ROOT_SCRIPT, | ||||
THING_ROOT_ID, | ||||
THING_ROOT_VALUE, | ||||
THING_ROOT_LIMIT | ||||
}; | ||||
struct ContextFriendFields { | ||||
JSRuntime *const runtime; | ||||
ContextFriendFields(JSRuntime *rt) | ||||
: runtime(rt) { } | ||||
static const ContextFriendFields *get(const JSContext *cx) { | ||||
return reinterpret_cast<const ContextFriendFields *>(cx); | ||||
} | ||||
static ContextFriendFields *get(JSContext *cx) { | ||||
return reinterpret_cast<ContextFriendFields *>(cx); | ||||
} | ||||
#ifdef JSGC_ROOT_ANALYSIS | ||||
/* | ||||
* Stack allocated GC roots for stack GC heap pointers, which may be | ||||
* overwritten if moved during a GC. | ||||
*/ | ||||
Root<void*> *thingGCRooters[THING_ROOT_LIMIT]; | ||||
#ifdef DEBUG | ||||
/* | ||||
* Stack allocated list of stack locations which hold non-relocatable | ||||
* 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 | ||||
* suppress false positives which occur when a rooting analysis treats | ||||
the | ||||
* location as holding a relocatable pointer, but have no other effect | ||||
on | ||||
* GC behavior. | ||||
*/ | ||||
SkipRoot *skipGCRooters; | ||||
#endif | ||||
#endif /* JSGC_ROOT_ANALYSIS */ | ||||
}; | ||||
} /* namespace JS */ | ||||
#endif /* __cplusplus */ | ||||
#endif /* jspubtd_h___ */ | #endif /* jspubtd_h___ */ | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 68 lines changed or added | |||
jsutil.h | jsutil.h | |||
---|---|---|---|---|
skipping to change at line 69 | skipping to change at line 69 | |||
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); | |||
return memcpy(dst, src, len); | return memcpy(dst, src, len); | |||
} | } | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
namespace js { | namespace js { | |||
template <class T> | template <class T> | |||
struct AlignmentTestStruct | ||||
{ | ||||
char c; | ||||
T t; | ||||
}; | ||||
/* This macro determines the alignment requirements of a type. */ | ||||
#define JS_ALIGNMENT_OF(t_) \ | ||||
(sizeof(js::AlignmentTestStruct<t_>) - sizeof(t_)) | ||||
template <class T> | ||||
class AlignedPtrAndFlag | class AlignedPtrAndFlag | |||
{ | { | |||
uintptr_t bits; | uintptr_t bits; | |||
public: | public: | |||
AlignedPtrAndFlag(T *t, bool flag) { | AlignedPtrAndFlag(T *t, bool flag) { | |||
JS_ASSERT((uintptr_t(t) & 1) == 0); | JS_ASSERT((uintptr_t(t) & 1) == 0); | |||
bits = uintptr_t(t) | uintptr_t(flag); | bits = uintptr_t(t) | uintptr_t(flag); | |||
} | } | |||
skipping to change at line 276 | skipping to change at line 287 | |||
for (T *p1 = one, *p2 = two; p1 != p1end; ++p1, ++p2) { | for (T *p1 = one, *p2 = two; p1 != p1end; ++p1, ++p2) { | |||
if (*p1 != *p2) | if (*p1 != *p2) | |||
return false; | return false; | |||
} | } | |||
return true; | return true; | |||
} | } | |||
return !memcmp(one, two, len * sizeof(T)); | return !memcmp(one, two, len * sizeof(T)); | |||
} | } | |||
template <class T> | ||||
JS_ALWAYS_INLINE static void | ||||
Swap(T &t, T &u) | ||||
{ | ||||
T tmp(Move(t)); | ||||
t = Move(u); | ||||
u = Move(tmp); | ||||
} | ||||
JS_ALWAYS_INLINE static size_t | JS_ALWAYS_INLINE static size_t | |||
UnsignedPtrDiff(const void *bigger, const void *smaller) | UnsignedPtrDiff(const void *bigger, const void *smaller) | |||
{ | { | |||
return size_t(bigger) - size_t(smaller); | return size_t(bigger) - size_t(smaller); | |||
} | } | |||
/* | /* | |||
* Ordinarily, a function taking a JSContext* 'cx' parameter reports errors on | * Ordinarily, a function taking a JSContext* 'cx' parameter reports errors on | |||
* the context. In some cases, functions optionally report and indicate thi s by | * the context. In some cases, functions optionally report and indicate thi s by | |||
* taking a nullable 'maybecx' parameter. In some cases, though, a function | * taking a nullable 'maybecx' parameter. In some cases, though, a function | |||
* always needs a 'cx', but optionally reports. This option is presented by the | * always needs a 'cx', but optionally reports. This option is presented by the | |||
* MaybeReportError. | * MaybeReportError. | |||
*/ | */ | |||
enum MaybeReportError { REPORT_ERROR = true, DONT_REPORT_ERROR = false }; | enum MaybeReportError { REPORT_ERROR = true, DONT_REPORT_ERROR = false }; | |||
/************************************************************************** | ||||
***/ | ||||
/* A bit array is an array of bits represented by an array of words (size_t | ||||
). */ | ||||
static inline unsigned | ||||
NumWordsForBitArrayOfLength(size_t length) | ||||
{ | ||||
return (length + (JS_BITS_PER_WORD - 1)) / JS_BITS_PER_WORD; | ||||
} | ||||
static inline unsigned | ||||
BitArrayIndexToWordIndex(size_t length, size_t bitIndex) | ||||
{ | ||||
unsigned wordIndex = bitIndex / JS_BITS_PER_WORD; | ||||
JS_ASSERT(wordIndex < length); | ||||
return wordIndex; | ||||
} | ||||
static inline size_t | ||||
BitArrayIndexToWordMask(size_t i) | ||||
{ | ||||
return size_t(1) << (i % JS_BITS_PER_WORD); | ||||
} | ||||
static inline bool | ||||
IsBitArrayElementSet(size_t *array, size_t length, size_t i) | ||||
{ | ||||
return array[BitArrayIndexToWordIndex(length, i)] & BitArrayIndexToWord | ||||
Mask(i); | ||||
} | ||||
static inline bool | ||||
IsAnyBitArrayElementSet(size_t *array, size_t length) | ||||
{ | ||||
unsigned numWords = NumWordsForBitArrayOfLength(length); | ||||
for (unsigned i = 0; i < numWords; ++i) { | ||||
if (array[i]) | ||||
return true; | ||||
} | ||||
return false; | ||||
} | ||||
static inline void | ||||
SetBitArrayElement(size_t *array, size_t length, size_t i) | ||||
{ | ||||
array[BitArrayIndexToWordIndex(length, i)] |= BitArrayIndexToWordMask(i | ||||
); | ||||
} | ||||
static inline void | ||||
ClearBitArrayElement(size_t *array, size_t length, size_t i) | ||||
{ | ||||
array[BitArrayIndexToWordIndex(length, i)] &= ~BitArrayIndexToWordMask( | ||||
i); | ||||
} | ||||
static inline void | ||||
ClearAllBitArrayElements(size_t *array, size_t length) | ||||
{ | ||||
for (unsigned i = 0; i < length; ++i) | ||||
array[i] = 0; | ||||
} | ||||
} /* namespace js */ | } /* namespace js */ | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
/* | /* | |||
* JS_ROTATE_LEFT32 | * JS_ROTATE_LEFT32 | |||
* | * | |||
* There is no rotate operation in the C Language so the construct (a << 4) | | * 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 | * (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 | * 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 | * MSVC to generate a rotate instruction, we have to use the _rotl intrinsi c | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 85 lines changed or added | |||
jsval.h | jsval.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
* use your version of this file under the terms of the MPL, indicate your | * 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 | * 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 | * 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 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. | * the terms of any one of the MPL, the GPL or the LGPL. | |||
* | * | |||
* ***** END LICENSE BLOCK ***** */ | * ***** 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 "js/Utility.h" | ||||
JS_BEGIN_EXTERN_C | ||||
/************************************************************************** ****/ | #include "mozilla/FloatingPoint.h" | |||
/* To avoid a circular dependency, pull in the necessary pieces of jsnum.h. | #include "js/Utility.h" | |||
*/ | ||||
#define JSDOUBLE_SIGNBIT (((uint64_t) 1) << 63) | ||||
#define JSDOUBLE_EXPMASK (((uint64_t) 0x7ff) << 52) | ||||
#define JSDOUBLE_MANTMASK ((((uint64_t) 1) << 52) - 1) | ||||
#define JSDOUBLE_HI32_SIGNBIT 0x80000000 | ||||
static JS_ALWAYS_INLINE JSBool | ||||
JSDOUBLE_IS_NEGZERO(double d) | ||||
{ | ||||
union { | ||||
struct { | ||||
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA) | ||||
uint32_t lo, hi; | ||||
#else | ||||
uint32_t hi, lo; | ||||
#endif | ||||
} s; | ||||
double d; | ||||
} x; | ||||
if (d != 0) | ||||
return JS_FALSE; | ||||
x.d = d; | ||||
return (x.s.hi & JSDOUBLE_HI32_SIGNBIT) != 0; | ||||
} | ||||
static JS_ALWAYS_INLINE JSBool | ||||
JSDOUBLE_IS_INT32(double d, int32_t* pi) | ||||
{ | ||||
if (JSDOUBLE_IS_NEGZERO(d)) | ||||
return JS_FALSE; | ||||
return d == (*pi = (int32_t)d); | ||||
} | ||||
/************************************************************************** ****/ | 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))) | |||
#elif defined(_MSC_VER) | #elif defined(_MSC_VER) | |||
/* | /* | |||
* Structs can be aligned with MSVC, but not if they are used as paramete rs, | * Structs can be aligned with MSVC, but not if they are used as paramete rs, | |||
skipping to change at line 118 | skipping to change at line 84 | |||
/* | /* | |||
* We try to use enums so that printing a jsval_layout in the debugger show s | * We try to use enums so that printing a jsval_layout in the debugger show s | |||
* nice symbolic type tags, however we can only do this when we can force t he | * nice symbolic type tags, however we can only do this when we can force t he | |||
* underlying type of the enum to be the desired size. | * underlying type of the enum to be the desired size. | |||
*/ | */ | |||
#if defined(__cplusplus) && !defined(__SUNPRO_CC) && !defined(__xlC__) | #if defined(__cplusplus) && !defined(__SUNPRO_CC) && !defined(__xlC__) | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
# define JS_ENUM_HEADER(id, type) enum id : type | # define JS_ENUM_HEADER(id, type) enum id : type | |||
# define JS_ENUM_MEMBER(id, type, value) id = (type)value, | ||||
# define JS_LAST_ENUM_MEMBER(id, type, value) id = (type)value | ||||
# define JS_ENUM_FOOTER(id) | # define JS_ENUM_FOOTER(id) | |||
#else | #else | |||
# define JS_ENUM_HEADER(id, type) enum id | # define JS_ENUM_HEADER(id, type) enum id | |||
# define JS_ENUM_MEMBER(id, type, value) id = (type)value, | ||||
# define JS_LAST_ENUM_MEMBER(id, type, value) id = (type)value | ||||
# define JS_ENUM_FOOTER(id) __attribute__((packed)) | # define JS_ENUM_FOOTER(id) __attribute__((packed)) | |||
#endif | #endif | |||
/* Remember to propagate changes to the C defines below. */ | /* Remember to propagate changes to the C defines below. */ | |||
JS_ENUM_HEADER(JSValueType, uint8_t) | JS_ENUM_HEADER(JSValueType, uint8_t) | |||
{ | { | |||
JSVAL_TYPE_DOUBLE = 0x00, | JSVAL_TYPE_DOUBLE = 0x00, | |||
JSVAL_TYPE_INT32 = 0x01, | JSVAL_TYPE_INT32 = 0x01, | |||
JSVAL_TYPE_UNDEFINED = 0x02, | JSVAL_TYPE_UNDEFINED = 0x02, | |||
JSVAL_TYPE_BOOLEAN = 0x03, | JSVAL_TYPE_BOOLEAN = 0x03, | |||
skipping to change at line 278 | skipping to change at line 240 | |||
#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_ NULL | #define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_ NULL | |||
#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_ OBJECT | #define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_ OBJECT | |||
#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_ UNDEFINED | #define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_ UNDEFINED | |||
#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_ STRING | #define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_ STRING | |||
#endif /* JS_BITS_PER_WORD */ | #endif /* JS_BITS_PER_WORD */ | |||
typedef enum JSWhyMagic | typedef enum JSWhyMagic | |||
{ | { | |||
JS_ARRAY_HOLE, /* a hole in a dense array */ | JS_ARRAY_HOLE, /* a hole in a dense array */ | |||
JS_ARGS_HOLE, /* a hole in the args object's array */ | ||||
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_UNASSIGNED_ARGUMENTS, /* the initial value of callobj.arguments */ | |||
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_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 { | |||
End of changes. 10 change blocks. | ||||
44 lines changed or deleted | 6 lines changed or added | |||
jsversion.h | jsversion.h | |||
---|---|---|---|---|
skipping to change at line 82 | skipping to change at line 82 | |||
* implement, e.g., iterators and generators, we are dropping support for a ll | * implement, e.g., iterators and generators, we are dropping support for a ll | |||
* versions <= 1.4. | * versions <= 1.4. | |||
*/ | */ | |||
#define JS_VERSION_ECMA_3 148 | #define JS_VERSION_ECMA_3 148 | |||
#define JS_VERSION_ECMA_3_TEST 149 | #define JS_VERSION_ECMA_3_TEST 149 | |||
#if JS_VERSION == JS_VERSION_ECMA_3 || \ | #if JS_VERSION == JS_VERSION_ECMA_3 || \ | |||
JS_VERSION == JS_VERSION_ECMA_3_TEST | JS_VERSION == JS_VERSION_ECMA_3_TEST | |||
#define JS_HAS_STR_HTML_HELPERS 0 /* has str.anchor, str.bold, etc. * / | #define JS_HAS_STR_HTML_HELPERS 0 /* has str.anchor, str.bold, etc. * / | |||
#define JS_HAS_PERL_SUBSTR 0 /* has str.substr */ | ||||
#if JS_VERSION == JS_VERSION_ECMA_3_TEST | #if JS_VERSION == JS_VERSION_ECMA_3_TEST | |||
#define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ | #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */ | |||
#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_XDR 0 /* has XDR API and internal support */ | ||||
#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_SPARSE_ARRAYS 0 /* array methods preserve empty ele ms */ | ||||
#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_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" | |||
#elif JS_VERSION == 150 | #elif JS_VERSION == 150 | |||
#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_PERL_SUBSTR 1 /* has str.substr */ | ||||
#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_XDR 1 /* has XDR API and internal support */ | ||||
#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_SPARSE_ARRAYS 0 /* array methods preserve empty ele ms */ | ||||
#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_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_PERL_SUBSTR 1 /* has str.substr */ | ||||
#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_XDR 1 /* has XDR API and internal support */ | ||||
#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_SPARSE_ARRAYS 0 /* array methods preserve empty ele ms */ | ||||
#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_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_PERL_SUBSTR 1 /* has str.substr */ | ||||
#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_XDR 1 /* has XDR API and internal support */ | ||||
#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_SPARSE_ARRAYS 0 /* array methods preserve empty ele ms */ | ||||
#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_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_PERL_SUBSTR 1 /* has str.substr */ | ||||
#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_XDR 1 /* has XDR API and internal support */ | ||||
#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_SPARSE_ARRAYS 0 /* array methods preserve empty ele ms */ | ||||
#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_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 */ | |||
skipping to change at line 212 | skipping to change at line 197 | |||
#define JS_HAS_MAKE_SYSTEM_OBJECT 1 | #define JS_HAS_MAKE_SYSTEM_OBJECT 1 | |||
/* Feature-test macro for evolving destructuring support. */ | /* Feature-test macro for evolving destructuring support. */ | |||
#define JS_HAS_DESTRUCTURING_SHORTHAND (JS_HAS_DESTRUCTURING == 2) | #define JS_HAS_DESTRUCTURING_SHORTHAND (JS_HAS_DESTRUCTURING == 2) | |||
/* | /* | |||
* Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy suppor t; | * Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy suppor t; | |||
* support likely to be made opt-in at some future time. | * support likely to be made opt-in at some future time. | |||
*/ | */ | |||
#define OLD_GETTER_SETTER_METHODS 1 | #define OLD_GETTER_SETTER_METHODS 1 | |||
/* A kill-switch for bug 586842. Embedders shouldn't touch this! */ | ||||
#define USE_NEW_OBJECT_REPRESENTATION 0 | ||||
#if USE_NEW_OBJECT_REPRESENTATION | ||||
# define NEW_OBJECT_REPRESENTATION_ONLY() ((void)0) | ||||
#else | ||||
# define NEW_OBJECT_REPRESENTATION_ONLY() \ | ||||
MOZ_NOT_REACHED("don't call this! to be used in the new object repres | ||||
entation") | ||||
#endif | ||||
End of changes. 16 change blocks. | ||||
15 lines changed or deleted | 0 lines changed or added | |||
jswrapper.h | jswrapper.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
#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; | |||
/* No-op wrapper handler base class. */ | /* Base class that just implements no-op forwarding methods for fundamental | |||
class JS_FRIEND_API(Wrapper) : public ProxyHandler | * traps. This is meant to be used as a base class for ProxyHandlers that | |||
* want transparent forwarding behavior but don't want to use the derived | ||||
* traps and other baggage of js::Wrapper. | ||||
*/ | ||||
class JS_FRIEND_API(AbstractWrapper) : public ProxyHandler | ||||
{ | { | |||
unsigned mFlags; | unsigned mFlags; | |||
public: | public: | |||
unsigned flags() const { return mFlags; } | unsigned flags() const { return mFlags; } | |||
explicit Wrapper(unsigned flags); | explicit AbstractWrapper(unsigned flags); | |||
typedef enum { PermitObjectAccess, PermitPropertyAccess, DenyAccess } P | ||||
ermission; | ||||
virtual ~Wrapper(); | ||||
/* 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; | |||
virtual bool getOwnPropertyNames(JSContext *cx, JSObject *wrapper, Auto IdVector &props) 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 delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *b p) MOZ_OVERRIDE; | |||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector & props) MOZ_OVERRIDE; | virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector & props) MOZ_OVERRIDE; | |||
virtual bool fix(JSContext *cx, JSObject *wrapper, Value *vp) MOZ_OVERR IDE; | virtual bool fix(JSContext *cx, JSObject *wrapper, Value *vp) MOZ_OVERR IDE; | |||
/* Policy enforcement traps. | ||||
* | ||||
* 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, | ||||
* |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, | ||||
* SET, and CALL are self-explanatory, but PUNCTURE requires more expla | ||||
nation: | ||||
* | ||||
* 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 | ||||
* 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 | ||||
* 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 | ||||
* should throw. This is the role of PUNCTURE. | ||||
* | ||||
* 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 | ||||
* anything that the wrapped object could access. This is a very powerf | ||||
ul | ||||
* permission, and thus should generally be denied for security wrapper | ||||
s | ||||
* except under very special circumstances. When |act| is PUNCTURE, |id | ||||
| | ||||
* should be JSID_VOID. | ||||
* */ | ||||
enum Action { GET, SET, CALL, PUNCTURE }; | ||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action ac | ||||
t, bool *bp); | ||||
virtual void leave(JSContext *cx, JSObject *wrapper); | ||||
static JSObject *wrappedObject(const JSObject *wrapper); | ||||
static AbstractWrapper *wrapperHandler(const JSObject *wrapper); | ||||
}; | ||||
/* No-op wrapper handler base class. */ | ||||
class JS_FRIEND_API(Wrapper) : public AbstractWrapper | ||||
{ | ||||
public: | ||||
explicit Wrapper(unsigned flags); | ||||
typedef enum { PermitObjectAccess, PermitPropertyAccess, DenyAccess } P | ||||
ermission; | ||||
virtual ~Wrapper(); | ||||
/* 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. */ | |||
skipping to change at line 103 | skipping to change at line 149 | |||
virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; | virtual JSType typeOf(JSContext *cx, JSObject *proxy) 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 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 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) MOZ_OVERRIDE; | virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp) MOZ_OVERRIDE; | |||
virtual void trace(JSTracer *trc, JSObject *wrapper) MOZ_OVERRIDE; | virtual void trace(JSTracer *trc, JSObject *wrapper) MOZ_OVERRIDE; | |||
/* Policy enforcement traps. */ | using AbstractWrapper::Action; | |||
enum Action { GET, SET, CALL }; | ||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action ac | ||||
t, bool *bp); | ||||
virtual void leave(JSContext *cx, JSObject *wrapper); | ||||
static Wrapper singleton; | static Wrapper singleton; | |||
static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSO bject *parent, | static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSO bject *parent, | |||
Wrapper *handler); | Wrapper *handler); | |||
static JSObject *wrappedObject(const JSObject *wrapper); | using AbstractWrapper::wrappedObject; | |||
static Wrapper *wrapperHandler(const JSObject *wrapper); | using AbstractWrapper::wrapperHandler; | |||
enum { | enum { | |||
CROSS_COMPARTMENT = 1 << 0, | CROSS_COMPARTMENT = 1 << 0, | |||
LAST_USED_FLAG = CROSS_COMPARTMENT | 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. */ | |||
skipping to change at line 229 | skipping to change at line 272 | |||
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 ue, | JS_FRIEND_API(JSObject *) UnwrapObject(JSObject *obj, bool stopAtOuter = tr ue, | |||
unsigned *flagsp = NULL); | unsigned *flagsp = NULL); | |||
// 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 | ||||
// code should never be unwrapping outer window wrappers, we always stop at | ||||
// outer windows. | ||||
JS_FRIEND_API(JSObject *) UnwrapObjectChecked(JSContext *cx, JSObject *obj) | ||||
; | ||||
bool IsCrossCompartmentWrapper(const JSObject *obj); | bool IsCrossCompartmentWrapper(const JSObject *obj); | |||
void | ||||
NukeCrossCompartmentWrapper(JSObject *wrapper); | ||||
} /* namespace js */ | } /* namespace js */ | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
15 lines changed or deleted | 85 lines changed or added | |||
lauxlib.h | lauxlib.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
#if defined(LUA_COMPAT_GETN) | #if defined(LUA_COMPAT_GETN) | |||
LUALIB_API int (luaL_getn) (lua_State *L, int t); | LUALIB_API int (luaL_getn) (lua_State *L, int t); | |||
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); | LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); | |||
#else | #else | |||
#define luaL_getn(L,i) ((int)lua_objlen(L, i)) | #define luaL_getn(L,i) ((int)lua_objlen(L, i)) | |||
#define luaL_setn(L,i,j) ((void)0) /* no op! */ | #define luaL_setn(L,i,j) ((void)0) /* no op! */ | |||
#endif | #endif | |||
#if defined(LUA_COMPAT_OPENLIB) | #if defined(LUA_COMPAT_OPENLIB) | |||
#define luaI_openlib luaL_openlib | #define luaI_openlib luaL_openlib | |||
#endif | #endif | |||
/* extra error code for `luaL_load' */ | /* extra error code for `luaL_load' */ | |||
#define LUA_ERRFILE (LUA_ERRERR+1) | #define LUA_ERRFILE (LUA_ERRERR+1) | |||
typedef struct luaL_Reg { | typedef struct luaL_Reg { | |||
const char *name; | const char *name; | |||
lua_CFunction func; | lua_CFunction func; | |||
} luaL_Reg; | } luaL_Reg; | |||
skipping to change at line 89 | skipping to change at line 89 | |||
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, | LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, | |||
const char *fname, int szhint); | const char *fname, int szhint); | |||
/* | /* | |||
** =============================================================== | ** =============================================================== | |||
** some useful macros | ** some useful macros | |||
** =============================================================== | ** =============================================================== | |||
*/ | */ | |||
#define luaL_argcheck(L, cond,numarg,extramsg) \ | #define luaL_argcheck(L, cond,numarg,extramsg) \ | |||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) | ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) | |||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) | |||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) | |||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) | #define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) | |||
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) | #define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) | |||
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) | #define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) | |||
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) | #define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) | |||
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) | #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) | |||
#define luaL_dofile(L, fn) \ | #define luaL_dofile(L, fn) \ | |||
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) | (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) | |||
#define luaL_dostring(L, s) \ | #define luaL_dostring(L, s) \ | |||
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) | (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) | |||
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) | #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) | |||
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) | #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) | |||
/* | /* | |||
** {====================================================== | ** {====================================================== | |||
** Generic Buffer manipulation | ** Generic Buffer manipulation | |||
** ======================================================= | ** ======================================================= | |||
*/ | */ | |||
typedef struct luaL_Buffer { | typedef struct luaL_Buffer { | |||
char *p; /* current position in buffer */ | char *p; /* current position in buffer */ | |||
int lvl; /* number of strings in the stack (level) */ | int lvl; /* number of strings in the stack (level) */ | |||
lua_State *L; | lua_State *L; | |||
char buffer[LUAL_BUFFERSIZE]; | char buffer[LUAL_BUFFERSIZE]; | |||
} luaL_Buffer; | } luaL_Buffer; | |||
#define luaL_addchar(B,c) \ | #define luaL_addchar(B,c) \ | |||
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ | ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ | |||
(*(B)->p++ = (char)(c))) | (*(B)->p++ = (char)(c))) | |||
/* compatibility only */ | /* compatibility only */ | |||
#define luaL_putchar(B,c) luaL_addchar(B,c) | #define luaL_putchar(B,c) luaL_addchar(B,c) | |||
#define luaL_addsize(B,n) ((B)->p += (n)) | #define luaL_addsize(B,n) ((B)->p += (n)) | |||
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); | LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); | |||
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); | LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); | |||
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l) ; | LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l) ; | |||
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); | LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); | |||
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); | LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); | |||
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); | LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); | |||
/* }====================================================== */ | /* }====================================================== */ | |||
skipping to change at line 154 | skipping to change at line 154 | |||
#define LUA_NOREF (-2) | #define LUA_NOREF (-2) | |||
#define LUA_REFNIL (-1) | #define LUA_REFNIL (-1) | |||
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ | #define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ | |||
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) | (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) | |||
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) | #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) | |||
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) | |||
#define luaL_reg luaL_Reg | #define luaL_reg luaL_Reg | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
lcode.h | lcode.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, | OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, | |||
OPR_CONCAT, | OPR_CONCAT, | |||
OPR_NE, OPR_EQ, | OPR_NE, OPR_EQ, | |||
OPR_LT, OPR_LE, OPR_GT, OPR_GE, | OPR_LT, OPR_LE, OPR_GT, OPR_GE, | |||
OPR_AND, OPR_OR, | OPR_AND, OPR_OR, | |||
OPR_NOBINOPR | OPR_NOBINOPR | |||
} BinOpr; | } BinOpr; | |||
typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; | |||
#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) | #define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) | |||
#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) | #define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx ) | |||
#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) | #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) | |||
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx ); | LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx ); | |||
LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); | LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); | |||
LUAI_FUNC void luaK_fixline (FuncState *fs, int line); | LUAI_FUNC void luaK_fixline (FuncState *fs, int line); | |||
LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); | LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); | |||
LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); | LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); | |||
LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); | LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); | |||
LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); | LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); | |||
LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); | LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); | |||
LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); | LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ldebug.h | ldebug.h | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ | |||
** Auxiliary functions from Debug Interface module | ** Auxiliary functions from Debug Interface module | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef ldebug_h | #ifndef ldebug_h | |||
#define ldebug_h | #define ldebug_h | |||
#include "lstate.h" | #include "lstate.h" | |||
#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) | |||
#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) | |||
#define resethookcount(L) (L->hookcount = L->basehookcount) | #define resethookcount(L) (L->hookcount = L->basehookcount) | |||
LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, | |||
const char *opname); | const char *opname); | |||
LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); | |||
LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, | |||
const TValue *p2); | const TValue *p2); | |||
LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, | |||
const TValue *p2); | const TValue *p2); | |||
LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); | |||
LUAI_FUNC void luaG_errormsg (lua_State *L); | LUAI_FUNC void luaG_errormsg (lua_State *L); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ldo.h | ldo.h | |||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef ldo_h | #ifndef ldo_h | |||
#define ldo_h | #define ldo_h | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "lstate.h" | #include "lstate.h" | |||
#include "lzio.h" | #include "lzio.h" | |||
#define luaD_checkstack(L,n) \ | #define luaD_checkstack(L,n) \ | |||
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ | if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ | |||
luaD_growstack(L, n); \ | luaD_growstack(L, n); \ | |||
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); | else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); | |||
#define incr_top(L) {luaD_checkstack(L,1); L->top++;} | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} | |||
#define savestack(L,p) ((char *)(p) - (char *)L->stack) | #define savestack(L,p) ((char *)(p) - (char *)L->stack) | |||
#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) | |||
#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) | #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) | |||
#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) | #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) | |||
/* results from luaD_precall */ | /* results from luaD_precall */ | |||
#define PCRLUA 0 /* initiated a call to a Lua function */ | #define PCRLUA 0 /* initiated a call to a Lua function */ | |||
#define PCRC 1 /* did a call to a C function */ | #define PCRC 1 /* did a call to a C function */ | |||
#define PCRYIELD 2 /* C funtion yielded */ | #define PCRYIELD 2 /* C funtion yielded */ | |||
/* type of protected functions, to be ran by `runprotected' */ | /* type of protected functions, to be ran by `runprotected' */ | |||
typedef void (*Pfunc) (lua_State *L, void *ud); | typedef void (*Pfunc) (lua_State *L, void *ud); | |||
LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) ; | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) ; | |||
LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); | LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); | |||
LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); | |||
LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); | |||
LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, | |||
ptrdiff_t oldtop, ptrdiff_t ef); | ptrdiff_t oldtop, ptrdiff_t ef); | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
lfunc.h | lfunc.h | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ | |||
** Auxiliary functions to manipulate prototypes and closures | ** Auxiliary functions to manipulate prototypes and closures | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef lfunc_h | #ifndef lfunc_h | |||
#define lfunc_h | #define lfunc_h | |||
#include "lobject.h" | #include "lobject.h" | |||
#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ | |||
cast(int, sizeof(TValue)*((n)-1))) | cast(int, sizeof(TValue)*((n)-1))) | |||
#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ | |||
cast(int, sizeof(TValue *)*((n)-1))) | cast(int, sizeof(TValue *)*((n)-1))) | |||
LUAI_FUNC Proto *luaF_newproto (lua_State *L); | LUAI_FUNC Proto *luaF_newproto (lua_State *L); | |||
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); | |||
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); | |||
LUAI_FUNC UpVal *luaF_newupval (lua_State *L); | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); | |||
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | |||
LUAI_FUNC void luaF_close (lua_State *L, StkId level); | LUAI_FUNC void luaF_close (lua_State *L, StkId level); | |||
LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); | |||
LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
lgc.h | lgc.h | |||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
*/ | */ | |||
#ifndef lgc_h | #ifndef lgc_h | |||
#define lgc_h | #define lgc_h | |||
#include "lobject.h" | #include "lobject.h" | |||
/* | /* | |||
** Possible states of the Garbage Collector | ** Possible states of the Garbage Collector | |||
*/ | */ | |||
#define GCSpause 0 | #define GCSpause 0 | |||
#define GCSpropagate 1 | #define GCSpropagate 1 | |||
#define GCSsweepstring 2 | #define GCSsweepstring 2 | |||
#define GCSsweep 3 | #define GCSsweep 3 | |||
#define GCSfinalize 4 | #define GCSfinalize 4 | |||
/* | /* | |||
** some userful bit tricks | ** some userful bit tricks | |||
*/ | */ | |||
#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) | |||
#define setbits(x,m) ((x) |= (m)) | #define setbits(x,m) ((x) |= (m)) | |||
#define testbits(x,m) ((x) & (m)) | #define testbits(x,m) ((x) & (m)) | |||
#define bitmask(b) (1<<(b)) | #define bitmask(b) (1<<(b)) | |||
#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) | #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) | |||
#define l_setbit(x,b) setbits(x, bitmask(b)) | #define l_setbit(x,b) setbits(x, bitmask(b)) | |||
#define resetbit(x,b) resetbits(x, bitmask(b)) | #define resetbit(x,b) resetbits(x, bitmask(b)) | |||
#define testbit(x,b) testbits(x, bitmask(b)) | #define testbit(x,b) testbits(x, bitmask(b)) | |||
#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) | #define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) | |||
#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) | #define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) | |||
#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) | #define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) | |||
/* | /* | |||
** Layout for bit use in `marked' field: | ** Layout for bit use in `marked' field: | |||
** bit 0 - object is white (type 0) | ** bit 0 - object is white (type 0) | |||
** bit 1 - object is white (type 1) | ** bit 1 - object is white (type 1) | |||
** bit 2 - object is black | ** bit 2 - object is black | |||
** bit 3 - for userdata: has been finalized | ** bit 3 - for userdata: has been finalized | |||
** bit 3 - for tables: has weak keys | ** bit 3 - for tables: has weak keys | |||
** bit 4 - for tables: has weak values | ** bit 4 - for tables: has weak values | |||
** bit 5 - object is fixed (should not be collected) | ** bit 5 - object is fixed (should not be collected) | |||
** bit 6 - object is "super" fixed (only the main thread) | ** bit 6 - object is "super" fixed (only the main thread) | |||
*/ | */ | |||
#define WHITE0BIT 0 | #define WHITE0BIT 0 | |||
#define WHITE1BIT 1 | #define WHITE1BIT 1 | |||
#define BLACKBIT 2 | #define BLACKBIT 2 | |||
#define FINALIZEDBIT 3 | #define FINALIZEDBIT 3 | |||
#define KEYWEAKBIT 3 | #define KEYWEAKBIT 3 | |||
#define VALUEWEAKBIT 4 | #define VALUEWEAKBIT 4 | |||
#define FIXEDBIT 5 | #define FIXEDBIT 5 | |||
#define SFIXEDBIT 6 | #define SFIXEDBIT 6 | |||
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) | #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) | |||
#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) | #define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) | |||
#define isblack(x) testbit((x)->gch.marked, BLACKBIT) | #define isblack(x) testbit((x)->gch.marked, BLACKBIT) | |||
#define isgray(x) (!isblack(x) && !iswhite(x)) | #define isgray(x) (!isblack(x) && !iswhite(x)) | |||
#define otherwhite(g) (g->currentwhite ^ WHITEBITS) | #define otherwhite(g) (g->currentwhite ^ WHITEBITS) | |||
#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) | #define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) | |||
#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) | #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) | |||
#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) | #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) | |||
#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) | #define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) | |||
#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) | #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) | |||
#define luaC_checkGC(L) { \ | #define luaC_checkGC(L) { \ | |||
condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ | condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ | |||
if (G(L)->totalbytes >= G(L)->GCthreshold) \ | if (G(L)->totalbytes >= G(L)->GCthreshold) \ | |||
luaC_step(L); } | luaC_step(L); } | |||
#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ | #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ | |||
luaC_barrierf(L,obj2gco(p),gcvalue(v)); } | luaC_barrierf(L,obj2gco(p),gcvalue(v)); } | |||
#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ | #define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ | |||
luaC_barrierback(L,t); } | luaC_barrierback(L,t); } | |||
#define luaC_objbarrier(L,p,o) \ | #define luaC_objbarrier(L,p,o) \ | |||
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ | { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ | |||
luaC_barrierf(L,obj2gco(p),obj2gco(o)); } | luaC_barrierf(L,obj2gco(p),obj2gco(o)); } | |||
#define luaC_objbarriert(L,t,o) \ | #define luaC_objbarriert(L,t,o) \ | |||
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } | { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } | |||
LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); | LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); | |||
LUAI_FUNC void luaC_callGCTM (lua_State *L); | LUAI_FUNC void luaC_callGCTM (lua_State *L); | |||
LUAI_FUNC void luaC_freeall (lua_State *L); | LUAI_FUNC void luaC_freeall (lua_State *L); | |||
LUAI_FUNC void luaC_step (lua_State *L); | LUAI_FUNC void luaC_step (lua_State *L); | |||
LUAI_FUNC void luaC_fullgc (lua_State *L); | LUAI_FUNC void luaC_fullgc (lua_State *L); | |||
LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); | LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); | |||
End of changes. 12 change blocks. | ||||
37 lines changed or deleted | 37 lines changed or added | |||
llex.h | llex.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
** Lexical Analyzer | ** Lexical Analyzer | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef llex_h | #ifndef llex_h | |||
#define llex_h | #define llex_h | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "lzio.h" | #include "lzio.h" | |||
#define FIRST_RESERVED 257 | #define FIRST_RESERVED 257 | |||
/* maximum length of a reserved word */ | /* maximum length of a reserved word */ | |||
#define TOKEN_LEN (sizeof("function")/sizeof(char)) | #define TOKEN_LEN (sizeof("function")/sizeof(char)) | |||
/* | /* | |||
* WARNING: if you change the order of this enumeration, | * WARNING: if you change the order of this enumeration, | |||
* grep "ORDER RESERVED" | * grep "ORDER RESERVED" | |||
*/ | */ | |||
enum RESERVED { | enum RESERVED { | |||
/* terminal symbols denoted by reserved words */ | /* terminal symbols denoted by reserved words */ | |||
TK_AND = FIRST_RESERVED, TK_BREAK, | TK_AND = FIRST_RESERVED, TK_BREAK, | |||
TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, | |||
TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, | TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, | |||
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, | |||
/* other terminal symbols */ | /* other terminal symbols */ | |||
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, | TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, | |||
TK_NAME, TK_STRING, TK_EOS | TK_NAME, TK_STRING, TK_EOS | |||
}; | }; | |||
/* number of reserved words */ | /* number of reserved words */ | |||
#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) | #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) | |||
/* array with token `names' */ | /* array with token `names' */ | |||
LUAI_DATA const char *const luaX_tokens []; | LUAI_DATA const char *const luaX_tokens []; | |||
typedef union { | typedef union { | |||
lua_Number r; | lua_Number r; | |||
TString *ts; | TString *ts; | |||
} SemInfo; /* semantics information */ | } SemInfo; /* semantics information */ | |||
typedef struct Token { | typedef struct Token { | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
llimits.h | llimits.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
typedef LUAI_UINT32 lu_int32; | typedef LUAI_UINT32 lu_int32; | |||
typedef LUAI_UMEM lu_mem; | typedef LUAI_UMEM lu_mem; | |||
typedef LUAI_MEM l_mem; | typedef LUAI_MEM l_mem; | |||
/* chars used as small naturals (so that `char' is reserved for characters) */ | /* chars used as small naturals (so that `char' is reserved for characters) */ | |||
typedef unsigned char lu_byte; | typedef unsigned char lu_byte; | |||
#define MAX_SIZET ((size_t)(~(size_t)0)-2) | #define MAX_SIZET ((size_t)(~(size_t)0)-2) | |||
#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) | |||
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ | |||
/* | /* | |||
** conversion of pointer to integer | ** conversion of pointer to integer | |||
** this is for hashing only; there is no problem if the integer | ** this is for hashing only; there is no problem if the integer | |||
** cannot hold the whole pointer value | ** cannot hold the whole pointer value | |||
*/ | */ | |||
#define IntPoint(p) ((unsigned int)(lu_mem)(p)) | #define IntPoint(p) ((unsigned int)(lu_mem)(p)) | |||
/* type to ensure maximum alignment */ | /* type to ensure maximum alignment */ | |||
typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; | |||
/* result of a `usual argument conversion' over lua_Number */ | /* result of a `usual argument conversion' over lua_Number */ | |||
typedef LUAI_UACNUMBER l_uacNumber; | typedef LUAI_UACNUMBER l_uacNumber; | |||
/* internal assertions for in-house debugging */ | /* internal assertions for in-house debugging */ | |||
#ifdef lua_assert | #ifdef lua_assert | |||
#define check_exp(c,e) (lua_assert(c), (e)) | #define check_exp(c,e) (lua_assert(c), (e)) | |||
#define api_check(l,e) lua_assert(e) | #define api_check(l,e) lua_assert(e) | |||
#else | #else | |||
#define lua_assert(c) ((void)0) | #define lua_assert(c) ((void)0) | |||
#define check_exp(c,e) (e) | #define check_exp(c,e) (e) | |||
#define api_check luai_apicheck | #define api_check luai_apicheck | |||
#endif | #endif | |||
#ifndef UNUSED | #ifndef UNUSED | |||
#define UNUSED(x) ((void)(x)) /* to avoid warnings */ | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ | |||
#endif | #endif | |||
#ifndef cast | #ifndef cast | |||
#define cast(t, exp) ((t)(exp)) | #define cast(t, exp) ((t)(exp)) | |||
#endif | #endif | |||
#define cast_byte(i) cast(lu_byte, (i)) | #define cast_byte(i) cast(lu_byte, (i)) | |||
#define cast_num(i) cast(lua_Number, (i)) | #define cast_num(i) cast(lua_Number, (i)) | |||
#define cast_int(i) cast(int, (i)) | #define cast_int(i) cast(int, (i)) | |||
/* | /* | |||
** type for virtual-machine instructions | ** type for virtual-machine instructions | |||
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) | ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) | |||
*/ | */ | |||
typedef lu_int32 Instruction; | typedef lu_int32 Instruction; | |||
/* maximum stack for a Lua function */ | /* maximum stack for a Lua function */ | |||
#define MAXSTACK 250 | #define MAXSTACK 250 | |||
/* minimum size for the string table (must be power of 2) */ | /* minimum size for the string table (must be power of 2) */ | |||
#ifndef MINSTRTABSIZE | #ifndef MINSTRTABSIZE | |||
#define MINSTRTABSIZE 32 | #define MINSTRTABSIZE 32 | |||
#endif | #endif | |||
/* minimum size for string buffer */ | /* minimum size for string buffer */ | |||
#ifndef LUA_MINBUFFER | #ifndef LUA_MINBUFFER | |||
#define LUA_MINBUFFER 32 | #define LUA_MINBUFFER 32 | |||
#endif | #endif | |||
#ifndef lua_lock | #ifndef lua_lock | |||
#define lua_lock(L) ((void) 0) | #define lua_lock(L) ((void) 0) | |||
#define lua_unlock(L) ((void) 0) | #define lua_unlock(L) ((void) 0) | |||
#endif | #endif | |||
#ifndef luai_threadyield | #ifndef luai_threadyield | |||
#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} | |||
#endif | #endif | |||
/* | /* | |||
** macro to control inclusion of some hard tests on stack reallocation | ** macro to control inclusion of some hard tests on stack reallocation | |||
*/ | */ | |||
#ifndef HARDSTACKTESTS | #ifndef HARDSTACKTESTS | |||
#define condhardstacktests(x) ((void)0) | #define condhardstacktests(x) ((void)0) | |||
#else | #else | |||
#define condhardstacktests(x) x | #define condhardstacktests(x) x | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
lmem.h | lmem.h | |||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
*/ | */ | |||
#ifndef lmem_h | #ifndef lmem_h | |||
#define lmem_h | #define lmem_h | |||
#include <stddef.h> | #include <stddef.h> | |||
#include "llimits.h" | #include "llimits.h" | |||
#include "lua.h" | #include "lua.h" | |||
#define MEMERRMSG "not enough memory" | #define MEMERRMSG "not enough memory" | |||
#define luaM_reallocv(L,b,on,n,e) \ | #define luaM_reallocv(L,b,on,n,e) \ | |||
((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings * | |||
luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ | / \ | |||
luaM_toobig(L)) | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ | |||
luaM_toobig(L)) | ||||
#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) | |||
#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), | |||
0) | ||||
#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) | |||
#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) | |||
#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) | |||
#define luaM_newvector(L,n,t) \ | #define luaM_newvector(L,n,t) \ | |||
cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) | |||
#define luaM_growvector(L,v,nelems,size,t,limit,e) \ | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ | |||
if ((nelems)+1 > (size)) \ | if ((nelems)+1 > (size)) \ | |||
((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) | |||
#define luaM_reallocvector(L, v,oldn,n,t) \ | #define luaM_reallocvector(L, v,oldn,n,t) \ | |||
((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) | |||
LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, | |||
size_t size); | size_t size); | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 11 lines changed or added | |||
lobject.h | lobject.h | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#ifndef lobject_h | #ifndef lobject_h | |||
#define lobject_h | #define lobject_h | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include "llimits.h" | #include "llimits.h" | |||
#include "lua.h" | #include "lua.h" | |||
/* tags for values visible from Lua */ | /* tags for values visible from Lua */ | |||
#define LAST_TAG LUA_TTHREAD | #define LAST_TAG LUA_TTHREAD | |||
#define NUM_TAGS (LAST_TAG+1) | #define NUM_TAGS (LAST_TAG+1) | |||
/* | /* | |||
** Extra tags for non-values | ** Extra tags for non-values | |||
*/ | */ | |||
#define LUA_TPROTO (LAST_TAG+1) | #define LUA_TPROTO (LAST_TAG+1) | |||
#define LUA_TUPVAL (LAST_TAG+2) | #define LUA_TUPVAL (LAST_TAG+2) | |||
#define LUA_TDEADKEY (LAST_TAG+3) | #define LUA_TDEADKEY (LAST_TAG+3) | |||
/* | /* | |||
** Union of all collectable objects | ** Union of all collectable objects | |||
*/ | */ | |||
typedef union GCObject GCObject; | typedef union GCObject GCObject; | |||
/* | /* | |||
** Common Header for all collectable objects (in macro form, to be | ** Common Header for all collectable objects (in macro form, to be | |||
** included in other objects) | ** included in other objects) | |||
*/ | */ | |||
#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked | #define CommonHeader GCObject *next; lu_byte tt; lu_byte marked | |||
/* | /* | |||
** Common header in struct form | ** Common header in struct form | |||
*/ | */ | |||
typedef struct GCheader { | typedef struct GCheader { | |||
CommonHeader; | CommonHeader; | |||
} GCheader; | } GCheader; | |||
/* | /* | |||
** Union of all Lua values | ** Union of all Lua values | |||
skipping to change at line 59 | skipping to change at line 59 | |||
GCObject *gc; | GCObject *gc; | |||
void *p; | void *p; | |||
lua_Number n; | lua_Number n; | |||
int b; | int b; | |||
} Value; | } Value; | |||
/* | /* | |||
** Tagged Values | ** Tagged Values | |||
*/ | */ | |||
#define TValuefields Value value; int tt | #define TValuefields Value value; int tt | |||
typedef struct lua_TValue { | typedef struct lua_TValue { | |||
TValuefields; | TValuefields; | |||
} TValue; | } TValue; | |||
/* Macros to test type */ | /* Macros to test type */ | |||
#define ttisnil(o) (ttype(o) == LUA_TNIL) | #define ttisnil(o) (ttype(o) == LUA_TNIL) | |||
#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) | #define ttisnumber(o) (ttype(o) == LUA_TNUMBER) | |||
#define ttisstring(o) (ttype(o) == LUA_TSTRING) | #define ttisstring(o) (ttype(o) == LUA_TSTRING) | |||
#define ttistable(o) (ttype(o) == LUA_TTABLE) | #define ttistable(o) (ttype(o) == LUA_TTABLE) | |||
#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) | #define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) | |||
#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) | #define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) | |||
#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) | #define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) | |||
#define ttisthread(o) (ttype(o) == LUA_TTHREAD) | #define ttisthread(o) (ttype(o) == LUA_TTHREAD) | |||
#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) | #define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) | |||
/* Macros to access values */ | /* Macros to access values */ | |||
#define ttype(o) ((o)->tt) | #define ttype(o) ((o)->tt) | |||
#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) | #define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) | |||
#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) | #define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) | |||
#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) | #define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) | |||
#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) | #define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) | |||
#define tsvalue(o) (&rawtsvalue(o)->tsv) | #define tsvalue(o) (&rawtsvalue(o)->tsv) | |||
#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) | #define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) | |||
#define uvalue(o) (&rawuvalue(o)->uv) | #define uvalue(o) (&rawuvalue(o)->uv) | |||
#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) | #define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) | |||
#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) | #define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) | |||
#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) | #define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) | |||
#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) | #define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) | |||
#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) | #define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) | |||
/* | /* | |||
** for internal debug only | ** for internal debug only | |||
*/ | */ | |||
#define checkconsistency(obj) \ | #define checkconsistency(obj) \ | |||
lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt) ) | lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt) ) | |||
#define checkliveness(g,obj) \ | #define checkliveness(g,obj) \ | |||
lua_assert(!iscollectable(obj) || \ | lua_assert(!iscollectable(obj) || \ | |||
((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) | ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) | |||
skipping to change at line 154 | skipping to change at line 154 | |||
#define setobj(L,obj1,obj2) \ | #define setobj(L,obj1,obj2) \ | |||
{ const TValue *o2=(obj2); TValue *o1=(obj1); \ | { const TValue *o2=(obj2); TValue *o1=(obj1); \ | |||
o1->value = o2->value; o1->tt=o2->tt; \ | o1->value = o2->value; o1->tt=o2->tt; \ | |||
checkliveness(G(L),o1); } | checkliveness(G(L),o1); } | |||
/* | /* | |||
** different types of sets, according to destination | ** different types of sets, according to destination | |||
*/ | */ | |||
/* from stack to (same) stack */ | /* from stack to (same) stack */ | |||
#define setobjs2s setobj | #define setobjs2s setobj | |||
/* to stack (not from same stack) */ | /* to stack (not from same stack) */ | |||
#define setobj2s setobj | #define setobj2s setobj | |||
#define setsvalue2s setsvalue | #define setsvalue2s setsvalue | |||
#define sethvalue2s sethvalue | #define sethvalue2s sethvalue | |||
#define setptvalue2s setptvalue | #define setptvalue2s setptvalue | |||
/* from table to same table */ | /* from table to same table */ | |||
#define setobjt2t setobj | #define setobjt2t setobj | |||
/* to table */ | /* to table */ | |||
#define setobj2t setobj | #define setobj2t setobj | |||
/* to new object */ | /* to new object */ | |||
#define setobj2n setobj | #define setobj2n setobj | |||
#define setsvalue2n setsvalue | #define setsvalue2n setsvalue | |||
#define setttype(obj, tt) (ttype(obj) = (tt)) | #define setttype(obj, tt) (ttype(obj) = (tt)) | |||
#define iscollectable(o) (ttype(o) >= LUA_TSTRING) | #define iscollectable(o) (ttype(o) >= LUA_TSTRING) | |||
typedef TValue *StkId; /* index to stack elements */ | typedef TValue *StkId; /* index to stack elements */ | |||
/* | /* | |||
** String headers for string table | ** String headers for string table | |||
*/ | */ | |||
typedef union TString { | typedef union TString { | |||
L_Umaxalign dummy; /* ensures maximum alignment for strings */ | L_Umaxalign dummy; /* ensures maximum alignment for strings */ | |||
struct { | struct { | |||
CommonHeader; | CommonHeader; | |||
lu_byte reserved; | lu_byte reserved; | |||
unsigned int hash; | unsigned int hash; | |||
size_t len; | size_t len; | |||
} tsv; | } tsv; | |||
} TString; | } TString; | |||
#define getstr(ts) cast(const char *, (ts) + 1) | #define getstr(ts) cast(const char *, (ts) + 1) | |||
#define svalue(o) getstr(rawtsvalue(o)) | #define svalue(o) getstr(rawtsvalue(o)) | |||
typedef union Udata { | typedef union Udata { | |||
L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | |||
struct { | struct { | |||
CommonHeader; | CommonHeader; | |||
struct Table *metatable; | struct Table *metatable; | |||
struct Table *env; | struct Table *env; | |||
size_t len; | size_t len; | |||
} uv; | } uv; | |||
skipping to change at line 228 | skipping to change at line 228 | |||
int linedefined; | int linedefined; | |||
int lastlinedefined; | int lastlinedefined; | |||
GCObject *gclist; | GCObject *gclist; | |||
lu_byte nups; /* number of upvalues */ | lu_byte nups; /* number of upvalues */ | |||
lu_byte numparams; | lu_byte numparams; | |||
lu_byte is_vararg; | lu_byte is_vararg; | |||
lu_byte maxstacksize; | lu_byte maxstacksize; | |||
} Proto; | } Proto; | |||
/* masks for new-style vararg */ | /* masks for new-style vararg */ | |||
#define VARARG_HASARG 1 | #define VARARG_HASARG 1 | |||
#define VARARG_ISVARARG 2 | #define VARARG_ISVARARG 2 | |||
#define VARARG_NEEDSARG 4 | #define VARARG_NEEDSARG 4 | |||
typedef struct LocVar { | typedef struct LocVar { | |||
TString *varname; | TString *varname; | |||
int startpc; /* first point where variable is active */ | int startpc; /* first point where variable is active */ | |||
int endpc; /* first point where variable is dead */ | int endpc; /* first point where variable is dead */ | |||
} LocVar; | } LocVar; | |||
/* | /* | |||
** Upvalues | ** Upvalues | |||
*/ | */ | |||
skipping to change at line 259 | skipping to change at line 259 | |||
struct UpVal *next; | struct UpVal *next; | |||
} l; | } l; | |||
} u; | } u; | |||
} UpVal; | } UpVal; | |||
/* | /* | |||
** Closures | ** Closures | |||
*/ | */ | |||
#define ClosureHeader \ | #define ClosureHeader \ | |||
CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ | CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ | |||
struct Table *env | struct Table *env | |||
typedef struct CClosure { | typedef struct CClosure { | |||
ClosureHeader; | ClosureHeader; | |||
lua_CFunction f; | lua_CFunction f; | |||
TValue upvalue[1]; | TValue upvalue[1]; | |||
} CClosure; | } CClosure; | |||
typedef struct LClosure { | typedef struct LClosure { | |||
ClosureHeader; | ClosureHeader; | |||
struct Proto *p; | struct Proto *p; | |||
UpVal *upvals[1]; | UpVal *upvals[1]; | |||
} LClosure; | } LClosure; | |||
typedef union Closure { | typedef union Closure { | |||
CClosure c; | CClosure c; | |||
LClosure l; | LClosure l; | |||
} Closure; | } Closure; | |||
#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) | #define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) | |||
#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) | #define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) | |||
/* | /* | |||
** Tables | ** Tables | |||
*/ | */ | |||
typedef union TKey { | typedef union TKey { | |||
struct { | struct { | |||
TValuefields; | TValuefields; | |||
struct Node *next; /* for chaining */ | struct Node *next; /* for chaining */ | |||
} nk; | } nk; | |||
skipping to change at line 315 | skipping to change at line 315 | |||
Node *node; | Node *node; | |||
Node *lastfree; /* any free position is before this position */ | Node *lastfree; /* any free position is before this position */ | |||
GCObject *gclist; | GCObject *gclist; | |||
int sizearray; /* size of `array' array */ | int sizearray; /* size of `array' array */ | |||
} Table; | } Table; | |||
/* | /* | |||
** `module' operation for hashing (size is always a power of 2) | ** `module' operation for hashing (size is always a power of 2) | |||
*/ | */ | |||
#define lmod(s,size) \ | #define lmod(s,size) \ | |||
(check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) | (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) | |||
#define twoto(x) (1<<(x)) | #define twoto(x) (1<<(x)) | |||
#define sizenode(t) (twoto((t)->lsizenode)) | #define sizenode(t) (twoto((t)->lsizenode)) | |||
#define luaO_nilobject (&luaO_nilobject_) | #define luaO_nilobject (&luaO_nilobject_) | |||
LUAI_DATA const TValue luaO_nilobject_; | LUAI_DATA const TValue luaO_nilobject_; | |||
#define ceillog2(x) (luaO_log2((x)-1) + 1) | #define ceillog2(x) (luaO_log2((x)-1) + 1) | |||
LUAI_FUNC int luaO_log2 (unsigned int x); | LUAI_FUNC int luaO_log2 (unsigned int x); | |||
LUAI_FUNC int luaO_int2fb (unsigned int x); | LUAI_FUNC int luaO_int2fb (unsigned int x); | |||
LUAI_FUNC int luaO_fb2int (int x); | LUAI_FUNC int luaO_fb2int (int x); | |||
LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); | LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); | |||
LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); | LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); | |||
LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, | LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, | |||
va_list argp); | va_list argp); | |||
LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) ; | LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) ; | |||
LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); | LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); | |||
End of changes. 22 change blocks. | ||||
52 lines changed or deleted | 52 lines changed or added | |||
lopcodes.h | lopcodes.h | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#ifndef lopcodes_h | #ifndef lopcodes_h | |||
#define lopcodes_h | #define lopcodes_h | |||
#include "llimits.h" | #include "llimits.h" | |||
/*========================================================================= == | /*========================================================================= == | |||
We assume that instructions are unsigned numbers. | We assume that instructions are unsigned numbers. | |||
All instructions have an opcode in the first 6 bits. | All instructions have an opcode in the first 6 bits. | |||
Instructions can have the following fields: | Instructions can have the following fields: | |||
`A' : 8 bits | `A' : 8 bits | |||
`B' : 9 bits | `B' : 9 bits | |||
`C' : 9 bits | `C' : 9 bits | |||
`Bx' : 18 bits (`B' and `C' together) | `Bx' : 18 bits (`B' and `C' together) | |||
`sBx' : signed Bx | `sBx' : signed Bx | |||
A signed argument is represented in excess K; that is, the number | A signed argument is represented in excess K; that is, the number | |||
value is the unsigned value minus K. K is exactly the maximum value | value is the unsigned value minus K. K is exactly the maximum value | |||
for that argument (so that -max is represented by 0, and +max is | for that argument (so that -max is represented by 0, and +max is | |||
represented by 2*max), which is half the maximum for the corresponding | represented by 2*max), which is half the maximum for the corresponding | |||
unsigned argument. | unsigned argument. | |||
=========================================================================== */ | =========================================================================== */ | |||
enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ | enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ | |||
/* | /* | |||
** size and position of opcode arguments. | ** size and position of opcode arguments. | |||
*/ | */ | |||
#define SIZE_C 9 | #define SIZE_C 9 | |||
#define SIZE_B 9 | #define SIZE_B 9 | |||
#define SIZE_Bx (SIZE_C + SIZE_B) | #define SIZE_Bx (SIZE_C + SIZE_B) | |||
#define SIZE_A 8 | #define SIZE_A 8 | |||
#define SIZE_OP 6 | #define SIZE_OP 6 | |||
#define POS_OP 0 | #define POS_OP 0 | |||
#define POS_A (POS_OP + SIZE_OP) | #define POS_A (POS_OP + SIZE_OP) | |||
#define POS_C (POS_A + SIZE_A) | #define POS_C (POS_A + SIZE_A) | |||
#define POS_B (POS_C + SIZE_C) | #define POS_B (POS_C + SIZE_C) | |||
#define POS_Bx POS_C | #define POS_Bx POS_C | |||
/* | /* | |||
** limits for opcode arguments. | ** limits for opcode arguments. | |||
** we use (signed) int to manipulate most arguments, | ** we use (signed) int to manipulate most arguments, | |||
** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) | ** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) | |||
*/ | */ | |||
#if SIZE_Bx < LUAI_BITSINT-1 | #if SIZE_Bx < LUAI_BITSINT-1 | |||
#define MAXARG_Bx ((1<<SIZE_Bx)-1) | #define MAXARG_Bx ((1<<SIZE_Bx)-1) | |||
#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ | #define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ | |||
#else | #else | |||
#define MAXARG_Bx MAX_INT | #define MAXARG_Bx MAX_INT | |||
#define MAXARG_sBx MAX_INT | #define MAXARG_sBx MAX_INT | |||
#endif | #endif | |||
#define MAXARG_A ((1<<SIZE_A)-1) | #define MAXARG_A ((1<<SIZE_A)-1) | |||
#define MAXARG_B ((1<<SIZE_B)-1) | #define MAXARG_B ((1<<SIZE_B)-1) | |||
#define MAXARG_C ((1<<SIZE_C)-1) | #define MAXARG_C ((1<<SIZE_C)-1) | |||
/* creates a mask with `n' 1 bits at position `p' */ | /* creates a mask with `n' 1 bits at position `p' */ | |||
#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p) | #define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p) | |||
/* creates a mask with `n' 0 bits at position `p' */ | /* creates a mask with `n' 0 bits at position `p' */ | |||
#define MASK0(n,p) (~MASK1(n,p)) | #define MASK0(n,p) (~MASK1(n,p)) | |||
/* | /* | |||
** the following macros help to manipulate instructions | ** the following macros help to manipulate instructions | |||
*/ | */ | |||
#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) | #define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) | |||
#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ | #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ | |||
((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP)))) | ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP)))) | |||
#define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0))) | #define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0))) | |||
#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ | #define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ | |||
((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A)))) | ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A)))) | |||
#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0))) | #define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0))) | |||
#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ | #define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ | |||
((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B)))) | ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B)))) | |||
#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0))) | #define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0))) | |||
#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ | #define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ | |||
((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C)))) | ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C)))) | |||
#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0))) | #define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0))) | |||
#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ | #define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ | |||
((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx)))) | ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx)))) | |||
#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx) | #define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx) | |||
#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx) | #define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_ | |||
) | sBx)) | |||
#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \ | #define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \ | |||
| (cast(Instruction, a)<<POS_A) \ | | (cast(Instruction, a)<<POS_A) \ | |||
| (cast(Instruction, b)<<POS_B) \ | | (cast(Instruction, b)<<POS_B) \ | |||
| (cast(Instruction, c)<<POS_C)) | | (cast(Instruction, c)<<POS_C)) | |||
#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \ | #define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \ | |||
| (cast(Instruction, a)<<POS_A) \ | | (cast(Instruction, a)<<POS_A) \ | |||
| (cast(Instruction, bc)<<POS_Bx)) | | (cast(Instruction, bc)<<POS_Bx)) | |||
/* | /* | |||
** Macros to operate RK indices | ** Macros to operate RK indices | |||
*/ | */ | |||
/* this bit 1 means constant (0 means register) */ | /* this bit 1 means constant (0 means register) */ | |||
#define BITRK (1 << (SIZE_B - 1)) | #define BITRK (1 << (SIZE_B - 1)) | |||
/* test whether value is a constant */ | /* test whether value is a constant */ | |||
#define ISK(x) ((x) & BITRK) | #define ISK(x) ((x) & BITRK) | |||
/* gets the index of the constant */ | /* gets the index of the constant */ | |||
#define INDEXK(r) ((int)(r) & ~BITRK) | #define INDEXK(r) ((int)(r) & ~BITRK) | |||
#define MAXINDEXRK (BITRK - 1) | #define MAXINDEXRK (BITRK - 1) | |||
/* code a constant index as a RK value */ | /* code a constant index as a RK value */ | |||
#define RKASK(x) ((x) | BITRK) | #define RKASK(x) ((x) | BITRK) | |||
/* | /* | |||
** invalid register that fits in 8 bits | ** invalid register that fits in 8 bits | |||
*/ | */ | |||
#define NO_REG MAXARG_A | #define NO_REG MAXARG_A | |||
/* | /* | |||
** R(x) - register | ** R(x) - register | |||
** Kst(x) - constant (in constant table) | ** Kst(x) - constant (in constant table) | |||
** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x) | ** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x) | |||
*/ | */ | |||
/* | /* | |||
** grep "ORDER OP" if you change these enums | ** grep "ORDER OP" if you change these enums | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
/*---------------------------------------------------------------------- | /*---------------------------------------------------------------------- | |||
name args description | name args description | |||
------------------------------------------------------------------------*/ | ------------------------------------------------------------------------*/ | |||
OP_MOVE,/* A B R(A) := R(B) */ | OP_MOVE,/* A B R(A) := R(B) */ | |||
OP_LOADK,/* A Bx R(A) := Kst(Bx) */ | OP_LOADK,/* A Bx R(A) := Kst(Bx) */ | |||
OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */ | OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */ | |||
OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */ | OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */ | |||
OP_GETUPVAL,/* A B R(A) := UpValue[B] */ | OP_GETUPVAL,/* A B R(A) := UpValue[B] */ | |||
OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */ | OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] | |||
OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */ | */ | |||
OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */ | ||||
OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */ | OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) | |||
OP_SETUPVAL,/* A B UpValue[B] := R(A) */ | */ | |||
OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */ | OP_SETUPVAL,/* A B UpValue[B] := R(A) */ | |||
OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */ | ||||
OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */ | OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */ | |||
OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ | OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ | |||
OP_ADD,/* A B C R(A) := RK(B) + RK(C) */ | OP_ADD,/* A B C R(A) := RK(B) + RK(C) */ | |||
OP_SUB,/* A B C R(A) := RK(B) - RK(C) */ | OP_SUB,/* A B C R(A) := RK(B) - RK(C) */ | |||
OP_MUL,/* A B C R(A) := RK(B) * RK(C) */ | OP_MUL,/* A B C R(A) := RK(B) * RK(C) */ | |||
OP_DIV,/* A B C R(A) := RK(B) / RK(C) */ | OP_DIV,/* A B C R(A) := RK(B) / RK(C) */ | |||
OP_MOD,/* A B C R(A) := RK(B) % RK(C) */ | OP_MOD,/* A B C R(A) := RK(B) % RK(C) */ | |||
OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */ | OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */ | |||
OP_UNM,/* A B R(A) := -R(B) */ | OP_UNM,/* A B R(A) := -R(B) */ | |||
OP_NOT,/* A B R(A) := not R(B) */ | OP_NOT,/* A B R(A) := not R(B) */ | |||
OP_LEN,/* A B R(A) := length of R(B) */ | OP_LEN,/* A B R(A) := length of R(B) */ | |||
OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ | OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ | |||
OP_JMP,/* sBx pc+=sBx */ | OP_JMP,/* sBx pc+=sBx */ | |||
OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ | OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ | |||
OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ | OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ | |||
OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ | OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ | |||
OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ | OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ | |||
OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ | OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ | |||
OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) * | OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) * | |||
/ | / | |||
OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ | OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ | |||
OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ | OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ | |||
OP_FORLOOP,/* A sBx R(A)+=R(A+2); | OP_FORLOOP,/* A sBx R(A)+=R(A+2); | |||
if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ | if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ | |||
OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ | OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ | |||
OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); | OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); | |||
if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */ | if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */ | |||
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | |||
OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ | |||
OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ | |||
*/ | ||||
OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ | OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ | |||
} OpCode; | } OpCode; | |||
#define NUM_OPCODES (cast(int, OP_VARARG) + 1) | #define NUM_OPCODES (cast(int, OP_VARARG) + 1) | |||
/*========================================================================= == | /*========================================================================= == | |||
Notes: | Notes: | |||
(*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, | (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, | |||
and can be 0: OP_CALL then sets `top' to last_result+1, so | and can be 0: OP_CALL then sets `top' to last_result+1, so | |||
next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. | next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. | |||
(*) In OP_VARARG, if (B == 0) then use actual number of varargs and | (*) In OP_VARARG, if (B == 0) then use actual number of varargs and | |||
set top (like in OP_CALL with C == 0). | set top (like in OP_CALL with C == 0). | |||
skipping to change at line 239 | skipping to change at line 239 | |||
enum OpArgMask { | enum OpArgMask { | |||
OpArgN, /* argument is not used */ | OpArgN, /* argument is not used */ | |||
OpArgU, /* argument is used */ | OpArgU, /* argument is used */ | |||
OpArgR, /* argument is a register or a jump offset */ | OpArgR, /* argument is a register or a jump offset */ | |||
OpArgK /* argument is a constant or register/constant */ | OpArgK /* argument is a constant or register/constant */ | |||
}; | }; | |||
LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; | LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; | |||
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) | #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) | |||
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) | #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) | |||
#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) | #define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) | |||
#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) | #define testAMode(m) (luaP_opmodes[m] & (1 << 6)) | |||
#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) | #define testTMode(m) (luaP_opmodes[m] & (1 << 7)) | |||
LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names * / | LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names * / | |||
/* number of list items to accumulate before a SETLIST instruction */ | /* number of list items to accumulate before a SETLIST instruction */ | |||
#define LFIELDS_PER_FLUSH 50 | #define LFIELDS_PER_FLUSH 50 | |||
#endif | #endif | |||
End of changes. 30 change blocks. | ||||
107 lines changed or deleted | 108 lines changed or added | |||
lparser.h | lparser.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#include "llimits.h" | #include "llimits.h" | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "lzio.h" | #include "lzio.h" | |||
/* | /* | |||
** Expression descriptor | ** Expression descriptor | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
VVOID, /* no value */ | VVOID, /* no value */ | |||
VNIL, | VNIL, | |||
VTRUE, | VTRUE, | |||
VFALSE, | VFALSE, | |||
VK, /* info = index of constant in `k' */ | VK, /* info = index of constant in `k' */ | |||
VKNUM, /* nval = numerical value */ | VKNUM, /* nval = numerical value */ | |||
VLOCAL, /* info = local register */ | VLOCAL, /* info = local register */ | |||
VUPVAL, /* info = index of upvalue in `upvalues' */ | VUPVAL, /* info = index of upvalue in `upvalues' */ | |||
VGLOBAL, /* info = index of table; aux = index of global name in `k' * | VGLOBAL, /* info = index of table; aux = index of global name in `k' | |||
/ | */ | |||
VINDEXED, /* info = table register; aux = index register (or `k') */ | VINDEXED, /* info = table register; aux = index register (or `k') */ | |||
VJMP, /* info = instruction pc */ | VJMP, /* info = instruction pc */ | |||
VRELOCABLE, /* info = instruction pc */ | VRELOCABLE, /* info = instruction pc */ | |||
VNONRELOC, /* info = result register */ | VNONRELOC, /* info = result register */ | |||
VCALL, /* info = instruction pc */ | VCALL, /* info = instruction pc */ | |||
VVARARG /* info = instruction pc */ | VVARARG /* info = instruction pc */ | |||
} expkind; | } expkind; | |||
typedef struct expdesc { | typedef struct expdesc { | |||
expkind k; | expkind k; | |||
union { | union { | |||
struct { int info, aux; } s; | struct { int info, aux; } s; | |||
lua_Number nval; | lua_Number nval; | |||
} u; | } u; | |||
int t; /* patch list of `exit when true' */ | int t; /* patch list of `exit when true' */ | |||
int f; /* patch list of `exit when false' */ | int f; /* patch list of `exit when false' */ | |||
End of changes. 3 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
lstate.h | lstate.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#include "lua.h" | #include "lua.h" | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "ltm.h" | #include "ltm.h" | |||
#include "lzio.h" | #include "lzio.h" | |||
struct lua_longjmp; /* defined in ldo.c */ | struct lua_longjmp; /* defined in ldo.c */ | |||
/* table of globals */ | /* table of globals */ | |||
#define gt(L) (&L->l_gt) | #define gt(L) (&L->l_gt) | |||
/* registry */ | /* registry */ | |||
#define registry(L) (&G(L)->l_registry) | #define registry(L) (&G(L)->l_registry) | |||
/* extra stack space to handle TM calls and some other extras */ | /* extra stack space to handle TM calls and some other extras */ | |||
#define EXTRA_STACK 5 | #define EXTRA_STACK 5 | |||
#define BASIC_CI_SIZE 8 | #define BASIC_CI_SIZE 8 | |||
#define BASIC_STACK_SIZE (2*LUA_MINSTACK) | #define BASIC_STACK_SIZE (2*LUA_MINSTACK) | |||
typedef struct stringtable { | typedef struct stringtable { | |||
GCObject **hash; | GCObject **hash; | |||
lu_int32 nuse; /* number of elements */ | lu_int32 nuse; /* number of elements */ | |||
int size; | int size; | |||
} stringtable; | } stringtable; | |||
/* | /* | |||
** informations about a call | ** informations about a call | |||
*/ | */ | |||
typedef struct CallInfo { | typedef struct CallInfo { | |||
StkId base; /* base for this function */ | StkId base; /* base for this function */ | |||
StkId func; /* function index in the stack */ | StkId func; /* function index in the stack */ | |||
StkId top; /* top for this function */ | StkId top; /* top for this function */ | |||
const Instruction *savedpc; | const Instruction *savedpc; | |||
int nresults; /* expected number of results from this function */ | int nresults; /* expected number of results from this function */ | |||
int tailcalls; /* number of tail calls lost under this entry */ | int tailcalls; /* number of tail calls lost under this entry */ | |||
} CallInfo; | } CallInfo; | |||
#define curr_func(L) (clvalue(L->ci->func)) | #define curr_func(L) (clvalue(L->ci->func)) | |||
#define ci_func(ci) (clvalue((ci)->func)) | #define ci_func(ci) (clvalue((ci)->func)) | |||
#define f_isLua(ci) (!ci_func(ci)->c.isC) | #define f_isLua(ci) (!ci_func(ci)->c.isC) | |||
#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) | #define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) | |||
/* | /* | |||
** `global state', shared by all threads of this state | ** `global state', shared by all threads of this state | |||
*/ | */ | |||
typedef struct global_State { | typedef struct global_State { | |||
stringtable strt; /* hash table for strings */ | stringtable strt; /* hash table for strings */ | |||
lua_Alloc frealloc; /* function to reallocate memory */ | lua_Alloc frealloc; /* function to reallocate memory */ | |||
void *ud; /* auxiliary data to `frealloc' */ | void *ud; /* auxiliary data to `frealloc' */ | |||
lu_byte currentwhite; | lu_byte currentwhite; | |||
lu_byte gcstate; /* state of garbage collector */ | lu_byte gcstate; /* state of garbage collector */ | |||
skipping to change at line 117 | skipping to change at line 117 | |||
int hookcount; | int hookcount; | |||
lua_Hook hook; | lua_Hook hook; | |||
TValue l_gt; /* table of globals */ | TValue l_gt; /* table of globals */ | |||
TValue env; /* temporary place for environments */ | TValue env; /* temporary place for environments */ | |||
GCObject *openupval; /* list of open upvalues in this stack */ | GCObject *openupval; /* list of open upvalues in this stack */ | |||
GCObject *gclist; | GCObject *gclist; | |||
struct lua_longjmp *errorJmp; /* current error recover point */ | struct lua_longjmp *errorJmp; /* current error recover point */ | |||
ptrdiff_t errfunc; /* current error handling function (stack index) */ | ptrdiff_t errfunc; /* current error handling function (stack index) */ | |||
}; | }; | |||
#define G(L) (L->l_G) | #define G(L) (L->l_G) | |||
/* | /* | |||
** Union of all collectable objects | ** Union of all collectable objects | |||
*/ | */ | |||
union GCObject { | union GCObject { | |||
GCheader gch; | GCheader gch; | |||
union TString ts; | union TString ts; | |||
union Udata u; | union Udata u; | |||
union Closure cl; | union Closure cl; | |||
struct Table h; | struct Table h; | |||
struct Proto p; | struct Proto p; | |||
struct UpVal uv; | struct UpVal uv; | |||
struct lua_State th; /* thread */ | struct lua_State th; /* thread */ | |||
}; | }; | |||
/* macros to convert a GCObject into a specific value */ | /* macros to convert a GCObject into a specific value */ | |||
#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) | #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) | |||
#define gco2ts(o) (&rawgco2ts(o)->tsv) | #define gco2ts(o) (&rawgco2ts(o)->tsv) | |||
#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) | #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) | |||
#define gco2u(o) (&rawgco2u(o)->uv) | #define gco2u(o) (&rawgco2u(o)->uv) | |||
#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) | #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) | |||
#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) | #define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) | |||
#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) | #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) | |||
#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | |||
#define ngcotouv(o) \ | #define ngcotouv(o) \ | |||
check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | |||
#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) | #define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) | |||
/* macro to convert any Lua object into a GCObject */ | /* macro to convert any Lua object into a GCObject */ | |||
#define obj2gco(v) (cast(GCObject *, (v))) | #define obj2gco(v) (cast(GCObject *, (v))) | |||
LUAI_FUNC lua_State *luaE_newthread (lua_State *L); | LUAI_FUNC lua_State *luaE_newthread (lua_State *L); | |||
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added | |||
lstring.h | lstring.h | |||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef lstring_h | #ifndef lstring_h | |||
#define lstring_h | #define lstring_h | |||
#include "lgc.h" | #include "lgc.h" | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "lstate.h" | #include "lstate.h" | |||
#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) | |||
#define sizeudata(u) (sizeof(union Udata)+(u)->len) | #define sizeudata(u) (sizeof(union Udata)+(u)->len) | |||
#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | |||
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | |||
(sizeof(s)/sizeof(char))-1)) | (sizeof(s)/sizeof(char))-1)) | |||
#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) | |||
LUAI_FUNC void luaS_resize (lua_State *L, int newsize); | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); | |||
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); | |||
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
ltable.h | ltable.h | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ | |||
** Lua tables (hash) | ** Lua tables (hash) | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef ltable_h | #ifndef ltable_h | |||
#define ltable_h | #define ltable_h | |||
#include "lobject.h" | #include "lobject.h" | |||
#define gnode(t,i) (&(t)->node[i]) | #define gnode(t,i) (&(t)->node[i]) | |||
#define gkey(n) (&(n)->i_key.nk) | #define gkey(n) (&(n)->i_key.nk) | |||
#define gval(n) (&(n)->i_val) | #define gval(n) (&(n)->i_val) | |||
#define gnext(n) ((n)->i_key.nk.next) | #define gnext(n) ((n)->i_key.nk.next) | |||
#define key2tval(n) (&(n)->i_key.tvk) | #define key2tval(n) (&(n)->i_key.tvk) | |||
LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); | |||
LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); | |||
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); | |||
LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); | |||
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); | |||
LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); | |||
LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); | |||
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); | |||
LUAI_FUNC void luaH_free (lua_State *L, Table *t); | LUAI_FUNC void luaH_free (lua_State *L, Table *t); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
ltm.h | ltm.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
TM_MUL, | TM_MUL, | |||
TM_DIV, | TM_DIV, | |||
TM_MOD, | TM_MOD, | |||
TM_POW, | TM_POW, | |||
TM_UNM, | TM_UNM, | |||
TM_LEN, | TM_LEN, | |||
TM_LT, | TM_LT, | |||
TM_LE, | TM_LE, | |||
TM_CONCAT, | TM_CONCAT, | |||
TM_CALL, | TM_CALL, | |||
TM_N /* number of elements in the enum */ | TM_N /* number of elements in the enum */ | |||
} TMS; | } TMS; | |||
#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ | |||
((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) | |||
#define fasttm(l,et,e) gfasttm(G(l), et, e) | #define fasttm(l,et,e) gfasttm(G(l), et, e) | |||
LUAI_DATA const char *const luaT_typenames[]; | LUAI_DATA const char *const luaT_typenames[]; | |||
LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *enam e); | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *enam e); | |||
LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, | |||
TMS event); | TMS event); | |||
LUAI_FUNC void luaT_init (lua_State *L); | LUAI_FUNC void luaT_init (lua_State *L); | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
lua.h | lua.h | |||
---|---|---|---|---|
/* | /* | |||
** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ | ** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $ | |||
** Lua - An Extensible Extension Language | ** Lua - An Extensible Extension Language | |||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | |||
** See Copyright Notice at the end of this file | ** See Copyright Notice at the end of this file | |||
*/ | */ | |||
#ifndef lua_h | #ifndef lua_h | |||
#define lua_h | #define lua_h | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <stddef.h> | #include <stddef.h> | |||
#include "luaconf.h" | #include "luaconf.h" | |||
#define LUA_VERSION "Lua 5.1" | #define LUA_VERSION "Lua 5.1" | |||
#define LUA_RELEASE "Lua 5.1.4" | #define LUA_RELEASE "Lua 5.1.5" | |||
#define LUA_VERSION_NUM 501 | #define LUA_VERSION_NUM 501 | |||
#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" | #define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio" | |||
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" | |||
/* mark for precompiled code (`<esc>Lua') */ | /* mark for precompiled code (`<esc>Lua') */ | |||
#define LUA_SIGNATURE "\033Lua" | #define LUA_SIGNATURE "\033Lua" | |||
/* option for multiple returns in `lua_pcall' and `lua_call' */ | /* option for multiple returns in `lua_pcall' and `lua_call' */ | |||
#define LUA_MULTRET (-1) | #define LUA_MULTRET (-1) | |||
/* | /* | |||
** pseudo-indices | ** pseudo-indices | |||
*/ | */ | |||
#define LUA_REGISTRYINDEX (-10000) | #define LUA_REGISTRYINDEX (-10000) | |||
#define LUA_ENVIRONINDEX (-10001) | #define LUA_ENVIRONINDEX (-10001) | |||
#define LUA_GLOBALSINDEX (-10002) | #define LUA_GLOBALSINDEX (-10002) | |||
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) | #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) | |||
/* thread status; 0 is OK */ | /* thread status; 0 is OK */ | |||
#define LUA_YIELD 1 | #define LUA_YIELD 1 | |||
#define LUA_ERRRUN 2 | #define LUA_ERRRUN 2 | |||
#define LUA_ERRSYNTAX 3 | #define LUA_ERRSYNTAX 3 | |||
#define LUA_ERRMEM 4 | #define LUA_ERRMEM 4 | |||
#define LUA_ERRERR 5 | #define LUA_ERRERR 5 | |||
typedef struct lua_State lua_State; | typedef struct lua_State lua_State; | |||
typedef int (*lua_CFunction) (lua_State *L); | typedef int (*lua_CFunction) (lua_State *L); | |||
/* | /* | |||
** functions that read/write blocks when loading/dumping Lua chunks | ** functions that read/write blocks when loading/dumping Lua chunks | |||
*/ | */ | |||
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); | typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); | |||
typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud ); | typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud ); | |||
/* | /* | |||
** prototype for memory-allocation functions | ** prototype for memory-allocation functions | |||
*/ | */ | |||
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsiz e); | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsiz e); | |||
/* | /* | |||
** basic types | ** basic types | |||
*/ | */ | |||
#define LUA_TNONE (-1) | #define LUA_TNONE (-1) | |||
#define LUA_TNIL 0 | #define LUA_TNIL 0 | |||
#define LUA_TBOOLEAN 1 | #define LUA_TBOOLEAN 1 | |||
#define LUA_TLIGHTUSERDATA 2 | #define LUA_TLIGHTUSERDATA 2 | |||
#define LUA_TNUMBER 3 | #define LUA_TNUMBER 3 | |||
#define LUA_TSTRING 4 | #define LUA_TSTRING 4 | |||
#define LUA_TTABLE 5 | #define LUA_TTABLE 5 | |||
#define LUA_TFUNCTION 6 | #define LUA_TFUNCTION 6 | |||
#define LUA_TUSERDATA 7 | #define LUA_TUSERDATA 7 | |||
#define LUA_TTHREAD 8 | #define LUA_TTHREAD 8 | |||
/* minimum Lua stack available to a C function */ | /* minimum Lua stack available to a C function */ | |||
#define LUA_MINSTACK 20 | #define LUA_MINSTACK 20 | |||
/* | /* | |||
** generic extra include file | ** generic extra include file | |||
*/ | */ | |||
#if defined(LUA_USER_H) | #if defined(LUA_USER_H) | |||
#include LUA_USER_H | #include LUA_USER_H | |||
#endif | #endif | |||
/* type of numbers in Lua */ | /* type of numbers in Lua */ | |||
typedef LUA_NUMBER lua_Number; | typedef LUA_NUMBER lua_Number; | |||
skipping to change at line 133 | skipping to change at line 133 | |||
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); | LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); | |||
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); | LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); | |||
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); | LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); | |||
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | |||
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | |||
LUA_API int (lua_toboolean) (lua_State *L, int idx); | LUA_API int (lua_toboolean) (lua_State *L, int idx); | |||
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len ); | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len ); | |||
LUA_API size_t (lua_objlen) (lua_State *L, int idx); | LUA_API size_t (lua_objlen) (lua_State *L, int idx); | |||
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | |||
LUA_API void *(lua_touserdata) (lua_State *L, int idx); | LUA_API void *(lua_touserdata) (lua_State *L, int idx); | |||
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); | |||
LUA_API const void *(lua_topointer) (lua_State *L, int idx); | LUA_API const void *(lua_topointer) (lua_State *L, int idx); | |||
/* | /* | |||
** push functions (C -> stack) | ** push functions (C -> stack) | |||
*/ | */ | |||
LUA_API void (lua_pushnil) (lua_State *L); | LUA_API void (lua_pushnil) (lua_State *L); | |||
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); | LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); | |||
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); | LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); | |||
LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); | LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); | |||
skipping to change at line 197 | skipping to change at line 197 | |||
** coroutine functions | ** coroutine functions | |||
*/ | */ | |||
LUA_API int (lua_yield) (lua_State *L, int nresults); | LUA_API int (lua_yield) (lua_State *L, int nresults); | |||
LUA_API int (lua_resume) (lua_State *L, int narg); | LUA_API int (lua_resume) (lua_State *L, int narg); | |||
LUA_API int (lua_status) (lua_State *L); | LUA_API int (lua_status) (lua_State *L); | |||
/* | /* | |||
** garbage-collection function and options | ** garbage-collection function and options | |||
*/ | */ | |||
#define LUA_GCSTOP 0 | #define LUA_GCSTOP 0 | |||
#define LUA_GCRESTART 1 | #define LUA_GCRESTART 1 | |||
#define LUA_GCCOLLECT 2 | #define LUA_GCCOLLECT 2 | |||
#define LUA_GCCOUNT 3 | #define LUA_GCCOUNT 3 | |||
#define LUA_GCCOUNTB 4 | #define LUA_GCCOUNTB 4 | |||
#define LUA_GCSTEP 5 | #define LUA_GCSTEP 5 | |||
#define LUA_GCSETPAUSE 6 | #define LUA_GCSETPAUSE 6 | |||
#define LUA_GCSETSTEPMUL 7 | #define LUA_GCSETSTEPMUL 7 | |||
LUA_API int (lua_gc) (lua_State *L, int what, int data); | LUA_API int (lua_gc) (lua_State *L, int what, int data); | |||
/* | /* | |||
** miscellaneous functions | ** miscellaneous functions | |||
*/ | */ | |||
LUA_API int (lua_error) (lua_State *L); | LUA_API int (lua_error) (lua_State *L); | |||
LUA_API int (lua_next) (lua_State *L, int idx); | LUA_API int (lua_next) (lua_State *L, int idx); | |||
skipping to change at line 227 | skipping to change at line 227 | |||
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | |||
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); | LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); | |||
/* | /* | |||
** =============================================================== | ** =============================================================== | |||
** some useful macros | ** some useful macros | |||
** =============================================================== | ** =============================================================== | |||
*/ | */ | |||
#define lua_pop(L,n) lua_settop(L, -(n)-1) | #define lua_pop(L,n) lua_settop(L, -(n)-1) | |||
#define lua_newtable(L) lua_createtable(L, 0, 0) | #define lua_newtable(L) lua_createtable(L, 0, 0) | |||
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n ))) | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n ))) | |||
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | |||
#define lua_strlen(L,i) lua_objlen(L, (i)) | #define lua_strlen(L,i) lua_objlen(L, (i)) | |||
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) | |||
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) | |||
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA | #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERD | |||
) | ATA) | |||
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) | #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) | |||
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) | #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) | |||
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) | #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) | |||
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) | #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) | |||
#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) | #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) | |||
#define lua_pushliteral(L, s) \ | #define lua_pushliteral(L, s) \ | |||
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) | lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) | |||
#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) | #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) | |||
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) | #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) | |||
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) | #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) | |||
/* | /* | |||
** compatibility macros and functions | ** compatibility macros and functions | |||
*/ | */ | |||
#define lua_open() luaL_newstate() | #define lua_open() luaL_newstate() | |||
#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) | |||
#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) | #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) | |||
#define lua_Chunkreader lua_Reader | #define lua_Chunkreader lua_Reader | |||
#define lua_Chunkwriter lua_Writer | #define lua_Chunkwriter lua_Writer | |||
/* hack */ | /* hack */ | |||
LUA_API void lua_setlevel (lua_State *from, lua_State *to); | LUA_API void lua_setlevel (lua_State *from, lua_State *to); | |||
/* | /* | |||
** {====================================================================== | ** {====================================================================== | |||
** Debug API | ** Debug API | |||
** ======================================================================= | ** ======================================================================= | |||
*/ | */ | |||
/* | /* | |||
** Event codes | ** Event codes | |||
*/ | */ | |||
#define LUA_HOOKCALL 0 | #define LUA_HOOKCALL 0 | |||
#define LUA_HOOKRET 1 | #define LUA_HOOKRET 1 | |||
#define LUA_HOOKLINE 2 | #define LUA_HOOKLINE 2 | |||
#define LUA_HOOKCOUNT 3 | #define LUA_HOOKCOUNT 3 | |||
#define LUA_HOOKTAILRET 4 | #define LUA_HOOKTAILRET 4 | |||
/* | /* | |||
** Event masks | ** Event masks | |||
*/ | */ | |||
#define LUA_MASKCALL (1 << LUA_HOOKCALL) | #define LUA_MASKCALL (1 << LUA_HOOKCALL) | |||
#define LUA_MASKRET (1 << LUA_HOOKRET) | #define LUA_MASKRET (1 << LUA_HOOKRET) | |||
#define LUA_MASKLINE (1 << LUA_HOOKLINE) | #define LUA_MASKLINE (1 << LUA_HOOKLINE) | |||
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) | #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) | |||
typedef struct lua_Debug lua_Debug; /* activation record */ | typedef struct lua_Debug lua_Debug; /* activation record */ | |||
/* Functions to be called by the debuger in specific events */ | /* Functions to be called by the debuger in specific events */ | |||
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); | |||
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); | |||
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); | |||
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) ; | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) ; | |||
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) ; | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) ; | |||
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); | |||
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); | |||
LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); | |||
LUA_API lua_Hook lua_gethook (lua_State *L); | LUA_API lua_Hook lua_gethook (lua_State *L); | |||
LUA_API int lua_gethookmask (lua_State *L); | LUA_API int lua_gethookmask (lua_State *L); | |||
LUA_API int lua_gethookcount (lua_State *L); | LUA_API int lua_gethookcount (lua_State *L); | |||
struct lua_Debug { | struct lua_Debug { | |||
int event; | int event; | |||
const char *name; /* (n) */ | const char *name; /* (n) */ | |||
const char *namewhat; /* (n) `global', `local', `field', `method' */ | const char *namewhat; /* (n) `global', `local', `field', `method' | |||
const char *what; /* (S) `Lua', `C', `main', `tail' */ | */ | |||
const char *source; /* (S) */ | const char *what; /* (S) `Lua', `C', `main', `tail' */ | |||
int currentline; /* (l) */ | const char *source; /* (S) */ | |||
int nups; /* (u) number of upvalues */ | int currentline; /* (l) */ | |||
int linedefined; /* (S) */ | int nups; /* (u) number of upvalues */ | |||
int lastlinedefined; /* (S) */ | int linedefined; /* (S) */ | |||
int lastlinedefined; /* (S) */ | ||||
char short_src[LUA_IDSIZE]; /* (S) */ | char short_src[LUA_IDSIZE]; /* (S) */ | |||
/* private part */ | /* private part */ | |||
int i_ci; /* active function */ | int i_ci; /* active function */ | |||
}; | }; | |||
/* }====================================================================== */ | /* }====================================================================== */ | |||
/************************************************************************** **** | /************************************************************************** **** | |||
* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. | * Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved. | |||
* | * | |||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | |||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | |||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | |||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | |||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | |||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | |||
* the following conditions: | * the following conditions: | |||
* | * | |||
* The above copyright notice and this permission notice shall be | * The above copyright notice and this permission notice shall be | |||
End of changes. 28 change blocks. | ||||
78 lines changed or deleted | 79 lines changed or added | |||
luaconf.h | luaconf.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
#if defined(__STRICT_ANSI__) | #if defined(__STRICT_ANSI__) | |||
#define LUA_ANSI | #define LUA_ANSI | |||
#endif | #endif | |||
#if !defined(LUA_ANSI) && defined(_WIN32) | #if !defined(LUA_ANSI) && defined(_WIN32) | |||
#define LUA_WIN | #define LUA_WIN | |||
#endif | #endif | |||
#if defined(LUA_USE_LINUX) | #if defined(LUA_USE_LINUX) | |||
#define LUA_USE_POSIX | #define LUA_USE_POSIX | |||
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ | |||
#define LUA_USE_READLINE /* needs some extra libraries */ | #define LUA_USE_READLINE /* needs some extra libraries */ | |||
#endif | #endif | |||
#if defined(LUA_USE_MACOSX) | #if defined(LUA_USE_MACOSX) | |||
#define LUA_USE_POSIX | #define LUA_USE_POSIX | |||
#define LUA_DL_DYLD /* does not need extra library */ | #define LUA_DL_DYLD /* does not need extra library */ | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_USE_POSIX includes all functionallity listed as X/Open System | @@ LUA_USE_POSIX includes all functionallity listed as X/Open System | |||
@* Interfaces Extension (XSI). | @* Interfaces Extension (XSI). | |||
** CHANGE it (define it) if your system is XSI compatible. | ** CHANGE it (define it) if your system is XSI compatible. | |||
*/ | */ | |||
#if defined(LUA_USE_POSIX) | #if defined(LUA_USE_POSIX) | |||
#define LUA_USE_MKSTEMP | #define LUA_USE_MKSTEMP | |||
#define LUA_USE_ISATTY | #define LUA_USE_ISATTY | |||
skipping to change at line 64 | skipping to change at line 64 | |||
/* | /* | |||
@@ LUA_PATH and LUA_CPATH are the names of the environment variables that | @@ LUA_PATH and LUA_CPATH are the names of the environment variables that | |||
@* Lua check to set its paths. | @* Lua check to set its paths. | |||
@@ LUA_INIT is the name of the environment variable that Lua | @@ LUA_INIT is the name of the environment variable that Lua | |||
@* checks for initialization code. | @* checks for initialization code. | |||
** CHANGE them if you want different names. | ** CHANGE them if you want different names. | |||
*/ | */ | |||
#define LUA_PATH "LUA_PATH" | #define LUA_PATH "LUA_PATH" | |||
#define LUA_CPATH "LUA_CPATH" | #define LUA_CPATH "LUA_CPATH" | |||
#define LUA_INIT "LUA_INIT" | #define LUA_INIT "LUA_INIT" | |||
/* | /* | |||
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for | @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for | |||
@* Lua libraries. | @* Lua libraries. | |||
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for | @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for | |||
@* C libraries. | @* C libraries. | |||
** CHANGE them if your machine has a non-conventional directory | ** CHANGE them if your machine has a non-conventional directory | |||
** hierarchy or if you want to install your libraries in | ** hierarchy or if you want to install your libraries in | |||
** non-conventional directories. | ** non-conventional directories. | |||
*/ | */ | |||
#if defined(_WIN32) | #if defined(_WIN32) | |||
/* | /* | |||
** In Windows, any exclamation mark ('!') in the path is replaced by the | ** In Windows, any exclamation mark ('!') in the path is replaced by the | |||
** path of the directory of the executable file of the current process. | ** path of the directory of the executable file of the current process. | |||
*/ | */ | |||
#define LUA_LDIR "!\\lua\\" | #define LUA_LDIR "!\\lua\\" | |||
#define LUA_CDIR "!\\" | #define LUA_CDIR "!\\" | |||
#define LUA_PATH_DEFAULT \ | #define LUA_PATH_DEFAULT \ | |||
".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ | ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ | |||
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" | LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" | |||
#define LUA_CPATH_DEFAULT \ | #define LUA_CPATH_DEFAULT \ | |||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" | ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" | |||
#else | #else | |||
#define LUA_ROOT "/usr/local/" | #define LUA_ROOT "/usr/local/" | |||
#define LUA_LDIR LUA_ROOT "share/lua/5.1/" | #define LUA_LDIR LUA_ROOT "share/lua/5.1/" | |||
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" | #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" | |||
#define LUA_PATH_DEFAULT \ | #define LUA_PATH_DEFAULT \ | |||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ | "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ | |||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" | LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" | |||
#define LUA_CPATH_DEFAULT \ | #define LUA_CPATH_DEFAULT \ | |||
"./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" | "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_DIRSEP is the directory separator (for submodules). | @@ LUA_DIRSEP is the directory separator (for submodules). | |||
** CHANGE it if your machine does not use "/" as the directory separator | ** CHANGE it if your machine does not use "/" as the directory separator | |||
** and is not Windows. (On Windows Lua automatically uses "\".) | ** and is not Windows. (On Windows Lua automatically uses "\".) | |||
*/ | */ | |||
#if defined(_WIN32) | #if defined(_WIN32) | |||
#define LUA_DIRSEP "\\" | #define LUA_DIRSEP "\\" | |||
#else | #else | |||
#define LUA_DIRSEP "/" | #define LUA_DIRSEP "/" | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_PATHSEP is the character that separates templates in a path. | @@ LUA_PATHSEP is the character that separates templates in a path. | |||
@@ LUA_PATH_MARK is the string that marks the substitution points in a | @@ LUA_PATH_MARK is the string that marks the substitution points in a | |||
@* template. | @* template. | |||
@@ LUA_EXECDIR in a Windows path is replaced by the executable's | @@ LUA_EXECDIR in a Windows path is replaced by the executable's | |||
@* directory. | @* directory. | |||
@@ LUA_IGMARK is a mark to ignore all before it when bulding the | @@ LUA_IGMARK is a mark to ignore all before it when bulding the | |||
@* luaopen_ function name. | @* luaopen_ function name. | |||
** CHANGE them if for some reason your system cannot use those | ** CHANGE them if for some reason your system cannot use those | |||
** characters. (E.g., if one of those characters is a common character | ** characters. (E.g., if one of those characters is a common character | |||
** in file/directory names.) Probably you do not need to change them. | ** in file/directory names.) Probably you do not need to change them. | |||
*/ | */ | |||
#define LUA_PATHSEP ";" | #define LUA_PATHSEP ";" | |||
#define LUA_PATH_MARK "?" | #define LUA_PATH_MARK "?" | |||
#define LUA_EXECDIR "!" | #define LUA_EXECDIR "!" | |||
#define LUA_IGMARK "-" | #define LUA_IGMARK "-" | |||
/* | /* | |||
@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. | @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. | |||
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most | ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most | |||
** machines, ptrdiff_t gives a good choice between int or long.) | ** machines, ptrdiff_t gives a good choice between int or long.) | |||
*/ | */ | |||
#define LUA_INTEGER ptrdiff_t | #define LUA_INTEGER ptrdiff_t | |||
/* | /* | |||
@@ LUA_API is a mark for all core API functions. | @@ LUA_API is a mark for all core API functions. | |||
@@ LUALIB_API is a mark for all standard library functions. | @@ LUALIB_API is a mark for all standard library functions. | |||
** CHANGE them if you need to define those functions in some special way. | ** CHANGE them if you need to define those functions in some special way. | |||
** For instance, if you want to create one Windows DLL with the core and | ** For instance, if you want to create one Windows DLL with the core and | |||
** the libraries, you may want to use the following definition (define | ** the libraries, you may want to use the following definition (define | |||
** LUA_BUILD_AS_DLL to get it). | ** LUA_BUILD_AS_DLL to get it). | |||
*/ | */ | |||
#if defined(LUA_BUILD_AS_DLL) | #if defined(LUA_BUILD_AS_DLL) | |||
#if defined(LUA_CORE) || defined(LUA_LIB) | #if defined(LUA_CORE) || defined(LUA_LIB) | |||
#define LUA_API __declspec(dllexport) | #define LUA_API __declspec(dllexport) | |||
#else | #else | |||
#define LUA_API __declspec(dllimport) | #define LUA_API __declspec(dllimport) | |||
#endif | #endif | |||
#else | #else | |||
#define LUA_API extern | #define LUA_API extern | |||
#endif | #endif | |||
/* more often than not the libs go together with the core */ | /* more often than not the libs go together with the core */ | |||
#define LUALIB_API LUA_API | #define LUALIB_API LUA_API | |||
/* | /* | |||
@@ LUAI_FUNC is a mark for all extern functions that are not to be | @@ LUAI_FUNC is a mark for all extern functions that are not to be | |||
@* exported to outside modules. | @* exported to outside modules. | |||
@@ LUAI_DATA is a mark for all extern (const) variables that are not to | @@ LUAI_DATA is a mark for all extern (const) variables that are not to | |||
@* be exported to outside modules. | @* be exported to outside modules. | |||
** CHANGE them if you need to mark them in some special way. Elf/gcc | ** CHANGE them if you need to mark them in some special way. Elf/gcc | |||
** (versions 3.2 and later) mark them as "hidden" to optimize access | ** (versions 3.2 and later) mark them as "hidden" to optimize access | |||
** when Lua is compiled as a shared library. | ** when Lua is compiled as a shared library. | |||
*/ | */ | |||
#if defined(luaall_c) | #if defined(luaall_c) | |||
#define LUAI_FUNC static | #define LUAI_FUNC static | |||
#define LUAI_DATA /* empty */ | #define LUAI_DATA /* empty */ | |||
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ | #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ | |||
defined(__ELF__) | defined(__ELF__) | |||
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern | #define LUAI_FUNC __attribute__((visibility("hidden"))) extern | |||
#define LUAI_DATA LUAI_FUNC | #define LUAI_DATA LUAI_FUNC | |||
#else | #else | |||
#define LUAI_FUNC extern | #define LUAI_FUNC extern | |||
#define LUAI_DATA extern | #define LUAI_DATA extern | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_QL describes how error messages quote program elements. | @@ LUA_QL describes how error messages quote program elements. | |||
** CHANGE it if you want a different appearance. | ** CHANGE it if you want a different appearance. | |||
*/ | */ | |||
#define LUA_QL(x) "'" x "'" | #define LUA_QL(x) "'" x "'" | |||
#define LUA_QS LUA_QL("%s") | #define LUA_QS LUA_QL("%s") | |||
/* | /* | |||
@@ LUA_IDSIZE gives the maximum size for the description of the source | @@ LUA_IDSIZE gives the maximum size for the description of the source | |||
@* of a function in debug information. | @* of a function in debug information. | |||
** CHANGE it if you want a different size. | ** CHANGE it if you want a different size. | |||
*/ | */ | |||
#define LUA_IDSIZE 60 | #define LUA_IDSIZE 60 | |||
/* | /* | |||
** {================================================================== | ** {================================================================== | |||
** Stand-alone configuration | ** Stand-alone configuration | |||
** =================================================================== | ** =================================================================== | |||
*/ | */ | |||
#if defined(lua_c) || defined(luaall_c) | #if defined(lua_c) || defined(luaall_c) | |||
/* | /* | |||
@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that | @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that | |||
@* is, whether we're running lua interactively). | @* is, whether we're running lua interactively). | |||
** CHANGE it if you have a better definition for non-POSIX/non-Windows | ** CHANGE it if you have a better definition for non-POSIX/non-Windows | |||
** systems. | ** systems. | |||
*/ | */ | |||
#if defined(LUA_USE_ISATTY) | #if defined(LUA_USE_ISATTY) | |||
#include <unistd.h> | #include <unistd.h> | |||
#define lua_stdin_is_tty() isatty(0) | #define lua_stdin_is_tty() isatty(0) | |||
#elif defined(LUA_WIN) | #elif defined(LUA_WIN) | |||
#include <io.h> | #include <io.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#define lua_stdin_is_tty() _isatty(_fileno(stdin)) | #define lua_stdin_is_tty() _isatty(_fileno(stdin)) | |||
#else | #else | |||
#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ | #define lua_stdin_is_tty() 1 /* assume stdin is a tty */ | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_PROMPT is the default prompt used by stand-alone Lua. | @@ LUA_PROMPT is the default prompt used by stand-alone Lua. | |||
@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. | @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. | |||
** CHANGE them if you want different prompts. (You can also change the | ** CHANGE them if you want different prompts. (You can also change the | |||
** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) | ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) | |||
*/ | */ | |||
#define LUA_PROMPT "> " | #define LUA_PROMPT "> " | |||
#define LUA_PROMPT2 ">> " | #define LUA_PROMPT2 ">> " | |||
/* | /* | |||
@@ LUA_PROGNAME is the default name for the stand-alone Lua program. | @@ LUA_PROGNAME is the default name for the stand-alone Lua program. | |||
** CHANGE it if your stand-alone interpreter has a different name and | ** CHANGE it if your stand-alone interpreter has a different name and | |||
** your system is not able to detect that name automatically. | ** your system is not able to detect that name automatically. | |||
*/ | */ | |||
#define LUA_PROGNAME "lua" | #define LUA_PROGNAME "lua" | |||
/* | /* | |||
@@ LUA_MAXINPUT is the maximum length for an input line in the | @@ LUA_MAXINPUT is the maximum length for an input line in the | |||
@* stand-alone interpreter. | @* stand-alone interpreter. | |||
** CHANGE it if you need longer lines. | ** CHANGE it if you need longer lines. | |||
*/ | */ | |||
#define LUA_MAXINPUT 512 | #define LUA_MAXINPUT 512 | |||
/* | /* | |||
@@ lua_readline defines how to show a prompt and then read a line from | @@ lua_readline defines how to show a prompt and then read a line from | |||
@* the standard input. | @* the standard input. | |||
@@ lua_saveline defines how to "save" a read line in a "history". | @@ lua_saveline defines how to "save" a read line in a "history". | |||
@@ lua_freeline defines how to free a line read by lua_readline. | @@ lua_freeline defines how to free a line read by lua_readline. | |||
** CHANGE them if you want to improve this functionality (e.g., by using | ** CHANGE them if you want to improve this functionality (e.g., by using | |||
** GNU readline and history facilities). | ** GNU readline and history facilities). | |||
*/ | */ | |||
#if defined(LUA_USE_READLINE) | #if defined(LUA_USE_READLINE) | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <readline/readline.h> | #include <readline/readline.h> | |||
#include <readline/history.h> | #include <readline/history.h> | |||
#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | |||
#define lua_saveline(L,idx) \ | #define lua_saveline(L,idx) \ | |||
if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ | if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ | |||
add_history(lua_tostring(L, idx)); /* add it to history */ | add_history(lua_tostring(L, idx)); /* add it to history */ | |||
#define lua_freeline(L,b) ((void)L, free(b)) | #define lua_freeline(L,b) ((void)L, free(b)) | |||
#else | #else | |||
#define lua_readline(L,b,p) \ | #define lua_readline(L,b,p) \ | |||
((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ | ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ | |||
fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ | fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ | |||
#define lua_saveline(L,idx) { (void)L; (void)idx; } | #define lua_saveline(L,idx) { (void)L; (void)idx; } | |||
#define lua_freeline(L,b) { (void)L; (void)b; } | #define lua_freeline(L,b) { (void)L; (void)b; } | |||
#endif | #endif | |||
#endif | #endif | |||
/* }================================================================== */ | /* }================================================================== */ | |||
/* | /* | |||
@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles | @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles | |||
@* as a percentage. | @* as a percentage. | |||
** CHANGE it if you want the GC to run faster or slower (higher values | ** CHANGE it if you want the GC to run faster or slower (higher values | |||
** mean larger pauses which mean slower collection.) You can also change | ** mean larger pauses which mean slower collection.) You can also change | |||
** this value dynamically. | ** this value dynamically. | |||
*/ | */ | |||
#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ | #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ | |||
/* | /* | |||
@@ LUAI_GCMUL defines the default speed of garbage collection relative to | @@ LUAI_GCMUL defines the default speed of garbage collection relative to | |||
@* memory allocation as a percentage. | @* memory allocation as a percentage. | |||
** CHANGE it if you want to change the granularity of the garbage | ** CHANGE it if you want to change the granularity of the garbage | |||
** collection. (Higher values mean coarser collections. 0 represents | ** collection. (Higher values mean coarser collections. 0 represents | |||
** infinity, where each step performs a full collection.) You can also | ** infinity, where each step performs a full collection.) You can also | |||
** change this value dynamically. | ** change this value dynamically. | |||
*/ | */ | |||
#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ | #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocatio n */ | |||
/* | /* | |||
@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. | @@ LUA_COMPAT_GETN controls compatibility with old getn behavior. | |||
** CHANGE it (define it) if you want exact compatibility with the | ** CHANGE it (define it) if you want exact compatibility with the | |||
** behavior of setn/getn in Lua 5.0. | ** behavior of setn/getn in Lua 5.0. | |||
*/ | */ | |||
#undef LUA_COMPAT_GETN | #undef LUA_COMPAT_GETN | |||
/* | /* | |||
@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. | @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. | |||
skipping to change at line 326 | skipping to change at line 326 | |||
** the new '%' operator instead of 'math.mod'. | ** the new '%' operator instead of 'math.mod'. | |||
*/ | */ | |||
#define LUA_COMPAT_MOD | #define LUA_COMPAT_MOD | |||
/* | /* | |||
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting | @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting | |||
@* facility. | @* facility. | |||
** CHANGE it to 2 if you want the old behaviour, or undefine it to turn | ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn | |||
** off the advisory error when nesting [[...]]. | ** off the advisory error when nesting [[...]]. | |||
*/ | */ | |||
#define LUA_COMPAT_LSTR 1 | #define LUA_COMPAT_LSTR 1 | |||
/* | /* | |||
@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. | @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. | |||
** CHANGE it to undefined as soon as you rename 'string.gfind' to | ** CHANGE it to undefined as soon as you rename 'string.gfind' to | |||
** 'string.gmatch'. | ** 'string.gmatch'. | |||
*/ | */ | |||
#define LUA_COMPAT_GFIND | #define LUA_COMPAT_GFIND | |||
/* | /* | |||
@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' | @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' | |||
skipping to change at line 352 | skipping to change at line 352 | |||
/* | /* | |||
@@ luai_apicheck is the assert macro used by the Lua-C API. | @@ luai_apicheck is the assert macro used by the Lua-C API. | |||
** CHANGE luai_apicheck if you want Lua to perform some checks in the | ** CHANGE luai_apicheck if you want Lua to perform some checks in the | |||
** parameters it gets from API calls. This may slow down the interpreter | ** parameters it gets from API calls. This may slow down the interpreter | |||
** a bit, but may be quite useful when debugging C code that interfaces | ** a bit, but may be quite useful when debugging C code that interfaces | |||
** with Lua. A useful redefinition is to use assert.h. | ** with Lua. A useful redefinition is to use assert.h. | |||
*/ | */ | |||
#if defined(LUA_USE_APICHECK) | #if defined(LUA_USE_APICHECK) | |||
#include <assert.h> | #include <assert.h> | |||
#define luai_apicheck(L,o) { (void)L; assert(o); } | #define luai_apicheck(L,o) { (void)L; assert(o); } | |||
#else | #else | |||
#define luai_apicheck(L,o) { (void)L; } | #define luai_apicheck(L,o) { (void)L; } | |||
#endif | #endif | |||
/* | /* | |||
@@ LUAI_BITSINT defines the number of bits in an int. | @@ LUAI_BITSINT defines the number of bits in an int. | |||
** CHANGE here if Lua cannot automatically detect the number of bits of | ** CHANGE here if Lua cannot automatically detect the number of bits of | |||
** your machine. Probably you do not need to change this. | ** your machine. Probably you do not need to change this. | |||
*/ | */ | |||
/* avoid overflows in comparison */ | /* avoid overflows in comparison */ | |||
#if INT_MAX-20 < 32760 | #if INT_MAX-20 < 32760 | |||
#define LUAI_BITSINT 16 | #define LUAI_BITSINT 16 | |||
#elif INT_MAX > 2147483640L | #elif INT_MAX > 2147483640L | |||
/* int has at least 32 bits */ | /* int has at least 32 bits */ | |||
#define LUAI_BITSINT 32 | #define LUAI_BITSINT 32 | |||
#else | #else | |||
#error "you must define LUA_BITSINT with number of bits in an integer" | #error "you must define LUA_BITSINT with number of bits in an integer" | |||
#endif | #endif | |||
/* | /* | |||
@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. | @@ LUAI_UINT32 is an unsigned integer with at least 32 bits. | |||
@@ LUAI_INT32 is an signed integer with at least 32 bits. | @@ LUAI_INT32 is an signed integer with at least 32 bits. | |||
@@ LUAI_UMEM is an unsigned integer big enough to count the total | @@ LUAI_UMEM is an unsigned integer big enough to count the total | |||
@* memory used by Lua. | @* memory used by Lua. | |||
@@ LUAI_MEM is a signed integer big enough to count the total memory | @@ LUAI_MEM is a signed integer big enough to count the total memory | |||
@* used by Lua. | @* used by Lua. | |||
** CHANGE here if for some weird reason the default definitions are not | ** CHANGE here if for some weird reason the default definitions are not | |||
** good enough for your machine. (The definitions in the 'else' | ** good enough for your machine. (The definitions in the 'else' | |||
** part always works, but may waste space on machines with 64-bit | ** part always works, but may waste space on machines with 64-bit | |||
** longs.) Probably you do not need to change this. | ** longs.) Probably you do not need to change this. | |||
*/ | */ | |||
#if LUAI_BITSINT >= 32 | #if LUAI_BITSINT >= 32 | |||
#define LUAI_UINT32 unsigned int | #define LUAI_UINT32 unsigned int | |||
#define LUAI_INT32 int | #define LUAI_INT32 int | |||
#define LUAI_MAXINT32 INT_MAX | #define LUAI_MAXINT32 INT_MAX | |||
#define LUAI_UMEM size_t | #define LUAI_UMEM size_t | |||
#define LUAI_MEM ptrdiff_t | #define LUAI_MEM ptrdiff_t | |||
#else | #else | |||
/* 16-bit ints */ | /* 16-bit ints */ | |||
#define LUAI_UINT32 unsigned long | #define LUAI_UINT32 unsigned long | |||
#define LUAI_INT32 long | #define LUAI_INT32 long | |||
#define LUAI_MAXINT32 LONG_MAX | #define LUAI_MAXINT32 LONG_MAX | |||
#define LUAI_UMEM unsigned long | #define LUAI_UMEM unsigned long | |||
#define LUAI_MEM long | #define LUAI_MEM long | |||
#endif | #endif | |||
/* | /* | |||
@@ LUAI_MAXCALLS limits the number of nested calls. | @@ LUAI_MAXCALLS limits the number of nested calls. | |||
** CHANGE it if you need really deep recursive calls. This limit is | ** CHANGE it if you need really deep recursive calls. This limit is | |||
** arbitrary; its only purpose is to stop infinite recursion before | ** arbitrary; its only purpose is to stop infinite recursion before | |||
** exhausting memory. | ** exhausting memory. | |||
*/ | */ | |||
#define LUAI_MAXCALLS 20000 | #define LUAI_MAXCALLS 20000 | |||
/* | /* | |||
@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function | @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function | |||
@* can use. | @* can use. | |||
** CHANGE it if you need lots of (Lua) stack space for your C | ** CHANGE it if you need lots of (Lua) stack space for your C | |||
** functions. This limit is arbitrary; its only purpose is to stop C | ** functions. This limit is arbitrary; its only purpose is to stop C | |||
** functions to consume unlimited stack space. (must be smaller than | ** functions to consume unlimited stack space. (must be smaller than | |||
** -LUA_REGISTRYINDEX) | ** -LUA_REGISTRYINDEX) | |||
*/ | */ | |||
#define LUAI_MAXCSTACK 8000 | #define LUAI_MAXCSTACK 8000 | |||
/* | /* | |||
** {================================================================== | ** {================================================================== | |||
** CHANGE (to smaller values) the following definitions if your system | ** CHANGE (to smaller values) the following definitions if your system | |||
** has a small C stack. (Or you may want to change them to larger | ** has a small C stack. (Or you may want to change them to larger | |||
** values if your system has a large C stack and these limits are | ** values if your system has a large C stack and these limits are | |||
** too rigid for you.) Some of these constants control the size of | ** too rigid for you.) Some of these constants control the size of | |||
** stack-allocated arrays used by the compiler or the interpreter, while | ** stack-allocated arrays used by the compiler or the interpreter, while | |||
** others limit the maximum number of recursive calls that the compiler | ** others limit the maximum number of recursive calls that the compiler | |||
** or the interpreter can perform. Values too large may cause a C stack | ** or the interpreter can perform. Values too large may cause a C stack | |||
** overflow for some forms of deep constructs. | ** overflow for some forms of deep constructs. | |||
** =================================================================== | ** =================================================================== | |||
*/ | */ | |||
/* | /* | |||
@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and | @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and | |||
@* syntactical nested non-terminals in a program. | @* syntactical nested non-terminals in a program. | |||
*/ | */ | |||
#define LUAI_MAXCCALLS 200 | #define LUAI_MAXCCALLS 200 | |||
/* | /* | |||
@@ LUAI_MAXVARS is the maximum number of local variables per function | @@ LUAI_MAXVARS is the maximum number of local variables per function | |||
@* (must be smaller than 250). | @* (must be smaller than 250). | |||
*/ | */ | |||
#define LUAI_MAXVARS 200 | #define LUAI_MAXVARS 200 | |||
/* | /* | |||
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function | @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function | |||
@* (must be smaller than 250). | @* (must be smaller than 250). | |||
*/ | */ | |||
#define LUAI_MAXUPVALUES 60 | #define LUAI_MAXUPVALUES 60 | |||
/* | /* | |||
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. | @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. | |||
*/ | */ | |||
#define LUAL_BUFFERSIZE BUFSIZ | #define LUAL_BUFFERSIZE BUFSIZ | |||
/* }================================================================== */ | /* }================================================================== */ | |||
/* | /* | |||
** {================================================================== | ** {================================================================== | |||
@@ LUA_NUMBER is the type of numbers in Lua. | @@ LUA_NUMBER is the type of numbers in Lua. | |||
** CHANGE the following definitions only if you want to build Lua | ** CHANGE the following definitions only if you want to build Lua | |||
** with a number type different from double. You may also need to | ** with a number type different from double. You may also need to | |||
** change lua_number2int & lua_number2integer. | ** change lua_number2int & lua_number2integer. | |||
** =================================================================== | ** =================================================================== | |||
*/ | */ | |||
#define LUA_NUMBER_DOUBLE | #define LUA_NUMBER_DOUBLE | |||
#define LUA_NUMBER double | #define LUA_NUMBER double | |||
/* | /* | |||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' | @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' | |||
@* over a number. | @* over a number. | |||
*/ | */ | |||
#define LUAI_UACNUMBER double | #define LUAI_UACNUMBER double | |||
/* | /* | |||
@@ LUA_NUMBER_SCAN is the format for reading numbers. | @@ LUA_NUMBER_SCAN is the format for reading numbers. | |||
@@ LUA_NUMBER_FMT is the format for writing numbers. | @@ LUA_NUMBER_FMT is the format for writing numbers. | |||
@@ lua_number2str converts a number to a string. | @@ lua_number2str converts a number to a string. | |||
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. | @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. | |||
@@ lua_str2number converts a string to a number. | @@ lua_str2number converts a string to a number. | |||
*/ | */ | |||
#define LUA_NUMBER_SCAN "%lf" | #define LUA_NUMBER_SCAN "%lf" | |||
#define LUA_NUMBER_FMT "%.14g" | #define LUA_NUMBER_FMT "%.14g" | |||
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | |||
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ | #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ | |||
#define lua_str2number(s,p) strtod((s), (p)) | #define lua_str2number(s,p) strtod((s), (p)) | |||
/* | /* | |||
@@ The luai_num* macros define the primitive operations over numbers. | @@ The luai_num* macros define the primitive operations over numbers. | |||
*/ | */ | |||
#if defined(LUA_CORE) | #if defined(LUA_CORE) | |||
#include <math.h> | #include <math.h> | |||
#define luai_numadd(a,b) ((a)+(b)) | #define luai_numadd(a,b) ((a)+(b)) | |||
#define luai_numsub(a,b) ((a)-(b)) | #define luai_numsub(a,b) ((a)-(b)) | |||
#define luai_nummul(a,b) ((a)*(b)) | #define luai_nummul(a,b) ((a)*(b)) | |||
#define luai_numdiv(a,b) ((a)/(b)) | #define luai_numdiv(a,b) ((a)/(b)) | |||
#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) | #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) | |||
#define luai_numpow(a,b) (pow(a,b)) | #define luai_numpow(a,b) (pow(a,b)) | |||
#define luai_numunm(a) (-(a)) | #define luai_numunm(a) (-(a)) | |||
#define luai_numeq(a,b) ((a)==(b)) | #define luai_numeq(a,b) ((a)==(b)) | |||
#define luai_numlt(a,b) ((a)<(b)) | #define luai_numlt(a,b) ((a)<(b)) | |||
#define luai_numle(a,b) ((a)<=(b)) | #define luai_numle(a,b) ((a)<=(b)) | |||
#define luai_numisnan(a) (!luai_numeq((a), (a))) | #define luai_numisnan(a) (!luai_numeq((a), (a))) | |||
#endif | #endif | |||
/* | /* | |||
@@ lua_number2int is a macro to convert lua_Number to int. | @@ lua_number2int is a macro to convert lua_Number to int. | |||
@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. | @@ lua_number2integer is a macro to convert lua_Number to lua_Integer. | |||
** CHANGE them if you know a faster way to convert a lua_Number to | ** CHANGE them if you know a faster way to convert a lua_Number to | |||
** int (with any rounding method and without throwing errors) in your | ** int (with any rounding method and without throwing errors) in your | |||
** system. In Pentium machines, a naive typecast from double to int | ** system. In Pentium machines, a naive typecast from double to int | |||
** in C is extremely slow, so any alternative is worth trying. | ** in C is extremely slow, so any alternative is worth trying. | |||
*/ | */ | |||
/* On a Pentium, resort to a trick */ | /* On a Pentium, resort to a trick */ | |||
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ | #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ | |||
(defined(__i386) || defined (_M_IX86) || defined(__i386__)) | (defined(__i386) || defined (_M_IX86) || defined(__i386__)) | |||
/* On a Microsoft compiler, use assembler */ | /* On a Microsoft compiler, use assembler */ | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#define lua_number2int(i,d) __asm fld d __asm fistp i | #define lua_number2int(i,d) __asm fld d __asm fistp i | |||
#define lua_number2integer(i,n) lua_number2int(i, n) | #define lua_number2integer(i,n) lua_number2int(i, n) | |||
/* the next trick should work on any Pentium, but sometimes clashes | /* the next trick should work on any Pentium, but sometimes clashes | |||
with a DirectX idiosyncrasy */ | with a DirectX idiosyncrasy */ | |||
#else | #else | |||
union luai_Cast { double l_d; long l_l; }; | union luai_Cast { double l_d; long l_l; }; | |||
#define lua_number2int(i,d) \ | #define lua_number2int(i,d) \ | |||
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l _l; } | { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l _l; } | |||
#define lua_number2integer(i,n) lua_number2int(i, n) | #define lua_number2integer(i,n) lua_number2int(i, n) | |||
#endif | #endif | |||
/* this option always works, but may be slow */ | /* this option always works, but may be slow */ | |||
#else | #else | |||
#define lua_number2int(i,d) ((i)=(int)(d)) | #define lua_number2int(i,d) ((i)=(int)(d)) | |||
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) | #define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) | |||
#endif | #endif | |||
/* }================================================================== */ | /* }================================================================== */ | |||
/* | /* | |||
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. | @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. | |||
** CHANGE it if your system requires alignments larger than double. (For | ** CHANGE it if your system requires alignments larger than double. (For | |||
** instance, if your system supports long doubles and they must be | ** instance, if your system supports long doubles and they must be | |||
** aligned in 16-byte boundaries, then you should add long double in the | ** aligned in 16-byte boundaries, then you should add long double in the | |||
** union.) Probably you do not need to change this. | ** union.) Probably you do not need to change this. | |||
*/ | */ | |||
#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } | #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } | |||
/* | /* | |||
@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. | @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. | |||
** CHANGE them if you prefer to use longjmp/setjmp even with C++ | ** CHANGE them if you prefer to use longjmp/setjmp even with C++ | |||
** or if want/don't to use _longjmp/_setjmp instead of regular | ** or if want/don't to use _longjmp/_setjmp instead of regular | |||
** longjmp/setjmp. By default, Lua handles errors with exceptions when | ** longjmp/setjmp. By default, Lua handles errors with exceptions when | |||
** compiling as C++ code, with _longjmp/_setjmp when asked to use them, | ** compiling as C++ code, with _longjmp/_setjmp when asked to use them, | |||
** and with longjmp/setjmp otherwise. | ** and with longjmp/setjmp otherwise. | |||
*/ | */ | |||
#if defined(__cplusplus) | #if defined(__cplusplus) | |||
/* C++ exceptions */ | /* C++ exceptions */ | |||
#define LUAI_THROW(L,c) throw(c) | #define LUAI_THROW(L,c) throw(c) | |||
#define LUAI_TRY(L,c,a) try { a } catch(...) \ | #define LUAI_TRY(L,c,a) try { a } catch(...) \ | |||
{ if ((c)->status == 0) (c)->status = -1; } | { if ((c)->status == 0) (c)->status = -1; } | |||
#define luai_jmpbuf int /* dummy variable */ | #define luai_jmpbuf int /* dummy variable */ | |||
#elif defined(LUA_USE_ULONGJMP) | #elif defined(LUA_USE_ULONGJMP) | |||
/* in Unix, try _longjmp/_setjmp (more efficient) */ | /* in Unix, try _longjmp/_setjmp (more efficient) */ | |||
#define LUAI_THROW(L,c) _longjmp((c)->b, 1) | #define LUAI_THROW(L,c) _longjmp((c)->b, 1) | |||
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } | |||
#define luai_jmpbuf jmp_buf | #define luai_jmpbuf jmp_buf | |||
#else | #else | |||
/* default handling with long jumps */ | /* default handling with long jumps */ | |||
#define LUAI_THROW(L,c) longjmp((c)->b, 1) | #define LUAI_THROW(L,c) longjmp((c)->b, 1) | |||
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } | |||
#define luai_jmpbuf jmp_buf | #define luai_jmpbuf jmp_buf | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern | @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern | |||
@* can do during pattern-matching. | @* can do during pattern-matching. | |||
** CHANGE it if you need more captures. This limit is arbitrary. | ** CHANGE it if you need more captures. This limit is arbitrary. | |||
*/ | */ | |||
#define LUA_MAXCAPTURES 32 | #define LUA_MAXCAPTURES 32 | |||
/* | /* | |||
@@ lua_tmpnam is the function that the OS library uses to create a | @@ lua_tmpnam is the function that the OS library uses to create a | |||
@* temporary name. | @* temporary name. | |||
@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. | @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. | |||
** CHANGE them if you have an alternative to tmpnam (which is considered | ** CHANGE them if you have an alternative to tmpnam (which is considered | |||
** insecure) or if you want the original tmpnam anyway. By default, Lua | ** insecure) or if you want the original tmpnam anyway. By default, Lua | |||
** uses tmpnam except when POSIX is available, where it uses mkstemp. | ** uses tmpnam except when POSIX is available, where it uses mkstemp. | |||
*/ | */ | |||
#if defined(loslib_c) || defined(luaall_c) | #if defined(loslib_c) || defined(luaall_c) | |||
#if defined(LUA_USE_MKSTEMP) | #if defined(LUA_USE_MKSTEMP) | |||
#include <unistd.h> | #include <unistd.h> | |||
#define LUA_TMPNAMBUFSIZE 32 | #define LUA_TMPNAMBUFSIZE 32 | |||
#define lua_tmpnam(b,e) { \ | #define lua_tmpnam(b,e) { \ | |||
strcpy(b, "/tmp/lua_XXXXXX"); \ | strcpy(b, "/tmp/lua_XXXXXX"); \ | |||
e = mkstemp(b); \ | e = mkstemp(b); \ | |||
if (e != -1) close(e); \ | if (e != -1) close(e); \ | |||
e = (e == -1); } | e = (e == -1); } | |||
#else | #else | |||
#define LUA_TMPNAMBUFSIZE L_tmpnam | #define LUA_TMPNAMBUFSIZE L_tmpnam | |||
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } | #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } | |||
#endif | #endif | |||
#endif | #endif | |||
/* | /* | |||
@@ lua_popen spawns a new process connected to the current one through | @@ lua_popen spawns a new process connected to the current one through | |||
@* the file streams. | @* the file streams. | |||
** CHANGE it if you have a way to implement it in your system. | ** CHANGE it if you have a way to implement it in your system. | |||
*/ | */ | |||
#if defined(LUA_USE_POPEN) | #if defined(LUA_USE_POPEN) | |||
#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) | #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) | |||
#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) | #define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) | |||
#elif defined(LUA_WIN) | #elif defined(LUA_WIN) | |||
#define lua_popen(L,c,m) ((void)L, _popen(c,m)) | #define lua_popen(L,c,m) ((void)L, _popen(c,m)) | |||
#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) | #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) | |||
#else | #else | |||
#define lua_popen(L,c,m) ((void)((void)c, m), \ | #define lua_popen(L,c,m) ((void)((void)c, m), \ | |||
luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) | |||
#define lua_pclose(L,file) ((void)((void)L, file), 0) | #define lua_pclose(L,file) ((void)((void)L, file), 0) | |||
#endif | #endif | |||
/* | /* | |||
@@ LUA_DL_* define which dynamic-library system Lua should use. | @@ LUA_DL_* define which dynamic-library system Lua should use. | |||
** CHANGE here if Lua has problems choosing the appropriate | ** CHANGE here if Lua has problems choosing the appropriate | |||
** dynamic-library system for your platform (either Windows' DLL, Mac's | ** dynamic-library system for your platform (either Windows' DLL, Mac's | |||
** dyld, or Unix's dlopen). If your system is some kind of Unix, there | ** dyld, or Unix's dlopen). If your system is some kind of Unix, there | |||
** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for | ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for | |||
** it. To use dlopen you also need to adapt the src/Makefile (probably | ** it. To use dlopen you also need to adapt the src/Makefile (probably | |||
skipping to change at line 665 | skipping to change at line 665 | |||
#if defined(LUA_WIN) | #if defined(LUA_WIN) | |||
#define LUA_DL_DLL | #define LUA_DL_DLL | |||
#endif | #endif | |||
/* | /* | |||
@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State | @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State | |||
@* (the data goes just *before* the lua_State pointer). | @* (the data goes just *before* the lua_State pointer). | |||
** CHANGE (define) this if you really need that. This value must be | ** CHANGE (define) this if you really need that. This value must be | |||
** a multiple of the maximum alignment required for your machine. | ** a multiple of the maximum alignment required for your machine. | |||
*/ | */ | |||
#define LUAI_EXTRASPACE 0 | #define LUAI_EXTRASPACE 0 | |||
/* | /* | |||
@@ luai_userstate* allow user-specific actions on threads. | @@ luai_userstate* allow user-specific actions on threads. | |||
** CHANGE them if you defined LUAI_EXTRASPACE and need to do something | ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something | |||
** extra when a thread is created/deleted/resumed/yielded. | ** extra when a thread is created/deleted/resumed/yielded. | |||
*/ | */ | |||
#define luai_userstateopen(L) ((void)L) | #define luai_userstateopen(L) ((void)L) | |||
#define luai_userstateclose(L) ((void)L) | #define luai_userstateclose(L) ((void)L) | |||
#define luai_userstatethread(L,L1) ((void)L) | #define luai_userstatethread(L,L1) ((void)L) | |||
#define luai_userstatefree(L) ((void)L) | #define luai_userstatefree(L) ((void)L) | |||
#define luai_userstateresume(L,n) ((void)L) | #define luai_userstateresume(L,n) ((void)L) | |||
#define luai_userstateyield(L,n) ((void)L) | #define luai_userstateyield(L,n) ((void)L) | |||
/* | /* | |||
@@ LUA_INTFRMLEN is the length modifier for integer conversions | @@ LUA_INTFRMLEN is the length modifier for integer conversions | |||
@* in 'string.format'. | @* in 'string.format'. | |||
@@ LUA_INTFRM_T is the integer type correspoding to the previous length | @@ LUA_INTFRM_T is the integer type correspoding to the previous length | |||
@* modifier. | @* modifier. | |||
** CHANGE them if your system supports long long or does not support long. | ** CHANGE them if your system supports long long or does not support long. | |||
*/ | */ | |||
#if defined(LUA_USELONGLONG) | #if defined(LUA_USELONGLONG) | |||
#define LUA_INTFRMLEN "ll" | #define LUA_INTFRMLEN "ll" | |||
#define LUA_INTFRM_T long long | #define LUA_INTFRM_T long long | |||
#else | #else | |||
#define LUA_INTFRMLEN "l" | #define LUA_INTFRMLEN "l" | |||
#define LUA_INTFRM_T long | #define LUA_INTFRM_T long | |||
#endif | #endif | |||
/* =================================================================== */ | /* =================================================================== */ | |||
/* | /* | |||
** Local configuration. You can use this space to add your redefinitions | ** Local configuration. You can use this space to add your redefinitions | |||
** without modifying the main part of the file. | ** without modifying the main part of the file. | |||
*/ | */ | |||
End of changes. 64 change blocks. | ||||
133 lines changed or deleted | 133 lines changed or added | |||
lualib.h | lualib.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
** Lua standard libraries | ** Lua standard libraries | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef lualib_h | #ifndef lualib_h | |||
#define lualib_h | #define lualib_h | |||
#include "lua.h" | #include "lua.h" | |||
/* Key to file-handle type */ | /* Key to file-handle type */ | |||
#define LUA_FILEHANDLE "FILE*" | #define LUA_FILEHANDLE "FILE*" | |||
#define LUA_COLIBNAME "coroutine" | #define LUA_COLIBNAME "coroutine" | |||
LUALIB_API int (luaopen_base) (lua_State *L); | LUALIB_API int (luaopen_base) (lua_State *L); | |||
#define LUA_TABLIBNAME "table" | #define LUA_TABLIBNAME "table" | |||
LUALIB_API int (luaopen_table) (lua_State *L); | LUALIB_API int (luaopen_table) (lua_State *L); | |||
#define LUA_IOLIBNAME "io" | #define LUA_IOLIBNAME "io" | |||
LUALIB_API int (luaopen_io) (lua_State *L); | LUALIB_API int (luaopen_io) (lua_State *L); | |||
#define LUA_OSLIBNAME "os" | #define LUA_OSLIBNAME "os" | |||
LUALIB_API int (luaopen_os) (lua_State *L); | LUALIB_API int (luaopen_os) (lua_State *L); | |||
#define LUA_STRLIBNAME "string" | #define LUA_STRLIBNAME "string" | |||
LUALIB_API int (luaopen_string) (lua_State *L); | LUALIB_API int (luaopen_string) (lua_State *L); | |||
#define LUA_MATHLIBNAME "math" | #define LUA_MATHLIBNAME "math" | |||
LUALIB_API int (luaopen_math) (lua_State *L); | LUALIB_API int (luaopen_math) (lua_State *L); | |||
#define LUA_DBLIBNAME "debug" | #define LUA_DBLIBNAME "debug" | |||
LUALIB_API int (luaopen_debug) (lua_State *L); | LUALIB_API int (luaopen_debug) (lua_State *L); | |||
#define LUA_LOADLIBNAME "package" | #define LUA_LOADLIBNAME "package" | |||
LUALIB_API int (luaopen_package) (lua_State *L); | LUALIB_API int (luaopen_package) (lua_State *L); | |||
/* open all previous libraries */ | /* open all previous libraries */ | |||
LUALIB_API void (luaL_openlibs) (lua_State *L); | LUALIB_API void (luaL_openlibs) (lua_State *L); | |||
#ifndef lua_assert | #ifndef lua_assert | |||
#define lua_assert(x) ((void)0) | #define lua_assert(x) ((void)0) | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
lundump.h | lundump.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
/* dump one chunk; from ldump.c */ | /* dump one chunk; from ldump.c */ | |||
LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); | |||
#ifdef luac_c | #ifdef luac_c | |||
/* print one chunk; from print.c */ | /* print one chunk; from print.c */ | |||
LUAI_FUNC void luaU_print (const Proto* f, int full); | LUAI_FUNC void luaU_print (const Proto* f, int full); | |||
#endif | #endif | |||
/* for header of binary files -- this is Lua 5.1 */ | /* for header of binary files -- this is Lua 5.1 */ | |||
#define LUAC_VERSION 0x51 | #define LUAC_VERSION 0x51 | |||
/* for header of binary files -- this is the official format */ | /* for header of binary files -- this is the official format */ | |||
#define LUAC_FORMAT 0 | #define LUAC_FORMAT 0 | |||
/* size of header of binary files */ | /* size of header of binary files */ | |||
#define LUAC_HEADERSIZE 12 | #define LUAC_HEADERSIZE 12 | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
lvm.h | lvm.h | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
#ifndef lvm_h | #ifndef lvm_h | |||
#define lvm_h | #define lvm_h | |||
#include "ldo.h" | #include "ldo.h" | |||
#include "lobject.h" | #include "lobject.h" | |||
#include "ltm.h" | #include "ltm.h" | |||
#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) | |||
#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ | |||
(((o) = luaV_tonumber(o,n)) != NULL)) | (((o) = luaV_tonumber(o,n)) != NULL)) | |||
#define equalobj(L,o1,o2) \ | #define equalobj(L,o1,o2) \ | |||
(ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) | |||
LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r ); | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r ); | |||
LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue * t2); | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue * t2); | |||
LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); | |||
LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); | |||
LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, | |||
StkId val); | StkId val); | |||
LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, | |||
StkId val); | StkId val); | |||
LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
lzio.h | lzio.h | |||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
** See Copyright Notice in lua.h | ** See Copyright Notice in lua.h | |||
*/ | */ | |||
#ifndef lzio_h | #ifndef lzio_h | |||
#define lzio_h | #define lzio_h | |||
#include "lua.h" | #include "lua.h" | |||
#include "lmem.h" | #include "lmem.h" | |||
#define EOZ (-1) /* end of stream */ | #define EOZ (-1) /* end of stream */ | |||
typedef struct Zio ZIO; | typedef struct Zio ZIO; | |||
#define char2int(c) cast(int, cast(unsigned char, (c))) | #define char2int(c) cast(int, cast(unsigned char, (c))) | |||
#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) | |||
typedef struct Mbuffer { | typedef struct Mbuffer { | |||
char *buffer; | char *buffer; | |||
size_t n; | size_t n; | |||
size_t buffsize; | size_t buffsize; | |||
} Mbuffer; | } Mbuffer; | |||
#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) | |||
#define luaZ_buffer(buff) ((buff)->buffer) | #define luaZ_buffer(buff) ((buff)->buffer) | |||
#define luaZ_sizebuffer(buff) ((buff)->buffsize) | #define luaZ_sizebuffer(buff) ((buff)->buffsize) | |||
#define luaZ_bufflen(buff) ((buff)->n) | #define luaZ_bufflen(buff) ((buff)->n) | |||
#define luaZ_resetbuffer(buff) ((buff)->n = 0) | #define luaZ_resetbuffer(buff) ((buff)->n = 0) | |||
#define luaZ_resizebuffer(L, buff, size) \ | #define luaZ_resizebuffer(L, buff, size) \ | |||
(luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ | (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char) | |||
(buff)->buffsize = size) | , \ | |||
(buff)->buffsize = size) | ||||
#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) | |||
LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); | |||
LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, | |||
void *data); | void *data); | |||
LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n b ytes */ | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ | |||
LUAI_FUNC int luaZ_lookahead (ZIO *z); | LUAI_FUNC int luaZ_lookahead (ZIO *z); | |||
/* --------- Private Part ------------------ */ | /* --------- Private Part ------------------ */ | |||
struct Zio { | struct Zio { | |||
size_t n; /* bytes still unread */ | size_t n; /* bytes still unread */ | |||
const char *p; /* current position in buffer */ | const char *p; /* current position in buffer */ | |||
lua_Reader reader; | lua_Reader reader; | |||
void* data; /* additional data */ | void* data; /* additional data */ | |||
lua_State *L; /* Lua state (for reader) */ | lua_State *L; /* Lua state (for reader) */ | |||
}; | }; | |||
LUAI_FUNC int luaZ_fill (ZIO *z); | LUAI_FUNC int luaZ_fill (ZIO *z); | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
13 lines changed or deleted | 14 lines changed or added | |||
main.h | main.h | |||
---|---|---|---|---|
#ifndef __MAIN_H__ | #ifndef __MAIN_H__ | |||
#define __MAIN_H__ | #define __MAIN_H__ | |||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from W indows headers | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from W indows headers | |||
// Windows Header Files: | // Windows Header Files: | |||
//#include <windows.h> | #include <windows.h> | |||
//#include <tchar.h> | #include <tchar.h> | |||
// C RunTime Header Files | // C RunTime Header Files | |||
#include "CCStdC.h" | #include "CCStdC.h" | |||
#endif // __MAIN_H__ | #endif // __MAIN_H__ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
nanoftp.h | nanoftp.h | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
* Author: Daniel Veillard | * Author: Daniel Veillard | |||
*/ | */ | |||
#ifndef __NANO_FTP_H__ | #ifndef __NANO_FTP_H__ | |||
#define __NANO_FTP_H__ | #define __NANO_FTP_H__ | |||
#include <libxml/xmlversion.h> | #include <libxml/xmlversion.h> | |||
#ifdef LIBXML_FTP_ENABLED | #ifdef LIBXML_FTP_ENABLED | |||
/* Needed for portability to Windows 64 bits */ | ||||
#if defined(__MINGW32__) || defined(_WIN32_WCE) | ||||
#include <winsock2.h> | ||||
#else | ||||
/** | ||||
* SOCKET: | ||||
* | ||||
* macro used to provide portability of code to windows sockets | ||||
*/ | ||||
#define SOCKET int | ||||
/** | ||||
* INVALID_SOCKET: | ||||
* | ||||
* macro used to provide portability of code to windows sockets | ||||
* the value to be used when the socket is not valid | ||||
*/ | ||||
#define INVALID_SOCKET (-1) | ||||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* ftpListCallback: | * ftpListCallback: | |||
* @userData: user provided data for the callback | * @userData: user provided data for the callback | |||
* @filename: the file name (including "->" when links are shown) | * @filename: the file name (including "->" when links are shown) | |||
* @attrib: the attribute string | * @attrib: the attribute string | |||
* @owner: the owner string | * @owner: the owner string | |||
skipping to change at line 41 | skipping to change at line 60 | |||
* @year: the year | * @year: the year | |||
* @month: the month | * @month: the month | |||
* @day: the day | * @day: the day | |||
* @hour: the hour | * @hour: the hour | |||
* @minute: the minute | * @minute: the minute | |||
* | * | |||
* A callback for the xmlNanoFTPList command. | * A callback for the xmlNanoFTPList command. | |||
* Note that only one of year and day:minute are specified. | * Note that only one of year and day:minute are specified. | |||
*/ | */ | |||
typedef void (*ftpListCallback) (void *userData, | typedef void (*ftpListCallback) (void *userData, | |||
const char *filename, const char *attrib, | const char *filename, const char *attrib, | |||
const char *owner, const char *group, | const char *owner, const char *group, | |||
unsigned long size, int links, int year, | unsigned long size, int links, int year, | |||
const char *month, int day, int hour, | const char *month, int day, int hour, | |||
int minute); | int minute); | |||
/** | /** | |||
* ftpDataCallback: | * ftpDataCallback: | |||
* @userData: the user provided context | * @userData: the user provided context | |||
* @data: the data received | * @data: the data received | |||
* @len: its size in bytes | * @len: its size in bytes | |||
* | * | |||
* A callback for the xmlNanoFTPGet command. | * A callback for the xmlNanoFTPGet command. | |||
*/ | */ | |||
typedef void (*ftpDataCallback) (void *userData, | typedef void (*ftpDataCallback) (void *userData, | |||
const char *data, | const char *data, | |||
int len); | int len); | |||
/* | /* | |||
* Init | * Init | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNanoFTPInit (void); | xmlNanoFTPInit (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNanoFTPCleanup (void); | xmlNanoFTPCleanup (void); | |||
/* | /* | |||
* Creating/freeing contexts. | * Creating/freeing contexts. | |||
*/ | */ | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlNanoFTPNewCtxt (const char *URL); | xmlNanoFTPNewCtxt (const char *URL); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNanoFTPFreeCtxt (void * ctx); | xmlNanoFTPFreeCtxt (void * ctx); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlNanoFTPConnectTo (const char *server, | xmlNanoFTPConnectTo (const char *server, | |||
int port); | int port); | |||
/* | /* | |||
* Opening/closing session connections. | * Opening/closing session connections. | |||
*/ | */ | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlNanoFTPOpen (const char *URL); | xmlNanoFTPOpen (const char *URL); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPConnect (void *ctx); | xmlNanoFTPConnect (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPClose (void *ctx); | xmlNanoFTPClose (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPQuit (void *ctx); | xmlNanoFTPQuit (void *ctx); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNanoFTPScanProxy (const char *URL); | xmlNanoFTPScanProxy (const char *URL); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNanoFTPProxy (const char *host, | xmlNanoFTPProxy (const char *host, | |||
int port, | int port, | |||
const char *user, | const char *user, | |||
const char *passwd, | const char *passwd, | |||
int type); | int type); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPUpdateURL (void *ctx, | xmlNanoFTPUpdateURL (void *ctx, | |||
const char *URL); | const char *URL); | |||
/* | /* | |||
* Rather internal commands. | * Rather internal commands. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPGetResponse (void *ctx); | xmlNanoFTPGetResponse (void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPCheckResponse (void *ctx); | xmlNanoFTPCheckResponse (void *ctx); | |||
/* | /* | |||
* CD/DIR/GET handlers. | * CD/DIR/GET handlers. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPCwd (void *ctx, | xmlNanoFTPCwd (void *ctx, | |||
const char *directory); | const char *directory); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPDele (void *ctx, | xmlNanoFTPDele (void *ctx, | |||
const char *file); | const char *file); | |||
XMLPUBFUN SOCKET XMLCALL | ||||
xmlNanoFTPGetConnection (void *ctx); | ||||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPGetConnection (void *ctx); | xmlNanoFTPCloseConnection(void *ctx); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNanoFTPCloseConnection(void *ctx); | xmlNanoFTPList (void *ctx, | |||
XMLPUBFUN int XMLCALL | ftpListCallback callback, | |||
xmlNanoFTPList (void *ctx, | void *userData, | |||
ftpListCallback callback, | const char *filename); | |||
void *userData, | XMLPUBFUN SOCKET XMLCALL | |||
const char *filename); | xmlNanoFTPGetSocket (void *ctx, | |||
XMLPUBFUN int XMLCALL | const char *filename); | |||
xmlNanoFTPGetSocket (void *ctx, | XMLPUBFUN int XMLCALL | |||
const char *filename); | xmlNanoFTPGet (void *ctx, | |||
XMLPUBFUN int XMLCALL | ftpDataCallback callback, | |||
xmlNanoFTPGet (void *ctx, | void *userData, | |||
ftpDataCallback callback, | const char *filename); | |||
void *userData, | XMLPUBFUN int XMLCALL | |||
const char *filename); | xmlNanoFTPRead (void *ctx, | |||
XMLPUBFUN int XMLCALL | void *dest, | |||
xmlNanoFTPRead (void *ctx, | int len); | |||
void *dest, | ||||
int len); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* LIBXML_FTP_ENABLED */ | #endif /* LIBXML_FTP_ENABLED */ | |||
#endif /* __NANO_FTP_H__ */ | #endif /* __NANO_FTP_H__ */ | |||
End of changes. 21 change blocks. | ||||
51 lines changed or deleted | 70 lines changed or added | |||
neon_matrix_impl.h | neon_matrix_impl.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#define __NEON_MATRIX_IMPL_H__ | #define __NEON_MATRIX_IMPL_H__ | |||
#ifdef __arm__ | #ifdef __arm__ | |||
#if defined(__QNX__) || defined(ANDROID) | #if defined(__QNX__) || defined(ANDROID) | |||
// blackberry and android don't have arm/arch.h but it defines __arm__ | // blackberry and android don't have arm/arch.h but it defines __arm__ | |||
#else | #else | |||
#include "arm/arch.h" | #include "arm/arch.h" | |||
#endif | #endif | |||
#endif // __arm__ | #endif // __arm__ | |||
// Matrixes are assumed to be stored in column major format according to Op enGL | // Matrices are assumed to be stored in column major format according to Op enGL | |||
// specification. | // specification. | |||
// Multiplies two 4x4 matrices (a,b) outputing a 4x4 matrix (output) | // Multiplies two 4x4 matrices (a,b) outputting a 4x4 matrix (output) | |||
void NEON_Matrix4Mul(const float* a, const float* b, float* output ); | void NEON_Matrix4Mul(const float* a, const float* b, float* output ); | |||
// Multiplies a 4x4 matrix (m) with a vector 4 (v), outputing a vector 4 | // Multiplies a 4x4 matrix (m) with a vector 4 (v), outputting a vector 4 | |||
void NEON_Matrix4Vector4Mul(const float* m, const float* v, float* output); | void NEON_Matrix4Vector4Mul(const float* m, const float* v, float* output); | |||
#endif // __NEON_MATRIX_IMPL_H__ | #endif // __NEON_MATRIX_IMPL_H__ | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 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 field * | XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema f | |||
/ | 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. | ||||
32 lines changed or deleted | 33 lines changed or added | |||
plane.h | plane.h | |||
---|---|---|---|---|
skipping to change at line 65 | skipping to change at line 65 | |||
} POINT_CLASSIFICATION; | } POINT_CLASSIFICATION; | |||
CC_DLL const kmScalar kmPlaneDot(const kmPlane* pP, const struct kmVec4* pV ); | CC_DLL const kmScalar kmPlaneDot(const kmPlane* pP, const struct kmVec4* pV ); | |||
CC_DLL const kmScalar kmPlaneDotCoord(const kmPlane* pP, const struct kmVec 3* pV); | CC_DLL const kmScalar kmPlaneDotCoord(const kmPlane* pP, const struct kmVec 3* pV); | |||
CC_DLL const kmScalar kmPlaneDotNormal(const kmPlane* pP, const struct kmVe c3* pV); | CC_DLL const kmScalar kmPlaneDotNormal(const kmPlane* pP, const struct kmVe c3* pV); | |||
CC_DLL kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const struct km Vec3* pPoint, const struct kmVec3* pNormal); | CC_DLL kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const struct km Vec3* pPoint, const struct kmVec3* pNormal); | |||
CC_DLL kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1, const struct kmVec3* p2, const struct kmVec3* p3); | CC_DLL kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1, const struct kmVec3* p2, const struct kmVec3* p3); | |||
CC_DLL kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPla ne* pP, const struct kmVec3* pV1, const struct kmVec3* pV2); | CC_DLL kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPla ne* pP, const struct kmVec3* pV1, const struct kmVec3* pV2); | |||
CC_DLL kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP); | CC_DLL kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP); | |||
CC_DLL kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScal ar s); | CC_DLL kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScal ar s); | |||
CC_DLL const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifys a point against a plane */ | CC_DLL const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifies a point against a plane */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif // PLANE_H_INCLUDED | #endif // PLANE_H_INCLUDED | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
png.h | png.h | |||
---|---|---|---|---|
/* png.h - header file for PNG reference library | /* png.h - header file for PNG reference library | |||
* | * | |||
* libpng version 1.4.8 - July 7, 2011 | * libpng version 1.4.5beta04 - November 8, 2010 | |||
* 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 (See LICENSE, below) | * This code is released under the libpng license (See LICENSE, below) | |||
* | * | |||
* Authors and maintainers: | * Authors and maintainers: | |||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalna t | * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalna t | |||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilge r | * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilge r | |||
* libpng versions 0.97, January 1998, through 1.4.8 - July 7, 2011: Glenn | * libpng versions 0.97, January 1998, through 1.4.5beta04 - November 8, 2 010: Glenn | |||
* See also "Contributing Authors", below. | * See also "Contributing Authors", below. | |||
* | * | |||
* Note about libpng version numbers: | * Note about libpng version numbers: | |||
* | * | |||
* Due to various miscommunications, unforeseen code incompatibilities | * Due to various miscommunications, unforeseen code incompatibilities | |||
* and occasional factors outside the authors' control, version numberin g | * and occasional factors outside the authors' control, version numberin g | |||
* on the library has not always been consistent and straightforward. | * on the library has not always been consistent and straightforward. | |||
* The following table summarizes matters since version 0.89c, which was | * The following table summarizes matters since version 0.89c, which was | |||
* the first widely used release: | * the first widely used release: | |||
* | * | |||
skipping to change at line 152 | skipping to change at line 152 | |||
* 1.4.2beta01 14 10402 14.so.14.2[.0] | * 1.4.2beta01 14 10402 14.so.14.2[.0] | |||
* 1.4.2rc02-06 14 10402 14.so.14.2[.0] | * 1.4.2rc02-06 14 10402 14.so.14.2[.0] | |||
* 1.4.2 14 10402 14.so.14.2[.0] | * 1.4.2 14 10402 14.so.14.2[.0] | |||
* 1.4.3beta01-05 14 10403 14.so.14.3[.0] | * 1.4.3beta01-05 14 10403 14.so.14.3[.0] | |||
* 1.4.3rc01-03 14 10403 14.so.14.3[.0] | * 1.4.3rc01-03 14 10403 14.so.14.3[.0] | |||
* 1.4.3 14 10403 14.so.14.3[.0] | * 1.4.3 14 10403 14.so.14.3[.0] | |||
* 1.4.4beta01-08 14 10404 14.so.14.4[.0] | * 1.4.4beta01-08 14 10404 14.so.14.4[.0] | |||
* 1.4.4rc01-05 14 10404 14.so.14.4[.0] | * 1.4.4rc01-05 14 10404 14.so.14.4[.0] | |||
* 1.4.4 14 10404 14.so.14.4[.0] | * 1.4.4 14 10404 14.so.14.4[.0] | |||
* 1.4.5beta01-04 14 10405 14.so.14.5[.0] | * 1.4.5beta01-04 14 10405 14.so.14.5[.0] | |||
* 1.4.5rc01 14 10405 14.so.14.5[.0] | ||||
* 1.4.5beta05-07 14 10405 14.so.14.5[.0] | ||||
* 1.4.5rc02-03 14 10405 14.so.14.5[.0] | ||||
* 1.4.5 14 10405 14.so.14.5[.0] | ||||
* 1.4.6beta01-07 14 10406 14.so.14.6[.0] | ||||
* 1.4.6rc01 14 10406 14.so.14.6[.0] | ||||
* 1.4.6 14 10406 14.so.14.6[.0] | ||||
* 1.4.7rc01 14 10407 14.so.14.7[.0] | ||||
* 1.4.7 14 10407 14.so.14.7[.0] | ||||
* 1.4.8beta01-05 14 10408 14.so.14.8[.0] | ||||
* 1.4.8rc01 14 10408 14.so.14.8[.0] | ||||
* 1.4.8 14 10408 14.so.14.8[.0] | ||||
* | * | |||
* Henceforth the source version will match the shared-library major | * Henceforth the source version will match the shared-library major | |||
* and minor numbers; the shared-library major version number will be | * and minor numbers; the shared-library major version number will be | |||
* used for changes in backward compatibility, as it is intended. The | * used for changes in backward compatibility, as it is intended. The | |||
* PNG_LIBPNG_VER macro, which is not used within libpng but is availabl e | * PNG_LIBPNG_VER macro, which is not used within libpng but is availabl e | |||
* for applications, is an unsigned integer of the form xyyzz correspond ing | * for applications, is an unsigned integer of the form xyyzz correspond ing | |||
* to the source version x.y.z (leading zeros in y and z). Beta version s | * to the source version x.y.z (leading zeros in y and z). Beta version s | |||
* were given the previous public release number plus a letter, until | * were given the previous public release number plus a letter, until | |||
* version 1.0.6j; from then on they were given the upcoming public | * version 1.0.6j; from then on they were given the upcoming public | |||
* release number plus "betaNN" or "rcN". | * release number plus "betaNN" or "rcN". | |||
skipping to change at line 195 | skipping to change at line 183 | |||
*/ | */ | |||
/* | /* | |||
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: | * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: | |||
* | * | |||
* If you modify libpng you may insert additional notices immediately follo wing | * If you modify libpng you may insert additional notices immediately follo wing | |||
* this sentence. | * this sentence. | |||
* | * | |||
* This code is released under the libpng license. | * This code is released under the libpng license. | |||
* | * | |||
* libpng versions 1.2.6, August 15, 2004, through 1.4.8, July 7, 2011, are | * libpng versions 1.2.6, August 15, 2004, through 1.4.5beta04, November 8, 2010, are | |||
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are | * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are | |||
* distributed according to the same disclaimer and license as libpng-1.2.5 | * distributed according to the same disclaimer and license as libpng-1.2.5 | |||
* with the following individual added to the list of Contributing Authors: | * with the following individual added to the list of Contributing Authors: | |||
* | * | |||
* Cosmin Truta | * Cosmin Truta | |||
* | * | |||
* libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are | * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are | |||
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are | * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are | |||
* distributed according to the same disclaimer and license as libpng-1.0.6 | * distributed according to the same disclaimer and license as libpng-1.0.6 | |||
* with the following individuals added to the list of Contributing Authors : | * with the following individuals added to the list of Contributing Authors : | |||
skipping to change at line 307 | skipping to change at line 295 | |||
* with testing, bug fixes, and patience. This wouldn't have been | * with testing, bug fixes, and patience. This wouldn't have been | |||
* possible without all of you. | * possible without all of you. | |||
* | * | |||
* Thanks to Frank J. T. Wojcik for helping with the documentation. | * Thanks to Frank J. T. Wojcik for helping with the documentation. | |||
*/ | */ | |||
/* | /* | |||
* Y2K compliance in libpng: | * Y2K compliance in libpng: | |||
* ========================= | * ========================= | |||
* | * | |||
* July 7, 2011 | * November 8, 2010 | |||
* | * | |||
* Since the PNG Development group is an ad-hoc body, we can't make | * Since the PNG Development group is an ad-hoc body, we can't make | |||
* an official declaration. | * an official declaration. | |||
* | * | |||
* This is your unofficial assurance that libpng from version 0.71 and | * This is your unofficial assurance that libpng from version 0.71 and | |||
* upward through 1.4.8 are Y2K compliant. It is my belief that earlier | * upward through 1.4.5beta04 are Y2K compliant. It is my belief that e arlier | |||
* versions were also Y2K compliant. | * versions were also Y2K compliant. | |||
* | * | |||
* Libpng only has three year fields. One is a 2-byte unsigned integer | * Libpng only has three year fields. One is a 2-byte unsigned integer | |||
* that will hold years up to 65535. The other two hold the date in tex t | * that will hold years up to 65535. The other two hold the date in tex t | |||
* format, and will hold years up to 9999. | * format, and will hold years up to 9999. | |||
* | * | |||
* The integer is | * The integer is | |||
* "png_uint_16 year" in png_time_struct. | * "png_uint_16 year" in png_time_struct. | |||
* | * | |||
* The strings are | * The strings are | |||
skipping to change at line 369 | skipping to change at line 357 | |||
#ifndef PNG_H | #ifndef PNG_H | |||
#define PNG_H | #define PNG_H | |||
/* This is not the place to learn how to use libpng. The file libpng.txt | /* This is not the place to learn how to use libpng. The file libpng.txt | |||
* describes how to use libpng, and the file example.c summarizes it | * describes how to use libpng, and the file example.c summarizes it | |||
* with some code on which to build. This file is useful for looking | * with some code on which to build. This file is useful for looking | |||
* at the actual function definitions and structure components. | * at the actual function definitions and structure components. | |||
*/ | */ | |||
/* Version information for png.h - this should match the version in png.c * / | /* Version information for png.h - this should match the version in png.c * / | |||
#define PNG_LIBPNG_VER_STRING "1.4.8" | #define PNG_LIBPNG_VER_STRING "1.4.5beta04" | |||
#define PNG_HEADER_VERSION_STRING \ | #define PNG_HEADER_VERSION_STRING \ | |||
" libpng version 1.4.8 - July 7, 2011\n" | " libpng version 1.4.5beta04 - November 8, 2010\n" | |||
#define PNG_LIBPNG_VER_SONUM 14 | #define PNG_LIBPNG_VER_SONUM 14 | |||
#define PNG_LIBPNG_VER_DLLNUM 14 | #define PNG_LIBPNG_VER_DLLNUM 14 | |||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ | /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ | |||
#define PNG_LIBPNG_VER_MAJOR 1 | #define PNG_LIBPNG_VER_MAJOR 1 | |||
#define PNG_LIBPNG_VER_MINOR 4 | #define PNG_LIBPNG_VER_MINOR 4 | |||
#define PNG_LIBPNG_VER_RELEASE 8 | #define PNG_LIBPNG_VER_RELEASE 5 | |||
/* This should match the numeric part of the final component of | /* This should match the numeric part of the final component of | |||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: | * PNG_LIBPNG_VER_STRING, omitting any leading zero: | |||
*/ | */ | |||
#define PNG_LIBPNG_VER_BUILD 0 | #define PNG_LIBPNG_VER_BUILD 04 | |||
/* Release Status */ | /* Release Status */ | |||
#define PNG_LIBPNG_BUILD_ALPHA 1 | #define PNG_LIBPNG_BUILD_ALPHA 1 | |||
#define PNG_LIBPNG_BUILD_BETA 2 | #define PNG_LIBPNG_BUILD_BETA 2 | |||
#define PNG_LIBPNG_BUILD_RC 3 | #define PNG_LIBPNG_BUILD_RC 3 | |||
#define PNG_LIBPNG_BUILD_STABLE 4 | #define PNG_LIBPNG_BUILD_STABLE 4 | |||
#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 | #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 | |||
/* Release-Specific Flags */ | /* Release-Specific Flags */ | |||
#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with | #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with | |||
skipping to change at line 409 | skipping to change at line 397 | |||
PNG_LIBPNG_BUILD_PRIVATE */ | PNG_LIBPNG_BUILD_PRIVATE */ | |||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA | #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA | |||
/* Careful here. At one time, Guy wanted to use 082, but that would be oct al. | /* Careful here. At one time, Guy wanted to use 082, but that would be oct al. | |||
* We must not include leading zeros. | * We must not include leading zeros. | |||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only | * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only | |||
* version 1.0.0 was mis-numbered 100 instead of 10000). From | * version 1.0.0 was mis-numbered 100 instead of 10000). From | |||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release | * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release | |||
*/ | */ | |||
#define PNG_LIBPNG_VER 10408 /* 1.4.8 */ | #define PNG_LIBPNG_VER 10405 /* 1.4.5 */ | |||
#ifndef PNG_VERSION_INFO_ONLY | #ifndef PNG_VERSION_INFO_ONLY | |||
/* Include the compression library's header */ | /* Include the compression library's header */ | |||
#include "zlib.h" | #include "zlib.h" | |||
#endif | #endif | |||
/* Include all user configurable info, including optional assembler routine s */ | /* Include all user configurable info, including optional assembler routine s */ | |||
#include "pngconf.h" | #include "pngconf.h" | |||
/* | /* | |||
skipping to change at line 916 | skipping to change at line 904 | |||
png_fixed_point int_y_red PNG_DEPSTRUCT; | png_fixed_point int_y_red PNG_DEPSTRUCT; | |||
png_fixed_point int_x_green PNG_DEPSTRUCT; | png_fixed_point int_x_green PNG_DEPSTRUCT; | |||
png_fixed_point int_y_green PNG_DEPSTRUCT; | png_fixed_point int_y_green PNG_DEPSTRUCT; | |||
png_fixed_point int_x_blue PNG_DEPSTRUCT; | png_fixed_point int_x_blue PNG_DEPSTRUCT; | |||
png_fixed_point int_y_blue PNG_DEPSTRUCT; | png_fixed_point int_y_blue PNG_DEPSTRUCT; | |||
#endif | #endif | |||
} png_info; | } png_info; | |||
typedef png_info FAR * png_infop; | typedef png_info FAR * png_infop; | |||
typedef PNG_CONST png_info FAR * png_const_infop; | ||||
typedef png_info FAR * FAR * png_infopp; | typedef png_info FAR * FAR * png_infopp; | |||
/* Maximum positive integer used in PNG is (2^31)-1 */ | /* Maximum positive integer used in PNG is (2^31)-1 */ | |||
#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) | #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) | |||
#define PNG_UINT_32_MAX ((png_uint_32)(-1)) | #define PNG_UINT_32_MAX ((png_uint_32)(-1)) | |||
#define PNG_SIZE_MAX ((png_size_t)(-1)) | #define PNG_SIZE_MAX ((png_size_t)(-1)) | |||
/* These describe the color_type field in png_info. */ | /* These describe the color_type field in png_info. */ | |||
/* color type masks */ | /* color type masks */ | |||
#define PNG_COLOR_MASK_PALETTE 1 | #define PNG_COLOR_MASK_PALETTE 1 | |||
skipping to change at line 1037 | skipping to change at line 1024 | |||
typedef png_row_info FAR * FAR * png_row_infopp; | typedef png_row_info FAR * FAR * png_row_infopp; | |||
/* These are the function types for the I/O functions and for the functions | /* These are the function types for the I/O functions and for the functions | |||
* that allow the user to override the default I/O functions with his or he r | * that allow the user to override the default I/O functions with his or he r | |||
* own. The png_error_ptr type should match that of user-supplied warning | * own. The png_error_ptr type should match that of user-supplied warning | |||
* and error functions, while the png_rw_ptr type should match that of the | * and error functions, while the png_rw_ptr type should match that of the | |||
* user read/write data functions. | * user read/write data functions. | |||
*/ | */ | |||
typedef struct png_struct_def png_struct; | typedef struct png_struct_def png_struct; | |||
typedef png_struct FAR * png_structp; | typedef png_struct FAR * png_structp; | |||
typedef PNG_CONST png_struct FAR * png_const_structp; | ||||
typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)) ; | typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)) ; | |||
typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_ t)); | typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_ t)); | |||
typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); | typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); | |||
typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32 , | typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32 , | |||
int)); | int)); | |||
typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_3 2, | typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_3 2, | |||
int)); | int)); | |||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | |||
skipping to change at line 1494 | skipping to change at line 1480 | |||
#ifdef PNG_IO_STATE_SUPPORTED | #ifdef PNG_IO_STATE_SUPPORTED | |||
/* New member added in libpng-1.4.0 */ | /* New member added in libpng-1.4.0 */ | |||
png_uint_32 io_state PNG_DEPSTRUCT; | png_uint_32 io_state PNG_DEPSTRUCT; | |||
#endif | #endif | |||
}; | }; | |||
/* This triggers a compiler error in png.c, if png.c and png.h | /* This triggers a compiler error in png.c, if png.c and png.h | |||
* do not agree upon the version number. | * do not agree upon the version number. | |||
*/ | */ | |||
typedef png_structp version_1_4_8; | typedef png_structp version_1_4_5beta04; | |||
typedef png_struct FAR * FAR * png_structpp; | typedef png_struct FAR * FAR * png_structpp; | |||
/* Here are the function definitions most commonly used. This is not | /* Here are the function definitions most commonly used. This is not | |||
* the place to find out how to use libpng. See libpng.txt for the | * the place to find out how to use libpng. See libpng.txt for the | |||
* full explanation, see example.c for the summary. This just provides | * full explanation, see example.c for the summary. This just provides | |||
* a simple one line description of the use of each function. | * a simple one line description of the use of each function. | |||
*/ | */ | |||
/* Returns the version number of the library */ | /* Returns the version number of the library */ | |||
skipping to change at line 1537 | skipping to change at line 1523 | |||
PNG_EXPORT(png_structp,png_create_read_struct) | PNG_EXPORT(png_structp,png_create_read_struct) | |||
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, | PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, | |||
png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; | png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; | |||
/* Allocate and initialize png_ptr struct for writing, and any other memory */ | /* Allocate and initialize png_ptr struct for writing, and any other memory */ | |||
PNG_EXPORT(png_structp,png_create_write_struct) | PNG_EXPORT(png_structp,png_create_write_struct) | |||
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, | PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, | |||
png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; | png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; | |||
PNG_EXPORT(png_size_t,png_get_compression_buffer_size) | PNG_EXPORT(png_size_t,png_get_compression_buffer_size) | |||
PNGARG((png_const_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
PNG_EXPORT(void,png_set_compression_buffer_size) | PNG_EXPORT(void,png_set_compression_buffer_size) | |||
PNGARG((png_structp png_ptr, png_size_t size)); | PNGARG((png_structp png_ptr, png_size_t size)); | |||
/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp | /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp | |||
* match up. | * match up. | |||
*/ | */ | |||
#ifdef PNG_SETJMP_SUPPORTED | #ifdef PNG_SETJMP_SUPPORTED | |||
/* This function returns the jmp_buf built in to *png_ptr. It must be | /* This function returns the jmp_buf built in to *png_ptr. It must be | |||
* supplied with an appropriate 'longjmp' function to use on that jmp_buf | * supplied with an appropriate 'longjmp' function to use on that jmp_buf | |||
skipping to change at line 1659 | skipping to change at line 1645 | |||
#endif | #endif | |||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED | #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED | |||
/* Reduce RGB to grayscale. */ | /* Reduce RGB to grayscale. */ | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, | |||
int error_action, double red, double green )); | int error_action, double red, double green )); | |||
#endif | #endif | |||
PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, | |||
int error_action, png_fixed_point red, png_fixed_point green )); | int error_action, png_fixed_point red, png_fixed_point green )); | |||
PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_const_structp | PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp | |||
png_ptr)); | png_ptr)); | |||
#endif | #endif | |||
PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, | PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, | |||
png_colorp palette)); | png_colorp palette)); | |||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED | #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED | |||
PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); | PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); | |||
#endif | #endif | |||
skipping to change at line 1980 | skipping to change at line 1966 | |||
* write and use replacement functions. The replacement error_fn should | * write and use replacement functions. The replacement error_fn should | |||
* still do a longjmp to the last setjmp location if you are using this | * still do a longjmp to the last setjmp location if you are using this | |||
* method of error handling. If error_fn or warning_fn is NULL, the | * method of error handling. If error_fn or warning_fn is NULL, the | |||
* default function will be used. | * default function will be used. | |||
*/ | */ | |||
PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, | |||
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); | png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); | |||
/* Return the user pointer associated with the error functions */ | /* Return the user pointer associated with the error functions */ | |||
PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_const_structp png_ptr)) ; | PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); | |||
/* Replace the default data output functions with a user supplied one(s). | /* Replace the default data output functions with a user supplied one(s). | |||
* If buffered output is not used, then output_flush_fn can be set to NULL. | * If buffered output is not used, then output_flush_fn can be set to NULL. | |||
* If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time | * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time | |||
* output_flush_fn will be ignored (and thus can be NULL). | * output_flush_fn will be ignored (and thus can be NULL). | |||
* It is probably a mistake to use NULL for output_flush_fn if | * It is probably a mistake to use NULL for output_flush_fn if | |||
* write_data_fn is not also NULL unless you have built libpng with | * write_data_fn is not also NULL unless you have built libpng with | |||
* PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's | * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's | |||
* default flush function, which uses the standard *FILE structure, will | * default flush function, which uses the standard *FILE structure, will | |||
* be used. | * be used. | |||
skipping to change at line 2013 | skipping to change at line 1999 | |||
png_read_status_ptr read_row_fn)); | png_read_status_ptr read_row_fn)); | |||
PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, | |||
png_write_status_ptr write_row_fn)); | png_write_status_ptr write_row_fn)); | |||
#ifdef PNG_USER_MEM_SUPPORTED | #ifdef PNG_USER_MEM_SUPPORTED | |||
/* Replace the default memory allocation functions with user supplied one(s ). */ | /* Replace the default memory allocation functions with user supplied one(s ). */ | |||
PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, | |||
png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); | png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); | |||
/* Return the user pointer associated with the memory functions */ | /* Return the user pointer associated with the memory functions */ | |||
PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_const_structp png_ptr)); | PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); | |||
#endif | #endif | |||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED | #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED | |||
PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp | PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp | |||
png_ptr, png_user_transform_ptr read_user_transform_fn)); | png_ptr, png_user_transform_ptr read_user_transform_fn)); | |||
#endif | #endif | |||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED | #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED | |||
PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp | PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp | |||
png_ptr, png_user_transform_ptr write_user_transform_fn)); | png_ptr, png_user_transform_ptr write_user_transform_fn)); | |||
#endif | #endif | |||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ | #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ | |||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) | defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) | |||
PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp | PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp | |||
png_ptr, png_voidp user_transform_ptr, int user_transform_depth, | png_ptr, png_voidp user_transform_ptr, int user_transform_depth, | |||
int user_transform_channels)); | int user_transform_channels)); | |||
/* Return the user pointer associated with the user transform functions */ | /* Return the user pointer associated with the user transform functions */ | |||
PNG_EXPORT(png_voidp,png_get_user_transform_ptr) | PNG_EXPORT(png_voidp,png_get_user_transform_ptr) | |||
PNGARG((png_const_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
#endif | #endif | |||
#ifdef PNG_USER_CHUNKS_SUPPORTED | #ifdef PNG_USER_CHUNKS_SUPPORTED | |||
PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, | |||
png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); | png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); | |||
PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_const_structp | PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp | |||
png_ptr)); | png_ptr)); | |||
#endif | #endif | |||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | |||
/* Sets the function callbacks for the push reader, and a pointer to a | /* Sets the function callbacks for the push reader, and a pointer to a | |||
* user-defined structure available to the callback functions. | * user-defined structure available to the callback functions. | |||
*/ | */ | |||
PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, | |||
png_voidp progressive_ptr, | png_voidp progressive_ptr, | |||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, | png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, | |||
png_progressive_end_ptr end_fn)); | png_progressive_end_ptr end_fn)); | |||
/* Returns the user pointer associated with the push read functions */ | /* Returns the user pointer associated with the push read functions */ | |||
PNG_EXPORT(png_voidp,png_get_progressive_ptr) | PNG_EXPORT(png_voidp,png_get_progressive_ptr) | |||
PNGARG((png_const_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
/* Function to be called when data becomes available */ | /* Function to be called when data becomes available */ | |||
PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); | png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); | |||
/* Function that combines rows. Not very much different than the | /* Function that combines rows. Not very much different than the | |||
* png_combine_row() call. Is this even used????? | * png_combine_row() call. Is this even used????? | |||
*/ | */ | |||
PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, | |||
png_bytep old_row, png_bytep new_row)); | png_bytep old_row, png_bytep new_row)); | |||
skipping to change at line 2162 | skipping to change at line 2148 | |||
* setting pointers into the png_info_struct where the data is stored. The | * setting pointers into the png_info_struct where the data is stored. The | |||
* png_get_<chunk> functions return a non-zero value if the data was availa ble | * png_get_<chunk> functions return a non-zero value if the data was availa ble | |||
* in info_ptr, or return zero and do not change any of the parameters if t he | * in info_ptr, or return zero and do not change any of the parameters if t he | |||
* data was not available. | * data was not available. | |||
* | * | |||
* These functions should be used instead of directly accessing png_info | * These functions should be used instead of directly accessing png_info | |||
* to avoid problems with future changes in the size and internal layout of | * to avoid problems with future changes in the size and internal layout of | |||
* png_info_struct. | * png_info_struct. | |||
*/ | */ | |||
/* Returns "flag" if chunk data is valid in info_ptr. */ | /* Returns "flag" if chunk data is valid in info_ptr. */ | |||
PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_uint_32 flag)); | png_infop info_ptr, png_uint_32 flag)); | |||
/* Returns number of bytes needed to hold a transformed row. */ | /* Returns number of bytes needed to hold a transformed row. */ | |||
PNG_EXPORT(png_size_t,png_get_rowbytes) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_size_t,png_get_rowbytes) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr)); | png_infop info_ptr)); | |||
#ifdef PNG_INFO_IMAGE_SUPPORTED | #ifdef PNG_INFO_IMAGE_SUPPORTED | |||
/* Returns row_pointers, which is an array of pointers to scanlines that wa s | /* Returns row_pointers, which is an array of pointers to scanlines that wa s | |||
* returned from png_read_png(). | * returned from png_read_png(). | |||
*/ | */ | |||
PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr)); | png_infop info_ptr)); | |||
/* Set row_pointers, which is an array of pointers to scanlines for use | /* Set row_pointers, which is an array of pointers to scanlines for use | |||
* by png_write_png(). | * by png_write_png(). | |||
*/ | */ | |||
PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_bytepp row_pointers)); | png_infop info_ptr, png_bytepp row_pointers)); | |||
#endif | #endif | |||
/* Returns number of color channels in image. */ | /* Returns number of color channels in image. */ | |||
PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr)); | png_infop info_ptr)); | |||
#ifdef PNG_EASY_ACCESS_SUPPORTED | #ifdef PNG_EASY_ACCESS_SUPPORTED | |||
/* Returns image width in pixels. */ | /* Returns image width in pixels. */ | |||
PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image height in pixels. */ | /* Returns image height in pixels. */ | |||
PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image bit_depth. */ | /* Returns image bit_depth. */ | |||
PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_const_structp | PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image color_type. */ | /* Returns image color_type. */ | |||
PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_const_structp | PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image filter_type. */ | /* Returns image filter_type. */ | |||
PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_const_structp | PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image interlace_type. */ | /* Returns image interlace_type. */ | |||
PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_const_structp | PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image compression_type. */ | /* Returns image compression_type. */ | |||
PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_const_structp | PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
/* Returns image resolution in pixels per meter, from pHYs chunk data. */ | /* Returns image resolution in pixels per meter, from pHYs chunk data. */ | |||
PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_const_struc | PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp | |||
tp | png_ptr, png_infop info_ptr)); | |||
png_ptr, png_const_infop info_ptr)); | PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp | |||
PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_const_struc | png_ptr, png_infop info_ptr)); | |||
tp | ||||
png_ptr, png_const_infop info_ptr)); | ||||
/* Returns pixel aspect ratio, computed from pHYs chunk data. */ | /* Returns pixel aspect ratio, computed from pHYs chunk data. */ | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_const_structp | PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
#endif | #endif | |||
/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ | /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ | |||
PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_const_structp | PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_const_structp | PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_const_structp | PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_const_structp | PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr)); | png_ptr, png_infop info_ptr)); | |||
#endif /* PNG_EASY_ACCESS_SUPPORTED */ | #endif /* PNG_EASY_ACCESS_SUPPORTED */ | |||
/* Returns pointer to signature string read from PNG header */ | /* Returns pointer to signature string read from PNG header */ | |||
PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr)); | png_infop info_ptr)); | |||
#ifdef PNG_bKGD_SUPPORTED | #ifdef PNG_bKGD_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_color_16p *background)); | png_infop info_ptr, png_color_16p *background)); | |||
#endif | #endif | |||
#ifdef PNG_bKGD_SUPPORTED | #ifdef PNG_bKGD_SUPPORTED | |||
PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_color_16p background)); | png_infop info_ptr, png_color_16p background)); | |||
#endif | #endif | |||
#ifdef PNG_cHRM_SUPPORTED | #ifdef PNG_cHRM_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, double *white_x, double *white_y, double *red_ | png_infop info_ptr, double *white_x, double *white_y, double *red_x, | |||
x, | ||||
double *red_y, double *green_x, double *green_y, double *blue_x, | double *red_y, double *green_x, double *green_y, double *blue_x, | |||
double *blue_y)); | double *blue_y)); | |||
#endif | #endif | |||
#ifdef PNG_FIXED_POINT_SUPPORTED | #ifdef PNG_FIXED_POINT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_const_structp png_pt | PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, | |||
r, | png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point | |||
png_const_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point | ||||
*int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, | *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, | |||
png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_po int | png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_po int | |||
*int_blue_x, png_fixed_point *int_blue_y)); | *int_blue_x, png_fixed_point *int_blue_y)); | |||
#endif | #endif | |||
#endif | #endif | |||
#ifdef PNG_cHRM_SUPPORTED | #ifdef PNG_cHRM_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, double white_x, double white_y, double red_x, | png_infop info_ptr, double white_x, double white_y, double red_x, | |||
skipping to change at line 2288 | skipping to change at line 2274 | |||
PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_whi te_y, | png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_whi te_y, | |||
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point | |||
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, | |||
png_fixed_point int_blue_y)); | png_fixed_point int_blue_y)); | |||
#endif | #endif | |||
#endif | #endif | |||
#ifdef PNG_gAMA_SUPPORTED | #ifdef PNG_gAMA_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, double *file_gamma)); | png_infop info_ptr, double *file_gamma)); | |||
#endif | #endif | |||
PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_const_structp png_pt | PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, | |||
r, | png_infop info_ptr, png_fixed_point *int_file_gamma)); | |||
png_const_infop info_ptr, png_fixed_point *int_file_gamma)); | ||||
#endif | #endif | |||
#ifdef PNG_gAMA_SUPPORTED | #ifdef PNG_gAMA_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, double file_gamma)); | png_infop info_ptr, double file_gamma)); | |||
#endif | #endif | |||
PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_fixed_point int_file_gamma)); | png_infop info_ptr, png_fixed_point int_file_gamma)); | |||
#endif | #endif | |||
#ifdef PNG_hIST_SUPPORTED | #ifdef PNG_hIST_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_uint_16p *hist)); | png_infop info_ptr, png_uint_16p *hist)); | |||
#endif | #endif | |||
#ifdef PNG_hIST_SUPPORTED | #ifdef PNG_hIST_SUPPORTED | |||
PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_uint_16p hist)); | png_infop info_ptr, png_uint_16p hist)); | |||
#endif | #endif | |||
PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, | png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, | |||
int *bit_depth, int *color_type, int *interlace_method, | int *bit_depth, int *color_type, int *interlace_method, | |||
int *compression_method, int *filter_method)); | int *compression_method, int *filter_method)); | |||
PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth , | png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth , | |||
int color_type, int interlace_method, int compression_method, | int color_type, int interlace_method, int compression_method, | |||
int filter_method)); | int filter_method)); | |||
#ifdef PNG_oFFs_SUPPORTED | #ifdef PNG_oFFs_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, | png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, | |||
int *unit_type)); | int *unit_type)); | |||
#endif | #endif | |||
#ifdef PNG_oFFs_SUPPORTED | #ifdef PNG_oFFs_SUPPORTED | |||
PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, | png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, | |||
int unit_type)); | int unit_type)); | |||
#endif | #endif | |||
#ifdef PNG_pCAL_SUPPORTED | #ifdef PNG_pCAL_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 | png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, | |||
*X1, | ||||
int *type, int *nparams, png_charp *units, png_charpp *params)); | int *type, int *nparams, png_charp *units, png_charpp *params)); | |||
#endif | #endif | |||
#ifdef PNG_pCAL_SUPPORTED | #ifdef PNG_pCAL_SUPPORTED | |||
PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, | png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, | |||
int type, int nparams, png_charp units, png_charpp params)); | int type, int nparams, png_charp units, png_charpp params)); | |||
#endif | #endif | |||
#ifdef PNG_pHYs_SUPPORTED | #ifdef PNG_pHYs_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *u | png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_ty | |||
nit_type)); | pe)); | |||
#endif | #endif | |||
#ifdef PNG_pHYs_SUPPORTED | #ifdef PNG_pHYs_SUPPORTED | |||
PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type) ); | png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type) ); | |||
#endif | #endif | |||
PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_colorp *palette, int *num_palette)); | png_infop info_ptr, png_colorp *palette, int *num_palette)); | |||
PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_colorp palette, int num_palette)); | png_infop info_ptr, png_colorp palette, int num_palette)); | |||
#ifdef PNG_sBIT_SUPPORTED | #ifdef PNG_sBIT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_color_8p *sig_bit)); | png_infop info_ptr, png_color_8p *sig_bit)); | |||
#endif | #endif | |||
#ifdef PNG_sBIT_SUPPORTED | #ifdef PNG_sBIT_SUPPORTED | |||
PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_color_8p sig_bit)); | png_infop info_ptr, png_color_8p sig_bit)); | |||
#endif | #endif | |||
#ifdef PNG_sRGB_SUPPORTED | #ifdef PNG_sRGB_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, int *intent)); | png_infop info_ptr, int *intent)); | |||
#endif | #endif | |||
#ifdef PNG_sRGB_SUPPORTED | #ifdef PNG_sRGB_SUPPORTED | |||
PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, int intent)); | png_infop info_ptr, int intent)); | |||
PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, int intent)); | png_infop info_ptr, int intent)); | |||
#endif | #endif | |||
#ifdef PNG_iCCP_SUPPORTED | #ifdef PNG_iCCP_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_charpp name, int *compression_type, | png_infop info_ptr, png_charpp name, int *compression_type, | |||
png_charpp profile, png_uint_32 *proflen)); | png_charpp profile, png_uint_32 *proflen)); | |||
/* Note to maintainer: profile should be png_bytepp */ | /* Note to maintainer: profile should be png_bytepp */ | |||
#endif | #endif | |||
#ifdef PNG_iCCP_SUPPORTED | #ifdef PNG_iCCP_SUPPORTED | |||
PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_charp name, int compression_type, | png_infop info_ptr, png_charp name, int compression_type, | |||
png_charp profile, png_uint_32 proflen)); | png_charp profile, png_uint_32 proflen)); | |||
/* Note to maintainer: profile should be png_bytep */ | /* Note to maintainer: profile should be png_bytep */ | |||
#endif | #endif | |||
#ifdef PNG_sPLT_SUPPORTED | #ifdef PNG_sPLT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_sPLT_tpp entries)); | png_infop info_ptr, png_sPLT_tpp entries)); | |||
#endif | #endif | |||
#ifdef PNG_sPLT_SUPPORTED | #ifdef PNG_sPLT_SUPPORTED | |||
PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_sPLT_tp entries, int nentries)); | png_infop info_ptr, png_sPLT_tp entries, int nentries)); | |||
#endif | #endif | |||
#ifdef PNG_TEXT_SUPPORTED | #ifdef PNG_TEXT_SUPPORTED | |||
/* png_get_text also returns the number of text chunks in *num_text */ | /* png_get_text also returns the number of text chunks in *num_text */ | |||
PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_textp *text_ptr, int *num_text)); | png_infop info_ptr, png_textp *text_ptr, int *num_text)); | |||
#endif | #endif | |||
/* Note while png_set_text() will accept a structure whose text, | /* Note while png_set_text() will accept a structure whose text, | |||
* language, and translated keywords are NULL pointers, the structure | * language, and translated keywords are NULL pointers, the structure | |||
* returned by png_get_text will always contain regular | * returned by png_get_text will always contain regular | |||
* zero-terminated C strings. They might be empty strings but | * zero-terminated C strings. They might be empty strings but | |||
* they will never be NULL pointers. | * they will never be NULL pointers. | |||
*/ | */ | |||
#ifdef PNG_TEXT_SUPPORTED | #ifdef PNG_TEXT_SUPPORTED | |||
PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_textp text_ptr, int num_text)); | png_infop info_ptr, png_textp text_ptr, int num_text)); | |||
#endif | #endif | |||
#ifdef PNG_tIME_SUPPORTED | #ifdef PNG_tIME_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_timep *mod_time)); | png_infop info_ptr, png_timep *mod_time)); | |||
#endif | #endif | |||
#ifdef PNG_tIME_SUPPORTED | #ifdef PNG_tIME_SUPPORTED | |||
PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_timep mod_time)); | png_infop info_ptr, png_timep mod_time)); | |||
#endif | #endif | |||
#ifdef PNG_tRNS_SUPPORTED | #ifdef PNG_tRNS_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, | png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, | |||
png_color_16p *trans_color)); | png_color_16p *trans_color)); | |||
#endif | #endif | |||
#ifdef PNG_tRNS_SUPPORTED | #ifdef PNG_tRNS_SUPPORTED | |||
PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_bytep trans_alpha, int num_trans, | png_infop info_ptr, png_bytep trans_alpha, int num_trans, | |||
png_color_16p trans_color)); | png_color_16p trans_color)); | |||
#endif | #endif | |||
#ifdef PNG_tRNS_SUPPORTED | #ifdef PNG_tRNS_SUPPORTED | |||
#endif | #endif | |||
#ifdef PNG_sCAL_SUPPORTED | #ifdef PNG_sCAL_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, int *unit, double *width, double *height)); | png_infop info_ptr, int *unit, double *width, double *height)); | |||
#else | #else | |||
#ifdef PNG_FIXED_POINT_SUPPORTED | #ifdef PNG_FIXED_POINT_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheig | png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); | |||
ht)); | ||||
#endif | #endif | |||
#endif | #endif | |||
#endif /* PNG_sCAL_SUPPORTED */ | #endif /* PNG_sCAL_SUPPORTED */ | |||
#ifdef PNG_sCAL_SUPPORTED | #ifdef PNG_sCAL_SUPPORTED | |||
#ifdef PNG_FLOATING_POINT_SUPPORTED | #ifdef PNG_FLOATING_POINT_SUPPORTED | |||
PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, | PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, int unit, double width, double height)); | png_infop info_ptr, int unit, double width, double height)); | |||
#else | #else | |||
#ifdef PNG_FIXED_POINT_SUPPORTED | #ifdef PNG_FIXED_POINT_SUPPORTED | |||
skipping to change at line 2497 | skipping to change at line 2483 | |||
PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp | PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp | |||
png_ptr, int keep, png_bytep chunk_list, int num_chunks)); | png_ptr, int keep, png_bytep chunk_list, int num_chunks)); | |||
PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_byte p | PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_byte p | |||
chunk_name)); | chunk_name)); | |||
#endif | #endif | |||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED | #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED | |||
PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, | PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); | png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); | |||
PNG_EXPORT(void, png_set_unknown_chunk_location) | PNG_EXPORT(void, png_set_unknown_chunk_location) | |||
PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location )); | PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location )); | |||
PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp | |||
png_ptr, png_const_infop info_ptr, png_unknown_chunkpp entries)); | png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); | |||
#endif | #endif | |||
/* Png_free_data() will turn off the "valid" flag for anything it frees. | /* Png_free_data() will turn off the "valid" flag for anything it frees. | |||
* If you need to turn it off for a chunk that your application has freed, | * If you need to turn it off for a chunk that your application has freed, | |||
* you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); | * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); | |||
*/ | */ | |||
PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, | PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, int mask)); | png_infop info_ptr, int mask)); | |||
#ifdef PNG_INFO_IMAGE_SUPPORTED | #ifdef PNG_INFO_IMAGE_SUPPORTED | |||
skipping to change at line 2520 | skipping to change at line 2506 | |||
PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, | PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, | png_infop info_ptr, | |||
int transforms, | int transforms, | |||
png_voidp params)); | png_voidp params)); | |||
PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, | PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, | |||
png_infop info_ptr, | png_infop info_ptr, | |||
int transforms, | int transforms, | |||
png_voidp params)); | png_voidp params)); | |||
#endif | #endif | |||
PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_const_structp png_ptr)) | PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); | |||
; | PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); | |||
PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_const_structp png_ptr) | PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp | |||
); | ||||
PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_const_structp | ||||
png_ptr)); | png_ptr)); | |||
PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_const_structp png_ptr) ); | PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); | |||
#ifdef PNG_MNG_FEATURES_SUPPORTED | #ifdef PNG_MNG_FEATURES_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp | PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp | |||
png_ptr, png_uint_32 mng_features_permitted)); | png_ptr, png_uint_32 mng_features_permitted)); | |||
#endif | #endif | |||
/* For use in png_set_keep_unknown, added to version 1.2.6 */ | /* For use in png_set_keep_unknown, added to version 1.2.6 */ | |||
#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 | #define PNG_HANDLE_CHUNK_AS_DEFAULT 0 | |||
#define PNG_HANDLE_CHUNK_NEVER 1 | #define PNG_HANDLE_CHUNK_NEVER 1 | |||
#define PNG_HANDLE_CHUNK_IF_SAFE 2 | #define PNG_HANDLE_CHUNK_IF_SAFE 2 | |||
skipping to change at line 2549 | skipping to change at line 2535 | |||
*/ | */ | |||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED | #ifdef PNG_ERROR_NUMBERS_SUPPORTED | |||
PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp | PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp | |||
png_ptr, png_uint_32 strip_mode)); | png_ptr, png_uint_32 strip_mode)); | |||
#endif | #endif | |||
/* Added in libpng-1.2.6 */ | /* Added in libpng-1.2.6 */ | |||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED | #ifdef PNG_SET_USER_LIMITS_SUPPORTED | |||
PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp | PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp | |||
png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); | png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); | |||
PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp | |||
png_ptr)); | png_ptr)); | |||
PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_const_structp | PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp | |||
png_ptr)); | png_ptr)); | |||
/* Added in libpng-1.4.0 */ | /* Added in libpng-1.4.0 */ | |||
PNG_EXPORT(void,png_set_chunk_cache_max) PNGARG((png_structp | PNG_EXPORT(void,png_set_chunk_cache_max) PNGARG((png_structp | |||
png_ptr, png_uint_32 user_chunk_cache_max)); | png_ptr, png_uint_32 user_chunk_cache_max)); | |||
PNG_EXPORT(png_uint_32,png_get_chunk_cache_max) | PNG_EXPORT(png_uint_32,png_get_chunk_cache_max) | |||
PNGARG((png_const_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
/* Added in libpng-1.4.1 */ | /* Added in libpng-1.4.1 */ | |||
PNG_EXPORT(void,png_set_chunk_malloc_max) PNGARG((png_structp | PNG_EXPORT(void,png_set_chunk_malloc_max) PNGARG((png_structp | |||
png_ptr, png_alloc_size_t user_chunk_cache_max)); | png_ptr, png_alloc_size_t user_chunk_cache_max)); | |||
PNG_EXPORT(png_alloc_size_t,png_get_chunk_malloc_max) | PNG_EXPORT(png_alloc_size_t,png_get_chunk_malloc_max) | |||
PNGARG((png_const_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
#endif | #endif | |||
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) | #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) | |||
PNG_EXPORT(png_uint_32,png_get_pixels_per_inch) | PNG_EXPORT(png_uint_32,png_get_pixels_per_inch) PNGARG((png_structp png_ptr | |||
PNGARG((png_const_structp png_ptr, png_const_infop info_ptr)); | , | |||
png_infop info_ptr)); | ||||
PNG_EXPORT(png_uint_32,png_get_x_pixels_per_inch) | PNG_EXPORT(png_uint_32,png_get_x_pixels_per_inch) PNGARG((png_structp png_p | |||
PNGARG((png_const_structp png_ptr, png_const_infop info_ptr)); | tr, | |||
png_infop info_ptr)); | ||||
PNG_EXPORT(png_uint_32,png_get_y_pixels_per_inch) | PNG_EXPORT(png_uint_32,png_get_y_pixels_per_inch) PNGARG((png_structp png_p | |||
PNGARG((png_const_structp png_ptr, png_const_infop info_ptr)); | tr, | |||
png_infop info_ptr)); | ||||
PNG_EXPORT(float,png_get_x_offset_inches) PNGARG((png_const_structp png_ptr | PNG_EXPORT(float,png_get_x_offset_inches) PNGARG((png_structp png_ptr, | |||
, | png_infop info_ptr)); | |||
png_const_infop info_ptr)); | ||||
PNG_EXPORT(float,png_get_y_offset_inches) PNGARG((png_const_structp png_ptr | PNG_EXPORT(float,png_get_y_offset_inches) PNGARG((png_structp png_ptr, | |||
, | png_infop info_ptr)); | |||
png_const_infop info_ptr)); | ||||
#ifdef PNG_pHYs_SUPPORTED | #ifdef PNG_pHYs_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_pHYs_dpi) PNGARG((png_const_structp png_ptr, | PNG_EXPORT(png_uint_32,png_get_pHYs_dpi) PNGARG((png_structp png_ptr, | |||
png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, | png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) | |||
int *unit_type)); | ); | |||
#endif /* PNG_pHYs_SUPPORTED */ | #endif /* PNG_pHYs_SUPPORTED */ | |||
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ | #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ | |||
/* Added in libpng-1.4.0 */ | /* Added in libpng-1.4.0 */ | |||
#ifdef PNG_IO_STATE_SUPPORTED | #ifdef PNG_IO_STATE_SUPPORTED | |||
PNG_EXPORT(png_uint_32,png_get_io_state) PNGARG((png_const_structp png_ptr) ); | PNG_EXPORT(png_uint_32,png_get_io_state) PNGARG((png_structp png_ptr)); | |||
PNG_EXPORT(png_bytep,png_get_io_chunk_name) | PNG_EXPORT(png_bytep,png_get_io_chunk_name) | |||
PNGARG((png_structp png_ptr)); | PNGARG((png_structp png_ptr)); | |||
/* The flags returned by png_get_io_state() are the following: */ | /* The flags returned by png_get_io_state() are the following: */ | |||
#define PNG_IO_NONE 0x0000 /* no I/O at this moment */ | #define PNG_IO_NONE 0x0000 /* no I/O at this moment */ | |||
#define PNG_IO_READING 0x0001 /* currently reading */ | #define PNG_IO_READING 0x0001 /* currently reading */ | |||
#define PNG_IO_WRITING 0x0002 /* currently writing */ | #define PNG_IO_WRITING 0x0002 /* currently writing */ | |||
#define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ | #define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ | |||
#define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ | #define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ | |||
skipping to change at line 2663 | skipping to change at line 2648 | |||
#ifdef PNG_USE_READ_MACROS | #ifdef PNG_USE_READ_MACROS | |||
/* Inline macros to do direct reads of bytes from the input buffer. | /* Inline macros to do direct reads of bytes from the input buffer. | |||
* The png_get_int_32() routine assumes we are using two's complement | * The png_get_int_32() routine assumes we are using two's complement | |||
* format for negative values, which is almost certainly true. | * format for negative values, which is almost certainly true. | |||
*/ | */ | |||
# define png_get_uint_32(buf) \ | # define png_get_uint_32(buf) \ | |||
(((png_uint_32)(*(buf)) << 24) + \ | (((png_uint_32)(*(buf)) << 24) + \ | |||
((png_uint_32)(*((buf) + 1)) << 16) + \ | ((png_uint_32)(*((buf) + 1)) << 16) + \ | |||
((png_uint_32)(*((buf) + 2)) << 8) + \ | ((png_uint_32)(*((buf) + 2)) << 8) + \ | |||
((png_uint_32)(*((buf) + 3)))) | ((png_uint_32)(*((buf) + 3)))) | |||
/* The following definition introduces an API incompatibility (but not | ||||
* an ABI incompatibility) with libpng-1.4.0 through 1.4.4. Prior to | ||||
* libpng-1.4.5 the macro, which is used by default, returned (incorrectl | ||||
y) | ||||
* a (png_uint_32), while the function, if used instead, correctly return | ||||
ed | ||||
* a (png_uint_16). | ||||
* | ||||
* Libpng versions 1.0.x and 1.2.x only used a function so are not affect | ||||
ed | ||||
* by this potential API incompatibility between macros. | ||||
*/ | ||||
# define png_get_uint_16(buf) \ | # define png_get_uint_16(buf) \ | |||
((png_uint_16) \ | (((png_uint_32)(*(buf)) << 8) + \ | |||
(((unsigned int)(*(buf)) << 8) + \ | ((png_uint_32)(*((buf) + 1)))) | |||
((unsigned int)(*((buf) + 1))))) | ||||
# define png_get_int_32(buf) \ | # define png_get_int_32(buf) \ | |||
((png_int_32)((*(buf) & 0x80) \ | ((png_int_32)((*(buf) & 0x80) \ | |||
? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ | ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffff)+1)) \ | |||
: (png_int_32)png_get_uint_32(buf))) | : (png_int_32)png_get_uint_32(buf))) | |||
#else | #else | |||
PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); | PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); | |||
PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); | PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); | |||
#ifdef PNG_GET_INT_32_SUPPORTED | #ifdef PNG_GET_INT_32_SUPPORTED | |||
PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); | PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); | |||
#endif | #endif | |||
#endif | #endif | |||
PNG_EXPORT(png_uint_32,png_get_uint_31) | PNG_EXPORT(png_uint_32,png_get_uint_31) | |||
PNGARG((png_structp png_ptr, png_bytep buf)); | PNGARG((png_structp png_ptr, png_bytep buf)); | |||
End of changes. 72 change blocks. | ||||
161 lines changed or deleted | 124 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 ctx | xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, | |||
t, | int flag); | |||
int flag); | ||||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctx t); | xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); | |||
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 ctx t); | xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); | |||
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(xmlRelaxNGValidCt | xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, | |||
xtPtr ctxt, | xmlStructuredErrorFunc serror, void *ctx); | |||
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 (xmlRelaxNGValidCtxt | xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, | |||
Ptr ctxt, | xmlDocPtr doc, | |||
xmlDocPtr doc, | xmlNodePtr elem); | |||
xmlNodePtr elem); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, | |||
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt | const xmlChar *data, | |||
, | int len); | |||
const xmlChar *data, | XMLPUBFUN int XMLCALL | |||
int len); | xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, | |||
XMLPUBFUN int XMLCALL | xmlDocPtr doc, | |||
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxt | xmlNodePtr elem); | |||
Ptr ctxt, | XMLPUBFUN int XMLCALL | |||
xmlDocPtr doc, | xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, | |||
xmlNodePtr elem); | xmlDocPtr doc, | |||
XMLPUBFUN int XMLCALL | xmlNodePtr elem); | |||
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. | ||||
67 lines changed or deleted | 57 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 wa | xmlSchematronValidityWarningFunc warn, | |||
rn, | void *ctx); | |||
void *ctx); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, | |||
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt | xmlSchematronValidityErrorFunc * err, | |||
, | xmlSchematronValidityWarningFunc * warn, | |||
xmlSchematronValidityErrorFunc * err | void **ctx); | |||
, | ||||
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 wa | xmlSchematronValidityWarningFunc warn, | |||
rn, | void *ctx); | |||
void *ctx); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, | |||
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, | xmlSchematronValidityErrorFunc *err, | |||
xmlSchematronValidityErrorFunc *err | xmlSchematronValidityWarningFunc *warn, | |||
, | 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. | ||||
52 lines changed or deleted | 45 lines changed or added | |||
stdint.h | stdint.h | |||
---|---|---|---|---|
#pragma GCC system_header | // ISO C9x compliant stdint.h for Microsoft Visual Studio | |||
#pragma GCC visibility push(default) | // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 | |||
#include_next <stdint.h> | // | |||
#pragma GCC visibility pop | // Copyright (c) 2006-2008 Alexander Chemeris | |||
// | ||||
// Redistribution and use in source and binary forms, with or without | ||||
// modification, are permitted provided that the following conditions are m | ||||
et: | ||||
// | ||||
// 1. Redistributions of source code must retain the above copyright noti | ||||
ce, | ||||
// this list of conditions and the following disclaimer. | ||||
// | ||||
// 2. Redistributions in binary form must reproduce the above copyright | ||||
// notice, this list of conditions and the following disclaimer in the | ||||
// documentation and/or other materials provided with the distribution | ||||
. | ||||
// | ||||
// 3. The name of the author may be used to endorse or promote products | ||||
// derived from this software without specific prior written permissio | ||||
n. | ||||
// | ||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMP | ||||
LIED | ||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||||
NO | ||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||||
TO, | ||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFI | ||||
TS; | ||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
// | ||||
/////////////////////////////////////////////////////////////////////////// | ||||
//// | ||||
#ifndef _MSC_VER // [ | ||||
#error "Use this header only with Microsoft Visual C++ compilers!" | ||||
#endif // _MSC_VER ] | ||||
#ifndef _MSC_STDINT_H_ // [ | ||||
#define _MSC_STDINT_H_ | ||||
#if _MSC_VER > 1000 | ||||
#pragma once | ||||
#endif | ||||
#include <limits.h> | ||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when | ||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {} | ||||
' | ||||
// or compiler give many errors like this: | ||||
// error C2733: second C linkage of overloaded function 'wmemchr' not all | ||||
owed | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
# include <wchar.h> | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
// Define _W64 macros to mark types changing their size, like intptr_t. | ||||
#ifndef _W64 | ||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER | ||||
>= 1300 | ||||
# define _W64 __w64 | ||||
# else | ||||
# define _W64 | ||||
# endif | ||||
#endif | ||||
// 7.18.1 Integer types | ||||
// 7.18.1.1 Exact-width integer types | ||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't | ||||
// realize that, e.g. char has the same size as __int8 | ||||
// so we give up on __intX for them. | ||||
#if (_MSC_VER < 1300) | ||||
typedef signed char int8_t; | ||||
typedef signed short int16_t; | ||||
typedef signed int int32_t; | ||||
typedef unsigned char uint8_t; | ||||
typedef unsigned short uint16_t; | ||||
typedef unsigned int uint32_t; | ||||
#else | ||||
typedef signed __int8 int8_t; | ||||
typedef signed __int16 int16_t; | ||||
typedef signed __int32 int32_t; | ||||
typedef unsigned __int8 uint8_t; | ||||
typedef unsigned __int16 uint16_t; | ||||
typedef unsigned __int32 uint32_t; | ||||
#endif | ||||
typedef signed __int64 int64_t; | ||||
typedef unsigned __int64 uint64_t; | ||||
// 7.18.1.2 Minimum-width integer types | ||||
typedef int8_t int_least8_t; | ||||
typedef int16_t int_least16_t; | ||||
typedef int32_t int_least32_t; | ||||
typedef int64_t int_least64_t; | ||||
typedef uint8_t uint_least8_t; | ||||
typedef uint16_t uint_least16_t; | ||||
typedef uint32_t uint_least32_t; | ||||
typedef uint64_t uint_least64_t; | ||||
// 7.18.1.3 Fastest minimum-width integer types | ||||
typedef int8_t int_fast8_t; | ||||
typedef int16_t int_fast16_t; | ||||
typedef int32_t int_fast32_t; | ||||
typedef int64_t int_fast64_t; | ||||
typedef uint8_t uint_fast8_t; | ||||
typedef uint16_t uint_fast16_t; | ||||
typedef uint32_t uint_fast32_t; | ||||
typedef uint64_t uint_fast64_t; | ||||
// 7.18.1.4 Integer types capable of holding object pointers | ||||
#ifdef _WIN64 // [ | ||||
typedef signed __int64 intptr_t; | ||||
typedef unsigned __int64 uintptr_t; | ||||
#else // _WIN64 ][ | ||||
typedef _W64 signed int intptr_t; | ||||
typedef _W64 unsigned int uintptr_t; | ||||
#endif // _WIN64 ] | ||||
// 7.18.1.5 Greatest-width integer types | ||||
typedef int64_t intmax_t; | ||||
typedef uint64_t uintmax_t; | ||||
// 7.18.2 Limits of specified-width integer types | ||||
// 7.18.2.1 Limits of exact-width integer types | ||||
#define INT8_MIN ((int8_t)_I8_MIN) | ||||
#define INT8_MAX _I8_MAX | ||||
#define INT16_MIN ((int16_t)_I16_MIN) | ||||
#define INT16_MAX _I16_MAX | ||||
#define INT32_MIN ((int32_t)_I32_MIN) | ||||
#define INT32_MAX _I32_MAX | ||||
#define INT64_MIN ((int64_t)_I64_MIN) | ||||
#define INT64_MAX _I64_MAX | ||||
#define UINT8_MAX _UI8_MAX | ||||
#define UINT16_MAX _UI16_MAX | ||||
#define UINT32_MAX _UI32_MAX | ||||
#define UINT64_MAX _UI64_MAX | ||||
// 7.18.2.2 Limits of minimum-width integer types | ||||
#define INT_LEAST8_MIN INT8_MIN | ||||
#define INT_LEAST8_MAX INT8_MAX | ||||
#define INT_LEAST16_MIN INT16_MIN | ||||
#define INT_LEAST16_MAX INT16_MAX | ||||
#define INT_LEAST32_MIN INT32_MIN | ||||
#define INT_LEAST32_MAX INT32_MAX | ||||
#define INT_LEAST64_MIN INT64_MIN | ||||
#define INT_LEAST64_MAX INT64_MAX | ||||
#define UINT_LEAST8_MAX UINT8_MAX | ||||
#define UINT_LEAST16_MAX UINT16_MAX | ||||
#define UINT_LEAST32_MAX UINT32_MAX | ||||
#define UINT_LEAST64_MAX UINT64_MAX | ||||
// 7.18.2.3 Limits of fastest minimum-width integer types | ||||
#define INT_FAST8_MIN INT8_MIN | ||||
#define INT_FAST8_MAX INT8_MAX | ||||
#define INT_FAST16_MIN INT16_MIN | ||||
#define INT_FAST16_MAX INT16_MAX | ||||
#define INT_FAST32_MIN INT32_MIN | ||||
#define INT_FAST32_MAX INT32_MAX | ||||
#define INT_FAST64_MIN INT64_MIN | ||||
#define INT_FAST64_MAX INT64_MAX | ||||
#define UINT_FAST8_MAX UINT8_MAX | ||||
#define UINT_FAST16_MAX UINT16_MAX | ||||
#define UINT_FAST32_MAX UINT32_MAX | ||||
#define UINT_FAST64_MAX UINT64_MAX | ||||
// 7.18.2.4 Limits of integer types capable of holding object pointers | ||||
#ifdef _WIN64 // [ | ||||
# define INTPTR_MIN INT64_MIN | ||||
# define INTPTR_MAX INT64_MAX | ||||
# define UINTPTR_MAX UINT64_MAX | ||||
#else // _WIN64 ][ | ||||
# define INTPTR_MIN INT32_MIN | ||||
# define INTPTR_MAX INT32_MAX | ||||
# define UINTPTR_MAX UINT32_MAX | ||||
#endif // _WIN64 ] | ||||
// 7.18.2.5 Limits of greatest-width integer types | ||||
#define INTMAX_MIN INT64_MIN | ||||
#define INTMAX_MAX INT64_MAX | ||||
#define UINTMAX_MAX UINT64_MAX | ||||
// 7.18.3 Limits of other integer types | ||||
#ifdef _WIN64 // [ | ||||
# define PTRDIFF_MIN _I64_MIN | ||||
# define PTRDIFF_MAX _I64_MAX | ||||
#else // _WIN64 ][ | ||||
# define PTRDIFF_MIN _I32_MIN | ||||
# define PTRDIFF_MAX _I32_MAX | ||||
#endif // _WIN64 ] | ||||
#define SIG_ATOMIC_MIN INT_MIN | ||||
#define SIG_ATOMIC_MAX INT_MAX | ||||
#ifndef SIZE_MAX // [ | ||||
# ifdef _WIN64 // [ | ||||
# define SIZE_MAX _UI64_MAX | ||||
# else // _WIN64 ][ | ||||
# define SIZE_MAX _UI32_MAX | ||||
# endif // _WIN64 ] | ||||
#endif // SIZE_MAX ] | ||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> | ||||
#ifndef WCHAR_MIN // [ | ||||
# define WCHAR_MIN 0 | ||||
#endif // WCHAR_MIN ] | ||||
#ifndef WCHAR_MAX // [ | ||||
# define WCHAR_MAX _UI16_MAX | ||||
#endif // WCHAR_MAX ] | ||||
#define WINT_MIN 0 | ||||
#define WINT_MAX _UI16_MAX | ||||
#endif // __STDC_LIMIT_MACROS ] | ||||
// 7.18.4 Limits of other integer types | ||||
// 7.18.4.1 Macros for minimum-width integer constants | ||||
#define INT8_C(val) val##i8 | ||||
#define INT16_C(val) val##i16 | ||||
#define INT32_C(val) val##i32 | ||||
#define INT64_C(val) val##i64 | ||||
#define UINT8_C(val) val##ui8 | ||||
#define UINT16_C(val) val##ui16 | ||||
#define UINT32_C(val) val##ui32 | ||||
#define UINT64_C(val) val##ui64 | ||||
// 7.18.4.2 Macros for greatest-width integer constants | ||||
#define INTMAX_C INT64_C | ||||
#define UINTMAX_C UINT64_C | ||||
#endif // __STDC_CONSTANT_MACROS ] | ||||
#endif // _MSC_STDINT_H_ ] | ||||
End of changes. 1 change blocks. | ||||
lines changed or deleted | 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 | |||
tolua_fix.h | tolua_fix.h | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
#ifndef __TOLUA_FIX_H_ | #ifndef __TOLUA_FIX_H_ | |||
#define __TOLUA_FIX_H_ | #define __TOLUA_FIX_H_ | |||
#include "tolua++.h" | #include "tolua++.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
#define TOLUA_REFID_PTR_MAPPING "tolua_refid_ptr_mapping" | #define TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping" | |||
#define TOLUA_REFID_TYPE_MAPPING "tolua_refid_type_mapping" | #define TOLUA_REFID_TYPE_MAPPING "toluafix_refid_type_mapping" | |||
#define TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" | ||||
TOLUA_API void tolua_prepare_ccobject_table(lua_State* L); | ||||
TOLUA_API int tolua_pushusertype_ccobject(lua_State* L, | TOLUA_API void toluafix_open(lua_State* L); | |||
int uid, | TOLUA_API int toluafix_pushusertype_ccobject(lua_State* L, | |||
int* p_refid, | int uid, | |||
void* ptr, | int* p_refid, | |||
const char* type); | void* ptr, | |||
TOLUA_API int tolua_remove_ccobject_by_refid(lua_State* L, int refid); | const char* type); | |||
TOLUA_API int tolua_ref_function(lua_State* L, int lo, int def); | TOLUA_API int toluafix_remove_ccobject_by_refid(lua_State* L, int refid); | |||
TOLUA_API void tolua_remove_function_by_refid(lua_State* L, int refid); | TOLUA_API int toluafix_ref_function(lua_State* L, int lo, int def); | |||
TOLUA_API int tolua_isfunction(lua_State* L, int lo, tolua_Error* err); | TOLUA_API void toluafix_get_function_by_refid(lua_State* L, int refid); | |||
TOLUA_API void tolua_stack_dump(lua_State* L, const char* label); | TOLUA_API void toluafix_remove_function_by_refid(lua_State* L, int refid); | |||
TOLUA_API int toluafix_isfunction(lua_State* L, int lo, const char* type, i | ||||
nt def, tolua_Error* err); | ||||
TOLUA_API int toluafix_totable(lua_State* L, int lo, int def); | ||||
TOLUA_API int toluafix_istable(lua_State* L, int lo, const char* type, int | ||||
def, tolua_Error* err); | ||||
TOLUA_API void toluafix_stack_dump(lua_State* L, const char* label); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} // extern "C" | } // extern "C" | |||
#endif | #endif | |||
#endif // __TOLUA_FIX_H_ | #endif // __TOLUA_FIX_H_ | |||
End of changes. 1 change blocks. | ||||
14 lines changed or deleted | 20 lines changed or added | |||
tree.h | tree.h | |||
---|---|---|---|---|
skipping to change at line 74 | skipping to change at line 74 | |||
/* #define LIBXML_NAMESPACE_DICT */ | /* #define LIBXML_NAMESPACE_DICT */ | |||
/** | /** | |||
* xmlBufferAllocationScheme: | * xmlBufferAllocationScheme: | |||
* | * | |||
* A buffer allocation scheme can be defined to either match exactly the | * A buffer allocation scheme can be defined to either match exactly the | |||
* need or double it's allocated size each time it is found too small. | * need or double it's allocated size each time it is found too small. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ | XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ | |||
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ | XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ | |||
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ | XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ | |||
XML_BUFFER_ALLOC_IO /* special allocation scheme used for I/O */ | XML_BUFFER_ALLOC_IO /* special allocation scheme used fo r I/O */ | |||
} xmlBufferAllocationScheme; | } xmlBufferAllocationScheme; | |||
/** | /** | |||
* xmlBuffer: | * xmlBuffer: | |||
* | * | |||
* A buffer structure. | * A buffer structure. | |||
*/ | */ | |||
typedef struct _xmlBuffer xmlBuffer; | typedef struct _xmlBuffer xmlBuffer; | |||
typedef xmlBuffer *xmlBufferPtr; | typedef xmlBuffer *xmlBufferPtr; | |||
struct _xmlBuffer { | struct _xmlBuffer { | |||
xmlChar *content; /* The buffer content UTF8 */ | xmlChar *content; /* The buffer content UTF8 */ | |||
unsigned int use; /* The buffer size used */ | unsigned int use; /* The buffer size used */ | |||
unsigned int size; /* The buffer size */ | unsigned int size; /* The buffer size */ | |||
xmlBufferAllocationScheme alloc; /* The realloc method */ | xmlBufferAllocationScheme alloc; /* The realloc method */ | |||
xmlChar *contentIO; /* in IO mode we may have a different base * / | xmlChar *contentIO; /* in IO mode we may have a differen t base */ | |||
}; | }; | |||
/** | /** | |||
* XML_XML_NAMESPACE: | * XML_XML_NAMESPACE: | |||
* | * | |||
* This is the namespace for the special xml: prefix predefined in the | * This is the namespace for the special xml: prefix predefined in the | |||
* XML Namespace specification. | * XML Namespace specification. | |||
*/ | */ | |||
#define XML_XML_NAMESPACE \ | #define XML_XML_NAMESPACE \ | |||
(const xmlChar *) "http://www.w3.org/XML/1998/namespace" | (const xmlChar *) "http://www.w3.org/XML/1998/namespace" | |||
skipping to change at line 121 | skipping to change at line 121 | |||
/* | /* | |||
* The different element types carried by an XML tree. | * The different element types carried by an XML tree. | |||
* | * | |||
* NOTE: This is synchronized with DOM Level1 values | * NOTE: This is synchronized with DOM Level1 values | |||
* See http://www.w3.org/TR/REC-DOM-Level-1/ | * See http://www.w3.org/TR/REC-DOM-Level-1/ | |||
* | * | |||
* Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should | * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should | |||
* be deprecated to use an XML_DTD_NODE. | * be deprecated to use an XML_DTD_NODE. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_ELEMENT_NODE= 1, | XML_ELEMENT_NODE= 1, | |||
XML_ATTRIBUTE_NODE= 2, | XML_ATTRIBUTE_NODE= 2, | |||
XML_TEXT_NODE= 3, | XML_TEXT_NODE= 3, | |||
XML_CDATA_SECTION_NODE= 4, | XML_CDATA_SECTION_NODE= 4, | |||
XML_ENTITY_REF_NODE= 5, | XML_ENTITY_REF_NODE= 5, | |||
XML_ENTITY_NODE= 6, | XML_ENTITY_NODE= 6, | |||
XML_PI_NODE= 7, | XML_PI_NODE= 7, | |||
XML_COMMENT_NODE= 8, | XML_COMMENT_NODE= 8, | |||
XML_DOCUMENT_NODE= 9, | XML_DOCUMENT_NODE= 9, | |||
XML_DOCUMENT_TYPE_NODE= 10, | XML_DOCUMENT_TYPE_NODE= 10, | |||
XML_DOCUMENT_FRAG_NODE= 11, | XML_DOCUMENT_FRAG_NODE= 11, | |||
XML_NOTATION_NODE= 12, | XML_NOTATION_NODE= 12, | |||
XML_HTML_DOCUMENT_NODE= 13, | XML_HTML_DOCUMENT_NODE= 13, | |||
XML_DTD_NODE= 14, | XML_DTD_NODE= 14, | |||
XML_ELEMENT_DECL= 15, | XML_ELEMENT_DECL= 15, | |||
XML_ATTRIBUTE_DECL= 16, | XML_ATTRIBUTE_DECL= 16, | |||
XML_ENTITY_DECL= 17, | XML_ENTITY_DECL= 17, | |||
XML_NAMESPACE_DECL= 18, | XML_NAMESPACE_DECL= 18, | |||
XML_XINCLUDE_START= 19, | XML_XINCLUDE_START= 19, | |||
XML_XINCLUDE_END= 20 | XML_XINCLUDE_END= 20 | |||
#ifdef LIBXML_DOCB_ENABLED | #ifdef LIBXML_DOCB_ENABLED | |||
,XML_DOCB_DOCUMENT_NODE= 21 | ,XML_DOCB_DOCUMENT_NODE= 21 | |||
#endif | #endif | |||
} xmlElementType; | } xmlElementType; | |||
/** | /** | |||
* xmlNotation: | * xmlNotation: | |||
* | * | |||
* A DTD Notation definition. | * A DTD Notation definition. | |||
*/ | */ | |||
typedef struct _xmlNotation xmlNotation; | typedef struct _xmlNotation xmlNotation; | |||
typedef xmlNotation *xmlNotationPtr; | typedef xmlNotation *xmlNotationPtr; | |||
struct _xmlNotation { | struct _xmlNotation { | |||
const xmlChar *name; /* Notation name */ | const xmlChar *name; /* Notation name */ | |||
const xmlChar *PublicID; /* Public identifier, if any | const xmlChar *PublicID; /* Public identifier, if any | |||
*/ | */ | |||
const xmlChar *SystemID; /* System identifier, if any | const xmlChar *SystemID; /* System identifier, if any | |||
*/ | */ | |||
}; | }; | |||
/** | /** | |||
* xmlAttributeType: | * xmlAttributeType: | |||
* | * | |||
* A DTD Attribute type definition. | * A DTD Attribute type definition. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_ATTRIBUTE_CDATA = 1, | XML_ATTRIBUTE_CDATA = 1, | |||
XML_ATTRIBUTE_ID, | XML_ATTRIBUTE_ID, | |||
XML_ATTRIBUTE_IDREF , | XML_ATTRIBUTE_IDREF , | |||
XML_ATTRIBUTE_IDREFS, | XML_ATTRIBUTE_IDREFS, | |||
XML_ATTRIBUTE_ENTITY, | XML_ATTRIBUTE_ENTITY, | |||
XML_ATTRIBUTE_ENTITIES, | XML_ATTRIBUTE_ENTITIES, | |||
XML_ATTRIBUTE_NMTOKEN, | XML_ATTRIBUTE_NMTOKEN, | |||
XML_ATTRIBUTE_NMTOKENS, | XML_ATTRIBUTE_NMTOKENS, | |||
XML_ATTRIBUTE_ENUMERATION, | XML_ATTRIBUTE_ENUMERATION, | |||
XML_ATTRIBUTE_NOTATION | XML_ATTRIBUTE_NOTATION | |||
} xmlAttributeType; | } xmlAttributeType; | |||
/** | /** | |||
skipping to change at line 201 | skipping to change at line 201 | |||
/** | /** | |||
* xmlEnumeration: | * xmlEnumeration: | |||
* | * | |||
* List structure used when there is an enumeration in DTDs. | * List structure used when there is an enumeration in DTDs. | |||
*/ | */ | |||
typedef struct _xmlEnumeration xmlEnumeration; | typedef struct _xmlEnumeration xmlEnumeration; | |||
typedef xmlEnumeration *xmlEnumerationPtr; | typedef xmlEnumeration *xmlEnumerationPtr; | |||
struct _xmlEnumeration { | struct _xmlEnumeration { | |||
struct _xmlEnumeration *next; /* next one */ | struct _xmlEnumeration *next; /* next one */ | |||
const xmlChar *name; /* Enumeration name */ | const xmlChar *name; /* Enumeration name */ | |||
}; | }; | |||
/** | /** | |||
* xmlAttribute: | * xmlAttribute: | |||
* | * | |||
* An Attribute declaration in a DTD. | * An Attribute declaration in a DTD. | |||
*/ | */ | |||
typedef struct _xmlAttribute xmlAttribute; | typedef struct _xmlAttribute xmlAttribute; | |||
typedef xmlAttribute *xmlAttributePtr; | typedef xmlAttribute *xmlAttributePtr; | |||
struct _xmlAttribute { | struct _xmlAttribute { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* XML_ATTRIBUTE_DECL, must be seco nd ! */ | xmlElementType type; /* XML_ATTRIBUTE_DECL, must be seco nd ! */ | |||
const xmlChar *name; /* Attribute name */ | const xmlChar *name; /* Attribute name */ | |||
struct _xmlNode *children; /* NULL */ | struct _xmlNode *children; /* NULL */ | |||
struct _xmlNode *last; /* NULL */ | struct _xmlNode *last; /* NULL */ | |||
struct _xmlDtd *parent; /* -> DTD */ | struct _xmlDtd *parent; /* -> DTD */ | |||
struct _xmlNode *next; /* next sibling link */ | struct _xmlNode *next; /* next sibling link */ | |||
struct _xmlNode *prev; /* previous sibling link */ | struct _xmlNode *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* the containing document */ | struct _xmlDoc *doc; /* the containing document */ | |||
struct _xmlAttribute *nexth; /* next in hash table */ | struct _xmlAttribute *nexth; /* next in hash table */ | |||
xmlAttributeType atype; /* The attribute type */ | xmlAttributeType atype; /* The attribute type */ | |||
xmlAttributeDefault def; /* the default */ | xmlAttributeDefault def; /* the default */ | |||
const xmlChar *defaultValue; /* or the default value */ | const xmlChar *defaultValue; /* or the default value */ | |||
xmlEnumerationPtr tree; /* or the enumeration tree if any * / | xmlEnumerationPtr tree; /* or the enumeration tree if any * / | |||
const xmlChar *prefix; /* the namespace prefix if any */ | const xmlChar *prefix; /* the namespace prefix if any */ | |||
const xmlChar *elem; /* Element holding the attribute */ | const xmlChar *elem; /* Element holding the attribute */ | |||
}; | }; | |||
/** | /** | |||
* xmlElementContentType: | * xmlElementContentType: | |||
* | * | |||
* Possible definitions of element content types. | * Possible definitions of element content types. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_ELEMENT_CONTENT_PCDATA = 1, | XML_ELEMENT_CONTENT_PCDATA = 1, | |||
XML_ELEMENT_CONTENT_ELEMENT, | XML_ELEMENT_CONTENT_ELEMENT, | |||
skipping to change at line 267 | skipping to change at line 267 | |||
/** | /** | |||
* xmlElementContent: | * xmlElementContent: | |||
* | * | |||
* An XML Element content as stored after parsing an element definition | * An XML Element content as stored after parsing an element definition | |||
* in a DTD. | * in a DTD. | |||
*/ | */ | |||
typedef struct _xmlElementContent xmlElementContent; | typedef struct _xmlElementContent xmlElementContent; | |||
typedef xmlElementContent *xmlElementContentPtr; | typedef xmlElementContent *xmlElementContentPtr; | |||
struct _xmlElementContent { | struct _xmlElementContent { | |||
xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ | xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ | |||
xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ | xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ | |||
const xmlChar *name; /* Element name */ | const xmlChar *name; /* Element name */ | |||
struct _xmlElementContent *c1; /* first child */ | struct _xmlElementContent *c1; /* first child */ | |||
struct _xmlElementContent *c2; /* second child */ | struct _xmlElementContent *c2; /* second child */ | |||
struct _xmlElementContent *parent; /* parent */ | struct _xmlElementContent *parent; /* parent */ | |||
const xmlChar *prefix; /* Namespace prefix */ | const xmlChar *prefix; /* Namespace prefix */ | |||
}; | }; | |||
/** | /** | |||
* xmlElementTypeVal: | * xmlElementTypeVal: | |||
* | * | |||
* The different possibilities for an element content type. | * The different possibilities for an element content type. | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_ELEMENT_TYPE_UNDEFINED = 0, | XML_ELEMENT_TYPE_UNDEFINED = 0, | |||
skipping to change at line 307 | skipping to change at line 307 | |||
/** | /** | |||
* xmlElement: | * xmlElement: | |||
* | * | |||
* An XML Element declaration from a DTD. | * An XML Element declaration from a DTD. | |||
*/ | */ | |||
typedef struct _xmlElement xmlElement; | typedef struct _xmlElement xmlElement; | |||
typedef xmlElement *xmlElementPtr; | typedef xmlElement *xmlElementPtr; | |||
struct _xmlElement { | struct _xmlElement { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ | xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ | |||
const xmlChar *name; /* Element name */ | const xmlChar *name; /* Element name */ | |||
struct _xmlNode *children; /* NULL */ | struct _xmlNode *children; /* NULL */ | |||
struct _xmlNode *last; /* NULL */ | struct _xmlNode *last; /* NULL */ | |||
struct _xmlDtd *parent; /* -> DTD */ | struct _xmlDtd *parent; /* -> DTD */ | |||
struct _xmlNode *next; /* next sibling link */ | struct _xmlNode *next; /* next sibling link */ | |||
struct _xmlNode *prev; /* previous sibling link */ | struct _xmlNode *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* the containing document */ | struct _xmlDoc *doc; /* the containing document */ | |||
xmlElementTypeVal etype; /* The type */ | xmlElementTypeVal etype; /* The type */ | |||
xmlElementContentPtr content; /* the allowed element content */ | xmlElementContentPtr content; /* the allowed element content */ | |||
xmlAttributePtr attributes; /* List of the declared attributes */ | xmlAttributePtr attributes; /* List of the declared attributes * | |||
const xmlChar *prefix; /* the namespace prefix if any */ | / | |||
const xmlChar *prefix; /* the namespace prefix if any */ | ||||
#ifdef LIBXML_REGEXP_ENABLED | #ifdef LIBXML_REGEXP_ENABLED | |||
xmlRegexpPtr contModel; /* the validating regexp */ | xmlRegexpPtr contModel; /* the validating regexp */ | |||
#else | #else | |||
void *contModel; | void *contModel; | |||
#endif | #endif | |||
}; | }; | |||
/** | /** | |||
* XML_LOCAL_NAMESPACE: | * XML_LOCAL_NAMESPACE: | |||
* | * | |||
* A namespace declaration node. | * A namespace declaration node. | |||
*/ | */ | |||
#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL | #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL | |||
typedef xmlElementType xmlNsType; | typedef xmlElementType xmlNsType; | |||
skipping to change at line 349 | skipping to change at line 349 | |||
* An XML namespace. | * An XML namespace. | |||
* Note that prefix == NULL is valid, it defines the default namespace | * Note that prefix == NULL is valid, it defines the default namespace | |||
* within the subtree (until overridden). | * within the subtree (until overridden). | |||
* | * | |||
* xmlNsType is unified with xmlElementType. | * xmlNsType is unified with xmlElementType. | |||
*/ | */ | |||
typedef struct _xmlNs xmlNs; | typedef struct _xmlNs xmlNs; | |||
typedef xmlNs *xmlNsPtr; | typedef xmlNs *xmlNsPtr; | |||
struct _xmlNs { | struct _xmlNs { | |||
struct _xmlNs *next; /* next Ns link for this node */ | struct _xmlNs *next; /* next Ns link for this node */ | |||
xmlNsType type; /* global or local */ | xmlNsType type; /* global or local */ | |||
const xmlChar *href; /* URL for the namespace */ | const xmlChar *href; /* URL for the namespace */ | |||
const xmlChar *prefix; /* prefix for the namespace */ | const xmlChar *prefix; /* prefix for the namespace */ | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
struct _xmlDoc *context; /* normally an xmlDoc */ | struct _xmlDoc *context; /* normally an xmlDoc */ | |||
}; | }; | |||
/** | /** | |||
* xmlDtd: | * xmlDtd: | |||
* | * | |||
* An XML DTD, as defined by <!DOCTYPE ... There is actually one for | * An XML DTD, as defined by <!DOCTYPE ... There is actually one for | |||
* the internal subset and for the external subset. | * the internal subset and for the external subset. | |||
*/ | */ | |||
typedef struct _xmlDtd xmlDtd; | typedef struct _xmlDtd xmlDtd; | |||
typedef xmlDtd *xmlDtdPtr; | typedef xmlDtd *xmlDtdPtr; | |||
struct _xmlDtd { | struct _xmlDtd { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* XML_DTD_NODE, must be second ! */ | xmlElementType type; /* XML_DTD_NODE, must be second ! */ | |||
const xmlChar *name; /* Name of the DTD */ | const xmlChar *name; /* Name of the DTD */ | |||
struct _xmlNode *children; /* the value of the property link */ | struct _xmlNode *children; /* the value of the property link */ | |||
struct _xmlNode *last; /* last child link */ | struct _xmlNode *last; /* last child link */ | |||
struct _xmlDoc *parent; /* child->parent link */ | struct _xmlDoc *parent; /* child->parent link */ | |||
struct _xmlNode *next; /* next sibling link */ | struct _xmlNode *next; /* next sibling link */ | |||
struct _xmlNode *prev; /* previous sibling link */ | struct _xmlNode *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* the containing document */ | struct _xmlDoc *doc; /* the containing document */ | |||
/* End of common part */ | /* End of common part */ | |||
void *notations; /* Hash table for notations if any */ | void *notations; /* Hash table for notations if any */ | |||
void *elements; /* Hash table for elements if any */ | void *elements; /* Hash table for elements if any */ | |||
void *attributes; /* Hash table for attributes if any */ | void *attributes; /* Hash table for attributes if any */ | |||
void *entities; /* Hash table for entities if any */ | void *entities; /* Hash table for entities if any */ | |||
const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ | const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ | |||
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ | const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ | |||
void *pentities; /* Hash table for param entities if any */ | void *pentities; /* Hash table for param entities if any */ | |||
}; | }; | |||
/** | /** | |||
* xmlAttr: | * xmlAttr: | |||
* | * | |||
* An attribute on an XML node. | * An attribute on an XML node. | |||
*/ | */ | |||
typedef struct _xmlAttr xmlAttr; | typedef struct _xmlAttr xmlAttr; | |||
typedef xmlAttr *xmlAttrPtr; | typedef xmlAttr *xmlAttrPtr; | |||
struct _xmlAttr { | struct _xmlAttr { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ | xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ | |||
const xmlChar *name; /* the name of the property */ | const xmlChar *name; /* the name of the property */ | |||
struct _xmlNode *children; /* the value of the property */ | struct _xmlNode *children; /* the value of the property */ | |||
struct _xmlNode *last; /* NULL */ | struct _xmlNode *last; /* NULL */ | |||
struct _xmlNode *parent; /* child->parent link */ | struct _xmlNode *parent; /* child->parent link */ | |||
struct _xmlAttr *next; /* next sibling link */ | struct _xmlAttr *next; /* next sibling link */ | |||
struct _xmlAttr *prev; /* previous sibling link */ | struct _xmlAttr *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* the containing document */ | struct _xmlDoc *doc; /* the containing document */ | |||
xmlNs *ns; /* pointer to the associated namespace */ | xmlNs *ns; /* pointer to the associated namespace */ | |||
xmlAttributeType atype; /* the attribute type if validating */ | xmlAttributeType atype; /* the attribute type if validating */ | |||
void *psvi; /* for type/PSVI informations */ | void *psvi; /* for type/PSVI informations */ | |||
}; | }; | |||
/** | /** | |||
* xmlID: | * xmlID: | |||
* | * | |||
* An XML ID instance. | * An XML ID instance. | |||
*/ | */ | |||
typedef struct _xmlID xmlID; | typedef struct _xmlID xmlID; | |||
typedef xmlID *xmlIDPtr; | typedef xmlID *xmlIDPtr; | |||
struct _xmlID { | struct _xmlID { | |||
struct _xmlID *next; /* next ID */ | struct _xmlID *next; /* next ID */ | |||
const xmlChar *value; /* The ID name */ | const xmlChar *value; /* The ID name */ | |||
xmlAttrPtr attr; /* The attribute holding it */ | xmlAttrPtr attr; /* The attribute holding it */ | |||
const xmlChar *name; /* The attribute if attr is not available */ | const xmlChar *name; /* The attribute if attr is not available */ | |||
int lineno; /* The line number if attr is not availabl | int lineno; /* The line number if attr is not available | |||
e */ | */ | |||
struct _xmlDoc *doc; /* The document holding the ID */ | struct _xmlDoc *doc; /* The document holding the ID */ | |||
}; | }; | |||
/** | /** | |||
* xmlRef: | * xmlRef: | |||
* | * | |||
* An XML IDREF instance. | * An XML IDREF instance. | |||
*/ | */ | |||
typedef struct _xmlRef xmlRef; | typedef struct _xmlRef xmlRef; | |||
typedef xmlRef *xmlRefPtr; | typedef xmlRef *xmlRefPtr; | |||
struct _xmlRef { | struct _xmlRef { | |||
struct _xmlRef *next; /* next Ref */ | struct _xmlRef *next; /* next Ref */ | |||
const xmlChar *value; /* The Ref name */ | const xmlChar *value; /* The Ref name */ | |||
xmlAttrPtr attr; /* The attribute holding it */ | xmlAttrPtr attr; /* The attribute holding it */ | |||
const xmlChar *name; /* The attribute if attr is not available */ | const xmlChar *name; /* The attribute if attr is not available */ | |||
int lineno; /* The line number if attr is not availabl | int lineno; /* The line number if attr is not available | |||
e */ | */ | |||
}; | }; | |||
/** | /** | |||
* xmlNode: | * xmlNode: | |||
* | * | |||
* A node in an XML tree. | * A node in an XML tree. | |||
*/ | */ | |||
typedef struct _xmlNode xmlNode; | typedef struct _xmlNode xmlNode; | |||
typedef xmlNode *xmlNodePtr; | typedef xmlNode *xmlNodePtr; | |||
struct _xmlNode { | struct _xmlNode { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* type number, must be second ! */ | xmlElementType type; /* type number, must be second ! */ | |||
const xmlChar *name; /* the name of the node, or the entity */ | const xmlChar *name; /* the name of the node, or the entity */ | |||
struct _xmlNode *children; /* parent->childs link */ | struct _xmlNode *children; /* parent->childs link */ | |||
struct _xmlNode *last; /* last child link */ | struct _xmlNode *last; /* last child link */ | |||
struct _xmlNode *parent; /* child->parent link */ | struct _xmlNode *parent; /* child->parent link */ | |||
struct _xmlNode *next; /* next sibling link */ | struct _xmlNode *next; /* next sibling link */ | |||
struct _xmlNode *prev; /* previous sibling link */ | struct _xmlNode *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* the containing document */ | struct _xmlDoc *doc; /* the containing document */ | |||
/* End of common part */ | /* End of common part */ | |||
xmlNs *ns; /* pointer to the associated namespace */ | xmlNs *ns; /* pointer to the associated namespace */ | |||
xmlChar *content; /* the content */ | xmlChar *content; /* the content */ | |||
struct _xmlAttr *properties;/* properties list */ | struct _xmlAttr *properties;/* properties list */ | |||
xmlNs *nsDef; /* namespace definitions on this node */ | xmlNs *nsDef; /* namespace definitions on this node */ | |||
void *psvi; /* for type/PSVI informations */ | void *psvi; /* for type/PSVI informations */ | |||
unsigned short line; /* line number */ | unsigned short line; /* line number */ | |||
unsigned short extra; /* extra data for XPath/XSLT */ | unsigned short extra; /* extra data for XPath/XSLT */ | |||
}; | }; | |||
/** | /** | |||
* XML_GET_CONTENT: | * XML_GET_CONTENT: | |||
* | * | |||
* Macro to extract the content pointer of a node. | * Macro to extract the content pointer of a node. | |||
*/ | */ | |||
#define XML_GET_CONTENT(n) \ | #define XML_GET_CONTENT(n) \ | |||
((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) | ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) | |||
/** | /** | |||
* XML_GET_LINE: | * XML_GET_LINE: | |||
* | * | |||
* Macro to extract the line number of an element node. | * Macro to extract the line number of an element node. | |||
*/ | */ | |||
#define XML_GET_LINE(n) \ | #define XML_GET_LINE(n) \ | |||
(xmlGetLineNo(n)) | (xmlGetLineNo(n)) | |||
/** | /** | |||
* xmlDocProperty | * xmlDocProperty | |||
* | * | |||
* Set of properties of the document as found by the parser | * Set of properties of the document as found by the parser | |||
* Some of them are linked to similary named xmlParserOption | * Some of them are linked to similary named xmlParserOption | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ | XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ | |||
XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ | XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ | |||
XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ | XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ | |||
XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ | XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ | |||
XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ | XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ | |||
XML_DOC_USERBUILT = 1<<5, /* Document was built using the API | XML_DOC_USERBUILT = 1<<5, /* Document was built using the API | |||
and not by parsing an instance * / | and not by parsing an instance * / | |||
XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ | XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ | |||
XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ | XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ | |||
} xmlDocProperties; | } xmlDocProperties; | |||
/** | /** | |||
* xmlDoc: | * xmlDoc: | |||
* | * | |||
* An XML document. | * An XML document. | |||
*/ | */ | |||
typedef struct _xmlDoc xmlDoc; | typedef struct _xmlDoc xmlDoc; | |||
typedef xmlDoc *xmlDocPtr; | typedef xmlDoc *xmlDocPtr; | |||
struct _xmlDoc { | struct _xmlDoc { | |||
void *_private; /* application data */ | void *_private; /* application data */ | |||
xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ | xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ | |||
char *name; /* name/filename/URI of the document */ | char *name; /* name/filename/URI of the document */ | |||
struct _xmlNode *children; /* the document tree */ | struct _xmlNode *children; /* the document tree */ | |||
struct _xmlNode *last; /* last child link */ | struct _xmlNode *last; /* last child link */ | |||
struct _xmlNode *parent; /* child->parent link */ | struct _xmlNode *parent; /* child->parent link */ | |||
struct _xmlNode *next; /* next sibling link */ | struct _xmlNode *next; /* next sibling link */ | |||
struct _xmlNode *prev; /* previous sibling link */ | struct _xmlNode *prev; /* previous sibling link */ | |||
struct _xmlDoc *doc; /* autoreference to itself */ | struct _xmlDoc *doc; /* autoreference to itself */ | |||
/* End of common part */ | /* End of common part */ | |||
int compression;/* level of zlib compression */ | int compression;/* level of zlib compression */ | |||
int standalone; /* standalone document (no external refs) | int standalone; /* standalone document (no external refs) | |||
1 if standalone="yes" | 1 if standalone="yes" | |||
0 if standalone="no" | 0 if standalone="no" | |||
-1 if there is no XML declaration | -1 if there is no XML declaration | |||
-2 if there is an XML declaration, but no | -2 if there is an XML declaration, but n | |||
standalone attribute was specified */ | o | |||
struct _xmlDtd *intSubset; /* the document internal subset */ | standalone attribute was specified * | |||
struct _xmlDtd *extSubset; /* the document external subset */ | / | |||
struct _xmlNs *oldNs; /* Global namespace, the old way */ | struct _xmlDtd *intSubset; /* the document internal subset */ | |||
const xmlChar *version; /* the XML version string */ | struct _xmlDtd *extSubset; /* the document external subset */ | |||
struct _xmlNs *oldNs; /* Global namespace, the old way */ | ||||
const xmlChar *version; /* the XML version string */ | ||||
const xmlChar *encoding; /* external initial encoding, if any */ | const xmlChar *encoding; /* external initial encoding, if any */ | |||
void *ids; /* Hash table for ID attributes if any */ | void *ids; /* Hash table for ID attributes if any */ | |||
void *refs; /* Hash table for IDREFs attributes if any */ | void *refs; /* Hash table for IDREFs attributes if any */ | |||
const xmlChar *URL; /* The URI for that document */ | const xmlChar *URL; /* The URI for that document */ | |||
int charset; /* encoding of the in-memory content | int charset; /* encoding of the in-memory content | |||
actually an xmlCharEncoding */ | actually an xmlCharEncoding */ | |||
struct _xmlDict *dict; /* dict used to allocate names or NULL */ | struct _xmlDict *dict; /* dict used to allocate names or NULL */ | |||
void *psvi; /* for type/PSVI informations */ | void *psvi; /* for type/PSVI informations */ | |||
int parseFlags; /* set of xmlParserOption used to parse | int parseFlags; /* set of xmlParserOption used to pa | |||
the | rse the | |||
document */ | document */ | |||
int properties; /* set of xmlDocProperties for this docu | int properties; /* set of xmlDocProperties for this | |||
ment | document | |||
set at the end of parsing */ | set at the end of parsing */ | |||
}; | }; | |||
typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; | typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; | |||
typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; | typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; | |||
/** | /** | |||
* xmlDOMWrapAcquireNsFunction: | * xmlDOMWrapAcquireNsFunction: | |||
* @ctxt: a DOM wrapper context | * @ctxt: a DOM wrapper context | |||
* @node: the context node (element or attribute) | * @node: the context node (element or attribute) | |||
* @nsName: the requested namespace name | * @nsName: the requested namespace name | |||
* @nsPrefix: the requested namespace prefix | * @nsPrefix: the requested namespace prefix | |||
* | * | |||
* A function called to acquire namespaces (xmlNs) from the wrapper. | * A function called to acquire namespaces (xmlNs) from the wrapper. | |||
* | * | |||
* Returns an xmlNsPtr or NULL in case of an error. | * Returns an xmlNsPtr or NULL in case of an error. | |||
*/ | */ | |||
typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, | typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
const xmlChar *nsName, | const xmlChar *nsName, | |||
const xmlChar *nsPrefix); | const xmlChar *nsPrefix); | |||
/** | /** | |||
* xmlDOMWrapCtxt: | * xmlDOMWrapCtxt: | |||
* | * | |||
* Context for DOM wrapper-operations. | * Context for DOM wrapper-operations. | |||
*/ | */ | |||
struct _xmlDOMWrapCtxt { | struct _xmlDOMWrapCtxt { | |||
void * _private; | void * _private; | |||
/* | /* | |||
* The type of this context, just in case we need specialized | * The type of this context, just in case we need specialized | |||
skipping to change at line 618 | skipping to change at line 618 | |||
/* | /* | |||
* Variables. | * Variables. | |||
*/ | */ | |||
/* | /* | |||
* Some helper functions | * Some helper functions | |||
*/ | */ | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || define d(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBX ML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENA BLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || define d(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBX ML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENA BLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlValidateNCName (const xmlChar *value, | xmlValidateNCName (const xmlChar *value, | |||
int space); | int space); | |||
#endif | #endif | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlValidateQName (const xmlChar *value, | xmlValidateQName (const xmlChar *value, | |||
int space); | int space); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlValidateName (const xmlChar *value, | xmlValidateName (const xmlChar *value, | |||
int space); | int space); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlValidateNMToken (const xmlChar *value, | xmlValidateNMToken (const xmlChar *value, | |||
int space); | int space); | |||
#endif | #endif | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlBuildQName (const xmlChar *ncname, | xmlBuildQName (const xmlChar *ncname, | |||
const xmlChar *prefix, | const xmlChar *prefix, | |||
xmlChar *memory, | xmlChar *memory, | |||
int len); | int len); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlSplitQName2 (const xmlChar *name, | xmlSplitQName2 (const xmlChar *name, | |||
xmlChar **prefix); | xmlChar **prefix); | |||
XMLPUBFUN const xmlChar * XMLCALL | XMLPUBFUN const xmlChar * XMLCALL | |||
xmlSplitQName3 (const xmlChar *name, | xmlSplitQName3 (const xmlChar *name, | |||
int *len); | int *len); | |||
/* | /* | |||
* Handling Buffers. | * Handling Buffers. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); | xmlSetBufferAllocationScheme(xmlBufferAllocationScheme schem e); | |||
XMLPUBFUN xmlBufferAllocationScheme XMLCALL | XMLPUBFUN xmlBufferAllocationScheme XMLCALL | |||
xmlGetBufferAllocationScheme(void); | xmlGetBufferAllocationScheme(void); | |||
XMLPUBFUN xmlBufferPtr XMLCALL | XMLPUBFUN xmlBufferPtr XMLCALL | |||
xmlBufferCreate (void); | xmlBufferCreate (void); | |||
XMLPUBFUN xmlBufferPtr XMLCALL | XMLPUBFUN xmlBufferPtr XMLCALL | |||
xmlBufferCreateSize (size_t size); | xmlBufferCreateSize (size_t size); | |||
XMLPUBFUN xmlBufferPtr XMLCALL | XMLPUBFUN xmlBufferPtr XMLCALL | |||
xmlBufferCreateStatic (void *mem, | xmlBufferCreateStatic (void *mem, | |||
size_t size); | size_t size); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferResize (xmlBufferPtr buf, | xmlBufferResize (xmlBufferPtr buf, | |||
unsigned int size); | unsigned int size); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferFree (xmlBufferPtr buf); | xmlBufferFree (xmlBufferPtr buf); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferDump (FILE *file, | xmlBufferDump (FILE *file, | |||
xmlBufferPtr buf); | xmlBufferPtr buf); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferAdd (xmlBufferPtr buf, | xmlBufferAdd (xmlBufferPtr buf, | |||
const xmlChar *str, | const xmlChar *str, | |||
int len); | int len); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferAddHead (xmlBufferPtr buf, | xmlBufferAddHead (xmlBufferPtr buf, | |||
const xmlChar *str, | const xmlChar *str, | |||
int len); | int len); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferCat (xmlBufferPtr buf, | xmlBufferCat (xmlBufferPtr buf, | |||
const xmlChar *str); | const xmlChar *str); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferCCat (xmlBufferPtr buf, | xmlBufferCCat (xmlBufferPtr buf, | |||
const char *str); | const char *str); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferShrink (xmlBufferPtr buf, | xmlBufferShrink (xmlBufferPtr buf, | |||
unsigned int len); | unsigned int len); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferGrow (xmlBufferPtr buf, | xmlBufferGrow (xmlBufferPtr buf, | |||
unsigned int len); | unsigned int len); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferEmpty (xmlBufferPtr buf); | xmlBufferEmpty (xmlBufferPtr buf); | |||
XMLPUBFUN const xmlChar* XMLCALL | XMLPUBFUN const xmlChar* XMLCALL | |||
xmlBufferContent (const xmlBufferPtr buf); | xmlBufferContent (const xmlBufferPtr buf); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferSetAllocationScheme(xmlBufferPtr buf, | xmlBufferSetAllocationScheme(xmlBufferPtr buf, | |||
xmlBufferAllocationScheme scheme); | xmlBufferAllocationScheme scheme); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlBufferLength (const xmlBufferPtr buf); | xmlBufferLength (const xmlBufferPtr buf); | |||
/* | /* | |||
* Creating/freeing new structures. | * Creating/freeing new structures. | |||
*/ | */ | |||
XMLPUBFUN xmlDtdPtr XMLCALL | XMLPUBFUN xmlDtdPtr XMLCALL | |||
xmlCreateIntSubset (xmlDocPtr doc, | xmlCreateIntSubset (xmlDocPtr doc, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ExternalID, | const xmlChar *ExternalID, | |||
const xmlChar *SystemID); | const xmlChar *SystemID); | |||
XMLPUBFUN xmlDtdPtr XMLCALL | XMLPUBFUN xmlDtdPtr XMLCALL | |||
xmlNewDtd (xmlDocPtr doc, | xmlNewDtd (xmlDocPtr doc, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ExternalID, | const xmlChar *ExternalID, | |||
const xmlChar *SystemID); | const xmlChar *SystemID); | |||
XMLPUBFUN xmlDtdPtr XMLCALL | XMLPUBFUN xmlDtdPtr XMLCALL | |||
xmlGetIntSubset (xmlDocPtr doc); | xmlGetIntSubset (xmlDocPtr doc); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeDtd (xmlDtdPtr cur); | xmlFreeDtd (xmlDtdPtr cur); | |||
#ifdef LIBXML_LEGACY_ENABLED | #ifdef LIBXML_LEGACY_ENABLED | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlNewGlobalNs (xmlDocPtr doc, | xmlNewGlobalNs (xmlDocPtr doc, | |||
const xmlChar *href, | const xmlChar *href, | |||
const xmlChar *prefix); | const xmlChar *prefix); | |||
#endif /* LIBXML_LEGACY_ENABLED */ | #endif /* LIBXML_LEGACY_ENABLED */ | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlNewNs (xmlNodePtr node, | xmlNewNs (xmlNodePtr node, | |||
const xmlChar *href, | const xmlChar *href, | |||
const xmlChar *prefix); | const xmlChar *prefix); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeNs (xmlNsPtr cur); | xmlFreeNs (xmlNsPtr cur); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeNsList (xmlNsPtr cur); | xmlFreeNsList (xmlNsPtr cur); | |||
XMLPUBFUN xmlDocPtr XMLCALL | XMLPUBFUN xmlDocPtr XMLCALL | |||
xmlNewDoc (const xmlChar *version); | xmlNewDoc (const xmlChar *version); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeDoc (xmlDocPtr cur); | xmlFreeDoc (xmlDocPtr cur); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlNewDocProp (xmlDocPtr doc, | xmlNewDocProp (xmlDocPtr doc, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | |||
defined(LIBXML_SCHEMAS_ENABLED) | defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlNewProp (xmlNodePtr node, | xmlNewProp (xmlNodePtr node, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
#endif | #endif | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlNewNsProp (xmlNodePtr node, | xmlNewNsProp (xmlNodePtr node, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlNewNsPropEatName (xmlNodePtr node, | xmlNewNsPropEatName (xmlNodePtr node, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
xmlChar *name, | xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreePropList (xmlAttrPtr cur); | xmlFreePropList (xmlAttrPtr cur); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeProp (xmlAttrPtr cur); | xmlFreeProp (xmlAttrPtr cur); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlCopyProp (xmlNodePtr target, | xmlCopyProp (xmlNodePtr target, | |||
xmlAttrPtr cur); | xmlAttrPtr cur); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlCopyPropList (xmlNodePtr target, | xmlCopyPropList (xmlNodePtr target, | |||
xmlAttrPtr cur); | xmlAttrPtr cur); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN xmlDtdPtr XMLCALL | XMLPUBFUN xmlDtdPtr XMLCALL | |||
xmlCopyDtd (xmlDtdPtr dtd); | xmlCopyDtd (xmlDtdPtr dtd); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN xmlDocPtr XMLCALL | XMLPUBFUN xmlDocPtr XMLCALL | |||
xmlCopyDoc (xmlDocPtr doc, | xmlCopyDoc (xmlDocPtr doc, | |||
int recursive); | int recursive); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) * / | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) * / | |||
/* | /* | |||
* Creating new nodes. | * Creating new nodes. | |||
*/ | */ | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocNode (xmlDocPtr doc, | xmlNewDocNode (xmlDocPtr doc, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocNodeEatName (xmlDocPtr doc, | xmlNewDocNodeEatName (xmlDocPtr doc, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
xmlChar *name, | xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewNode (xmlNsPtr ns, | xmlNewNode (xmlNsPtr ns, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewNodeEatName (xmlNsPtr ns, | xmlNewNodeEatName (xmlNsPtr ns, | |||
xmlChar *name); | xmlChar *name); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewChild (xmlNodePtr parent, | xmlNewChild (xmlNodePtr parent, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
#endif | #endif | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocText (xmlDocPtr doc, | xmlNewDocText (xmlDocPtr doc, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewText (const xmlChar *content); | xmlNewText (const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocPI (xmlDocPtr doc, | xmlNewDocPI (xmlDocPtr doc, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewPI (const xmlChar *name, | xmlNewPI (const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocTextLen (xmlDocPtr doc, | xmlNewDocTextLen (xmlDocPtr doc, | |||
const xmlChar *content, | const xmlChar *content, | |||
int len); | int len); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewTextLen (const xmlChar *content, | xmlNewTextLen (const xmlChar *content, | |||
int len); | int len); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocComment (xmlDocPtr doc, | xmlNewDocComment (xmlDocPtr doc, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewComment (const xmlChar *content); | xmlNewComment (const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewCDataBlock (xmlDocPtr doc, | xmlNewCDataBlock (xmlDocPtr doc, | |||
const xmlChar *content, | const xmlChar *content, | |||
int len); | int len); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewCharRef (xmlDocPtr doc, | xmlNewCharRef (xmlDocPtr doc, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewReference (xmlDocPtr doc, | xmlNewReference (xmlDocPtr doc, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlCopyNode (const xmlNodePtr node, | xmlCopyNode (const xmlNodePtr node, | |||
int recursive); | int recursive); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlDocCopyNode (const xmlNodePtr node, | xmlDocCopyNode (const xmlNodePtr node, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
int recursive); | int recursive); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlDocCopyNodeList (xmlDocPtr doc, | xmlDocCopyNodeList (xmlDocPtr doc, | |||
const xmlNodePtr node); | const xmlNodePtr node); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlCopyNodeList (const xmlNodePtr node); | xmlCopyNodeList (const xmlNodePtr node); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewTextChild (xmlNodePtr parent, | xmlNewTextChild (xmlNodePtr parent, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocRawNode (xmlDocPtr doc, | xmlNewDocRawNode (xmlDocPtr doc, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNewDocFragment (xmlDocPtr doc); | xmlNewDocFragment (xmlDocPtr doc); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
/* | /* | |||
* Navigating. | * Navigating. | |||
*/ | */ | |||
XMLPUBFUN long XMLCALL | XMLPUBFUN long XMLCALL | |||
xmlGetLineNo (xmlNodePtr node); | xmlGetLineNo (xmlNodePtr node); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlGetNodePath (xmlNodePtr node); | xmlGetNodePath (xmlNodePtr node); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlDocGetRootElement (xmlDocPtr doc); | xmlDocGetRootElement (xmlDocPtr doc); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlGetLastChild (xmlNodePtr parent); | xmlGetLastChild (xmlNodePtr parent); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNodeIsText (xmlNodePtr node); | xmlNodeIsText (xmlNodePtr node); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlIsBlankNode (xmlNodePtr node); | xmlIsBlankNode (xmlNodePtr node); | |||
/* | /* | |||
* Changing the structure. | * Changing the structure. | |||
*/ | */ | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlDocSetRootElement (xmlDocPtr doc, | xmlDocSetRootElement (xmlDocPtr doc, | |||
xmlNodePtr root); | xmlNodePtr root); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetName (xmlNodePtr cur, | xmlNodeSetName (xmlNodePtr cur, | |||
const xmlChar *name); | const xmlChar *name); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlAddChild (xmlNodePtr parent, | xmlAddChild (xmlNodePtr parent, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlAddChildList (xmlNodePtr parent, | xmlAddChildList (xmlNodePtr parent, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlReplaceNode (xmlNodePtr old, | xmlReplaceNode (xmlNodePtr old, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ | |||
defined(LIBXML_SCHEMAS_ENABLED) | defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlAddPrevSibling (xmlNodePtr cur, | xmlAddPrevSibling (xmlNodePtr cur, | |||
xmlNodePtr elem); | xmlNodePtr elem); | |||
#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENAB LED */ | #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENAB LED */ | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlAddSibling (xmlNodePtr cur, | xmlAddSibling (xmlNodePtr cur, | |||
xmlNodePtr elem); | xmlNodePtr elem); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlAddNextSibling (xmlNodePtr cur, | xmlAddNextSibling (xmlNodePtr cur, | |||
xmlNodePtr elem); | xmlNodePtr elem); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlUnlinkNode (xmlNodePtr cur); | xmlUnlinkNode (xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlTextMerge (xmlNodePtr first, | xmlTextMerge (xmlNodePtr first, | |||
xmlNodePtr second); | xmlNodePtr second); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlTextConcat (xmlNodePtr node, | xmlTextConcat (xmlNodePtr node, | |||
const xmlChar *content, | const xmlChar *content, | |||
int len); | int len); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeNodeList (xmlNodePtr cur); | xmlFreeNodeList (xmlNodePtr cur); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlFreeNode (xmlNodePtr cur); | xmlFreeNode (xmlNodePtr cur); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetTreeDoc (xmlNodePtr tree, | xmlSetTreeDoc (xmlNodePtr tree, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetListDoc (xmlNodePtr list, | xmlSetListDoc (xmlNodePtr list, | |||
xmlDocPtr doc); | xmlDocPtr doc); | |||
/* | /* | |||
* Namespaces. | * Namespaces. | |||
*/ | */ | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlSearchNs (xmlDocPtr doc, | xmlSearchNs (xmlDocPtr doc, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
const xmlChar *nameSpace); | const xmlChar *nameSpace); | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlSearchNsByHref (xmlDocPtr doc, | xmlSearchNsByHref (xmlDocPtr doc, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
const xmlChar *href); | const xmlChar *href); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || define d(LIBXML_SCHEMAS_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || define d(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN xmlNsPtr * XMLCALL | XMLPUBFUN xmlNsPtr * XMLCALL | |||
xmlGetNsList (xmlDocPtr doc, | xmlGetNsList (xmlDocPtr doc, | |||
xmlNodePtr node); | xmlNodePtr node); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetNs (xmlNodePtr node, | xmlSetNs (xmlNodePtr node, | |||
xmlNsPtr ns); | xmlNsPtr ns); | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlCopyNamespace (xmlNsPtr cur); | xmlCopyNamespace (xmlNsPtr cur); | |||
XMLPUBFUN xmlNsPtr XMLCALL | XMLPUBFUN xmlNsPtr XMLCALL | |||
xmlCopyNamespaceList (xmlNsPtr cur); | xmlCopyNamespaceList (xmlNsPtr cur); | |||
/* | /* | |||
* Changing the content. | * Changing the content. | |||
*/ | */ | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || def ined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || def ined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlSetProp (xmlNodePtr node, | xmlSetProp (xmlNodePtr node, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlSetNsProp (xmlNodePtr node, | xmlSetNsProp (xmlNodePtr node, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *value); | const xmlChar *value); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlGetNoNsProp (xmlNodePtr node, | xmlGetNoNsProp (xmlNodePtr node, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlGetProp (xmlNodePtr node, | xmlGetProp (xmlNodePtr node, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlHasProp (xmlNodePtr node, | xmlHasProp (xmlNodePtr node, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlAttrPtr XMLCALL | XMLPUBFUN xmlAttrPtr XMLCALL | |||
xmlHasNsProp (xmlNodePtr node, | xmlHasNsProp (xmlNodePtr node, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *nameSpace); | const xmlChar *nameSpace); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlGetNsProp (xmlNodePtr node, | xmlGetNsProp (xmlNodePtr node, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *nameSpace); | const xmlChar *nameSpace); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlStringGetNodeList (xmlDocPtr doc, | xmlStringGetNodeList (xmlDocPtr doc, | |||
const xmlChar *value); | const xmlChar *value); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlStringLenGetNodeList (xmlDocPtr doc, | xmlStringLenGetNodeList (xmlDocPtr doc, | |||
const xmlChar *value, | const xmlChar *value, | |||
int len); | int len); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlNodeListGetString (xmlDocPtr doc, | xmlNodeListGetString (xmlDocPtr doc, | |||
xmlNodePtr list, | xmlNodePtr list, | |||
int inLine); | int inLine); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlNodeListGetRawString (xmlDocPtr doc, | xmlNodeListGetRawString (xmlDocPtr doc, | |||
xmlNodePtr list, | xmlNodePtr list, | |||
int inLine); | int inLine); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetContent (xmlNodePtr cur, | xmlNodeSetContent (xmlNodePtr cur, | |||
const xmlChar *content); | const xmlChar *content); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetContentLen (xmlNodePtr cur, | xmlNodeSetContentLen (xmlNodePtr cur, | |||
const xmlChar *content, | const xmlChar *content, | |||
int len); | int len); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeAddContent (xmlNodePtr cur, | xmlNodeAddContent (xmlNodePtr cur, | |||
const xmlChar *content); | const xmlChar *content); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeAddContentLen (xmlNodePtr cur, | xmlNodeAddContentLen (xmlNodePtr cur, | |||
const xmlChar *content, | const xmlChar *content, | |||
int len); | int len); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlNodeGetContent (xmlNodePtr cur); | xmlNodeGetContent (xmlNodePtr cur); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNodeBufGetContent (xmlBufferPtr buffer, | xmlNodeBufGetContent (xmlBufferPtr buffer, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlNodeGetLang (xmlNodePtr cur); | xmlNodeGetLang (xmlNodePtr cur); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNodeGetSpacePreserve (xmlNodePtr cur); | xmlNodeGetSpacePreserve (xmlNodePtr cur); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetLang (xmlNodePtr cur, | xmlNodeSetLang (xmlNodePtr cur, | |||
const xmlChar *lang); | const xmlChar *lang); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetSpacePreserve (xmlNodePtr cur, | xmlNodeSetSpacePreserve (xmlNodePtr cur, | |||
int val); | int val); | |||
#endif /* LIBXML_TREE_ENABLED */ | #endif /* LIBXML_TREE_ENABLED */ | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlNodeGetBase (xmlDocPtr doc, | xmlNodeGetBase (xmlDocPtr doc, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeSetBase (xmlNodePtr cur, | xmlNodeSetBase (xmlNodePtr cur, | |||
const xmlChar *uri); | const xmlChar *uri); | |||
#endif | #endif | |||
/* | /* | |||
* Removing content. | * Removing content. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlRemoveProp (xmlAttrPtr cur); | xmlRemoveProp (xmlAttrPtr cur); | |||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlUnsetNsProp (xmlNodePtr node, | xmlUnsetNsProp (xmlNodePtr node, | |||
xmlNsPtr ns, | xmlNsPtr ns, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlUnsetProp (xmlNodePtr node, | xmlUnsetProp (xmlNodePtr node, | |||
const xmlChar *name); | const xmlChar *name); | |||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) * / | #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) * / | |||
/* | /* | |||
* Internal, don't use. | * Internal, don't use. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferWriteCHAR (xmlBufferPtr buf, | xmlBufferWriteCHAR (xmlBufferPtr buf, | |||
const xmlChar *string); | const xmlChar *string); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferWriteChar (xmlBufferPtr buf, | xmlBufferWriteChar (xmlBufferPtr buf, | |||
const char *string); | const char *string); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlBufferWriteQuotedString(xmlBufferPtr buf, | xmlBufferWriteQuotedString(xmlBufferPtr buf, | |||
const xmlChar *string); | const xmlChar *string); | |||
#ifdef LIBXML_OUTPUT_ENABLED | #ifdef LIBXML_OUTPUT_ENABLED | |||
XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, | XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
xmlAttrPtr attr, | xmlAttrPtr attr, | |||
const xmlChar *string); | const xmlChar *string); | |||
#endif /* LIBXML_OUTPUT_ENABLED */ | #endif /* LIBXML_OUTPUT_ENABLED */ | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
/* | /* | |||
* Namespace handling. | * Namespace handling. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlReconciliateNs (xmlDocPtr doc, | xmlReconciliateNs (xmlDocPtr doc, | |||
xmlNodePtr tree); | xmlNodePtr tree); | |||
#endif | #endif | |||
#ifdef LIBXML_OUTPUT_ENABLED | #ifdef LIBXML_OUTPUT_ENABLED | |||
/* | /* | |||
* Saving. | * Saving. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDocDumpFormatMemory (xmlDocPtr cur, | xmlDocDumpFormatMemory (xmlDocPtr cur, | |||
xmlChar **mem, | xmlChar **mem, | |||
int *size, | int *size, | |||
int format); | int format); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDocDumpMemory (xmlDocPtr cur, | xmlDocDumpMemory (xmlDocPtr cur, | |||
xmlChar **mem, | xmlChar **mem, | |||
int *size); | int *size); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDocDumpMemoryEnc (xmlDocPtr out_doc, | xmlDocDumpMemoryEnc (xmlDocPtr out_doc, | |||
xmlChar **doc_txt_ptr, | xmlChar **doc_txt_ptr, | |||
int * doc_txt_len, | int * doc_txt_len, | |||
const char *txt_encoding); | const char *txt_encoding); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, | xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, | |||
xmlChar **doc_txt_ptr, | xmlChar **doc_txt_ptr, | |||
int * doc_txt_len, | int * doc_txt_len, | |||
const char *txt_encoding, | const char *txt_encoding, | |||
int format); | int format); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDocFormatDump (FILE *f, | xmlDocFormatDump (FILE *f, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
int format); | int format); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDocDump (FILE *f, | xmlDocDump (FILE *f, | |||
xmlDocPtr cur); | xmlDocPtr cur); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlElemDump (FILE *f, | xmlElemDump (FILE *f, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFile (const char *filename, | xmlSaveFile (const char *filename, | |||
xmlDocPtr cur); | xmlDocPtr cur); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFormatFile (const char *filename, | xmlSaveFormatFile (const char *filename, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
int format); | int format); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlNodeDump (xmlBufferPtr buf, | xmlNodeDump (xmlBufferPtr buf, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
xmlNodePtr cur, | xmlNodePtr cur, | |||
int level, | int level, | |||
int format); | int format); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFileTo (xmlOutputBufferPtr buf, | xmlSaveFileTo (xmlOutputBufferPtr buf, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
const char *encoding); | const char *encoding); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFormatFileTo (xmlOutputBufferPtr buf, | xmlSaveFormatFileTo (xmlOutputBufferPtr buf, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
const char *encoding, | const char *encoding, | |||
int format); | int format); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlNodeDumpOutput (xmlOutputBufferPtr buf, | xmlNodeDumpOutput (xmlOutputBufferPtr buf, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
xmlNodePtr cur, | xmlNodePtr cur, | |||
int level, | int level, | |||
int format, | int format, | |||
const char *encoding); | const char *encoding); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFormatFileEnc (const char *filename, | xmlSaveFormatFileEnc (const char *filename, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
const char *encoding, | const char *encoding, | |||
int format); | int format); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSaveFileEnc (const char *filename, | xmlSaveFileEnc (const char *filename, | |||
xmlDocPtr cur, | xmlDocPtr cur, | |||
const char *encoding); | const char *encoding); | |||
#endif /* LIBXML_OUTPUT_ENABLED */ | #endif /* LIBXML_OUTPUT_ENABLED */ | |||
/* | /* | |||
* XHTML | * XHTML | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlIsXHTML (const xmlChar *systemID, | xmlIsXHTML (const xmlChar *systemID, | |||
const xmlChar *publicID); | const xmlChar *publicID); | |||
/* | /* | |||
* Compression. | * Compression. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlGetDocCompressMode (xmlDocPtr doc); | xmlGetDocCompressMode (xmlDocPtr doc); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetDocCompressMode (xmlDocPtr doc, | xmlSetDocCompressMode (xmlDocPtr doc, | |||
int mode); | int mode); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlGetCompressMode (void); | xmlGetCompressMode (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlSetCompressMode (int mode); | xmlSetCompressMode (int mode); | |||
/* | /* | |||
* DOM-wrapper helper functions. | * DOM-wrapper helper functions. | |||
*/ | */ | |||
XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL | XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL | |||
xmlDOMWrapNewCtxt (void); | xmlDOMWrapNewCtxt (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); | xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, | xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, | |||
xmlNodePtr elem, | xmlNodePtr elem, | |||
int options); | int options); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, | xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, | |||
xmlDocPtr sourceDoc, | xmlDocPtr sourceDoc, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlDocPtr destDoc, | xmlDocPtr destDoc, | |||
xmlNodePtr destParent, | xmlNodePtr destParent, | |||
int options); | int options); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, | xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, | |||
xmlDocPtr doc, | xmlDocPtr doc, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
int options); | int options); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, | xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, | |||
xmlDocPtr sourceDoc, | xmlDocPtr sourceDoc, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNodePtr *clonedNode, | xmlNodePtr *clonedNode, | |||
xmlDocPtr destDoc, | xmlDocPtr destDoc, | |||
xmlNodePtr destParent, | xmlNodePtr destParent, | |||
int deep, | int deep, | |||
int options); | int options); | |||
#ifdef LIBXML_TREE_ENABLED | #ifdef LIBXML_TREE_ENABLED | |||
/* | /* | |||
* 5 interfaces from DOM ElementTraversal, but different in entities | * 5 interfaces from DOM ElementTraversal, but different in entities | |||
* traversal. | * traversal. | |||
*/ | */ | |||
XMLPUBFUN unsigned long XMLCALL | XMLPUBFUN unsigned long XMLCALL | |||
xmlChildElementCount (xmlNodePtr parent); | xmlChildElementCount (xmlNodePtr parent); | |||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlNextElementSibling (xmlNodePtr node); | xmlNextElementSibling (xmlNodePtr node); | |||
End of changes. 174 change blocks. | ||||
524 lines changed or deleted | 527 lines changed or added | |||
unzip.h | unzip.h | |||
---|---|---|---|---|
skipping to change at line 155 | skipping to change at line 155 | |||
uLong external_fa; /* external file attributes 4 bytes */ | uLong external_fa; /* external file attributes 4 bytes */ | |||
tm_unz tmu_date; | tm_unz tmu_date; | |||
} unz_file_info; | } unz_file_info; | |||
int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | |||
const char* fileName2, | const char* fileName2, | |||
int iCaseSensitivity)); | int iCaseSensitivity)); | |||
/* | /* | |||
Compare two filename (fileName1,fileName2). | Compare two filename (fileName1,fileName2). | |||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) | If iCaseSenisivity = 1, comparison is case sensitivity (like strcmp) | |||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmp | If iCaseSenisivity = 2, comparison is not case sensitivity (like strcmpi | |||
i | ||||
or strcasecmp) | or strcasecmp) | |||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating sys tem | If iCaseSenisivity = 0, case sensitivity is default of your operating sy stem | |||
(like 1 on Unix, 2 on Windows) | (like 1 on Unix, 2 on Windows) | |||
*/ | */ | |||
unzFile ZEXPORT unzOpen OF((const char *path)); | unzFile ZEXPORT unzOpen OF((const char *path)); | |||
unzFile ZEXPORT unzOpen64 OF((const void *path)); | unzFile ZEXPORT unzOpen64 OF((const void *path)); | |||
/* | /* | |||
Open a Zip file. path contain the full pathname (by example, | Open a Zip file. path contain the full pathname (by example, | |||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix compute r | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix compute r | |||
"zlib/zlib113.zip". | "zlib/zlib113.zip". | |||
If the zipfile cannot be opened (file don't exist or in not valid), th e | If the zipfile cannot be opened (file don't exist or in not valid), th e | |||
skipping to change at line 299 | skipping to change at line 299 | |||
int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | |||
unz_file_info *pfile_info, | unz_file_info *pfile_info, | |||
char *szFileName, | char *szFileName, | |||
uLong fileNameBufferSize, | uLong fileNameBufferSize, | |||
void *extraField, | void *extraField, | |||
uLong extraFieldBufferSize, | uLong extraFieldBufferSize, | |||
char *szComment, | char *szComment, | |||
uLong commentBufferSize)); | uLong commentBufferSize)); | |||
/* | /* | |||
Get Info about the current file | Get Info about the current file | |||
if pfile_info!=NULL, the *pfile_info structure will contain somes info ab out | if pfile_info!=NULL, the *pfile_info structure will contain some info abo ut | |||
the current file | the current file | |||
if szFileName!=NULL, the filemane string will be copied in szFileName | if szFileName!=NULL, the filename string will be copied in szFileName | |||
(fileNameBufferSize is the size of the buffer) | (fileNameBufferSize is the size of the buffer) | |||
if extraField!=NULL, the extra field information will be copied in extraF ield | if extraField!=NULL, the extra field information will be copied in extraF ield | |||
(extraFieldBufferSize is the size of the buffer). | (extraFieldBufferSize is the size of the buffer). | |||
This is the Central-header version of the extra field | This is the Central-header version of the extra field | |||
if szComment!=NULL, the comment string of the file will be copied in szCo mment | if szComment!=NULL, the comment string of the file will be copied in szCo mment | |||
(commentBufferSize is the size of the buffer) | (commentBufferSize is the size of the buffer) | |||
*/ | */ | |||
/** Addition for GDAL : START */ | /** Addition for GDAL : START */ | |||
skipping to change at line 376 | skipping to change at line 376 | |||
*/ | */ | |||
int ZEXPORT unzReadCurrentFile OF((unzFile file, | int ZEXPORT unzReadCurrentFile OF((unzFile file, | |||
voidp buf, | voidp buf, | |||
unsigned len)); | unsigned len)); | |||
/* | /* | |||
Read bytes from the current file (opened by unzOpenCurrentFile) | Read bytes from the current file (opened by unzOpenCurrentFile) | |||
buf contain buffer where data must be copied | buf contain buffer where data must be copied | |||
len the size of buf. | len the size of buf. | |||
return the number of byte copied if somes bytes are copied | return the number of byte copied if some bytes are copied | |||
return 0 if the end of file was reached | return 0 if the end of file was reached | |||
return <0 with error code if there is an error | return <0 with error code if there is an error | |||
(UNZ_ERRNO for IO error, or zLib error for uncompress error) | (UNZ_ERRNO for IO error, or zLib error for uncompress error) | |||
*/ | */ | |||
z_off_t ZEXPORT unztell OF((unzFile file)); | z_off_t ZEXPORT unztell OF((unzFile file)); | |||
ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | |||
/* | /* | |||
Give the current position in uncompressed data | Give the current position in uncompressed data | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 6 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 */ | */ | |||
int cleanup; /* parsing potentially unclean URI */ | char *fragment; /* the fragment identifier */ | |||
char *query_raw; /* the query string (as it appears in the URI) */ | int cleanup; /* parsing potentially unclean 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. | ||||
35 lines changed or deleted | 36 lines changed or added | |||
uthash.h | uthash.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*/ | */ | |||
#ifndef __SUPPORT_DATA_SUPPORT_UTHASH_H__ | #ifndef __SUPPORT_DATA_SUPPORT_UTHASH_H__ | |||
#define __SUPPORT_DATA_SUPPORT_UTHASH_H__ | #define __SUPPORT_DATA_SUPPORT_UTHASH_H__ | |||
#include <string.h> /* memcmp,strlen */ | #include <string.h> /* memcmp,strlen */ | |||
#include <stddef.h> /* ptrdiff_t */ | #include <stddef.h> /* ptrdiff_t */ | |||
#include <stdlib.h> /* exit() */ | #include <stdlib.h> /* exit() */ | |||
namespace cocos2d { | ||||
/* These macros use decltype or the earlier __typeof GNU extension. | /* These macros use decltype or the earlier __typeof GNU extension. | |||
As decltype is only available in newer compilers (VS2010 or gcc 4.3+ | As decltype is only available in newer compilers (VS2010 or gcc 4.3+ | |||
when compiling c++ source) this code uses whatever method is needed | when compiling c++ source) this code uses whatever method is needed | |||
or, for VS2008 where neither is available, uses casting workarounds. */ | or, for VS2008 where neither is available, uses casting workarounds. */ | |||
#ifdef _MSC_VER /* MS compiler */ | #ifdef _MSC_VER /* MS compiler */ | |||
#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mod e */ | #if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mod e */ | |||
#define DECLTYPE(x) (decltype(x)) | #define DECLTYPE(x) (decltype(x)) | |||
#else /* VS2008 or older (or VS2010 in C mode) */ | #else /* VS2008 or older (or VS2010 in C mode) */ | |||
#define NO_DECLTYPE | #define NO_DECLTYPE | |||
#define DECLTYPE(x) | #define DECLTYPE(x) | |||
skipping to change at line 67 | skipping to change at line 65 | |||
char **_da_dst = (char**)(&(dst)); \ | char **_da_dst = (char**)(&(dst)); \ | |||
*_da_dst = (char*)(src); \ | *_da_dst = (char*)(src); \ | |||
} while(0) | } while(0) | |||
#else | #else | |||
#define DECLTYPE_ASSIGN(dst,src) \ | #define DECLTYPE_ASSIGN(dst,src) \ | |||
do { \ | do { \ | |||
(dst) = DECLTYPE(dst)(src); \ | (dst) = DECLTYPE(dst)(src); \ | |||
} while(0) | } while(0) | |||
#endif | #endif | |||
/* uint32_t next definded will conflict with other libraries and an "error C2872: 'uint32_t' : ambiguous symbol" will appear. | /* uint32_t next defined will conflict with other libraries and an "error C 2872: 'uint32_t' : ambiguous symbol" will appear. | |||
so we replace all uint32_t with 'unsigned int'. | so we replace all uint32_t with 'unsigned int'. | |||
*/ | */ | |||
/* a number of the hash function use uint32_t which isn't defined on win32 */ | /* a number of the hash function use uint32_t which isn't defined on win32 */ | |||
// #ifdef _MSC_VER | // #ifdef _MSC_VER | |||
// typedef unsigned int uint32_t; | // typedef unsigned int uint32_t; | |||
// #else | // #else | |||
// #ifndef __QNX__ | // #ifndef __QNX__ | |||
// #include <inttypes.h> /* uint32_t */ | // #include <inttypes.h> /* uint32_t */ | |||
// #endif /* __QNX__ */ | // #endif /* __QNX__ */ | |||
skipping to change at line 983 | skipping to change at line 981 | |||
typedef struct UT_hash_handle { | typedef struct UT_hash_handle { | |||
struct UT_hash_table *tbl; | struct UT_hash_table *tbl; | |||
void *prev; /* prev element in app order */ | void *prev; /* prev element in app order */ | |||
void *next; /* next element in app order */ | void *next; /* next element in app order */ | |||
struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ | struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ | |||
struct UT_hash_handle *hh_next; /* next hh in bucket order */ | struct UT_hash_handle *hh_next; /* next hh in bucket order */ | |||
void *key; /* ptr to enclosing struct's key */ | void *key; /* ptr to enclosing struct's key */ | |||
unsigned keylen; /* enclosing struct's key len */ | unsigned keylen; /* enclosing struct's key len */ | |||
unsigned hashv; /* result of hash-fcn(key) */ | unsigned hashv; /* result of hash-fcn(key) */ | |||
} UT_hash_handle; | } UT_hash_handle; | |||
}//namespace cocos2d | ||||
#endif /* __SUPPORT_DATA_SUPPORT_UTHASH_H__*/ | #endif /* __SUPPORT_DATA_SUPPORT_UTHASH_H__*/ | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 1 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 | |||
xmlmemory.h | xmlmemory.h | |||
---|---|---|---|---|
skipping to change at line 103 | skipping to change at line 103 | |||
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; | LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; | |||
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; | LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; | |||
*/ | */ | |||
/* | /* | |||
* The way to overload the existing functions. | * The way to overload the existing functions. | |||
* The xmlGc function have an extra entry for atomic block | * The xmlGc function have an extra entry for atomic block | |||
* allocations useful for garbage collected memory allocators | * allocations useful for garbage collected memory allocators | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlMemSetup (xmlFreeFunc freeFunc, | xmlMemSetup (xmlFreeFunc freeFunc, | |||
xmlMallocFunc mallocFunc, | xmlMallocFunc mallocFunc, | |||
xmlReallocFunc reallocFunc, | xmlReallocFunc reallocFunc, | |||
xmlStrdupFunc strdupFunc); | xmlStrdupFunc strdupFunc); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlMemGet (xmlFreeFunc *freeFunc, | xmlMemGet (xmlFreeFunc *freeFunc, | |||
xmlMallocFunc *mallocFunc, | xmlMallocFunc *mallocFunc, | |||
xmlReallocFunc *reallocFunc, | xmlReallocFunc *reallocFunc, | |||
xmlStrdupFunc *strdupFunc); | xmlStrdupFunc *strdupFunc); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlGcMemSetup (xmlFreeFunc freeFunc, | xmlGcMemSetup (xmlFreeFunc freeFunc, | |||
xmlMallocFunc mallocFunc, | xmlMallocFunc mallocFunc, | |||
xmlMallocFunc mallocAtomicFunc, | xmlMallocFunc mallocAtomicFunc, | |||
xmlReallocFunc reallocFunc, | xmlReallocFunc reallocFunc, | |||
xmlStrdupFunc strdupFunc); | xmlStrdupFunc strdupFunc); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlGcMemGet (xmlFreeFunc *freeFunc, | xmlGcMemGet (xmlFreeFunc *freeFunc, | |||
xmlMallocFunc *mallocFunc, | xmlMallocFunc *mallocFunc, | |||
xmlMallocFunc *mallocAtomicFunc, | xmlMallocFunc *mallocAtomicFunc, | |||
xmlReallocFunc *reallocFunc, | xmlReallocFunc *reallocFunc, | |||
xmlStrdupFunc *strdupFunc); | xmlStrdupFunc *strdupFunc); | |||
/* | /* | |||
* Initialization of the memory layer. | * Initialization of the memory layer. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlInitMemory (void); | xmlInitMemory (void); | |||
/* | /* | |||
* Cleanup of the memory layer. | * Cleanup of the memory layer. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlCleanupMemory (void); | xmlCleanupMemory (void); | |||
/* | /* | |||
* These are specific to the XML debug memory wrapper. | * These are specific to the XML debug memory wrapper. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlMemUsed (void); | xmlMemUsed (void); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlMemBlocks (void); | xmlMemBlocks (void); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlMemDisplay (FILE *fp); | xmlMemDisplay (FILE *fp); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlMemDisplayLast(FILE *fp, long nbBytes); | xmlMemDisplayLast(FILE *fp, long nbBytes); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlMemShow (FILE *fp, int nr); | xmlMemShow (FILE *fp, int nr); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlMemoryDump (void); | xmlMemoryDump (void); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); | xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlMemRealloc (void *ptr,size_t size); | xmlMemRealloc (void *ptr,size_t size); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlMemFree (void *ptr); | xmlMemFree (void *ptr); | |||
XMLPUBFUN char * XMLCALL | XMLPUBFUN char * XMLCALL | |||
xmlMemoryStrdup (const char *str); | xmlMemoryStrdup (const char *str); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_A LLOC_SIZE(1); | xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATT R_ALLOC_SIZE(1); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlReallocLoc (void *ptr, size_t size, const char *file, int line); | xmlReallocLoc (void *ptr, size_t size, const char *file, int line) ; | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATT R_ALLOC_SIZE(1); | xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ ATTR_ALLOC_SIZE(1); | |||
XMLPUBFUN char * XMLCALL | XMLPUBFUN char * XMLCALL | |||
xmlMemStrdupLoc (const char *str, const char *file, int line); | xmlMemStrdupLoc (const char *str, const char *file, int line); | |||
#ifdef DEBUG_MEMORY_LOCATION | #ifdef DEBUG_MEMORY_LOCATION | |||
/** | /** | |||
* xmlMalloc: | * xmlMalloc: | |||
* @size: number of bytes to allocate | * @size: number of bytes to allocate | |||
* | * | |||
* Wrapper for the malloc() function used in the XML library. | * Wrapper for the malloc() function used in the XML library. | |||
* | * | |||
* Returns the pointer to the allocated area or NULL in case of error. | * Returns the pointer to the allocated area or NULL in case of error. | |||
*/ | */ | |||
End of changes. 16 change blocks. | ||||
36 lines changed or deleted | 36 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, | |||
xmlSchemaWhitespaceValueTyp | xmlSchemaWhitespaceValueType fws, | |||
e fws, | xmlSchemaValType valType, | |||
xmlSchemaValType valType, | const xmlChar *value, | |||
const xmlChar *value, | xmlSchemaValPtr val, | |||
xmlSchemaValPtr val, | xmlSchemaWhitespaceValueType ws); | |||
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, | |||
xmlSchemaWhitespaceValueTy | xmlSchemaWhitespaceValueType ws); | |||
pe ws); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, | |||
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, | const xmlChar *value, | |||
const xmlChar *value, | xmlSchemaValPtr *val, | |||
xmlSchemaValPtr *val, | xmlNodePtr node); | |||
xmlNodePtr node); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlSchemaGetCanonValue (xmlSchemaValPtr val, | |||
xmlSchemaGetCanonValue (xmlSchemaValPtr val, | const xmlChar **retValue); | |||
const xmlChar **retValue); | XMLPUBFUN int XMLCALL | |||
XMLPUBFUN int XMLCALL | xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, | |||
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, | const xmlChar **retValue, | |||
const xmlChar **retValue, | xmlSchemaWhitespaceValueType ws); | |||
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 *namespaceNam | xmlSchemaNewQNameValue (const xmlChar *namespaceName, | |||
e, | const xmlChar *localName); | |||
const xmlChar *localName); | ||||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, | xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, | |||
xmlSchemaWhitespaceValueTyp | xmlSchemaWhitespaceValueType xws, | |||
e xws, | xmlSchemaValPtr y, | |||
xmlSchemaValPtr y, | xmlSchemaWhitespaceValueType yws); | |||
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. | ||||
94 lines changed or deleted | 85 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 nb_types; /* number of defined types */ | int max_types; /* max number of types */ | |||
int max_types; /* max number of types */ | xmlXPathTypePtr types; /* Array of defined types */ | |||
xmlXPathTypePtr types; /* Array of defined types */ | ||||
int nb_funcs_unused; /* unused (hash table) */ | ||||
int nb_funcs_unused; /* unused (hash table) */ | int max_funcs_unused; /* unused (hash table) */ | |||
int max_funcs_unused; /* unused (hash table) */ | xmlHashTablePtr funcHash; /* Hash table of defined funcs */ | |||
xmlHashTablePtr funcHash; /* Hash table of defined funcs */ | ||||
int nb_axis; /* number of defined axis */ | ||||
int nb_axis; /* number of defined axis */ | int max_axis; /* max number of axis */ | |||
int max_axis; /* max number of axis */ | xmlXPathAxisPtr axis; /* Array of defined 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 pa | const xmlChar *cur; /* the current char being parsed */ | |||
rsed */ | const xmlChar *base; /* the full expression */ | |||
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. | ||||
121 lines changed or deleted | 118 lines changed or added | |||
xpathInternals.h | xpathInternals.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
#include <libxml/xmlversion.h> | #include <libxml/xmlversion.h> | |||
#include <libxml/xpath.h> | #include <libxml/xpath.h> | |||
#ifdef LIBXML_XPATH_ENABLED | #ifdef LIBXML_XPATH_ENABLED | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/************************************************************************ | /************************************************************************ | |||
* * | * * | |||
* Helpers * | * Helpers * | |||
* * | * * | |||
************************************************************************/ | ************************************************************************/ | |||
/* | /* | |||
* Many of these macros may later turn into functions. They | * Many of these macros may later turn into functions. They | |||
* shouldn't be used in #ifdef's preprocessor instructions. | * shouldn't be used in #ifdef's preprocessor instructions. | |||
*/ | */ | |||
/** | /** | |||
* xmlXPathSetError: | * xmlXPathSetError: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @err: an xmlXPathError code | * @err: an xmlXPathError code | |||
* | * | |||
* Raises an error. | * Raises an error. | |||
*/ | */ | |||
#define xmlXPathSetError(ctxt, err) \ | #define xmlXPathSetError(ctxt, err) \ | |||
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); | { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ | |||
\ | ||||
if ((ctxt) != NULL) (ctxt)->error = (err); } | if ((ctxt) != NULL) (ctxt)->error = (err); } | |||
/** | /** | |||
* xmlXPathSetArityError: | * xmlXPathSetArityError: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Raises an XPATH_INVALID_ARITY error. | * Raises an XPATH_INVALID_ARITY error. | |||
*/ | */ | |||
#define xmlXPathSetArityError(ctxt) \ | #define xmlXPathSetArityError(ctxt) \ | |||
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) | xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) | |||
/** | /** | |||
* xmlXPathSetTypeError: | * xmlXPathSetTypeError: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Raises an XPATH_INVALID_TYPE error. | * Raises an XPATH_INVALID_TYPE error. | |||
*/ | */ | |||
#define xmlXPathSetTypeError(ctxt) \ | #define xmlXPathSetTypeError(ctxt) \ | |||
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) | xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) | |||
/** | /** | |||
* xmlXPathGetError: | * xmlXPathGetError: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Get the error code of an XPath context. | * Get the error code of an XPath context. | |||
* | * | |||
* Returns the context error. | * Returns the context error. | |||
*/ | */ | |||
#define xmlXPathGetError(ctxt) ((ctxt)->error) | #define xmlXPathGetError(ctxt) ((ctxt)->error) | |||
/** | /** | |||
* xmlXPathCheckError: | * xmlXPathCheckError: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Check if an XPath error was raised. | * Check if an XPath error was raised. | |||
* | * | |||
* Returns true if an error has been raised, false otherwise. | * Returns true if an error has been raised, false otherwise. | |||
*/ | */ | |||
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) | #define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) | |||
/** | /** | |||
* xmlXPathGetDocument: | * xmlXPathGetDocument: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Get the document of an XPath context. | * Get the document of an XPath context. | |||
* | * | |||
* Returns the context document. | * Returns the context document. | |||
*/ | */ | |||
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) | #define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) | |||
/** | /** | |||
* xmlXPathGetContextNode: | * xmlXPathGetContextNode: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Get the context node of an XPath context. | * Get the context node of an XPath context. | |||
* | * | |||
* Returns the context node. | * Returns the context node. | |||
*/ | */ | |||
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) | #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); | xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN double XMLCALL | XMLPUBFUN double XMLCALL | |||
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); | xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlXPathPopString (xmlXPathParserContextPtr ctxt); | xmlXPathPopString (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); | xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void * XMLCALL | XMLPUBFUN void * XMLCALL | |||
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); | xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); | |||
/** | /** | |||
* xmlXPathReturnBoolean: | * xmlXPathReturnBoolean: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @val: a boolean | * @val: a boolean | |||
* | * | |||
* Pushes the boolean @val on the context stack. | * Pushes the boolean @val on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnBoolean(ctxt, val) \ | #define xmlXPathReturnBoolean(ctxt, val) \ | |||
valuePush((ctxt), xmlXPathNewBoolean(val)) | valuePush((ctxt), xmlXPathNewBoolean(val)) | |||
/** | /** | |||
* xmlXPathReturnTrue: | * xmlXPathReturnTrue: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Pushes true on the context stack. | * Pushes true on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) | #define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) | |||
skipping to change at line 147 | skipping to change at line 147 | |||
*/ | */ | |||
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) | #define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) | |||
/** | /** | |||
* xmlXPathReturnNumber: | * xmlXPathReturnNumber: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @val: a double | * @val: a double | |||
* | * | |||
* Pushes the double @val on the context stack. | * Pushes the double @val on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnNumber(ctxt, val) \ | #define xmlXPathReturnNumber(ctxt, val) \ | |||
valuePush((ctxt), xmlXPathNewFloat(val)) | valuePush((ctxt), xmlXPathNewFloat(val)) | |||
/** | /** | |||
* xmlXPathReturnString: | * xmlXPathReturnString: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @str: a string | * @str: a string | |||
* | * | |||
* Pushes the string @str on the context stack. | * Pushes the string @str on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnString(ctxt, str) \ | #define xmlXPathReturnString(ctxt, str) \ | |||
valuePush((ctxt), xmlXPathWrapString(str)) | valuePush((ctxt), xmlXPathWrapString(str)) | |||
/** | /** | |||
* xmlXPathReturnEmptyString: | * xmlXPathReturnEmptyString: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Pushes an empty string on the stack. | * Pushes an empty string on the stack. | |||
*/ | */ | |||
#define xmlXPathReturnEmptyString(ctxt) \ | #define xmlXPathReturnEmptyString(ctxt) \ | |||
valuePush((ctxt), xmlXPathNewCString("")) | valuePush((ctxt), xmlXPathNewCString("")) | |||
/** | /** | |||
* xmlXPathReturnNodeSet: | * xmlXPathReturnNodeSet: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @ns: a node-set | * @ns: a node-set | |||
* | * | |||
* Pushes the node-set @ns on the context stack. | * Pushes the node-set @ns on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnNodeSet(ctxt, ns) \ | #define xmlXPathReturnNodeSet(ctxt, ns) \ | |||
valuePush((ctxt), xmlXPathWrapNodeSet(ns)) | valuePush((ctxt), xmlXPathWrapNodeSet(ns)) | |||
/** | /** | |||
* xmlXPathReturnEmptyNodeSet: | * xmlXPathReturnEmptyNodeSet: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Pushes an empty node-set on the context stack. | * Pushes an empty node-set on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnEmptyNodeSet(ctxt) \ | #define xmlXPathReturnEmptyNodeSet(ctxt) \ | |||
valuePush((ctxt), xmlXPathNewNodeSet(NULL)) | valuePush((ctxt), xmlXPathNewNodeSet(NULL)) | |||
/** | /** | |||
* xmlXPathReturnExternal: | * xmlXPathReturnExternal: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* @val: user data | * @val: user data | |||
* | * | |||
* Pushes user data on the context stack. | * Pushes user data on the context stack. | |||
*/ | */ | |||
#define xmlXPathReturnExternal(ctxt, val) \ | #define xmlXPathReturnExternal(ctxt, val) \ | |||
valuePush((ctxt), xmlXPathWrapExternal(val)) | valuePush((ctxt), xmlXPathWrapExternal(val)) | |||
/** | /** | |||
* xmlXPathStackIsNodeSet: | * xmlXPathStackIsNodeSet: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Check if the current value on the XPath stack is a node set or | * Check if the current value on the XPath stack is a node set or | |||
* an XSLT value tree. | * an XSLT value tree. | |||
* | * | |||
* Returns true if the current object on the stack is a node-set. | * Returns true if the current object on the stack is a node-set. | |||
*/ | */ | |||
#define xmlXPathStackIsNodeSet(ctxt) \ | #define xmlXPathStackIsNodeSet(ctxt) \ | |||
(((ctxt)->value != NULL) \ | (((ctxt)->value != NULL) \ | |||
&& (((ctxt)->value->type == XPATH_NODESET) | && (((ctxt)->value->type == XPATH_NODESET) \ | |||
\ | ||||
|| ((ctxt)->value->type == XPATH_XSLT_TREE))) | || ((ctxt)->value->type == XPATH_XSLT_TREE))) | |||
/** | /** | |||
* xmlXPathStackIsExternal: | * xmlXPathStackIsExternal: | |||
* @ctxt: an XPath parser context | * @ctxt: an XPath parser context | |||
* | * | |||
* Checks if the current value on the XPath stack is an external | * Checks if the current value on the XPath stack is an external | |||
* object. | * object. | |||
* | * | |||
* Returns true if the current object on the stack is an external | * Returns true if the current object on the stack is an external | |||
* object. | * object. | |||
*/ | */ | |||
#define xmlXPathStackIsExternal(ctxt) \ | #define xmlXPathStackIsExternal(ctxt) \ | |||
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) | ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) | |||
/** | /** | |||
* xmlXPathEmptyNodeSet: | * xmlXPathEmptyNodeSet: | |||
* @ns: a node-set | * @ns: a node-set | |||
* | * | |||
* Empties a node-set. | * Empties a node-set. | |||
*/ | */ | |||
#define xmlXPathEmptyNodeSet(ns) \ | #define xmlXPathEmptyNodeSet(ns) \ | |||
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } | { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } | |||
/** | /** | |||
* CHECK_ERROR: | * CHECK_ERROR: | |||
* | * | |||
* Macro to return from the function if an XPath error was detected. | * Macro to return from the function if an XPath error was detected. | |||
*/ | */ | |||
#define CHECK_ERROR \ | #define CHECK_ERROR \ | |||
if (ctxt->error != XPATH_EXPRESSION_OK) return | if (ctxt->error != XPATH_EXPRESSION_OK) return | |||
/** | /** | |||
* CHECK_ERROR0: | * CHECK_ERROR0: | |||
* | * | |||
* Macro to return 0 from the function if an XPath error was detected. | * Macro to return 0 from the function if an XPath error was detected. | |||
*/ | */ | |||
#define CHECK_ERROR0 \ | #define CHECK_ERROR0 \ | |||
if (ctxt->error != XPATH_EXPRESSION_OK) return(0) | if (ctxt->error != XPATH_EXPRESSION_OK) return(0) | |||
/** | /** | |||
* XP_ERROR: | * XP_ERROR: | |||
* @X: the error code | * @X: the error code | |||
* | * | |||
* Macro to raise an XPath error and return. | * Macro to raise an XPath error and return. | |||
*/ | */ | |||
#define XP_ERROR(X) \ | #define XP_ERROR(X) \ | |||
{ xmlXPathErr(ctxt, X); return; } | { xmlXPathErr(ctxt, X); return; } | |||
/** | /** | |||
* XP_ERROR0: | * XP_ERROR0: | |||
* @X: the error code | * @X: the error code | |||
* | * | |||
* Macro to raise an XPath error and return 0. | * Macro to raise an XPath error and return 0. | |||
*/ | */ | |||
#define XP_ERROR0(X) \ | #define XP_ERROR0(X) \ | |||
{ xmlXPathErr(ctxt, X); return(0); } | { xmlXPathErr(ctxt, X); return(0); } | |||
/** | /** | |||
* CHECK_TYPE: | * CHECK_TYPE: | |||
* @typeval: the XPath type | * @typeval: the XPath type | |||
* | * | |||
* Macro to check that the value on top of the XPath stack is of a given | * Macro to check that the value on top of the XPath stack is of a given | |||
* type. | * type. | |||
*/ | */ | |||
#define CHECK_TYPE(typeval) \ | #define CHECK_TYPE(typeval) \ | |||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | |||
XP_ERROR(XPATH_INVALID_TYPE) | XP_ERROR(XPATH_INVALID_TYPE) | |||
/** | /** | |||
* CHECK_TYPE0: | * CHECK_TYPE0: | |||
* @typeval: the XPath type | * @typeval: the XPath type | |||
* | * | |||
* Macro to check that the value on top of the XPath stack is of a given | * Macro to check that the value on top of the XPath stack is of a given | |||
* type. Return(0) in case of failure | * type. Return(0) in case of failure | |||
*/ | */ | |||
#define CHECK_TYPE0(typeval) \ | #define CHECK_TYPE0(typeval) \ | |||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ | |||
XP_ERROR0(XPATH_INVALID_TYPE) | XP_ERROR0(XPATH_INVALID_TYPE) | |||
/** | /** | |||
* CHECK_ARITY: | * CHECK_ARITY: | |||
* @x: the number of expected args | * @x: the number of expected args | |||
* | * | |||
* Macro to check that the number of args passed to an XPath function match es. | * Macro to check that the number of args passed to an XPath function match es. | |||
*/ | */ | |||
#define CHECK_ARITY(x) \ | #define CHECK_ARITY(x) \ | |||
if (ctxt == NULL) return; \ | if (ctxt == NULL) return; \ | |||
if (nargs != (x)) \ | if (nargs != (x)) \ | |||
XP_ERROR(XPATH_INVALID_ARITY); | XP_ERROR(XPATH_INVALID_ARITY); | |||
/** | /** | |||
* CAST_TO_STRING: | * CAST_TO_STRING: | |||
* | * | |||
* Macro to try to cast the value on the top of the XPath stack to a string . | * Macro to try to cast the value on the top of the XPath stack to a string . | |||
*/ | */ | |||
#define CAST_TO_STRING \ | #define CAST_TO_STRING \ | |||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ | |||
xmlXPathStringFunction(ctxt, 1); | xmlXPathStringFunction(ctxt, 1); | |||
/** | /** | |||
* CAST_TO_NUMBER: | * CAST_TO_NUMBER: | |||
* | * | |||
* Macro to try to cast the value on the top of the XPath stack to a number . | * Macro to try to cast the value on the top of the XPath stack to a number . | |||
*/ | */ | |||
#define CAST_TO_NUMBER \ | #define CAST_TO_NUMBER \ | |||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ | |||
xmlXPathNumberFunction(ctxt, 1); | xmlXPathNumberFunction(ctxt, 1); | |||
/** | /** | |||
* CAST_TO_BOOLEAN: | * CAST_TO_BOOLEAN: | |||
* | * | |||
* Macro to try to cast the value on the top of the XPath stack to a boolea n. | * Macro to try to cast the value on the top of the XPath stack to a boolea n. | |||
*/ | */ | |||
#define CAST_TO_BOOLEAN | #define CAST_TO_BOOLEAN \ | |||
\ | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ | |||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ | ||||
xmlXPathBooleanFunction(ctxt, 1); | xmlXPathBooleanFunction(ctxt, 1); | |||
/* | /* | |||
* Variable Lookup forwarding. | * Variable Lookup forwarding. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, | xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, | |||
xmlXPathVariableLookupFunc f, | xmlXPathVariableLookupFunc f, | |||
void *data); | void *data); | |||
/* | /* | |||
* Function Lookup forwarding. | * Function Lookup forwarding. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, | xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, | |||
xmlXPathFuncLookupFunc f, | xmlXPathFuncLookupFunc f, | |||
void *funcCtxt); | void *funcCtxt); | |||
/* | /* | |||
* Error reporting. | * Error reporting. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPatherror (xmlXPathParserContextPtr ctxt, | xmlXPatherror (xmlXPathParserContextPtr ctxt, | |||
const char *file, | const char *file, | |||
int line, | int line, | |||
int no); | int no); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathErr (xmlXPathParserContextPtr ctxt, | xmlXPathErr (xmlXPathParserContextPtr ctxt, | |||
int error); | int error); | |||
#ifdef LIBXML_DEBUG_ENABLED | #ifdef LIBXML_DEBUG_ENABLED | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathDebugDumpObject (FILE *output, | xmlXPathDebugDumpObject (FILE *output, | |||
xmlXPathObjectPtr cur, | xmlXPathObjectPtr cur, | |||
int depth); | int depth); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathDebugDumpCompExpr(FILE *output, | xmlXPathDebugDumpCompExpr(FILE *output, | |||
xmlXPathCompExprPtr comp, | xmlXPathCompExprPtr comp, | |||
int depth); | int depth); | |||
#endif | #endif | |||
/** | /** | |||
* NodeSet handling. | * NodeSet handling. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathNodeSetContains (xmlNodeSetPtr cur, | xmlXPathNodeSetContains (xmlNodeSetPtr cur, | |||
xmlNodePtr val); | xmlNodePtr val); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathDifference (xmlNodeSetPtr nodes1, | xmlXPathDifference (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathIntersection (xmlNodeSetPtr nodes1, | xmlXPathIntersection (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathDistinctSorted (xmlNodeSetPtr nodes); | xmlXPathDistinctSorted (xmlNodeSetPtr nodes); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathDistinct (xmlNodeSetPtr nodes); | xmlXPathDistinct (xmlNodeSetPtr nodes); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, | xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, | xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, | |||
xmlNodePtr node); | xmlNodePtr node); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, | xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathNodeLeading (xmlNodeSetPtr nodes, | xmlXPathNodeLeading (xmlNodeSetPtr nodes, | |||
xmlNodePtr node); | xmlNodePtr node); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathLeading (xmlNodeSetPtr nodes1, | xmlXPathLeading (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, | xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, | |||
xmlNodePtr node); | xmlNodePtr node); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, | xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathNodeTrailing (xmlNodeSetPtr nodes, | xmlXPathNodeTrailing (xmlNodeSetPtr nodes, | |||
xmlNodePtr node); | xmlNodePtr node); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathTrailing (xmlNodeSetPtr nodes1, | xmlXPathTrailing (xmlNodeSetPtr nodes1, | |||
xmlNodeSetPtr nodes2); | xmlNodeSetPtr nodes2); | |||
/** | /** | |||
* Extending a context. | * Extending a context. | |||
*/ | */ | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathRegisterNs (xmlXPathContextPtr ctxt, | xmlXPathRegisterNs (xmlXPathContextPtr ctxt, | |||
const xmlChar *prefix, | const xmlChar *prefix, | |||
const xmlChar *ns_uri); | const xmlChar *ns_uri); | |||
XMLPUBFUN const xmlChar * XMLCALL | XMLPUBFUN const xmlChar * XMLCALL | |||
xmlXPathNsLookup (xmlXPathContextPtr ctxt, | xmlXPathNsLookup (xmlXPathContextPtr ctxt, | |||
const xmlChar *prefix); | const xmlChar *prefix); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); | xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, | xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
xmlXPathFunction f); | xmlXPathFunction f); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, | xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ns_uri, | const xmlChar *ns_uri, | |||
xmlXPathFunction f); | xmlXPathFunction f); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, | xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
xmlXPathObjectPtr value); | xmlXPathObjectPtr value); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, | xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ns_uri, | const xmlChar *ns_uri, | |||
xmlXPathObjectPtr value); | xmlXPathObjectPtr value); | |||
XMLPUBFUN xmlXPathFunction XMLCALL | XMLPUBFUN xmlXPathFunction XMLCALL | |||
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, | xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlXPathFunction XMLCALL | XMLPUBFUN xmlXPathFunction XMLCALL | |||
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, | xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ns_uri); | const xmlChar *ns_uri); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); | xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathVariableLookup (xmlXPathContextPtr ctxt, | xmlXPathVariableLookup (xmlXPathContextPtr ctxt, | |||
const xmlChar *name); | const xmlChar *name); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, | xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, | |||
const xmlChar *name, | const xmlChar *name, | |||
const xmlChar *ns_uri); | const xmlChar *ns_uri); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); | xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); | |||
/** | /** | |||
* Utilities to extend XPath. | * Utilities to extend XPath. | |||
*/ | */ | |||
XMLPUBFUN xmlXPathParserContextPtr XMLCALL | XMLPUBFUN xmlXPathParserContextPtr XMLCALL | |||
xmlXPathNewParserContext (const xmlChar *str, | xmlXPathNewParserContext (const xmlChar *str, | |||
xmlXPathContextPtr ctxt); | xmlXPathContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathFreeParserContext (xmlXPathParserContextPtr ct xt); | xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); | |||
/* TODO: remap to xmlXPathValuePop and Push. */ | /* TODO: remap to xmlXPathValuePop and Push. */ | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
valuePop (xmlXPathParserContextPtr ct xt); | valuePop (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
valuePush (xmlXPathParserContextPtr ct | valuePush (xmlXPathParserContextPtr ctxt, | |||
xt, | xmlXPathObjectPtr value); | |||
xmlXPathObjectPtr value); | ||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewString (const xmlChar *val); | xmlXPathNewString (const xmlChar *val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewCString (const char *val); | xmlXPathNewCString (const char *val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathWrapString (xmlChar *val); | xmlXPathWrapString (xmlChar *val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathWrapCString (char * val); | xmlXPathWrapCString (char * val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewFloat (double val); | xmlXPathNewFloat (double val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewBoolean (int val); | xmlXPathNewBoolean (int val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewNodeSet (xmlNodePtr val); | xmlXPathNewNodeSet (xmlNodePtr val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewValueTree (xmlNodePtr val); | xmlXPathNewValueTree (xmlNodePtr val); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetAdd (xmlNodeSetPtr cur, | xmlXPathNodeSetAdd (xmlNodeSetPtr cur, | |||
xmlNodePtr val); | xmlNodePtr val); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, | xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, | |||
xmlNodePtr val); | xmlNodePtr val); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, | xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, | |||
xmlNodePtr node, | xmlNodePtr node, | |||
xmlNsPtr ns); | xmlNsPtr ns); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetSort (xmlNodeSetPtr set); | xmlXPathNodeSetSort (xmlNodeSetPtr set); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRoot (xmlXPathParserContextPtr ct xt); | xmlXPathRoot (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathEvalExpr (xmlXPathParserContextPtr ct xt); | xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlXPathParseName (xmlXPathParserContextPtr ct xt); | xmlXPathParseName (xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN xmlChar * XMLCALL | XMLPUBFUN xmlChar * XMLCALL | |||
xmlXPathParseNCName (xmlXPathParserContextPtr ct xt); | xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); | |||
/* | /* | |||
* Existing functions. | * Existing functions. | |||
*/ | */ | |||
XMLPUBFUN double XMLCALL | XMLPUBFUN double XMLCALL | |||
xmlXPathStringEvalNumber (const xmlChar *str); | xmlXPathStringEvalNumber (const xmlChar *str); | |||
XMLPUBFUN int XMLCALL | XMLPUBFUN int XMLCALL | |||
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ct | xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, | |||
xt, | xmlXPathObjectPtr res); | |||
xmlXPathObjectPtr res); | ||||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); | xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); | |||
XMLPUBFUN xmlNodeSetPtr XMLCALL | XMLPUBFUN xmlNodeSetPtr XMLCALL | |||
xmlXPathNodeSetMerge (xmlNodeSetPtr val1, | xmlXPathNodeSetMerge (xmlNodeSetPtr val1, | |||
xmlNodeSetPtr val2); | xmlNodeSetPtr val2); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetDel (xmlNodeSetPtr cur, | xmlXPathNodeSetDel (xmlNodeSetPtr cur, | |||
xmlNodePtr val); | xmlNodePtr val); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPathNodeSetRemove (xmlNodeSetPtr cur, | xmlXPathNodeSetRemove (xmlNodeSetPtr cur, | |||
int val); | int val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathNewNodeSetList (xmlNodeSetPtr val); | xmlXPathNewNodeSetList (xmlNodeSetPtr val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathWrapNodeSet (xmlNodeSetPtr val); | xmlXPathWrapNodeSet (xmlNodeSetPtr val); | |||
XMLPUBFUN xmlXPathObjectPtr XMLCALL | XMLPUBFUN xmlXPathObjectPtr XMLCALL | |||
xmlXPathWrapExternal (void *val); | xmlXPathWrapExternal (void *val); | |||
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) ; | XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) ; | |||
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); | XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); | |||
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) ; | XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) ; | |||
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); | XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); | |||
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); | XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); | |||
/* | /* | |||
* Some of the axis navigation routines. | * Some of the axis navigation routines. | |||
*/ | */ | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt , | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt , | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctx t, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctx t, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPt r ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPt r ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserCon textPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserCon textPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ct xt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ct xt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserConte xtPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserConte xtPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserCon textPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserCon textPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserCon textPtr ctxt, | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserCon textPtr ctxt, | |||
xmlNodePtr cur); | xmlNodePtr cur); | |||
/* | /* | |||
* The official core of XPath functions. | * The official core of XPath functions. | |||
*/ | */ | |||
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); | XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ct xt, int nargs); | XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ct xt, int nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); | XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, in t nargs); | XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, in t nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr c txt, int nargs); | XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr c txt, int nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPt r ctxt, int nargs); | XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPt r ctxt, int nargs); | |||
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt , int nargs); | XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt , int nargs); | |||
End of changes. 106 change blocks. | ||||
179 lines changed or deleted | 174 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 ct | xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, | |||
xt, | int nargs); | |||
int nargs); | ||||
XMLPUBFUN xmlNodePtr XMLCALL | XMLPUBFUN xmlNodePtr XMLCALL | |||
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); | xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); | |||
XMLPUBFUN void XMLCALL | XMLPUBFUN void XMLCALL | |||
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ct xt); | xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); | |||
#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. | ||||
41 lines changed or deleted | 40 lines changed or added | |||