add license and comments

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/e1959ad5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/e1959ad5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/e1959ad5

Branch: refs/heads/master
Commit: e1959ad54e9b44c49bddf7d659d30946d9079089
Parents: 2c71ae1
Author: SuJinpei <[email protected]>
Authored: Mon Sep 18 22:33:49 2017 +0800
Committer: SuJinpei <[email protected]>
Committed: Mon Sep 18 22:33:49 2017 +0800

----------------------------------------------------------------------
 core/conn/odb/src/JsonReader.c |  27 +++++-
 core/conn/odb/src/JsonReader.h | 168 +++++++++++++++++++++++++++++++++++-
 2 files changed, 192 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e1959ad5/core/conn/odb/src/JsonReader.c
----------------------------------------------------------------------
diff --git a/core/conn/odb/src/JsonReader.c b/core/conn/odb/src/JsonReader.c
index d118ee8..df65170 100755
--- a/core/conn/odb/src/JsonReader.c
+++ b/core/conn/odb/src/JsonReader.c
@@ -1,4 +1,27 @@
-#include "JsonReader.h"
+//------------------------------------------------------------------
+//
+// @@@ START COPYRIGHT @@@
+//
+// 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.
+//
+// @@@ END COPYRIGHT @@@
+
+#include "JsonReader.h"
 #include <errno.h>
 #include <string.h>
 
@@ -537,4 +560,4 @@ void jsonReaderFree(JsonReader *pJsonReader)
 {
     fclose(pJsonReader->jsonFile);
     free(pJsonReader);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e1959ad5/core/conn/odb/src/JsonReader.h
----------------------------------------------------------------------
diff --git a/core/conn/odb/src/JsonReader.h b/core/conn/odb/src/JsonReader.h
index d23dc23..e1420f1 100755
--- a/core/conn/odb/src/JsonReader.h
+++ b/core/conn/odb/src/JsonReader.h
@@ -1,3 +1,26 @@
+//------------------------------------------------------------------
+//
+// @@@ START COPYRIGHT @@@
+//
+// 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.
+//
+// @@@ END COPYRIGHT @@@
+
 #ifndef JSONREADER_H
 #define JSONREADER_H
 
@@ -87,56 +110,199 @@ struct JsonReader_
 
 typedef struct JsonReader_ JsonReader;
 
+/* jsonReaderNew: create a json reader
+ *
+ * path: path of json file
+ * return: pointer to json reader
+ */
 JsonReader *jsonReaderNew(const char *path);
 
+/* jsonMoveCurrentCharPtr: move current char pointer forward.
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonMoveCurrentCharPtr(JsonReader *pJsonReader);
 
+/* jsonSaveAndToState: save and change parser state
+ *
+ * pJsonReader: pointer of json reader
+ * JsonReaderState : parser state
+ * return: json reader error code
+ */
 JsonReaderError jsonSaveAndToState(JsonReader *pJsonReader, JsonReaderState 
state);
 
+/* jsonReaderSetTmpbuf: set temp buffer to save parsed contents
+ *
+ * pJsonReader: pointer of json reader
+ * buf: the buf to save contents
+ * len: length of buf
+ * return: json reader error code
+ */
 JsonReaderError jsonReaderSetTmpbuf(JsonReader *pJsonReader, char *buf, size_t 
len);
 
+/* jsonReaderUnsetTmpbuf: unset tempbuf to save parsed contents.
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonReaderUnsetTmpbuf(JsonReader *pJsonReader);
 
+/* jsonParseStateStart: parse json file start
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseStateStart(JsonReader *pJsonReader);
 
+/* jsonParseObjectInitial: encuntered '{'
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseObjectInitial(JsonReader *pJsonReader);
 
+/* jsonGetStringValue: parse string value
+ *
+ * pJsonReader: pointer of json reader
+ * strValue: pointer to buf to save string
+ * len: length of strValue
+ * return: strValue
+ */
 char *jsonGetStringValue(JsonReader *pJsonReader, char *strValue, size_t len);
 
+/* jsonParseMemberKey: parse member key
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseMemberKey(JsonReader *pJsonReader);
 
+/* jsonParseKeyValueDelimiter: encountered key value delimiter
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseKeyValueDelimiter(JsonReader *pJsonReader);
 
+/* jsonInternalGetValue: common function to get string value
+ *
+ * pJsonReader: pointer of json reader
+ * endChars: encounter these chars function end
+ * len: length of end chars
+ * return: json reader error code
+ */
 JsonReaderError jsonInternalGetValue(JsonReader *pJsonReader, char *endChars, 
size_t len);
 
+/* jsonParseMemberValueEnd: parse member value end
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseMemberValueEnd(JsonReader *pJsonReader);
 
+/* jsonParseElementEnd: parse element value end
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseElementEnd(JsonReader *pJsonReader);
 
+/* jsonParseMemberValue: parse member value
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseMemberValue(JsonReader *pJsonReader);
 
+/* jsonParseMemberDelimiter: parse contents after member delimiter
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseMemberDelimiter(JsonReader *pJsonReader);
 
+/* jsonParseObjectFinish: parse contents after object finish
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseObjectFinish(JsonReader *pJsonReader);
 
+/* jsonParseArrayInitial: encounter '['
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseArrayInitial(JsonReader *pJsonReader);
 
+/* jsonParseElement: parse array element
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseElement(JsonReader *pJsonReader);
 
+/* jsonParseElementDelimiter: parse contents after array elements delimiter
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseElementDelimiter(JsonReader *pJsonReader);
 
+/* jsonParseArrayFinish: parse contents after array finish
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParseArrayFinish(JsonReader *pJsonReader);
 
+/* jsonReadKey: parse key
+ *
+ * pJsonReader: pointer of json reader
+ * keyBuf: buf to save key
+ * len: keyBuf length
+ * return: json reader error code
+ */
 JsonReaderError jsonReadKey(JsonReader *pJsonReader, char *keyBuf, size_t len);
 
+/* jsonReadMemberValue: parse member value
+ *
+ * pJsonReader: pointer of json reader
+ * memberValbuf: buf to save member value
+ * len: memberValbuf length
+ * return: json reader error code
+ */
 JsonReaderError jsonReadMemberValue(JsonReader *pJsonReader, char 
*memberValbuf, size_t len);
 
+/* jsonReadArrayValue: parse array value
+ *
+ * pJsonReader: pointer of json reader
+ * arrayValbuf: buf to save array value
+ * len: arrayValbuf length
+ * return: json reader error code
+ */
 JsonReaderError jsonReadArrayValue(JsonReader *pJsonReader, char *arrayValBuf, 
size_t len);
 
+/* jsonRead: parse stream to next state
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonRead(JsonReader *pJsonReader);
 
+/* jsonParse: parse stream to end if no error
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 JsonReaderError jsonParse(JsonReader *pJsonReader);
 
+/* jsonReaderFree: free json reader
+ *
+ * pJsonReader: pointer of json reader
+ * return: json reader error code
+ */
 void jsonReaderFree(JsonReader *pJsonReader);
 
-#endif //JSONREADER_H
\ No newline at end of file
+#endif //JSONREADER_H

Reply via email to