split qcbor.h into four separate headers (#34)

This is to make it much easier to read the header files.

Backwards compatibility with qcbor.h is retained, but use of qcbor/qcbor_encode.h and qcbor/qcbor_decode.h is preferred now.

Signed-off-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 1b6ff3e..fd3e57b 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -30,48 +30,8 @@
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  =============================================================================*/
 
-/*==============================================================================
- FILE:  qcbor_decode.c
 
- DESCRIPTION:  This file contains the implementation of QCBOR.
-
- EDIT HISTORY FOR FILE:
-
- This section contains comments describing changes made to the module.
- Notice that changes are listed in reverse chronological order.
-
- when       who             what, where, why
- --------   ----            ---------------------------------------------------
- 01/28/2020 llundblade      Refine integer signedness to quiet static analysis.
- 01/25/2020 llundblade      Cleaner handling of too-long encoded string input.
- 01/25/2020 llundblade      Refine use of integer types to quiet static analysis
- 01/08/2020 llundblade      Documentation corrections & improved code formatting
- 12/30/19   llundblade      Add support for decimal fractions and bigfloats.
- 11/07/19   llundblade      Fix long long conversion to double compiler warning
- 09/07/19   llundblade      Fix bug decoding empty arrays and maps
- 07/31/19   llundblade      Decode error fixes for some not-well-formed CBOR
- 07/31/19   llundblade      New error code for better end of data handling
- 02/17/19   llundblade      Fixed: QCBORItem.u{Data|Label}Alloc when
-                            bAllStrings set
- 02/16/19   llundblade      Redesign MemPool to fix memory access alignment bug
- 01/10/19   llundblade      Clever type and argument decoder; 250 bytes smaller
- 11/9/18    llundblade      Error codes are now enums.
- 11/2/18    llundblade      Simplify float decoding and align with preferred
-                            float encoding
- 10/31/18   llundblade      Switch to one license that is almost BSD-3.
- 10/28/18   llundblade      Reworked tag decoding
- 10/15/18   llundblade      Indefinite length maps and arrays supported
- 10/8/18    llundblade      Indefinite length strings supported
- 02/04/17   llundbla        Work on CPUs that don's require pointer alignment
-                            by making use of changes in UsefulBuf
- 03/01/17   llundbla        More data types; decoding improvements and fixes
- 11/13/16   llundbla        Integrate most TZ changes back into github version.
- 09/30/16   gkanike         Porting to TZ.
- 03/15/16   llundbla        Initial Version.
-
- =============================================================================*/
-
-#include "qcbor.h"
+#include "qcbor/qcbor_decode.h"
 #include "ieee754.h"
 
 
@@ -86,7 +46,8 @@
 /*===========================================================================
  DecodeNesting -- Functions for tracking array/map nesting when decoding
 
- See qcbor.h for definition of the object used here: QCBORDecodeNesting
+ See qcbor/qcbor_decode.h for definition of the object
+  used here: QCBORDecodeNesting
   ===========================================================================*/
 
 inline static int
@@ -390,7 +351,8 @@
 /*===========================================================================
  QCBORDecode -- The main implementation of CBOR decoding
 
- See qcbor.h for definition of the object used here: QCBORDecodeContext
+ See qcbor/qcbor_decode.h for definition of the object
+ used here: QCBORDecodeContext
   ===========================================================================*/
 /*
  Public function, see header file
@@ -1062,7 +1024,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 QCBORError QCBORDecode_GetNextMapOrArray(QCBORDecodeContext *me,
                                          QCBORItem *pDecodedItem,
@@ -1366,7 +1328,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 QCBORError
 QCBORDecode_GetNextWithTags(QCBORDecodeContext *me,
@@ -1434,7 +1396,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 QCBORError QCBORDecode_GetNext(QCBORDecodeContext *me, QCBORItem *pDecodedItem)
 {
@@ -1486,7 +1448,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 int QCBORDecode_IsTagged(QCBORDecodeContext *me,
                          const QCBORItem *pItem,
@@ -1507,7 +1469,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 QCBORError QCBORDecode_Finish(QCBORDecodeContext *me)
 {
@@ -1715,7 +1677,7 @@
 
 
 /*
- Public function, see header qcbor.h file
+ Public function, see header qcbor/qcbor_decode.h file
  */
 QCBORError QCBORDecode_SetMemPool(QCBORDecodeContext *pMe,
                                   UsefulBuf Pool,
diff --git a/src/qcbor_encode.c b/src/qcbor_encode.c
index 5cc0bd7..be72cd5 100644
--- a/src/qcbor_encode.c
+++ b/src/qcbor_encode.c
@@ -30,42 +30,8 @@
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  =============================================================================*/
 
-/*=============================================================================
- FILE:  qcbor_encode.c
 
- DESCRIPTION:  This file contains the implementation of QCBOR.
-
- EDIT HISTORY FOR FILE:
-
- This section contains comments describing changes made to the module.
- Notice that changes are listed in reverse chronological order.
-
- when       who            what, where, why
- --------   ----           ---------------------------------------------------
- 02/07/2020 llundblade     QCBOREncode_EncodeHead() and other for bstr hashing.
- 01/25/2020 llundblade     Refine use of integer types to quiet static analysis.
- 01/08/2020 llundblade     Documentation corrections & improved code formatting.
- 12/30/19   llundblade     Add support for decimal fractions and bigfloats.
- 8/7/19     llundblade     Prevent encoding simple type reserved values 24..31
- 7/25/19    janjongboom    Add indefinite length encoding for maps and arrays
- 4/6/19     llundblade     Wrapped bstr returned now includes the wrapping bstr.
- 12/30/18   llundblade     Small efficient clever encode of type & argument.
- 11/29/18   llundblade     Rework to simpler handling of tags and labels.
- 11/9/18    llundblade     Error codes are now enums.
- 11/1/18    llundblade     Floating support.
- 10/31/18   llundblade     Switch to one license that is almost BSD-3.
- 09/28/18   llundblade     Added bstr wrapping feature for COSE implementation.
- 02/05/18   llundbla       Works on CPUs which require integer alignment.
-                           Requires new version of UsefulBuf.
- 07/05/17   llundbla       Add bstr wrapping of maps/arrays for COSE
- 03/01/17   llundbla       More data types
- 11/13/16   llundbla       Integrate most TZ changes back into github version.
- 09/30/16   gkanike        Porting to TZ.
- 03/15/16   llundbla       Initial Version.
-
- =============================================================================*/
-
-#include "qcbor.h"
+#include "qcbor/qcbor_encode.h"
 #include "ieee754.h"
 
 
@@ -244,7 +210,7 @@
 
 
 /*
- Public function for initialization. See header qcbor.h
+ Public function for initialization. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_Init(QCBOREncodeContext *me, UsefulBuf Storage)
 {
@@ -255,7 +221,7 @@
 
 
 /*
- Public function for initialization. See header qcbor.h
+ Public function to encode a CBOR head. See qcbor/qcbor_encode.h
  */
 UsefulBufC QCBOREncode_EncodeHead(UsefulBuf buffer,
                                   uint8_t   uMajorType,
@@ -277,7 +243,7 @@
 
     The top three bits of the initial byte are the major type for the
     CBOR data item.  The eight major types defined by the standard are
-    defined as CBOR_MAJOR_TYPE_xxxx in qcbor.h.
+    defined as CBOR_MAJOR_TYPE_xxxx in qcbor/qcbor_common.h.
 
     The remaining five bits, known as "additional information", and
     possibly more bytes encode the argument. If the argument is less than
@@ -504,7 +470,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for adding integers. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddUInt64(QCBOREncodeContext *me, uint64_t uValue)
 {
@@ -516,7 +482,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for adding unsigned. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddInt64(QCBOREncodeContext *me, int64_t nNum)
 {
@@ -543,7 +509,7 @@
  Semi-private function. It is exposed to user of the interface, but
  they will usually call one of the inline wrappers rather than this.
 
- See qcbor.h
+ See qcbor/qcbor_encode.h
 
  Does the work of adding actual strings bytes to the CBOR output (as
  opposed to numbers and opening / closing aggregate types).
@@ -583,7 +549,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for adding a tag. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddTag(QCBOREncodeContext *me, uint64_t uTag)
 {
@@ -595,7 +561,7 @@
  Semi-private function. It is exposed to user of the interface,
  but they will usually call one of the inline wrappers rather than this.
 
- See header qcbor.h
+ See header qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddType7(QCBOREncodeContext *me, uint8_t uMinLen, uint64_t uNum)
 {
@@ -612,7 +578,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for adding a double. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddDouble(QCBOREncodeContext *me, double dNum)
 {
@@ -627,7 +593,7 @@
  Semi-public function. It is exposed to the user of the interface, but
  one of the inline wrappers will usually be called rather than this.
 
- See qcbor.h
+ See qcbor/qcbor_encode.h
  */
 void QCBOREncode_AddExponentAndMantissa(QCBOREncodeContext *pMe,
                                         uint64_t            uTag,
@@ -664,7 +630,7 @@
  Semi-public function. It is exposed to user of the interface,
  but they will usually call one of the inline wrappers rather than this.
 
- See header qcbor.h
+ See qcbor/qcbor_encode.h
 */
 void QCBOREncode_OpenMapOrArray(QCBOREncodeContext *me, uint8_t uMajorType)
 {
@@ -705,7 +671,7 @@
  Semi-public function. It is exposed to user of the interface,
  but they will usually call one of the inline wrappers rather than this.
 
- See qcbor.h
+ See qcbor/qcbor_encode.h
 */
 void QCBOREncode_OpenMapOrArrayIndefiniteLength(QCBOREncodeContext *me, uint8_t uMajorType)
 {
@@ -719,7 +685,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for closing arrays and maps. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_CloseMapOrArray(QCBOREncodeContext *me, uint8_t uMajorType)
 {
@@ -728,7 +694,7 @@
 
 
 /*
- Public functions for closing bstr wrapping. See qcbor.h
+ Public functions for closing bstr wrapping. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_CloseBstrWrap2(QCBOREncodeContext *me, bool bIncludeCBORHead, UsefulBufC *pWrappedCBOR)
 {
@@ -765,7 +731,7 @@
 
 
 /*
- Public functions for closing arrays and maps. See qcbor.h
+ Public functions for closing arrays and maps. See qcbor/qcbor_encode.h
  */
 void QCBOREncode_CloseMapOrArrayIndefiniteLength(QCBOREncodeContext *me, uint8_t uMajorType)
 {
@@ -785,7 +751,7 @@
 
 
 /*
- Public functions to finish and get the encoded result. See qcbor.h
+ Public functions to finish and get the encoded result. See qcbor/qcbor_encode.h
  */
 QCBORError QCBOREncode_Finish(QCBOREncodeContext *me, UsefulBufC *pEncodedCBOR)
 {
@@ -808,7 +774,7 @@
 
 
 /*
- Public functions to finish and get the encoded result. See qcbor.h
+ Public functions to finish and get the encoded result. See qcbor/qcbor_encode.h
  */
 QCBORError QCBOREncode_FinishGetSize(QCBOREncodeContext *me, size_t *puEncodedLen)
 {