Index: branches/BNC_2.12/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h
===================================================================
--- branches/BNC_2.12/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h	(revision 8943)
+++ branches/BNC_2.12/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h	(revision 8987)
@@ -13,13 +13,22 @@
 #include <string.h>
 
-enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
+
+
+
+
+
+enum SatelliteReferenceDatum {
+  DATUM_ITRF  = 0,
+  DATUM_LOCAL = 1
+};
 
 enum COR_BASE {
-  COBBASE_GPS = 1057,
+  COBBASE_GPS     = 1057,
   COBBASE_GLONASS = 1063,
   COBBASE_GALILEO = 1240,
-  COBBASE_QZSS = 1246,
-  COBBASE_SBAS = 1252,
-  COBBASE_BDS = 1258,
+  COBBASE_QZSS    = 1246,
+  COBBASE_SBAS    = 1252,
+  COBBASE_BDS     = 1258,
+  COBBASE_NUM
 };
 
@@ -27,5 +36,5 @@
   COBOFS_ORBIT = 0,
   COBOFS_CLOCK,
-  COBOFS_BIAS,
+  COBOFS_CBIAS,
   COBOFS_COMBINED,
   COBOFS_URA,
@@ -35,11 +44,11 @@
 
 enum ClockOrbitType {
-  COTYPE_GPSORBIT = COBBASE_GPS + COBOFS_ORBIT,
+  COTYPE_GPSORBIT        = COBBASE_GPS     + COBOFS_ORBIT,
   COTYPE_GPSCLOCK,
-  COTYPE_GPSCOMBINED = COBBASE_GPS + COBOFS_COMBINED,
+  COTYPE_GPSCOMBINED     = COBBASE_GPS     + COBOFS_COMBINED,
   COTYPE_GPSURA,
   COTYPE_GPSHR,
 
-  COTYPE_GLONASSORBIT = COBBASE_GLONASS + COBOFS_ORBIT,
+  COTYPE_GLONASSORBIT    = COBBASE_GLONASS + COBOFS_ORBIT,
   COTYPE_GLONASSCLOCK,
   COTYPE_GLONASSCOMBINED = COBBASE_GLONASS + COBOFS_COMBINED,
@@ -47,5 +56,5 @@
   COTYPE_GLONASSHR,
 
-  COTYPE_GALILEOORBIT = COBBASE_GALILEO + COBOFS_ORBIT,
+  COTYPE_GALILEOORBIT    = COBBASE_GALILEO + COBOFS_ORBIT,
   COTYPE_GALILEOCLOCK,
   COTYPE_GALILEOCOMBINED = COBBASE_GALILEO + COBOFS_COMBINED,
@@ -53,19 +62,19 @@
   COTYPE_GALILEOHR,
 
-  COTYPE_QZSSORBIT = COBBASE_QZSS + COBOFS_ORBIT,
+  COTYPE_QZSSORBIT       = COBBASE_QZSS    + COBOFS_ORBIT,
   COTYPE_QZSSCLOCK,
-  COTYPE_QZSSCOMBINED = COBBASE_QZSS + COBOFS_COMBINED,
+  COTYPE_QZSSCOMBINED    = COBBASE_QZSS    + COBOFS_COMBINED,
   COTYPE_QZSSURA,
   COTYPE_QZSSHR,
 
-  COTYPE_SBASORBIT = COBBASE_SBAS + COBOFS_ORBIT,
+  COTYPE_SBASORBIT       = COBBASE_SBAS    + COBOFS_ORBIT,
   COTYPE_SBASCLOCK,
-  COTYPE_SBASCOMBINED = COBBASE_SBAS + COBOFS_COMBINED,
+  COTYPE_SBASCOMBINED    = COBBASE_SBAS    + COBOFS_COMBINED,
   COTYPE_SBASURA,
   COTYPE_SBASHR,
 
-  COTYPE_BDSORBIT = COBBASE_BDS + COBOFS_ORBIT,
+  COTYPE_BDSORBIT        = COBBASE_BDS     + COBOFS_ORBIT,
   COTYPE_BDSCLOCK,
-  COTYPE_BDSCOMBINED = COBBASE_BDS + COBOFS_COMBINED,
+  COTYPE_BDSCOMBINED     = COBBASE_BDS + COBOFS_COMBINED,
   COTYPE_BDSURA,
   COTYPE_BDSHR,
@@ -75,16 +84,16 @@
 
 enum CodeBiasType {
-  BTYPE_GPS = COBBASE_GPS + COBOFS_BIAS,
-  BTYPE_GLONASS = COBBASE_GLONASS + COBOFS_BIAS,
-  BTYPE_GALILEO = COBBASE_GALILEO + COBOFS_BIAS,
-  BTYPE_QZSS = COBBASE_QZSS + COBOFS_BIAS,
-  BTYPE_SBAS = COBBASE_SBAS + COBOFS_BIAS,
-  BTYPE_BDS = COBBASE_BDS + COBOFS_BIAS,
-  BTYPE_AUTO = 0
-};
-
-enum PhaseBiasType {
-  PBTYPE_BASE = 1265,
-  PBTYPE_GPS = PBTYPE_BASE,
+  CBTYPE_GPS     = COBBASE_GPS     + COBOFS_CBIAS,
+  CBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_CBIAS,
+  CBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_CBIAS,
+  CBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_CBIAS,
+  CBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_CBIAS,
+  CBTYPE_BDS     = COBBASE_BDS     + COBOFS_CBIAS,
+  CBTYPE_AUTO    = 0
+};
+
+enum PhaseBiasType{
+  PBTYPE_BASE    = 1265,
+  PBTYPE_GPS     = PBTYPE_BASE,
   PBTYPE_GLONASS,
   PBTYPE_GALILEO,
@@ -92,5 +101,5 @@
   PBTYPE_SBAS,
   PBTYPE_BDS,
-  PBTYPE_AUTO = 0
+  PBTYPE_AUTO    = 0
 };
 
@@ -102,15 +111,15 @@
 for these systems to save space */
 enum COR_CONSTANTS {
-  CLOCKORBIT_BUFFERSIZE=8192,
-  CLOCKORBIT_NUMGPS=32,
-  CLOCKORBIT_NUMGLONASS=26,
-  CLOCKORBIT_NUMGALILEO=36,
-  CLOCKORBIT_NUMQZSS=10,
-  CLOCKORBIT_NUMSBAS=38,
-  CLOCKORBIT_NUMBDS=65,
-  CLOCKORBIT_NUMBIAS=100,
-  CLOCKORBIT_NUMIONOLAYERS=4,
-  CLOCKORBIT_MAXIONOORDER=16,
-  CLOCKORBIT_MAXIONODEGREE=16
+  CLOCKORBIT_BUFFERSIZE    = 8192,
+  CLOCKORBIT_NUMGPS        =   32,
+  CLOCKORBIT_NUMGLONASS    =   26,
+  CLOCKORBIT_NUMGALILEO    =   36,
+  CLOCKORBIT_NUMQZSS       =   10,
+  CLOCKORBIT_NUMSBAS       =   38,
+  CLOCKORBIT_NUMBDS        =   65,
+  CLOCKORBIT_NUMBIAS       =  100,
+  CLOCKORBIT_NUMIONOLAYERS =    4,
+  CLOCKORBIT_MAXIONOORDER  =   16,
+  CLOCKORBIT_MAXIONODEGREE =   16
 };
 
@@ -126,16 +135,14 @@
 
 enum COR_OFFSETS {
-  CLOCKORBIT_OFFSETGPS=0,
-  CLOCKORBIT_OFFSETGLONASS=CLOCKORBIT_NUMGPS,
-  CLOCKORBIT_OFFSETGALILEO=CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS,
-  CLOCKORBIT_OFFSETQZSS=CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS
-  +CLOCKORBIT_NUMGALILEO,
-  CLOCKORBIT_OFFSETSBAS=CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS
-  +CLOCKORBIT_NUMGALILEO+CLOCKORBIT_NUMQZSS,
-  CLOCKORBIT_OFFSETBDS=CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS
-  +CLOCKORBIT_NUMGALILEO+CLOCKORBIT_NUMQZSS+CLOCKORBIT_NUMSBAS,
-  CLOCKORBIT_COUNTSAT=CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS
-  +CLOCKORBIT_NUMGALILEO+CLOCKORBIT_NUMQZSS+CLOCKORBIT_NUMSBAS
-  +CLOCKORBIT_NUMBDS
+  CLOCKORBIT_OFFSETGPS     = 0,
+  CLOCKORBIT_OFFSETGLONASS = CLOCKORBIT_NUMGPS,
+  CLOCKORBIT_OFFSETGALILEO = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS,
+  CLOCKORBIT_OFFSETQZSS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO,
+  CLOCKORBIT_OFFSETSBAS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
+                           + CLOCKORBIT_NUMQZSS,
+  CLOCKORBIT_OFFSETBDS     = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
+                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS,
+  CLOCKORBIT_COUNTSAT      = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
+                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS    + CLOCKORBIT_NUMBDS
 };
 
@@ -220,4 +227,5 @@
   CODETYPE_SBAS_L5_Q         = 2,
   CODETYPE_SBAS_L5_IQ        = 3,
+
   CODETYPE_BDS_B1_I          = 0,
   CODETYPE_BDS_B1_Q          = 1,
@@ -234,8 +242,5 @@
   CODETYPE_BDS_B2a_D         = 12,
   CODETYPE_BDS_B2a_P         = 13,
-  CODETYPE_BDS_B2a_DP        = 14,
-
-  CODETYPE_IRNSS_S_SPS       = 8,
-  CODETYPE_IRNSS_L5_SPS      = 22
+  CODETYPE_BDS_B2a_DP        = 14
 };
 
@@ -247,33 +252,9 @@
 xxx->Sat[CLOCKORBIT_OFFSETGPS]. */
 
-#ifdef COR_LEGACY
-/* old names */
-#define NumberOfGPSSat     NumberOfSat[CLOCKORBIT_SATGPS]
-#define NumberOfGLONASSSat NumberOfSat[CLOCKORBIT_SATGLONASS]
-#define GPSEpochTime       EpochTime[CLOCKORBIT_SATGPS] /* 0 .. 604799 s */
-#define GLONASSEpochTime   EpochTime[CLOCKORBIT_SATGLONASS] /* 0 .. 86399 s (86400 for leap second) */
-#define ClockDataSupplied  Supplied[COBOFS_CLOCK]
-#define HRDataSupplied     Supplied[COBOFS_HR]
-#define OrbitDataSupplied  Supplied[COBOFS_ORBIT]
-#define URADataSupplied    Supplied[COBOFS_URA]
-#define GetClockOrbitBias(a,b,c,d,e) GetSSR(a,b,0,0,c,d,e)
-#endif /* COR_LEGACY */
-
-/* latency check code, disabled by default */
-#ifdef COR_LATENCY
-#define COR_LATENCYCOUNT 100
-#endif
-
-struct ClockOrbit
-{
+struct ClockOrbit {
   enum ClockOrbitType messageType;
   unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
   unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-
   unsigned int Supplied[COBOFS_NUM];           /* boolean */
-#ifdef COR_LATENCY
-  unsigned int epochGPS[COR_LATENCYCOUNT+1];   /* Weber, for latency */
-  unsigned int epochSize;                      /* Weber, for latency */
-#endif
   unsigned int SSRIOD;
   unsigned int SSRProviderID;
@@ -287,6 +268,5 @@
     double UserRangeAccuracy; /* accuracy values in [m] */
     double hrclock;
-    struct OrbitPart
-    {
+    struct OrbitPart {
       double DeltaRadial;           /* m */
       double DeltaAlongTrack;       /* m */
@@ -296,6 +276,5 @@
       double DotDeltaCrossTrack;    /* m/s */
     } Orbit;
-    struct ClockPart
-    {
+    struct ClockPart {
       double DeltaA0;               /* m */
       double DeltaA1;               /* m/s */
@@ -305,6 +284,5 @@
 };
 
-struct CodeBias
-{
+struct CodeBias {
   enum CodeBiasType messageType;
   unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
@@ -314,10 +292,8 @@
   unsigned int SSRProviderID;
   unsigned int SSRSolutionID;
-  struct BiasSat
-  {
+  struct BiasSat {
     unsigned int ID; /* all */
     unsigned int NumberOfCodeBiases;
-    struct CodeBiasEntry
-    {
+    struct CodeBiasEntry {
       enum CodeType Type;
       float         Bias;           /* m */
@@ -326,6 +302,5 @@
 };
 
-struct PhaseBias
-{
+struct PhaseBias {
   enum PhaseBiasType messageType;
   unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
@@ -337,12 +312,10 @@
   unsigned int DispersiveBiasConsistencyIndicator;
   unsigned int MWConsistencyIndicator;
-  struct PhaseBiasSat
-  {
+  struct PhaseBiasSat {
     unsigned int ID; /* all */
     unsigned int NumberOfPhaseBiases;
     double YawAngle; /* radiant */
     double YawRate;  /* radiant/s */
-    struct PhaseBiasEntry
-    {
+    struct PhaseBiasEntry {
       enum CodeType Type;
       unsigned int  SignalIntegerIndicator;
@@ -354,6 +327,5 @@
 };
 
-struct VTEC
-{
+struct VTEC {
   unsigned int EpochTime; /* GPS */
   unsigned int UpdateInterval;
@@ -384,22 +356,22 @@
 enum GCOB_RETURN {
   /* all well */
-  GCOBR_MESSAGEFOLLOWS = 1,
-  GCOBR_OK = 0,
+  GCOBR_MESSAGEFOLLOWS        =  1,
+  GCOBR_OK                    =  0,
   /* unknown data, a warning */
-  GCOBR_UNKNOWNTYPE = -1,
-  GCOBR_UNKNOWNDATA = -2,
-  GCOBR_CRCMISMATCH = -3,
-  GCOBR_SHORTMESSAGE = -4,
+  GCOBR_UNKNOWNTYPE           = -1,
+  GCOBR_UNKNOWNDATA           = -2,
+  GCOBR_CRCMISMATCH           = -3,
+  GCOBR_SHORTMESSAGE          = -4,
   /* failed to do the work */
   GCOBR_NOCLOCKORBITPARAMETER = -10,
-  GCOBR_NOCODEBIASPARAMETER = -11,
-  GCOBR_NOPHASEBIASPARAMETER = -12,
-  GCOBR_NOVTECPARAMETER = -13,
+  GCOBR_NOCODEBIASPARAMETER   = -11,
+  GCOBR_NOPHASEBIASPARAMETER  = -12,
+  GCOBR_NOVTECPARAMETER       = -13,
   /* data mismatch - data in storage does not match new data */
-  GCOBR_TIMEMISMATCH = -20,
-  GCOBR_DATAMISMATCH = -21,
+  GCOBR_TIMEMISMATCH          = -20,
+  GCOBR_DATAMISMATCH          = -21,
   /* not enough data - can decode the block completely */
-  GCOBR_SHORTBUFFER = -30,
-  GCOBR_MESSAGEEXCEEDSBUFFER = -31};
+  GCOBR_SHORTBUFFER           = -30,
+  GCOBR_MESSAGEEXCEEDSBUFFER  = -31};
 
 /* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
