From: Charles McGarvey Date: Tue, 3 Nov 2009 03:38:58 +0000 (-0700) Subject: converted tilemap scripts to lua X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=23d8f7a5fbd1eca7f46f2342c20ac5e28ae0128a;p=chaz%2Fyoink converted tilemap scripts to lua yajl and all json files have been purged --- diff --git a/COPYING b/COPYING index 293eda0..50a0424 100644 --- a/COPYING +++ b/COPYING @@ -71,8 +71,3 @@ Copyright: © 2002, Bob Pendleton Copyright: © 1999-2004 Southampton University, 2004-2009 Andy Rushton License: BSD - Portion: yajl - Source: http://lloyd.github.com/yajl/ -Copyright: © 2009, Lloyd Hilaiel - License: BSD - diff --git a/configure.ac b/configure.ac index 245a183..d591ee7 100644 --- a/configure.ac +++ b/configure.ac @@ -306,11 +306,9 @@ fi #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DATA_FILES=$(echo $(cd data; \ - find . -name "*.json" \ - -o -name "*.lua" \ + find . -name "*.lua" \ -o -name "*.ogg" \ -o -name "*.png" \ - -o -name "*.xm" \ -o -name "yoinkrc")) AC_SUBST([DATA_FILES]) diff --git a/data/tilemaps/AlienWarrior.json b/data/tilemaps/AlienWarrior.json deleted file mode 100644 index b1e409d..0000000 --- a/data/tilemaps/AlienWarrior.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/AlienWarrior.lua b/data/tilemaps/AlienWarrior.lua new file mode 100644 index 0000000..a98bb7c --- /dev/null +++ b/data/tilemaps/AlienWarrior.lua @@ -0,0 +1,4 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/BackgroundFar.json b/data/tilemaps/BackgroundFar.json deleted file mode 100644 index 564692b..0000000 --- a/data/tilemaps/BackgroundFar.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 1, - "tiles_t": 1, - "min_filter": "linear", - "mag_filter": "linear", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/BackgroundFar.lua b/data/tilemaps/BackgroundFar.lua new file mode 100644 index 0000000..1128761 --- /dev/null +++ b/data/tilemaps/BackgroundFar.lua @@ -0,0 +1,6 @@ +tiles_s = 1 +tiles_t = 1 +min_filter = LINEAR +mag_filter = LINEAR +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/BackgroundNear.json b/data/tilemaps/BackgroundNear.json deleted file mode 100644 index c6bb637..0000000 --- a/data/tilemaps/BackgroundNear.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 1, - "tiles_t": 1, - "min_filter": "linear", - "mag_filter": "linear", - "wrap_s": "repeat", - "wrap_t": "repeat" -} diff --git a/data/tilemaps/BackgroundNear.lua b/data/tilemaps/BackgroundNear.lua new file mode 100644 index 0000000..26d50f2 --- /dev/null +++ b/data/tilemaps/BackgroundNear.lua @@ -0,0 +1,6 @@ +tiles_s = 1 +tiles_t = 1 +min_filter = LINEAR +mag_filter = LINEAR +wrap_s = REPEAT +wrap_t = REPEAT diff --git a/data/tilemaps/BigExplosion.json b/data/tilemaps/BigExplosion.json deleted file mode 100644 index 3913ad4..0000000 --- a/data/tilemaps/BigExplosion.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 1, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/BigExplosion.lua b/data/tilemaps/BigExplosion.lua new file mode 100644 index 0000000..2acfc3c --- /dev/null +++ b/data/tilemaps/BigExplosion.lua @@ -0,0 +1,6 @@ +tiles_s = 8 +tiles_t = 1 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/Bonuses.json b/data/tilemaps/Bonuses.json deleted file mode 100644 index e5ac533..0000000 --- a/data/tilemaps/Bonuses.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/Bonuses.lua b/data/tilemaps/Bonuses.lua new file mode 100644 index 0000000..e2cf01d --- /dev/null +++ b/data/tilemaps/Bonuses.lua @@ -0,0 +1,6 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/Building.json b/data/tilemaps/Building.json deleted file mode 100644 index e5ac533..0000000 --- a/data/tilemaps/Building.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/Building.lua b/data/tilemaps/Building.lua new file mode 100644 index 0000000..e2cf01d --- /dev/null +++ b/data/tilemaps/Building.lua @@ -0,0 +1,6 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/Font.json b/data/tilemaps/Font.json deleted file mode 100644 index 57a341c..0000000 --- a/data/tilemaps/Font.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 8, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/Font.lua b/data/tilemaps/Font.lua new file mode 100644 index 0000000..d3670e1 --- /dev/null +++ b/data/tilemaps/Font.lua @@ -0,0 +1,4 @@ +tiles_s = 8 +tiles_t = 8 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/Heroine.json b/data/tilemaps/Heroine.json deleted file mode 100644 index b1e409d..0000000 --- a/data/tilemaps/Heroine.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/Heroine.lua b/data/tilemaps/Heroine.lua new file mode 100644 index 0000000..a98bb7c --- /dev/null +++ b/data/tilemaps/Heroine.lua @@ -0,0 +1,4 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/Jetbot.json b/data/tilemaps/Jetbot.json deleted file mode 100644 index bf95ae6..0000000 --- a/data/tilemaps/Jetbot.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 4, - "tiles_t": 2, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/Jetbot.lua b/data/tilemaps/Jetbot.lua new file mode 100644 index 0000000..d62e532 --- /dev/null +++ b/data/tilemaps/Jetbot.lua @@ -0,0 +1,4 @@ +tiles_s = 4 +tiles_t = 2 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/Particles.json b/data/tilemaps/Particles.json deleted file mode 100644 index e5ac533..0000000 --- a/data/tilemaps/Particles.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/Particles.lua b/data/tilemaps/Particles.lua new file mode 100644 index 0000000..e2cf01d --- /dev/null +++ b/data/tilemaps/Particles.lua @@ -0,0 +1,6 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/RobotTrooper.json b/data/tilemaps/RobotTrooper.json deleted file mode 100644 index b1e409d..0000000 --- a/data/tilemaps/RobotTrooper.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 8, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/RobotTrooper.lua b/data/tilemaps/RobotTrooper.lua new file mode 100644 index 0000000..a98bb7c --- /dev/null +++ b/data/tilemaps/RobotTrooper.lua @@ -0,0 +1,4 @@ +tiles_s = 8 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/Scenery.json b/data/tilemaps/Scenery.json deleted file mode 100644 index ac6f951..0000000 --- a/data/tilemaps/Scenery.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 4, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "repeat", - "wrap_t": "repeat" -} diff --git a/data/tilemaps/Scenery.lua b/data/tilemaps/Scenery.lua new file mode 100644 index 0000000..d42abc4 --- /dev/null +++ b/data/tilemaps/Scenery.lua @@ -0,0 +1,6 @@ +tiles_s = 4 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = REPEAT +wrap_t = REPEAT diff --git a/data/tilemaps/StatusBars.json b/data/tilemaps/StatusBars.json deleted file mode 100644 index 1ff8dcd..0000000 --- a/data/tilemaps/StatusBars.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tiles_s": 4, - "tiles_t": 1, - "min_filter": "nearest", - "mag_filter": "nearest" -} diff --git a/data/tilemaps/StatusBars.lua b/data/tilemaps/StatusBars.lua new file mode 100644 index 0000000..0b6a8fe --- /dev/null +++ b/data/tilemaps/StatusBars.lua @@ -0,0 +1,4 @@ +tiles_s = 4 +tiles_t = 1 +min_filter = NEAREST +mag_filter = NEAREST diff --git a/data/tilemaps/TowerBlock1.json b/data/tilemaps/TowerBlock1.json deleted file mode 100644 index 1dbed9e..0000000 --- a/data/tilemaps/TowerBlock1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 4, - "tiles_t": 4, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/TowerBlock1.lua b/data/tilemaps/TowerBlock1.lua new file mode 100644 index 0000000..e31c4cc --- /dev/null +++ b/data/tilemaps/TowerBlock1.lua @@ -0,0 +1,6 @@ +tiles_s = 4 +tiles_t = 4 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/data/tilemaps/Trees.json b/data/tilemaps/Trees.json deleted file mode 100644 index b2090e5..0000000 --- a/data/tilemaps/Trees.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tiles_s": 2, - "tiles_t": 1, - "min_filter": "nearest", - "mag_filter": "nearest", - "wrap_s": "clamp", - "wrap_t": "clamp" -} diff --git a/data/tilemaps/Trees.lua b/data/tilemaps/Trees.lua new file mode 100644 index 0000000..4f97474 --- /dev/null +++ b/data/tilemaps/Trees.lua @@ -0,0 +1,6 @@ +tiles_s = 2 +tiles_t = 1 +min_filter = NEAREST +mag_filter = NEAREST +wrap_s = CLAMP +wrap_t = CLAMP diff --git a/src/Moof/Animation.cc b/src/Animation.cc similarity index 72% rename from src/Moof/Animation.cc rename to src/Animation.cc index 7eaec19..b449a0f 100644 --- a/src/Moof/Animation.cc +++ b/src/Animation.cc @@ -29,12 +29,11 @@ #include #include -#include "Animation.hh" -#include "Mippleton.hh" -#include "Serializable.hh" - +#include +#include +#include -namespace Mf { +#include "Animation.hh" /** @@ -56,10 +55,10 @@ class Animation::Impl * which wants to use these loaded sequences. */ - class Data : public Mippleton + class Data : public Mf::Mippleton { friend class Impl; - friend class Mippleton; + friend class Mf::Mippleton; /** * A frame of an animation sequence. A frame is merely an index which @@ -70,40 +69,24 @@ class Animation::Impl struct Frame { unsigned index; ///< Frame index. - Scalar duration; ///< Frame duration. + Mf::Scalar duration; ///< Frame duration. /** * Construction is initialization. The frame data is loaded from a * frame map which is probably loaded within an animation file. */ - Frame(SerializableP root) : + Frame(Mf::Script& script, Mf::Script::Value table) : index(0), duration(1.0) { - Serializable::Map rootObj; - - if (root->get(rootObj)) - { - Serializable::Map::iterator it; + table.pushField("index"); + script[-1].get(index); + script.pop(); - for (it = rootObj.begin(); it != rootObj.end(); ++it) - { - std::string key = (*it).first; - if (key == "index") - { - long value = 0; - (*it).second->get(value); - index = unsigned(value); - } - else if (key == "duration") - { - double value = 0.0; - (*it).second->getNumber(value); - duration = Scalar(value); - } - } - } + table.pushField("duration"); + script[-1].get(duration); + script.pop(); } }; @@ -116,7 +99,7 @@ class Animation::Impl struct Sequence { std::vector frames; ///< List of frames. - Scalar delay; ///< Scale frame durations. + Mf::Scalar delay; ///< Scale frame durations. bool loop; ///< Does the sequence repeat? std::string next; ///< Next sequence name. @@ -127,53 +110,43 @@ class Animation::Impl * constructor which loads each individual frame. */ - Sequence(SerializableP root) : + Sequence(Mf::Script& script, Mf::Script::Value table) : delay(0.0), loop(true) { - Serializable::Map rootObj; + table.pushField("delay"); + script[-1].get(delay); + script.pop(); - if (root->get(rootObj)) + table.pushField("loop"); + script[-1].get(loop); + script.pop(); + + table.pushField("next"); + script[-1].get(next); + script.pop(); + + // TODO - sequence class/type not yet implemented + + table.pushField("frames"); + Mf::Script::Value frameTable = script.getTop(); + if (frameTable.isTable()) { - Serializable::Map::iterator it; - for (it = rootObj.begin(); it != rootObj.end(); ++it) + Mf::Script::Value top = script[-1]; + int index = 1; + + for (;;) { - std::string key = (*it).first; - - if (key == "frames") - { - Serializable::Array framesObj; - - if ((*it).second->get(framesObj)) - { - Serializable::Array::iterator jt; - - for (jt = framesObj.begin(); - jt != framesObj.end(); ++jt) - { - if (*jt) - { - frames.push_back(Frame(*jt)); - } - } - } - } - else if (key == "delay") - { - double value; - (*it).second->getNumber(value); - delay = Scalar(value); - } - else if (key == "loop") - { - (*it).second->get(loop); - } - else if (key == "next") - { - (*it).second->get(next); - } + script.push(index); + frameTable.pushField(); + + if (top.isTable()) frames.push_back(Frame(script, top)); + else break; + + ++index; } } + script.pop(); } }; @@ -186,36 +159,58 @@ class Animation::Impl void loadFromFile() { + Mf::Script script; std::string filePath = Animation::getPath(getName()); - Deserializer deserializer(filePath); + script.importStandardLibraries(); + importLogScript(script); + importAnimationBindings(script); - SerializableP root = deserializer.deserialize(); - - if (root) + if (script.doFile(filePath) != Mf::Script::SUCCESS) { - Serializable::Map rootObj; + std::string str; + script[-1].get(str); + Mf::logScript("%s", str.c_str()); + } + } - if (root->get(rootObj)) - { - Serializable::Map::iterator it; + int defineSequence(Mf::Script& script) + { + Mf::Script::Value name = script[1].requireString(); + Mf::Script::Value table = script[2].requireTable(); - for (it = rootObj.begin(); it != rootObj.end(); ++it) - { - sequences.insert(std::pair((*it).first, - Sequence((*it).second))); - } - } - } + std::string nameStr; + name.get(nameStr); + + sequences.insert(std::pair(nameStr, + Sequence(script, table))); + + return 0; } + + void importAnimationBindings(Mf::Script& script) + { + script.importFunction("DefineSequence", + boost::bind(&Data::defineSequence, this, _1)); + + script.push(1); script.set("ATTACK"); + script.push(2); script.set("CHARGE"); + script.push(3); script.set("FLY"); + script.push(4); script.set("HIT"); + script.push(5); script.set("JUMP"); + script.push(6); script.set("RUN"); + script.push(7); script.set("STAND"); + } + + /** * Construction is initialization. The animation class data container * registers itself as a mippleton and then loads the animation data. */ explicit Data(const std::string& name) : - Mippleton(name) + Mf::Mippleton(name) { loadFromFile(); } @@ -239,8 +234,8 @@ class Animation::Impl /** * Sets up the animation classes to "play" a named sequence. If another - * sequence was active, it will be replaced as the current sequence. Future - * updates will progress the new sequence. + * sequence was active, it will be replaced. Future updates will progress + * the new sequence. */ void startSequence(const std::string& name) @@ -270,7 +265,7 @@ class Animation::Impl * starts over again. */ - void update(Scalar t, Scalar dt) + void update(Mf::Scalar t, Mf::Scalar dt) { if (currentSequence) { @@ -308,8 +303,8 @@ class Animation::Impl Data::Sequence* currentSequence; ///< Active sequence. unsigned frameCounter; ///< Current frame. unsigned frameIndex; ///< Index of current frame. - Scalar timeAccum; ///< Time accumulation. - Scalar frameDuration; ///< Scaled frame duration. + Mf::Scalar timeAccum; ///< Time accumulation. + Mf::Scalar frameDuration; ///< Scaled frame duration. }; @@ -324,7 +319,7 @@ void Animation::startSequence(const std::string& name) impl_->startSequence(name); } -void Animation::update(Scalar t, Scalar dt) +void Animation::update(Mf::Scalar t, Mf::Scalar dt) { // pass through impl_->update(t, dt); @@ -349,11 +344,9 @@ unsigned Animation::getFrame() const std::string Animation::getPath(const std::string& name) { - return Resource::getPath("animations/" + name + ".json"); + return Mf::Resource::getPath("animations/" + name + ".lua"); } -} // namespace Mf - /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/Animation.hh b/src/Animation.hh similarity index 93% rename from src/Moof/Animation.hh rename to src/Animation.hh index 38a055d..30f0348 100644 --- a/src/Moof/Animation.hh +++ b/src/Animation.hh @@ -26,8 +26,8 @@ *******************************************************************************/ -#ifndef _MOOF_ANIMATION_HH_ -#define _MOOF_ANIMATION_HH_ +#ifndef _ANIMATION_HH_ +#define _ANIMATION_HH_ /** * @file Animation.hh @@ -42,9 +42,6 @@ #include -namespace Mf { - - class Animation; typedef boost::shared_ptr AnimationP; @@ -56,32 +53,31 @@ typedef boost::shared_ptr AnimationP; * anything to whatever drawing context is used to render the frame. */ -class Animation : public Resource +class Animation : public Mf::Resource { class Impl; boost::shared_ptr impl_; public: + Animation(const std::string& name); + static AnimationP alloc(const std::string& name) { return AnimationP(new Animation(name)); } - Animation(const std::string& name); void startSequence(const std::string& name); - void update(Scalar t, Scalar dt); + void update(Mf::Scalar t, Mf::Scalar dt); unsigned getFrame() const; static std::string getPath(const std::string& name); }; -} // namespace Mf - -#endif // _MOOF_ANIMATION_HH_ +#endif // _ANIMATION_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Character.cc b/src/Character.cc index ffecfd5..b26f2d4 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -71,8 +71,8 @@ private: Character::Character(const std::string& name) : - tilemap_(name), - animation_(name) + tilemap(name), + animation(name) { current.init(); @@ -118,7 +118,7 @@ void Character::update(Mf::Scalar t, Mf::Scalar dt) current.force = userForce; current.integrate(t, dt); - animation_.update(t, dt); + animation.update(t, dt); } @@ -127,16 +127,16 @@ void Character::draw(Mf::Scalar alpha) const Mf::Vector2 position = cml::lerp(previous.position, current.position, alpha); //glColor3f(1.0f, 1.0f, 1.0f); - tilemap_.bind(); + tilemap.bind(); - Mf::Tilemap::Index frame = animation_.getFrame(); + Tilemap::Index frame = animation.getFrame(); - Mf::Tilemap::Orientation orientation = Mf::Tilemap::NORMAL; + Tilemap::Orientation orientation = Tilemap::NORMAL; - if (current.velocity[0] < 0.0) orientation = Mf::Tilemap::REVERSE; + if (current.velocity[0] < 0.0) orientation = Tilemap::REVERSE; Mf::Scalar coords[8]; - tilemap_.getTileCoords(frame, coords, orientation); + tilemap.getTileCoords(frame, coords, orientation); Mf::Scalar s = 16.0; @@ -164,16 +164,5 @@ void Character::draw(Mf::Scalar alpha) const } -Mf::Tilemap& Character::getTilemap() -{ - return tilemap_; -} - -Mf::Animation& Character::getAnimation() -{ - return animation_; -} - - /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Character.hh b/src/Character.hh index 090e7cb..d1ec2c3 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -31,12 +31,14 @@ #include -#include #include #include #include #include -#include + +#include "Animation.hh" +#include "Tilemap.hh" + struct Character; @@ -145,9 +147,6 @@ private: static const Mf::Scalar z = 96.0; - Mf::Tilemap tilemap_; - Mf::Animation animation_; - protected: Mf::Vector2 userForce; @@ -160,8 +159,9 @@ public: virtual void update(Mf::Scalar t, Mf::Scalar dt); virtual void draw(Mf::Scalar alpha) const; - Mf::Tilemap& getTilemap(); - Mf::Animation& getAnimation(); + + Tilemap tilemap; + Animation animation; }; diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 3371069..c763b0f 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -48,7 +48,7 @@ GameLayer::GameLayer() : music.stream(); heroine = Heroine::alloc(); - heroine->getAnimation().startSequence("FlyDiagonallyUp"); + heroine->animation.startSequence("FlyDiagonallyUp"); Mf::Scalar a[6] = {0.0, 1.5, -0.5, 3.0, -2.0, 1.0}; interp.init(a, 2.0, Mf::Interpolator::OSCILLATE); @@ -107,7 +107,7 @@ bool GameLayer::handleEvent(const Mf::Event& event) case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_SPACE) { - heroine->getAnimation().startSequence("Flattened"); + heroine->animation.startSequence("Flattened"); Mf::logInfo("thump!"); punchSound.play(); return true; diff --git a/src/Heroine.hh b/src/Heroine.hh index 9ee49d1..c5c62ed 100644 --- a/src/Heroine.hh +++ b/src/Heroine.hh @@ -31,13 +31,7 @@ #include -#include -#include #include -#include -#include -#include -#include #include "Character.hh" diff --git a/src/Hud.cc b/src/Hud.cc index b336b28..84b7bc1 100644 --- a/src/Hud.cc +++ b/src/Hud.cc @@ -33,7 +33,7 @@ #include -ProgressBar::ProgressBar(const Mf::Tilemap& tilemap, Mf::Tilemap::Index index) : +ProgressBar::ProgressBar(const Tilemap& tilemap, Tilemap::Index index) : progress_(0.0), tilemap_(tilemap) { @@ -119,8 +119,8 @@ void ProgressBar::draw(Mf::Scalar alpha) const Hud::Hud() : - bar1_(Mf::Tilemap("StatusBars"), 0), - bar2_(Mf::Tilemap("StatusBars"), 2), + bar1_(Tilemap("StatusBars"), 0), + bar2_(Tilemap("StatusBars"), 2), font_("Font") { resize(800, 600); diff --git a/src/Hud.hh b/src/Hud.hh index 966ae43..f386fd4 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -38,14 +38,15 @@ #include #include #include -#include + +#include "Tilemap.hh" class ProgressBar : public Mf::Drawable { public: - ProgressBar(const Mf::Tilemap& tilemap, Mf::Tilemap::Index index); + ProgressBar(const Tilemap& tilemap, Tilemap::Index index); void resize(const Mf::Rectangle& rect); @@ -60,7 +61,7 @@ private: Mf::Vector2 vertices_[8]; Mf::Scalar width_; - Mf::Tilemap tilemap_; + Tilemap tilemap_; Mf::Scalar texCoords_[8]; Mf::Scalar midCoords_[2]; }; @@ -105,7 +106,7 @@ private: ProgressBar bar2_; unsigned number_; - Mf::Tilemap font_; + Tilemap font_; Mf::Matrix4 projection_; }; diff --git a/src/Makefile.am b/src/Makefile.am index aeab798..a7598d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,15 +14,11 @@ noinst_LIBRARIES = libmoof.a libmoof_a_SOURCES = \ Moof/Aabb.cc \ Moof/Aabb.hh \ - Moof/Animation.cc \ - Moof/Animation.hh \ Moof/Camera.cc \ Moof/Camera.hh \ Moof/ConvertUTF.c \ Moof/ConvertUTF.h \ Moof/Cullable.hh \ - Moof/Deserializer.cc \ - Moof/Deserializer.hh \ Moof/Dispatcher.cc \ Moof/Dispatcher.hh \ Moof/Drawable.hh \ @@ -53,10 +49,6 @@ libmoof_a_SOURCES = \ Moof/Resource.hh \ Moof/RK4.hh \ Moof/Script.hh \ - Moof/Serializable.cc \ - Moof/Serializable.hh \ - Moof/Serializer.cc \ - Moof/Serializer.hh \ Moof/Settings.cc \ Moof/Settings.hh \ Moof/Sound.cc \ @@ -68,8 +60,6 @@ libmoof_a_SOURCES = \ Moof/Texture.cc \ Moof/Texture.hh \ Moof/Thread.hh \ - Moof/Tilemap.cc \ - Moof/Tilemap.hh \ Moof/Timer.cc \ Moof/Timer.hh \ Moof/Transition.hh \ @@ -79,25 +69,9 @@ libmoof_a_SOURCES = \ Moof/fastevents.h \ $(ENDLIST) -libmoof_a_SOURCES += \ - Moof/yajl/src/yajl.c \ - Moof/yajl/src/yajl_alloc.c \ - Moof/yajl/src/yajl_alloc.h \ - Moof/yajl/src/yajl_buf.c \ - Moof/yajl/src/yajl_buf.h \ - Moof/yajl/src/yajl_bytestack.h \ - Moof/yajl/src/yajl_encode.c \ - Moof/yajl/src/yajl_encode.h \ - Moof/yajl/src/yajl_gen.c \ - Moof/yajl/src/yajl_lex.c \ - Moof/yajl/src/yajl_lex.h \ - Moof/yajl/src/yajl_parser.c \ - Moof/yajl/src/yajl_parser.h \ - $(ENDLIST) +libmoof_a_CPPFLAGS = -I$(top_srcdir)/src/Moof -libmoof_a_CPPFLAGS = -I$(top_srcdir)/src/Moof -I$(top_srcdir)/src/Moof/yajl/src - -EXTRA_DIST = Moof/cml Moof/stlplus Moof/yajl +EXTRA_DIST = Moof/cml Moof/stlplus # @@ -107,6 +81,8 @@ EXTRA_DIST = Moof/cml Moof/stlplus Moof/yajl bin_PROGRAMS = yoink yoink_SOURCES = \ + Animation.cc \ + Animation.hh \ Character.cc \ Character.hh \ GameLayer.cc \ @@ -119,6 +95,8 @@ yoink_SOURCES = \ MainLayer.hh \ Scene.cc \ Scene.hh \ + Tilemap.cc \ + Tilemap.hh \ TilemapFont.cc \ TilemapFont.hh \ TitleLayer.cc \ diff --git a/src/Moof/Deserializer.cc b/src/Moof/Deserializer.cc deleted file mode 100644 index c92ef47..0000000 --- a/src/Moof/Deserializer.cc +++ /dev/null @@ -1,255 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include -#include - -#include - -#include "Deserializer.hh" -#include "Log.hh" -#include "Serializable.hh" - - -namespace Mf { - - -class Deserializer::Impl -{ -public: - Impl(const std::string& filePath, bool comments = false, - bool check = false) - { - std::ifstream* input = new std::ifstream(filePath.c_str()); - init(*input, true, comments, check); - } - - Impl(std::istream& input, bool comments = false, - bool check = false) - { - init(input, false, comments, check); - } - - ~Impl() - { - while (!parsed.empty()) - { - delete parsed.front(); - parsed.pop(); - } - - if (deleteWhenDone) - { - delete in; - } - yajl_free(hand); - } - - void raise() - { - unsigned char* errorStr = yajl_get_error(hand, 0, 0, 0); - logError("parser error: %s", errorStr); - yajl_free_error(hand, errorStr); - - throw Exception(Exception::PARSING_FAILED); - } - - - static int parsedNull(void* ctx) - { - ((Impl*)ctx)->parsed.push(new SerializableNull); - return 1; - } - - static int parsedBoolean(void* ctx, int value) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic(value)); - return 1; - } - - static int parsedInteger(void* ctx, long value) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic(value)); - return 1; - } - - static int parsedFloat(void* ctx, double value) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic(value)); - return 1; - } - - static int parsedString(void* ctx, const unsigned char* value, - unsigned length) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic(std::string((char*)value, length))); - return 1; - } - - static int parsedBeginMap(void* ctx) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic); - return 1; - } - - static int parsedMapKey(void* ctx, const unsigned char* value, - unsigned length) - { - // same thing as a string - return parsedString(ctx, value, length); - } - - static int parsedEndMap(void* ctx) - { - // null means the end of a structure - ((Impl*)ctx)->parsed.push(0); - return 1; - } - - static int parsedBeginArray(void* ctx) - { - ((Impl*)ctx)->parsed.push(new SerializableBasic); - return 1; - } - - static int parsedEndArray(void* ctx) - { - // null means the end of a structure - ((Impl*)ctx)->parsed.push(0); - return 1; - } - - - void parse() - { - unsigned char buffer[4096]; - - yajl_status stat; - - while (parsed.empty() && in->good()) - { - in->read((char*)buffer, sizeof(buffer)); - unsigned readIn = in->gcount(); - - if (readIn > 0) - { - stat = yajl_parse(hand, buffer, readIn); - } - else - { - stat = yajl_parse_complete(hand); - } - - if (stat != yajl_status_ok && - stat != yajl_status_insufficient_data) - { - raise(); - } - } - } - - - yajl_handle hand; - - std::istream* in; - bool deleteWhenDone; - - std::queue parsed; - -private: - void init(std::istream& input, bool deleteIn, bool comments, bool check) - { - // this has to be static because yajl actually does not copy it into its - // internal data structures but rather keeps a pointer to this - static const yajl_callbacks callbacks = - { - Impl::parsedNull, - Impl::parsedBoolean, - Impl::parsedInteger, - Impl::parsedFloat, - 0, - Impl::parsedString, - Impl::parsedBeginMap, - Impl::parsedMapKey, - Impl::parsedEndMap, - Impl::parsedBeginArray, - Impl::parsedEndArray - }; - - in = &input; - deleteWhenDone = deleteIn; - - yajl_parser_config config = {comments, check}; - hand = yajl_alloc(&callbacks, &config, NULL, this); - } -}; - - -Deserializer::Deserializer(const std::string& filePath, bool comments, - bool check) : - // pass through - impl_(new Deserializer::Impl(filePath, comments, check)) {} - -Deserializer::Deserializer(std::istream& input, bool comments, bool check) : - // pass through - impl_(new Deserializer::Impl(input, comments, check)) {} - - -SerializableP Deserializer::deserialize() -{ - Serializable* ptr = pullNext(); - if (ptr) - { - ptr->deserialize(*this); - } - return SerializableP(ptr); -} - - -Serializable* Deserializer::pullNext() -{ - impl_->parse(); - if (!impl_->parsed.empty()) - { - Serializable* ptr = impl_->parsed.front(); - return ptr; - } - return 0; -} - -void Deserializer::pop() -{ - // pass through - impl_->parsed.pop(); -} - - -} // namespace Mf - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Deserializer.hh b/src/Moof/Deserializer.hh deleted file mode 100644 index cf99c2d..0000000 --- a/src/Moof/Deserializer.hh +++ /dev/null @@ -1,153 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _MOOF_DESERIALIZER_HH_ -#define _MOOF_DESERIALIZER_HH_ - -/** - * @file Deserializer.hh - * Deserialize structures and types from input on a stream. - */ - -#include -#include -#include - -#include - -#include - - -namespace Mf { - - -class Serializable; // forward declaration -typedef boost::shared_ptr SerializableP; - - -class Deserializer -{ - class Impl; - boost::shared_ptr impl_; - -public: - - /** - * Construction is initialization. A deserializer can be constructed with - * either an input stream or a string representing a filename that will be - * read from. If a stream is provided, it will not be closed after parsing, - * but the parser may read past the end of usable bytes, so you should not - * use a deserializer on a stream that you expect to continue to use after - * the deserialization. - * @param comments If true, C and C++-style comments will be allowed and - * ignored by the parser. - * @param check If true, UTF-8 strings will be checked for validity and an - * exception thrown if such a problem exists. Otherwise strings will not be - * checked. - */ - - Deserializer(const std::string& filePath, bool comments = false, - bool check = false); - Deserializer(std::istream& input, bool comments = false, bool check = false); - - - /** - * Parse the object from of the stream. The stream is considered to be - * dominated by the parser and may read and discard bytes past the end of - * the actual parsed object. Only one object can be deserialized by the - * deserializer. - */ - - SerializableP deserialize(); - - /** - * Used by serializable objects to parse themselves. These methods should - * generally not be used directory for deserialization. This one returns - * the next object in the queue which has been parsed. This method may - * block if more data is pending and an object has not bee constructed yet. - * The caller takes ownership of the object which has been allocated with - * the new operator and must therefore be sure to delete the object as - * appropriated. Null (0) will be returned by this method to signify one of - * three things: 1) the end of an array, 2) the end of a map/dictionary, or - * 3) there is nothing more to be obtained. Container objects will be empty - * and will have to be filled with their contained elements by repeatedly - * calling this method until a null is returned. This method will continue - * to return the same value until pop() is called which will cause this - * method to return the next object as expected. - */ - - Serializable* pullNext(); - - /** - * If the object returned by pullNext() has been received successfully and - * the caller is ready for the next object, this method should be called to - * take that object off of the queue. - */ - - void pop(); - - - /** - * This exception is thrown upon deserialization errors. - */ - - struct Exception : public Mf::Exception - { - enum - { - PARSING_FAILED = 1024 - }; - - explicit Exception(unsigned error) : - Mf::Exception(error) {} - - void raise() - { - throw *this; - } - - const char* what() const throw() - { - switch (code) - { - case PARSING_FAILED: - return "parsing failed"; - } - return Mf::Exception::what(); - } - }; -}; - - -} // namespace Mf - - -#endif // _MOOF_DESERIALIZER_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Script.hh b/src/Moof/Script.hh index 553e31a..2fe275e 100644 --- a/src/Moof/Script.hh +++ b/src/Moof/Script.hh @@ -126,6 +126,18 @@ struct Script index(i), state(s) {} + /** + * A copied value presently points to the same value, except the real + * index is used. That means that if a value that refers to a frame + * referenced from the top of the stack will have its normalized index + * copied into the new value object. + */ + + Value(const Value& copy) : + index(copy.getRealIndex()), + state(copy.state) {} + + // check the type of the value bool isBoolean() const { return (bool)lua_isboolean(state, index); } bool isFunction() const { return (bool)lua_isfunction(state, index); } diff --git a/src/Moof/Serializable.cc b/src/Moof/Serializable.cc deleted file mode 100644 index b374575..0000000 --- a/src/Moof/Serializable.cc +++ /dev/null @@ -1,122 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "Serializable.hh" - - -namespace Mf { - - -Serializable::~Serializable() -{ -} - - -bool Serializable::get(Integer& value) -{ - return false; -} - -bool Serializable::get(Float& value) -{ - return false; -} - -bool Serializable::get(Boolean& value) -{ - return false; -} - -bool Serializable::get(String& value) -{ - return false; -} - -bool Serializable::get(WideString& value) -{ - return false; -} - -bool Serializable::get(Array& value) -{ - return false; -} - -bool Serializable::get(Map& value) -{ - return false; -} - - -bool Serializable::isNull() -{ - return false; -} - - -bool Serializable::getNumber(Integer& value) -{ - if (get(value)) - { - return true; - } - else - { - Float doubleValue; - if (get(doubleValue)) - { - value = Integer(doubleValue); - return true; - } - } - return false; -} - -bool Serializable::getNumber(Float& value) -{ - if (get(value)) - { - return true; - } - else - { - Integer longValue; - if (get(longValue)) - { - value = Float(longValue); - return true; - } - } - return false; -} - - -} // namespace Mf - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Serializable.hh b/src/Moof/Serializable.hh deleted file mode 100644 index e91660d..0000000 --- a/src/Moof/Serializable.hh +++ /dev/null @@ -1,257 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _MOOF_SERIALIZABLE_HH_ -#define _MOOF_SERIALIZABLE_HH_ - -#include -#include -#include -#include - -#include -#include -#include - - -namespace Mf { - - -/** - * Interface for a type which can be serialized and deserialized. - */ - -struct Serializable -{ - // basic types which are serializable - typedef long Integer; - typedef double Float; - typedef bool Boolean; - typedef std::string String; - typedef std::wstring WideString; - typedef std::vector Array; - typedef std::map Map; - - - virtual ~Serializable(); - - virtual void serialize(Serializer& out) const = 0; - virtual void deserialize(Deserializer& in) = 0; - - virtual void print() const = 0; - - virtual bool get(Integer& value); - virtual bool get(Float& value); - virtual bool get(Boolean& value); - virtual bool get(String& value); - virtual bool get(WideString& value); - virtual bool get(Array& value); - virtual bool get(Map& value); - - /* - * To get a number value which may have been parsed as either an integer or - * double, use these getters instead. - */ - - bool getNumber(Integer& value); - bool getNumber(Float& value); - - virtual bool isNull(); -}; - - -template -class SerializableBasic : public Serializable -{ - T value_; - -public: - - SerializableBasic() {} - SerializableBasic(const T& value) : - value_(value) {} - - void serialize(Serializer& out) const; - void deserialize(Deserializer& in); - - void print() const; - bool get(T& value); -}; - - -struct SerializableNull : public Serializable -{ - SerializableNull() {} - - void serialize(Serializer& out) const; - void deserialize(Deserializer& in); - - void print() const; - bool isNull(); -}; - - -template -inline void SerializableBasic::serialize(Serializer& out) const -{ - out.push(value_); -} - -template <> -inline void -SerializableBasic::serialize(Serializer& out) const -{ - out.pushArrayHead(); - - std::vector::const_iterator it; - for (it = value_.begin(); it < value_.end(); ++it) - { - (*it)->serialize(out); - } - - out.pushArrayTail(); -} - -template <> -inline void -SerializableBasic::serialize(Serializer& out) const -{ - out.pushMapHead(); - - for (Map::const_iterator it = value_.begin(); it != value_.end(); ++it) - { - out.push((*it).first); - (*it).second->serialize(out); - } - - out.pushMapTail(); -} - -inline void SerializableNull::serialize(Serializer& out) const -{ - out.pushNull(); -} - - -template -inline void SerializableBasic::deserialize(Deserializer& in) -{ - in.pop(); -} - -template <> -inline void -SerializableBasic::deserialize(Deserializer& in) -{ - SerializableP obj; - - in.pop(); - - while (obj = in.deserialize()) - { - value_.push_back(obj); - } - - in.pop(); -} - -template <> -inline void -SerializableBasic::deserialize(Deserializer& in) -{ - SerializableP obj; - - in.pop(); - - while (obj = in.deserialize()) - { - std::string key; - if (obj->get(key)) - { - value_[key] = in.deserialize(); - } - } - - in.pop(); -} - -inline void SerializableNull::deserialize(Deserializer& in) -{ - in.pop(); -} - - -template -inline void SerializableBasic::print() const -{ - std::cout << std::boolalpha << typeid(T).name() << "(" << value_ << ")"; -} - -template <> -inline void SerializableBasic::print() const -{ - std::wcout << value_; -} - -template <> -inline void SerializableBasic::print() const -{ - std::cout << "array"; -} - -template <> -inline void SerializableBasic::print() const -{ - std::cout << "map"; -} - -inline void SerializableNull::print() const -{ - std::cout << "null"; -} - - -template -inline bool SerializableBasic::get(T& value) -{ - value = value_; - return true; -} - -inline bool SerializableNull::isNull() -{ - return true; -} - - -} // namespace Mf - -#endif // _MOOF_SERIALIZABLE_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Serializer.cc b/src/Moof/Serializer.cc deleted file mode 100644 index 570ee5a..0000000 --- a/src/Moof/Serializer.cc +++ /dev/null @@ -1,199 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include - -#include - -#include "Serializer.hh" -#include "StringTools.hh" - - -namespace Mf { - - -struct Serializer::Impl -{ - Impl(const std::string& filePath, const std::string& indent = "") - { - std::ofstream* output = new std::ofstream(filePath.c_str()); - init(*output, true, indent); - } - - Impl(std::ostream& output, const std::string& indent = "") - { - init(output, false, indent); - } - - ~Impl() - { - if (deleteWhenDone) - { - delete out; - } - yajl_gen_free(gen); - } - - static void raise(yajl_gen_status err) - { - switch (err) - { - case yajl_gen_generation_complete: - throw Serializer::Exception(Exception::ARCHIVE_TERMINATED); - case yajl_gen_keys_must_be_strings: - throw Serializer::Exception(Exception::KEYS_MUST_BE_STRINGS); - case yajl_max_depth_exceeded: - throw Serializer::Exception(Exception::RECURSION_TOO_DEEP); - case yajl_gen_in_error_state: - throw Serializer::Exception(Exception::ALREADY_FAILED); - case yajl_gen_status_ok: - ; // There is no error here. Move along... - } - } - - yajl_gen gen; - - std::ostream* out; - bool deleteWhenDone; - -private: - - void init(std::ostream& output, bool deleteOut, const std::string& indent) - { - yajl_gen_config config; - - out = &output; - deleteWhenDone = deleteOut; - - if (indent != "") - { - config.beautify = true; - config.indentString = 0; - // FIXME a yajl bug prevents using heap-allocated strings - //config.indentString = indent.c_str(); - } - else - { - config.beautify = false; - } - gen = yajl_gen_alloc(&config, 0); - } -}; - - -Serializer::Serializer(const std::string& filePath, const std::string& indent) : - // pass through - impl_(new Serializer::Impl(filePath, indent)) {} - -Serializer::Serializer(std::ostream& output, const std::string& indent) : - // pass through - impl_(new Serializer::Impl(output, indent)) {} - -Serializer::~Serializer() -{ - flush(); -} - - -void Serializer::push(long value) -{ - yajl_gen_status stat = yajl_gen_integer(impl_->gen, value); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::push(double value) -{ - yajl_gen_status stat = yajl_gen_double(impl_->gen, value); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::push(bool value) -{ - yajl_gen_status stat = yajl_gen_bool(impl_->gen, value); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::push(const std::string& value) -{ - yajl_gen_status stat = yajl_gen_string(impl_->gen, - (const unsigned char*)value.c_str(), value.length()); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::push(const std::wstring& value) -{ - push(wideToMulti(value)); -} - -void Serializer::pushNull() -{ - yajl_gen_status stat = yajl_gen_null(impl_->gen); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - - -void Serializer::pushMapHead() -{ - yajl_gen_status stat = yajl_gen_map_open(impl_->gen); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::pushMapTail() -{ - yajl_gen_status stat = yajl_gen_map_close(impl_->gen); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::pushArrayHead() -{ - yajl_gen_status stat = yajl_gen_array_open(impl_->gen); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - -void Serializer::pushArrayTail() -{ - yajl_gen_status stat = yajl_gen_array_close(impl_->gen); - if (stat != yajl_gen_status_ok) Serializer::Impl::raise(stat); -} - - -void Serializer::flush() -{ - const unsigned char* buffer; - unsigned length; - - yajl_gen_get_buf(impl_->gen, &buffer, &length); - impl_->out->write((const char*)buffer, length); - yajl_gen_clear(impl_->gen); -} - - -} // namespace Mf - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Serializer.hh b/src/Moof/Serializer.hh deleted file mode 100644 index 4329e6f..0000000 --- a/src/Moof/Serializer.hh +++ /dev/null @@ -1,150 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef _MOOF_SERIALIZER_HH_ -#define _MOOF_SERIALIZER_HH_ - -/** - * @file Serializer.hh - * Serialize structures and types for output on a stream. - */ - -#include -#include -#include - -#include - -#include - - -namespace Mf { - - -class Serializer -{ - class Impl; - boost::shared_ptr impl_; - -public: - - /** - * Construction is initialization. Use either an output stream or a string - * representing a path to a fill to which the serialized data will be - * written (replacing any previous file). - * @param indent If non-empty, the string's characters will be used as - * indentation. Otherwise, the serialized data will not be formatted neatly - * but will be tightly packed. - */ - - Serializer(const std::string& filePath, const std::string& indent = ""); - Serializer(std::ostream& output, const std::string& indent = ""); - - ~Serializer(); - - /** - * Push various types of data onto the stream. - */ - - void push(long value); - void push(double value); - void push(bool value); - void push(const std::string& value); - void push(const std::wstring& value); - void pushNull(); - - /** - * Push a map onto the stream. Each map head must be matched by a map tail. - */ - - void pushMapHead(); - void pushMapTail(); - - /** - * Push an array onto the stream. Each array head must be matched by an - * array tail. - */ - - void pushArrayHead(); - void pushArrayTail(); - - /** - * Write any pending bytes to the stream. This is called automatically by - * the destructor of this class. - */ - - void flush(); - - - /** - * This exception is thrown for serializer-related exceptional errors. - */ - - struct Exception : public Mf::Exception - { - enum - { - ARCHIVE_TERMINATED = 1024, - KEYS_MUST_BE_STRINGS = 1025, - RECURSION_TOO_DEEP = 1026, - ALREADY_FAILED = 1027, - }; - - explicit Exception(unsigned error) : - Mf::Exception(error) {} - - void raise() - { - throw *this; - } - - const char* what() const throw() - { - switch (code) - { - case ARCHIVE_TERMINATED: - return "archive is already terminated"; - case KEYS_MUST_BE_STRINGS: - return "map keys must be strings"; - case RECURSION_TOO_DEEP: - return "generator recursion too deep"; - case ALREADY_FAILED: - return "generator already errored out"; - } - return Mf::Exception::what(); - } - }; -}; - -} // namespace Mf - - -#endif // _MOOF_SERIALIZER_HH_ - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/Tilemap.cc b/src/Moof/Tilemap.cc deleted file mode 100644 index 4fe5e97..0000000 --- a/src/Moof/Tilemap.cc +++ /dev/null @@ -1,235 +0,0 @@ - -/******************************************************************************* - - Copyright (c) 2009, Charles McGarvey - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "Deserializer.hh" -#include "Mippleton.hh" -#include "OpenGL.hh" -#include "Serializable.hh" -#include "Tilemap.hh" - - -namespace Mf { - - -class Tilemap::Impl : public Mippleton -{ - static GLint filterFromString(const std::string& filter) - { - if (filter == "linear") - { - return GL_LINEAR; - } - else if (filter == "nearest_mipmap_nearest") - { - return GL_NEAREST_MIPMAP_NEAREST; - } - else if (filter == "nearest_mipmap_linear") - { - return GL_NEAREST_MIPMAP_LINEAR; - } - else if (filter == "linear_mipmap_nearest") - { - return GL_LINEAR_MIPMAP_NEAREST; - } - else if (filter == "linear_mipmap_linear") - { - return GL_LINEAR_MIPMAP_LINEAR; - } - - return GL_NEAREST; - } - - static GLint wrapFromString(const std::string& wrap) - { - if (wrap == "repeat") - { - return GL_REPEAT; - } - - return GL_CLAMP; - } - -public: - Impl(const std::string& name) : - Mippleton(name), - magFilter_(GL_NEAREST), - minFilter_(GL_NEAREST), - nTilesS_(1), - nTilesT_(1), - wrapS_(GL_CLAMP), - wrapT_(GL_CLAMP) - { - loadFromFile(); - } - - void loadFromFile() - { - Deserializer deserializer(Tilemap::getPath(getName())); - - SerializableP root = deserializer.deserialize(); - - if (root) - { - Serializable::Map rootObj; - - if (root->get(rootObj)) - { - Serializable::Map::iterator it; - - if ((it = rootObj.find("tiles_s")) != rootObj.end()) - { - long value; - if ((*it).second->get(value)) - { - nTilesS_ = unsigned(value); - } - } - if ((it = rootObj.find("tiles_t")) != rootObj.end()) - { - long value; - if ((*it).second->get(value)) - { - nTilesT_ = unsigned(value); - } - } - if ((it = rootObj.find("min_filter")) != rootObj.end()) - { - std::string value; - if ((*it).second->get(value)) - { - minFilter_ = filterFromString(value); - } - } - if ((it = rootObj.find("mag_filter")) != rootObj.end()) - { - std::string value; - if ((*it).second->get(value)) - { - magFilter_ = filterFromString(value); - } - } - if ((it = rootObj.find("wrap_s")) != rootObj.end()) - { - std::string value; - if ((*it).second->get(value)) - { - wrapS_ = wrapFromString(value); - } - } - if ((it = rootObj.find("wrap_t")) != rootObj.end()) - { - std::string value; - if ((*it).second->get(value)) - { - wrapT_ = wrapFromString(value); - } - } - } - } - } - - GLuint magFilter_; - GLuint minFilter_; - unsigned nTilesS_; - unsigned nTilesT_; - GLuint wrapS_; - GLuint wrapT_; -}; - - -Tilemap::Tilemap(const std::string& name) : - Texture(name), - impl_(Tilemap::Impl::getInstance(name)) -{ - setMinFilter(impl_->minFilter_); - setMagFilter(impl_->magFilter_); - setWrapS(impl_->wrapS_); - setWrapT(impl_->wrapT_); -} - - -bool Tilemap::getTileCoords(unsigned index, Scalar coords[8]) const -{ - // make sure the index represents a real tile - if (index >= impl_->nTilesS_ * impl_->nTilesT_) return false; - - Scalar w = 1.0 / Scalar(impl_->nTilesS_); - Scalar h = 1.0 / Scalar(impl_->nTilesT_); - - coords[0] = Scalar(index % impl_->nTilesS_) * w; - coords[1] = (Scalar(impl_->nTilesT_ - 1) - - Scalar(index / impl_->nTilesS_)) * h; - coords[2] = coords[0] + w; - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = coords[1] + h; - coords[6] = coords[0]; - coords[7] = coords[5]; - - return true; -} - -bool Tilemap::getTileCoords(unsigned index, Scalar coords[8], - Orientation orientation) const -{ - if (getTileCoords(index, coords)) - { - if (orientation & FLIP) - { - // this looks kinda weird, but it's just swapping in a way that - // doesn't require an intermediate variable - coords[1] = coords[5]; - coords[5] = coords[3]; - coords[3] = coords[7]; - coords[7] = coords[5]; - } - if (orientation & REVERSE) - { - coords[0] = coords[2]; - coords[2] = coords[6]; - coords[4] = coords[6]; - coords[6] = coords[0]; - } - - return true; - } - - return false; -} - - -std::string Tilemap::getPath(const std::string& name) -{ - return Resource::getPath("tilemaps/" + name + ".json"); -} - - -} // namespace Mf - -/** vim: set ts=4 sw=4 tw=80: *************************************************/ - diff --git a/src/Moof/yajl/BUILDING b/src/Moof/yajl/BUILDING deleted file mode 100644 index 74589e1..0000000 --- a/src/Moof/yajl/BUILDING +++ /dev/null @@ -1,19 +0,0 @@ -Short story (If you already have ruby and cmake): - -./configure && make install - -When things go wrong: - -attain CMake (http://www.cmake.org) and ruby (http://ruby-lang.org) and -try again. - -OR, attain CMake and build by hand: - -1. mkdir build -2. cd build -3. cmake .. -4. make -5. build output left in yajl-X.Y.Z - -best, -lloyd diff --git a/src/Moof/yajl/BUILDING.win32 b/src/Moof/yajl/BUILDING.win32 deleted file mode 100644 index 8b987ee..0000000 --- a/src/Moof/yajl/BUILDING.win32 +++ /dev/null @@ -1,13 +0,0 @@ -YAJL has been successfully built using Visual Studio 8. CMake is used to -build the software and by specifying a generator explicitly at cmake: - -1. acquire cmake (http://www.cmake.org) -2. mkdir build -3. cd build -4. cmake .. -5. devenv YetAnotherJSONParser.sln -6. build the ALL_BUILD target -7. build output is left in build/yajl-X.Y.Z - -Earlier versions of visual studio have not been tested, but should -work without any major issues. diff --git a/src/Moof/yajl/CMakeLists.txt b/src/Moof/yajl/CMakeLists.txt deleted file mode 100644 index 6ec4f87..0000000 --- a/src/Moof/yajl/CMakeLists.txt +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2007-2009, Lloyd Hilaiel. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, 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. Neither the name of Lloyd Hilaiel nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -PROJECT(YetAnotherJSONParser) - -SET (YAJL_MAJOR 1) -SET (YAJL_MINOR 0) -SET (YAJL_MICRO 5) - -SET (YAJL_DIST_NAME "yajl-${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}") - -IF (NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Release") -ENDIF (NOT CMAKE_BUILD_TYPE) - -SET(CMAKE_C_FLAGS "-Wall") -IF (WIN32) - SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") - SET(CMAKE_EXE_LINKER_FLAGS "${linkFlags}" - CACHE STRING "YAJL linker flags" FORCE) - SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "" - CACHE STRING "YAJL debug linker flags" FORCE) - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE - CACHE STRING "YAJL release linker flags" FORCE) - SET(CMAKE_SHARED_LINKER_FLAGS "${linkFlags}" - CACHE STRING "YAJL shared linker flags" FORCE) - SET(CMAKE_MODULE_LINKER_FLAGS "${linkFlags}" - CACHE STRING "YAJL module linker flags" FORCE) - - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711") - SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7") - SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2") -ELSE (WIN32) - SET(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -fPIC -ansi -pedantic -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wno-missing-field-initializers -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes") - - SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g") - SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -Wuninitialized") -ENDIF (WIN32) - - -ADD_SUBDIRECTORY(src) -ADD_SUBDIRECTORY(test) -ADD_SUBDIRECTORY(reformatter) -ADD_SUBDIRECTORY(verify) - -INCLUDE(YAJLDoc.cmake) - -# a test target -ADD_CUSTOM_TARGET(test - ./run_tests.sh - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) - diff --git a/src/Moof/yajl/COPYING b/src/Moof/yajl/COPYING deleted file mode 100644 index fac48ba..0000000 --- a/src/Moof/yajl/COPYING +++ /dev/null @@ -1,29 +0,0 @@ -Copyright 2007-2009, Lloyd Hilaiel. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - 1. Redistributions of source code must retain the above copyright - notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/src/Moof/yajl/TODO b/src/Moof/yajl/TODO deleted file mode 100644 index 56c3dc0..0000000 --- a/src/Moof/yajl/TODO +++ /dev/null @@ -1,9 +0,0 @@ -* add a test for 0x1F bug -* numeric overflow in integers and double -* line and char offsets in the lexer and in error messages -* testing: - a. the permuter - b. some performance comparison against json_checker. -* investigate pull instead of push parsing -* Handle memory allocation failures gracefully -* cygwin/msys support on win32 diff --git a/src/Moof/yajl/YAJLDoc.cmake b/src/Moof/yajl/YAJLDoc.cmake deleted file mode 100644 index 049cdef..0000000 --- a/src/Moof/yajl/YAJLDoc.cmake +++ /dev/null @@ -1,26 +0,0 @@ -FIND_PROGRAM(doxygenPath doxygen) - -IF (doxygenPath) - SET (YAJL_VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}) - SET(yajlDirName yajl-${YAJL_VERSION}) - SET(docPath - "${CMAKE_CURRENT_BINARY_DIR}/${yajlDirName}/share/doc/${yajlDirName}") - MESSAGE("** using doxygen at: ${doxygenPath}") - MESSAGE("** documentation output to: ${docPath}") - - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/YAJL.dxy - ${CMAKE_CURRENT_BINARY_DIR}/YAJL.dxy @ONLY) - - FILE(MAKE_DIRECTORY "${docPath}") - - ADD_CUSTOM_TARGET(doc - ${doxygenPath} YAJL.dxy - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -ELSE (doxygenPath) - MESSAGE("!! doxygen not found, not generating documentation") - ADD_CUSTOM_TARGET( - doc - echo doxygen not installed, not generating documentation - ) -ENDIF (doxygenPath) diff --git a/src/Moof/yajl/reformatter/CMakeLists.txt b/src/Moof/yajl/reformatter/CMakeLists.txt deleted file mode 100644 index 5e6a281..0000000 --- a/src/Moof/yajl/reformatter/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2007-2009, Lloyd Hilaiel. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, 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. Neither the name of Lloyd Hilaiel nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -# set up a paths -SET (binDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/bin) - -# create a directories -FILE(MAKE_DIRECTORY ${binDir}) - -SET (SRCS json_reformat.c) - -# use the library we build, duh. -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include) -LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) - -ADD_EXECUTABLE(json_reformat ${SRCS}) - -TARGET_LINK_LIBRARIES(json_reformat yajl_s) - -# copy the binary into the output directory -GET_TARGET_PROPERTY(binPath json_reformat LOCATION) - -ADD_CUSTOM_COMMAND(TARGET json_reformat POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir}) - -IF (NOT WIN32) - INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin) -ENDIF () diff --git a/src/Moof/yajl/reformatter/json_reformat.c b/src/Moof/yajl/reformatter/json_reformat.c deleted file mode 100644 index a85f2ea..0000000 --- a/src/Moof/yajl/reformatter/json_reformat.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include -#include -#include - -static int reformat_null(void * ctx) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_null(g); - return 1; -} - -static int reformat_boolean(void * ctx, int boolean) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_bool(g, boolean); - return 1; -} - -static int reformat_number(void * ctx, const char * s, unsigned int l) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_number(g, s, l); - return 1; -} - -static int reformat_string(void * ctx, const unsigned char * stringVal, - unsigned int stringLen) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_string(g, stringVal, stringLen); - return 1; -} - -static int reformat_map_key(void * ctx, const unsigned char * stringVal, - unsigned int stringLen) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_string(g, stringVal, stringLen); - return 1; -} - -static int reformat_start_map(void * ctx) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_map_open(g); - return 1; -} - - -static int reformat_end_map(void * ctx) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_map_close(g); - return 1; -} - -static int reformat_start_array(void * ctx) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_array_open(g); - return 1; -} - -static int reformat_end_array(void * ctx) -{ - yajl_gen g = (yajl_gen) ctx; - yajl_gen_array_close(g); - return 1; -} - -static yajl_callbacks callbacks = { - reformat_null, - reformat_boolean, - NULL, - NULL, - reformat_number, - reformat_string, - reformat_start_map, - reformat_map_key, - reformat_end_map, - reformat_start_array, - reformat_end_array -}; - -static void -usage(const char * progname) -{ - fprintf(stderr, "usage: %s \n" - " -m minimize json rather than beautify (default)\n" - " -u allow invalid UTF8 inside strings during parsing\n", - progname); - exit(1); - -} - -int -main(int argc, char ** argv) -{ - yajl_handle hand; - static unsigned char fileData[65536]; - /* generator config */ - yajl_gen_config conf = { 1, " " }; - yajl_gen g; - yajl_status stat; - size_t rd; - /* allow comments */ - yajl_parser_config cfg = { 1, 1 }; - int done = 0; - - /* check arguments. We expect exactly one! */ - if (argc == 2) { - if (!strcmp("-m", argv[1])) { - conf.beautify = 0; - - } else if (!strcmp("-u", argv[1])) { - cfg.checkUTF8 = 0; - } else { - usage(argv[0]); - } - } else if (argc != 1) { - usage(argv[0]); - } - - g = yajl_gen_alloc(&conf, NULL); - - /* ok. open file. let's read and parse */ - hand = yajl_alloc(&callbacks, &cfg, NULL, (void *) g); - - while (!done) { - rd = fread((void *) fileData, 1, sizeof(fileData) - 1, stdin); - - if (rd == 0) { - if (!feof(stdin)) { - fprintf(stderr, "error on file read.\n"); - break; - } - done = 1; - } - fileData[rd] = 0; - - if (done) - /* parse any remaining buffered data */ - stat = yajl_parse_complete(hand); - else - /* read file data, pass to parser */ - stat = yajl_parse(hand, fileData, rd); - - if (stat != yajl_status_ok && - stat != yajl_status_insufficient_data) - { - unsigned char * str = yajl_get_error(hand, 1, fileData, rd); - fprintf(stderr, (const char *) str); - yajl_free_error(hand, str); - } else { - const unsigned char * buf; - unsigned int len; - yajl_gen_get_buf(g, &buf, &len); - fwrite(buf, 1, len, stdout); - yajl_gen_clear(g); - } - } - - yajl_gen_free(g); - yajl_free(hand); - - return 0; -} diff --git a/src/Moof/yajl/rfc4627.txt b/src/Moof/yajl/rfc4627.txt deleted file mode 100644 index 67b8909..0000000 --- a/src/Moof/yajl/rfc4627.txt +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - -Network Working Group D. Crockford -Request for Comments: 4627 JSON.org -Category: Informational July 2006 - - - The application/json Media Type for JavaScript Object Notation (JSON) - -Status of This Memo - - This memo provides information for the Internet community. It does - not specify an Internet standard of any kind. Distribution of this - memo is unlimited. - -Copyright Notice - - Copyright (C) The Internet Society (2006). - -Abstract - - JavaScript Object Notation (JSON) is a lightweight, text-based, - language-independent data interchange format. It was derived from - the ECMAScript Programming Language Standard. JSON defines a small - set of formatting rules for the portable representation of structured - data. - -1. Introduction - - JavaScript Object Notation (JSON) is a text format for the - serialization of structured data. It is derived from the object - literals of JavaScript, as defined in the ECMAScript Programming - Language Standard, Third Edition [ECMA]. - - JSON can represent four primitive types (strings, numbers, booleans, - and null) and two structured types (objects and arrays). - - A string is a sequence of zero or more Unicode characters [UNICODE]. - - An object is an unordered collection of zero or more name/value - pairs, where a name is a string and a value is a string, number, - boolean, null, object, or array. - - An array is an ordered sequence of zero or more values. - - The terms "object" and "array" come from the conventions of - JavaScript. - - JSON's design goals were for it to be minimal, portable, textual, and - a subset of JavaScript. - - - -Crockford Informational [Page 1] - -RFC 4627 JSON July 2006 - - -1.1. Conventions Used in This Document - - The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", - "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this - document are to be interpreted as described in [RFC2119]. - - The grammatical rules in this document are to be interpreted as - described in [RFC4234]. - -2. JSON Grammar - - A JSON text is a sequence of tokens. The set of tokens includes six - structural characters, strings, numbers, and three literal names. - - A JSON text is a serialized object or array. - - JSON-text = object / array - - These are the six structural characters: - - begin-array = ws %x5B ws ; [ left square bracket - - begin-object = ws %x7B ws ; { left curly bracket - - end-array = ws %x5D ws ; ] right square bracket - - end-object = ws %x7D ws ; } right curly bracket - - name-separator = ws %x3A ws ; : colon - - value-separator = ws %x2C ws ; , comma - - Insignificant whitespace is allowed before or after any of the six - structural characters. - - ws = *( - %x20 / ; Space - %x09 / ; Horizontal tab - %x0A / ; Line feed or New line - %x0D ; Carriage return - ) - -2.1. Values - - A JSON value MUST be an object, array, number, or string, or one of - the following three literal names: - - false null true - - - -Crockford Informational [Page 2] - -RFC 4627 JSON July 2006 - - - The literal names MUST be lowercase. No other literal names are - allowed. - - value = false / null / true / object / array / number / string - - false = %x66.61.6c.73.65 ; false - - null = %x6e.75.6c.6c ; null - - true = %x74.72.75.65 ; true - -2.2. Objects - - An object structure is represented as a pair of curly brackets - surrounding zero or more name/value pairs (or members). A name is a - string. A single colon comes after each name, separating the name - from the value. A single comma separates a value from a following - name. The names within an object SHOULD be unique. - - object = begin-object [ member *( value-separator member ) ] - end-object - - member = string name-separator value - -2.3. Arrays - - An array structure is represented as square brackets surrounding zero - or more values (or elements). Elements are separated by commas. - - array = begin-array [ value *( value-separator value ) ] end-array - -2.4. Numbers - - The representation of numbers is similar to that used in most - programming languages. A number contains an integer component that - may be prefixed with an optional minus sign, which may be followed by - a fraction part and/or an exponent part. - - Octal and hex forms are not allowed. Leading zeros are not allowed. - - A fraction part is a decimal point followed by one or more digits. - - An exponent part begins with the letter E in upper or lowercase, - which may be followed by a plus or minus sign. The E and optional - sign are followed by one or more digits. - - Numeric values that cannot be represented as sequences of digits - (such as Infinity and NaN) are not permitted. - - - -Crockford Informational [Page 3] - -RFC 4627 JSON July 2006 - - - number = [ minus ] int [ frac ] [ exp ] - - decimal-point = %x2E ; . - - digit1-9 = %x31-39 ; 1-9 - - e = %x65 / %x45 ; e E - - exp = e [ minus / plus ] 1*DIGIT - - frac = decimal-point 1*DIGIT - - int = zero / ( digit1-9 *DIGIT ) - - minus = %x2D ; - - - plus = %x2B ; + - - zero = %x30 ; 0 - -2.5. Strings - - The representation of strings is similar to conventions used in the C - family of programming languages. A string begins and ends with - quotation marks. All Unicode characters may be placed within the - quotation marks except for the characters that must be escaped: - quotation mark, reverse solidus, and the control characters (U+0000 - through U+001F). - - Any character may be escaped. If the character is in the Basic - Multilingual Plane (U+0000 through U+FFFF), then it may be - represented as a six-character sequence: a reverse solidus, followed - by the lowercase letter u, followed by four hexadecimal digits that - encode the character's code point. The hexadecimal letters A though - F can be upper or lowercase. So, for example, a string containing - only a single reverse solidus character may be represented as - "\u005C". - - Alternatively, there are two-character sequence escape - representations of some popular characters. So, for example, a - string containing only a single reverse solidus character may be - represented more compactly as "\\". - - To escape an extended character that is not in the Basic Multilingual - Plane, the character is represented as a twelve-character sequence, - encoding the UTF-16 surrogate pair. So, for example, a string - containing only the G clef character (U+1D11E) may be represented as - "\uD834\uDD1E". - - - -Crockford Informational [Page 4] - -RFC 4627 JSON July 2006 - - - string = quotation-mark *char quotation-mark - - char = unescaped / - escape ( - %x22 / ; " quotation mark U+0022 - %x5C / ; \ reverse solidus U+005C - %x2F / ; / solidus U+002F - %x62 / ; b backspace U+0008 - %x66 / ; f form feed U+000C - %x6E / ; n line feed U+000A - %x72 / ; r carriage return U+000D - %x74 / ; t tab U+0009 - %x75 4HEXDIG ) ; uXXXX U+XXXX - - escape = %x5C ; \ - - quotation-mark = %x22 ; " - - unescaped = %x20-21 / %x23-5B / %x5D-10FFFF - -3. Encoding - - JSON text SHALL be encoded in Unicode. The default encoding is - UTF-8. - - Since the first two characters of a JSON text will always be ASCII - characters [RFC0020], it is possible to determine whether an octet - stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking - at the pattern of nulls in the first four octets. - - 00 00 00 xx UTF-32BE - 00 xx 00 xx UTF-16BE - xx 00 00 00 UTF-32LE - xx 00 xx 00 UTF-16LE - xx xx xx xx UTF-8 - -4. Parsers - - A JSON parser transforms a JSON text into another representation. A - JSON parser MUST accept all texts that conform to the JSON grammar. - A JSON parser MAY accept non-JSON forms or extensions. - - An implementation may set limits on the size of texts that it - accepts. An implementation may set limits on the maximum depth of - nesting. An implementation may set limits on the range of numbers. - An implementation may set limits on the length and character contents - of strings. - - - - -Crockford Informational [Page 5] - -RFC 4627 JSON July 2006 - - -5. Generators - - A JSON generator produces JSON text. The resulting text MUST - strictly conform to the JSON grammar. - -6. IANA Considerations - - The MIME media type for JSON text is application/json. - - Type name: application - - Subtype name: json - - Required parameters: n/a - - Optional parameters: n/a - - Encoding considerations: 8bit if UTF-8; binary if UTF-16 or UTF-32 - - JSON may be represented using UTF-8, UTF-16, or UTF-32. When JSON - is written in UTF-8, JSON is 8bit compatible. When JSON is - written in UTF-16 or UTF-32, the binary content-transfer-encoding - must be used. - - Security considerations: - - Generally there are security issues with scripting languages. JSON - is a subset of JavaScript, but it is a safe subset that excludes - assignment and invocation. - - A JSON text can be safely passed into JavaScript's eval() function - (which compiles and executes a string) if all the characters not - enclosed in strings are in the set of characters that form JSON - tokens. This can be quickly determined in JavaScript with two - regular expressions and calls to the test and replace methods. - - var my_JSON_object = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( - text.replace(/"(\\.|[^"\\])*"/g, ''))) && - eval('(' + text + ')'); - - Interoperability considerations: n/a - - Published specification: RFC 4627 - - - - - - - - -Crockford Informational [Page 6] - -RFC 4627 JSON July 2006 - - - Applications that use this media type: - - JSON has been used to exchange data between applications written - in all of these programming languages: ActionScript, C, C#, - ColdFusion, Common Lisp, E, Erlang, Java, JavaScript, Lua, - Objective CAML, Perl, PHP, Python, Rebol, Ruby, and Scheme. - - Additional information: - - Magic number(s): n/a - File extension(s): .json - Macintosh file type code(s): TEXT - - Person & email address to contact for further information: - Douglas Crockford - douglas@crockford.com - - Intended usage: COMMON - - Restrictions on usage: none - - Author: - Douglas Crockford - douglas@crockford.com - - Change controller: - Douglas Crockford - douglas@crockford.com - -7. Security Considerations - - See Security Considerations in Section 6. - -8. Examples - - This is a JSON object: - - { - "Image": { - "Width": 800, - "Height": 600, - "Title": "View from 15th Floor", - "Thumbnail": { - "Url": "http://www.example.com/image/481989943", - "Height": 125, - "Width": "100" - }, - "IDs": [116, 943, 234, 38793] - - - -Crockford Informational [Page 7] - -RFC 4627 JSON July 2006 - - - } - } - - Its Image member is an object whose Thumbnail member is an object - and whose IDs member is an array of numbers. - - This is a JSON array containing two objects: - - [ - { - "precision": "zip", - "Latitude": 37.7668, - "Longitude": -122.3959, - "Address": "", - "City": "SAN FRANCISCO", - "State": "CA", - "Zip": "94107", - "Country": "US" - }, - { - "precision": "zip", - "Latitude": 37.371991, - "Longitude": -122.026020, - "Address": "", - "City": "SUNNYVALE", - "State": "CA", - "Zip": "94085", - "Country": "US" - } - ] - -9. References - -9.1. Normative References - - [ECMA] European Computer Manufacturers Association, "ECMAScript - Language Specification 3rd Edition", December 1999, - . - - [RFC0020] Cerf, V., "ASCII format for network interchange", RFC 20, - October 1969. - - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate - Requirement Levels", BCP 14, RFC 2119, March 1997. - - [RFC4234] Crocker, D. and P. Overell, "Augmented BNF for Syntax - Specifications: ABNF", RFC 4234, October 2005. - - - -Crockford Informational [Page 8] - -RFC 4627 JSON July 2006 - - - [UNICODE] The Unicode Consortium, "The Unicode Standard Version 4.0", - 2003, . - -Author's Address - - Douglas Crockford - JSON.org - EMail: douglas@crockford.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Crockford Informational [Page 9] - -RFC 4627 JSON July 2006 - - -Full Copyright Statement - - Copyright (C) The Internet Society (2006). - - This document is subject to the rights, licenses and restrictions - contained in BCP 78, and except as set forth therein, the authors - retain all their rights. - - This document and the information contained herein are provided on an - "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS - OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET - ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE - INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED - WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - -Intellectual Property - - The IETF takes no position regarding the validity or scope of any - Intellectual Property Rights or other rights that might be claimed to - pertain to the implementation or use of the technology described in - this document or the extent to which any license under such rights - might or might not be available; nor does it represent that it has - made any independent effort to identify any such rights. Information - on the procedures with respect to rights in RFC documents can be - found in BCP 78 and BCP 79. - - Copies of IPR disclosures made to the IETF Secretariat and any - assurances of licenses to be made available, or the result of an - attempt made to obtain a general license or permission for the use of - such proprietary rights by implementers or users of this - specification can be obtained from the IETF on-line IPR repository at - http://www.ietf.org/ipr. - - The IETF invites any interested party to bring to its attention any - copyrights, patents or patent applications, or other proprietary - rights that may cover technology that may be required to implement - this standard. Please address the information to the IETF at - ietf-ipr@ietf.org. - -Acknowledgement - - Funding for the RFC Editor function is provided by the IETF - Administrative Support Activity (IASA). - - - - - - - -Crockford Informational [Page 10] - diff --git a/src/Moof/yajl/src/CMakeLists.txt b/src/Moof/yajl/src/CMakeLists.txt deleted file mode 100644 index 59027cb..0000000 --- a/src/Moof/yajl/src/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2007-2009, Lloyd Hilaiel. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, 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. Neither the name of Lloyd Hilaiel nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -SET (SRCS yajl.c yajl_lex.c yajl_parser.c yajl_buf.c - yajl_encode.c yajl_gen.c yajl_alloc.c) -SET (HDRS yajl_parser.h yajl_lex.h yajl_buf.h yajl_encode.h yajl_alloc.h) -SET (PUB_HDRS api/yajl_parse.h api/yajl_gen.h api/yajl_common.h) - -# useful when fixing lexer bugs. -#ADD_DEFINITIONS(-DYAJL_LEXER_DEBUG) - -# set up some paths -SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) -SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl) - -# set the output path for libraries -SET(LIBRARY_OUTPUT_PATH ${libDir}) - -ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS}) - -ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS}) - -#### setup shared library version number -SET_TARGET_PROPERTIES(yajl PROPERTIES - SOVERSION ${YAJL_MAJOR} - VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}) - -#### build up an sdk as a post build step - -# create some directories -FILE(MAKE_DIRECTORY ${libDir}) -FILE(MAKE_DIRECTORY ${incDir}) - -# copy public headers to output directory -FOREACH (header ${PUB_HDRS}) - SET (header ${CMAKE_CURRENT_SOURCE_DIR}/${header}) - - EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different ${header} ${incDir}) - - ADD_CUSTOM_COMMAND(TARGET yajl_s POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir}) -ENDFOREACH (header ${PUB_HDRS}) - -INCLUDE_DIRECTORIES(${incDir}/..) - -IF(NOT WIN32) - INSTALL(TARGETS yajl LIBRARY DESTINATION lib) - INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib) - INSTALL(DIRECTORY api/ DESTINATION include/yajl - FILES_MATCHING PATTERN "*.h") -ENDIF() diff --git a/src/Moof/yajl/src/YAJL.dxy b/src/Moof/yajl/src/YAJL.dxy deleted file mode 100644 index 680eb43..0000000 --- a/src/Moof/yajl/src/YAJL.dxy +++ /dev/null @@ -1,1258 +0,0 @@ -# Doxyfile 1.5.2 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file that -# follow. The default is UTF-8 which is also the encoding used for all text before -# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into -# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of -# possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = YAJL - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = @YAJL_VERSION@ - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = yajl-@YAJL_VERSION@/share - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = NO - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning - -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../src/yajl ../src/api - -# This tag can be used to specify the character encoding of the source files that -# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default -# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. -# See http://www.gnu.org/software/libiconv for the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - -FILE_PATTERNS = *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the output. -# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, -# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = doc/yajl-@YAJL_VERSION@ - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = YES - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to -# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to -# specify the directory where the mscgen tool resides. If left empty the tool is assumed to -# be found in the default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen will always -# show the root nodes and its direct children regardless of this setting. - -DOT_GRAPH_MAX_NODES = 50 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/src/Moof/yajl/src/api/yajl_common.h b/src/Moof/yajl/src/api/yajl_common.h deleted file mode 100644 index 9ad5eb4..0000000 --- a/src/Moof/yajl/src/api/yajl_common.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_COMMON_H__ -#define __YAJL_COMMON_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define YAJL_MAX_DEPTH 128 - -/* msft dll export gunk. To build a DLL on windows, you - * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared - * DLL, you must define YAJL_SHARED and WIN32 */ -#if defined(WIN32) && defined(YAJL_SHARED) -# ifdef YAJL_BUILD -# define YAJL_API __declspec(dllexport) -# else -# define YAJL_API __declspec(dllimport) -# endif -#else -# define YAJL_API -#endif - -/** pointer to a malloc function, supporting client overriding memory - * allocation routines */ -typedef void * (*yajl_malloc_func)(void *ctx, unsigned int sz); - -/** pointer to a free function, supporting client overriding memory - * allocation routines */ -typedef void (*yajl_free_func)(void *ctx, void * ptr); - -/** pointer to a realloc function which can resize an allocation. */ -typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, unsigned int sz); - -/** A structure which can be passed to yajl_*_alloc routines to allow the - * client to specify memory allocation functions to be used. */ -typedef struct -{ - /** pointer to a function that can allocate uninitialized memory */ - yajl_malloc_func malloc; - /** pointer to a function that can resize memory allocations */ - yajl_realloc_func realloc; - /** pointer to a function that can free memory allocated using - * reallocFunction or mallocFunction */ - yajl_free_func free; - /** a context pointer that will be passed to above allocation routines */ - void * ctx; -} yajl_alloc_funcs; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Moof/yajl/src/api/yajl_gen.h b/src/Moof/yajl/src/api/yajl_gen.h deleted file mode 100644 index 55a8362..0000000 --- a/src/Moof/yajl/src/api/yajl_gen.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_gen.h - * Interface to YAJL's JSON generation facilities. - */ - -#include - -#ifndef __YAJL_GEN_H__ -#define __YAJL_GEN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - /** generator status codes */ - typedef enum { - /** no error */ - yajl_gen_status_ok = 0, - /** at a point where a map key is generated, a function other than - * yajl_gen_string was called */ - yajl_gen_keys_must_be_strings, - /** YAJL's maximum generation depth was exceeded. see - * YAJL_MAX_DEPTH */ - yajl_max_depth_exceeded, - /** A generator function (yajl_gen_XXX) was called while in an error - * state */ - yajl_gen_in_error_state, - /** A complete JSON document has been generated */ - yajl_gen_generation_complete - } yajl_gen_status; - - /** an opaque handle to a generator */ - typedef struct yajl_gen_t * yajl_gen; - - /** configuration structure for the generator */ - typedef struct { - /** generate indented (beautiful) output */ - unsigned int beautify; - /** an opportunity to define an indent string. such as \\t or - * some number of spaces. default is four spaces ' '. This - * member is only relevant when beautify is true */ - const char * indentString; - } yajl_gen_config; - - /** allocate a generator handle - * \param config a pointer to a structure containing parameters which - * configure the behavior of the json generator - * \param allocFuncs an optional pointer to a structure which allows - * the client to overide the memory allocation - * used by yajl. May be NULL, in which case - * malloc/free/realloc will be used. - * - * \returns an allocated handle on success, NULL on failure (bad params) - */ - yajl_gen YAJL_API yajl_gen_alloc(const yajl_gen_config * config, - const yajl_alloc_funcs * allocFuncs); - - /** free a generator handle */ - void YAJL_API yajl_gen_free(yajl_gen handle); - - yajl_gen_status YAJL_API yajl_gen_integer(yajl_gen hand, long int number); - yajl_gen_status YAJL_API yajl_gen_double(yajl_gen hand, double number); - yajl_gen_status YAJL_API yajl_gen_number(yajl_gen hand, - const char * num, - unsigned int len); - yajl_gen_status YAJL_API yajl_gen_string(yajl_gen hand, - const unsigned char * str, - unsigned int len); - yajl_gen_status YAJL_API yajl_gen_null(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_bool(yajl_gen hand, int boolean); - yajl_gen_status YAJL_API yajl_gen_map_open(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_map_close(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_array_open(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_array_close(yajl_gen hand); - - /** access the null terminated generator buffer. If incrementally - * outputing JSON, one should call yajl_gen_clear to clear the - * buffer. This allows stream generation. */ - yajl_gen_status YAJL_API yajl_gen_get_buf(yajl_gen hand, - const unsigned char ** buf, - unsigned int * len); - - /** clear yajl's output buffer, but maintain all internal generation - * state. This function will not "reset" the generator state, and is - * intended to enable incremental JSON outputing. */ - void YAJL_API yajl_gen_clear(yajl_gen hand); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Moof/yajl/src/api/yajl_parse.h b/src/Moof/yajl/src/api/yajl_parse.h deleted file mode 100644 index 40998bc..0000000 --- a/src/Moof/yajl/src/api/yajl_parse.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_parse.h - * Interface to YAJL's JSON parsing facilities. - */ - -#include - -#ifndef __YAJL_PARSE_H__ -#define __YAJL_PARSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - /** error codes returned from this interface */ - typedef enum { - /** no error was encountered */ - yajl_status_ok, - /** a client callback returned zero, stopping the parse */ - yajl_status_client_canceled, - /** The parse cannot yet complete because more json input text - * is required, call yajl_parse with the next buffer of input text. - * (pertinent only when stream parsing) */ - yajl_status_insufficient_data, - /** An error occured during the parse. Call yajl_get_error for - * more information about the encountered error */ - yajl_status_error - } yajl_status; - - /** attain a human readable, english, string for an error */ - const char * YAJL_API yajl_status_to_string(yajl_status code); - - /** an opaque handle to a parser */ - typedef struct yajl_handle_t * yajl_handle; - - /** yajl is an event driven parser. this means as json elements are - * parsed, you are called back to do something with the data. The - * functions in this table indicate the various events for which - * you will be called back. Each callback accepts a "context" - * pointer, this is a void * that is passed into the yajl_parse - * function which the client code may use to pass around context. - * - * All callbacks return an integer. If non-zero, the parse will - * continue. If zero, the parse will be canceled and - * yajl_status_client_canceled will be returned from the parse. - * - * Note about handling of numbers: - * yajl will only convert numbers that can be represented in a double - * or a long int. All other numbers will be passed to the client - * in string form using the yajl_number callback. Furthermore, if - * yajl_number is not NULL, it will always be used to return numbers, - * that is yajl_integer and yajl_double will be ignored. If - * yajl_number is NULL but one of yajl_integer or yajl_double are - * defined, parsing of a number larger than is representable - * in a double or long int will result in a parse error. - */ - typedef struct { - int (* yajl_null)(void * ctx); - int (* yajl_boolean)(void * ctx, int boolVal); - int (* yajl_integer)(void * ctx, long integerVal); - int (* yajl_double)(void * ctx, double doubleVal); - /** A callback which passes the string representation of the number - * back to the client. Will be used for all numbers when present */ - int (* yajl_number)(void * ctx, const char * numberVal, - unsigned int numberLen); - - /** strings are returned as pointers into the JSON text when, - * possible, as a result, they are _not_ null padded */ - int (* yajl_string)(void * ctx, const unsigned char * stringVal, - unsigned int stringLen); - - int (* yajl_start_map)(void * ctx); - int (* yajl_map_key)(void * ctx, const unsigned char * key, - unsigned int stringLen); - int (* yajl_end_map)(void * ctx); - - int (* yajl_start_array)(void * ctx); - int (* yajl_end_array)(void * ctx); - } yajl_callbacks; - - /** configuration structure for the generator */ - typedef struct { - /** if nonzero, javascript style comments will be allowed in - * the json input, both slash star and slash slash */ - unsigned int allowComments; - /** if nonzero, invalid UTF8 strings will cause a parse - * error */ - unsigned int checkUTF8; - } yajl_parser_config; - - /** allocate a parser handle - * \param callbacks a yajl callbacks structure specifying the - * functions to call when different JSON entities - * are encountered in the input text. May be NULL, - * which is only useful for validation. - * \param config configuration parameters for the parse. - * \param ctx a context pointer that will be passed to callbacks. - */ - yajl_handle YAJL_API yajl_alloc(const yajl_callbacks * callbacks, - const yajl_parser_config * config, - const yajl_alloc_funcs * allocFuncs, - void * ctx); - - /** free a parser handle */ - void YAJL_API yajl_free(yajl_handle handle); - - /** Parse some json! - * \param hand - a handle to the json parser allocated with yajl_alloc - * \param jsonText - a pointer to the UTF8 json text to be parsed - * \param jsonTextLength - the length, in bytes, of input text - */ - yajl_status YAJL_API yajl_parse(yajl_handle hand, - const unsigned char * jsonText, - unsigned int jsonTextLength); - - /** Parse any remaining buffered json. - * Since yajl is a stream-based parser, without an explicit end of - * input, yajl sometimes can't decide if content at the end of the - * stream is valid or not. For example, if "1" has been fed in, - * yajl can't know whether another digit is next or some character - * that would terminate the integer token. - * - * \param hand - a handle to the json parser allocated with yajl_alloc - */ - yajl_status yajl_parse_complete(yajl_handle hand); - - /** get an error string describing the state of the - * parse. - * - * If verbose is non-zero, the message will include the JSON - * text where the error occured, along with an arrow pointing to - * the specific char. - * - * A dynamically allocated string will be returned which should - * be freed with yajl_free_error - */ - unsigned char * YAJL_API yajl_get_error(yajl_handle hand, int verbose, - const unsigned char * jsonText, - unsigned int jsonTextLength); - - /** free an error returned from yajl_get_error */ - void YAJL_API yajl_free_error(yajl_handle hand, unsigned char * str); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Moof/yajl/src/yajl.c b/src/Moof/yajl/src/yajl.c deleted file mode 100644 index fe7d05e..0000000 --- a/src/Moof/yajl/src/yajl.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "api/yajl_parse.h" -#include "yajl_lex.h" -#include "yajl_parser.h" -#include "yajl_alloc.h" - -#include -#include -#include - -const char * -yajl_status_to_string(yajl_status stat) -{ - const char * statStr = "unknown"; - switch (stat) { - case yajl_status_ok: - statStr = "ok, no error"; - break; - case yajl_status_client_canceled: - statStr = "client canceled parse"; - break; - case yajl_status_insufficient_data: - statStr = "eof was met before the parse could complete"; - break; - case yajl_status_error: - statStr = "parse error"; - break; - } - return statStr; -} - -yajl_handle -yajl_alloc(const yajl_callbacks * callbacks, - const yajl_parser_config * config, - const yajl_alloc_funcs * afs, - void * ctx) -{ - unsigned int allowComments = 0; - unsigned int validateUTF8 = 0; - yajl_handle hand = NULL; - yajl_alloc_funcs afsBuffer; - - /* first order of business is to set up memory allocation routines */ - if (afs != NULL) { - if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL) - { - return NULL; - } - } else { - yajl_set_default_alloc_funcs(&afsBuffer); - afs = &afsBuffer; - } - - hand = (yajl_handle) YA_MALLOC(afs, sizeof(struct yajl_handle_t)); - - /* copy in pointers to allocation routines */ - memcpy((void *) &(hand->alloc), (void *) afs, sizeof(yajl_alloc_funcs)); - - if (config != NULL) { - allowComments = config->allowComments; - validateUTF8 = config->checkUTF8; - } - - hand->callbacks = callbacks; - hand->ctx = ctx; - hand->lexer = yajl_lex_alloc(&(hand->alloc), allowComments, validateUTF8); - hand->errorOffset = 0; - hand->decodeBuf = yajl_buf_alloc(&(hand->alloc)); - yajl_bs_init(hand->stateStack, &(hand->alloc)); - - yajl_bs_push(hand->stateStack, yajl_state_start); - - return hand; -} - -void -yajl_free(yajl_handle handle) -{ - yajl_bs_free(handle->stateStack); - yajl_buf_free(handle->decodeBuf); - yajl_lex_free(handle->lexer); - YA_FREE(&(handle->alloc), handle); -} - -yajl_status -yajl_parse(yajl_handle hand, const unsigned char * jsonText, - unsigned int jsonTextLen) -{ - unsigned int offset = 0; - yajl_status status; - status = yajl_do_parse(hand, &offset, jsonText, jsonTextLen); - return status; -} - -yajl_status -yajl_parse_complete(yajl_handle hand) -{ - /* The particular case we want to handle is a trailing number. - * Further input consisting of digits could cause our interpretation - * of the number to change (buffered "1" but "2" comes in). - * A very simple approach to this is to inject whitespace to terminate - * any number in the lex buffer. - */ - return yajl_parse(hand, (const unsigned char *)" ", 1); -} - -unsigned char * -yajl_get_error(yajl_handle hand, int verbose, - const unsigned char * jsonText, unsigned int jsonTextLen) -{ - return yajl_render_error_string(hand, jsonText, jsonTextLen, verbose); -} - -void -yajl_free_error(yajl_handle hand, unsigned char * str) -{ - /* use memory allocation functions if set */ - YA_FREE(&(hand->alloc), str); -} - -/* XXX: add utility routines to parse from file */ diff --git a/src/Moof/yajl/src/yajl_alloc.c b/src/Moof/yajl/src/yajl_alloc.c deleted file mode 100644 index 0b4bf37..0000000 --- a/src/Moof/yajl/src/yajl_alloc.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_alloc.h - * default memory allocation routines for yajl which use malloc/realloc and - * free - */ - -#include "yajl_alloc.h" -#include - -static void * yajl_internal_malloc(void *ctx, unsigned int sz) -{ - return malloc(sz); -} - -static void * yajl_internal_realloc(void *ctx, void * previous, - unsigned int sz) -{ - return realloc(previous, sz); -} - -static void yajl_internal_free(void *ctx, void * ptr) -{ - free(ptr); -} - -void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf) -{ - yaf->malloc = yajl_internal_malloc; - yaf->free = yajl_internal_free; - yaf->realloc = yajl_internal_realloc; - yaf->ctx = NULL; -} - diff --git a/src/Moof/yajl/src/yajl_alloc.h b/src/Moof/yajl/src/yajl_alloc.h deleted file mode 100644 index bf19308..0000000 --- a/src/Moof/yajl/src/yajl_alloc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_alloc.h - * default memory allocation routines for yajl which use malloc/realloc and - * free - */ - -#ifndef __YAJL_ALLOC_H__ -#define __YAJL_ALLOC_H__ - -#include "api/yajl_common.h" - -#define YA_MALLOC(afs, sz) (afs)->malloc((afs)->ctx, (sz)) -#define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr)) -#define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz)) - -void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf); - -#endif diff --git a/src/Moof/yajl/src/yajl_buf.c b/src/Moof/yajl/src/yajl_buf.c deleted file mode 100644 index 97f1ced..0000000 --- a/src/Moof/yajl/src/yajl_buf.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "yajl_buf.h" - -#include -#include -#include - -#define YAJL_BUF_INIT_SIZE 2048 - -struct yajl_buf_t { - unsigned int len; - unsigned int used; - unsigned char * data; - yajl_alloc_funcs * alloc; -}; - -static -void yajl_buf_ensure_available(yajl_buf buf, unsigned int want) -{ - unsigned int need; - - assert(buf != NULL); - - /* first call */ - if (buf->data == NULL) { - buf->len = YAJL_BUF_INIT_SIZE; - buf->data = (unsigned char *) YA_MALLOC(buf->alloc, buf->len); - buf->data[0] = 0; - } - - need = buf->len; - - while (want >= (need - buf->used)) need <<= 1; - - if (need != buf->len) { - buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need); - buf->len = need; - } -} - -yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc) -{ - yajl_buf b = YA_MALLOC(alloc, sizeof(struct yajl_buf_t)); - memset((void *) b, 0, sizeof(struct yajl_buf_t)); - b->alloc = alloc; - return b; -} - -void yajl_buf_free(yajl_buf buf) -{ - assert(buf != NULL); - if (buf->data) YA_FREE(buf->alloc, buf->data); - YA_FREE(buf->alloc, buf); -} - -void yajl_buf_append(yajl_buf buf, const void * data, unsigned int len) -{ - yajl_buf_ensure_available(buf, len); - if (len > 0) { - assert(data != NULL); - memcpy(buf->data + buf->used, data, len); - buf->used += len; - buf->data[buf->used] = 0; - } -} - -void yajl_buf_clear(yajl_buf buf) -{ - buf->used = 0; - if (buf->data) buf->data[buf->used] = 0; -} - -const unsigned char * yajl_buf_data(yajl_buf buf) -{ - return buf->data; -} - -unsigned int yajl_buf_len(yajl_buf buf) -{ - return buf->used; -} - -void -yajl_buf_truncate(yajl_buf buf, unsigned int len) -{ - assert(len <= buf->used); - buf->used = len; -} diff --git a/src/Moof/yajl/src/yajl_buf.h b/src/Moof/yajl/src/yajl_buf.h deleted file mode 100644 index ebdf411..0000000 --- a/src/Moof/yajl/src/yajl_buf.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_BUF_H__ -#define __YAJL_BUF_H__ - -#include "api/yajl_common.h" -#include "yajl_alloc.h" - -/* - * Implementation/performance notes. If this were moved to a header - * only implementation using #define's where possible we might be - * able to sqeeze a little performance out of the guy by killing function - * call overhead. YMMV. - */ - -/** - * yajl_buf is a buffer with exponential growth. the buffer ensures that - * you are always null padded. - */ -typedef struct yajl_buf_t * yajl_buf; - -/* allocate a new buffer */ -yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc); - -/* free the buffer */ -void yajl_buf_free(yajl_buf buf); - -/* append a number of bytes to the buffer */ -void yajl_buf_append(yajl_buf buf, const void * data, unsigned int len); - -/* empty the buffer */ -void yajl_buf_clear(yajl_buf buf); - -/* get a pointer to the beginning of the buffer */ -const unsigned char * yajl_buf_data(yajl_buf buf); - -/* get the length of the buffer */ -unsigned int yajl_buf_len(yajl_buf buf); - -/* truncate the buffer */ -void yajl_buf_truncate(yajl_buf buf, unsigned int len); - -#endif diff --git a/src/Moof/yajl/src/yajl_bytestack.h b/src/Moof/yajl/src/yajl_bytestack.h deleted file mode 100644 index f5694f9..0000000 --- a/src/Moof/yajl/src/yajl_bytestack.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * A header only implementation of a simple stack of bytes, used in YAJL - * to maintain parse state. - */ - -#ifndef __YAJL_BYTESTACK_H__ -#define __YAJL_BYTESTACK_H__ - -#include "api/yajl_common.h" - -#define YAJL_BS_INC 128 - -typedef struct yajl_bytestack_t -{ - unsigned char * stack; - unsigned int size; - unsigned int used; - yajl_alloc_funcs * yaf; -} yajl_bytestack; - -/* initialize a bytestack */ -#define yajl_bs_init(obs, _yaf) { \ - (obs).stack = NULL; \ - (obs).size = 0; \ - (obs).used = 0; \ - (obs).yaf = (_yaf); \ - } \ - - -/* initialize a bytestack */ -#define yajl_bs_free(obs) \ - if ((obs).stack) (obs).yaf->free((obs).yaf->ctx, (obs).stack); - -#define yajl_bs_current(obs) \ - (assert((obs).used > 0), (obs).stack[(obs).used - 1]) - -#define yajl_bs_push(obs, byte) { \ - if (((obs).size - (obs).used) == 0) { \ - (obs).size += YAJL_BS_INC; \ - (obs).stack = (obs).yaf->realloc((obs).yaf->ctx,\ - (void *) (obs).stack, (obs).size);\ - } \ - (obs).stack[((obs).used)++] = (byte); \ -} - -/* removes the top item of the stack, returns nothing */ -#define yajl_bs_pop(obs) { ((obs).used)--; } - -#define yajl_bs_set(obs, byte) \ - (obs).stack[((obs).used) - 1] = (byte); - - -#endif diff --git a/src/Moof/yajl/src/yajl_encode.c b/src/Moof/yajl/src/yajl_encode.c deleted file mode 100644 index 184277b..0000000 --- a/src/Moof/yajl/src/yajl_encode.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "yajl_encode.h" - -#include -#include -#include -#include - -static void CharToHex(unsigned char c, char * hexBuf) -{ - const char * hexchar = "0123456789ABCDEF"; - hexBuf[0] = hexchar[c >> 4]; - hexBuf[1] = hexchar[c & 0x0F]; -} - -void -yajl_string_encode(yajl_buf buf, const unsigned char * str, - unsigned int len) -{ - unsigned int beg = 0; - unsigned int end = 0; - char hexBuf[7]; - hexBuf[0] = '\\'; hexBuf[1] = 'u'; hexBuf[2] = '0'; hexBuf[3] = '0'; - hexBuf[6] = 0; - - while (end < len) { - const char * escaped = NULL; - switch (str[end]) { - case '\r': escaped = "\\r"; break; - case '\n': escaped = "\\n"; break; - case '\\': escaped = "\\\\"; break; - /* case '/': escaped = "\\/"; break; */ - case '"': escaped = "\\\""; break; - case '\f': escaped = "\\f"; break; - case '\b': escaped = "\\b"; break; - case '\t': escaped = "\\t"; break; - default: - if ((unsigned char) str[end] < 32) { - CharToHex(str[end], hexBuf + 4); - escaped = hexBuf; - } - break; - } - if (escaped != NULL) { - yajl_buf_append(buf, str + beg, end - beg); - yajl_buf_append(buf, escaped, strlen(escaped)); - beg = ++end; - } else { - ++end; - } - } - yajl_buf_append(buf, str + beg, end - beg); -} - -static void hexToDigit(unsigned int * val, const unsigned char * hex) -{ - unsigned int i; - for (i=0;i<4;i++) { - unsigned char c = hex[i]; - if (c >= 'A') c = (c & ~0x20) - 7; - c -= '0'; - assert(!(c & 0xF0)); - *val = (*val << 4) | c; - } -} - -static void Utf32toUtf8(unsigned int codepoint, char * utf8Buf) -{ - if (codepoint < 0x80) { - utf8Buf[0] = (char) codepoint; - utf8Buf[1] = 0; - } else if (codepoint < 0x0800) { - utf8Buf[0] = (char) ((codepoint >> 6) | 0xC0); - utf8Buf[1] = (char) ((codepoint & 0x3F) | 0x80); - utf8Buf[2] = 0; - } else if (codepoint < 0x10000) { - utf8Buf[0] = (char) ((codepoint >> 12) | 0xE0); - utf8Buf[1] = (char) (((codepoint >> 6) & 0x3F) | 0x80); - utf8Buf[2] = (char) ((codepoint & 0x3F) | 0x80); - utf8Buf[3] = 0; - } else if (codepoint < 0x200000) { - utf8Buf[0] =(char)((codepoint >> 18) | 0xF0); - utf8Buf[1] =(char)(((codepoint >> 12) & 0x3F) | 0x80); - utf8Buf[2] =(char)(((codepoint >> 6) & 0x3F) | 0x80); - utf8Buf[3] =(char)((codepoint & 0x3F) | 0x80); - utf8Buf[4] = 0; - } else { - utf8Buf[0] = '?'; - utf8Buf[1] = 0; - } -} - -void yajl_string_decode(yajl_buf buf, const unsigned char * str, - unsigned int len) -{ - unsigned int beg = 0; - unsigned int end = 0; - - while (end < len) { - if (str[end] == '\\') { - char utf8Buf[5]; - const char * unescaped = "?"; - yajl_buf_append(buf, str + beg, end - beg); - switch (str[++end]) { - case 'r': unescaped = "\r"; break; - case 'n': unescaped = "\n"; break; - case '\\': unescaped = "\\"; break; - case '/': unescaped = "/"; break; - case '"': unescaped = "\""; break; - case 'f': unescaped = "\f"; break; - case 'b': unescaped = "\b"; break; - case 't': unescaped = "\t"; break; - case 'u': { - unsigned int codepoint = 0; - hexToDigit(&codepoint, str + ++end); - end+=3; - /* check if this is a surrogate */ - if ((codepoint & 0xFC00) == 0xD800) { - end++; - if (str[end] == '\\' && str[end + 1] == 'u') { - unsigned int surrogate = 0; - hexToDigit(&surrogate, str + end + 2); - codepoint = - (((codepoint & 0x3F) << 10) | - ((((codepoint >> 6) & 0xF) + 1) << 16) | - (surrogate & 0x3FF)); - end += 5; - } else { - unescaped = "?"; - break; - } - } - - Utf32toUtf8(codepoint, utf8Buf); - unescaped = utf8Buf; - break; - } - default: - assert("this should never happen" == NULL); - } - yajl_buf_append(buf, unescaped, strlen(unescaped)); - beg = ++end; - } else { - end++; - } - } - yajl_buf_append(buf, str + beg, end - beg); -} diff --git a/src/Moof/yajl/src/yajl_encode.h b/src/Moof/yajl/src/yajl_encode.h deleted file mode 100644 index 8bd01af..0000000 --- a/src/Moof/yajl/src/yajl_encode.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_ENCODE_H__ -#define __YAJL_ENCODE_H__ - -#include "yajl_buf.h" - -void yajl_string_encode(yajl_buf buf, const unsigned char * str, - unsigned int length); - -void yajl_string_decode(yajl_buf buf, const unsigned char * str, - unsigned int length); - -#endif diff --git a/src/Moof/yajl/src/yajl_gen.c b/src/Moof/yajl/src/yajl_gen.c deleted file mode 100644 index 34cfbec..0000000 --- a/src/Moof/yajl/src/yajl_gen.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "api/yajl_gen.h" -#include "yajl_buf.h" -#include "yajl_encode.h" - -#include -#include -#include - -typedef enum { - yajl_gen_start, - yajl_gen_map_start, - yajl_gen_map_key, - yajl_gen_map_val, - yajl_gen_array_start, - yajl_gen_in_array, - yajl_gen_complete, - yajl_gen_error -} yajl_gen_state; - -struct yajl_gen_t -{ - unsigned int depth; - unsigned int pretty; - const char * indentString; - yajl_gen_state state[YAJL_MAX_DEPTH]; - yajl_buf buf; - /* memory allocation routines */ - yajl_alloc_funcs alloc; -}; - -yajl_gen -yajl_gen_alloc(const yajl_gen_config * config, - const yajl_alloc_funcs * afs) -{ - yajl_gen g = NULL; - yajl_alloc_funcs afsBuffer; - - /* first order of business is to set up memory allocation routines */ - if (afs != NULL) { - if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL) - { - return NULL; - } - } else { - yajl_set_default_alloc_funcs(&afsBuffer); - afs = &afsBuffer; - } - - g = (yajl_gen) YA_MALLOC(afs, sizeof(struct yajl_gen_t)); - memset((void *) g, 0, sizeof(struct yajl_gen_t)); - /* copy in pointers to allocation routines */ - memcpy((void *) &(g->alloc), (void *) afs, sizeof(yajl_alloc_funcs)); - - if (config) { - g->pretty = config->beautify; - g->indentString = config->indentString ? config->indentString : " "; - } - g->buf = yajl_buf_alloc(&(g->alloc)); - - return g; -} - -void -yajl_gen_free(yajl_gen g) -{ - yajl_buf_free(g->buf); - YA_FREE(&(g->alloc), g); -} - -#define INSERT_SEP \ - if (g->state[g->depth] == yajl_gen_map_key || \ - g->state[g->depth] == yajl_gen_in_array) { \ - yajl_buf_append(g->buf, ",", 1); \ - if (g->pretty) yajl_buf_append(g->buf, "\n", 1); \ - } else if (g->state[g->depth] == yajl_gen_map_val) { \ - yajl_buf_append(g->buf, ":", 1); \ - if (g->pretty) yajl_buf_append(g->buf, " ", 1); \ - } - -#define INSERT_WHITESPACE \ - if (g->pretty) { \ - if (g->state[g->depth] != yajl_gen_map_val) { \ - unsigned int _i; \ - for (_i=0;_idepth;_i++) \ - yajl_buf_append(g->buf, g->indentString, \ - strlen(g->indentString)); \ - } \ - } - -#define ENSURE_NOT_KEY \ - if (g->state[g->depth] == yajl_gen_map_key) { \ - return yajl_gen_keys_must_be_strings; \ - } \ - -/* check that we're not complete, or in error state. in a valid state - * to be generating */ -#define ENSURE_VALID_STATE \ - if (g->state[g->depth] == yajl_gen_error) { \ - return yajl_gen_in_error_state;\ - } else if (g->state[g->depth] == yajl_gen_complete) { \ - return yajl_gen_generation_complete; \ - } - -#define INCREMENT_DEPTH \ - if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; - -#define APPENDED_ATOM \ - switch (g->state[g->depth]) { \ - case yajl_gen_start: \ - g->state[g->depth] = yajl_gen_complete; \ - break; \ - case yajl_gen_map_start: \ - case yajl_gen_map_key: \ - g->state[g->depth] = yajl_gen_map_val; \ - break; \ - case yajl_gen_array_start: \ - g->state[g->depth] = yajl_gen_in_array; \ - break; \ - case yajl_gen_map_val: \ - g->state[g->depth] = yajl_gen_map_key; \ - break; \ - default: \ - break; \ - } \ - -#define FINAL_NEWLINE \ - if (g->pretty && g->state[g->depth] == yajl_gen_complete) \ - yajl_buf_append(g->buf, "\n", 1); - -yajl_gen_status -yajl_gen_integer(yajl_gen g, long int number) -{ - char i[32]; - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - sprintf(i, "%ld", number); - yajl_buf_append(g->buf, i, strlen(i)); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_double(yajl_gen g, double number) -{ - char i[32]; - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - sprintf(i, "%g", number); - yajl_buf_append(g->buf, i, strlen(i)); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_number(yajl_gen g, const char * s, unsigned int l) -{ - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - yajl_buf_append(g->buf, s, l); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_string(yajl_gen g, const unsigned char * str, - unsigned int len) -{ - ENSURE_VALID_STATE; INSERT_SEP; INSERT_WHITESPACE; - yajl_buf_append(g->buf, "\"", 1); - yajl_string_encode(g->buf, str, len); - yajl_buf_append(g->buf, "\"", 1); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_null(yajl_gen g) -{ - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - yajl_buf_append(g->buf, "null", strlen("null")); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_bool(yajl_gen g, int boolean) -{ - const char * val = boolean ? "true" : "false"; - - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - yajl_buf_append(g->buf, val, strlen(val)); - APPENDED_ATOM; - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_map_open(yajl_gen g) -{ - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; - - g->state[g->depth] = yajl_gen_map_start; - yajl_buf_append(g->buf, "{", 1); - if (g->pretty) yajl_buf_append(g->buf, "\n", 1); - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_map_close(yajl_gen g) -{ - ENSURE_VALID_STATE; - (g->depth)--; - if (g->pretty) yajl_buf_append(g->buf, "\n", 1); - APPENDED_ATOM; - INSERT_WHITESPACE; - yajl_buf_append(g->buf, "}", 1); - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_array_open(yajl_gen g) -{ - ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; - g->state[g->depth] = yajl_gen_array_start; - yajl_buf_append(g->buf, "[", 1); - if (g->pretty) yajl_buf_append(g->buf, "\n", 1); - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_array_close(yajl_gen g) -{ - ENSURE_VALID_STATE; - if (g->pretty) yajl_buf_append(g->buf, "\n", 1); - (g->depth)--; - APPENDED_ATOM; - INSERT_WHITESPACE; - yajl_buf_append(g->buf, "]", 1); - FINAL_NEWLINE; - return yajl_gen_status_ok; -} - -yajl_gen_status -yajl_gen_get_buf(yajl_gen g, const unsigned char ** buf, - unsigned int * len) -{ - *buf = yajl_buf_data(g->buf); - *len = yajl_buf_len(g->buf); - return yajl_gen_status_ok; -} - -void -yajl_gen_clear(yajl_gen g) -{ - yajl_buf_clear(g->buf); -} diff --git a/src/Moof/yajl/src/yajl_lex.c b/src/Moof/yajl/src/yajl_lex.c deleted file mode 100644 index f689ff6..0000000 --- a/src/Moof/yajl/src/yajl_lex.c +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "yajl_lex.h" -#include "yajl_buf.h" - -#include -#include -#include -#include - -#ifdef YAJL_LEXER_DEBUG -static const char * -tokToStr(yajl_tok tok) -{ - switch (tok) { - case yajl_tok_bool: return "bool"; - case yajl_tok_colon: return "colon"; - case yajl_tok_comma: return "comma"; - case yajl_tok_eof: return "eof"; - case yajl_tok_error: return "error"; - case yajl_tok_left_brace: return "brace"; - case yajl_tok_left_bracket: return "bracket"; - case yajl_tok_null: return "null"; - case yajl_tok_integer: return "integer"; - case yajl_tok_double: return "double"; - case yajl_tok_right_brace: return "brace"; - case yajl_tok_right_bracket: return "bracket"; - case yajl_tok_string: return "string"; - case yajl_tok_string_with_escapes: return "string_with_escapes"; - } - return "unknown"; -} -#endif - -/* Impact of the stream parsing feature on the lexer: - * - * YAJL support stream parsing. That is, the ability to parse the first - * bits of a chunk of JSON before the last bits are available (still on - * the network or disk). This makes the lexer more complex. The - * responsibility of the lexer is to handle transparently the case where - * a chunk boundary falls in the middle of a token. This is - * accomplished is via a buffer and a character reading abstraction. - * - * Overview of implementation - * - * When we lex to end of input string before end of token is hit, we - * copy all of the input text composing the token into our lexBuf. - * - * Every time we read a character, we do so through the readChar function. - * readChar's responsibility is to handle pulling all chars from the buffer - * before pulling chars from input text - */ - -struct yajl_lexer_t { - /* the overal line and char offset into the data */ - unsigned int lineOff; - unsigned int charOff; - - /* error */ - yajl_lex_error error; - - /* a input buffer to handle the case where a token is spread over - * multiple chunks */ - yajl_buf buf; - - /* in the case where we have data in the lexBuf, bufOff holds - * the current offset into the lexBuf. */ - unsigned int bufOff; - - /* are we using the lex buf? */ - unsigned int bufInUse; - - /* shall we allow comments? */ - unsigned int allowComments; - - /* shall we validate utf8 inside strings? */ - unsigned int validateUTF8; - - yajl_alloc_funcs * alloc; -}; - -#define readChar(lxr, txt, off) \ - (((lxr)->bufInUse && yajl_buf_len((lxr)->buf) && lxr->bufOff < yajl_buf_len((lxr)->buf)) ? \ - (*((const unsigned char *) yajl_buf_data((lxr)->buf) + ((lxr)->bufOff)++)) : \ - ((txt)[(*(off))++])) - -#define unreadChar(lxr, off) ((*(off) > 0) ? (*(off))-- : ((lxr)->bufOff--)) - -yajl_lexer -yajl_lex_alloc(yajl_alloc_funcs * alloc, - unsigned int allowComments, unsigned int validateUTF8) -{ - yajl_lexer lxr = (yajl_lexer) YA_MALLOC(alloc, sizeof(struct yajl_lexer_t)); - memset((void *) lxr, 0, sizeof(struct yajl_lexer_t)); - lxr->buf = yajl_buf_alloc(alloc); - lxr->allowComments = allowComments; - lxr->validateUTF8 = validateUTF8; - lxr->alloc = alloc; - return lxr; -} - -void -yajl_lex_free(yajl_lexer lxr) -{ - yajl_buf_free(lxr->buf); - YA_FREE(lxr->alloc, lxr); - return; -} - -/* a lookup table which lets us quickly determine three things: - * VEC - valid escaped conrol char - * IJC - invalid json char - * VHC - valid hex char - * note. the solidus '/' may be escaped or not. - * note. the - */ -#define VEC 1 -#define IJC 2 -#define VHC 4 -static const char charLookupTable[256] = -{ -/*00*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , -/*08*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , -/*10*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , -/*18*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , - -/*20*/ 0 , 0 , VEC|IJC, 0 , 0 , 0 , 0 , 0 , -/*28*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , VEC , -/*30*/ VHC , VHC , VHC , VHC , VHC , VHC , VHC , VHC , -/*38*/ VHC , VHC , 0 , 0 , 0 , 0 , 0 , 0 , - -/*40*/ 0 , VHC , VHC , VHC , VHC , VHC , VHC , 0 , -/*48*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -/*50*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -/*58*/ 0 , 0 , 0 , 0 , VEC|IJC, 0 , 0 , 0 , - -/*60*/ 0 , VHC , VEC|VHC, VHC , VHC , VHC , VEC|VHC, 0 , -/*68*/ 0 , 0 , 0 , 0 , 0 , 0 , VEC , 0 , -/*70*/ 0 , 0 , VEC , 0 , VEC , 0 , 0 , 0 , -/*78*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - -/* include these so we don't have to always check the range of the char */ - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 -}; - -/** process a variable length utf8 encoded codepoint. - * - * returns: - * yajl_tok_string - if valid utf8 char was parsed and offset was - * advanced - * yajl_tok_eof - if end of input was hit before validation could - * complete - * yajl_tok_error - if invalid utf8 was encountered - * - * NOTE: on error the offset will point to the first char of the - * invalid utf8 */ -#define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } - -static yajl_tok -yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset, - unsigned char curChar) -{ - if (curChar <= 0x7f) { - /* single byte */ - return yajl_tok_string; - } else if ((curChar >> 5) == 0x6) { - /* two byte */ - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) return yajl_tok_string; - } else if ((curChar >> 4) == 0x0e) { - /* three byte */ - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) { - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) return yajl_tok_string; - } - } else if ((curChar >> 3) == 0x1e) { - /* four byte */ - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) { - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) { - UTF8_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if ((curChar >> 6) == 0x2) return yajl_tok_string; - } - } - } - - return yajl_tok_error; -} - -/* lex a string. input is the lexer, pointer to beginning of - * json text, and start of string (offset). - * a token is returned which has the following meanings: - * yajl_tok_string: lex of string was successful. offset points to - * terminating '"'. - * yajl_tok_eof: end of text was encountered before we could complete - * the lex. - * yajl_tok_error: embedded in the string were unallowable chars. offset - * points to the offending char - */ -#define STR_CHECK_EOF \ -if (*offset >= jsonTextLen) { \ - tok = yajl_tok_eof; \ - goto finish_string_lex; \ -} - -static yajl_tok -yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset) -{ - yajl_tok tok = yajl_tok_error; - int hasEscapes = 0; - - for (;;) { - unsigned char curChar; - - STR_CHECK_EOF; - - curChar = readChar(lexer, jsonText, offset); - - /* quote terminates */ - if (curChar == '"') { - tok = yajl_tok_string; - break; - } - /* backslash escapes a set of control chars, */ - else if (curChar == '\\') { - hasEscapes = 1; - STR_CHECK_EOF; - - /* special case \u */ - curChar = readChar(lexer, jsonText, offset); - if (curChar == 'u') { - unsigned int i = 0; - - for (i=0;i<4;i++) { - STR_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); - if (!(charLookupTable[curChar] & VHC)) { - /* back up to offending char */ - unreadChar(lexer, offset); - lexer->error = yajl_lex_string_invalid_hex_char; - goto finish_string_lex; - } - } - } else if (!(charLookupTable[curChar] & VEC)) { - /* back up to offending char */ - unreadChar(lexer, offset); - lexer->error = yajl_lex_string_invalid_escaped_char; - goto finish_string_lex; - } - } - /* when not validating UTF8 it's a simple table lookup to determine - * if the present character is invalid */ - else if(charLookupTable[curChar] & IJC) { - /* back up to offending char */ - unreadChar(lexer, offset); - lexer->error = yajl_lex_string_invalid_json_char; - goto finish_string_lex; - } - /* when in validate UTF8 mode we need to do some extra work */ - else if (lexer->validateUTF8) { - yajl_tok t = yajl_lex_utf8_char(lexer, jsonText, jsonTextLen, - offset, curChar); - - if (t == yajl_tok_eof) { - tok = yajl_tok_eof; - goto finish_string_lex; - } else if (t == yajl_tok_error) { - lexer->error = yajl_lex_string_invalid_utf8; - goto finish_string_lex; - } - } - /* accept it, and move on */ - } - finish_string_lex: - /* tell our buddy, the parser, wether he needs to process this string - * again */ - if (hasEscapes && tok == yajl_tok_string) { - tok = yajl_tok_string_with_escapes; - } - - return tok; -} - -#define RETURN_IF_EOF if (*offset >= jsonTextLen) return yajl_tok_eof; - -static yajl_tok -yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset) -{ - /** XXX: numbers are the only entities in json that we must lex - * _beyond_ in order to know that they are complete. There - * is an ambiguous case for integers at EOF. */ - - unsigned char c; - - yajl_tok tok = yajl_tok_integer; - - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - - /* optional leading minus */ - if (c == '-') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } - - /* a single zero, or a series of integers */ - if (c == '0') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } else if (c >= '1' && c <= '9') { - do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } while (c >= '0' && c <= '9'); - } else { - unreadChar(lexer, offset); - lexer->error = yajl_lex_missing_integer_after_minus; - return yajl_tok_error; - } - - /* optional fraction (indicates this is floating point) */ - if (c == '.') { - int numRd = 0; - - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - - while (c >= '0' && c <= '9') { - numRd++; - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } - - if (!numRd) { - unreadChar(lexer, offset); - lexer->error = yajl_lex_missing_integer_after_decimal; - return yajl_tok_error; - } - tok = yajl_tok_double; - } - - /* optional exponent (indicates this is floating point) */ - if (c == 'e' || c == 'E') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - - /* optional sign */ - if (c == '+' || c == '-') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } - - if (c >= '0' && c <= '9') { - do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } while (c >= '0' && c <= '9'); - } else { - unreadChar(lexer, offset); - lexer->error = yajl_lex_missing_integer_after_exponent; - return yajl_tok_error; - } - tok = yajl_tok_double; - } - - /* we always go "one too far" */ - unreadChar(lexer, offset); - - return tok; -} - -static yajl_tok -yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset) -{ - unsigned char c; - - yajl_tok tok = yajl_tok_comment; - - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - - /* either slash or star expected */ - if (c == '/') { - /* now we throw away until end of line */ - do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } while (c != '\n'); - } else if (c == '*') { - /* now we throw away until end of comment */ - for (;;) { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - if (c == '*') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - if (c == '/') { - break; - } else { - unreadChar(lexer, offset); - } - } - } - } else { - lexer->error = yajl_lex_invalid_char; - tok = yajl_tok_error; - } - - return tok; -} - -yajl_tok -yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset, - const unsigned char ** outBuf, unsigned int * outLen) -{ - yajl_tok tok = yajl_tok_error; - unsigned char c; - unsigned int startOffset = *offset; - - *outBuf = NULL; - *outLen = 0; - - for (;;) { - assert(*offset <= jsonTextLen); - - if (*offset >= jsonTextLen) { - tok = yajl_tok_eof; - goto lexed; - } - - c = readChar(lexer, jsonText, offset); - - switch (c) { - case '{': - tok = yajl_tok_left_bracket; - goto lexed; - case '}': - tok = yajl_tok_right_bracket; - goto lexed; - case '[': - tok = yajl_tok_left_brace; - goto lexed; - case ']': - tok = yajl_tok_right_brace; - goto lexed; - case ',': - tok = yajl_tok_comma; - goto lexed; - case ':': - tok = yajl_tok_colon; - goto lexed; - case '\t': case '\n': case '\v': case '\f': case '\r': case ' ': - startOffset++; - break; - case 't': { - const char * want = "rue"; - do { - if (*offset >= jsonTextLen) { - tok = yajl_tok_eof; - goto lexed; - } - c = readChar(lexer, jsonText, offset); - if (c != *want) { - unreadChar(lexer, offset); - lexer->error = yajl_lex_invalid_string; - tok = yajl_tok_error; - goto lexed; - } - } while (*(++want)); - tok = yajl_tok_bool; - goto lexed; - } - case 'f': { - const char * want = "alse"; - do { - if (*offset >= jsonTextLen) { - tok = yajl_tok_eof; - goto lexed; - } - c = readChar(lexer, jsonText, offset); - if (c != *want) { - unreadChar(lexer, offset); - lexer->error = yajl_lex_invalid_string; - tok = yajl_tok_error; - goto lexed; - } - } while (*(++want)); - tok = yajl_tok_bool; - goto lexed; - } - case 'n': { - const char * want = "ull"; - do { - if (*offset >= jsonTextLen) { - tok = yajl_tok_eof; - goto lexed; - } - c = readChar(lexer, jsonText, offset); - if (c != *want) { - unreadChar(lexer, offset); - lexer->error = yajl_lex_invalid_string; - tok = yajl_tok_error; - goto lexed; - } - } while (*(++want)); - tok = yajl_tok_null; - goto lexed; - } - case '"': { - tok = yajl_lex_string(lexer, (const unsigned char *) jsonText, - jsonTextLen, offset); - goto lexed; - } - case '-': - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': { - /* integer parsing wants to start from the beginning */ - unreadChar(lexer, offset); - tok = yajl_lex_number(lexer, (const unsigned char *) jsonText, - jsonTextLen, offset); - goto lexed; - } - case '/': - /* hey, look, a probable comment! If comments are disabled - * it's an error. */ - if (!lexer->allowComments) { - unreadChar(lexer, offset); - lexer->error = yajl_lex_unallowed_comment; - tok = yajl_tok_error; - goto lexed; - } - /* if comments are enabled, then we should try to lex - * the thing. possible outcomes are - * - successful lex (tok_comment, which means continue), - * - malformed comment opening (slash not followed by - * '*' or '/') (tok_error) - * - eof hit. (tok_eof) */ - tok = yajl_lex_comment(lexer, (const unsigned char *) jsonText, - jsonTextLen, offset); - if (tok == yajl_tok_comment) { - /* "error" is silly, but that's the initial - * state of tok. guilty until proven innocent. */ - tok = yajl_tok_error; - yajl_buf_clear(lexer->buf); - lexer->bufInUse = 0; - startOffset = *offset; - break; - } - /* hit error or eof, bail */ - goto lexed; - default: - lexer->error = yajl_lex_invalid_char; - tok = yajl_tok_error; - goto lexed; - } - } - - - lexed: - /* need to append to buffer if the buffer is in use or - * if it's an EOF token */ - if (tok == yajl_tok_eof || lexer->bufInUse) { - if (!lexer->bufInUse) yajl_buf_clear(lexer->buf); - lexer->bufInUse = 1; - yajl_buf_append(lexer->buf, jsonText + startOffset, *offset - startOffset); - lexer->bufOff = 0; - - if (tok != yajl_tok_eof) { - *outBuf = yajl_buf_data(lexer->buf); - *outLen = yajl_buf_len(lexer->buf); - lexer->bufInUse = 0; - } - } else if (tok != yajl_tok_error) { - *outBuf = jsonText + startOffset; - *outLen = *offset - startOffset; - } - - /* special case for strings. skip the quotes. */ - if (tok == yajl_tok_string || tok == yajl_tok_string_with_escapes) - { - assert(*outLen >= 2); - (*outBuf)++; - *outLen -= 2; - } - - -#ifdef YAJL_LEXER_DEBUG - if (tok == yajl_tok_error) { - printf("lexical error: %s\n", - yajl_lex_error_to_string(yajl_lex_get_error(lexer))); - } else if (tok == yajl_tok_eof) { - printf("EOF hit\n"); - } else { - printf("lexed %s: '", tokToStr(tok)); - fwrite(*outBuf, 1, *outLen, stdout); - printf("'\n"); - } -#endif - - return tok; -} - -const char * -yajl_lex_error_to_string(yajl_lex_error error) -{ - switch (error) { - case yajl_lex_e_ok: - return "ok, no error"; - case yajl_lex_string_invalid_utf8: - return "invalid bytes in UTF8 string."; - case yajl_lex_string_invalid_escaped_char: - return "inside a string, '\\' occurs before a character " - "which it may not."; - case yajl_lex_string_invalid_json_char: - return "invalid character inside string."; - case yajl_lex_string_invalid_hex_char: - return "invalid (non-hex) character occurs after '\\u' inside " - "string."; - case yajl_lex_invalid_char: - return "invalid char in json text."; - case yajl_lex_invalid_string: - return "invalid string in json text."; - case yajl_lex_missing_integer_after_exponent: - return "malformed number, a digit is required after the exponent."; - case yajl_lex_missing_integer_after_decimal: - return "malformed number, a digit is required after the " - "decimal point."; - case yajl_lex_missing_integer_after_minus: - return "malformed number, a digit is required after the " - "minus sign."; - case yajl_lex_unallowed_comment: - return "probable comment found in input text, comments are " - "not enabled."; - } - return "unknown error code"; -} - - -/** allows access to more specific information about the lexical - * error when yajl_lex_lex returns yajl_tok_error. */ -yajl_lex_error -yajl_lex_get_error(yajl_lexer lexer) -{ - if (lexer == NULL) return (yajl_lex_error) -1; - return lexer->error; -} - -unsigned int yajl_lex_current_line(yajl_lexer lexer) -{ - return lexer->lineOff; -} - -unsigned int yajl_lex_current_char(yajl_lexer lexer) -{ - return lexer->charOff; -} - -yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int offset) -{ - const unsigned char * outBuf; - unsigned int outLen; - unsigned int bufLen = yajl_buf_len(lexer->buf); - unsigned int bufOff = lexer->bufOff; - unsigned int bufInUse = lexer->bufInUse; - yajl_tok tok; - - tok = yajl_lex_lex(lexer, jsonText, jsonTextLen, &offset, - &outBuf, &outLen); - - lexer->bufOff = bufOff; - lexer->bufInUse = bufInUse; - yajl_buf_truncate(lexer->buf, bufLen); - - return tok; -} diff --git a/src/Moof/yajl/src/yajl_lex.h b/src/Moof/yajl/src/yajl_lex.h deleted file mode 100644 index 966365c..0000000 --- a/src/Moof/yajl/src/yajl_lex.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_LEX_H__ -#define __YAJL_LEX_H__ - -#include "api/yajl_common.h" - -typedef enum { - yajl_tok_bool, - yajl_tok_colon, - yajl_tok_comma, - yajl_tok_eof, - yajl_tok_error, - yajl_tok_left_brace, - yajl_tok_left_bracket, - yajl_tok_null, - yajl_tok_right_brace, - yajl_tok_right_bracket, - - /* we differentiate between integers and doubles to allow the - * parser to interpret the number without re-scanning */ - yajl_tok_integer, - yajl_tok_double, - - /* we differentiate between strings which require further processing, - * and strings that do not */ - yajl_tok_string, - yajl_tok_string_with_escapes, - - /* comment tokens are not currently returned to the parser, ever */ - yajl_tok_comment -} yajl_tok; - -typedef struct yajl_lexer_t * yajl_lexer; - -yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc, - unsigned int allowComments, - unsigned int validateUTF8); - -void yajl_lex_free(yajl_lexer lexer); - -/** - * run/continue a lex. "offset" is an input/output parameter. - * It should be initialized to zero for a - * new chunk of target text, and upon subsetquent calls with the same - * target text should passed with the value of the previous invocation. - * - * the client may be interested in the value of offset when an error is - * returned from the lexer. This allows the client to render useful -n * error messages. - * - * When you pass the next chunk of data, context should be reinitialized - * to zero. - * - * Finally, the output buffer is usually just a pointer into the jsonText, - * however in cases where the entity being lexed spans multiple chunks, - * the lexer will buffer the entity and the data returned will be - * a pointer into that buffer. - * - * This behavior is abstracted from client code except for the performance - * implications which require that the client choose a reasonable chunk - * size to get adequate performance. - */ -yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int * offset, - const unsigned char ** outBuf, unsigned int * outLen); - -/** have a peek at the next token, but don't move the lexer forward */ -yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, - unsigned int jsonTextLen, unsigned int offset); - - -typedef enum { - yajl_lex_e_ok = 0, - yajl_lex_string_invalid_utf8, - yajl_lex_string_invalid_escaped_char, - yajl_lex_string_invalid_json_char, - yajl_lex_string_invalid_hex_char, - yajl_lex_invalid_char, - yajl_lex_invalid_string, - yajl_lex_missing_integer_after_decimal, - yajl_lex_missing_integer_after_exponent, - yajl_lex_missing_integer_after_minus, - yajl_lex_unallowed_comment -} yajl_lex_error; - -const char * yajl_lex_error_to_string(yajl_lex_error error); - -/** allows access to more specific information about the lexical - * error when yajl_lex_lex returns yajl_tok_error. */ -yajl_lex_error yajl_lex_get_error(yajl_lexer lexer); - -/** get the current offset into the most recently lexed json string. */ -unsigned int yajl_lex_current_offset(yajl_lexer lexer); - -/** get the number of lines lexed by this lexer instance */ -unsigned int yajl_lex_current_line(yajl_lexer lexer); - -/** get the number of chars lexed by this lexer instance since the last - * \n or \r */ -unsigned int yajl_lex_current_char(yajl_lexer lexer); - -#endif diff --git a/src/Moof/yajl/src/yajl_parser.c b/src/Moof/yajl/src/yajl_parser.c deleted file mode 100644 index 7a52df4..0000000 --- a/src/Moof/yajl/src/yajl_parser.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "yajl_lex.h" -#include "yajl_parser.h" -#include "yajl_encode.h" -#include "yajl_bytestack.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -unsigned char * -yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, - unsigned int jsonTextLen, int verbose) -{ - unsigned int offset = hand->errorOffset; - unsigned char * str; - const char * errorType = NULL; - const char * errorText = NULL; - char text[72]; - const char * arrow = " (right here) ------^\n"; - - if (yajl_bs_current(hand->stateStack) == yajl_state_parse_error) { - errorType = "parse"; - errorText = hand->parseError; - } else if (yajl_bs_current(hand->stateStack) == yajl_state_lexical_error) { - errorType = "lexical"; - errorText = yajl_lex_error_to_string(yajl_lex_get_error(hand->lexer)); - } else { - errorType = "unknown"; - } - - { - unsigned int memneeded = 0; - memneeded += strlen(errorType); - memneeded += strlen(" error"); - if (errorText != NULL) { - memneeded += strlen(": "); - memneeded += strlen(errorText); - } - str = (unsigned char *) YA_MALLOC(&(hand->alloc), memneeded + 2); - str[0] = 0; - strcat((char *) str, errorType); - strcat((char *) str, " error"); - if (errorText != NULL) { - strcat((char *) str, ": "); - strcat((char *) str, errorText); - } - strcat((char *) str, "\n"); - } - - /* now we append as many spaces as needed to make sure the error - * falls at char 41, if verbose was specified */ - if (verbose) { - unsigned int start, end, i; - unsigned int spacesNeeded; - - spacesNeeded = (offset < 30 ? 40 - offset : 10); - start = (offset >= 30 ? offset - 30 : 0); - end = (offset + 30 > jsonTextLen ? jsonTextLen : offset + 30); - - for (i=0;ialloc), (strlen((char *) str) + - strlen((char *) text) + - strlen(arrow) + 1)); - newStr[0] = 0; - strcat((char *) newStr, (char *) str); - strcat((char *) newStr, text); - strcat((char *) newStr, arrow); - YA_FREE(&(hand->alloc), str); - str = (unsigned char *) newStr; - } - } - return str; -} - -/* check for client cancelation */ -#define _CC_CHK(x) \ - if (!(x)) { \ - yajl_bs_set(hand->stateStack, yajl_state_parse_error); \ - hand->parseError = \ - "client cancelled parse via callback return value"; \ - return yajl_status_client_canceled; \ - } - - -yajl_status -yajl_do_parse(yajl_handle hand, unsigned int * offset, - const unsigned char * jsonText, unsigned int jsonTextLen) -{ - yajl_tok tok; - const unsigned char * buf; - unsigned int bufLen; - - around_again: - switch (yajl_bs_current(hand->stateStack)) { - case yajl_state_parse_complete: - return yajl_status_ok; - case yajl_state_lexical_error: - case yajl_state_parse_error: - hand->errorOffset = *offset; - return yajl_status_error; - case yajl_state_start: - case yajl_state_map_need_val: - case yajl_state_array_need_val: - case yajl_state_array_start: { - /* for arrays and maps, we advance the state for this - * depth, then push the state of the next depth. - * If an error occurs during the parsing of the nesting - * enitity, the state at this level will not matter. - * a state that needs pushing will be anything other - * than state_start */ - yajl_state stateToPush = yajl_state_start; - - tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, - offset, &buf, &bufLen); - - switch (tok) { - case yajl_tok_eof: - return yajl_status_insufficient_data; - case yajl_tok_error: - yajl_bs_set(hand->stateStack, yajl_state_lexical_error); - goto around_again; - case yajl_tok_string: - if (hand->callbacks && hand->callbacks->yajl_string) { - _CC_CHK(hand->callbacks->yajl_string(hand->ctx, - buf, bufLen)); - } - break; - case yajl_tok_string_with_escapes: - if (hand->callbacks && hand->callbacks->yajl_string) { - yajl_buf_clear(hand->decodeBuf); - yajl_string_decode(hand->decodeBuf, buf, bufLen); - _CC_CHK(hand->callbacks->yajl_string( - hand->ctx, yajl_buf_data(hand->decodeBuf), - yajl_buf_len(hand->decodeBuf))); - } - break; - case yajl_tok_bool: - if (hand->callbacks && hand->callbacks->yajl_boolean) { - _CC_CHK(hand->callbacks->yajl_boolean(hand->ctx, - *buf == 't')); - } - break; - case yajl_tok_null: - if (hand->callbacks && hand->callbacks->yajl_null) { - _CC_CHK(hand->callbacks->yajl_null(hand->ctx)); - } - break; - case yajl_tok_left_bracket: - if (hand->callbacks && hand->callbacks->yajl_start_map) { - _CC_CHK(hand->callbacks->yajl_start_map(hand->ctx)); - } - stateToPush = yajl_state_map_start; - break; - case yajl_tok_left_brace: - if (hand->callbacks && hand->callbacks->yajl_start_array) { - _CC_CHK(hand->callbacks->yajl_start_array(hand->ctx)); - } - stateToPush = yajl_state_array_start; - break; - case yajl_tok_integer: - /* - * note. strtol does not respect the length of - * the lexical token. in a corner case where the - * lexed number is a integer with a trailing zero, - * immediately followed by the end of buffer, - * sscanf could run off into oblivion and cause a - * crash. for this reason we copy the integer - * (and doubles), into our parse buffer (the same - * one used for unescaping strings), before - * calling strtol. yajl_buf ensures null padding, - * so we're safe. - */ - if (hand->callbacks) { - if (hand->callbacks->yajl_number) { - _CC_CHK(hand->callbacks->yajl_number( - hand->ctx,(const char *) buf, bufLen)); - } else if (hand->callbacks->yajl_integer) { - long int i = 0; - yajl_buf_clear(hand->decodeBuf); - yajl_buf_append(hand->decodeBuf, buf, bufLen); - buf = yajl_buf_data(hand->decodeBuf); - i = strtol((const char *) buf, NULL, 10); - if ((i == LONG_MIN || i == LONG_MAX) && - errno == ERANGE) - { - yajl_bs_set(hand->stateStack, - yajl_state_parse_error); - hand->parseError = "integer overflow" ; - /* try to restore error offset */ - if (*offset >= bufLen) *offset -= bufLen; - else *offset = 0; - goto around_again; - } - _CC_CHK(hand->callbacks->yajl_integer(hand->ctx, - i)); - } - } - break; - case yajl_tok_double: - if (hand->callbacks) { - if (hand->callbacks->yajl_number) { - _CC_CHK(hand->callbacks->yajl_number( - hand->ctx, (const char *) buf, bufLen)); - } else if (hand->callbacks->yajl_double) { - double d = 0.0; - yajl_buf_clear(hand->decodeBuf); - yajl_buf_append(hand->decodeBuf, buf, bufLen); - buf = yajl_buf_data(hand->decodeBuf); - d = strtod((char *) buf, NULL); - if ((d == HUGE_VAL || d == -HUGE_VAL) && - errno == ERANGE) - { - yajl_bs_set(hand->stateStack, - yajl_state_parse_error); - hand->parseError = "numeric (floating point) " - "overflow"; - /* try to restore error offset */ - if (*offset >= bufLen) *offset -= bufLen; - else *offset = 0; - goto around_again; - } - _CC_CHK(hand->callbacks->yajl_double(hand->ctx, - d)); - } - } - break; - case yajl_tok_right_brace: { - if (yajl_bs_current(hand->stateStack) == - yajl_state_array_start) - { - if (hand->callbacks && - hand->callbacks->yajl_end_array) - { - _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx)); - } - yajl_bs_pop(hand->stateStack); - goto around_again; - } - /* intentional fall-through */ - } - case yajl_tok_colon: - case yajl_tok_comma: - case yajl_tok_right_bracket: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = - "unallowed token at this point in JSON text"; - goto around_again; - default: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = "invalid token, internal error"; - goto around_again; - } - /* got a value. transition depends on the state we're in. */ - { - yajl_state s = yajl_bs_current(hand->stateStack); - if (s == yajl_state_start) { - yajl_bs_set(hand->stateStack, yajl_state_parse_complete); - } else if (s == yajl_state_map_need_val) { - yajl_bs_set(hand->stateStack, yajl_state_map_got_val); - } else { - yajl_bs_set(hand->stateStack, yajl_state_array_got_val); - } - } - if (stateToPush != yajl_state_start) { - yajl_bs_push(hand->stateStack, stateToPush); - } - - goto around_again; - } - case yajl_state_map_start: - case yajl_state_map_need_key: { - /* only difference between these two states is that in - * start '}' is valid, whereas in need_key, we've parsed - * a comma, and a string key _must_ follow */ - tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, - offset, &buf, &bufLen); - switch (tok) { - case yajl_tok_eof: - return yajl_status_insufficient_data; - case yajl_tok_error: - yajl_bs_set(hand->stateStack, yajl_state_lexical_error); - goto around_again; - case yajl_tok_string_with_escapes: - if (hand->callbacks && hand->callbacks->yajl_map_key) { - yajl_buf_clear(hand->decodeBuf); - yajl_string_decode(hand->decodeBuf, buf, bufLen); - buf = yajl_buf_data(hand->decodeBuf); - bufLen = yajl_buf_len(hand->decodeBuf); - } - /* intentional fall-through */ - case yajl_tok_string: - if (hand->callbacks && hand->callbacks->yajl_map_key) { - _CC_CHK(hand->callbacks->yajl_map_key(hand->ctx, buf, - bufLen)); - } - yajl_bs_set(hand->stateStack, yajl_state_map_sep); - goto around_again; - case yajl_tok_right_bracket: - if (yajl_bs_current(hand->stateStack) == - yajl_state_map_start) - { - if (hand->callbacks && hand->callbacks->yajl_end_map) { - _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx)); - } - yajl_bs_pop(hand->stateStack); - goto around_again; - } - default: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = - "invalid object key (must be a string)"; - goto around_again; - } - } - case yajl_state_map_sep: { - tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, - offset, &buf, &bufLen); - switch (tok) { - case yajl_tok_colon: - yajl_bs_set(hand->stateStack, yajl_state_map_need_val); - goto around_again; - case yajl_tok_eof: - return yajl_status_insufficient_data; - case yajl_tok_error: - yajl_bs_set(hand->stateStack, yajl_state_lexical_error); - goto around_again; - default: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = "object key and value must " - "be separated by a colon (':')"; - goto around_again; - } - } - case yajl_state_map_got_val: { - tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, - offset, &buf, &bufLen); - switch (tok) { - case yajl_tok_right_bracket: - if (hand->callbacks && hand->callbacks->yajl_end_map) { - _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx)); - } - yajl_bs_pop(hand->stateStack); - goto around_again; - case yajl_tok_comma: - yajl_bs_set(hand->stateStack, yajl_state_map_need_key); - goto around_again; - case yajl_tok_eof: - return yajl_status_insufficient_data; - case yajl_tok_error: - yajl_bs_set(hand->stateStack, yajl_state_lexical_error); - goto around_again; - default: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = "after key and value, inside map, " - "I expect ',' or '}'"; - /* try to restore error offset */ - if (*offset >= bufLen) *offset -= bufLen; - else *offset = 0; - goto around_again; - } - } - case yajl_state_array_got_val: { - tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, - offset, &buf, &bufLen); - switch (tok) { - case yajl_tok_right_brace: - if (hand->callbacks && hand->callbacks->yajl_end_array) { - _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx)); - } - yajl_bs_pop(hand->stateStack); - goto around_again; - case yajl_tok_comma: - yajl_bs_set(hand->stateStack, yajl_state_array_need_val); - goto around_again; - case yajl_tok_eof: - return yajl_status_insufficient_data; - case yajl_tok_error: - yajl_bs_set(hand->stateStack, yajl_state_lexical_error); - goto around_again; - default: - yajl_bs_set(hand->stateStack, yajl_state_parse_error); - hand->parseError = - "after array element, I expect ',' or ']'"; - goto around_again; - } - } - } - - abort(); - return yajl_status_error; -} - diff --git a/src/Moof/yajl/src/yajl_parser.h b/src/Moof/yajl/src/yajl_parser.h deleted file mode 100644 index 92b4a40..0000000 --- a/src/Moof/yajl/src/yajl_parser.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_PARSER_H__ -#define __YAJL_PARSER_H__ - -#include "api/yajl_parse.h" -#include "yajl_bytestack.h" -#include "yajl_buf.h" - - -typedef enum { - yajl_state_start = 0, - yajl_state_parse_complete, - yajl_state_parse_error, - yajl_state_lexical_error, - yajl_state_map_start, - yajl_state_map_sep, - yajl_state_map_need_val, - yajl_state_map_got_val, - yajl_state_map_need_key, - yajl_state_array_start, - yajl_state_array_got_val, - yajl_state_array_need_val -} yajl_state; - -struct yajl_handle_t { - const yajl_callbacks * callbacks; - void * ctx; - yajl_lexer lexer; - const char * parseError; - unsigned int errorOffset; - /* temporary storage for decoded strings */ - yajl_buf decodeBuf; - /* a stack of states. access with yajl_state_XXX routines */ - yajl_bytestack stateStack; - /* memory allocation routines */ - yajl_alloc_funcs alloc; -}; - -yajl_status -yajl_do_parse(yajl_handle handle, unsigned int * offset, - const unsigned char * jsonText, unsigned int jsonTextLen); - -unsigned char * -yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, - unsigned int jsonTextLen, int verbose); - - -#endif diff --git a/src/Moof/yajl/test/CMakeLists.txt b/src/Moof/yajl/test/CMakeLists.txt deleted file mode 100644 index 85d673d..0000000 --- a/src/Moof/yajl/test/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2007-2009, Lloyd Hilaiel. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, 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. Neither the name of Lloyd Hilaiel nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -SET (SRCS yajl_test.c) - -# use the library we build, duh. -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include) -LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) - -ADD_EXECUTABLE(yajl_test ${SRCS}) - -TARGET_LINK_LIBRARIES(yajl_test yajl_s) diff --git a/src/Moof/yajl/test/cases/array.json b/src/Moof/yajl/test/cases/array.json deleted file mode 100644 index f76058d..0000000 --- a/src/Moof/yajl/test/cases/array.json +++ /dev/null @@ -1,6 +0,0 @@ -["foo", - "bar", "baz", - true,false,null,{"key":"value"}, - [null,null,null,[]], - "\n\r\\" -] diff --git a/src/Moof/yajl/test/cases/array.json.gold b/src/Moof/yajl/test/cases/array.json.gold deleted file mode 100644 index 477559d..0000000 --- a/src/Moof/yajl/test/cases/array.json.gold +++ /dev/null @@ -1,22 +0,0 @@ -array open '[' -string: 'foo' -string: 'bar' -string: 'baz' -bool: true -bool: false -null -map open '{' -key: 'key' -string: 'value' -map close '}' -array open '[' -null -null -null -array open '[' -array close ']' -array close ']' -string: ' - \' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/array_close.json b/src/Moof/yajl/test/cases/array_close.json deleted file mode 100644 index 079b579..0000000 --- a/src/Moof/yajl/test/cases/array_close.json +++ /dev/null @@ -1 +0,0 @@ -] diff --git a/src/Moof/yajl/test/cases/array_close.json.gold b/src/Moof/yajl/test/cases/array_close.json.gold deleted file mode 100644 index 972fd39..0000000 --- a/src/Moof/yajl/test/cases/array_close.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: unallowed token at this point in JSON text -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/array_open.json b/src/Moof/yajl/test/cases/array_open.json deleted file mode 100644 index 558ed37..0000000 --- a/src/Moof/yajl/test/cases/array_open.json +++ /dev/null @@ -1 +0,0 @@ -[ diff --git a/src/Moof/yajl/test/cases/array_open.json.gold b/src/Moof/yajl/test/cases/array_open.json.gold deleted file mode 100644 index 478b6b9..0000000 --- a/src/Moof/yajl/test/cases/array_open.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -array open '[' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/bogus_char.json b/src/Moof/yajl/test/cases/bogus_char.json deleted file mode 100644 index 8163bd8..0000000 --- a/src/Moof/yajl/test/cases/bogus_char.json +++ /dev/null @@ -1,4 +0,0 @@ -["this","is","what","should","be", - "a happy bit of json", - "but someone, misspelled \"true\"", ture, - "who says JSON is easy for humans to generate?"] diff --git a/src/Moof/yajl/test/cases/bogus_char.json.gold b/src/Moof/yajl/test/cases/bogus_char.json.gold deleted file mode 100644 index 0c68a49..0000000 --- a/src/Moof/yajl/test/cases/bogus_char.json.gold +++ /dev/null @@ -1,10 +0,0 @@ -array open '[' -string: 'this' -string: 'is' -string: 'what' -string: 'should' -string: 'be' -string: 'a happy bit of json' -string: 'but someone, misspelled "true"' -lexical error: invalid string in json text. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json b/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json deleted file mode 100644 index f91f3be..0000000 --- a/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json +++ /dev/null @@ -1 +0,0 @@ -"\u004d\u0430\u4e8c\ud800\udf02" diff --git a/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json.gold b/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json.gold deleted file mode 100644 index f359a1b..0000000 --- a/src/Moof/yajl/test/cases/codepoints_from_unicode_org.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: 'Mа二𐌂' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/dc_simple_with_comments.json b/src/Moof/yajl/test/cases/dc_simple_with_comments.json deleted file mode 100644 index 3b79bba..0000000 --- a/src/Moof/yajl/test/cases/dc_simple_with_comments.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "this": "is", // ignore this - "really": "simple", - /* ignore -this -too * / -** // -(/ -******/ - "json": "right?" -} diff --git a/src/Moof/yajl/test/cases/dc_simple_with_comments.json.gold b/src/Moof/yajl/test/cases/dc_simple_with_comments.json.gold deleted file mode 100644 index d222e9b..0000000 --- a/src/Moof/yajl/test/cases/dc_simple_with_comments.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -lexical error: probable comment found in input text, comments are not enabled. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/deep_arrays.json b/src/Moof/yajl/test/cases/deep_arrays.json deleted file mode 100644 index 82d1b0d..0000000 --- a/src/Moof/yajl/test/cases/deep_arrays.json +++ /dev/null @@ -1 +0,0 @@ -[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/deep_arrays.json.gold b/src/Moof/yajl/test/cases/deep_arrays.json.gold deleted file mode 100644 index 4d5cd99..0000000 --- a/src/Moof/yajl/test/cases/deep_arrays.json.gold +++ /dev/null @@ -1,2049 +0,0 @@ -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/difficult_json_c_test_case.json b/src/Moof/yajl/test/cases/difficult_json_c_test_case.json deleted file mode 100644 index 6998f55..0000000 --- a/src/Moof/yajl/test/cases/difficult_json_c_test_case.json +++ /dev/null @@ -1 +0,0 @@ -{ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": [ { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML", "markup"] } ] } } } diff --git a/src/Moof/yajl/test/cases/difficult_json_c_test_case.json.gold b/src/Moof/yajl/test/cases/difficult_json_c_test_case.json.gold deleted file mode 100644 index c3adc11..0000000 --- a/src/Moof/yajl/test/cases/difficult_json_c_test_case.json.gold +++ /dev/null @@ -1,36 +0,0 @@ -map open '{' -key: 'glossary' -map open '{' -key: 'title' -string: 'example glossary' -key: 'GlossDiv' -map open '{' -key: 'title' -string: 'S' -key: 'GlossList' -array open '[' -map open '{' -key: 'ID' -string: 'SGML' -key: 'SortAs' -string: 'SGML' -key: 'GlossTerm' -string: 'Standard Generalized Markup Language' -key: 'Acronym' -string: 'SGML' -key: 'Abbrev' -string: 'ISO 8879:1986' -key: 'GlossDef' -string: 'A meta-markup language, used to create markup languages such as DocBook.' -key: 'GlossSeeAlso' -array open '[' -string: 'GML' -string: 'XML' -string: 'markup' -array close ']' -map close '}' -array close ']' -map close '}' -map close '}' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json b/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json deleted file mode 100644 index 2463c71..0000000 --- a/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json +++ /dev/null @@ -1 +0,0 @@ -{ "glossary": { /* you */ "title": /**/ "example glossary", /*should*/"GlossDiv": { "title": /*never*/"S", /*ever*/"GlossList": [ { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", /*see*/"GlossSeeAlso"/*this*/:/*coming*/[/*out*/"GML"/*of*/,/*the*/"XML"/*parser!*/, "markup"] /*hey*/}/*ho*/]/*hey*/}/*ho*/} } // and the parser won't even get this far, so chill. /* hah! diff --git a/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json.gold b/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json.gold deleted file mode 100644 index c3adc11..0000000 --- a/src/Moof/yajl/test/cases/difficult_json_c_test_case_with_comments.json.gold +++ /dev/null @@ -1,36 +0,0 @@ -map open '{' -key: 'glossary' -map open '{' -key: 'title' -string: 'example glossary' -key: 'GlossDiv' -map open '{' -key: 'title' -string: 'S' -key: 'GlossList' -array open '[' -map open '{' -key: 'ID' -string: 'SGML' -key: 'SortAs' -string: 'SGML' -key: 'GlossTerm' -string: 'Standard Generalized Markup Language' -key: 'Acronym' -string: 'SGML' -key: 'Abbrev' -string: 'ISO 8879:1986' -key: 'GlossDef' -string: 'A meta-markup language, used to create markup languages such as DocBook.' -key: 'GlossSeeAlso' -array open '[' -string: 'GML' -string: 'XML' -string: 'markup' -array close ']' -map close '}' -array close ']' -map close '}' -map close '}' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/doubles.json b/src/Moof/yajl/test/cases/doubles.json deleted file mode 100644 index 626f21c..0000000 --- a/src/Moof/yajl/test/cases/doubles.json +++ /dev/null @@ -1 +0,0 @@ -[ 0.1e2, 1e1, 3.141569, 10000000000000e-10] diff --git a/src/Moof/yajl/test/cases/doubles.json.gold b/src/Moof/yajl/test/cases/doubles.json.gold deleted file mode 100644 index c0ea726..0000000 --- a/src/Moof/yajl/test/cases/doubles.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -double: 10 -double: 10 -double: 3.14157 -double: 1000 -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/empty_array.json b/src/Moof/yajl/test/cases/empty_array.json deleted file mode 100644 index 0637a08..0000000 --- a/src/Moof/yajl/test/cases/empty_array.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/empty_array.json.gold b/src/Moof/yajl/test/cases/empty_array.json.gold deleted file mode 100644 index f069c8f..0000000 --- a/src/Moof/yajl/test/cases/empty_array.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/empty_string.json b/src/Moof/yajl/test/cases/empty_string.json deleted file mode 100644 index e16c76d..0000000 --- a/src/Moof/yajl/test/cases/empty_string.json +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/src/Moof/yajl/test/cases/empty_string.json.gold b/src/Moof/yajl/test/cases/empty_string.json.gold deleted file mode 100644 index c197bba..0000000 --- a/src/Moof/yajl/test/cases/empty_string.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: '' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/escaped_bulgarian.json b/src/Moof/yajl/test/cases/escaped_bulgarian.json deleted file mode 100644 index 9ce1d1c..0000000 --- a/src/Moof/yajl/test/cases/escaped_bulgarian.json +++ /dev/null @@ -1,4 +0,0 @@ -["\u0414\u0430", - "\u041c\u0443", - "\u0415\u0431\u0430", - "\u041c\u0430\u0439\u043a\u0430\u0442\u0430"] diff --git a/src/Moof/yajl/test/cases/escaped_bulgarian.json.gold b/src/Moof/yajl/test/cases/escaped_bulgarian.json.gold deleted file mode 100644 index a0c9ae9..0000000 --- a/src/Moof/yajl/test/cases/escaped_bulgarian.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -string: 'Да' -string: 'Му' -string: 'Еба' -string: 'Майката' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/escaped_foobar.json b/src/Moof/yajl/test/cases/escaped_foobar.json deleted file mode 100644 index 2c0e25f..0000000 --- a/src/Moof/yajl/test/cases/escaped_foobar.json +++ /dev/null @@ -1 +0,0 @@ -"\u0066\u006f\u006f\u0062\u0061\u0072" diff --git a/src/Moof/yajl/test/cases/escaped_foobar.json.gold b/src/Moof/yajl/test/cases/escaped_foobar.json.gold deleted file mode 100644 index 5753c64..0000000 --- a/src/Moof/yajl/test/cases/escaped_foobar.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: 'foobar' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/false.json b/src/Moof/yajl/test/cases/false.json deleted file mode 100644 index c508d53..0000000 --- a/src/Moof/yajl/test/cases/false.json +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/src/Moof/yajl/test/cases/false.json.gold b/src/Moof/yajl/test/cases/false.json.gold deleted file mode 100644 index e55fa1f..0000000 --- a/src/Moof/yajl/test/cases/false.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: false -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/false_then_garbage.json b/src/Moof/yajl/test/cases/false_then_garbage.json deleted file mode 100644 index 78f4e96..0000000 --- a/src/Moof/yajl/test/cases/false_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -falsex \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/false_then_garbage.json.gold b/src/Moof/yajl/test/cases/false_then_garbage.json.gold deleted file mode 100644 index e55fa1f..0000000 --- a/src/Moof/yajl/test/cases/false_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: false -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/four_byte_utf8.json b/src/Moof/yajl/test/cases/four_byte_utf8.json deleted file mode 100644 index 582c575..0000000 --- a/src/Moof/yajl/test/cases/four_byte_utf8.json +++ /dev/null @@ -1,2 +0,0 @@ -{ "U+10ABCD": "ôŠ¯" } - diff --git a/src/Moof/yajl/test/cases/four_byte_utf8.json.gold b/src/Moof/yajl/test/cases/four_byte_utf8.json.gold deleted file mode 100644 index f6260f2..0000000 --- a/src/Moof/yajl/test/cases/four_byte_utf8.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'U+10ABCD' -string: 'ôŠ¯' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/integers.json b/src/Moof/yajl/test/cases/integers.json deleted file mode 100644 index a4bbd7a..0000000 --- a/src/Moof/yajl/test/cases/integers.json +++ /dev/null @@ -1,4 +0,0 @@ -[ 1,2,3,4,5,6,7, - 123456789 , -123456789, - 2147483647, -2147483647, - 2147483648 ] diff --git a/src/Moof/yajl/test/cases/integers.json.gold b/src/Moof/yajl/test/cases/integers.json.gold deleted file mode 100644 index bb55c39..0000000 --- a/src/Moof/yajl/test/cases/integers.json.gold +++ /dev/null @@ -1,14 +0,0 @@ -array open '[' -integer: 1 -integer: 2 -integer: 3 -integer: 4 -integer: 5 -integer: 6 -integer: 7 -integer: 123456789 -integer: -123456789 -integer: 2147483647 -integer: -2147483647 -parse error: integer overflow -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/invalid_utf8.json b/src/Moof/yajl/test/cases/invalid_utf8.json deleted file mode 100644 index 12f1718..0000000 --- a/src/Moof/yajl/test/cases/invalid_utf8.json +++ /dev/null @@ -1 +0,0 @@ -["Да ÐœÑ Ð•Ð±Ð° Майката"] diff --git a/src/Moof/yajl/test/cases/invalid_utf8.json.gold b/src/Moof/yajl/test/cases/invalid_utf8.json.gold deleted file mode 100644 index c0dec77..0000000 --- a/src/Moof/yajl/test/cases/invalid_utf8.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -lexical error: invalid bytes in UTF8 string. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/isolated_surrogate_marker.json b/src/Moof/yajl/test/cases/isolated_surrogate_marker.json deleted file mode 100644 index 36959f4..0000000 --- a/src/Moof/yajl/test/cases/isolated_surrogate_marker.json +++ /dev/null @@ -1 +0,0 @@ -"\ud800" diff --git a/src/Moof/yajl/test/cases/isolated_surrogate_marker.json.gold b/src/Moof/yajl/test/cases/isolated_surrogate_marker.json.gold deleted file mode 100644 index cca172e..0000000 --- a/src/Moof/yajl/test/cases/isolated_surrogate_marker.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: '?' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/leading_zero_in_number.json b/src/Moof/yajl/test/cases/leading_zero_in_number.json deleted file mode 100644 index 959f5ba..0000000 --- a/src/Moof/yajl/test/cases/leading_zero_in_number.json +++ /dev/null @@ -1 +0,0 @@ -{ "bad thing": 01 } diff --git a/src/Moof/yajl/test/cases/leading_zero_in_number.json.gold b/src/Moof/yajl/test/cases/leading_zero_in_number.json.gold deleted file mode 100644 index 1a1580d..0000000 --- a/src/Moof/yajl/test/cases/leading_zero_in_number.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'bad thing' -integer: 0 -parse error: after key and value, inside map, I expect ',' or '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/lonely_minus_sign.json b/src/Moof/yajl/test/cases/lonely_minus_sign.json deleted file mode 100644 index 85f69bd..0000000 --- a/src/Moof/yajl/test/cases/lonely_minus_sign.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "foo", true, - true, "blue", - "baby where are you?", "oh boo hoo!", - - -] - diff --git a/src/Moof/yajl/test/cases/lonely_minus_sign.json.gold b/src/Moof/yajl/test/cases/lonely_minus_sign.json.gold deleted file mode 100644 index d15ede9..0000000 --- a/src/Moof/yajl/test/cases/lonely_minus_sign.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -array open '[' -string: 'foo' -bool: true -bool: true -string: 'blue' -string: 'baby where are you?' -string: 'oh boo hoo!' -lexical error: malformed number, a digit is required after the minus sign. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/lonely_number.json b/src/Moof/yajl/test/cases/lonely_number.json deleted file mode 100644 index e2e107a..0000000 --- a/src/Moof/yajl/test/cases/lonely_number.json +++ /dev/null @@ -1 +0,0 @@ -123456789 \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/lonely_number.json.gold b/src/Moof/yajl/test/cases/lonely_number.json.gold deleted file mode 100644 index 181fdfa..0000000 --- a/src/Moof/yajl/test/cases/lonely_number.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -integer: 123456789 -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/map_close.json b/src/Moof/yajl/test/cases/map_close.json deleted file mode 100644 index 5c34318..0000000 --- a/src/Moof/yajl/test/cases/map_close.json +++ /dev/null @@ -1 +0,0 @@ -} diff --git a/src/Moof/yajl/test/cases/map_close.json.gold b/src/Moof/yajl/test/cases/map_close.json.gold deleted file mode 100644 index 972fd39..0000000 --- a/src/Moof/yajl/test/cases/map_close.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: unallowed token at this point in JSON text -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/map_open.json b/src/Moof/yajl/test/cases/map_open.json deleted file mode 100644 index 98232c6..0000000 --- a/src/Moof/yajl/test/cases/map_open.json +++ /dev/null @@ -1 +0,0 @@ -{ diff --git a/src/Moof/yajl/test/cases/map_open.json.gold b/src/Moof/yajl/test/cases/map_open.json.gold deleted file mode 100644 index ab1f33d..0000000 --- a/src/Moof/yajl/test/cases/map_open.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -map open '{' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json b/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json deleted file mode 100644 index 2369f4b..0000000 --- a/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json +++ /dev/null @@ -1 +0,0 @@ -10.e2 diff --git a/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json.gold b/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json.gold deleted file mode 100644 index c2e7e2e..0000000 --- a/src/Moof/yajl/test/cases/missing_integer_after_decimal_point.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: malformed number, a digit is required after the decimal point. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/missing_integer_after_exponent.json b/src/Moof/yajl/test/cases/missing_integer_after_exponent.json deleted file mode 100644 index a62b45d..0000000 --- a/src/Moof/yajl/test/cases/missing_integer_after_exponent.json +++ /dev/null @@ -1 +0,0 @@ -10e diff --git a/src/Moof/yajl/test/cases/missing_integer_after_exponent.json.gold b/src/Moof/yajl/test/cases/missing_integer_after_exponent.json.gold deleted file mode 100644 index 5089681..0000000 --- a/src/Moof/yajl/test/cases/missing_integer_after_exponent.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: malformed number, a digit is required after the exponent. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/non_utf8_char_in_string.json b/src/Moof/yajl/test/cases/non_utf8_char_in_string.json deleted file mode 100644 index 253a664..0000000 --- a/src/Moof/yajl/test/cases/non_utf8_char_in_string.json +++ /dev/null @@ -1 +0,0 @@ -{"CoreletAPIVersion":2,"CoreletType":"standalone","documentation":"A corelet that provides the capability to upload a folder’s contents into a user’s locker.","functions":[{"documentation":"Displays a dialog box that allows user to select a folder on the local system.","name":"ShowBrowseDialog","parameters":[{"documentation":"The callback function for results.","name":"callback","required":true,"type":"callback"}]},{"documentation":"Uploads all mp3 files in the folder provided.","name":"UploadFolder","parameters":[{"documentation":"The path to upload mp3 files from.","name":"path","required":true,"type":"string"},{"documentation":"The callback function for progress.","name":"callback","required":true,"type":"callback"}]},{"documentation":"Returns the server name to the current locker service.","name":"GetLockerService","parameters":[]},{"documentation":"Changes the name of the locker service.","name":"SetLockerService","parameters":[{"documentation":"The value of the locker service to set active.","name":"LockerService","required":true,"type":"string"}]},{"documentation":"Downloads locker files to the suggested folder.","name":"DownloadFile","parameters":[{"documentation":"The origin path of the locker file.","name":"path","required":true,"type":"string"},{"documentation":"The Window destination path of the locker file.","name":"destination","required":true,"type":"integer"},{"documentation":"The callback function for progress.","name":"callback","required":true,"type":"callback"}]}],"name":"LockerUploader","version":{"major":0,"micro":1,"minor":0},"versionString":"0.0.1"} \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/non_utf8_char_in_string.json.gold b/src/Moof/yajl/test/cases/non_utf8_char_in_string.json.gold deleted file mode 100644 index 5e3c580..0000000 --- a/src/Moof/yajl/test/cases/non_utf8_char_in_string.json.gold +++ /dev/null @@ -1,8 +0,0 @@ -map open '{' -key: 'CoreletAPIVersion' -integer: 2 -key: 'CoreletType' -string: 'standalone' -key: 'documentation' -lexical error: invalid bytes in UTF8 string. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/null.json b/src/Moof/yajl/test/cases/null.json deleted file mode 100644 index 19765bd..0000000 --- a/src/Moof/yajl/test/cases/null.json +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/src/Moof/yajl/test/cases/null.json.gold b/src/Moof/yajl/test/cases/null.json.gold deleted file mode 100644 index 94ad0fa..0000000 --- a/src/Moof/yajl/test/cases/null.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -null -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/null_then_garbage.json b/src/Moof/yajl/test/cases/null_then_garbage.json deleted file mode 100644 index 7b65b35..0000000 --- a/src/Moof/yajl/test/cases/null_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -nullx diff --git a/src/Moof/yajl/test/cases/null_then_garbage.json.gold b/src/Moof/yajl/test/cases/null_then_garbage.json.gold deleted file mode 100644 index 94ad0fa..0000000 --- a/src/Moof/yajl/test/cases/null_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -null -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/nulls_and_bools.json b/src/Moof/yajl/test/cases/nulls_and_bools.json deleted file mode 100644 index 65eb01f..0000000 --- a/src/Moof/yajl/test/cases/nulls_and_bools.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "boolean, true": true, - "boolean, false": false, - "null": null -} diff --git a/src/Moof/yajl/test/cases/nulls_and_bools.json.gold b/src/Moof/yajl/test/cases/nulls_and_bools.json.gold deleted file mode 100644 index 51f990b..0000000 --- a/src/Moof/yajl/test/cases/nulls_and_bools.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'boolean, true' -bool: true -key: 'boolean, false' -bool: false -key: 'null' -null -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/simple.json b/src/Moof/yajl/test/cases/simple.json deleted file mode 100644 index 9ed80c9..0000000 --- a/src/Moof/yajl/test/cases/simple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "this": "is", - "really": "simple", - "json": "right?" -} diff --git a/src/Moof/yajl/test/cases/simple.json.gold b/src/Moof/yajl/test/cases/simple.json.gold deleted file mode 100644 index 80fcad2..0000000 --- a/src/Moof/yajl/test/cases/simple.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -key: 'really' -string: 'simple' -key: 'json' -string: 'right?' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/simple_with_comments.json b/src/Moof/yajl/test/cases/simple_with_comments.json deleted file mode 100644 index 3b79bba..0000000 --- a/src/Moof/yajl/test/cases/simple_with_comments.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "this": "is", // ignore this - "really": "simple", - /* ignore -this -too * / -** // -(/ -******/ - "json": "right?" -} diff --git a/src/Moof/yajl/test/cases/simple_with_comments.json.gold b/src/Moof/yajl/test/cases/simple_with_comments.json.gold deleted file mode 100644 index 80fcad2..0000000 --- a/src/Moof/yajl/test/cases/simple_with_comments.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -key: 'really' -string: 'simple' -key: 'json' -string: 'right?' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/string_invalid_escape.json b/src/Moof/yajl/test/cases/string_invalid_escape.json deleted file mode 100644 index c554182..0000000 --- a/src/Moof/yajl/test/cases/string_invalid_escape.json +++ /dev/null @@ -1 +0,0 @@ -["\n foo \/ bar \r\f\\\uffff\t\b\"\\ and you can't escape thi\s"] diff --git a/src/Moof/yajl/test/cases/string_invalid_escape.json.gold b/src/Moof/yajl/test/cases/string_invalid_escape.json.gold deleted file mode 100644 index 439df43..0000000 --- a/src/Moof/yajl/test/cases/string_invalid_escape.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -lexical error: inside a string, '\' occurs before a character which it may not. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/string_invalid_hex_char.json b/src/Moof/yajl/test/cases/string_invalid_hex_char.json deleted file mode 100644 index bde7ee9..0000000 --- a/src/Moof/yajl/test/cases/string_invalid_hex_char.json +++ /dev/null @@ -1 +0,0 @@ -"foo foo, blah blah \u0123 \u4567 \u89ab \uc/ef \uABCD \uEFFE bar baz bing" diff --git a/src/Moof/yajl/test/cases/string_invalid_hex_char.json.gold b/src/Moof/yajl/test/cases/string_invalid_hex_char.json.gold deleted file mode 100644 index 8498792..0000000 --- a/src/Moof/yajl/test/cases/string_invalid_hex_char.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: invalid (non-hex) character occurs after '\u' inside string. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/string_with_escapes.json b/src/Moof/yajl/test/cases/string_with_escapes.json deleted file mode 100644 index 59cc940..0000000 --- a/src/Moof/yajl/test/cases/string_with_escapes.json +++ /dev/null @@ -1,3 +0,0 @@ -["\n foo \/ bar \r\f\\\uffff\t\b\"\\", - "\"and this string has an escape at the beginning", - "and this string has no escapes" ] diff --git a/src/Moof/yajl/test/cases/string_with_escapes.json.gold b/src/Moof/yajl/test/cases/string_with_escapes.json.gold deleted file mode 100644 index 086a9dc..0000000 --- a/src/Moof/yajl/test/cases/string_with_escapes.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -string: ' - foo / bar \ï¿¿ "\' -string: '"and this string has an escape at the beginning' -string: 'and this string has no escapes' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/string_with_invalid_newline.json b/src/Moof/yajl/test/cases/string_with_invalid_newline.json deleted file mode 100644 index 0e3ea0d..0000000 --- a/src/Moof/yajl/test/cases/string_with_invalid_newline.json +++ /dev/null @@ -1,2 +0,0 @@ -"la di dah. this is a string, and I can do this, \n, but not this -" diff --git a/src/Moof/yajl/test/cases/string_with_invalid_newline.json.gold b/src/Moof/yajl/test/cases/string_with_invalid_newline.json.gold deleted file mode 100644 index c38bdef..0000000 --- a/src/Moof/yajl/test/cases/string_with_invalid_newline.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: invalid character inside string. -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/three_byte_utf8.json b/src/Moof/yajl/test/cases/three_byte_utf8.json deleted file mode 100644 index 9c9e656..0000000 --- a/src/Moof/yajl/test/cases/three_byte_utf8.json +++ /dev/null @@ -1 +0,0 @@ -{"matzue": "松江", "asakusa": "浅草"} diff --git a/src/Moof/yajl/test/cases/three_byte_utf8.json.gold b/src/Moof/yajl/test/cases/three_byte_utf8.json.gold deleted file mode 100644 index 7d95fae..0000000 --- a/src/Moof/yajl/test/cases/three_byte_utf8.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -map open '{' -key: 'matzue' -string: '松江' -key: 'asakusa' -string: '浅草' -map close '}' -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/true.json b/src/Moof/yajl/test/cases/true.json deleted file mode 100644 index 27ba77d..0000000 --- a/src/Moof/yajl/test/cases/true.json +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/src/Moof/yajl/test/cases/true.json.gold b/src/Moof/yajl/test/cases/true.json.gold deleted file mode 100644 index 0858bf7..0000000 --- a/src/Moof/yajl/test/cases/true.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: true -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/true_then_garbage.json b/src/Moof/yajl/test/cases/true_then_garbage.json deleted file mode 100644 index 9151612..0000000 --- a/src/Moof/yajl/test/cases/true_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -truex \ No newline at end of file diff --git a/src/Moof/yajl/test/cases/true_then_garbage.json.gold b/src/Moof/yajl/test/cases/true_then_garbage.json.gold deleted file mode 100644 index 0858bf7..0000000 --- a/src/Moof/yajl/test/cases/true_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: true -memory leaks: 0 diff --git a/src/Moof/yajl/test/cases/unescaped_bulgarian.json b/src/Moof/yajl/test/cases/unescaped_bulgarian.json deleted file mode 100644 index f9a70a6..0000000 --- a/src/Moof/yajl/test/cases/unescaped_bulgarian.json +++ /dev/null @@ -1 +0,0 @@ -["Да Му Еба Майката"] diff --git a/src/Moof/yajl/test/cases/unescaped_bulgarian.json.gold b/src/Moof/yajl/test/cases/unescaped_bulgarian.json.gold deleted file mode 100644 index 8db076e..0000000 --- a/src/Moof/yajl/test/cases/unescaped_bulgarian.json.gold +++ /dev/null @@ -1,4 +0,0 @@ -array open '[' -string: 'Да Му Еба Майката' -array close ']' -memory leaks: 0 diff --git a/src/Moof/yajl/test/run_tests.sh b/src/Moof/yajl/test/run_tests.sh deleted file mode 100755 index 174932f..0000000 --- a/src/Moof/yajl/test/run_tests.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -DIFF_FLAGS="-u" -if [[ `uname` == *W32* ]] ; then - DIFF_FLAGS="-wu" -fi - -# find test binary on both platforms. allow the caller to force a -# particular test binary (useful for non-cmake build systems). -if [ -z "$testBin" ]; then - testBin="../build/test/Debug/yajl_test.exe" - if [[ ! -x $testBin ]] ; then - testBin="../build/test/yajl_test" - if [[ ! -x $testBin ]] ; then - echo "cannot execute test binary: '$testBin'" - exit 1; - fi - fi -fi - -echo "using test binary: $testBin" - -let testsSucceeded=0 -let testsTotal=0 - -for file in cases/*.json ; do - allowComments="-c" - - # if the filename starts with dc_, we disallow comments for this test - if [[ $(basename $file) == dc_* ]] ; then - allowComments="" - fi - echo -n " test case: '$file': " - let iter=1 - success="success" - - # parse with a read buffer size ranging from 1-31 to stress stream parsing - while (( $iter < 32 )) && [ $success == "success" ] ; do - $testBin $allowComments -b $iter < $file > ${file}.test 2>&1 - diff ${DIFF_FLAGS} ${file}.gold ${file}.test - if [[ $? == 0 ]] ; then - if (( $iter == 31 )) ; then let testsSucceeded+=1 ; fi - else - success="FAILURE" - let iter=32 - fi - let iter+=1 - rm ${file}.test - done - - echo $success - let testsTotal+=1 -done - -echo $testsSucceeded/$testsTotal tests successful - -if [[ $testsSucceeded != $testsTotal ]] ; then - exit 1 -fi - -exit 0 diff --git a/src/Moof/yajl/test/yajl_test.c b/src/Moof/yajl/test/yajl_test.c deleted file mode 100644 index f2c070f..0000000 --- a/src/Moof/yajl/test/yajl_test.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include -#include -#include - -#include - -/* memory debugging routines */ -typedef struct -{ - unsigned int numFrees; - unsigned int numMallocs; - /* XXX: we really need a hash table here with per-allocation - * information */ -} yajlTestMemoryContext; - -/* cast void * into context */ -#define TEST_CTX(vptr) ((yajlTestMemoryContext *) (vptr)) - -static void yajlTestFree(void * ctx, void * ptr) -{ - assert(ptr != NULL); - TEST_CTX(ctx)->numFrees++; - free(ptr); -} - -static void * yajlTestMalloc(void * ctx, unsigned int sz) -{ - assert(sz != 0); - TEST_CTX(ctx)->numMallocs++; - return malloc(sz); -} - -static void * yajlTestRealloc(void * ctx, void * ptr, unsigned int sz) -{ - if (ptr == NULL) { - assert(sz != 0); - TEST_CTX(ctx)->numMallocs++; - } else if (sz == 0) { - TEST_CTX(ctx)->numFrees++; - } - - return realloc(ptr, sz); -} - - -/* begin parsing callback routines */ -#define BUF_SIZE 2048 - -static int test_yajl_null(void *ctx) -{ - printf("null\n"); - return 1; -} - -static int test_yajl_boolean(void * ctx, int boolVal) -{ - printf("bool: %s\n", boolVal ? "true" : "false"); - return 1; -} - -static int test_yajl_integer(void *ctx, long integerVal) -{ - printf("integer: %ld\n", integerVal); - return 1; -} - -static int test_yajl_double(void *ctx, double doubleVal) -{ - printf("double: %g\n", doubleVal); - return 1; -} - -static int test_yajl_string(void *ctx, const unsigned char * stringVal, - unsigned int stringLen) -{ - printf("string: '"); - fwrite(stringVal, 1, stringLen, stdout); - printf("'\n"); - return 1; -} - -static int test_yajl_map_key(void *ctx, const unsigned char * stringVal, - unsigned int stringLen) -{ - char * str = (char *) malloc(stringLen + 1); - str[stringLen] = 0; - memcpy(str, stringVal, stringLen); - printf("key: '%s'\n", str); - free(str); - return 1; -} - -static int test_yajl_start_map(void *ctx) -{ - printf("map open '{'\n"); - return 1; -} - - -static int test_yajl_end_map(void *ctx) -{ - printf("map close '}'\n"); - return 1; -} - -static int test_yajl_start_array(void *ctx) -{ - printf("array open '['\n"); - return 1; -} - -static int test_yajl_end_array(void *ctx) -{ - printf("array close ']'\n"); - return 1; -} - -static yajl_callbacks callbacks = { - test_yajl_null, - test_yajl_boolean, - test_yajl_integer, - test_yajl_double, - NULL, - test_yajl_string, - test_yajl_start_map, - test_yajl_map_key, - test_yajl_end_map, - test_yajl_start_array, - test_yajl_end_array -}; - -static void usage(const char * progname) -{ - fprintf(stderr, - "usage: %s [options] \n" - " -c allow comments\n" - " -b set the read buffer size\n", - progname); - exit(1); -} - -int -main(int argc, char ** argv) -{ - yajl_handle hand; - const char * fileName; - static unsigned char * fileData = NULL; - unsigned int bufSize = BUF_SIZE; - yajl_status stat; - size_t rd; - yajl_parser_config cfg = { 0, 1 }; - int i, j, done; - - /* memory allocation debugging: allocate a structure which collects - * statistics */ - yajlTestMemoryContext memCtx = { 0,0 }; - - /* memory allocation debugging: allocate a structure which holds - * allocation routines */ - yajl_alloc_funcs allocFuncs = { - yajlTestMalloc, - yajlTestRealloc, - yajlTestFree, - (void *) NULL - }; - - allocFuncs.ctx = (void *) &memCtx; - - /* check arguments. We expect exactly one! */ - for (i=1;i= argc) usage(argv[0]); - - /* validate integer */ - for (j=0;j<(int)strlen(argv[i]);j++) { - if (argv[i][j] <= '9' && argv[i][j] >= '0') continue; - fprintf(stderr, "-b requires an integer argument. '%s' " - "is invalid\n", argv[i]); - usage(argv[0]); - } - - bufSize = atoi(argv[i]); - if (!bufSize) { - fprintf(stderr, "%d is an invalid buffer size\n", - bufSize); - } - } else { - fprintf(stderr, "invalid command line option: '%s'\n", - argv[i]); - usage(argv[0]); - } - } - - fileData = (unsigned char *) malloc(bufSize); - - if (fileData == NULL) { - fprintf(stderr, - "failed to allocate read buffer of %u bytes, exiting.", - bufSize); - exit(2); - } - - fileName = argv[argc-1]; - - /* ok. open file. let's read and parse */ - hand = yajl_alloc(&callbacks, &cfg, &allocFuncs, NULL); - - done = 0; - while (!done) { - rd = fread((void *) fileData, 1, bufSize, stdin); - - if (rd == 0) { - if (!feof(stdin)) { - fprintf(stderr, "error reading from '%s'\n", fileName); - break; - } - done = 1; - } - - if (done) - /* parse any remaining buffered data */ - stat = yajl_parse_complete(hand); - else - /* read file data, pass to parser */ - stat = yajl_parse(hand, fileData, rd); - - if (stat != yajl_status_insufficient_data && - stat != yajl_status_ok) - { - unsigned char * str = yajl_get_error(hand, 0, fileData, rd); - fflush(stdout); - fprintf(stderr, (char *) str); - yajl_free_error(hand, str); - break; - } - } - - yajl_free(hand); - free(fileData); - - /* finally, print out some memory statistics */ - -/* (lth) only print leaks here, as allocations and frees may vary depending - * on read buffer size, causing false failures. - * - * printf("allocations:\t%u\n", memCtx.numMallocs); - * printf("frees:\t\t%u\n", memCtx.numFrees); -*/ - fflush(stderr); - fflush(stdout); - printf("memory leaks:\t%u\n", memCtx.numMallocs - memCtx.numFrees); - - return 0; -} diff --git a/src/Moof/yajl/verify/CMakeLists.txt b/src/Moof/yajl/verify/CMakeLists.txt deleted file mode 100644 index 68aaff9..0000000 --- a/src/Moof/yajl/verify/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2007-2009, Lloyd Hilaiel. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, 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. Neither the name of Lloyd Hilaiel nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -# set up some paths -SET (binDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/bin) - -# create some directories -FILE(MAKE_DIRECTORY ${binDir}) - -SET (SRCS json_verify.c) - -# use the library we build, duh. -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include) -LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) - -ADD_EXECUTABLE(json_verify ${SRCS}) - -TARGET_LINK_LIBRARIES(json_verify yajl_s) - -# copy in the binary -GET_TARGET_PROPERTY(binPath json_verify LOCATION) - -ADD_CUSTOM_COMMAND(TARGET json_verify POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir}) - -IF (NOT WIN32) - INSTALL(TARGETS json_verify RUNTIME DESTINATION bin) -ENDIF () diff --git a/src/Moof/yajl/verify/json_verify.c b/src/Moof/yajl/verify/json_verify.c deleted file mode 100644 index 11d0285..0000000 --- a/src/Moof/yajl/verify/json_verify.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include -#include -#include - -static void -usage(const char * progname) -{ - fprintf(stderr, "%s: validate json from stdin\n" - "usage: json_verify [options]\n" - " -q quiet mode\n" - " -c allow comments\n" - " -u allow invalid utf8 inside strings\n", - progname); - exit(1); -} - -int -main(int argc, char ** argv) -{ - yajl_status stat; - size_t rd; - yajl_handle hand; - static unsigned char fileData[65536]; - int quiet = 0; - int retval = 0, done = 0; - yajl_parser_config cfg = { 0, 1 }; - - /* check arguments.*/ - if (argc > 1 && argc < 4) { - int i; - - for (i=1; i < argc;i++) { - if (!strcmp("-q", argv[i])) { - quiet = 1; - } else if (!strcmp("-c", argv[i])) { - cfg.allowComments = 1; - } else if (!strcmp("-u", argv[i])) { - cfg.checkUTF8 = 0; - } else { - fprintf(stderr, "unrecognized option: '%s'\n\n", argv[i]); - usage(argv[0]); - } - } - } else if (argc != 1) { - usage(argv[0]); - } - - /* allocate a parser */ - hand = yajl_alloc(NULL, &cfg, NULL, NULL); - - while (!done) { - rd = fread((void *) fileData, 1, sizeof(fileData) - 1, stdin); - - retval = 0; - - if (rd == 0) { - if (!feof(stdin)) { - if (!quiet) { - fprintf(stderr, "error encountered on file read\n"); - } - retval = 1; - break; - } - done = 1; - } - fileData[rd] = 0; - - if (done) - /* parse any remaining buffered data */ - stat = yajl_parse_complete(hand); - else - /* read file data, pass to parser */ - stat = yajl_parse(hand, fileData, rd); - - if (stat != yajl_status_ok && - stat != yajl_status_insufficient_data) - { - if (!quiet) { - unsigned char * str = yajl_get_error(hand, 1, fileData, rd); - fprintf(stderr, (const char *) str); - yajl_free_error(hand, str); - } - retval = 1; - break; - } - } - - yajl_free(hand); - - if (!quiet) { - printf("JSON is %s\n", retval ? "invalid" : "valid"); - } - - return retval; -} diff --git a/src/Moof/yajl/yajl_common.h b/src/Moof/yajl/yajl_common.h deleted file mode 100644 index 9ad5eb4..0000000 --- a/src/Moof/yajl/yajl_common.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __YAJL_COMMON_H__ -#define __YAJL_COMMON_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define YAJL_MAX_DEPTH 128 - -/* msft dll export gunk. To build a DLL on windows, you - * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared - * DLL, you must define YAJL_SHARED and WIN32 */ -#if defined(WIN32) && defined(YAJL_SHARED) -# ifdef YAJL_BUILD -# define YAJL_API __declspec(dllexport) -# else -# define YAJL_API __declspec(dllimport) -# endif -#else -# define YAJL_API -#endif - -/** pointer to a malloc function, supporting client overriding memory - * allocation routines */ -typedef void * (*yajl_malloc_func)(void *ctx, unsigned int sz); - -/** pointer to a free function, supporting client overriding memory - * allocation routines */ -typedef void (*yajl_free_func)(void *ctx, void * ptr); - -/** pointer to a realloc function which can resize an allocation. */ -typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, unsigned int sz); - -/** A structure which can be passed to yajl_*_alloc routines to allow the - * client to specify memory allocation functions to be used. */ -typedef struct -{ - /** pointer to a function that can allocate uninitialized memory */ - yajl_malloc_func malloc; - /** pointer to a function that can resize memory allocations */ - yajl_realloc_func realloc; - /** pointer to a function that can free memory allocated using - * reallocFunction or mallocFunction */ - yajl_free_func free; - /** a context pointer that will be passed to above allocation routines */ - void * ctx; -} yajl_alloc_funcs; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Moof/yajl/yajl_gen.h b/src/Moof/yajl/yajl_gen.h deleted file mode 100644 index 55a8362..0000000 --- a/src/Moof/yajl/yajl_gen.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_gen.h - * Interface to YAJL's JSON generation facilities. - */ - -#include - -#ifndef __YAJL_GEN_H__ -#define __YAJL_GEN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - /** generator status codes */ - typedef enum { - /** no error */ - yajl_gen_status_ok = 0, - /** at a point where a map key is generated, a function other than - * yajl_gen_string was called */ - yajl_gen_keys_must_be_strings, - /** YAJL's maximum generation depth was exceeded. see - * YAJL_MAX_DEPTH */ - yajl_max_depth_exceeded, - /** A generator function (yajl_gen_XXX) was called while in an error - * state */ - yajl_gen_in_error_state, - /** A complete JSON document has been generated */ - yajl_gen_generation_complete - } yajl_gen_status; - - /** an opaque handle to a generator */ - typedef struct yajl_gen_t * yajl_gen; - - /** configuration structure for the generator */ - typedef struct { - /** generate indented (beautiful) output */ - unsigned int beautify; - /** an opportunity to define an indent string. such as \\t or - * some number of spaces. default is four spaces ' '. This - * member is only relevant when beautify is true */ - const char * indentString; - } yajl_gen_config; - - /** allocate a generator handle - * \param config a pointer to a structure containing parameters which - * configure the behavior of the json generator - * \param allocFuncs an optional pointer to a structure which allows - * the client to overide the memory allocation - * used by yajl. May be NULL, in which case - * malloc/free/realloc will be used. - * - * \returns an allocated handle on success, NULL on failure (bad params) - */ - yajl_gen YAJL_API yajl_gen_alloc(const yajl_gen_config * config, - const yajl_alloc_funcs * allocFuncs); - - /** free a generator handle */ - void YAJL_API yajl_gen_free(yajl_gen handle); - - yajl_gen_status YAJL_API yajl_gen_integer(yajl_gen hand, long int number); - yajl_gen_status YAJL_API yajl_gen_double(yajl_gen hand, double number); - yajl_gen_status YAJL_API yajl_gen_number(yajl_gen hand, - const char * num, - unsigned int len); - yajl_gen_status YAJL_API yajl_gen_string(yajl_gen hand, - const unsigned char * str, - unsigned int len); - yajl_gen_status YAJL_API yajl_gen_null(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_bool(yajl_gen hand, int boolean); - yajl_gen_status YAJL_API yajl_gen_map_open(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_map_close(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_array_open(yajl_gen hand); - yajl_gen_status YAJL_API yajl_gen_array_close(yajl_gen hand); - - /** access the null terminated generator buffer. If incrementally - * outputing JSON, one should call yajl_gen_clear to clear the - * buffer. This allows stream generation. */ - yajl_gen_status YAJL_API yajl_gen_get_buf(yajl_gen hand, - const unsigned char ** buf, - unsigned int * len); - - /** clear yajl's output buffer, but maintain all internal generation - * state. This function will not "reset" the generator state, and is - * intended to enable incremental JSON outputing. */ - void YAJL_API yajl_gen_clear(yajl_gen hand); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Moof/yajl/yajl_parse.h b/src/Moof/yajl/yajl_parse.h deleted file mode 100644 index 40998bc..0000000 --- a/src/Moof/yajl/yajl_parse.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2007-2009, Lloyd Hilaiel. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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. Neither the name of Lloyd Hilaiel nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE 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 PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * \file yajl_parse.h - * Interface to YAJL's JSON parsing facilities. - */ - -#include - -#ifndef __YAJL_PARSE_H__ -#define __YAJL_PARSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - /** error codes returned from this interface */ - typedef enum { - /** no error was encountered */ - yajl_status_ok, - /** a client callback returned zero, stopping the parse */ - yajl_status_client_canceled, - /** The parse cannot yet complete because more json input text - * is required, call yajl_parse with the next buffer of input text. - * (pertinent only when stream parsing) */ - yajl_status_insufficient_data, - /** An error occured during the parse. Call yajl_get_error for - * more information about the encountered error */ - yajl_status_error - } yajl_status; - - /** attain a human readable, english, string for an error */ - const char * YAJL_API yajl_status_to_string(yajl_status code); - - /** an opaque handle to a parser */ - typedef struct yajl_handle_t * yajl_handle; - - /** yajl is an event driven parser. this means as json elements are - * parsed, you are called back to do something with the data. The - * functions in this table indicate the various events for which - * you will be called back. Each callback accepts a "context" - * pointer, this is a void * that is passed into the yajl_parse - * function which the client code may use to pass around context. - * - * All callbacks return an integer. If non-zero, the parse will - * continue. If zero, the parse will be canceled and - * yajl_status_client_canceled will be returned from the parse. - * - * Note about handling of numbers: - * yajl will only convert numbers that can be represented in a double - * or a long int. All other numbers will be passed to the client - * in string form using the yajl_number callback. Furthermore, if - * yajl_number is not NULL, it will always be used to return numbers, - * that is yajl_integer and yajl_double will be ignored. If - * yajl_number is NULL but one of yajl_integer or yajl_double are - * defined, parsing of a number larger than is representable - * in a double or long int will result in a parse error. - */ - typedef struct { - int (* yajl_null)(void * ctx); - int (* yajl_boolean)(void * ctx, int boolVal); - int (* yajl_integer)(void * ctx, long integerVal); - int (* yajl_double)(void * ctx, double doubleVal); - /** A callback which passes the string representation of the number - * back to the client. Will be used for all numbers when present */ - int (* yajl_number)(void * ctx, const char * numberVal, - unsigned int numberLen); - - /** strings are returned as pointers into the JSON text when, - * possible, as a result, they are _not_ null padded */ - int (* yajl_string)(void * ctx, const unsigned char * stringVal, - unsigned int stringLen); - - int (* yajl_start_map)(void * ctx); - int (* yajl_map_key)(void * ctx, const unsigned char * key, - unsigned int stringLen); - int (* yajl_end_map)(void * ctx); - - int (* yajl_start_array)(void * ctx); - int (* yajl_end_array)(void * ctx); - } yajl_callbacks; - - /** configuration structure for the generator */ - typedef struct { - /** if nonzero, javascript style comments will be allowed in - * the json input, both slash star and slash slash */ - unsigned int allowComments; - /** if nonzero, invalid UTF8 strings will cause a parse - * error */ - unsigned int checkUTF8; - } yajl_parser_config; - - /** allocate a parser handle - * \param callbacks a yajl callbacks structure specifying the - * functions to call when different JSON entities - * are encountered in the input text. May be NULL, - * which is only useful for validation. - * \param config configuration parameters for the parse. - * \param ctx a context pointer that will be passed to callbacks. - */ - yajl_handle YAJL_API yajl_alloc(const yajl_callbacks * callbacks, - const yajl_parser_config * config, - const yajl_alloc_funcs * allocFuncs, - void * ctx); - - /** free a parser handle */ - void YAJL_API yajl_free(yajl_handle handle); - - /** Parse some json! - * \param hand - a handle to the json parser allocated with yajl_alloc - * \param jsonText - a pointer to the UTF8 json text to be parsed - * \param jsonTextLength - the length, in bytes, of input text - */ - yajl_status YAJL_API yajl_parse(yajl_handle hand, - const unsigned char * jsonText, - unsigned int jsonTextLength); - - /** Parse any remaining buffered json. - * Since yajl is a stream-based parser, without an explicit end of - * input, yajl sometimes can't decide if content at the end of the - * stream is valid or not. For example, if "1" has been fed in, - * yajl can't know whether another digit is next or some character - * that would terminate the integer token. - * - * \param hand - a handle to the json parser allocated with yajl_alloc - */ - yajl_status yajl_parse_complete(yajl_handle hand); - - /** get an error string describing the state of the - * parse. - * - * If verbose is non-zero, the message will include the JSON - * text where the error occured, along with an arrow pointing to - * the specific char. - * - * A dynamically allocated string will be returned which should - * be freed with yajl_free_error - */ - unsigned char * YAJL_API yajl_get_error(yajl_handle hand, int verbose, - const unsigned char * jsonText, - unsigned int jsonTextLength); - - /** free an error returned from yajl_get_error */ - void YAJL_API yajl_free_error(yajl_handle hand, unsigned char * str); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/Scene.cc b/src/Scene.cc index bd9c034..59ece16 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -38,9 +38,9 @@ #include #include #include -#include #include "Scene.hh" +#include "Tilemap.hh" struct Scene::Impl : public Mf::Mippleton @@ -50,7 +50,7 @@ struct Scene::Impl : public Mf::Mippleton Mf::Scalar vertices_[12]; Mf::Scalar texCoords_[8]; - Mf::Tilemap tilemap_; + Tilemap tilemap_; bool blending_; bool fog_; @@ -68,7 +68,7 @@ struct Scene::Impl : public Mf::Mippleton }; Quad(const Mf::Vector3 vertices[4], const std::string& texture, - Mf::Tilemap::Index tileIndex) : + Tilemap::Index tileIndex) : tilemap_(texture), blending_(false), fog_(false) @@ -267,8 +267,6 @@ struct Scene::Impl : public Mf::Mippleton - Mf::Script script; - Mf::Matrix4 transform; std::string texture; @@ -287,10 +285,6 @@ struct Scene::Impl : public Mf::Mippleton explicit Impl(const std::string& name) : Mf::Mippleton(name) { - script.importStandardLibraries(); - importLogScript(script); - - importSceneBindings(script); loadFromFile(); } @@ -331,8 +325,13 @@ struct Scene::Impl : public Mf::Mippleton void loadFromFile() { + Mf::Script script; std::string filePath = Scene::getPath(getName()); + script.importStandardLibraries(); + importLogScript(script); + importSceneBindings(script); + if (script.doFile(filePath) != Mf::Script::SUCCESS) { std::string str; @@ -487,7 +486,7 @@ struct Scene::Impl : public Mf::Mippleton if (nTiles % width != 0) table.throwError("invalid number of tiles"); - std::vector< std::vector > indices; + std::vector< std::vector > indices; int i, w, h; @@ -501,7 +500,7 @@ struct Scene::Impl : public Mf::Mippleton i = 1; for (h = height - 1; h >= 0; --h) { - std::vector row; + std::vector row; for (w = 0; w < width; ++w, ++i) { @@ -509,10 +508,10 @@ struct Scene::Impl : public Mf::Mippleton script.push(long(i)); tiles.pushField(); - long index; + Tilemap::Index index; top.get(index); - row.push_back(Mf::Tilemap::Index(index)); + row.push_back(index); } indices[h] = row; @@ -527,8 +526,7 @@ struct Scene::Impl : public Mf::Mippleton { for (int w = 0; w <= width; ++w) { - vertices[h][w] = Mf::Vector4(Mf::Scalar(w), Mf::Scalar(h), 0.0, 1.0) * - transposedTransform; + vertices[h][w] = Mf::Vector4(w, h, 0.0, 1.0) * transposedTransform; } } @@ -536,7 +534,7 @@ struct Scene::Impl : public Mf::Mippleton { for (int w = 0; w < width; ++w) { - if (indices[h][w] == Mf::Tilemap::NO_TILE) continue; + if (indices[h][w] == Tilemap::NO_TILE) continue; Mf::Vector3 quadVertices[4]; @@ -607,7 +605,7 @@ struct Scene::Impl : public Mf::Mippleton quadVertices[2] = Mf::demote(vertices[1][w+1]); quadVertices[3] = Mf::demote(vertices[1][w]); - Quad* quad = new Quad(quadVertices, texture, Mf::Tilemap::Index(index)); + Quad* quad = new Quad(quadVertices, texture, Tilemap::Index(index)); quad->setBlending(blending); quad->setFog(fog); diff --git a/src/Tilemap.cc b/src/Tilemap.cc new file mode 100644 index 0000000..6554752 --- /dev/null +++ b/src/Tilemap.cc @@ -0,0 +1,189 @@ + +/******************************************************************************* + + Copyright (c) 2009, Charles McGarvey + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#include +#include +#include + +#include "Tilemap.hh" + + +struct Tilemap::Impl : public Mf::Mippleton +{ + Impl(const std::string& name) : + Mf::Mippleton(name), + magFilter_(GL_NEAREST), + minFilter_(GL_NEAREST), + nTilesS_(1), + nTilesT_(1), + wrapS_(GL_CLAMP), + wrapT_(GL_CLAMP) + { + loadFromFile(); + } + + + static void bindScriptConstants(Mf::Script& script) + { + script.push(GL_CLAMP); script.set("CLAMP"); + script.push(GL_REPEAT); script.set("REPEAT"); + script.push(GL_LINEAR); script.set("LINEAR"); + script.push(GL_NEAREST); script.set("NEAREST"); + script.push(GL_LINEAR_MIPMAP_LINEAR); script.set("LINEAR_MIPMAP_LINEAR"); + script.push(GL_LINEAR_MIPMAP_NEAREST); script.set("LINEAR_MIPMAP_NEAREST"); + script.push(GL_NEAREST_MIPMAP_LINEAR); script.set("NEAREST_MIPMAP_LINEAR"); + script.push(GL_NEAREST_MIPMAP_NEAREST); script.set("NEAREST_MIPMAP_NEAREST"); + } + + void loadFromFile() + { + Mf::Script script; + std::string filePath = Tilemap::getPath(getName()); + + script.importStandardLibraries(); + importLogScript(script); + bindScriptConstants(script); + + if (script.doFile(filePath) != Mf::Script::SUCCESS) + { + std::string str; + script[-1].get(str); + Mf::logScript("%s", str.c_str()); + return; // TODO needs a better exit strategy + } + + Mf::logInfo("loading tiles from tilemap %s", filePath.c_str()); + + Mf::Script::Value globals = script.getGlobalTable(); + Mf::Script::Value top = script[-1]; + + globals.pushField("tiles_s"); + top.get(nTilesS_); + + globals.pushField("tiles_t"); + top.get(nTilesT_); + + globals.pushField("min_filter"); + top.get(minFilter_); + + globals.pushField("mag_filter"); + top.get(magFilter_); + + globals.pushField("wrap_s"); + top.get(wrapS_); + + globals.pushField("wrap_t"); + top.get(wrapT_); + } + + + bool getTileCoords(Tilemap::Index index, Mf::Scalar coords[8]) const + { + // make sure the index represents a real tile + if (index >= nTilesS_ * nTilesT_) return false; + + Mf::Scalar w = 1.0 / Mf::Scalar(nTilesS_); + Mf::Scalar h = 1.0 / Mf::Scalar(nTilesT_); + + coords[0] = Mf::Scalar(index % nTilesS_) * w; + coords[1] = (Mf::Scalar(nTilesT_ - 1) - + Mf::Scalar(index / nTilesS_)) * h; + coords[2] = coords[0] + w; + coords[3] = coords[1]; + coords[4] = coords[2]; + coords[5] = coords[1] + h; + coords[6] = coords[0]; + coords[7] = coords[5]; + + return true; + } + + + GLuint magFilter_; + GLuint minFilter_; + unsigned nTilesS_; + unsigned nTilesT_; + GLuint wrapS_; + GLuint wrapT_; +}; + + +Tilemap::Tilemap(const std::string& name) : + Texture(name), + impl_(Tilemap::Impl::getInstance(name)) +{ + setMinFilter(impl_->minFilter_); + setMagFilter(impl_->magFilter_); + setWrapS(impl_->wrapS_); + setWrapT(impl_->wrapT_); +} + + +bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8]) const +{ + // pass through + return impl_->getTileCoords(index, coords); +} + +bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8], + Orientation orientation) const +{ + if (getTileCoords(index, coords)) + { + if (orientation & FLIP) + { + // this looks kinda weird, but it's just swapping in a way that + // doesn't require an intermediate variable + coords[1] = coords[5]; + coords[5] = coords[3]; + coords[3] = coords[7]; + coords[7] = coords[5]; + } + if (orientation & REVERSE) + { + coords[0] = coords[2]; + coords[2] = coords[6]; + coords[4] = coords[6]; + coords[6] = coords[0]; + } + + return true; + } + + return false; +} + + +std::string Tilemap::getPath(const std::string& name) +{ + return Resource::getPath("tilemaps/" + name + ".lua"); +} + + +/** vim: set ts=4 sw=4 tw=80: *************************************************/ + diff --git a/src/Moof/Tilemap.hh b/src/Tilemap.hh similarity index 92% rename from src/Moof/Tilemap.hh rename to src/Tilemap.hh index 942a5e9..163b45a 100644 --- a/src/Moof/Tilemap.hh +++ b/src/Tilemap.hh @@ -26,8 +26,8 @@ *******************************************************************************/ -#ifndef _MOOF_TILEMAP_HH_ -#define _MOOF_TILEMAP_HH_ +#ifndef _TILEMAP_HH_ +#define _TILEMAP_HH_ /** * @file Tilemap.hh @@ -40,9 +40,6 @@ #include -namespace Mf { - - /** * A tilemap is a texture which is meant to be divided into smaller sprites. * This class provides all the functionality of a texture and adds some methods @@ -50,7 +47,7 @@ namespace Mf { * simplicity, this class assumes square tiles. */ -class Tilemap : public Texture +class Tilemap : public Mf::Texture { public: /** @@ -83,7 +80,7 @@ public: * @return True if index is valid, false otherwise. */ - bool getTileCoords(Index index, Scalar coords[8]) const; + bool getTileCoords(Index index, Mf::Scalar coords[8]) const; /** @@ -94,7 +91,7 @@ public: * @return True if index is valid, false otherwise. */ - bool getTileCoords(Index index, Scalar coords[8], Orientation what) const; + bool getTileCoords(Index index, Mf::Scalar coords[8], Orientation what) const; static std::string getPath(const std::string& name); @@ -105,9 +102,7 @@ private: }; -} // namespace Mf - -#endif // _MOOF_TILEMAP_HH_ +#endif // _TILEMAP_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/TilemapFont.cc b/src/TilemapFont.cc index ea876ce..da0e9a6 100644 --- a/src/TilemapFont.cc +++ b/src/TilemapFont.cc @@ -32,13 +32,13 @@ TilemapFont::TilemapFont() : - Mf::Tilemap("Font") {} + Tilemap("Font") {} void TilemapFont::getTileCoords(char symbol, Mf::Scalar coords[8], - Mf::Tilemap::Orientation what) + Tilemap::Orientation what) { - Mf::Tilemap::Index index = 0; + Tilemap::Index index = 0; if (symbol >= ' ' && symbol <= '_') { @@ -53,7 +53,7 @@ void TilemapFont::getTileCoords(char symbol, Mf::Scalar coords[8], index = 0; } - Mf::Tilemap::getTileCoords(index, coords, what); + Tilemap::getTileCoords(index, coords, what); } diff --git a/src/TilemapFont.hh b/src/TilemapFont.hh index 04d9e1e..059b94a 100644 --- a/src/TilemapFont.hh +++ b/src/TilemapFont.hh @@ -34,16 +34,16 @@ * Text on the screen. */ -#include +#include "Tilemap.hh" -class TilemapFont : public Mf::Tilemap +class TilemapFont : public Tilemap { public: TilemapFont(); void getTileCoords(char symbol, Mf::Scalar coords[8], - Mf::Tilemap::Orientation what = Mf::Tilemap::NORMAL); + Tilemap::Orientation what = Tilemap::NORMAL); };