diff options
| author | lloydh <lloydh@e775cfb5-b74b-0410-aad5-5bebe4a96390> | 2008-01-14 14:16:18 +0000 |
|---|---|---|
| committer | lloydh <lloydh@e775cfb5-b74b-0410-aad5-5bebe4a96390> | 2008-01-14 14:16:18 +0000 |
| commit | 00ca98b8460cdd239b99f47e9a2b7e8c60cc15b0 (patch) | |
| tree | 7e8d69661c5d53b7f1f1081d9d614763b78cb90f | |
| parent | ae3d4b376c0094c3b3c12b2c0b728c2eb64227e8 (diff) | |
| download | yajl-00ca98b8460cdd239b99f47e9a2b7e8c60cc15b0.tar.gz | |
1. doxygen docs now part of the build
2. many documentation updates
3. freebsd4 fixes
4. works with CMake pre-LOOSE_LOOP_CONSTRUCTS
git-svn-id: http://yajl-c.googlecode.com/svn/yajl/trunk@90 e775cfb5-b74b-0410-aad5-5bebe4a96390
| -rw-r--r-- | CMakeLists.txt | 14 | ||||
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | TODO | 1 | ||||
| -rw-r--r-- | YAJLDoc.cmake | 22 | ||||
| -rwxr-xr-x | configure | 2 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/YAJL.dxy | 8 | ||||
| -rw-r--r-- | src/api/yajl_parse.h | 18 | ||||
| -rw-r--r-- | src/yajl | 11 | ||||
| -rw-r--r-- | src/yajl_parser.c | 2 |
10 files changed, 70 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1dab6..dd7a830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,17 +30,15 @@ PROJECT(YetAnotherJSONParser) -SET (YAJL_MAJOR 1) -SET (YAJL_MINOR 0) +SET (YAJL_MAJOR 0) +SET (YAJL_MINOR 3) SET (YAJL_MICRO 0) SET (YAJL_DIST_NAME "yajl-${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}") -SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1) - IF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "Debug") -ENDIF () +ENDIF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_C_FLAGS "-Wall") IF (WIN32) @@ -59,14 +57,16 @@ IF (WIN32) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711") SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7") SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2") -ELSE () +ELSE (WIN32) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -ansi") SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g") SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") -ENDIF () +ENDIF (WIN32) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(test) ADD_SUBDIRECTORY(reformatter) ADD_SUBDIRECTORY(verify) + +INCLUDE(YAJLDoc.cmake) @@ -1,4 +1,11 @@ 0.3.0 + * lth doxygen documentation (html & man) generated as part of the + build + * lth many documentation updates. + * lth fix to work with older versions of cmake (don't use LOOSE_LOOP + constructs) + * lth work around different behavior of freebsd 4 scanf. initialize + parameter to scanf to zero. * lth all tests run 32x with ranging buffer sizes to stress stream parsing * lth yajl_test accepts -b option to allow read buffer size to be @@ -4,6 +4,5 @@ a. the permuter b. some performance comparison against json_checker. * doxygen setup and compelete documentation -* non-cmake build system * investigate pull instead of push parsing * make install step diff --git a/YAJLDoc.cmake b/YAJLDoc.cmake new file mode 100644 index 0000000..6b899aa --- /dev/null +++ b/YAJLDoc.cmake @@ -0,0 +1,22 @@ +FIND_PROGRAM(doxygenPath doxygen) + +IF (doxygenPath) + SET (YAJL_VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}) + SET(yajlDirName yajl-${YAJL_VERSION}) + SET(docPath + "${CMAKE_CURRENT_BINARY_DIR}/${yajlDirName}/share/doc/${yajlDirName}") + MESSAGE("** using doxygen at: ${doxygenPath}") + MESSAGE("** documentation output to: ${docPath}") + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/YAJL.dxy + ${CMAKE_CURRENT_BINARY_DIR}/YAJL.dxy @ONLY) + + FILE(MAKE_DIRECTORY "${docPath}") + + ADD_CUSTOM_TARGET(doc + ${doxygenPath} YAJL.dxy + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + +ELSE (doxygenPath) + MESSAGE("!! doxygen not found, not generating documentation") +ENDIF (doxygenPath) @@ -72,7 +72,7 @@ File.open("Makefile", "w+") do |f| f.puts f.puts "distclean:" f.puts " @rm -rf Makefile build" - f.puts " @rm yajl-*.tgz" + f.puts " @rm -f yajl-*.tgz" f.puts f.puts "install: all" f.puts " @echo oops, install target not yet implemented" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7652f5a..a95a6e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,17 +57,7 @@ SET_TARGET_PROPERTIES(yajl PROPERTIES FILE(MAKE_DIRECTORY ${libDir}) FILE(MAKE_DIRECTORY ${incDir}) -# copy in the library -#GET_TARGET_PROPERTY(libPath yajl_s LOCATION) - -#ADD_CUSTOM_COMMAND(TARGET yajl_s POST_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${libPath} ${libDir}) - -#GET_TARGET_PROPERTY(libPath yajl LOCATION) - -#ADD_CUSTOM_COMMAND(TARGET yajl POST_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${libPath} ${libDir}) - +# copy public headers to output directory FOREACH (header ${PUB_HDRS}) SET (header ${CMAKE_CURRENT_SOURCE_DIR}/${header}) @@ -75,6 +65,6 @@ FOREACH (header ${PUB_HDRS}) ADD_CUSTOM_COMMAND(TARGET yajl_s POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir}) -ENDFOREACH () +ENDFOREACH (header ${PUB_HDRS}) INCLUDE_DIRECTORIES(${incDir}/..) diff --git a/src/YAJL.dxy b/src/YAJL.dxy index 5c5dd6e..afc2659 100644 --- a/src/YAJL.dxy +++ b/src/YAJL.dxy @@ -31,14 +31,14 @@ PROJECT_NAME = YAJL # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.0 +PROJECT_NUMBER = @YAJL_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = $(DXY_OUTPUT) +OUTPUT_DIRECTORY = yajl-@YAJL_VERSION@/share # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -462,7 +462,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = README api/CoreletAPI +INPUT = ../src/yajl ../src/api # This tag can be used to specify the character encoding of the source files that # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default @@ -655,7 +655,7 @@ GENERATE_HTML = YES # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. -HTML_OUTPUT = html +HTML_OUTPUT = doc/yajl-@YAJL_VERSION@ # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank diff --git a/src/api/yajl_parse.h b/src/api/yajl_parse.h index e158356..9c7906d 100644 --- a/src/api/yajl_parse.h +++ b/src/api/yajl_parse.h @@ -40,9 +40,16 @@ extern "C" { #endif /** error codes returned from this interface */ typedef enum { + /** no error was encountered */ yajl_status_ok, + /** a client callback returned zero, stopping the parse */ yajl_status_client_canceled, + /** The parse cannot yet complete because more json input text + * is required, call yajl_parse with the next buffer of input text. + * (pertinent only when stream parsing) */ yajl_status_insufficient_data, + /** An error occured during the parse. Call yajl_get_error for + * more information about the encountered error */ yajl_status_error } yajl_status; @@ -68,8 +75,8 @@ extern "C" { int (* yajl_boolean)(void * ctx, int boolVal); int (* yajl_integer)(void * ctx, long long integerVal); int (* yajl_double)(void * ctx, double doubleVal); - /* strings are returned as pointers into the JSON text when, - * possible, they are not null padded */ + /** strings are returned as pointers into the JSON text when, + * possible, as a result, they are _not_ null padded */ int (* yajl_string)(void * ctx, const unsigned char * stringVal, unsigned int stringLen); @@ -107,7 +114,11 @@ extern "C" { /** free a parser handle */ void YAJL_API yajl_free(yajl_handle handle); - /** parse some json! */ + /** Parse some json! + * \param hand - a handle to the json parser allocated with yajl_alloc + * \param jsonText - a pointer to the UTF8 json text to be parsed + * \param jsonTextLength - the length, in bytes, of input text + */ yajl_status YAJL_API yajl_parse(yajl_handle hand, const unsigned char * jsonText, unsigned int jsonTextLength); @@ -126,6 +137,7 @@ extern "C" { const unsigned char * jsonText, unsigned int jsonTextLength); + /** free an error returned from yajl_get_error */ void YAJL_API yajl_free_error(unsigned char * str); #ifdef __cplusplus diff --git a/src/yajl b/src/yajl new file mode 100644 index 0000000..aea3854 --- /dev/null +++ b/src/yajl @@ -0,0 +1,11 @@ +/*! \mainpage yajl + \author Lloyd Hilaiel + \date 2007-2008 + +\section overview Overview + +YAJL is a small event-driven (SAX-style) JSON parser written in ANSI +C, and a small validating JSON generator. YAJL is released under the +BSD license. + +*/ diff --git a/src/yajl_parser.c b/src/yajl_parser.c index 3ee55e8..b7564ce 100644 --- a/src/yajl_parser.c +++ b/src/yajl_parser.c @@ -219,7 +219,7 @@ yajl_do_parse(yajl_handle hand, unsigned int * offset, * so we're safe. */ if (hand->callbacks && hand->callbacks->yajl_integer) { - long long int i; + long long int i = 0; int neg = 0; yajl_buf_clear(hand->decodeBuf); yajl_buf_append(hand->decodeBuf, buf, bufLen); |
