avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject svn commit: r825593 [2/3] - in /hadoop/avro/trunk/src/c: ./ avro_schema_tests/ avro_schema_tests/fail/ avro_schema_tests/pass/ json/ json/fail/ json/pass/ json_tests/ json_tests/fail/ json_tests/pass/
Date Thu, 15 Oct 2009 18:00:26 GMT
Added: hadoop/avro/trunk/src/c/avro_long.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_long.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_long.c (added)
+++ hadoop/avro/trunk/src/c/avro_long.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,113 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+struct avro_long_value
+{
+  avro_long_t value;
+  int value_set;
+  struct avro_value base_value;
+};
+
+static void
+avro_long_print (struct avro_value *value, FILE * fp)
+{
+  struct avro_long_value *self =
+    container_of (value, struct avro_long_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "long");
+  if (self->value_set)
+    {
+      fprintf (fp, " value=%ld", self->value);
+    }
+  fprintf (fp, "\n");
+}
+
+static avro_status_t
+avro_long_read_skip (struct avro_value *value, struct avro_channel *channel,
+		     int skip)
+{
+  struct avro_long_value *self =
+    container_of (value, struct avro_long_value, base_value);
+  struct avro_io *io;
+  if (!channel)
+    {
+      return AVRO_FAILURE;
+    }
+  io = channel->io;
+  if (!io)
+    {
+      return AVRO_FAILURE;
+    }
+  self->value_set = !skip;
+  return avro_getlong (io, &self->value);
+}
+
+static avro_status_t
+avro_long_read (struct avro_value *value, struct avro_channel *channel)
+{
+  return avro_long_read_skip (value, channel, 0);
+}
+
+static avro_status_t
+avro_long_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  return avro_long_read_skip (value, channel, 1);
+}
+
+static avro_status_t
+avro_long_write (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_long_value *self =
+    container_of (value, struct avro_long_value, base_value);
+  struct avro_io *io;
+  if (!value || !channel)
+    {
+      return AVRO_FAILURE;
+    }
+  io = channel->io;
+  if (!io)
+    {
+      return AVRO_FAILURE;
+    }
+  return avro_putlong (io, &self->value);
+}
+
+struct avro_value *
+avro_long_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		  apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_long_value *self =
+    apr_palloc (pool, sizeof (struct avro_long_value));
+  DEBUG (fprintf (stderr, "Creating long\n"));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_LONG;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = avro_long_read;
+  self->base_value.skip_data = avro_long_skip;
+  self->base_value.write_data = avro_long_write;
+  self->base_value.print_info = avro_long_print;
+  self->value_set = 0;
+  return &self->base_value;
+}

Added: hadoop/avro/trunk/src/c/avro_map.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_map.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_map.c (added)
+++ hadoop/avro/trunk/src/c/avro_map.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,115 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+struct avro_map_value
+{
+  apr_hash_t *map;
+  struct avro_value *keys;
+  struct avro_value *values;
+  struct avro_value base_value;
+};
+
+static void
+avro_map_print (struct avro_value *value, FILE * fp)
+{
+  struct avro_map_value *self =
+    container_of (value, struct avro_map_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "map key/value\n");
+  self->keys->print_info (self->keys, fp);
+  self->values->print_info (self->values, fp);
+}
+
+static avro_status_t
+avro_map_read (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_map_value *self =
+    container_of (value, struct avro_map_value, base_value);
+  return AVRO_OK;
+}
+
+static avro_status_t
+avro_map_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_map_value *self =
+    container_of (value, struct avro_map_value, base_value);
+  return AVRO_OK;
+}
+
+static avro_status_t
+avro_map_write (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_map_value *self =
+    container_of (value, struct avro_map_value, base_value);
+  return AVRO_OK;
+}
+
+struct avro_value *
+avro_map_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		 apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_map_value *self;
+  const JSON_value *keys;
+  const JSON_value *values;
+
+  DEBUG (fprintf (stderr, "Creating map\n"));
+  self = apr_palloc (pool, sizeof (struct avro_map_value));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_MAP;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = avro_map_read;
+  self->base_value.skip_data = avro_map_skip;
+  self->base_value.write_data = avro_map_write;
+  self->base_value.print_info = avro_map_print;
+
+  /* collect and save required keys */
+  keys = json_attr_get (json, L"keys");
+  if (keys)
+    {
+      self->keys = avro_value_from_json (ctx, &self->base_value, keys);
+      if (!self->keys)
+	{
+	  return NULL;
+	}
+    }
+  else
+    {
+      /* TODO: should keys default to string? */
+      self->keys = avro_string_create (ctx, &self->base_value, pool, NULL);
+    }
+
+  /* collect and save required values */
+  values = json_attr_get (json, L"values");
+  if (!values)
+    {
+      return NULL;
+    }
+  self->values = avro_value_from_json (ctx, &self->base_value, values);
+  if (!self->values)
+    {
+      return NULL;
+    }
+  return &self->base_value;
+}

Added: hadoop/avro/trunk/src/c/avro_null.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_null.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_null.c (added)
+++ hadoop/avro/trunk/src/c/avro_null.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,53 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+static avro_status_t
+avro_null_noop (struct avro_value *value, struct avro_channel *channel)
+{
+  return AVRO_OK;
+}
+
+static void
+avro_null_print (struct avro_value *value, FILE * fp)
+{
+  avro_value_indent (value, fp);
+  fprintf (fp, "null\n");
+}
+
+struct avro_value *
+avro_null_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		  apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_value *self = apr_palloc (pool, sizeof (struct avro_value));
+  DEBUG (fprintf (stderr, "Creating null\n"));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->type = AVRO_NULL;
+  self->pool = pool;
+  self->parent = parent;
+  self->schema = json;
+  self->read_data = avro_null_noop;
+  self->skip_data = avro_null_noop;
+  self->write_data = avro_null_noop;
+  self->print_info = avro_null_print;
+  return self;
+}

Added: hadoop/avro/trunk/src/c/avro_primitives.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_primitives.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_primitives.c (added)
+++ hadoop/avro/trunk/src/c/avro_primitives.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,297 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+
+#include "avro_private.h"
+#include <stdlib.h>
+
+avro_status_t
+avro_putstring (struct avro_io *io, apr_pool_t * pool, avro_string_t string)
+{
+  avro_status_t status;
+  size_t wc_len, converted;
+  avro_long_t len;
+  char *s;
+  if (!io)
+    {
+      return AVRO_FAILURE;
+    }
+  wc_len = wcslen ((const wchar_t *) string);
+
+  /* TODO: how to calculate the number of char needed for wc_len 
+     assuming max for now */
+  s = apr_pcalloc (pool, wc_len * 4);
+  if (!s)
+    {
+      return AVRO_FAILURE;
+    }
+
+  converted = wcstombs (s, string, wc_len * 4);
+  if (converted < 0)
+    {
+      return AVRO_FAILURE;
+    }
+  len = converted;
+  status = avro_putlong (io, &len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  return io->write (io, s, len);
+}
+
+avro_status_t
+avro_getstring (struct avro_io * io, apr_pool_t * pool,
+		avro_string_t * string)
+{
+  avro_status_t status;
+  avro_long_t len;
+  size_t converted;
+  char *s;
+
+  if (!io || !pool || !string)
+    {
+      return AVRO_FAILURE;
+    }
+  status = avro_getlong (io, &len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  if (len < 0)
+    {
+      return AVRO_FAILURE;
+    }
+  s = apr_pcalloc (pool, len + 1);
+  if (!s)
+    {
+      return AVRO_FAILURE;
+    }
+  status = io->read (io, s, len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  s[len] = '\0';
+
+  /* TODO: calculate this more exactly... assuming char len == wchar len is wrong */
+  *string = apr_pcalloc (pool, (len + 1) * sizeof (wchar_t));
+  if (!*string)
+    {
+      return AVRO_FAILURE;
+    }
+  converted = mbstowcs (*string, s, len);
+  if (converted < 0)
+    {
+      return AVRO_FAILURE;
+    }
+  (*string)[converted] = '\0';
+  return AVRO_OK;
+}
+
+avro_status_t
+avro_putbytes (struct avro_io * io, char *data, avro_long_t len)
+{
+  avro_status_t status;
+  if (!io || !data || len < 0)
+    {
+      return AVRO_FAILURE;
+    }
+  status = avro_putlong (io, &len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  return io->write (io, data, len);
+}
+
+avro_status_t
+avro_getbytes (struct avro_io * io, apr_pool_t * pool, char **data,
+	       avro_long_t * len)
+{
+  avro_status_t status;
+  if (!io || !pool || !data || !len)
+    {
+      return AVRO_FAILURE;
+    }
+  status = avro_getlong (io, len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  *data = (char *) apr_pcalloc (pool, *len);
+  if (!*data)
+    {
+      return AVRO_FAILURE;
+    }
+  return io->read (io, *data, *len);
+}
+
+avro_status_t
+avro_putbool (struct avro_io * io, int boolean)
+{
+  char b;
+  if (!io)
+    {
+      return AVRO_FAILURE;
+    }
+  b = boolean;
+  return io->write (io, &b, 1);
+}
+
+avro_status_t
+avro_getbool (struct avro_io * io, int *boolean)
+{
+  avro_status_t status;
+  char b;
+  if (!io || !boolean)
+    {
+      return AVRO_FAILURE;
+    }
+  status = io->read (io, &b, 1);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  *boolean = b;
+  return AVRO_OK;
+}
+
+avro_status_t
+avro_putint (struct avro_io * io, avro_int_t * ip)
+{
+  avro_status_t status;
+  int32_t n = *ip;
+  uint8_t b;
+
+  if (!io || !ip)
+    {
+      return AVRO_FAILURE;
+    }
+
+  /* move sign to low-order bit */
+  n = (n << 1) ^ (n >> 31);
+  while ((n & ~0x7F) != 0)
+    {
+      b = ((((uint8_t) n) & 0x7F) | 0x80);
+      status = io->write (io, (char *) &b, 1);
+      if (status != AVRO_OK)
+	{
+	  return status;
+	}
+      n >>= 7;
+    }
+  b = (uint8_t) n;
+  return io->write (io, (char *) &b, 1);
+}
+
+avro_status_t
+avro_putlong (struct avro_io *io, avro_long_t * lp)
+{
+  avro_status_t status;
+  int64_t n = *lp;
+  uint8_t b;
+
+  if (!io || !lp)
+    {
+      return AVRO_FAILURE;
+    }
+
+  /* move sign to low-order bit */
+  n = (n << 1) ^ (n >> 63);
+  while ((n & ~0x7F) != 0)
+    {
+      b = ((((uint8_t) n) & 0x7F) | 0x80);
+      status = io->write (io, (char *) &b, 1);
+      if (status != AVRO_OK)
+	{
+	  return status;
+	}
+      n >>= 7;
+    }
+  b = (uint8_t) n;
+  return io->write (io, (char *) &b, 1);
+}
+
+avro_status_t
+avro_getint (struct avro_io *io, avro_int_t * ip)
+{
+  avro_status_t status;
+  int64_t value = 0;
+  int offset = 0;
+  uint8_t b;
+  const int MAX_VARINT_BUF_SIZE = 5;
+
+  if (!io || !ip)
+    {
+      return AVRO_FAILURE;
+    }
+
+  do
+    {
+      if (offset == MAX_VARINT_BUF_SIZE)
+	{
+	  return AVRO_FAILURE;
+	}
+      status = io->read (io, (char *) &b, 1);
+      if (status != AVRO_OK)
+	{
+	  return status;
+	}
+      value |= (int32_t) (b & 0x7F) << (7 * offset);
+      ++offset;
+    }
+  while (b & 0x80);
+  /* back to two's-complement value; */
+  *ip = (value >> 1) ^ -(value & 1);
+  return AVRO_OK;
+}
+
+avro_status_t
+avro_getlong (struct avro_io * io, avro_long_t * lp)
+{
+  avro_status_t status;
+  int64_t value = 0;
+  int offset = 0;
+  uint8_t b;
+  const int MAX_VARINT_BUF_SIZE = 10;
+
+  if (!io || !lp)
+    {
+      return AVRO_FAILURE;
+    }
+
+  do
+    {
+      if (offset == MAX_VARINT_BUF_SIZE)
+	{
+	  return AVRO_FAILURE;
+	}
+      status = io->read (io, (char *) &b, 1);
+      if (status != AVRO_OK)
+	{
+	  return status;
+	}
+      value |= (int64_t) (b & 0x7F) << (7 * offset);
+      ++offset;
+    }
+  while (b & 0x80);
+  /* back to two's-complement value; */
+  *lp = (value >> 1) ^ -(value & 1);
+  return AVRO_OK;
+}

Added: hadoop/avro/trunk/src/c/avro_private.h
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_private.h?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_private.h (added)
+++ hadoop/avro/trunk/src/c/avro_private.h Thu Oct 15 18:00:21 2009
@@ -0,0 +1,216 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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 AVRO_PRIVATE_H
+#define AVRO_PRIVATE_H
+
+/* Private internal structures. This is not part of the public API so never program to it. */
+#include <stdio.h>
+#include <stdarg.h>
+#include "avro.h"
+#include "json.h"
+#include "apr_hash.h"
+#include "apr_tables.h"
+#include "apr_pools.h"
+#include "apr_file_io.h"
+#include "apr_network_io.h"
+
+/* Util function */
+char *avro_util_file_read_full (apr_pool_t * pool, const char *fname,
+				apr_size_t * len);
+
+/* string */
+typedef wchar_t *avro_string_t;
+/* int */
+typedef int32_t avro_int_t;
+/* long */
+typedef int64_t avro_long_t;
+
+/* functions for reading and writing bytes */
+struct avro_io
+{
+  avro_status_t (*read) (struct avro_io * io, char *addr, uint64_t len);
+  avro_status_t (*skip) (struct avro_io * io, uint64_t len);
+  avro_status_t (*write) (struct avro_io * io, char *addr, uint64_t len);
+};
+typedef struct avro_io avro_io;
+
+/* list of avro formats */
+enum avro_format
+{
+  AVRO_BINARY_FORMAT,
+  AVRO_JSON_IMPORT_EXPORT_FORMAT
+};
+typedef enum avro_format avro_format;
+
+/* generic communication channel for sending/receiving avro data */
+struct avro_channel
+{
+  avro_format format;
+  avro_io *io;
+};
+typedef struct avro_channel avro_channel;
+
+/* General struct that all values implement */
+struct avro_value
+{
+  avro_type_t type;
+  apr_pool_t *pool;
+  const JSON_value *schema;
+  struct avro_value *parent;
+
+    avro_status_t (*read_data) (struct avro_value * value,
+				struct avro_channel * channel);
+    avro_status_t (*skip_data) (struct avro_value * value,
+				struct avro_channel * channel);
+    avro_status_t (*write_data) (struct avro_value * value,
+				 struct avro_channel * channel);
+  void (*print_info) (struct avro_value * value, FILE * fp);
+};
+typedef struct avro_value avro_value;
+
+/* Globals used during schema creation */
+struct avro_value_ctx
+{
+  apr_hash_t *named_objects;
+};
+
+/* Create a new avro value from json */
+struct avro_value *avro_value_create (apr_pool_t * pool, char *jsontext,
+				      apr_size_t textlen);
+struct avro_value *avro_value_from_json (struct avro_value_ctx *ctx,
+					 struct avro_value *parent,
+					 const JSON_value * json);
+
+struct avro_value *avro_record_create (struct avro_value_ctx *ctx,
+				       struct avro_value *parent,
+				       apr_pool_t * pool,
+				       const JSON_value * schema);
+struct avro_value *avro_string_create (struct avro_value_ctx *ctx,
+				       struct avro_value *parent,
+				       apr_pool_t * pool,
+				       const JSON_value * schema);
+struct avro_value *avro_boolean_create (struct avro_value_ctx *ctx,
+					struct avro_value *parent,
+					apr_pool_t * pool,
+					const JSON_value * schema);
+struct avro_value *avro_bytes_create (struct avro_value_ctx *ctx,
+				      struct avro_value *parent,
+				      apr_pool_t * pool,
+				      const JSON_value * schema);
+struct avro_value *avro_int_create (struct avro_value_ctx *ctx,
+				    struct avro_value *parent,
+				    apr_pool_t * pool,
+				    const JSON_value * schema);
+struct avro_value *avro_long_create (struct avro_value_ctx *ctx,
+				     struct avro_value *parent,
+				     apr_pool_t * pool,
+				     const JSON_value * schema);
+struct avro_value *avro_float_create (struct avro_value_ctx *ctx,
+				      struct avro_value *parent,
+				      apr_pool_t * pool,
+				      const JSON_value * schema);
+struct avro_value *avro_double_create (struct avro_value_ctx *ctx,
+				       struct avro_value *parent,
+				       apr_pool_t * pool,
+				       const JSON_value * schema);
+struct avro_value *avro_null_create (struct avro_value_ctx *ctx,
+				     struct avro_value *parent,
+				     apr_pool_t * pool,
+				     const JSON_value * schema);
+struct avro_value *avro_enum_create (struct avro_value_ctx *ctx,
+				     struct avro_value *parent,
+				     apr_pool_t * pool,
+				     const JSON_value * schema);
+struct avro_value *avro_fixed_create (struct avro_value_ctx *ctx,
+				      struct avro_value *parent,
+				      apr_pool_t * pool,
+				      const JSON_value * schema);
+struct avro_value *avro_map_create (struct avro_value_ctx *ctx,
+				    struct avro_value *parent,
+				    apr_pool_t * pool,
+				    const JSON_value * schema);
+struct avro_value *avro_array_create (struct avro_value_ctx *ctx,
+				      struct avro_value *parent,
+				      apr_pool_t * pool,
+				      const JSON_value * schema);
+struct avro_value *avro_union_create (struct avro_value_ctx *ctx,
+				      struct avro_value *parent,
+				      apr_pool_t * pool,
+				      const JSON_value * schema);
+
+const avro_type_t *avro_type_lookup (const avro_string_t name);
+const avro_type_t *avro_type_from_json (const JSON_value * json);
+
+/* Helper utility for reading an attribute from a JSON object */
+const JSON_value *json_attr_get (const JSON_value * obj, const wchar_t * key);
+/* Helper utility for reading an attribute from JSON w/type checking */
+const JSON_value *json_attr_get_check_type (const JSON_value * obj,
+					    const wchar_t * key,
+					    JSON_type type);
+/* Helper utility for printing the indent */
+void avro_value_indent (struct avro_value *value, FILE * fp);
+
+struct avro_io *avro_io_file_create (apr_file_t * file);
+struct avro_io *avro_io_socket_create (apr_socket_t * socket);
+struct avro_io *avro_io_memory_create (apr_pool_t * pool, char *addr,
+				       int64_t len);
+
+struct avro_channel *avro_file_container_create_from_file (apr_file_t * file);
+struct avro_channel *avro_file_container_create (apr_pool_t * pool,
+						 const char *fname,
+						 apr_int32_t flag,
+						 apr_fileperms_t perm);
+
+/* Endian helpers */
+avro_status_t avro_getint32_le (struct avro_io *io, int32_t * value);
+avro_status_t avro_putint32_le (struct avro_io *io, const int32_t value);
+avro_status_t avro_getint32_be (struct avro_io *io, int32_t * value);
+avro_status_t avro_putint32_be (struct avro_io *io, const int32_t value);
+avro_status_t avro_getint64_le (struct avro_io *io, int64_t * value);
+avro_status_t avro_putint64_le (struct avro_io *io, const int64_t value);
+avro_status_t avro_getint64_be (struct avro_io *io, int64_t * value);
+avro_status_t avro_putint64_be (struct avro_io *io, const int64_t value);
+
+/* Primitive IO Functions */
+avro_status_t avro_putstring (struct avro_io *io, apr_pool_t * pool,
+			      avro_string_t string);
+avro_status_t avro_getstring (struct avro_io *io, apr_pool_t * pool,
+			      avro_string_t * string);
+avro_status_t avro_putbytes (struct avro_io *io, char *data, int64_t len);
+avro_status_t avro_getbytes (struct avro_io *io, apr_pool_t * pool,
+			     char **data, int64_t * len);
+avro_status_t avro_putbool (struct avro_io *io, int boolean);
+avro_status_t avro_getbool (struct avro_io *io, int *boolean);
+avro_status_t avro_putint (struct avro_io *io, avro_int_t * ip);
+avro_status_t avro_putlong (struct avro_io *io, avro_long_t * lp);
+avro_status_t avro_getint (struct avro_io *io, avro_int_t * ip);
+avro_status_t avro_getlong (struct avro_io *io, avro_long_t * lp);
+
+#define DEBUGGING 0
+
+#if DEBUGGING
+#define DEBUG(__cmd) __cmd
+#else
+#define DEBUG(__cmd)
+#endif
+
+#include "container_of.h"
+#include "json.h"
+
+#endif

Added: hadoop/avro/trunk/src/c/avro_record.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_record.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_record.c (added)
+++ hadoop/avro/trunk/src/c/avro_record.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,272 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+struct avro_field_value
+{
+  avro_string_t name;
+  struct avro_value *value;
+  struct avro_value *default_value;
+
+  avro_value base_value;
+};
+
+struct avro_record_value
+{
+  avro_string_t name;
+  avro_string_t space;
+  apr_array_header_t *fields;
+
+  avro_value base_value;
+};
+
+static void
+field_print (struct avro_value *value, FILE * fp)
+{
+  struct avro_field_value *self =
+    container_of (value, struct avro_field_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "field name=%ls\n", self->name);
+  self->value->print_info (self->value, fp);
+}
+
+static void
+record_print (struct avro_value *value, FILE * fp)
+{
+  int i;
+  struct avro_record_value *self =
+    container_of (value, struct avro_record_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "record name=%ls\n", self->name);
+  for (i = 0; i < self->fields->nelts; i++)
+    {
+      struct avro_value *field =
+	((struct avro_value **) self->fields->elts)[i];
+      field->print_info (field, fp);
+    }
+}
+
+/* FIELDS */
+static avro_status_t
+field_read (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_field_value *self =
+    container_of (value, struct avro_field_value, base_value);
+  return self->value->read_data (self->value, channel);
+}
+
+static avro_status_t
+field_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_field_value *self =
+    container_of (value, struct avro_field_value, base_value);
+  return self->value->skip_data (self->value, channel);
+}
+
+static avro_status_t
+field_write (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_field_value *self =
+    container_of (value, struct avro_field_value, base_value);
+  return self->value->write_data (self->value, channel);
+}
+
+/* Private */
+static struct avro_value *
+avro_field_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		   apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_field_value *self =
+    apr_palloc (pool, sizeof (struct avro_field_value));
+  const JSON_value *name;
+  const JSON_value *type;
+
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_FIELD;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = field_read;
+  self->base_value.skip_data = field_skip;
+  self->base_value.write_data = field_write;
+  self->base_value.print_info = field_print;
+
+  /* collect and save required name */
+  name = json_attr_get_check_type (json, L"name", JSON_STRING);
+  if (!name)
+    {
+      return NULL;
+    }
+  self->name = name->json_string;
+
+  /* collect the save the required type */
+  type = json_attr_get (json, L"type");
+  if (!type)
+    {
+      return NULL;
+    }
+
+  self->value = avro_value_from_json (ctx, &self->base_value, type);
+  if (!self->value)
+    {
+      return NULL;
+    }
+
+  /* TODO: collect the optional default value based on type 
+     switch(field->value.type){
+     }
+   */
+  return &self->base_value;
+}
+
+static avro_status_t
+record_read_skip (struct avro_value *value, struct avro_channel *channel,
+		  int skip)
+{
+  int i;
+  struct avro_record_value *self =
+    container_of (value, struct avro_record_value, base_value);
+
+  for (i = 0; i < self->fields->nelts; i++)
+    {
+      struct avro_value *field =
+	((struct avro_value **) self->fields->elts)[i];
+      if (skip)
+	{
+	  field->skip_data (field, channel);
+	}
+      else
+	{
+	  field->read_data (field, channel);
+	}
+    }
+  return AVRO_OK;
+}
+
+/* RECORD */
+static avro_status_t
+record_read (struct avro_value *value, struct avro_channel *channel)
+{
+  return record_read_skip (value, channel, 0);
+}
+
+static avro_status_t
+record_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  return record_read_skip (value, channel, 1);
+}
+
+static avro_status_t
+record_write (struct avro_value *value, struct avro_channel *channel)
+{
+/* TODO:
+  struct avro_record_value *record =
+    container_of (value, struct avro_record_value, base_value);
+*/
+  return AVRO_OK;
+}
+
+struct avro_value *
+avro_record_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		    apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_record_value *self;
+  const JSON_value *name;
+  const JSON_value *space;
+  const JSON_value *fields;
+  apr_status_t status;
+  apr_pool_t *subpool;
+  int i;
+
+  DEBUG (fprintf (stderr, "CREATING A RECORD\n"));
+
+  self = apr_palloc (pool, sizeof (struct avro_record_value));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_RECORD;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = record_read;
+  self->base_value.skip_data = record_skip;
+  self->base_value.write_data = record_write;
+  self->base_value.print_info = record_print;
+
+  /* collect and save required name */
+  name = json_attr_get_check_type (json, L"name", JSON_STRING);
+  if (!name)
+    {
+      return NULL;
+    }
+  self->name = name->json_string;
+
+  /* register self with named objects */
+  apr_hash_set (ctx->named_objects, self->name,
+		wcslen (self->name) * sizeof (wchar_t), &self->base_value);
+
+  /* collect and save optional namespace */
+  self->space = NULL;
+  space = json_attr_get_check_type (json, L"namespace", JSON_STRING);
+  if (space)
+    {
+      self->space = space->json_string;
+    }
+
+  /* collect the required fields */
+  fields = json_attr_get_check_type (json, L"fields", JSON_ARRAY);
+  if (!fields)
+    {
+      return NULL;
+    }
+
+  /* allocate space for the fields */
+  self->fields =
+    apr_array_make (pool, fields->json_array->nelts,
+		    sizeof (struct avro_value *));
+  if (!self->fields)
+    {
+      return NULL;
+    }
+
+  for (i = 0; i < fields->json_array->nelts; i++)
+    {
+      struct avro_value *field_value;
+      const JSON_value *field_json =
+	((JSON_value **) fields->json_array->elts)[i];
+      status = apr_pool_create (&subpool, pool);
+      if (status != APR_SUCCESS)
+	{
+	  return NULL;
+	}
+      field_value =
+	avro_field_create (ctx, &self->base_value, subpool, field_json);
+      if (!field_value)
+	{
+	  return NULL;
+	}
+      *(struct avro_value **) apr_array_push (self->fields) = field_value;
+    }
+
+  return &self->base_value;
+}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonarray_symbols
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonarray_symbols?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonarray_symbols (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonarray_symbols Thu Oct 15 18:00:21 2009
@@ -0,0 +1,3 @@
+{"type": "enum",
+ "name": "Status",
+ "symbols": "Normal Caution Critical"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonstring_name
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonstring_name?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonstring_name (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_nonstring_name Thu Oct 15 18:00:21 2009
@@ -0,0 +1,3 @@
+{"type": "enum",
+ "name": [ 0, 1, 1, 2, 3, 5, 8 ],
+ "symbols": ["Golden", "Mean"]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_without_name
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_without_name?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_without_name (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/enum_without_name Thu Oct 15 18:00:21 2009
@@ -0,0 +1,3 @@
+{"type": "enum"
+  "symbols" : ["I", "will", "fail", "no", "name"]
+}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_name
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_name?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_name (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_name Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{"type": "fixed",
+ "size": 314}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_size
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_size?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_size (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/fixed_without_size Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{"type": "fixed",
+ "name": "Missing size"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/illegal_type
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/illegal_type?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/illegal_type (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/illegal_type Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"panther"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_name
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_name?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_name (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_name Thu Oct 15 18:00:21 2009
@@ -0,0 +1,5 @@
+{"type": "record",
+ "name": "Address",
+ "fields": [
+     {"type": "string"},
+     {"type": "string", "name": "City"}]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_type
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_type?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_type (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_field_missing_type Thu Oct 15 18:00:21 2009
@@ -0,0 +1,5 @@
+{"type": "record",
+ "name": "Event",
+ "fields": [ 
+    { "name": "Sponsor"},
+    { "name": "City", "type": "string"}]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonarray_fields
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonarray_fields?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonarray_fields (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonarray_fields Thu Oct 15 18:00:21 2009
@@ -0,0 +1,3 @@
+{ "type": "record",
+  "fields": "His vision, from the constantly passing bars,"
+  "name", "Rainer" }

Added: hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonstring_name
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonstring_name?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonstring_name (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/fail/record_with_nonstring_name Thu Oct 15 18:00:21 2009
@@ -0,0 +1,3 @@
+{"name": ["Tom", "Jerry"],
+ "type": "record",
+ "fields": [ {"name": "name", "type": "string"} ]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/array
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/array?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/array (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/array Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type": "array", "items": "long"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/boolean_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/boolean_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/boolean_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/boolean_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"boolean"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/bytes_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/bytes_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/bytes_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/bytes_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"bytes"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/double_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/double_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/double_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/double_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"double"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/enum
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/enum?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/enum (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/enum Thu Oct 15 18:00:21 2009
@@ -0,0 +1,4 @@
+{ "type": "enum",
+  "name": "Three Stooges",
+  "symbols" : [ "Moe", "Larry", "Curly" ]
+}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/extra_attributes
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/extra_attributes?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/extra_attributes (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/extra_attributes Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"string", "ignored": "value"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/fixed
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/fixed?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/fixed (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/fixed Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type": "fixed", "size": 16, "name": "md5"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/float_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/float_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/float_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/float_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"float"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/int_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/int_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/int_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/int_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"int"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/long_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/long_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/long_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/long_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"long"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/map
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/map?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/map (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/map Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type" : "map", "values": "long"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/null_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/null_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/null_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/null_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type":"null"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/record
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/record?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/record (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/record Thu Oct 15 18:00:21 2009
@@ -0,0 +1,5 @@
+{"name": "person",
+ "type": "record",
+ "fields": [ {"name": "height", "type": "long"},
+             {"name": "weight", "type": "long"},
+             {"name": "name", "type": "string"}]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/record_fields_with_defaults
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/record_fields_with_defaults?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/record_fields_with_defaults (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/record_fields_with_defaults Thu Oct 15 18:00:21 2009
@@ -0,0 +1,6 @@
+{"name": "person",
+ "type": "record",
+ "fields": [ {"name": "height", "type": "long"},
+             {"name": "weight", "type": "long"},
+             {"name": "name", "type": "string"},
+             {"name": "hacker", "type": "boolean", "default": false}]}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/recursive_record
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/recursive_record?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/recursive_record (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/recursive_record Thu Oct 15 18:00:21 2009
@@ -0,0 +1,7 @@
+{ "type": "record",
+  "name": "recursive",
+  "fields": [
+    { "name": "label", "type": "string" },
+    { "name": "children", "type": {"type": "array", "items": "recursive"} }
+  ]
+}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/string_full
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/string_full?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/string_full (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/string_full Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"type": "string"}

Added: hadoop/avro/trunk/src/c/avro_schema_tests/pass/union
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_schema_tests/pass/union?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_schema_tests/pass/union (added)
+++ hadoop/avro/trunk/src/c/avro_schema_tests/pass/union Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["string", "long", "null"]

Modified: hadoop/avro/trunk/src/c/avro_string.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_string.c?rev=825593&r1=825592&r2=825593&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c/avro_string.c (original)
+++ hadoop/avro/trunk/src/c/avro_string.c Thu Oct 15 18:00:21 2009
@@ -16,82 +16,122 @@
 specific language governing permissions and limitations
 under the License.
 */
+#include "avro_private.h"
 
-#include "avro.h"
+struct avro_string_value
+{
+  apr_pool_t *pool;
+  avro_string_t value;
+  int value_set;
+  struct avro_value base_value;
+};
 
-static avro_status_t
-avro_string_bytes_encode (AVRO * avro, char **str, int64_t * len,
-			  int64_t maxlen)
+static void
+avro_string_print (struct avro_value *value, FILE * fp)
 {
-  avro_status_t status = avro_int64 (avro, len);
-  CHECK_ERROR (status);
-  return AVRO_PUTBYTES (avro, *str, *len);
+  struct avro_string_value *self =
+    container_of (value, struct avro_string_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "string");
+  if (self->value_set)
+    {
+      fprintf (fp, " value=%ls", self->value);
+    }
+  fprintf (fp, "\n");
 }
 
 static avro_status_t
-avro_string_bytes_decode (AVRO * avro, char **str, int64_t * len,
-			  int null_terminated, int64_t maxlen)
+avro_string_read (struct avro_value *value, struct avro_channel *channel)
 {
-  avro_status_t status = avro_int64 (avro, len);
-  CHECK_ERROR (status);
-  if (*len < 0)
+  struct avro_io *io;
+  struct avro_string_value *self =
+    container_of (value, struct avro_string_value, base_value);
+  if (!channel)
     {
       return AVRO_FAILURE;
     }
-  *str = (caddr_t) apr_palloc (avro->pool, *len + null_terminated);
-  if (*str == NULL)
+  io = channel->io;
+  if (!io)
     {
       return AVRO_FAILURE;
     }
-  status = AVRO_GETBYTES (avro, *str, *len);
-  CHECK_ERROR (status);
-  if (null_terminated)
-    {
-      (*str)[*len] = '\0';
-    }
-  return AVRO_OK;
+  apr_pool_clear (self->pool);
+  self->value_set = 1;
+  return avro_getstring (io, self->pool, &self->value);
 }
 
-avro_status_t
-avro_string (AVRO * avro, char **str, int64_t maxlen)
+static avro_status_t
+avro_string_skip (struct avro_value *value, struct avro_channel *channel)
 {
-  int64_t len;
-  if (!avro || !str)
+  avro_status_t status;
+  avro_long_t len;
+  struct avro_io *io;
+  struct avro_string_value *self =
+    container_of (value, struct avro_string_value, base_value);
+
+  self->value_set = 0;
+  if (!channel)
     {
       return AVRO_FAILURE;
     }
-  switch (avro->a_op)
+  io = channel->io;
+  if (!io)
     {
-    case AVRO_ENCODE:
-      len = strlen (*str);
-      return avro_string_bytes_encode (avro, str, &len, maxlen);
-    case AVRO_DECODE:
-      return avro_string_bytes_decode (avro, str, &len, 1, maxlen);
-    default:
       return AVRO_FAILURE;
     }
-  return AVRO_OK;
+  status = avro_getlong (io, &len);
+  if (status != AVRO_OK)
+    {
+      return status;
+    }
+  if (len < 0)
+    {
+      return AVRO_FAILURE;
+    }
+  return io->skip (io, len);
 }
 
-avro_status_t
-avro_bytes (AVRO * avro, char **bytes, int64_t * len, int64_t maxlen)
+static avro_status_t
+avro_string_write (struct avro_value *value, struct avro_channel *channel)
 {
-  if (!avro || !bytes || !len)
+  struct avro_io *io;
+  struct avro_string_value *self =
+    container_of (value, struct avro_string_value, base_value);
+  if (!channel)
     {
       return AVRO_FAILURE;
     }
-  switch (avro->a_op)
+  io = channel->io;
+  if (!io)
     {
-    case AVRO_ENCODE:
-      if (*len < 0)
-	{
-	  return AVRO_FAILURE;
-	}
-      return avro_string_bytes_encode (avro, bytes, len, maxlen);
-    case AVRO_DECODE:
-      return avro_string_bytes_decode (avro, bytes, len, 0, maxlen);
-    default:
       return AVRO_FAILURE;
     }
-  return AVRO_OK;
+  return avro_putstring (io, self->pool, self->value);
+}
+
+struct avro_value *
+avro_string_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		    apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_string_value *self =
+    apr_palloc (pool, sizeof (struct avro_string_value));
+  DEBUG (fprintf (stderr, "Creating a string\n"));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_STRING;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = avro_string_read;
+  self->base_value.skip_data = avro_string_skip;
+  self->base_value.write_data = avro_string_write;
+  self->base_value.print_info = avro_string_print;
+  self->value_set = 0;
+  if (apr_pool_create (&self->pool, pool) != APR_SUCCESS)
+    {
+      return NULL;
+    }
+  return &self->base_value;
 }

Added: hadoop/avro/trunk/src/c/avro_type.gperf
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_type.gperf?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_type.gperf (added)
+++ hadoop/avro/trunk/src/c/avro_type.gperf Thu Oct 15 18:00:21 2009
@@ -0,0 +1,19 @@
+%{
+#include "avro.h"
+%}
+enum AVRO_node_type;
+%%
+string,AVRO_STRING
+bytes,AVRO_BYTES
+int,AVRO_INT
+long,AVRO_LONG
+float,AVRO_FLOAT
+double,AVRO_DOUBLE
+boolean,AVRO_BOOLEAN
+null,AVRO_NULL
+record,AVRO_RECORD
+enum,AVRO_ENUM
+fixed,AVRO_FIZED
+map,AVRO_MAP
+array,AVRO_ARRAY
+union,AVRO_UNION

Added: hadoop/avro/trunk/src/c/avro_union.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_union.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_union.c (added)
+++ hadoop/avro/trunk/src/c/avro_union.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,88 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+struct avro_union_value
+{
+  apr_array_header_t *schemas;
+  struct avro_value base_value;
+};
+
+static avro_status_t
+avro_union_print (struct avro_value *value, FILE * fp)
+{
+  struct avro_union_value *self =
+    container_of (value, struct avro_union_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "union\n");
+  return AVRO_OK;
+}
+
+static avro_status_t
+avro_union_read (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_union_value *self =
+    container_of (value, struct avro_union_value, base_value);
+  return AVRO_OK;
+}
+
+static avro_status_t
+avro_union_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_union_value *self =
+    container_of (value, struct avro_union_value, base_value);
+  return AVRO_OK;
+}
+
+static avro_status_t
+avro_union_write (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_union_value *self =
+    container_of (value, struct avro_union_value, base_value);
+  return AVRO_OK;
+}
+
+struct avro_value *
+avro_union_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		   apr_pool_t * pool, const JSON_value * json)
+{
+  struct avro_union_value *self;
+  DEBUG (fprintf (stderr, "Creating a union\n"));
+
+  if (json->type != JSON_ARRAY)
+    {
+      return NULL;
+    }
+  self = apr_palloc (pool, sizeof (struct avro_union_value));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = AVRO_UNION;
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = json;
+  self->base_value.read_data = avro_union_read;
+  self->base_value.skip_data = avro_union_skip;
+  self->base_value.write_data = avro_union_write;
+  self->base_value.print_info = avro_union_print;
+
+  /* TODO: check the schemas ... and save them */
+  return &self->base_value;
+}

Added: hadoop/avro/trunk/src/c/avro_value.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/avro_value.c?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/avro_value.c (added)
+++ hadoop/avro/trunk/src/c/avro_value.c Thu Oct 15 18:00:21 2009
@@ -0,0 +1,197 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+#include "avro_private.h"
+
+struct avro_decorator_value
+{
+  struct avro_value *decoratee;
+  struct avro_value base_value;
+};
+
+static void
+avro_decorator_print (struct avro_value *value, FILE * fp)
+{
+  struct avro_decorator_value *self =
+    container_of (value, struct avro_decorator_value, base_value);
+  avro_value_indent (value, fp);
+  fprintf (fp, "avro decorator\n");
+}
+
+static avro_status_t
+avro_decorator_read (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_decorator_value *self =
+    container_of (value, struct avro_decorator_value, base_value);
+  return self->decoratee->read_data (self->decoratee, channel);
+}
+
+static avro_status_t
+avro_decorator_skip (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_decorator_value *self =
+    container_of (value, struct avro_decorator_value, base_value);
+  return self->decoratee->skip_data (self->decoratee, channel);
+}
+
+static avro_status_t
+avro_decorator_write (struct avro_value *value, struct avro_channel *channel)
+{
+  struct avro_decorator_value *self =
+    container_of (value, struct avro_decorator_value, base_value);
+  return self->decoratee->write_data (self->decoratee, channel);
+}
+
+/* Used for recursive schemas */
+struct avro_value *
+avro_decorator_create (struct avro_value_ctx *ctx, struct avro_value *parent,
+		       apr_pool_t * pool, struct avro_value *decoratee)
+{
+  struct avro_decorator_value *self =
+    apr_palloc (pool, sizeof (struct avro_decorator_value));
+  DEBUG (fprintf (stderr, "Creating a decorator\n"));
+  if (!self)
+    {
+      return NULL;
+    }
+  self->base_value.type = 1000;	/* TODO: ... */
+  self->base_value.pool = pool;
+  self->base_value.parent = parent;
+  self->base_value.schema = decoratee->schema;
+  self->base_value.read_data = avro_decorator_read;
+  self->base_value.skip_data = avro_decorator_skip;
+  self->base_value.write_data = avro_decorator_write;
+  self->base_value.print_info = avro_decorator_print;
+
+  /* object we're decorating */
+  self->decoratee = decoratee;
+  return &self->base_value;
+}
+
+struct avro_value *
+avro_value_from_json (struct avro_value_ctx *ctx,
+		      struct avro_value *parent, const JSON_value * json)
+{
+  apr_status_t status;
+  struct avro_value *value;
+  const avro_type_t *avro_type;
+  apr_pool_t *subpool;
+
+  status = apr_pool_create (&subpool, parent ? parent->pool : NULL);
+  if (status != APR_SUCCESS)
+    {
+      return NULL;
+    }
+
+  avro_type = avro_type_from_json (json);
+  if (!avro_type)
+    {
+      if (json->type == JSON_STRING)
+	{
+	  avro_value *named_object =
+	    apr_hash_get (ctx->named_objects, json->json_string,
+			  wcslen (json->json_string) * sizeof (wchar_t));
+	  if (named_object)
+	    {
+	      return avro_decorator_create (ctx, parent, subpool,
+					    named_object);
+	    }
+	}
+      return NULL;
+    }
+
+  value = NULL;
+  switch (*avro_type)
+    {
+    case AVRO_STRING:
+      value = avro_string_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_BYTES:
+      value = avro_bytes_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_INT:
+      value = avro_int_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_LONG:
+      value = avro_long_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_FLOAT:
+      value = avro_float_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_DOUBLE:
+      value = avro_double_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_BOOLEAN:
+      value = avro_boolean_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_NULL:
+      value = avro_null_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_RECORD:
+      value = avro_record_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_ENUM:
+      value = avro_enum_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_FIXED:
+      value = avro_fixed_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_MAP:
+      value = avro_map_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_ARRAY:
+      value = avro_array_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_UNION:
+      value = avro_union_create (ctx, parent, subpool, json);
+      break;
+    case AVRO_FIELD:
+      /* fields are created by record_create */
+      break;
+    }
+  return value;
+}
+
+struct avro_value *
+avro_value_create (apr_pool_t * pool, char *jsontext, apr_size_t textlen)
+{
+  apr_status_t status;
+  struct avro_value_ctx *ctx;
+
+  const JSON_value *json = JSON_parse (pool, jsontext, textlen);
+  if (!json)
+    {
+      return NULL;
+    }
+
+  ctx =
+    (struct avro_value_ctx *) apr_palloc (pool,
+					  sizeof (struct avro_value_ctx));
+  if (!ctx)
+    {
+      return NULL;
+    }
+
+  ctx->named_objects = apr_hash_make (pool);
+  if (!ctx->named_objects)
+    {
+      return NULL;
+    }
+
+  return avro_value_from_json (ctx, NULL, json);
+}

Added: hadoop/avro/trunk/src/c/container_of.h
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/container_of.h?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/container_of.h (added)
+++ hadoop/avro/trunk/src/c/container_of.h Thu Oct 15 18:00:21 2009
@@ -0,0 +1,51 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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 CONTAINER_OF_H
+#define CONTAINER_OF_H
+
+/* This simple macro is found in stddef.h on most os */
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+/* 
+The container_of macro allows us to find the address of the outer
+structure when passed the address of an inner function.
+
+e.g. 
+struct innerstruct {
+  int foo;
+};
+struct outerstruct {
+  int bar;
+  struct innerstruct inner;
+};
+
+If we have a ptr to an inner structure called "in",
+we can find the address of the outer struct with...
+
+struct outer *out = container_of (in, struct outerstruct, inner);
+*/
+#define container_of(ptr, type, member) (\
+{                       \
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+        (type *)( (char *)__mptr - offsetof(type,member) ); \
+})
+
+#endif

Modified: hadoop/avro/trunk/src/c/json.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json.c?rev=825593&r1=825592&r2=825593&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c/json.c (original)
+++ hadoop/avro/trunk/src/c/json.c Thu Oct 15 18:00:21 2009
@@ -43,13 +43,13 @@
       fprintf (file, "???");
       return;
     case JSON_STRING:
-      fprintf (file, "\"%ls\"", value->string_value);
+      fprintf (file, "\"%ls\"", value->json_string);
       return;
     case JSON_NUMBER:
-      fprintf (file, "%E", value->number_value);
+      fprintf (file, "%E", value->json_number);
       return;
     case JSON_BOOLEAN:
-      fprintf (file, "%s", value->boolean_value ? "true" : "false");
+      fprintf (file, "%s", value->json_boolean ? "true" : "false");
       return;
     case JSON_NULL:
       fprintf (file, "null");
@@ -57,7 +57,7 @@
     case JSON_ARRAY:
       (*depth)++;
       fprintf (file, "[\n");
-      for (i = 0; i < value->array_value->nelts; i++)
+      for (i = 0; i < value->json_array->nelts; i++)
 	{
 	  if (i)
 	    {
@@ -65,7 +65,7 @@
 	    }
 	  ws_depth (file, *depth);
 	  JSON_print_private (file,
-			      ((JSON_value **) value->array_value->elts)[i],
+			      ((JSON_value **) value->json_array->elts)[i],
 			      depth);
 	}
       fprintf (file, "\n");
@@ -82,7 +82,7 @@
 
 	(*depth)++;
 	fprintf (file, "{\n");
-	for (i = 0, hi = apr_hash_first (value->pool, value->object_value);
+	for (i = 0, hi = apr_hash_first (value->pool, value->json_object);
 	     hi; hi = apr_hash_next (hi), i++)
 	  {
 	    if (i)
@@ -176,10 +176,10 @@
 
 	    value = JSON_value_new (pool, JSON_STRING);
 	    /* This allocates the maximum we need */
-	    value->string_value =
+	    value->json_string =
 	      (wchar_t *) apr_palloc (pool, (len + 1) * sizeof (wchar_t));
 
-	    for (p = cur + 1, q = value->string_value; p < cur + len - 1; p++)
+	    for (p = cur + 1, q = value->json_string; p < cur + len - 1; p++)
 	      {
 		if (*p == '\\')
 		  {
@@ -229,13 +229,13 @@
 
 	case TK_NUMBER:
 	  value = JSON_value_new (pool, JSON_NUMBER);
-	  value->number_value = number;
+	  value->json_number = number;
 	  break;
 
 	case TK_TRUE:
 	case TK_FALSE:
 	  value = JSON_value_new (pool, JSON_BOOLEAN);
-	  value->boolean_value = tokenType == TK_FALSE ? 0 : 1;
+	  value->json_boolean = tokenType == TK_FALSE ? 0 : 1;
 	  break;
 
 	case TK_NULL:

Modified: hadoop/avro/trunk/src/c/json.h
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json.h?rev=825593&r1=825592&r2=825593&view=diff
==============================================================================
--- hadoop/avro/trunk/src/c/json.h (original)
+++ hadoop/avro/trunk/src/c/json.h Thu Oct 15 18:00:21 2009
@@ -51,11 +51,11 @@
   apr_pool_t *pool;
 };
 typedef struct JSON_value JSON_value;
-#define object_value value_u.object
-#define array_value value_u.array
-#define string_value value_u.z
-#define number_value value_u.number
-#define boolean_value value_u.boolean
+#define json_object value_u.object
+#define json_array  value_u.array
+#define json_string value_u.z
+#define json_number value_u.number
+#define json_boolean value_u.boolean
 
 JSON_value *JSON_parse (apr_pool_t * pool, char *text, int text_len);
 
@@ -71,7 +71,7 @@
 };
 typedef struct JSON_ctx JSON_ctx;
 
-/* in json_schema.c */
+/* in json_parser.c */
 void *JSONParserAlloc (void *(*mallocProc) (size_t));
 void JSONParser (void *yyp, int yymajor, JSON_value * value, JSON_ctx * ctx);
 void JSONParserFree (void *p, void (*freeProc) (void *));

Added: hadoop/avro/trunk/src/c/json_parser.y
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_parser.y?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_parser.y (added)
+++ hadoop/avro/trunk/src/c/json_parser.y Thu Oct 15 18:00:21 2009
@@ -0,0 +1,121 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+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.
+*/
+%name JSONParser
+
+%token_type {JSON_value *}
+%default_type {JSON_value *}
+
+%extra_argument { JSON_ctx *ctx }
+
+%include {
+#include <stdio.h>
+#include <assert.h>
+#include <wchar.h>
+#include "json.h"
+#include "json_tokenizer.h"
+
+#if 0
+#define DEBUG_PARSER(stmt) stmt
+#else
+#define DEBUG_PARSER(stmt)
+#endif
+
+#define NUM_INIT_ELEMENTS 16
+}
+
+%parse_accept {
+   DEBUG_PARSER(fprintf(stderr,"Input parsed and accepted\n"));
+}
+
+%syntax_error {
+   ctx->error = 1;
+   DEBUG_PARSER(fprintf(stderr,"Syntax error\n"));
+}
+
+%token_prefix TK_
+
+json ::= jsontext(A).
+{
+      ctx->result = A;
+}
+
+jsontext(A) ::= object(B). { A=B; }
+jsontext(A) ::= array(B).  { A=B; }
+
+/* Values */
+value(A) ::= STRING(B).  { A=B; }
+value(A) ::= NUMBER(B).  { A=B; }
+value(A) ::= object(B).  { A=B; }
+value(A) ::= array(B).   { A=B; }
+value(A) ::= TRUE(B).    { A=B; }
+value(A) ::= FALSE(B).   { A=B; }
+value(A) ::= NULL(B).    { A=B; }
+
+/* Arrays */
+%type element_list {apr_array_header_t *}
+%type elements {apr_array_header_t *}
+
+element_list(A) ::= elements(B) COMMA.
+{
+      A=B;
+}
+element_list(A) ::= .
+{
+      A=apr_array_make(ctx->pool, NUM_INIT_ELEMENTS, sizeof(JSON_value *));
+}
+elements(A) ::= element_list(B) value(C).
+{
+      A = B;
+      *(JSON_value **)apr_array_push(B) = C;
+}
+elements(A) ::= element_list(B) .
+{
+      A = B;
+}
+array(A)  ::= LBRACKET elements(B) RBRACKET.
+{
+      A = JSON_value_new(ctx->pool, JSON_ARRAY);
+      A->json_array = B;
+}
+
+/* Objects */
+%type member_list {apr_hash_t *}
+%type members {apr_hash_t *}
+member_list(A) ::= members(B) COMMA.
+{
+     A = B;
+}
+member_list(A) ::= .
+{
+     A = apr_hash_make(ctx->pool);
+}
+members(A) ::= member_list(B) STRING(C) COLON value(D).
+{
+     A = B;
+     apr_hash_set(B, C->json_string, wcslen(C->json_string) * sizeof(wchar_t), D);
+}
+members(A) ::= member_list(B).
+{
+      A = B;
+}
+object(A) ::= LCURLY members(B) RCURLY.
+{
+      A = JSON_value_new(ctx->pool, JSON_OBJECT);
+      A->json_object = B;
+}

Added: hadoop/avro/trunk/src/c/json_tests/README
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/README?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/README (added)
+++ hadoop/avro/trunk/src/c/json_tests/README Thu Oct 15 18:00:21 2009
@@ -0,0 +1,7 @@
+This directory is used by test_json_parser 
+
+The "pass" directory contains schema definitions that
+should parse without error.
+
+The "fail" directory contains shema definitions that
+should *not* parse but instead throw an error.

Added: hadoop/avro/trunk/src/c/json_tests/fail/array_not_closed
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/array_not_closed?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/array_not_closed (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/array_not_closed Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[

Added: hadoop/avro/trunk/src/c/json_tests/fail/array_not_opened
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/array_not_opened?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/array_not_opened (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/array_not_opened Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+]

Added: hadoop/avro/trunk/src/c/json_tests/fail/bad_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/bad_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/bad_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/bad_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["Bad value", truth]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/colon_instead_of_comma
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/colon_instead_of_comma?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/colon_instead_of_comma (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/colon_instead_of_comma Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["Colon instead of comma": false]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/comma_after_close
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/comma_after_close?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/comma_after_close (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/comma_after_close Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["Comma after the close"],
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/comma_instead_of_colon
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/comma_instead_of_colon?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/comma_instead_of_colon (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/comma_instead_of_colon Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Comma instead of colon", null}
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/double_colon
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/double_colon?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/double_colon (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/double_colon Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Double colon":: null}
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/extra_close
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/extra_close?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/extra_close (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/extra_close Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["Extra close"]]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/extra_data_after_object
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/extra_data_after_object?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/extra_data_after_object (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/extra_data_after_object Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Extra value after object close": true} "This isn't valid JSON"

Added: hadoop/avro/trunk/src/c/json_tests/fail/illegal_expression
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/illegal_expression?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/illegal_expression (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/illegal_expression Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Illegal": 1 + 2}

Added: hadoop/avro/trunk/src/c/json_tests/fail/illegal_invocation
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/illegal_invocation?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/illegal_invocation (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/illegal_invocation Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Illegal invocation": alert()}

Added: hadoop/avro/trunk/src/c/json_tests/fail/invalid_number
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/invalid_number?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/invalid_number (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/invalid_number Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[0e]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/invalid_number2
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/invalid_number2?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/invalid_number2 (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/invalid_number2 Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[0e+]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/invalid_number3
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/invalid_number3?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/invalid_number3 (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/invalid_number3 Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Comma instead if closing brace": true,
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/invalid_number4
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/invalid_number4?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/invalid_number4 (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/invalid_number4 Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[0e+-1]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/json_text_not_array_or_object
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/json_text_not_array_or_object?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/json_text_not_array_or_object (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/json_text_not_array_or_object Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+"JSON text should be an array or object"

Added: hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+["line
+break"]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string2
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string2?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string2 (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/line_break_in_string2 Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+["line\
+break"]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/missing_colon
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/missing_colon?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/missing_colon (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/missing_colon Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"Missing colon" null}
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/naked_array_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/naked_array_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/naked_array_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/naked_array_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[\naked]

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_array_mismatch
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_array_mismatch?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_array_mismatch (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_array_mismatch Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["mismatch"}
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_malformed
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_malformed?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_malformed (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_malformed Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{"foo:"}

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_not_closed
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_not_closed?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_not_closed (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_not_closed Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_not_opened
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_not_opened?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_not_opened (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_not_opened Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+}

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_with_string
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_with_string?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_with_string (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_with_string Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{ "Fail" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/object_without_one_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/object_without_one_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/object_without_one_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/object_without_one_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{ "one", "two": "foobar" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/single_quote
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/single_quote?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/single_quote (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/single_quote Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+['single quote']
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u1_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u1_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u1_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u1_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{ "good" : "\uDEAD",
+  "bad" : "\u!BAD" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u2_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u2_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u2_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u2_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{ "good" : "\uDEAD",
+  "bad" : "\uB!AD" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u3_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u3_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u3_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u3_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{ "good" : "\uDEAD",
+  "bad" : "\uBA!D" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u4_value
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u4_value?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u4_value (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/string_bad_u4_value Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+{ "good" : "\uDEAD",
+  "bad" : "\uBAD!" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/string_illegal_escape
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/string_illegal_escape?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/string_illegal_escape (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/string_illegal_escape Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{ "bad" : "\z" }

Added: hadoop/avro/trunk/src/c/json_tests/fail/tab_char_in_string
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/tab_char_in_string?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/tab_char_in_string (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/tab_char_in_string Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["tab\   character\   in\  string\  "]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/tab_character_in_string
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/tab_character_in_string?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/tab_character_in_string (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/tab_character_in_string Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+["	tab	character	in	string	"]
\ No newline at end of file

Added: hadoop/avro/trunk/src/c/json_tests/fail/unquoted_object_key
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/fail/unquoted_object_key?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/fail/unquoted_object_key (added)
+++ hadoop/avro/trunk/src/c/json_tests/fail/unquoted_object_key Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+{unquoted_key: "<- Keys should be quoted"}

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_multidimensional
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_multidimensional?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_multidimensional (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_multidimensional Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ [ "one", "array" ], [ "two", "array" ], [ "three", [ "four" ] ] ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_false
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_false?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_false (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_false Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ false ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_ints
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_ints?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_ints (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_ints Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ 1, 1.0, -1, 3e4, 3e+5, 3e-10, 2.0E+13, 44E-2 ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_null
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_null?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_null (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_null Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ null ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_objects
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_objects?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_objects (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_objects Thu Oct 15 18:00:21 2009
@@ -0,0 +1,2 @@
+[ { "foo" : "bar" }, {"baz": "value"} 
+]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_string
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_string?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_string (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_string Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ "Hi" ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/array_with_true
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/array_with_true?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/array_with_true (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/array_with_true Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[ true ]

Added: hadoop/avro/trunk/src/c/json_tests/pass/deep
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/c/json_tests/pass/deep?rev=825593&view=auto
==============================================================================
--- hadoop/avro/trunk/src/c/json_tests/pass/deep (added)
+++ hadoop/avro/trunk/src/c/json_tests/pass/deep Thu Oct 15 18:00:21 2009
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Think deep thoughts"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]



Mime
View raw message