couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [25/44] couchdb commit: updated refs/heads/1843-feature-bigcouch-multi-repo to 2385a37
Date Tue, 04 Feb 2014 23:44:38 GMT
Remove src/ejson


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/191a9b41
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/191a9b41
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/191a9b41

Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 191a9b41f2f67d16472e0ace293bf1dc0fe4cece
Parents: 572ee3c
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Tue Feb 4 17:40:42 2014 -0600
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Tue Feb 4 17:40:42 2014 -0600

----------------------------------------------------------------------
 src/ejson/c_src/decode.c              | 308 -----------
 src/ejson/c_src/ejson.c               |  30 -
 src/ejson/c_src/encode.c              | 200 -------
 src/ejson/c_src/erl_nif_compat.h      | 120 ----
 src/ejson/c_src/yajl/yajl.c           | 159 ------
 src/ejson/c_src/yajl/yajl_alloc.c     |  65 ---
 src/ejson/c_src/yajl/yajl_alloc.h     |  50 --
 src/ejson/c_src/yajl/yajl_buf.c       | 119 ----
 src/ejson/c_src/yajl/yajl_buf.h       |  73 ---
 src/ejson/c_src/yajl/yajl_bytestack.h |  85 ---
 src/ejson/c_src/yajl/yajl_common.h    |  85 ---
 src/ejson/c_src/yajl/yajl_encode.c    | 188 -------
 src/ejson/c_src/yajl/yajl_encode.h    |  50 --
 src/ejson/c_src/yajl/yajl_gen.c       | 322 -----------
 src/ejson/c_src/yajl/yajl_gen.h       | 159 ------
 src/ejson/c_src/yajl/yajl_lex.c       | 737 -------------------------
 src/ejson/c_src/yajl/yajl_lex.h       | 133 -----
 src/ejson/c_src/yajl/yajl_parse.h     | 193 -------
 src/ejson/c_src/yajl/yajl_parser.c    | 470 ----------------
 src/ejson/c_src/yajl/yajl_parser.h    |  95 ----
 src/ejson/src/ejson.app.src           |   9 -
 src/ejson/src/ejson.erl               | 168 ------
 src/ejson/src/mochijson2.erl          | 849 -----------------------------
 src/ejson/src/mochinum.erl            | 354 ------------
 24 files changed, 5021 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/decode.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/decode.c b/src/ejson/c_src/decode.c
deleted file mode 100644
index 68f1317..0000000
--- a/src/ejson/c_src/decode.c
+++ /dev/null
@@ -1,308 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "erl_nif.h"
-#include "erl_nif_compat.h"
-#include "yajl/yajl_parse.h"
-#include "yajl/yajl_parser.h"
-#include "yajl/yajl_lex.h"
-
-typedef struct {
-    ERL_NIF_TERM head;
-    ErlNifEnv* env;
-} decode_ctx;
-
-#define ENV(ctxarg) (((decode_ctx*)ctxarg)->env)
-
-#define CONTINUE 1
-#define CANCEL 0
-
-
-static ERL_NIF_TERM
-make_error(yajl_handle handle, ErlNifEnv* env)
-{
-    char* yajlError = (char*) yajl_get_error(handle, 0, NULL, 0);
-    ERL_NIF_TERM errMsg;
-
-    if(yajlError != NULL)
-    {
-        errMsg = enif_make_string(env, yajlError, ERL_NIF_LATIN1);
-        yajl_free_error(handle, (unsigned char*) yajlError);
-    }
-    else
-    {
-        errMsg = enif_make_string(env, "unknown parse error", ERL_NIF_LATIN1);
-    }
-
-    return enif_make_tuple(env, 2,
-        enif_make_atom(env, "error"),
-        enif_make_tuple(env, 2,
-            enif_make_uint(env, handle->bytesConsumed),
-            errMsg
-        )
-    );
-}
-
-
-static void
-add_to_head(void* vctx, ERL_NIF_TERM newhead)
-{
-    decode_ctx* ctx = (decode_ctx*)vctx;
-    ctx->head = enif_make_list_cell(ctx->env, newhead, ctx->head);
-}
-
-static int
-decode_null(void* ctx)
-{
-    add_to_head(ctx, enif_make_atom(ENV(ctx), "null"));
-    return CONTINUE;
-}
-
-static int
-decode_boolean(void* ctx, int val)
-{
-    add_to_head(ctx, enif_make_atom(ENV(ctx), val ? "true" : "false"));
-    return CONTINUE;
-}
-
-static int
-decode_number(void * ctx, const char * numberVal, unsigned int numberLen)
-{
-    // scan in the input to see if it's a float or int
-
-    int numberType = 0; // 0 means integer, 1 means float
-    unsigned int i;
-    ErlNifBinary bin;
-    int missingDot = 1;
-    unsigned int expPos;
-
-    for(i=0; i<numberLen; i++) {
-        switch (numberVal[i]) {
-        case '.':
-            missingDot = 0;
-            numberType = 1; // it's  a float
-            goto loopend;
-        case 'E':
-        case 'e':
-            expPos = i;
-            numberType = 1; // it's  a float
-            goto loopend;
-        }
-    }
-loopend:
-    if ((numberType == 1) && missingDot)
-    {
-        if(!enif_alloc_binary_compat(ENV(ctx), numberLen + 2, &bin))
-        {
-            return CANCEL;
-        }
-        memcpy(bin.data, numberVal, expPos);
-        bin.data[expPos] = '.';
-        bin.data[expPos + 1] = '0';
-        memcpy(bin.data + expPos + 2, numberVal + expPos, numberLen - expPos);
-    }
-    else
-    {
-        if(!enif_alloc_binary_compat(ENV(ctx), numberLen, &bin))
-        {
-            return CANCEL;
-        }
-        memcpy(bin.data, numberVal, numberLen);
-    }
-    add_to_head(ctx, enif_make_tuple(ENV(ctx), 2,
-                        enif_make_int(ENV(ctx), numberType),
-                        enif_make_binary(ENV(ctx), &bin)));
-    return CONTINUE;
-}
-
-
-
-static int
-decode_string(void* ctx, const unsigned char* data, unsigned int size)
-{
-    ErlNifBinary bin;
-    if(!enif_alloc_binary_compat(ENV(ctx), size, &bin))
-    {
-        return CANCEL;
-    }
-    memcpy(bin.data, data, size);
-    add_to_head(ctx, enif_make_binary(ENV(ctx), &bin));
-    return CONTINUE;
-}
-
-static int
-decode_start_array(void* ctx)
-{
-    add_to_head(ctx, enif_make_int(ENV(ctx), 0));
-    return CONTINUE;
-}
-
-
-static int
-decode_end_array(void* ctx)
-{
-    add_to_head(ctx, enif_make_int(ENV(ctx), 1));
-    return CONTINUE;
-}
-
-
-static int
-decode_start_map(void* ctx)
-{
-    add_to_head(ctx, enif_make_int(ENV(ctx), 2));
-    return CONTINUE;
-}
-
-
-static int
-decode_end_map(void* ctx)
-{
-    add_to_head(ctx, enif_make_int(ENV(ctx), 3));
-    return CONTINUE;
-}
-
-
-static int
-decode_map_key(void* ctx, const unsigned char* data, unsigned int size)
-{
-    ErlNifBinary bin;
-    if(!enif_alloc_binary_compat(ENV(ctx), size, &bin))
-    {
-       return CANCEL;
-    }
-    memcpy(bin.data, data, size);
-    add_to_head(ctx, enif_make_tuple(ENV(ctx), 2,
-                        enif_make_int(ENV(ctx), 3),
-                        enif_make_binary(ENV(ctx), &bin)));
-    return CONTINUE;
-}
-
-static yajl_callbacks
-decoder_callbacks = {
-    decode_null,
-    decode_boolean,
-    NULL,
-    NULL,
-    decode_number,
-    decode_string,
-    decode_start_map,
-    decode_map_key,
-    decode_end_map,
-    decode_start_array,
-    decode_end_array
-};
-
-static int
-check_rest(unsigned char* data, unsigned int size, unsigned int used)
-{
-    unsigned int i = 0;
-    for(i = used; i < size; i++)
-    {
-        switch(data[i])
-        {
-            case ' ':
-            case '\t':
-            case '\r':
-            case '\n':
-                continue;
-            default:
-                return CANCEL;
-        }
-    }
-
-    return CONTINUE;
-}
-
-ERL_NIF_TERM
-reverse_tokens(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
-{
-    decode_ctx ctx;
-    yajl_parser_config conf = {0, 1}; // No comments, check utf8
-    yajl_handle handle = yajl_alloc(&decoder_callbacks, &conf, NULL, &ctx);
-    yajl_status status;
-    unsigned int used;
-    ErlNifBinary bin;
-    ERL_NIF_TERM ret;
-
-    ctx.env = env;
-    ctx.head = enif_make_list_from_array(env, NULL, 0);
-
-    if(!enif_inspect_iolist_as_binary(env, argv[0], &bin))
-    {
-        ret = enif_make_badarg(env);
-        goto done;
-    }
-
-    status = yajl_parse(handle, bin.data, bin.size);
-    used = handle->bytesConsumed;
-
-    // Parsing something like "2.0" (without quotes) will
-    // cause a spurious semi-error. We add the extra size
-    // check so that "2008-20-10" doesn't pass.
-    if(status == yajl_status_insufficient_data && used == bin.size)
-    {
-        status = yajl_parse_complete(handle);
-    }
-
-    if(status == yajl_status_ok && used != bin.size)
-    {
-        if(check_rest(bin.data, bin.size, used) == CANCEL)
-        {
-            ret = enif_make_tuple(env, 2,
-                enif_make_atom(env, "error"),
-                enif_make_atom(env, "garbage_after_value")
-            );
-            goto done;
-        }
-    }
-
-    switch(status)
-    {
-        case yajl_status_ok:
-            ret = enif_make_tuple(env, 2, enif_make_atom(env, "ok"), ctx.head);
-            goto done;
-
-        case yajl_status_error:
-            ret = make_error(handle, env);
-            goto done;
-
-        case yajl_status_insufficient_data:
-            ret = enif_make_tuple(env, 2,
-                enif_make_atom(env, "error"),
-                enif_make_atom(env, "insufficient_data")
-            );
-            goto done;
-
-        case yajl_status_client_canceled:
-        /* the only time we do this is when we can't allocate a binary. */
-            ret = enif_make_tuple(env, 2,
-                enif_make_atom(env, "error"),
-                enif_make_atom(env, "insufficient_memory")
-            );
-            goto done;
-
-        default:
-            ret = enif_make_tuple(env, 2,
-                enif_make_atom(env, "error"),
-                enif_make_atom(env, "unknown")
-            );
-            goto done;
-    }
-
-done:
-    if(handle != NULL) yajl_free(handle);
-    return ret;
-}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/ejson.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/ejson.c b/src/ejson/c_src/ejson.c
deleted file mode 100644
index 390f762..0000000
--- a/src/ejson/c_src/ejson.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "erl_nif.h"
-
-ERL_NIF_TERM final_encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
-ERL_NIF_TERM reverse_tokens(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
-
-int
-on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM info)
-{
-    return 0;
-}
-
-int
-on_reload(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM info)
-{
-    return 0;
-}
-
-int
-on_upgrade(ErlNifEnv* env, void** priv_data, void** old_data, ERL_NIF_TERM info)
-{
-    return 0;
-}
-
-static ErlNifFunc nif_funcs[] =
-{
-    {"final_encode", 1, final_encode},
-    {"reverse_tokens", 1, reverse_tokens}
-};
-
-ERL_NIF_INIT(ejson, nif_funcs, &on_load, &on_reload, &on_upgrade, NULL);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/encode.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/encode.c b/src/ejson/c_src/encode.c
deleted file mode 100644
index 1dbd1df..0000000
--- a/src/ejson/c_src/encode.c
+++ /dev/null
@@ -1,200 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "erl_nif.h"
-#include "erl_nif_compat.h"
-#include "yajl/yajl_encode.h"
-
-#if defined(_WIN32) || defined(WIN32) || defined(__WIN32__)
-#include <float.h>
-#define isnan _isnan
-#define isinf !_finite
-#define snprintf _snprintf
-#endif
-
-#define SUCCESS 0
-#define NOMEM 1
-#define BADARG 2
-
-
-typedef struct {
-    ErlNifEnv* env;
-    ErlNifBinary bin;
-    size_t fill_offset;
-    int error;
-} encode_ctx;
-
-
-static int
-ensure_buffer(void* vctx, unsigned int len) {
-    encode_ctx* ctx = (encode_ctx*)vctx;
-    if ((ctx->bin.size - ctx->fill_offset) < len) {
-        if(!enif_realloc_binary_compat(ctx->env, &(ctx->bin), (ctx->bin.size * 2) + len)) {
-            return NOMEM;
-        }
-    }
-    return SUCCESS;
-}
-
-static void
-fill_buffer(void* vctx, const char* str, unsigned int len)
-{
-    encode_ctx* ctx = (encode_ctx*)vctx;
-
-    if (ctx->error || (ctx->error = ensure_buffer(vctx, len))) {
-        return;
-    }
-    memcpy(ctx->bin.data + ctx->fill_offset, str, len);
-    ctx->fill_offset += len;
-}
-
-/* Json encode the string binary into the ctx.bin,
-  with surrounding quotes and all */
-static int
-encode_string(void* vctx, ERL_NIF_TERM binary)
-{
-    encode_ctx* ctx = (encode_ctx*)vctx;
-    ErlNifBinary bin;
-
-    if(!enif_inspect_binary(ctx->env, binary, &bin)) {
-        return NOMEM;
-    }
-    fill_buffer(ctx, "\"", 1);
-    if (ctx->error) {
-        return ctx->error;
-    }
-    yajl_string_encode2(fill_buffer, ctx, bin.data, bin.size);
-    fill_buffer(ctx, "\"", 1);
-
-    return ctx->error;
-}
-
-static ERL_NIF_TERM
-no_mem_error(ErlNifEnv* env)
-{
-    return enif_make_tuple(env, 2,
-            enif_make_atom(env, "error"),
-            enif_make_atom(env, "insufficient_memory"));
-}
-
-ERL_NIF_TERM
-final_encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
-{
-    ERL_NIF_TERM head = argv[0];
-    ERL_NIF_TERM term;
-    double number;
-    encode_ctx ctx;
-    char* start;
-    size_t len;
-    size_t i;
-
-    ctx.env = env;
-    ctx.fill_offset = 0;
-    ctx.error = 0;
-
-    if (!enif_alloc_binary_compat(env, 100, &ctx.bin)) {
-            return no_mem_error(env);
-    }
-
-    while(enif_get_list_cell(env, head, &term, &head)) {
-        ErlNifBinary termbin;
-        const ERL_NIF_TERM* array;
-        int arity;
-        int code;
-
-        // We scan the list, looking for things to write into the binary, or
-        // encode and then write into the binary. We encode values that are
-        // tuples tagged with a type and a value: {Type, Value} where Type
-        // is a an Integer and Value is what is to be encoded
-
-        if (enif_get_tuple(env, term, &arity, &array)) {
-            // It's a tuple to encode and copy
-            if (arity != 2 || !enif_get_int(env, array[0], &code)) {
-                // not arity 2 or the first element isn't an int
-                ctx.error = BADARG;
-                goto done;
-            }
-            if (code == 0) {
-                // {0, String}
-                if (encode_string(&ctx, array[1]) != SUCCESS) {
-                    goto done;
-                }
-            }
-            else {
-                // {1, Double}
-                if(!enif_get_double(env, array[1], &number)) {
-                    ctx.error = BADARG;
-                    goto done;
-                }
-                // We can't encode these.
-                if (isnan(number) || isinf(number)) {
-                    ctx.error = BADARG;
-                    goto done;
-                }
-                if ((ctx.error = ensure_buffer(&ctx, 32)) != SUCCESS) {
-                    goto done;
-                }
-                // write the string into the buffer
-                start = (char*) (ctx.bin.data + ctx.fill_offset);
-                snprintf(start, 32, "%0.20g", number);
-                len = strlen(start);
-                for(i = 0; i < len; i++) {
-                    if(start[i] == '.' || start[i] == 'e' || start[i] == 'E') {
-                        break;
-                    }
-                }
-                if(i == len) {
-                    if(i > 29) {
-                        ctx.error = BADARG;
-                        goto done;
-                    }
-                    start[len++] = '.';
-                    start[len++] = '0';
-                }
-                // increment the length
-                ctx.fill_offset += len;
-            }
-        } else if (enif_inspect_binary(env, term, &termbin)) {
-            // this is a regular binary, copy the contents into the buffer
-            fill_buffer(&ctx, (char*)termbin.data, termbin.size);
-            if (ctx.error) {
-                goto done;
-            }
-        }
-        else {
-            //not a binary, not a tuple, wtf!
-            ctx.error = BADARG;
-            goto done;
-        }
-    }
-done:
-    if (ctx.error == NOMEM) {
-        enif_release_binary_compat(env, &ctx.bin);
-        return no_mem_error(env);
-    } else if (ctx.error == BADARG) {
-        enif_release_binary_compat(env, &ctx.bin);
-        return enif_make_badarg(env);
-    }
-
-    // Resize the binary to our exact final size
-    if(!enif_realloc_binary_compat(env, &(ctx.bin), ctx.fill_offset)) {
-        enif_release_binary_compat(env, &ctx.bin);
-        return no_mem_error(env);
-    }
-    // make the binary term which transfers ownership
-    return enif_make_binary(env, &ctx.bin);
-}
-

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/erl_nif_compat.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/erl_nif_compat.h b/src/ejson/c_src/erl_nif_compat.h
deleted file mode 100644
index 548ea7a..0000000
--- a/src/ejson/c_src/erl_nif_compat.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright (c) 2010-2011 Basho Technologies, Inc.
- * With some minor modifications for Apache CouchDB.
- *
- * This file is provided to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License.  You may obtain
- * a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-*/
-
-#ifndef ERL_NIF_COMPAT_H_
-#define ERL_NIF_COMPAT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include "erl_nif.h"
-
-
-#if ERL_NIF_MAJOR_VERSION == 0 && ERL_NIF_MINOR_VERSION == 1
-#define OTP_R13B03
-#elif ERL_NIF_MAJOR_VERSION == 1 && ERL_NIF_MINOR_VERSION == 0
-#define OTP_R13B04
-#elif ERL_NIF_MAJOR_VERSION == 2 && ERL_NIF_MINOR_VERSION == 0
-#define OTP_R14A
-#define OTP_R14B
-#define OTP_R14B01
-#elif ERL_NIF_MAJOR_VERSION == 2 && ERL_NIF_MINOR_VERSION == 1
-#define OTP_R14B02
-#endif
-
-
-#ifdef OTP_R13B03
-
-#define enif_open_resource_type_compat enif_open_resource_type
-#define enif_alloc_resource_compat enif_alloc_resource
-#define enif_release_resource_compat enif_release_resource
-#define enif_alloc_binary_compat enif_alloc_binary
-#define enif_alloc_compat enif_alloc
-#define enif_release_binary_compat enif_release_binary
-#define enif_free_compat enif_free
-#define enif_get_atom_compat enif_get_atom
-#define enif_priv_data_compat enif_get_data
-#define enif_make_uint_compat enif_make_ulong
-
-#define enif_make_string_compat(E, B, Enc) \
-    enif_make_string(E, B)
-
-#endif /* R13B03 */
-
-
-#ifdef OTP_R13B04
-
-#define enif_open_resource_type_compat enif_open_resource_type
-#define enif_alloc_resource_compat enif_alloc_resource
-#define enif_release_resource_compat enif_release_resource
-#define enif_alloc_binary_compat enif_alloc_binary
-#define enif_realloc_binary_compat enif_realloc_binary
-#define enif_release_binary_compat enif_release_binary
-#define enif_alloc_compat enif_alloc
-#define enif_free_compat enif_free
-#define enif_get_atom_compat enif_get_atom
-#define enif_priv_data_compat enif_priv_data
-#define enif_make_string_compat enif_make_string
-#define enif_make_uint_compat enif_make_uint
-
-#endif /* R13B04 */
-
-
-/* OTP R14 and future releases */
-#if !defined(OTP_R13B03) && !defined(OTP_R13B04)
-
-#define enif_open_resource_type_compat(E, N, D, F, T) \
-    enif_open_resource_type(E, NULL, N, D, F, T)
-
-#define enif_alloc_resource_compat(E, T, S) \
-    enif_alloc_resource(T, S)
-
-#define enif_release_resource_compat(E, H) \
-    enif_release_resource(H)
-
-#define enif_alloc_binary_compat(E, S, B) \
-    enif_alloc_binary(S, B)
-
-#define enif_realloc_binary_compat(E, S, B) \
-    enif_realloc_binary(S, B)
-
-#define enif_release_binary_compat(E, B) \
-    enif_release_binary(B)
-
-#define enif_alloc_compat(E, S) \
-    enif_alloc(S)
-
-#define enif_free_compat(E, P) \
-    enif_free(P)
-
-#define enif_get_atom_compat(E, T, B, S) \
-    enif_get_atom(E, T, B, S, ERL_NIF_LATIN1)
-
-#define enif_priv_data_compat enif_priv_data
-#define enif_make_string_compat enif_make_string
-#define enif_make_uint_compat enif_make_uint
-
-#endif  /* R14 and future releases */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ERL_NIF_COMPAT_H_ */

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl.c b/src/ejson/c_src/yajl/yajl.c
deleted file mode 100644
index 39d8b9f..0000000
--- a/src/ejson/c_src/yajl/yajl.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2010, 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_parse.h"
-#include "yajl_lex.h"
-#include "yajl_parser.h"
-#include "yajl_alloc.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-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->bytesConsumed = 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)
-{
-    yajl_status status;
-    status = yajl_do_parse(hand, 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);
-}
-
-unsigned int
-yajl_get_bytes_consumed(yajl_handle hand)
-{
-    if (!hand) return 0;
-    else return hand->bytesConsumed;
-}
-
-
-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 */

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_alloc.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_alloc.c b/src/ejson/c_src/yajl/yajl_alloc.c
deleted file mode 100644
index ccfb7c3..0000000
--- a/src/ejson/c_src/yajl/yajl_alloc.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2010, 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 <stdlib.h>
-
-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;
-}
-

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_alloc.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_alloc.h b/src/ejson/c_src/yajl/yajl_alloc.h
deleted file mode 100644
index cc1e5cf..0000000
--- a/src/ejson/c_src/yajl/yajl_alloc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2010, 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 "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

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_buf.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_buf.c b/src/ejson/c_src/yajl/yajl_buf.c
deleted file mode 100644
index 04e608a..0000000
--- a/src/ejson/c_src/yajl/yajl_buf.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2010, 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 <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#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;
-}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_buf.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_buf.h b/src/ejson/c_src/yajl/yajl_buf.h
deleted file mode 100644
index a6dcbe9..0000000
--- a/src/ejson/c_src/yajl/yajl_buf.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2010, 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 "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

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_bytestack.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_bytestack.h b/src/ejson/c_src/yajl/yajl_bytestack.h
deleted file mode 100644
index 3b49d17..0000000
--- a/src/ejson/c_src/yajl/yajl_bytestack.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2010, 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 "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

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_common.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_common.h b/src/ejson/c_src/yajl/yajl_common.h
deleted file mode 100644
index a227deb..0000000
--- a/src/ejson/c_src/yajl/yajl_common.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2010, 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

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_encode.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_encode.c b/src/ejson/c_src/yajl/yajl_encode.c
deleted file mode 100644
index ad5b1c5..0000000
--- a/src/ejson/c_src/yajl/yajl_encode.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2010, 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 <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-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)
-{
-    yajl_string_encode2((const yajl_print_t) &yajl_buf_append, buf, str, len);
-}
-
-void
-yajl_string_encode2(const yajl_print_t print,
-                    void * ctx,
-                    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) {
-            print(ctx, (const char *) (str + beg), end - beg);
-            print(ctx, escaped, strlen(escaped));
-            beg = ++end;
-        } else {
-            ++end;
-        }
-    }
-    print(ctx, (const char *) (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);
-}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_encode.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_encode.h b/src/ejson/c_src/yajl/yajl_encode.h
deleted file mode 100644
index 3e3b092..0000000
--- a/src/ejson/c_src/yajl/yajl_encode.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2010, 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"
-#include "yajl_gen.h"
-
-void yajl_string_encode2(const yajl_print_t printer,
-                         void * ctx,
-                         const unsigned char * str,
-                         unsigned int length);
-
-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

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_gen.c
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_gen.c b/src/ejson/c_src/yajl/yajl_gen.c
deleted file mode 100644
index 6cfda0a..0000000
--- a/src/ejson/c_src/yajl/yajl_gen.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright 2010, 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_gen.h"
-#include "yajl_buf.h"
-#include "yajl_encode.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-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_print_t print;
-    void * ctx; /* yajl_buf */
-    /* memory allocation routines */
-    yajl_alloc_funcs alloc;
-};
-
-yajl_gen
-yajl_gen_alloc(const yajl_gen_config * config,
-               const yajl_alloc_funcs * afs)
-{
-    return yajl_gen_alloc2(NULL, config, afs, NULL);
-}
-
-yajl_gen
-yajl_gen_alloc2(const yajl_print_t callback,
-                const yajl_gen_config * config,
-                const yajl_alloc_funcs * afs,
-                void * ctx)
-{
-    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 : "  ";
-    }
-
-    if (callback) {
-        g->print = callback;
-        g->ctx = ctx;
-    } else {
-        g->print = (yajl_print_t)&yajl_buf_append;
-        g->ctx = yajl_buf_alloc(&(g->alloc));
-    }
-
-    return g;
-}
-
-void
-yajl_gen_free(yajl_gen g)
-{
-    if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_free((yajl_buf)g->ctx);
-    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) {              \
-        g->print(g->ctx, ",", 1);                               \
-        if (g->pretty) g->print(g->ctx, "\n", 1);               \
-    } else if (g->state[g->depth] == yajl_gen_map_val) {        \
-        g->print(g->ctx, ":", 1);                               \
-        if (g->pretty) g->print(g->ctx, " ", 1);                \
-   } 
-
-#define INSERT_WHITESPACE                                               \
-    if (g->pretty) {                                                    \
-        if (g->state[g->depth] != yajl_gen_map_val) {                   \
-            unsigned int _i;                                            \
-            for (_i=0;_i<g->depth;_i++)                                 \
-                g->print(g->ctx, 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) \
-        g->print(g->ctx, "\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);
-    g->print(g->ctx, i, strlen(i));
-    APPENDED_ATOM;
-    FINAL_NEWLINE;
-    return yajl_gen_status_ok;
-}
-
-#if defined(_WIN32) || defined(WIN32) || defined(__WIN32__)
-#include <float.h>
-#define isnan _isnan
-#define isinf !_finite
-#endif
-
-yajl_gen_status
-yajl_gen_double(yajl_gen g, double number)
-{
-    char i[32];
-    ENSURE_VALID_STATE; ENSURE_NOT_KEY; 
-    if (isnan(number) || isinf(number)) return yajl_gen_invalid_number;
-    INSERT_SEP; INSERT_WHITESPACE;
-    sprintf(i, "%g", number);
-    g->print(g->ctx, 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;
-    g->print(g->ctx, 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;
-    g->print(g->ctx, "\"", 1);
-    yajl_string_encode2(g->print, g->ctx, str, len);
-    g->print(g->ctx, "\"", 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;
-    g->print(g->ctx, "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;
-    g->print(g->ctx, 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;
-    g->print(g->ctx, "{", 1);
-    if (g->pretty) g->print(g->ctx, "\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) g->print(g->ctx, "\n", 1);
-    APPENDED_ATOM;
-    INSERT_WHITESPACE;
-    g->print(g->ctx, "}", 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;
-    g->print(g->ctx, "[", 1);
-    if (g->pretty) g->print(g->ctx, "\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) g->print(g->ctx, "\n", 1);
-    (g->depth)--;
-    APPENDED_ATOM;
-    INSERT_WHITESPACE;
-    g->print(g->ctx, "]", 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)
-{
-    if (g->print != (yajl_print_t)&yajl_buf_append) return yajl_gen_no_buf;
-    *buf = yajl_buf_data((yajl_buf)g->ctx);
-    *len = yajl_buf_len((yajl_buf)g->ctx);
-    return yajl_gen_status_ok;
-}
-
-void
-yajl_gen_clear(yajl_gen g)
-{
-    if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_clear((yajl_buf)g->ctx);
-}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/191a9b41/src/ejson/c_src/yajl/yajl_gen.h
----------------------------------------------------------------------
diff --git a/src/ejson/c_src/yajl/yajl_gen.h b/src/ejson/c_src/yajl/yajl_gen.h
deleted file mode 100644
index 97c2042..0000000
--- a/src/ejson/c_src/yajl/yajl_gen.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2010, 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_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_double was passed an invalid floating point value
-         *  (infinity or NaN). */
-        yajl_gen_invalid_number,
-        /** A print callback was passed in, so there is no internal
-         * buffer to get from */
-        yajl_gen_no_buf
-    } yajl_gen_status;
-
-    /** an opaque handle to a generator */
-    typedef struct yajl_gen_t * yajl_gen;
-
-    /** a callback used for "printing" the results. */
-    typedef void (*yajl_print_t)(void * ctx,
-                                 const char * str,
-                                 unsigned int len);
-
-    /** 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_API yajl_gen yajl_gen_alloc(const yajl_gen_config * config,
-                                     const yajl_alloc_funcs * allocFuncs);
-
-    /** allocate a generator handle that will print to the specified
-     *  callback rather than storing the results in an internal buffer.
-     *  \param callback   a pointer to a printer function.  May be NULL
-     *                    in which case, the results will be store in an
-     *                    internal buffer.
-     *  \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.
-     *  \param ctx        a context pointer that will be passed to the
-     *                    printer callback.
-     *
-     *  \returns an allocated handle on success, NULL on failure (bad params)
-     */
-    YAJL_API yajl_gen yajl_gen_alloc2(const yajl_print_t callback,
-                                      const yajl_gen_config * config,
-                                      const yajl_alloc_funcs * allocFuncs,
-                                      void * ctx);
-
-    /** free a generator handle */    
-    YAJL_API void yajl_gen_free(yajl_gen handle);
-
-    YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long int number);
-    /** generate a floating point number.  number may not be infinity or
-     *  NaN, as these have no representation in JSON.  In these cases the
-     *  generator will return 'yajl_gen_invalid_number' */
-    YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);
-    YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand,
-                                             const char * num,
-                                             unsigned int len);
-    YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand,
-                                             const unsigned char * str,
-                                             unsigned int len);
-    YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);
-    YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);    
-    YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand);
-    YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand);
-    YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand);
-    YAJL_API yajl_gen_status 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_API yajl_gen_status 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. */
-    YAJL_API void yajl_gen_clear(yajl_gen hand);
-
-#ifdef __cplusplus
-}
-#endif    
-
-#endif


Mime
View raw message