]> Dogcows Code - chaz/yoink/commitdiff
no longer using libtool; didn't really need it
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 24 Sep 2009 01:36:11 +0000 (19:36 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 24 Sep 2009 01:36:11 +0000 (19:36 -0600)
16 files changed:
configure.ac
src/Makefile.am
src/Moof/yajl/Makefile.am [deleted file]
src/Moof/yajl/src/api/yajl_common.h [moved from src/Moof/yajl/src/yajl/yajl_common.h with 100% similarity]
src/Moof/yajl/src/api/yajl_gen.h [moved from src/Moof/yajl/src/yajl/yajl_gen.h with 100% similarity]
src/Moof/yajl/src/api/yajl_parse.h [moved from src/Moof/yajl/src/yajl/yajl_parse.h with 100% similarity]
src/Moof/yajl/src/yajl.c
src/Moof/yajl/src/yajl_alloc.h
src/Moof/yajl/src/yajl_buf.h
src/Moof/yajl/src/yajl_bytestack.h
src/Moof/yajl/src/yajl_gen.c
src/Moof/yajl/src/yajl_lex.h
src/Moof/yajl/src/yajl_parser.h
src/Moof/yajl/yajl_common.h [new file with mode: 0644]
src/Moof/yajl/yajl_gen.h [new file with mode: 0644]
src/Moof/yajl/yajl_parse.h [new file with mode: 0644]

index 82ebaa0baa87f8eade714dd2afaf5ab86bce618e..11fbb5524c87c2aa7984996c97a359876ba9d1f7 100644 (file)
@@ -21,13 +21,11 @@ AM_INIT_AUTOMAKE
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 AC_PROG_CXX
-#AC_PROG_AWK
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
-#AC_PROG_LN_S
-#AC_PROG_MAKE_SET
-AC_PROG_LIBTOOL
+AC_PROG_RANLIB
+AM_PROG_CC_C_O
 
 
 #
@@ -275,8 +273,8 @@ AC_CONFIG_FILES([Makefile
                                 doc/yoink.6
                                 extra/Makefile
                                 extra/yoink.spec
-                 src/Makefile
-                                src/Moof/yajl/Makefile])
+                 src/Makefile])
+                                #src/Moof/yajl/Makefile])
 
 AC_CONFIG_HEADERS([src/config.h])
 
index fbfc46b40049c9549c8ae6ceb21ae8606343aa19..30f2bae88f3cbeb2ed24f4f21770e056e11f4475 100644 (file)
 
-SUBDIRS = Moof/yajl
-
-
-noinst_LTLIBRARIES = libmoof.la
-
-libmoof_la_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 \
-                                  Moof/Engine.cc \
-                                  Moof/Engine.hh \
-                                  Moof/Entity.hh \
-                                  Moof/Event.hh \
-                                  Moof/Exception.hh \
-                                  Moof/Frustum.cc \
-                                  Moof/Frustum.hh \
-                                  Moof/Hash.cc \
-                                  Moof/Hash.hh \
-                                  Moof/Interpolator.hh \
-                                  Moof/Log.cc \
-                                  Moof/Log.hh \
-                                  Moof/Math.hh \
-                                  Moof/Mippleton.hh \
-                                  Moof/Octree.cc \
-                                  Moof/Octree.hh \
-                                  Moof/OpenGL.hh \
-                                  Moof/Plane.cc \
-                                  Moof/Plane.hh \
-                                  Moof/Random.cc \
-                                  Moof/Random.hh \
-                                  Moof/Rectangle.cc \
-                                  Moof/Rectangle.hh \
-                                  Moof/Resource.cc \
-                                  Moof/Resource.hh \
-                                  Moof/RK4.hh \
-                                  Moof/Scene.cc \
-                                  Moof/Scene.hh \
-                                  Moof/Serializable.cc \
-                                  Moof/Serializable.hh \
-                                  Moof/Serializer.cc \
-                                  Moof/Serializer.hh \
-                                  Moof/Settings.cc \
-                                  Moof/Settings.hh \
-                                  Moof/Sound.cc \
-                                  Moof/Sound.hh \
-                                  Moof/Sphere.cc \
-                                  Moof/Sphere.hh \
-                                  Moof/StringTools.cc \
-                                  Moof/StringTools.hh \
-                                  Moof/Texture.cc \
-                                  Moof/Texture.hh \
-                                  Moof/Thread.hh \
-                                  Moof/Tilemap.cc \
-                                  Moof/Tilemap.hh \
-                                  Moof/Timer.cc \
-                                  Moof/Timer.hh \
-                                  Moof/Video.cc \
-                                  Moof/Video.hh \
-                                  Moof/fastevents.c \
-                                  Moof/fastevents.h \
-                                  $(ENDLIST)
-
-libmoof_la_CPPFLAGS = -I$(top_srcdir)/src/Moof -I$(top_srcdir)/src/Moof/yajl/src
-libmoof_la_LIBADD   = $(top_srcdir)/src/Moof/yajl/libyajl.la
-
-
-bin_PROGRAMS   = yoink
-
-yoink_SOURCES  = \
-                                Character.cc \
-                                Character.hh \
-                                Hud.cc \
-                                Hud.hh \
-                                TilemapFont.cc \
-                                TilemapFont.hh \
-                                Typesetter.cc \
-                                Typesetter.hh \
-                                YoinkApp.cc \
-                                YoinkApp.hh \
-                                $(ENDLIST)
+#
+# Yoink
+# Process this file with automake to produce a Makefile.
+#
+
+
+#
+# libmoof.a
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+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 \
+                                       Moof/Engine.cc \
+                                       Moof/Engine.hh \
+                                       Moof/Entity.hh \
+                                       Moof/Event.hh \
+                                       Moof/Exception.hh \
+                                       Moof/Frustum.cc \
+                                       Moof/Frustum.hh \
+                                       Moof/Hash.cc \
+                                       Moof/Hash.hh \
+                                       Moof/Interpolator.hh \
+                                       Moof/Log.cc \
+                                       Moof/Log.hh \
+                                       Moof/Math.hh \
+                                       Moof/Mippleton.hh \
+                                       Moof/Octree.cc \
+                                       Moof/Octree.hh \
+                                       Moof/OpenGL.hh \
+                                       Moof/Plane.cc \
+                                       Moof/Plane.hh \
+                                       Moof/Random.cc \
+                                       Moof/Random.hh \
+                                       Moof/Rectangle.cc \
+                                       Moof/Rectangle.hh \
+                                       Moof/Resource.cc \
+                                       Moof/Resource.hh \
+                                       Moof/RK4.hh \
+                                       Moof/Scene.cc \
+                                       Moof/Scene.hh \
+                                       Moof/Serializable.cc \
+                                       Moof/Serializable.hh \
+                                       Moof/Serializer.cc \
+                                       Moof/Serializer.hh \
+                                       Moof/Settings.cc \
+                                       Moof/Settings.hh \
+                                       Moof/Sound.cc \
+                                       Moof/Sound.hh \
+                                       Moof/Sphere.cc \
+                                       Moof/Sphere.hh \
+                                       Moof/StringTools.cc \
+                                       Moof/StringTools.hh \
+                                       Moof/Texture.cc \
+                                       Moof/Texture.hh \
+                                       Moof/Thread.hh \
+                                       Moof/Tilemap.cc \
+                                       Moof/Tilemap.hh \
+                                       Moof/Timer.cc \
+                                       Moof/Timer.hh \
+                                       Moof/Video.cc \
+                                       Moof/Video.hh \
+                                       Moof/fastevents.c \
+                                       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 -I$(top_srcdir)/src/Moof/yajl/src
 
-yoink_CPPFLAGS = -I$(top_srcdir)/src/Moof
-yoink_LDADD    = libmoof.la
+EXTRA_DIST = Moof/cml Moof/stlplus Moof/yajl
 
 
-EXTRA_DIST = Moof/cml Moof/stlplus Moof/yajl
+#
+# yoink
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+bin_PROGRAMS = yoink
+
+yoink_SOURCES = \
+                               Character.cc \
+                               Character.hh \
+                               Hud.cc \
+                               Hud.hh \
+                               TilemapFont.cc \
+                               TilemapFont.hh \
+                               Typesetter.cc \
+                               Typesetter.hh \
+                               YoinkApp.cc \
+                               YoinkApp.hh \
+                               $(ENDLIST)
+
+yoink_CPPFLAGS = -I$(top_srcdir)/src/Moof
+yoink_LDADD = libmoof.a
 
 
 YOINK_ENVIRONMENT = YOINK_DATADIR="$(top_srcdir)/data"
diff --git a/src/Moof/yajl/Makefile.am b/src/Moof/yajl/Makefile.am
deleted file mode 100644 (file)
index f10788a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# Here is an automake file which can be used to build yajl as a convenience
-# library.  I also had to rename src/api to src/yajl and change cpp include
-# directives accordingly in order to allow clients to use the more appropriate
-# #include <yajl/yajl_parse.h> syntax.  -- Chaz
-
-noinst_LTLIBRARIES = libyajl.la
-
-libyajl_la_SOURCES = \
-                                        src/yajl.c \
-                                        src/yajl_alloc.c \
-                                        src/yajl_alloc.h \
-                                        src/yajl_buf.c \
-                                        src/yajl_buf.h \
-                                        src/yajl_bytestack.h \
-                                        src/yajl_encode.c \
-                                        src/yajl_encode.h \
-                                        src/yajl_gen.c \
-                                        src/yajl_lex.c \
-                                        src/yajl_lex.h \
-                                        src/yajl_parser.c \
-                                        src/yajl_parser.h \
-                                        $(ENDLIST)
-
-noinst_HEADERS = \
-                                src/yajl/yajl_common.h \
-                                src/yajl/yajl_gen.h \
-                                src/yajl/yajl_parse.h \
-                                $(ENDLIST)
-
-libyajl_la_CPPFLAGS = -Isrc
-
index d9ab9ba8731a6130e60261833f8304c2a5f0c92d..fe7d05e38bf4a360dc039f690212ffdcc7fa02b6 100644 (file)
@@ -30,7 +30,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */ 
 
-#include "yajl/yajl_parse.h"
+#include "api/yajl_parse.h"
 #include "yajl_lex.h"
 #include "yajl_parser.h"
 #include "yajl_alloc.h"
index df8a1f213bba8265a62efbfa406aaeeba5846573..bf193089d9d0c47c9d879eae38eb7b1a69323e81 100644 (file)
@@ -39,7 +39,7 @@
 #ifndef __YAJL_ALLOC_H__
 #define __YAJL_ALLOC_H__
 
-#include "yajl/yajl_common.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))
index 1a25382c40bd50ecf7e1fb71c8637c0affd2ba61..ebdf411f3a4eea1b0136e2f69a657b49cac1ce40 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef __YAJL_BUF_H__
 #define __YAJL_BUF_H__
 
-#include "yajl/yajl_common.h"
+#include "api/yajl_common.h"
 #include "yajl_alloc.h"
 
 /*
index bb315182604f826df544f19d1476054d76b9c0e9..f5694f91291996cfb7c7daf974c9d1d8256d4759 100644 (file)
@@ -38,7 +38,7 @@
 #ifndef __YAJL_BYTESTACK_H__
 #define __YAJL_BYTESTACK_H__
 
-#include "yajl/yajl_common.h"
+#include "api/yajl_common.h"
 
 #define YAJL_BS_INC 128
 
index ab1fee564217319223749ced792e8d2ff7c2ebed..34cfbec6f8d8f02e11145a057b778b5dcc1152eb 100644 (file)
@@ -30,7 +30,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */ 
 
-#include "yajl/yajl_gen.h"
+#include "api/yajl_gen.h"
 #include "yajl_buf.h"
 #include "yajl_encode.h"
 
index 2d866257924127d2d29dfc12e4805664f28c9d28..966365cea8881fc9d9d8ff1d648e69b440315390 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef __YAJL_LEX_H__
 #define __YAJL_LEX_H__
 
-#include "yajl/yajl_common.h"
+#include "api/yajl_common.h"
 
 typedef enum {
     yajl_tok_bool,         
index db82ba1bcb4a95c4ab05c4286af6434e709d5743..92b4a40636a4e676041338df29e1ff0fca289cbe 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef __YAJL_PARSER_H__
 #define __YAJL_PARSER_H__
 
-#include "yajl/yajl_parse.h"
+#include "api/yajl_parse.h"
 #include "yajl_bytestack.h"
 #include "yajl_buf.h"
 
diff --git a/src/Moof/yajl/yajl_common.h b/src/Moof/yajl/yajl_common.h
new file mode 100644 (file)
index 0000000..9ad5eb4
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..55a8362
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * 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 <yajl/yajl_common.h>
+
+#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
new file mode 100644 (file)
index 0000000..40998bc
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * 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 <yajl/yajl_common.h>
+
+#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
This page took 0.042427 seconds and 4 git commands to generate.