Skip to content

Commit

Permalink
AVRO-344. Complete rewrite of C implementation
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/hadoop/avro/trunk@899870 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Matthew Lee Massie committed Jan 16, 2010
1 parent 91afe77 commit bbf437e
Show file tree
Hide file tree
Showing 193 changed files with 24,690 additions and 12,970 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -30,6 +30,8 @@ Trunk (unreleased changes)
AVRO-163. Re-organized source tree into separate directories for AVRO-163. Re-organized source tree into separate directories for
each language. (cutting) each language. (cutting)


AVRO-344. Complete rewrite of C implementation (massie)

NEW FEATURES NEW FEATURES


AVRO-151. Validating Avro schema parser for C (massie) AVRO-151. Validating Avro schema parser for C (massie)
Expand Down
22 changes: 22 additions & 0 deletions LICENSE.txt
Expand Up @@ -200,3 +200,25 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.

License for the Jansson C JSON parser used in the C implementation:

Copyright (c) 2009 Petri Lehtinen <petri@digip.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions NOTICE.txt
Expand Up @@ -3,3 +3,7 @@ Copyright 2010 The Apache Software Foundation


This product includes software developed at This product includes software developed at
The Apache Software Foundation (http://www.apache.org/). The Apache Software Foundation (http://www.apache.org/).

C JSON parsing provided by Jansson and
written by Petri Lehtinen. The original software is
available from http://www.digip.org/jansson/.
2 changes: 1 addition & 1 deletion README.txt
Expand Up @@ -10,7 +10,7 @@ The following packages must be installed before Avro can be built:


- Java: JDK 1.6 - Java: JDK 1.6
- Python: 2.5 or greater - Python: 2.5 or greater
- C: gcc, automake, libtool, libapr1-dev, libaprutil1-dev, doxygen - C: gcc, autoconf, automake, libtool, asciidoc
- C++: g++, flex, bison, libboost-dev - C++: g++, flex, bison, libboost-dev
- Apache Ant 1.7 - Apache Ant 1.7
- Apache Forrest 0.8 (for documentation, requires Java 1.5) - Apache Forrest 0.8 (for documentation, requires Java 1.5)
Expand Down
4 changes: 3 additions & 1 deletion build.sh
Expand Up @@ -32,7 +32,7 @@ case "$target" in
# run lang-specific tests # run lang-specific tests
(cd lang/java; ant test) (cd lang/java; ant test)
(cd lang/py; ant test) (cd lang/py; ant test)
# (cd lang/c; make test) (cd lang/c; ./build.sh test)
# (cd lang/c++; make test) # (cd lang/c++; make test)


# create interop test data # create interop test data
Expand Down Expand Up @@ -67,6 +67,7 @@ case "$target" in
(cd lang/py; ant dist) (cd lang/py; ant dist)


# (cd lang/c; make dist) # (cd lang/c; make dist)
(cd lang/c; ./build.sh dist)


# (cd lang/c++; make dist) # (cd lang/c++; make dist)


Expand All @@ -84,6 +85,7 @@ case "$target" in
(cd lang/py; ant clean) (cd lang/py; ant clean)


# (cd lang/c; make clean) # (cd lang/c; make clean)
(cd lang/c; ./build.sh clean)


# (cd lang/c++; make clean) # (cd lang/c++; make clean)
;; ;;
Expand Down
94 changes: 6 additions & 88 deletions lang/c/Makefile.am
@@ -1,90 +1,8 @@
# -pedantic EXTRA_DIST=version.sh m4
AM_CFLAGS=$(APR_CFLAGS) $(APR_INCLUDES) $(APU_INCLUDES) -Wall SUBDIRS = docs jansson src tests
ACLOCAL_AMFLAGS=-I m4


C_DOCS_OUTPUT ?= "docs/dox"

EXTRA_DIST=json/json_parser.y json/lemon.c json/lempar.c \
tests/json_tests tests/schema_tests docs version.sh m4

include_HEADERS = avro.h

lib_LTLIBRARIES = libavro.la
libavro_la_SOURCES = avro.h avro_private.h avro.c avro_private.c \
json/json_parser.c json/json_parser.h json/json_tokenizer.c \
json/json.c json/json.h json/json_tokenizer.h \
util/dump.c util/dump.h util/error.c util/error.h \
util/container_of.h util/endian.c \
datatypes/array.c datatypes/boolean.c datatypes/bytes.c datatypes/double.c \
datatypes/enum.c datatypes/fixed.c datatypes/float.c datatypes/int.c datatypes/long.c \
datatypes/map.c datatypes/null.c datatypes/record.c datatypes/string.c datatypes/union.c \
datatypes/decorator.c datatypes/primitives.c \
io/file.c io/socket.c io/memory.c io/file_container.c
libavro_la_LDFLAGS = \
-version-info $(LIBAVRO_VERSION) \
-release $(VERSION) \
-export-dynamic

noinst_PROGRAMS=test_avro_interop
check_PROGRAMS=test_json_parser test_avro_schema test_avro_data

dist-hook: docs

test_LDADD=$(APR_LIBS) $(APU_LIBS) $(top_builddir)/libavro.la

test_json_parser_SOURCES=tests/test_json_parser.c
test_json_parser_LDADD=$(test_LDADD)

test_avro_schema_SOURCES=tests/test_avro_schema.c
test_avro_schema_LDADD=$(test_LDADD)

test_avro_data_SOURCES=tests/test_avro_data.c
test_avro_data_LDADD=$(test_LDADD)
# use -std=c99 to avoid warnings about universal character names
test_avro_data_CFLAGS=$(AM_CFLAGS) -std=c99

test_avro_interop_SOURCES=tests/test_avro_interop.c
test_avro_interop_LDADD=$(test_LDADD)

TESTS=$(check_PROGRAMS)

# Run indent on all files.
# NOTE: Don't indent avro.h (messes up docs) or lemon.c,lempar.c (messes up parser)
pretty: pretty:
pushd $(top_srcdir); \ @for dir in src tests; do \
for path in $$(find . -name "*.[c,h]"); \ indent $(top_srcdir)/$$dir/*.[c,h]; \
do \ mv $(top_srcdir)/$$dir/*~ /tmp; \
file=$$(basename $$path); \ done
if [ $$file = "avro.h" -o $$file = "lemon.c" -o $$file = "lempar.c" -o $$file = "json_parser.c" ]; then \
continue;\
fi;\
indent $$path; \
done;\
popd;

docs:
pushd $(top_srcdir); \
(cat docs/doxygen.conf; echo "OUTPUT_DIRECTORY=$(C_DOCS_OUTPUT)")| doxygen - ;\
popd;


.PHONY: docs

CLEANFILES=$(top_srcdir)/*~ $(top_srcdir)/**/*~ trace.txt json_parser.out lemon


# We don't need to auto-generate the json parser code each time. It makes
# the build overly complicated and isn't required since the json parser
# doesn't require frequent updates
#
#lemon: $(top_srcdir)/lemon.c $(top_srcdir)/lempar.c
# $(CC) -o $@ $(top_srcdir)/lemon.c
# -cp $(top_srcdir)/lempar.c .
#
#json_parser.c json_parser.h: $(top_srcdir)/json_parser.y lemon
# -cp $(top_srcdir)/json_parser.y .
# ./lemon json_parser.y
#
# Make sure to generate the json_parser in the source directory before distribution
#dist-hook: json_parser.h json_parser.c
# @[ $(top_srcdir) = $(top_builddir) ] || rm -f json_parser.y lempar.c json_parser.c json_parser.h
6 changes: 0 additions & 6 deletions lang/c/README
Expand Up @@ -6,9 +6,3 @@


====================================================== ======================================================
Please see the documentation in the "docs" directory. Please see the documentation in the "docs" directory.

Documentation can also be (re)generated by running...

$ make docs


48 changes: 0 additions & 48 deletions lang/c/avro.c

This file was deleted.

107 changes: 0 additions & 107 deletions lang/c/avro.h

This file was deleted.

0 comments on commit bbf437e

Please sign in to comment.